add usb3.0 speed support
This commit is contained in:
@@ -13,11 +13,13 @@
|
||||
#define USB_2_1 0x0210
|
||||
|
||||
/* Device speeds */
|
||||
#define USB_SPEED_UNKNOWN 0 /* Transfer rate not yet set */
|
||||
#define USB_SPEED_LOW 1 /* USB 1.1 */
|
||||
#define USB_SPEED_FULL 2 /* USB 1.1 */
|
||||
#define USB_SPEED_HIGH 3 /* USB 2.0 */
|
||||
#define USB_SPEED_VARIABLE 4 /* Wireless USB 2.5 */
|
||||
#define USB_SPEED_UNKNOWN 0 /* Transfer rate not yet set */
|
||||
#define USB_SPEED_LOW 1 /* USB 1.1 */
|
||||
#define USB_SPEED_FULL 2 /* USB 1.1 */
|
||||
#define USB_SPEED_HIGH 3 /* USB 2.0 */
|
||||
#define USB_SPEED_WIRELESS 4 /* Wireless USB 2.5 */
|
||||
#define USB_SPEED_SUPER 5 /* USB 3.0 */
|
||||
#define USB_SPEED_SUPER_PLUS 5 /* USB 3.1 */
|
||||
|
||||
/* Maximum number of devices per controller */
|
||||
#define USB_MAX_DEVICES (127)
|
||||
|
||||
@@ -388,33 +388,24 @@ int usbh_enumerate(struct usbh_hubport *hport)
|
||||
struct usb_setup_packet *setup;
|
||||
uint8_t descsize;
|
||||
int dev_addr;
|
||||
uint8_t ep_mps;
|
||||
uint16_t ep_mps;
|
||||
int ret;
|
||||
|
||||
#define USB_REQUEST_BUFFER_SIZE 256
|
||||
setup = &hport->setup;
|
||||
|
||||
/* Pick an appropriate packet size for this device
|
||||
*
|
||||
* USB 2.0, Paragraph 5.5.3 "Control Transfer Packet Size Constraints"
|
||||
*
|
||||
* "An endpoint for control transfers specifies the maximum data
|
||||
* payload size that the endpoint can accept from or transmit to
|
||||
* the bus. The allowable maximum control transfer data payload
|
||||
* sizes for full-speed devices is 8, 16, 32, or 64 bytes; for
|
||||
* high-speed devices, it is 64 bytes and for low-speed devices,
|
||||
* it is 8 bytes. This maximum applies to the data payloads of the
|
||||
* Data packets following a Setup..."
|
||||
*/
|
||||
|
||||
if (hport->speed == USB_SPEED_HIGH) {
|
||||
/* For high-speed, we must use 64 bytes */
|
||||
ep_mps = 64;
|
||||
descsize = USB_SIZEOF_DEVICE_DESC;
|
||||
} else {
|
||||
/* For low or full, we use 8 bytes */
|
||||
if ((hport->speed == USB_SPEED_SUPER) || (hport->speed == USB_SPEED_SUPER_PLUS)) {
|
||||
/* For super speed , we must use 512 bytes */
|
||||
ep_mps = 512;
|
||||
descsize = 8;
|
||||
} else if (hport->speed == USB_SPEED_LOW) {
|
||||
/* For low speed, we use 8 bytes */
|
||||
ep_mps = 8;
|
||||
descsize = 8;
|
||||
} else {
|
||||
/* For full or high speed, we use 64 bytes */
|
||||
ep_mps = 64;
|
||||
descsize = 8;
|
||||
}
|
||||
|
||||
/* Configure EP0 with the initial maximum packet size */
|
||||
|
||||
Reference in New Issue
Block a user