Changeset 20eaa82 in mainline for uspace/lib/usbhost/include/usb/host/bus.h
- Timestamp:
- 2017-10-15T13:44:39Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2770b66
- Parents:
- 867b375
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/include/usb/host/bus.h
r867b375 r20eaa82 45 45 #include <usb/usb.h> 46 46 47 #include <assert.h> 47 48 #include <fibril_synch.h> 48 49 #include <stdbool.h> … … 51 52 typedef struct endpoint endpoint_t; 52 53 typedef struct bus bus_t; 54 typedef struct ddf_fun ddf_fun_t; 55 56 typedef struct device { 57 /* Device tree keeping */ 58 link_t link; 59 list_t devices; 60 fibril_mutex_t guard; 61 62 /* Associated DDF function, if any */ 63 ddf_fun_t *fun; 64 65 /* Invalid for the roothub device */ 66 unsigned port; 67 struct device *hub; 68 69 /* Transaction translator */ 70 usb_tt_address_t tt; 71 72 /* The following are not set by the library */ 73 usb_speed_t speed; 74 usb_address_t address; 75 76 /* This structure is meant to be extended by overriding. */ 77 } device_t; 53 78 54 79 typedef struct { 80 int (*enumerate_device)(bus_t *, hcd_t *, device_t *); 81 int (*remove_device)(bus_t *, hcd_t *, device_t *); 82 55 83 endpoint_t *(*create_endpoint)(bus_t *); 56 84 int (*register_endpoint)(bus_t *, endpoint_t *); … … 59 87 60 88 int (*request_address)(bus_t *, usb_address_t*, bool, usb_speed_t); 61 int (*get_speed)(bus_t *, usb_address_t, usb_speed_t *);62 89 int (*release_address)(bus_t *, usb_address_t); 63 90 … … 77 104 fibril_mutex_t guard; 78 105 106 size_t device_size; 107 79 108 /* Do not call directly, ops are synchronized. */ 80 109 bus_ops_t ops; … … 83 112 } bus_t; 84 113 85 void bus_init(bus_t *); 114 void bus_init(bus_t *, size_t); 115 int device_init(device_t *); 116 117 extern int bus_add_ep(bus_t *bus, device_t *device, usb_endpoint_t endpoint, 118 usb_direction_t dir, usb_transfer_type_t type, size_t max_packet_size, 119 unsigned packets, size_t size); 120 extern int bus_remove_ep(bus_t *bus, usb_target_t target, usb_direction_t dir); 121 122 int device_set_default_name(device_t *); 123 124 int bus_enumerate_device(bus_t *, hcd_t *, device_t *); 125 int bus_remove_device(bus_t *, hcd_t *, device_t *); 86 126 87 127 endpoint_t *bus_create_endpoint(bus_t *); … … 93 133 94 134 int bus_request_address(bus_t *, usb_address_t *, bool, usb_speed_t); 95 int bus_get_speed(bus_t *, usb_address_t, usb_speed_t *);96 135 int bus_release_address(bus_t *, usb_address_t); 136 137 static inline int bus_reserve_default_address(bus_t *bus, usb_speed_t speed) { 138 usb_address_t addr = USB_ADDRESS_DEFAULT; 139 140 const int r = bus_request_address(bus, &addr, true, speed); 141 assert(addr == USB_ADDRESS_DEFAULT); 142 return r; 143 } 144 145 static inline int bus_release_default_address(bus_t *bus) { 146 return bus_release_address(bus, USB_ADDRESS_DEFAULT); 147 } 97 148 98 149 int bus_reset_toggle(bus_t *, usb_target_t, bool);
Note:
See TracChangeset
for help on using the changeset viewer.