本帖最后由 xuqingli123 于 2018-7-16 11:20 编辑
__ALIGN_BEGIN static uint8_t usbd_audio_CfgDesc[AUDIO_CONFIG_DESC_SIZE] __ALIGN_END =
{
/* USB Microphone Configuration Descriptor */
0x09, /* bLength */
0x02, /* bDescriptorType */
LOBYTE(AUDIO_CONFIG_DESC_SIZE), /* wTotalLength */
HIBYTE(AUDIO_CONFIG_DESC_SIZE),
0x02, /* bNumInterfaces */
0x01, /* bConfigurationValue */
0x00, /* iConfiguration */
0xC0, /* bmAttributes : Self Powered */
0x32, /* bMaxPower = 100 mA*/
/* 09 byte*/
/* ---------------------------------------------------------------------------*/
/* ------------------ AudioControl Interface ------------------ */
/* USB Microphone Standard AC Interface Descriptor */
0x09, /* bLength */
0x04, /* bDescriptorType */
0x00, /* bInterfaceNumber */
0x00, /* bAlternateSetting */
0x00, /* bNumEndpoints */
0x01, /* bInterfaceClass */
0x01, /* bInterfaceSubClass */
0x00, /* bInterfaceProtocol */
0x00, /* iInterface */
/* 09 byte*/
/* ---------------------------------------------------------------------------*/
/* USB Microphone Class-specific AC Interface Descriptor */
0x09, /* bLength */
0x24, /* bDescriptorType */
0x01, /* bDescriptorSubtype */
0x00, /* 1.00 */ /* bcdADC */
0x01,
0x29, /* wTotalLength */
0x00,
0x01, /* bInCollection */
0x01, /* baInterfaceNr */
/* 09 byte*/
/* USB Microphone Input Terminal Descriptor */
0x0C, /* bLength */
0x24, /* bDescriptorType */
0x02, /* bDescriptorSubtype */
0x01, /* bTerminalID */
0x01, /* wTerminalType : Microphone 0x0201 */
0x02,
0x00, /* bAssocTerminal */
0x01, /* bNrChannels */
0x00, /* wChannelConfig : Mono sets no position bits */
0x00,
0x00, /* iChannelNames */
0x00, /* iTerminal */
/* 12 byte*/
/* USB Microphone Audio Feature Unit Descriptor */
0x08, /* bLength */
0x24, /* bDescriptorType */
0x06, /* bDescriptorSubtype */
0x02, /* bUnitID */
0x01, /* bSourceID */
0x01, /* bControlSize */
0x03, /* bmaControls(0) Mute & Volume */
0x00, /* ?? bmaControls(1) / iTerminal */
/* 8 byte*/
/*USB Microphone Output Terminal Descriptor */
0x09, /* bLength */
0x24, /* bDescriptorType */
0x03, /* bDescriptorSubtype */
0x03, /* bTerminalID */
0x01, /* wTerminalType : USB Streaming */
0x01,
0x00, /* bAssocTerminal */
0x02, /* bSourceID */
0x00, /* iTerminal */
/* 09 byte*/
/* ---------------------------------------------------------------------------*/
/* --------------- AudioStreaming Interface --------------- */
/* USB Microphone Standard AS Interface Descriptor - Audio Streaming Zero Bandwith */
/* Interface 1, Alternate Setting 0 */
0x09, /* bLength */
0x04, /* bDescriptorType */
0x01, /* bInterfaceNumber */
0x00, /* bAlternateSetting */
0x00, /* bNumEndpoints */
0x01, /* bInterfaceClass */
0x02, /* bInterfaceSubClass */
0x00, /* bInterfaceProtocol */
0x00, /* iInterface */
/* 09 byte*/
/* ---------------------------------------------------------------------------*/
/* USB Microphone Standard AS Interface Descriptor - Audio Streaming Operational */
/* Interface 1, Alternate Setting 1 */
0x09, /* bLength */
0x04, /* bDescriptorType */
0x01, /* bInterfaceNumber */
0x01, /* bAlternateSetting */
0x01, /* bNumEndpoints */
0x01, /* bInterfaceClass */
0x02, /* bInterfaceSubClass */
0x00, /* bInterfaceProtocol */
0x00, /* iInterface */
/* 09 byte*/
/* USB Microphone Class-specific AS General Interface Descriptor */
0x07, /* bLength */
0x24, /* bDescriptorType */
0x01, /* bDescriptorSubtype */
0x03, /* bTerminalLink : Unit ID of the Output Terminal*/
0x01, /* bDelay */
0x01, /* wFormatTag : AUDIO_FORMAT_PCM */
0x00,
/* 07 byte*/
/* USB Microphone Audio Type I Format Type Descriptor */
0x0B, /* bLength */
0x24, /* bDescriptorType */
0x02, /* bDescriptorSubtype */
0x01, /* bFormatType */
0x01, /* bNrChannels */
0x04, /* bSubFrameSize : 2 Bytes per audio subframe */
0x18, /* bBitResolution : 16 bits per sample */
0x01, /* bSamFreqType */
//B3VAL(USBD_AUDIO_FREQ), /* tSamFreq : Audio sampling frequency coded on 3 bytes */
// B3VAL(48000),
B3VAL(32000),
// B3VAL(16000),
// B3VAL(8000),
/* 11+9 byte*/
/* USB Microphone Standard AS Audio Data Endpoint Descriptor */
0x09, /* bLength */
0x05, /* bDescriptorType */
0x81, /* bEndpointAddress : IN endpoint 1 */
0x05, /* bmAttributes ¶Ëµã´«ÊäÀàÐÍ */
LOBYTE(AUDIO_IN_PACKET), /* wMaxPacketSize */
HIBYTE(AUDIO_IN_PACKET),
0x01, /* bInterval : one packet per frame */
0x00, /* bRefresh */
0x00, /* bSynchAddress */
/* 09 byte*/
/* USB Microphone Class-specific Isoc. Audio Data Endpoint Descriptor */
0x07, /* bLength */
0x25, /* bDescriptorType */
0x01, /* bDescriptor */
0x01, /* bmAttributes */
0x00, /* bLockDelayUnits */
0x00, /* wLockDelay */
0x00,
/* 07 byte*/
};想枚举出来24位的,但是枚举失败,不知道错在什么地方了,希望各位大佬帮帮忙
|