Changeset 6271a34 in mainline
- Timestamp:
- 2018-01-20T18:21:39Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2aaba7e
- Parents:
- 51c1d500
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/device.c
r51c1d500 r6271a34 87 87 dev->base.endpoints[0] = ep0_base; 88 88 89 usb_log_debug2("Looking up new device initial speed: %i", dev->base.speed); 90 ep0_base->max_packet_size = hc_get_ep0_initial_mps(dev->base.speed); 91 89 92 /* Address device */ 90 93 if ((err = hc_address_device(dev))) -
uspace/lib/usbhost/include/usb/host/utility.h
r51c1d500 r6271a34 46 46 typedef void (*endpoint_reset_toggle_t)(endpoint_t *); 47 47 48 uint16_t hc_get_ep0_initial_mps(usb_speed_t); 48 49 int hc_get_ep0_max_packet_size(uint16_t *, bus_t *, device_t *); 49 50 void hc_reset_toggles(const usb_transfer_batch_t *batch, endpoint_reset_toggle_t); -
uspace/lib/usbhost/src/utility.c
r51c1d500 r6271a34 42 42 #include "utility.h" 43 43 44 45 /** 46 * Get max packet size for the control endpoint 0. 47 * 48 * For LS, HS, and SS devices this value is fixed. For FS devices we must fetch 49 * the first 8B of the device descriptor to determine it. 50 * 51 * @return Max packet size for EP 0 52 */ 53 int hc_get_ep0_max_packet_size(uint16_t *mps, bus_t *bus, device_t *dev) 54 { 55 assert(mps); 56 44 /** 45 * Get initial max packet size for the control endpoint 0. 46 * 47 * For LS, HS, and SS devices this value is final and fixed. 48 * For FS devices, the default value of 8 is returned. The caller needs 49 * to fetch the first 8B of the device descriptor later in the initialization 50 * process and determine whether it should be increased. 51 * 52 * @return Max packet size for EP 0 (in bytes) 53 */ 54 uint16_t hc_get_ep0_initial_mps(usb_speed_t speed) 55 { 57 56 static const uint16_t mps_fixed [] = { 58 57 [USB_SPEED_LOW] = 8, … … 61 60 }; 62 61 63 if (dev->speed < ARRAY_SIZE(mps_fixed) && mps_fixed[dev->speed] != 0) { 64 *mps = mps_fixed[dev->speed]; 62 if (speed < ARRAY_SIZE(mps_fixed) && mps_fixed[speed] != 0) { 63 return mps_fixed[speed]; 64 } 65 return 8; // USB_SPEED_FULL default 66 } 67 68 /** 69 * Get max packet size for the control endpoint 0. 70 * 71 * For LS, HS, and SS devices the corresponding fixed value is obtained. 72 * For FS devices the first 8B of the device descriptor are fetched to 73 * determine it. 74 * 75 * @return Max packet size for EP 0 (in bytes) 76 */ 77 int hc_get_ep0_max_packet_size(uint16_t *mps, bus_t *bus, device_t *dev) 78 { 79 assert(mps); 80 81 *mps = hc_get_ep0_initial_mps(dev->speed); 82 if (dev->speed != USB_SPEED_FULL) { 65 83 return EOK; 66 84 }
Note:
See TracChangeset
for help on using the changeset viewer.