Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset cea3fca in mainline


Ignore:
Timestamp:
2010-12-16T10:22:07Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
70e5ad5
Parents:
f37f811
Message:

Add doxygen comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbvirt/include/usbvirt/device.h

    rf37f811 rcea3fca  
    4040#include <usb/devreq.h>
    4141
    42 typedef enum {
     42/** Request type of a control transfer. */
     43typedef enum {
     44        /** Standard USB request. */
    4345        USBVIRT_REQUEST_TYPE_STANDARD = 0,
     46        /** Standard class USB request. */
    4447        USBVIRT_REQUEST_TYPE_CLASS = 1
    4548} usbvirt_request_type_t;
    4649
    47 typedef enum {
     50/** Recipient of control request. */
     51typedef enum {
     52        /** Device is the recipient of the control request. */
    4853        USBVIRT_REQUEST_RECIPIENT_DEVICE = 0,
     54        /** Interface is the recipient of the control request. */
    4955        USBVIRT_REQUEST_RECIPIENT_INTERFACE = 1,
     56        /** Endpoint is the recipient of the control request. */
    5057        USBVIRT_REQUEST_RECIPIENT_ENDPOINT = 2,
     58        /** Other part of the device is the recipient of the control request. */
    5159        USBVIRT_REQUEST_RECIPIENT_OTHER = 3
    5260} usbvirt_request_recipient_t;
     
    5664 */
    5765typedef enum {
     66        /** Default state, device listens at default address. */
    5867        USBVIRT_STATE_DEFAULT,
     68        /** Device has non-default address assigned. */
    5969        USBVIRT_STATE_ADDRESS,
     70        /** Device is configured. */
    6071        USBVIRT_STATE_CONFIGURED
    6172} usbvirt_device_state_t;
     
    6879        uint8_t *data);
    6980
     81/** Callback for control request over pipe zero.
     82 *
     83 * @param dev Virtual device answering the call.
     84 * @param request Request setup packet.
     85 * @param data Data when DATA stage is present.
     86 * @return Error code.
     87 */
    7088typedef int (*usbvirt_control_request_callback_t)(usbvirt_device_t *dev,
    7189        usb_device_request_setup_packet_t *request,
    7290        uint8_t *data);
    7391
    74 typedef struct {
     92/** Handler for control transfer on endpoint zero. */
     93typedef struct {
     94        /** Request type bitmap.
     95         * Use USBVIRT_MAKE_CONTROL_REQUEST_TYPE for creating the bitmap.
     96         */
    7597        uint8_t request_type;
     98        /** Request code. */
    7699        uint8_t request;
     100        /** Request name for debugging. */
    77101        const char *name;
     102        /** Callback for the request.
     103         * NULL value here announces end of a list.
     104         */
    78105        usbvirt_control_request_callback_t callback;
    79106} usbvirt_control_transfer_handler_t;
    80107
     108/** Create control request type bitmap.
     109 *
     110 * @param direction Transfer direction (use usb_direction_t).
     111 * @param type Request type (use usbvirt_request_type_t).
     112 * @param recipient Recipient of the request (use usbvirt_request_recipient_t).
     113 * @return Request type bitmap.
     114 */
    81115#define USBVIRT_MAKE_CONTROL_REQUEST_TYPE(direction, type, recipient) \
    82116        ((((direction) == USB_DIRECTION_IN) ? 1 : 0) << 7) \
     
    84118        | (((recipient) & 31))
    85119
     120/** Create last item in an array of control request handlers. */
    86121#define USBVIRT_CONTROL_TRANSFER_HANDLER_LAST { 0, 0, NULL, NULL }
    87122
Note: See TracChangeset for help on using the changeset viewer.