add USB_DEVICE_QUALIFIER_DESCRIPTOR_INIT and USB_OTHER_SPEED_CONFIG_DESCRIPTOR_INIT macros
Signed-off-by: Zhihong Chen <zhihong.chen@hpmicro.com>
This commit is contained in:
@@ -34,6 +34,10 @@
|
|||||||
/**< maximum packet size (MPS) for EP 0 */
|
/**< maximum packet size (MPS) for EP 0 */
|
||||||
#define USB_CTRL_EP_MPS 64
|
#define USB_CTRL_EP_MPS 64
|
||||||
|
|
||||||
|
/**< maximum packet size (MPS) for bulk EP */
|
||||||
|
#define USB_BULK_EP_MPS_HS 512
|
||||||
|
#define USB_BULK_EP_MPS_FS 64
|
||||||
|
|
||||||
/* USB PID Types */
|
/* USB PID Types */
|
||||||
#define USB_PID_OUT (0x01) /* Tokens */
|
#define USB_PID_OUT (0x01) /* Tokens */
|
||||||
#define USB_PID_IN (0x09)
|
#define USB_PID_IN (0x09)
|
||||||
@@ -660,6 +664,27 @@ struct usb_desc_header {
|
|||||||
bmAttributes, /* bmAttributes */ \
|
bmAttributes, /* bmAttributes */ \
|
||||||
USB_CONFIG_POWER_MA(bMaxPower) /* bMaxPower */
|
USB_CONFIG_POWER_MA(bMaxPower) /* bMaxPower */
|
||||||
|
|
||||||
|
#define USB_DEVICE_QUALIFIER_DESCRIPTOR_INIT(bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bNumConfigurations) \
|
||||||
|
0x0A, /* bLength */ \
|
||||||
|
USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER, /* bDescriptorType */ \
|
||||||
|
WBVAL(bcdUSB), /* bcdUSB */ \
|
||||||
|
bDeviceClass, /* bDeviceClass */ \
|
||||||
|
bDeviceSubClass, /* bDeviceSubClass */ \
|
||||||
|
bDeviceProtocol, /* bDeviceProtocol */ \
|
||||||
|
0x40, /* bMaxPacketSize */ \
|
||||||
|
bNumConfigurations, /* bNumConfigurations */ \
|
||||||
|
0x00 /* bReserved */
|
||||||
|
|
||||||
|
#define USB_OTHER_SPEED_CONFIG_DESCRIPTOR_INIT(wTotalLength, bNumInterfaces, bConfigurationValue, bmAttributes, bMaxPower) \
|
||||||
|
0x09, /* bLength */ \
|
||||||
|
USB_DESCRIPTOR_TYPE_OTHER_SPEED, /* bDescriptorType */ \
|
||||||
|
WBVAL(wTotalLength), /* wTotalLength */ \
|
||||||
|
bNumInterfaces, /* bNumInterfaces */ \
|
||||||
|
bConfigurationValue, /* bConfigurationValue */ \
|
||||||
|
0x00, /* iConfiguration */ \
|
||||||
|
bmAttributes, /* bmAttributes */ \
|
||||||
|
USB_CONFIG_POWER_MA(bMaxPower) /* bMaxPower */
|
||||||
|
|
||||||
#define USB_INTERFACE_DESCRIPTOR_INIT(bInterfaceNumber, bAlternateSetting, bNumEndpoints, \
|
#define USB_INTERFACE_DESCRIPTOR_INIT(bInterfaceNumber, bAlternateSetting, bNumEndpoints, \
|
||||||
bInterfaceClass, bInterfaceSubClass, bInterfaceProtocol, iInterface) \
|
bInterfaceClass, bInterfaceSubClass, bInterfaceProtocol, iInterface) \
|
||||||
0x09, /* bLength */ \
|
0x09, /* bLength */ \
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ static bool usbd_get_descriptor(uint8_t busid, uint16_t type_index, uint8_t **da
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case USB_DESCRIPTOR_TYPE_DEVICE:
|
case USB_DESCRIPTOR_TYPE_DEVICE:
|
||||||
g_usbd_core[busid].speed = usbd_get_port_speed(busid, 0); /* before we get device descriptor, we have known steady port speed */
|
g_usbd_core[busid].speed = usbd_get_port_speed(busid); /* before we get device descriptor, we have known steady port speed */
|
||||||
desc = g_usbd_core[busid].descriptors->device_descriptor_callback(g_usbd_core[busid].speed);
|
desc = g_usbd_core[busid].descriptors->device_descriptor_callback(g_usbd_core[busid].speed);
|
||||||
if (desc == NULL) {
|
if (desc == NULL) {
|
||||||
found = false;
|
found = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user