Changeset 9262571 in mainline
- Timestamp:
- 2011-04-06T16:06:34Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9783496
- Parents:
- f0891ce
- Location:
- uspace/lib/usb/src/host
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/host/bandwidth.c
rf0891ce r9262571 78 78 } 79 79 /*----------------------------------------------------------------------------*/ 80 hash_table_operations_t op = {80 static hash_table_operations_t op = { 81 81 .hash = transfer_hash, 82 82 .compare = transfer_compare, 83 83 .remove_callback = transfer_remove, 84 84 }; 85 /*----------------------------------------------------------------------------*/86 size_t bandwidth_count_usb11(usb_speed_t speed, usb_transfer_type_t type,87 size_t size, size_t max_packet_size)88 {89 const unsigned packet_count =90 (size + max_packet_size - 1) / max_packet_size;91 /* TODO: It may be that ISO and INT transfers use only one data packet92 * per transaction, but I did not find text in UB spec that confirms93 * this */94 /* NOTE: All data packets will be considered to be max_packet_size */95 switch (speed)96 {97 case USB_SPEED_LOW:98 assert(type == USB_TRANSFER_INTERRUPT);99 /* Protocol overhead 13B100 * (3 SYNC bytes, 3 PID bytes, 2 Endpoint + CRC bytes, 2101 * CRC bytes, and a 3-byte interpacket delay)102 * see USB spec page 45-46. */103 /* Speed penalty 8: low speed is 8-times slower*/104 return packet_count * (13 + max_packet_size) * 8;105 case USB_SPEED_FULL:106 /* Interrupt transfer overhead see above107 * or page 45 of USB spec */108 if (type == USB_TRANSFER_INTERRUPT)109 return packet_count * (13 + max_packet_size);110 111 assert(type == USB_TRANSFER_ISOCHRONOUS);112 /* Protocol overhead 9B113 * (2 SYNC bytes, 2 PID bytes, 2 Endpoint + CRC bytes, 2 CRC114 * bytes, and a 1-byte interpacket delay)115 * see USB spec page 42 */116 return packet_count * (9 + max_packet_size);117 default:118 return 0;119 }120 }121 85 /*----------------------------------------------------------------------------*/ 122 86 int bandwidth_init(bandwidth_t *instance, size_t bandwidth, -
uspace/lib/usb/src/host/usb_endpoint_manager.c
rf0891ce r9262571 86 86 } 87 87 /*----------------------------------------------------------------------------*/ 88 hash_table_operations_t op = {88 static hash_table_operations_t op = { 89 89 .hash = ep_hash, 90 90 .compare = ep_compare,
Note:
See TracChangeset
for help on using the changeset viewer.