本帖最后由 xuqingli123 于 2019-11-12 13:10 编辑
static uint8_t usbd_audio_CfgDesc[AUDIO_CONFIG_DESC_SIZE] =
{
0x09, /* bLength */
0x02, /* bDescriptorType */
LOBYTE(AUDIO_CONFIG_DESC_SIZE), /* wTotalLength */
HIBYTE(AUDIO_CONFIG_DESC_SIZE),
0x03, /* bNumInterfaces */
0x01, /* bConfigurationValue */
0x00, /* iConfiguration */
0xC0, /* bmAttributes BUS Powered*/
0x32, /* bMaxPower = 100 mA*/
/* 09 byte*/
/* Standard Interface Association Descriptor */
0x08,
0x0B,
0x00,
0x03,
0x01,
0x00,
0x20,
0x00,
/* 08 byte */
/* Standard AC Interface Descriptor */
9, /* bLength */
0x04, /* bDescriptorType */
0x00, /* bInterfaceNumber */
0x00, /* bAlternateSetting */
0x00, /* bNumEndpoints */
0x01, /* bInterfaceClass */
0x01, /* bInterfaceSubClass */
0x20, /* bInterfaceProtocol */
0x00, /* iInterface */
/* 09 byte*/
/* Class-specific AC Interface Descriptor */
9, /* bLength */
0x24, /* bDescriptorType */
0x01, /* bDescriptorSubtype */
0x00, /* bcdADC */
0x02, /* 2.00 */
0x0b, /* bCategory */
0x6F, /* wTotalLength */
0x00,
0x00, /* bmControls */
/* 09 byte*/
/* USB Speaker Clock Source Descriptor */
0x08, /* bLength */
0x24, /* bDescriptorType */
0x0A, /* bDescriptorSubtype */
0x04, /* bClockID */
0x03, /* bmAttributes */
0x07, /* bmControls TODO */
0x00, /* bAssocTerminal */
0x00, /* iClockSource */
/* 08 byte*/
/* USB Speaker Input Terminal Descriptor */
0x11, /* bLength */
0x24, /* bDescriptorType */
0x02, /* bDescriptorSubtype */
0x01, /* bTerminalID */
0x01, /* wTerminalType AUDIO_TERMINAL_USB_STREAMING 0x0101 */
0x01,
0x00, /* bAssocTerminal */
0x04, /* bCSourceID*/
0x02, /* bNrChannels */
0x03, /* wChannelConfig 0x00000003 Stereo */
0x00,
0x00,
0x00,
0x00, /* iChannelNames */
0x00, /* bmControls */
0x00,
0x00, /* iTerminal */
/* 17 byte*/
/* USB Speaker Audio Feature Unit Descriptor */
0x12, /* bLength */
0x24, /* bDescriptorType */
0x06, /* bDescriptorSubtype */
0x02, /* bUnitID */
0x01, /* bSourceID */
AUDIO_20_CTL_MUTE(CONTROL_BITMAP_PROG)/* bmaControls(0) */
| AUDIO_20_CTL_VOLUME(CONTROL_BITMAP_PROG),
0x00,
0x00,
0x00,
0x00, /* bmaControls(1) */
0x00,
0x00,
0x00,
0x00, /* bmaControls(2) */
0x00,
0x00,
0x00,
0x00, /* iFeature */
/* 18 byte*/
/*USB Speaker Output Terminal Descriptor */
0x0C, /* bLength */
0x24, /* bDescriptorType */
0x03, /* bDescriptorSubtype */
0x03, /* bTerminalID */
0x01, /* wTerminalType 0x0301: Speaker, 0x0302: Headphone*/
0x03,
0x00, /* bAssocTerminal */
0x01, /* bSourceID */
0x04, /* bCSourceID */
0x00, /* bmControls */
0x00,
0x00, /* iTerminal */
/* 12 byte*/
/* USB Microphone Input Terminal Descriptor */
0x11, /* bLength */
0x24, /* bDescriptorType */
0x02, /* bDescriptorSubtype */
0x05, /* bTerminalID */
0x01, /* wTerminalType AUDIO_TERMINAL_USB_STREAMING 0x0201 */
0x02,
0x00, /* bAssocTerminal */
0x04, /* bCSourceID*/
0x02, /* bNrChannels */
0x03, /* wChannelConfig 0x00000003 Stereo */
0x00,
0x00,
0x00,
0x00, /* iChannelNames */
0x00, /* bmControls */
0x00,
0x00, /* iTerminal */
/* 17 byte*/
/* USB Microphone Audio Feature Unit Descriptor */
0x12, /* bLength */
0x24, /* bDescriptorType */
0x06, /* bDescriptorSubtype */
0x06, /* bUnitID */
0x05, /* bSourceID */
AUDIO_20_CTL_MUTE(CONTROL_BITMAP_PROG)/* bmaControls(0) */
| AUDIO_20_CTL_VOLUME(CONTROL_BITMAP_PROG),
0x00,
0x00,
0x00,
0x00, /* bmaControls(1) */
0x00,
0x00,
0x00,
0x00, /* bmaControls(2) */
0x00,
0x00,
0x00,
0x00, /* iFeature */
/* 18 byte*/
/*USB Microphone Output Terminal Descriptor */
0x0C, /* bLength */
0x24, /* bDescriptorType */
0x03, /* bDescriptorSubtype */
0x07, /* bTerminalID */
0x01, /* wTerminalType 0x0101*/
0x01,
0x00, /* bAssocTerminal */
0x05, /* bSourceID */
0x04, /* bCSourceID */
0x00, /* bmControls */
0x00,
0x00, /* iTerminal */
/* 12 byte*/
/* USB Speaker Standard AS Interface Descriptor - Audio Streaming Zero Bandwidth */
/* Interface 1, Alternate Setting 0 */
9, /* bLength */
0x04, /* bDescriptorType */
0x01, /* bInterfaceNumber */
0x00, /* bAlternateSetting */
0x00, /* bNumEndpoints */
0x01, /* bInterfaceClass */
0x02, /* bInterfaceSubClass */
0x20, /* bInterfaceProtocol */
0x00, /* iInterface */
/* 09 byte*/
/* USB Speaker Standard AS Interface Descriptor - Audio Streaming Operational */
/* Interface 1, Alternate Setting 1 */
9, /* bLength */
0x04, /* bDescriptorType */
0x01, /* bInterfaceNumber */
0x01, /* bAlternateSetting */
0x01, /* bNumEndpoints */
0x01, /* bInterfaceClass */
0x02, /* bInterfaceSubClass */
0x20, /* bInterfaceProtocol */
0x00, /* iInterface */
/* 09 byte*/
/* USB HeadSet Audio Streaming Interface Descriptor */
0x10, /* bLength */
0x24, /* bDescriptorType */
0x01, /* bDescriptorSubtype */
0x01, /* 0x01: bTerminalLink */
0x00, /* bmControls */
0x01, /* bFormatType */
0x01, /* bmFormats PCM */
0x00,
0x00,
0x00,
0x02, /* bNrChannels */
0x03, /* bmChannelConfig */
0x00,
0x00,
0x00,
0x00, /* iChannelNames */
/* 16 byte*/
/* USB Speaker Audio Type I Format Interface Descriptor */
0x06, /* bLength */
0x24, /* bDescriptorType */
0x02, /* bDescriptorSubtype */
0x01, /* bFormatType */
3, /* bSubslotSize */
24, /* bBitResolution */
/* 6 byte*/
/* Endpoint 1 - Standard Descriptor */
0x07, /* bLength */
0x05, /* bDescriptorType */
0x03, /* bEndpointAddress 3 out endpoint for Audio */
0x0d, /* bmAttributes */
AUDIO_PACKET_SZE(384000), /* XXXX wMaxPacketSize in Bytes (Freq(Samples)*2(Stereo)*2(HalfWord)) */
0x01, /* bInterval */
/* 07 byte*/
/* Endpoint - Audio Streaming Descriptor*/
0x08, /* bLength */
0x25, /* bDescriptorType */
0x01, /* bDescriptor */
0x00, /* bmAttributes */
0x00, /* bmControls */
0x00, /* bLockDelayUnits */
0x00, /* wLockDelay */
0x00,
/* 08 byte*/
/* USB Microphone Standard AS Interface Descriptor - Audio Streaming Zero Bandwith */
/* Interface 2, Alternate Setting 0 */
0x09, /* bLength */
0x04, /* bDescriptorType */
0x02, /* bInterfaceNumber */
0x00, /* bAlternateSetting */
0x00, /* bNumEndpoints */
0x01, /* bInterfaceClass */
0x02, /* bInterfaceSubClass */
0x20, /* bInterfaceProtocol */
0x00, /* iInterface */
/* 09 byte*/
/* USB Microphone Standard AS Interface Descriptor - Audio Streaming Operational */
/* Interface 2, Alternate Setting 1 */
0x09, /* bLength */
0x04, /* bDescriptorType */
0x02, /* bInterfaceNumber */
0x01, /* bAlternateSetting */
0x01, /* bNumEndpoints */
0x01, /* bInterfaceClass */
0x02, /* bInterfaceSubClass */
0x20, /* bInterfaceProtocol */
0x00, /* iInterface */
/* 09 byte*/
/* USB Microphone Audio Streaming Interface Descriptor */
0x10, /* bLength */
0x24, /* bDescriptorType */
0x01, /* bDescriptorSubtype */
0x07, /* 0x07: bTerminalLink */
0x00, /* bmControls */
0x01, /* bFormatType */
0x01, /* bmFormats PCM */
0x00,
0x00,
0x00,
0x02, /* bNrChannels */
0x03, /* bmChannelConfig */
0x00,
0x00,
0x00,
0x00, /* iChannelNames */
/* 16 byte*/
/* USB Microphone Audio Type I Format Interface Descriptor */
0x06, /* bLength */
0x24, /* bDescriptorType */
0x02, /* bDescriptorSubtype */
0x01, /* bFormatType */
3, /* bSubslotSize */
24, /* bBitResolution */
/* 6 byte*/
/* Endpoint 1 - Standard Descriptor */
0x07, /* bLength */
0x05, /* bDescriptorType */
0x81, /* bEndpointAddress 3 out endpoint for Audio */
0x0d, /* bmAttributes */
AUDIO_PACKET_SZE(384000), /* XXXX wMaxPacketSize in Bytes (Freq(Samples)*2(Stereo)*2(HalfWord)) */
0x01, /* bInterval */
/* 07 byte*/
/* Endpoint - Audio Streaming Descriptor*/
0x08, /* bLength */
0x25, /* bDescriptorType */
0x01, /* bDescriptor */
0x00, /* bmAttributes */
0x00, /* bmControls */
0x00, /* bLockDelayUnits */
0x00, /* wLockDelay */
0x00,
/* 08 byte*/
} ;
/**
* @}
*/
不知道描述符对不对,刚接触USB AUDIO2.0,大佬们帮忙看下。
|