Changeset e6b9182 in mainline for uspace/lib/usbhost
- Timestamp:
- 2017-10-13T08:49:29Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 741bcdeb
- Parents:
- 0a5833d7
- Location:
- uspace/lib/usbhost
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/include/usb/host/bus.h
r0a5833d7 re6b9182 68 68 /* Endpoint ops, optional (have generic fallback) */ 69 69 void (*destroy_endpoint)(endpoint_t *); 70 int(*endpoint_get_toggle)(endpoint_t *);71 void (*endpoint_set_toggle)(endpoint_t *, unsigned);70 bool (*endpoint_get_toggle)(endpoint_t *); 71 void (*endpoint_set_toggle)(endpoint_t *, bool); 72 72 } bus_ops_t; 73 73 74 74 /** Endpoint management structure */ 75 75 typedef struct bus { 76 hcd_t *hcd;77 78 76 /* Synchronization of ops */ 79 77 fibril_mutex_t guard; … … 85 83 } bus_t; 86 84 87 void bus_init(bus_t * , hcd_t *hcd);85 void bus_init(bus_t *); 88 86 89 87 endpoint_t *bus_create_endpoint(bus_t *); -
uspace/lib/usbhost/include/usb/host/usb2_bus.h
r0a5833d7 re6b9182 65 65 } usb2_bus_t; 66 66 67 extern int usb2_bus_init(usb2_bus_t *, hcd_t *,size_t, count_bw_func_t);67 extern int usb2_bus_init(usb2_bus_t *, size_t, count_bw_func_t); 68 68 69 69 #endif -
uspace/lib/usbhost/src/bus.c
r0a5833d7 re6b9182 43 43 * Initializes the bus structure. 44 44 */ 45 void bus_init(bus_t *bus , hcd_t *hcd)45 void bus_init(bus_t *bus) 46 46 { 47 47 memset(bus, 0, sizeof(bus_t)); 48 48 49 bus->hcd = hcd;50 49 fibril_mutex_initialize(&bus->guard); 51 50 } -
uspace/lib/usbhost/src/usb2_bus.c
r0a5833d7 re6b9182 41 41 #include <errno.h> 42 42 #include <macros.h> 43 #include <stdlib.h> 43 44 #include <stdbool.h> 44 45 … … 110 111 } 111 112 113 static endpoint_t *usb2_bus_create_ep(bus_t *bus) 114 { 115 endpoint_t *ep = malloc(sizeof(endpoint_t)); 116 if (!ep) 117 return NULL; 118 119 endpoint_init(ep, bus); 120 return ep; 121 } 122 112 123 /** Register an endpoint to the bus. Reserves bandwidth. 113 124 * @param bus usb_bus structure, non-null. … … 271 282 272 283 static const bus_ops_t usb2_bus_ops = { 284 .create_endpoint = usb2_bus_create_ep, 273 285 .find_endpoint = usb2_bus_find_ep, 274 286 .release_endpoint = usb2_bus_release_ep, … … 287 299 * @return Error code. 288 300 */ 289 int usb2_bus_init(usb2_bus_t *bus, hcd_t *hcd,size_t available_bandwidth, count_bw_func_t count_bw)301 int usb2_bus_init(usb2_bus_t *bus, size_t available_bandwidth, count_bw_func_t count_bw) 290 302 { 291 303 assert(bus); 292 304 293 bus_init(&bus->base , hcd);305 bus_init(&bus->base); 294 306 295 307 bus->base.ops = usb2_bus_ops;
Note:
See TracChangeset
for help on using the changeset viewer.