356 lines
10 KiB
C
356 lines
10 KiB
C
#ifndef USBD_DESCRIPTORS_H
|
|
#define USBD_DESCRIPTORS_H
|
|
|
|
#define USBD_SUPPORT_CLOCK_SELECTOR 0
|
|
|
|
UCHAR device_framework_fs[] = {
|
|
/* Device descriptor, size=18 */
|
|
0x12, // bLength
|
|
0x01, // bDescriptorType
|
|
0x00, 0x02, // bcdUSB
|
|
0xEF, // bDeviceClass !! DESCRIBED IN IAD
|
|
0x02, // bDeviceSubClass !! -^
|
|
0x01, // bDeviceProtocol !! -^
|
|
0x08, // bMaxPacketSize0
|
|
0x83, 0x04, // idVendor !! 0x0483
|
|
0x30, 0x57, // idProduct !! 0x5730
|
|
0x01, 0x00, // bcdDevice
|
|
0x01, // iManufacturer
|
|
0x02, // iProduct
|
|
0x03, // iSerialNumber
|
|
0x01, // bNumConfigurations
|
|
|
|
/* Device Qualifier descriptor */
|
|
0x0A, // bLength
|
|
0x06, // bDescriptorType
|
|
0x00, 0x02, // bcdUSB
|
|
0xEF, // bDeviceClass !! DESCRIBED IN IAD
|
|
0x02, // bDeviceSubClass !! -^
|
|
0x01, // bDeviceProtocol !! -^
|
|
0x08, // bMaxPacketSize0
|
|
0x01, // bNumConfigurations
|
|
0x00, // bReserved
|
|
|
|
/* Configuration descriptor size=9 */
|
|
0x09, // bLength
|
|
0x02, // bDescriptorType
|
|
#if USBD_SUPPORT_CLOCK_SELECTOR
|
|
0xB1, 0x00, // wTotalLength !! 9 + 8 + 9 + 89 + 9 + 9 + 16 + 6 + 7 + 8 + 7 ...
|
|
#else
|
|
0x98, 0x00, // wTotalLength !! 9 + 8 + 9 + 64 + 9 + 9 + 16 + 6 + 7 + 8 + 7 ...
|
|
#endif
|
|
0x02, // bNumInterfaces
|
|
0x01, // bConfigurationValue
|
|
0x00, // iConfiguration
|
|
0x80, // bmAttributes !! Bus powered
|
|
0x39, // bMaxPower
|
|
|
|
/* Interface Association descriptor <ECN> size=8 */
|
|
0x08, // bLength
|
|
0x0B, // bDescriptorType !! IAD, See ECN
|
|
0x00, // bFirstInterface
|
|
0x02, // bInterfaceCount
|
|
0x01, // bFunctionClass !! AUDIO_FUNCTION
|
|
0x00, // bFunctionSubClass !! FUNCTION_SUBCLASS_UNDEFINED
|
|
0x20, // bFunctionProtocol !! AF_VERSION_02_00
|
|
0x00, // iFunction
|
|
|
|
/* Audio Control Interface descriptor size=9 */
|
|
0x09, // bLength
|
|
0x04, // bDescriptorType
|
|
0x00, // bInterfaceNumber
|
|
0x00, // bAlternateSetting
|
|
0x00, // bNumEndpoints
|
|
0x01, // bInterfaceClass
|
|
0x01, // bInterfaceSubClass
|
|
0x20, // bInterfaceProtocol
|
|
0x00, // iInterface
|
|
|
|
/* Audio Control Interface Header descriptor size=9 */
|
|
0x09, // bLength
|
|
0x24, // bDescriptorType
|
|
0x01, // bDescriptorSubType
|
|
0x00, 0x02, // bcdADC !! 2.00
|
|
0x04, // bCategory
|
|
#if USBD_SUPPORT_CLOCK_SELECTOR
|
|
0x59, 0x00, // wTotalLength !! <UAC2 Table 4-5> 9 + 8 + 8 + 8 + 9 + 18 + 17 + 12 + ...
|
|
#else
|
|
0x40, 0x00, // wTotalLength !! <UAC2 Table 4-5> 9 + 8 + 18 + 17 + 12 + ...
|
|
#endif
|
|
0x00, // bmControls
|
|
|
|
/* Audio Control Clock Source descriptor CID=0x10 size=8 */
|
|
0x08, // bLength
|
|
0x24, // bDescriptorType
|
|
0x0A, // bDescriptorSubType
|
|
0x10, // bClockID
|
|
0x01, // bmAttributes !! Internal fixed clock
|
|
0x01, // bmControls
|
|
0x00, // bAssocTerminal
|
|
0x00, // iClockSource
|
|
|
|
#if USBD_SUPPORT_CLOCK_SELECTOR
|
|
|
|
/* Audio Control Clock Source descriptor CID=0x11 size=8 */
|
|
0x08, // bLength
|
|
0x24, // bDescriptorType
|
|
0x0A, // bDescriptorSubType
|
|
0x11, // bClockID
|
|
0x01, // bmAttributes !! Internal fixed clock
|
|
0x01, // bmControls
|
|
0x00, // bAssocTerminal
|
|
0x00, // iClockSource
|
|
|
|
/* Audio Control Clock Source descriptor CID=0x12 size=8 */
|
|
0x08, // bLength
|
|
0x24, // bDescriptorType
|
|
0x0A, // bDescriptorSubType
|
|
0x12, // bClockID
|
|
0x05, // bmAttributes !! Sync to SOF
|
|
0x01, // bmControls
|
|
0x00, // bAssocTerminal
|
|
0x00, // iClockSource
|
|
|
|
/* Audio Control Clock Selector descriptor CID=0x18 size=9 */
|
|
0x09, // bLength
|
|
0x24, // bDescriptorType !! CS_INTERFACE
|
|
0x0B, // bDescriptorSubType !! CLOCK_SELECTOR
|
|
0x18, // bClockID !!
|
|
0x02, // bNrInPins !! 2 input pins
|
|
0x10, // baCSourceID(1) !! From Clock Source CID=0x10
|
|
0x11, // baCSourceID(2) !! From Clock Source CID=0x11
|
|
0x03, // bmControls !! Windows UAC 2.0 driver does not support SET_CUR.
|
|
0x00, // iClockSelector
|
|
|
|
#endif
|
|
|
|
/* Audio Control Feature Unit descriptor UID=0x30 size=18 */
|
|
0x12, // bLength !!
|
|
0x24, // bDescriptorType
|
|
0x06, // bDescriptorSubType
|
|
0x30, // bUnitID !!
|
|
0x20, // bSourceID !! From Input Terminal TID=0x20
|
|
0x0F, 0x00, 0x00, 0x00, // bmaControls(0) !!
|
|
0x00, 0x00, 0x00, 0x00, // bmaControls(1) !!
|
|
0x00, 0x00, 0x00, 0x00, // bmaControls(2)
|
|
0x00, // iFeature
|
|
|
|
/* Audio Control Input Terminal descriptor TID=0x20 size=17 */
|
|
0x11, // bLength
|
|
0x24, // bDescriptorType
|
|
0x02, // bDescriptorSubType
|
|
0x20, // bTerminalID !! TID=0x20
|
|
0x01, 0x01, // wTerminalType !! USB Streaming - 0x0101
|
|
0x00, // bAssocTerminal !!
|
|
#if USBD_SUPPORT_CLOCK_SELECTOR
|
|
0x12, // bCSourceID !! From Clock Source CID=0x12
|
|
#else
|
|
0x10, // bCSourceID !! From Clock Source CID=0x10
|
|
#endif
|
|
0x02, // bNrChannels
|
|
0x03, 0x00, 0x00, 0x00, // bmChannelConfig
|
|
0x00, // iChannelNames
|
|
0x00, 0x00, // bmControls
|
|
0x00, // iTerminal
|
|
|
|
/* Audio Control Output Terminal descriptor TID=0x21 size=12 */
|
|
0x0C, // bLength
|
|
0x24, // bDescriptorType
|
|
0x03, // bDescriptorSubType
|
|
0x21, // bTerminalID !! TID=0x21
|
|
0x02, 0x03, // wTerminalType !! Headphones - 0x0302
|
|
0x00, // bAssocTerminal
|
|
0x30, // bSourceID !! From Feature Unit UID=0x30
|
|
#if USBD_SUPPORT_CLOCK_SELECTOR
|
|
0x18, // bCSourceID !! Associate with Clock selector at id=0x18
|
|
#else
|
|
0x10, // bCSourceID !! Associate with Clock source at id=0x10
|
|
#endif
|
|
0x00, 0x00, // bmControls !! TBD
|
|
0x04, // iTerminal
|
|
|
|
/* Audio Streaming Interface descriptor size=9 */
|
|
0x09, // bLength
|
|
0x04, // bDescriptorType
|
|
0x01, // bInterfaceNumber
|
|
0x00, // bAlternateSetting
|
|
0x00, // bNumEndpoints
|
|
0x01, // bInterfaceClass
|
|
0x02, // bInterfaceSubClass
|
|
0x20, // bInterfaceProtocol
|
|
0x04, // iInterface
|
|
|
|
/* Audio Streaming Interface descriptor size=9 */
|
|
0x09, // bLength
|
|
0x04, // bDescriptorType
|
|
0x01, // bInterfaceNumber
|
|
0x01, // bAlternateSetting
|
|
0x02, // bNumEndpoints
|
|
0x01, // bInterfaceClass
|
|
0x02, // bInterfaceSubClass
|
|
0x20, // bInterfaceProtocol
|
|
0x00, // iInterface
|
|
|
|
/* Audio Streaming Class Specific Interface descriptor size=16 */
|
|
0x10, // bLength
|
|
0x24, // bDescriptorType
|
|
0x01, // bDescriptorSubType
|
|
0x20, // bTerminalLink !! Link to Input Terminal TID=0x20
|
|
0x00, // bmControls
|
|
0x01, // bFormatType
|
|
0x01, 0x00, 0x00, 0x00, // bmFormats
|
|
0x02, // bNrChannels
|
|
0x03, 0x00, 0x00, 0x00, // bmChannelConfig
|
|
0x00, // iChannelNames
|
|
|
|
/* Audio Streaming Format Type descriptor size=6 */
|
|
0x06, // bLength
|
|
0x24, // bDescriptorType
|
|
0x02, // bDescriptorSubType
|
|
0x01, // bFormatType
|
|
0x02, // bSubslotSize !!
|
|
0x10, // bBitResolution !! - 16bits
|
|
|
|
/* Endpoint descriptor size=7 */
|
|
0x07, // bLength
|
|
0x05, // bDescriptorType
|
|
0x01, // bEndpointAddress
|
|
0x05, // bmAttributes
|
|
0x00, 0x01, // wMaxPacketSize
|
|
0x04, // bInterval
|
|
|
|
/* Audio Streaming Class Specific Data Endpoint descriptor size=8 */
|
|
0x08, // bLength
|
|
0x25, // bDescriptorType
|
|
0x01, // bDescriptorSubType
|
|
0x00, // bmAttributes
|
|
0x00, // bmControls
|
|
0x00, // bLockDelayUnits
|
|
0x00, 0x00, // wLockDelay
|
|
|
|
/* Endpoint descriptor size=7 */
|
|
0x07, // bLength
|
|
0x05, // bDescriptorType
|
|
0x82, // bEndpointAddress
|
|
0x11, // bmAttributes
|
|
0x04, 0x00, // wMaxPacketSize
|
|
0x04, // bInterval
|
|
};
|
|
|
|
UCHAR device_framework_hs[] = {
|
|
/* Device descriptor */
|
|
0x12,
|
|
0x01,
|
|
0x00,
|
|
0x02,
|
|
0x00,
|
|
0x00,
|
|
0x00,
|
|
0x40,
|
|
0x81,
|
|
0x07,
|
|
0x00,
|
|
0x00,
|
|
0x01,
|
|
0x00,
|
|
0x01,
|
|
0x02,
|
|
0x03,
|
|
0x01,
|
|
|
|
/* Device qualifier descriptor */
|
|
0x0a,
|
|
0x06,
|
|
0x00,
|
|
0x02,
|
|
0x00,
|
|
0x00,
|
|
0x00,
|
|
0x40,
|
|
0x01,
|
|
0x00,
|
|
|
|
/* Configuration descriptor */
|
|
0x09,
|
|
0x02,
|
|
0x20,
|
|
0x00,
|
|
0x01,
|
|
0x01,
|
|
0x00,
|
|
0xc0,
|
|
0x32,
|
|
|
|
/* Interface descriptor */
|
|
0x09,
|
|
0x04,
|
|
0x00,
|
|
0x00,
|
|
0x02,
|
|
0x08,
|
|
0x06,
|
|
0x50,
|
|
0x00,
|
|
|
|
/* Endpoint descriptor (Bulk In) */
|
|
0x07,
|
|
0x05,
|
|
0x81,
|
|
0x02,
|
|
0x00,
|
|
0x02,
|
|
0x00,
|
|
|
|
/* Endpoint descriptor (Bulk Out) */
|
|
0x07,
|
|
0x05,
|
|
0x02,
|
|
0x02,
|
|
0x00,
|
|
0x02,
|
|
0x00,
|
|
};
|
|
|
|
/* Note: this is not the standard string descriptor. */
|
|
UCHAR device_framework_string[] = {
|
|
/* Manufacturer string descriptor : Index 1 */
|
|
0x09, 0x04, // wLANGID
|
|
0x01, // bIndex
|
|
0x12, // bLength
|
|
'S', 'T', 'M', 'a', // ..DATA
|
|
'c', 'r', 'o', 'e', // -^
|
|
'l', 'e', 'c', 't', // -^
|
|
'r', 'o', 'n', 'i', // -^
|
|
'c', 's', // -^
|
|
|
|
/* Product string descriptor : Index 2 */
|
|
0x09, 0x04, // wLANGID
|
|
0x02, // bIndex
|
|
0x0a, // bLength
|
|
'L', 'o', '-', 'R', // ..DATA
|
|
'e', 's', ' ', 'D', // -^
|
|
'A', 'C', // -^
|
|
|
|
/* Serial Number string descriptor : Index 3 */
|
|
0x09, 0x04, // wLANGID
|
|
0x03, // bIndex
|
|
0x10, // bLength
|
|
'0', '1', '2', '3', // ..DATA
|
|
'4', '5', '6', '7', // -^
|
|
'8', '9', 'A', 'B', // -^
|
|
'C', 'D', 'E', 'F', // -^
|
|
|
|
0x09, 0x04, // wLANGID
|
|
0x04, // bIndex
|
|
0x05, // bLength
|
|
'A', 'U', 'D', 'I', // ..DATA
|
|
'O', // -^
|
|
};
|
|
|
|
UCHAR device_framework_lang_id[] = {
|
|
/* English. */
|
|
0x09,
|
|
0x04,
|
|
};
|
|
|
|
#endif |