Changes in uspace/lib/usbvirt/include/usbvirt/device.h [d93f5afb:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbvirt/include/usbvirt/device.h
rd93f5afb r9d58539 40 40 #include <usb/dev/request.h> 41 41 #include <async.h> 42 #include <errno.h>43 44 42 45 43 /** Maximum number of endpoints supported by virtual USB. */ … … 59 57 typedef int (*usbvirt_on_data_to_device_t)(usbvirt_device_t *dev, 60 58 usb_endpoint_t endpoint, usb_transfer_type_t transfer_type, 61 constvoid *buffer, size_t buffer_size);59 void *buffer, size_t buffer_size); 62 60 63 61 /** Callback for data from device (IN transaction). … … 90 88 uint8_t *data, size_t *act_data_size); 91 89 92 /** Create a class request to get data from device93 *94 * @param rec Request recipient.95 * @param req Request code.96 */97 #define CLASS_REQ_IN(rec, req) \98 .request_type = SETUP_REQUEST_TO_HOST(USB_REQUEST_TYPE_CLASS, rec), \99 .request = req100 101 /** Create a class request to send data to device102 *103 * @param rec Request recipient.104 * @param req Request code.105 */106 #define CLASS_REQ_OUT(rec, req) \107 .request_type = SETUP_REQUEST_TO_DEVICE(USB_REQUEST_TYPE_CLASS, rec), \108 .request = req109 110 /** Create a standard request to get data from device111 *112 * @param rec Request recipient.113 * @param req Request code.114 */115 #define STD_REQ_IN(rec, req) \116 .request_type = SETUP_REQUEST_TO_HOST(USB_REQUEST_TYPE_STANDARD, rec), \117 .request = req118 119 /** Create a standard request to send data to device120 *121 * @param rec Request recipient.122 * @param req Request code.123 */124 #define STD_REQ_OUT(rec, req) \125 .request_type = SETUP_REQUEST_TO_DEVICE(USB_REQUEST_TYPE_STANDARD, rec), \126 .request = req127 128 90 /** Callback for control request on a virtual USB device. 129 91 * … … 132 94 */ 133 95 typedef struct { 134 /* Request type. See usb/request.h */ 135 uint8_t request_type; 96 /** Request direction (in or out). */ 97 usb_direction_t req_direction; 98 /** Request recipient (device, interface or endpoint). */ 99 usb_request_recipient_t req_recipient; 100 /** Request type (standard, class or vendor). */ 101 usb_request_type_t req_type; 136 102 /** Actual request code. */ 137 103 uint8_t request; … … 145 111 typedef struct { 146 112 /** Actual data. */ 147 constuint8_t *data;113 uint8_t *data; 148 114 /** Data length. */ 149 115 size_t length; … … 155 121 usb_standard_configuration_descriptor_t *descriptor; 156 122 /** Array of extra data. */ 157 constusbvirt_device_configuration_extras_t *extra;123 usbvirt_device_configuration_extras_t *extra; 158 124 /** Length of @c extra array. */ 159 125 size_t extra_count; … … 165 131 * There is always only one such descriptor for the device. 166 132 */ 167 constusb_standard_device_descriptor_t *device;133 usb_standard_device_descriptor_t *device; 168 134 169 135 /** Configurations. */ … … 198 164 * Last handler is expected to have the @c callback field set to NULL 199 165 */ 200 constusbvirt_control_request_handler_t *control;166 usbvirt_control_request_handler_t *control; 201 167 /** Callback when device changes state. 202 168 * … … 214 180 /** Virtual USB device. */ 215 181 struct usbvirt_device { 216 /** Device does not require USB bus power */217 bool self_powered;218 /** Device is allowed to signal remote wakeup */219 bool remote_wakeup;220 182 /** Name for debugging purposes. */ 221 183 const char *name; … … 225 187 usbvirt_device_ops_t *ops; 226 188 /** Device descriptors. */ 227 constusbvirt_descriptors_t *descriptors;189 usbvirt_descriptors_t *descriptors; 228 190 /** Current device address. 229 191 * You shall treat this field as read only in your code. … … 240 202 }; 241 203 242 243 int req_nop(usbvirt_device_t *device,244 const usb_device_request_setup_packet_t *setup_packet,245 uint8_t *data, size_t *act_size);246 247 204 int usbvirt_device_plug(usbvirt_device_t *, const char *); 248 205 void usbvirt_device_unplug(usbvirt_device_t *); 249 206 250 207 void usbvirt_control_reply_helper(const usb_device_request_setup_packet_t *, 251 uint8_t *, size_t *, constvoid *, size_t);252 253 int usbvirt_control_write(usbvirt_device_t *, constvoid *, size_t, void *, size_t);254 int usbvirt_control_read(usbvirt_device_t *, constvoid *, size_t, void *, size_t, size_t *);208 uint8_t *, size_t *, void *, size_t); 209 210 int usbvirt_control_write(usbvirt_device_t *, void *, size_t, void *, size_t); 211 int usbvirt_control_read(usbvirt_device_t *, void *, size_t, void *, size_t, size_t *); 255 212 int usbvirt_data_out(usbvirt_device_t *, usb_transfer_type_t, usb_endpoint_t, 256 constvoid *, size_t);213 void *, size_t); 257 214 int usbvirt_data_in(usbvirt_device_t *, usb_transfer_type_t, usb_endpoint_t, 258 215 void *, size_t, size_t *);
Note:
See TracChangeset
for help on using the changeset viewer.