Changeset ecbad17 in mainline
- Timestamp:
- 2018-01-07T17:13:57Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- eb928c4
- Parents:
- 3dc3f99
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-07 17:12:35)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-07 17:13:57)
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/ehci_bus.c
r3dc3f99 recbad17 149 149 .endpoint_unregister = ehci_unregister_ep, 150 150 .endpoint_toggle_reset = ehci_ep_toggle_reset, 151 .endpoint_count_bw = bandwidth_count_usb 11,151 .endpoint_count_bw = bandwidth_count_usb20, 152 152 .batch_create = ehci_create_batch, 153 153 .batch_destroy = ehci_destroy_batch, … … 163 163 bus_t *bus_base = (bus_t *) bus; 164 164 165 usb2_bus_init(usb2_bus, BANDWIDTH_AVAILABLE_USB 11);165 usb2_bus_init(usb2_bus, BANDWIDTH_AVAILABLE_USB20); 166 166 bus_base->ops = &ehci_bus_ops; 167 167 -
uspace/lib/usbhost/include/usb/host/bandwidth.h
r3dc3f99 recbad17 44 44 #define BANDWIDTH_TOTAL_USB11 (12000000 / 8) 45 45 /** 90% of total bandwidth is available for periodic transfers */ 46 #define BANDWIDTH_AVAILABLE_USB11 ((BANDWIDTH_TOTAL_USB11 / 10) * 9)46 #define BANDWIDTH_AVAILABLE_USB11 ((BANDWIDTH_TOTAL_USB11 * 9) / 10) 47 47 48 //TODO: Implement 49 #define BANDWIDTH_AVAILABLE_USB20 1 48 /** Number of nanoseconds in one microframe */ 49 #define BANDWIDTH_TOTAL_USB20 (125000) 50 /** 90% of total bandwidth is available for periodic transfers */ 51 #define BANDWIDTH_AVAILABLE_USB20 ((BANDWIDTH_TOTAL_USB20 * 9) / 10) 50 52 51 53 typedef struct endpoint endpoint_t; -
uspace/lib/usbhost/src/bandwidth.c
r3dc3f99 recbad17 96 96 97 97 /** Calculate bandwidth that needs to be reserved for communication with EP. 98 * Calculation follows USB 2.0 specification. 98 * Calculation follows USB 2.0 specification, chapter 5.11.3. 99 * 99 100 * @param speed Device's speed. 100 101 * @param type Type of the transfer. 101 102 * @param size Number of byte to transfer. 102 103 * @param max_packet_size Maximum bytes in one packet. 104 * @return Number of nanoseconds transaction with @c size bytes payload will 105 * take. 103 106 */ 104 107 ssize_t bandwidth_count_usb20(endpoint_t *ep, size_t size) … … 113 116 return 0; 114 117 } 115 //TODO Implement 116 return 0; 118 119 // FIXME: Come up with some upper bound for these (in ns). 120 const size_t host_delay = 0; 121 const size_t hub_ls_setup = 0; 122 123 // Approx. Floor(3.167 + BitStuffTime(Data_bc)) 124 const size_t base_time = (size * 8 + 19) / 6; 125 126 switch (ep->device->speed) { 127 case USB_SPEED_LOW: 128 if (ep->direction == USB_DIRECTION_IN) 129 return 64060 + (2 * hub_ls_setup) + (677 * base_time) + host_delay; 130 else 131 return 64107 + (2 * hub_ls_setup) + (667 * base_time) + host_delay; 132 133 case USB_SPEED_FULL: 134 if (ep->transfer_type == USB_TRANSFER_INTERRUPT) 135 return 9107 + 84 * base_time + host_delay; 136 137 if (ep->direction == USB_DIRECTION_IN) 138 return 7268 + 84 * base_time + host_delay; 139 else 140 return 6265 + 84 * base_time + host_delay; 141 142 case USB_SPEED_HIGH: 143 if (ep->transfer_type == USB_TRANSFER_INTERRUPT) 144 return (3648 + 25 * base_time + 11) / 12 + host_delay; 145 else 146 return (5280 + 25 * base_time + 11) / 12 + host_delay; 147 148 default: 149 return 0; 150 } 117 151 }
Note:
See TracChangeset
for help on using the changeset viewer.