From cc7d05de0243ae2ff13b785fb597927b248c09a9 Mon Sep 17 00:00:00 2001 From: imi415 Date: Fri, 11 Feb 2022 00:52:12 +0800 Subject: [PATCH] Disable ClockSelector. --- Core/Inc/usbd_descriptors.h | 101 +++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 37 deletions(-) diff --git a/Core/Inc/usbd_descriptors.h b/Core/Inc/usbd_descriptors.h index 409418b..7b49b2a 100644 --- a/Core/Inc/usbd_descriptors.h +++ b/Core/Inc/usbd_descriptors.h @@ -1,6 +1,8 @@ #ifndef USBD_DESCRIPTORS_H #define USBD_DESCRIPTORS_H +#define USBD_SUPPORT_CLOCK_SELECTOR 0 + UCHAR device_framework_fs[] = { /* Device descriptor, size=18 */ 0x12, // bLength @@ -12,7 +14,7 @@ UCHAR device_framework_fs[] = { 0x08, // bMaxPacketSize0 0x83, 0x04, // idVendor !! 0x0483 0x30, 0x57, // idProduct !! 0x5730 - 0x00, 0x00, // bcdDevice + 0x01, 0x00, // bcdDevice 0x01, // iManufacturer 0x02, // iProduct 0x03, // iSerialNumber @@ -30,20 +32,24 @@ UCHAR device_framework_fs[] = { 0x00, // bReserved /* Configuration descriptor size=9 */ - 0x09, // bLength - 0x02, // bDescriptorType - 0xB1, 0x00, // wTotalLength !! 9 + 8 + 9 + 89 + 9 + 9 + 16 + 6 + 8 + 7 + 7 ... - 0x02, // bNumInterfaces - 0x01, // bConfigurationValue - 0x00, // iConfiguration - 0x80, // bmAttributes !! Bus powered - 0x39, // bMaxPower + 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 size=8 */ 0x08, // bLength 0x0B, // bDescriptorType !! IAD, See ECN 0x00, // bFirstInterface - 0x01, // bInterfaceCount + 0x02, // bInterfaceCount 0x01, // bFunctionClass !! AUDIO_FUNCTION 0x00, // bFunctionSubClass !! FUNCTION_SUBCLASS_UNDEFINED 0x20, // bFunctionProtocol !! AF_VERSION_02_00 @@ -65,26 +71,32 @@ UCHAR device_framework_fs[] = { 0x24, // bDescriptorType 0x01, // bDescriptorSubType 0x00, 0x02, // bcdADC !! 2.00 - 0x08, // bCategory + 0x04, // bCategory +#if USBD_SUPPORT_CLOCK_SELECTOR 0x59, 0x00, // wTotalLength !! 9 + 8 + 8 + 8 + 9 + 18 + 17 + 12 + ... - 0x00, // bmControls +#else + 0x40, 0x00, // wTotalLength !! 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 1 + 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 2 + 0x01, // bmAttributes !! Internal fixed clock 0x01, // bmControls 0x00, // bAssocTerminal 0x00, // iClockSource @@ -93,7 +105,7 @@ UCHAR device_framework_fs[] = { 0x08, // bLength 0x24, // bDescriptorType 0x0A, // bDescriptorSubType - 0x11, // bClockID + 0x12, // bClockID 0x05, // bmAttributes !! Sync to SOF 0x01, // bmControls 0x00, // bAssocTerminal @@ -110,7 +122,9 @@ UCHAR device_framework_fs[] = { 0x03, // bmControls !! Windows UAC 2.0 driver does not support SET_CUR. 0x00, // iClockSelector - /* Audio Control Feature Unit descriptor UID=0 size=18 */ +#endif + + /* Audio Control Feature Unit descriptor UID=0x30 size=18 */ 0x12, // bLength !! 0x24, // bDescriptorType 0x06, // bDescriptorSubType @@ -122,13 +136,17 @@ UCHAR device_framework_fs[] = { 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 !! - 0x12, // bCSourceID !! From Clock Selector CID=0x12 + 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 @@ -143,9 +161,13 @@ UCHAR device_framework_fs[] = { 0x02, 0x03, // wTerminalType !! Headphones - 0x0302 0x00, // bAssocTerminal 0x30, // bSourceID !! From Feature Unit UID=0x30 - 0x18, // bCSourceID !! Associate with Clock selector at id=0x18 +#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 - 0x00, // iTerminal + 0x04, // iTerminal /* Audio Streaming Interface descriptor size=9 */ 0x09, // bLength @@ -156,7 +178,7 @@ UCHAR device_framework_fs[] = { 0x01, // bInterfaceClass 0x02, // bInterfaceSubClass 0x20, // bInterfaceProtocol - 0x00, // iInterface + 0x04, // iInterface /* Audio Streaming Interface descriptor size=9 */ 0x09, // bLength @@ -189,6 +211,14 @@ UCHAR device_framework_fs[] = { 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 @@ -198,21 +228,13 @@ UCHAR device_framework_fs[] = { 0x00, // bLockDelayUnits 0x00, 0x00, // wLockDelay - /* Endpoint descriptor size=7 */ - 0x07, // bLength - 0x05, // bDescriptorType - 0x01, // bEndpointAddress - 0x05, // bmAttributes - 0x00, 0x01, // wMaxPacketSize - 0x01, // bInterval - /* Endpoint descriptor size=7 */ 0x07, // bLength 0x05, // bDescriptorType 0x81, // bEndpointAddress 0x11, // bmAttributes 0x04, 0x00, // wMaxPacketSize - 0x01, // bInterval + 0x04, // bInterval }; UCHAR device_framework_hs[] = { @@ -310,14 +332,19 @@ UCHAR device_framework_string[] = { 'A', 'C', // -^ /* Serial Number string descriptor : Index 3 */ - 0x09, - 0x04, // wLANGID + 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[] = {