Changeset fc0271a5 in mainline for uspace/lib/usbhost
- Timestamp:
- 2017-10-12T16:06:37Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f9d787c
- Parents:
- d0db4a0
- Location:
- uspace/lib/usbhost
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/include/usb/host/bandwidth.h
rd0db4a0 rfc0271a5 49 49 #define BANDWIDTH_AVAILABLE_USB20 1 50 50 51 extern size_t bandwidth_count_usb11(usb_speed_t, usb_transfer_type_t, size_t, size_t);51 typedef struct endpoint endpoint_t; 52 52 53 extern size_t bandwidth_count_usb20(usb_speed_t, usb_transfer_type_t, size_t, size_t); 53 extern size_t bandwidth_count_usb11(endpoint_t *, size_t); 54 55 extern size_t bandwidth_count_usb20(endpoint_t *, size_t); 54 56 55 57 #endif -
uspace/lib/usbhost/include/usb/host/hcd.h
rd0db4a0 rfc0271a5 58 58 /** Transfer scheduling, implement in device driver. */ 59 59 schedule_hook_t schedule; 60 /** Hook called upon registering new endpoint. */61 ep_add_hook_t ep_add_hook;62 /** Hook called upon removing of an endpoint. */63 ep_remove_hook_t ep_remove_hook;64 60 /** Hook to be called on device interrupt, passes ARG1 */ 65 61 interrupt_hook_t irq_hook; -
uspace/lib/usbhost/include/usb/host/usb2_bus.h
rd0db4a0 rfc0271a5 50 50 /** Endpoint management structure */ 51 51 typedef struct usb2_bus { 52 bus_t b us; /**< Inheritance - keep this first */52 bus_t base; /**< Inheritance - keep this first */ 53 53 54 54 /* Device bookkeeping */ -
uspace/lib/usbhost/src/bandwidth.c
rd0db4a0 rfc0271a5 35 35 36 36 #include <usb/host/bandwidth.h> 37 #include <usb/host/endpoint.h> 37 38 38 39 #include <assert.h> … … 46 47 * @param max_packet_size Maximum bytes in one packet. 47 48 */ 48 size_t bandwidth_count_usb11(usb_speed_t speed, usb_transfer_type_t type, 49 size_t size, size_t max_packet_size) 49 size_t bandwidth_count_usb11(endpoint_t *ep, size_t size) 50 50 { 51 assert(ep); 52 53 const usb_transfer_type_t type = ep->transfer_type; 54 51 55 /* We care about bandwidth only for interrupt and isochronous. */ 52 56 if ((type != USB_TRANSFER_INTERRUPT) … … 55 59 } 56 60 61 const size_t max_packet_size = ep->max_packet_size; 62 57 63 const unsigned packet_count = 58 64 (size + max_packet_size - 1) / max_packet_size; … … 60 66 * transaction, but I did not find text in USB spec to confirm this */ 61 67 /* NOTE: All data packets will be considered to be max_packet_size */ 62 switch ( speed)68 switch (ep->speed) 63 69 { 64 70 case USB_SPEED_LOW: … … 94 100 * @param max_packet_size Maximum bytes in one packet. 95 101 */ 96 size_t bandwidth_count_usb20(usb_speed_t speed, usb_transfer_type_t type, 97 size_t size, size_t max_packet_size) 102 size_t bandwidth_count_usb20(endpoint_t *ep, size_t size) 98 103 { 104 assert(ep); 105 106 const usb_transfer_type_t type = ep->transfer_type; 107 99 108 /* We care about bandwidth only for interrupt and isochronous. */ 100 109 if ((type != USB_TRANSFER_INTERRUPT) -
uspace/lib/usbhost/src/usb2_bus.c
rd0db4a0 rfc0271a5 291 291 assert(bus); 292 292 293 bus_init(&bus->b us, hcd);294 295 bus->b us.ops = usb2_bus_ops;296 bus->b us.ops.count_bw = count_bw;293 bus_init(&bus->base, hcd); 294 295 bus->base.ops = usb2_bus_ops; 296 bus->base.ops.count_bw = count_bw; 297 297 298 298 bus->free_bw = available_bandwidth;
Note:
See TracChangeset
for help on using the changeset viewer.