Changeset 0cec844 in mainline for uspace/lib/usb/include/usb/devdrv.h
- Timestamp:
- 2011-04-03T17:39:48Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3094804b, baa9d5d, c593b21
- Parents:
- b8f7a0d2 (diff), 0b4e7ca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/devdrv.h
rb8f7a0d2 r0cec844 47 47 } usb_device_descriptors_t; 48 48 49 /** Wrapper for data related to alternate interface setting. 50 * The pointers will typically point inside configuration descriptor and 51 * thus you shall not deallocate them. 52 */ 53 typedef struct { 54 /** Interface descriptor. */ 55 usb_standard_interface_descriptor_t *interface; 56 /** Pointer to start of descriptor tree bound with this interface. */ 57 uint8_t *nested_descriptors; 58 /** Size of data pointed by nested_descriptors in bytes. */ 59 size_t nested_descriptors_size; 60 } usb_alternate_interface_descriptors_t; 61 62 /** Alternate interface settings. */ 63 typedef struct { 64 /** Array of alternate interfaces descriptions. */ 65 usb_alternate_interface_descriptors_t *alternatives; 66 /** Size of @c alternatives array. */ 67 size_t alternative_count; 68 /** Index of currently selected one. */ 69 size_t current; 70 } usb_alternate_interfaces_t; 71 49 72 /** USB device structure. */ 50 73 typedef struct { … … 56 79 */ 57 80 usb_endpoint_mapping_t *pipes; 81 /** Number of other endpoint pipes. */ 82 size_t pipes_count; 58 83 /** Current interface. 59 84 * Usually, drivers operate on single interface only. … … 61 86 */ 62 87 int interface_no; 88 89 /** Alternative interfaces. 90 * Set to NULL when the driver controls whole device 91 * (i.e. more (or any) interfaces). 92 */ 93 usb_alternate_interfaces_t *alternate_interfaces; 63 94 64 95 /** Some useful descriptors. */ … … 92 123 */ 93 124 const char *name; 94 /** Expected endpoints description, excluding default control endpoint. 125 /** Expected endpoints description. 126 * This description shall exclude default control endpoint (pipe zero) 127 * and must be NULL terminated. 128 * When only control endpoint is expected, you may set NULL directly 129 * without creating one item array containing NULL. 95 130 * 96 * It MUST be of size expected_enpoints_count(excluding default ctrl) + 1 97 * where the last record MUST BE NULL, otherwise catastrophic things may 98 * happen. 131 * When the driver expect single interrupt in endpoint, 132 * the initialization may look like this: 133 \code 134 static usb_endpoint_description_t poll_endpoint_description = { 135 .transfer_type = USB_TRANSFER_INTERRUPT, 136 .direction = USB_DIRECTION_IN, 137 .interface_class = USB_CLASS_HUB, 138 .interface_subclass = 0, 139 .interface_protocol = 0, 140 .flags = 0 141 }; 142 143 static usb_endpoint_description_t *hub_endpoints[] = { 144 &poll_endpoint_description, 145 NULL 146 }; 147 148 static usb_driver_t hub_driver = { 149 .endpoints = hub_endpoints, 150 ... 151 }; 152 \endcode 99 153 */ 100 154 usb_endpoint_description_t **endpoints; … … 105 159 int usb_driver_main(usb_driver_t *); 106 160 161 int usb_device_select_interface(usb_device_t *, uint8_t, 162 usb_endpoint_description_t **); 163 107 164 typedef bool (*usb_polling_callback_t)(usb_device_t *, 108 165 uint8_t *, size_t, void *); 109 166 typedef void (*usb_polling_terminted_callback_t)(usb_device_t *, bool, void *); 110 111 167 112 168 int usb_device_auto_poll(usb_device_t *, size_t,
Note:
See TracChangeset
for help on using the changeset viewer.