Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __ALIGN_BEGIN static uint8_t USBD_AUDIO_CfgDesc[USB_AUDIO_CONFIG_DESC_SIZ] __ALIGN_END =
- {
- /* Configuration 1 */
- 0x09, /* bLength */
- USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType */
- LOBYTE(USB_AUDIO_CONFIG_DESC_SIZ), /* wTotalLength 109 bytes*/
- HIBYTE(USB_AUDIO_CONFIG_DESC_SIZ),
- 0x03, /* bNumInterfaces: conf, in, DFU*/
- 0x01, /* bConfigurationValue */
- USBD_IDX_CONFIG_STR, /* iConfiguration */
- 0x80, /* bmAttributes BUS Powered*/
- 0x32, /* bMaxPower = 100 mA*/
- /* 09 byte*/
- /* USB Microphone Standard interface descriptor */
- 0x09, /* bLength */
- USB_DESC_TYPE_INTERFACE, /* bDescriptorType */
- 0x00, /* bInterfaceNumber */
- 0x00, // Alternate Setting Number
- 0x00, // Number of endpoints in this intf
- USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */
- AUDIO_SUBCLASS_AUDIOCONTROL, /* bInterfaceSubClass */
- 0x00, // Protocol code
- 0x00, // Interface string index
- /* 09 byte*/
- /* USB Microphone Class-specific AC Interface Descriptor */
- 0x09, // Size of this descriptor, in bytes.
- AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
- AUDIO_CONTROL_HEADER, /* bDescriptorSubtype */
- 0x00,0x01, // Audio Device compliant to the USB Audio specification version 1.00
- 0x1E,0x00, // Total number of bytes returned for the class-specific AudioControl interface descriptor.
- // Includes the combined length of this descriptor header and all Unit and Terminal descriptors.
- 0x01, // The number of AudioStreaming interfaces in Audio Interface Collection which this AudioControl interface belongs
- 0x01, // AudioStreaming interface 1 belongs to this AudioControl interface.
- /* 09 byte*/
- /* Microphone Input Terminal */
- /* USB Speaker Input Terminal Descriptor */
- AUDIO_INPUT_TERMINAL_DESC_SIZE, /* bLength */
- AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
- AUDIO_CONTROL_INPUT_TERMINAL, /* bDescriptorSubtype */
- 0x01, /* bTerminalID */
- 0x01, /* wTerminalType 0x0201, generic microphone */
- 0x02,
- 0x00, /* bAssocTerminal */
- 0x0A, /* bNrChannels */
- 0x00, /* wChannelConfig 0x0000 means no spacial info available */
- 0x00,
- 0x00, /* iChannelNames */
- 0x00, /* iTerminal */
- /* 12 byte*/
- /*USB IN (to host) Audio Streaming Output Terminal */
- AUDIO_OUTPUT_TERMINAL_DESC_SIZE, /* bLength */
- AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
- AUDIO_CONTROL_OUTPUT_TERMINAL, /* bDescriptorSubtype */
- 0x04, /* bTerminalID */
- 0x01, /* wTerminalType 0x0101, USB Streaming*/
- 0x01,
- 0x02, /* bAssocTerminal - the USB stream from host */
- 0x01, /* bSourceID - the microphone */
- 0x00, /* iTerminal - unused */
- /* 09 byte*/
- /*
- * Microphone Standard AS Interface Descriptor - Audio Streaming Zero Bandwith
- * Interface 1, Alternate Setting 0
- */
- AUDIO_INTERFACE_DESC_SIZE, /* bLength */
- USB_DESC_TYPE_INTERFACE, /* bDescriptorType */
- 0x01, /* bInterfaceNumber */
- 0x00, /* bAlternateSetting */
- 0x00, /* bNumEndpoints */
- USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */
- AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */
- AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */
- 0x00, /* iInterface */
- /* 09 byte*/
- /* Microphone Standard AS Interface Descriptor - Audio Streaming Operational */
- /* Interface 1, Alternate Setting 1 */
- AUDIO_INTERFACE_DESC_SIZE, /* bLength */
- USB_DESC_TYPE_INTERFACE, /* bDescriptorType */
- 0x01, /* bInterfaceNumber */
- 0x01, /* bAlternateSetting */
- 0x01, /* bNumEndpoints */
- USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */
- AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */
- AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */
- 0x00, /* iInterface */
- /* 09 byte*/
- /* Microphone Class-specific Audio Streaming Interface Descriptor */
- AUDIO_STREAMING_INTERFACE_DESC_SIZE, /* bLength */
- AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
- AUDIO_STREAMING_GENERAL, /* bDescriptorSubtype */
- 0x04, /* bTerminalLink: AudioStream Output Terminal */
- 0x01, /* bDelay */
- 0x01, /* wFormatTag AUDIO_FORMAT_PCM 0x0001*/
- 0x00,
- /* 07 byte*/
- /* Microphone Audio Type I Format Interface Descriptor */
- 0x0B, /* bLength */
- AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
- AUDIO_STREAMING_FORMAT_TYPE, /* bDescriptorSubtype */
- AUDIO_FORMAT_TYPE_I, /* bFormatType */
- 0x0A, /* bNrChannels */
- 0x02, /* bSubFrameSize : 2 Bytes per sample (16bits) */
- 16, /* bBitResolution (16-bits per sample) */
- 0x01, /* bSamFreqType only one frequency supported */
- AUDIO_SAMPLE_FREQ(USBD_AUDIO_FREQ), /* Audio sampling frequency coded on 3 bytes */
- /* 11 byte*/
- /* Endpoint 1 - Standard Descriptor */
- AUDIO_STANDARD_ENDPOINT_DESC_SIZE, /* bLength */
- USB_DESC_TYPE_ENDPOINT, /* bDescriptorType */
- AUDIO_IN_EP, /* bEndpointAddress 1 out endpoint*/
- USBD_EP_TYPE_ISOC, /* bmAttributes */
- AUDIO_PACKET_SZE(USBD_AUDIO_FREQ, 10, 2), /* wMaxPacketSize in Bytes (Freq(Samples)*10(channels)*2(16bit)) */
- 0x01, /* bInterval */
- 0x00, /* bRefresh */
- 0x00, /* bSynchAddress */
- /* 09 byte*/
- /* Endpoint - Audio Streaming Descriptor*/
- AUDIO_STREAMING_ENDPOINT_DESC_SIZE, /* bLength */
- AUDIO_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
- AUDIO_ENDPOINT_GENERAL, /* bDescriptor */
- 0x00, /* bmAttributes */
- 0x00, /* bLockDelayUnits */
- 0x00, /* wLockDelay */
- 0x00,
- /* 07 byte*/
- /* DFU interface - This is just here to show that DFU interface exists. Device will be reset into DFU mode following ctrl command */
- 0x09, /* bLength, 9 bytes */
- 0x04, /* bDescriptor type : Interface */
- 0x02, /* This is the second interface */
- 0x00, /* Zero alternate settings */
- 0x00, /* Only control pipe */
- 0xfe, /* Class code */
- 0x01, /* Upgrade code */
- 0x01, /* Protocol number */
- USBD_IDX_DFU_STR, /* String descriptor index */
- /* DFU function descriptor */
- 0x09,
- 0x21, /* DFU function */
- 0x0B, /* Device will reset the bus, device can upload and download. Not manifestation tolerant (part of ST spec) */
- LOBYTE(200),
- HIBYTE(200), /* Timeout of 0.2s for the host to reset the bus, but device resets within 3ms or so, so unclear how important */
- LOBYTE(12), /* Max number of bytes in a control request, 12 bytes covers all poss commands? */
- HIBYTE(12),
- 0x1a, /* BCD version number for supported DFU protocol - version 1.1a - ST specific DfuSe*/
- 0x01,
- } ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement