Changeset f8e8738 in mainline for uspace/lib/usb/include
- Timestamp:
- 2011-04-07T20:22:40Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fee6381
- Parents:
- 61257f4 (diff), a82889e (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. - Location:
- uspace/lib/usb/include/usb
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/devdrv.h
r61257f4 rf8e8738 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, -
uspace/lib/usb/include/usb/host/batch.h
r61257f4 rf8e8738 39 39 #include <usbhc_iface.h> 40 40 #include <usb/usb.h> 41 #include <usb/host/endpoint.h> 41 42 42 43 typedef struct usb_transfer_batch usb_transfer_batch_t; … … 60 61 ddf_fun_t *fun; 61 62 void *arg; 63 endpoint_t *ep; 62 64 void *private_data; 63 65 }; … … 78 80 void *arg, 79 81 ddf_fun_t *fun, 82 endpoint_t *ep, 80 83 void *private_data 81 84 ); -
uspace/lib/usb/include/usb/host/device_keeper.h
r61257f4 rf8e8738 40 40 #ifndef LIBUSB_HOST_DEVICE_KEEPER_H 41 41 #define LIBUSB_HOST_DEVICE_KEEPER_H 42 43 #include <adt/list.h> 42 44 #include <devman.h> 43 45 #include <fibril_synch.h> 44 46 #include <usb/usb.h> 47 #include <usb/host/endpoint.h> 45 48 46 49 /** Number of USB address for array dimensions. */ … … 51 54 usb_speed_t speed; 52 55 bool occupied; 53 bool control_used;54 uint16_t toggle_status[2];56 link_t endpoints; 57 uint16_t control_used; 55 58 devman_handle_t handle; 56 59 }; … … 68 71 void usb_device_keeper_init(usb_device_keeper_t *instance); 69 72 70 void usb_device_keeper_reserve_default_address(usb_device_keeper_t *instance, 71 usb_speed_t speed); 73 void usb_device_keeper_add_ep( 74 usb_device_keeper_t *instance, usb_address_t address, endpoint_t *ep); 75 76 void usb_device_keeper_reserve_default_address( 77 usb_device_keeper_t *instance, usb_speed_t speed); 72 78 73 79 void usb_device_keeper_release_default_address(usb_device_keeper_t *instance); 74 80 75 81 void usb_device_keeper_reset_if_need(usb_device_keeper_t *instance, 76 usb_target_t target, 77 const uint8_t *setup_data); 78 79 int usb_device_keeper_get_toggle(usb_device_keeper_t *instance, 80 usb_target_t target, usb_direction_t direction); 81 82 int usb_device_keeper_set_toggle(usb_device_keeper_t *instance, 83 usb_target_t target, usb_direction_t direction, bool toggle); 82 usb_target_t target, const uint8_t *setup_data); 84 83 85 84 usb_address_t device_keeper_get_free_address(usb_device_keeper_t *instance, … … 99 98 100 99 void usb_device_keeper_use_control(usb_device_keeper_t *instance, 101 usb_ address_t address);100 usb_target_t target); 102 101 103 102 void usb_device_keeper_release_control(usb_device_keeper_t *instance, 104 usb_ address_t address);103 usb_target_t target); 105 104 106 105 #endif -
uspace/lib/usb/include/usb/pipes.h
r61257f4 rf8e8738 107 107 /** Interface number the endpoint must belong to (-1 for any). */ 108 108 int interface_no; 109 /** Alternate interface setting to choose. */ 110 int interface_setting; 109 111 /** Found descriptor fitting the description. */ 110 112 usb_standard_endpoint_descriptor_t *descriptor;
Note:
See TracChangeset
for help on using the changeset viewer.