Changeset cea3fca in mainline
- Timestamp:
- 2010-12-16T10:22:07Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 70e5ad5
- Parents:
- f37f811
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbvirt/include/usbvirt/device.h
rf37f811 rcea3fca 40 40 #include <usb/devreq.h> 41 41 42 typedef enum { 42 /** Request type of a control transfer. */ 43 typedef enum { 44 /** Standard USB request. */ 43 45 USBVIRT_REQUEST_TYPE_STANDARD = 0, 46 /** Standard class USB request. */ 44 47 USBVIRT_REQUEST_TYPE_CLASS = 1 45 48 } usbvirt_request_type_t; 46 49 47 typedef enum { 50 /** Recipient of control request. */ 51 typedef enum { 52 /** Device is the recipient of the control request. */ 48 53 USBVIRT_REQUEST_RECIPIENT_DEVICE = 0, 54 /** Interface is the recipient of the control request. */ 49 55 USBVIRT_REQUEST_RECIPIENT_INTERFACE = 1, 56 /** Endpoint is the recipient of the control request. */ 50 57 USBVIRT_REQUEST_RECIPIENT_ENDPOINT = 2, 58 /** Other part of the device is the recipient of the control request. */ 51 59 USBVIRT_REQUEST_RECIPIENT_OTHER = 3 52 60 } usbvirt_request_recipient_t; … … 56 64 */ 57 65 typedef enum { 66 /** Default state, device listens at default address. */ 58 67 USBVIRT_STATE_DEFAULT, 68 /** Device has non-default address assigned. */ 59 69 USBVIRT_STATE_ADDRESS, 70 /** Device is configured. */ 60 71 USBVIRT_STATE_CONFIGURED 61 72 } usbvirt_device_state_t; … … 68 79 uint8_t *data); 69 80 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 */ 70 88 typedef int (*usbvirt_control_request_callback_t)(usbvirt_device_t *dev, 71 89 usb_device_request_setup_packet_t *request, 72 90 uint8_t *data); 73 91 74 typedef struct { 92 /** Handler for control transfer on endpoint zero. */ 93 typedef struct { 94 /** Request type bitmap. 95 * Use USBVIRT_MAKE_CONTROL_REQUEST_TYPE for creating the bitmap. 96 */ 75 97 uint8_t request_type; 98 /** Request code. */ 76 99 uint8_t request; 100 /** Request name for debugging. */ 77 101 const char *name; 102 /** Callback for the request. 103 * NULL value here announces end of a list. 104 */ 78 105 usbvirt_control_request_callback_t callback; 79 106 } usbvirt_control_transfer_handler_t; 80 107 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 */ 81 115 #define USBVIRT_MAKE_CONTROL_REQUEST_TYPE(direction, type, recipient) \ 82 116 ((((direction) == USB_DIRECTION_IN) ? 1 : 0) << 7) \ … … 84 118 | (((recipient) & 31)) 85 119 120 /** Create last item in an array of control request handlers. */ 86 121 #define USBVIRT_CONTROL_TRANSFER_HANDLER_LAST { 0, 0, NULL, NULL } 87 122
Note:
See TracChangeset
for help on using the changeset viewer.