Continue working on descriptors.

This commit is contained in:
imi415 2022-02-09 18:25:48 +08:00
parent 12e177d375
commit fbbc5da2a9
Signed by: imi415
GPG Key ID: 17F01E106F9F5E0A
2 changed files with 83 additions and 57 deletions

View File

@ -2,7 +2,7 @@
#define USBD_DESCRIPTORS_H
UCHAR device_framework_fs[] = {
/* Device descriptor */
/* Device descriptor, size=18 */
0x12, // bLength
0x01, // bDescriptorType
0x00, 0x02, // bcdUSB
@ -10,25 +10,25 @@ UCHAR device_framework_fs[] = {
0x02, // bDeviceSubClass !! -^
0x01, // bDeviceProtocol !! -^
0x08, // bMaxPacketSize0
0x81, 0x07, // idVendor
0x00, 0x00, // idProduct
0x83, 0x04, // idVendor !! 0x0483
0x30, 0x57, // idProduct !! 0x5730
0x00, 0x00, // bcdDevice
0x01, // iManufacturer
0x02, // iProduct
0x03, // iSerialNumber
0x01, // bNumConfigurations
/* Configuration descriptor */
/* Configuration descriptor size=9 */
0x09, // bLength
0x02, // bDescriptorType
0x20, 0x00, // wTotalLength
0x41, 0x00, // wTotalLength !! 9 + 8 + 9 + 9 + 8 + 8 + 14 + ...
0x01, // bNumInterfaces
0x01, // bConfigurationValue
0x00, // iConfiguration
0xC0, // bmAttributes
0x32, // bMaxPower
0x80, // bmAttributes !! Bus powered
0x39, // bMaxPower
/* Interface Association descriptor <ECN> */
/* Interface Association descriptor <ECN> size=8 */
0x08, // bLength
0x0B, // bDescriptorType !! IAD, See ECN
0x00, // bFirstInterface
@ -38,11 +38,55 @@ UCHAR device_framework_fs[] = {
0x20, // bFunctionProtocol !! AF_VERSION_02_00
0x00, // iFunction
/* Audio Control Interface descriptor */
0x09, // bLength
0x00, // bDescriptorType
0x00, // bInterfaceNumber
/* 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
0x08, // bCategory
0x27, 0x00, // wTotalLength !! UAC2 Table 4-5 9 + 8 + 8 + 14 + ...
0x00, // bmControls
/* Audio Control Clock Source descriptor clockid=0 size=8 */
0x08, // bLength
0x24, // bDescriptorType
0x0A, // bDescriptorSubType
0x00, // bClockID
0x01, // bmAttributes !! Internal fixed clock
0x01, // bmControls
0x00, // bAssocTerminal
0x00, // iClockSource
/* Audio Control Clock Source descriptor clockid=1 size=8 */
0x08, // bLength
0x24, // bDescriptorType
0x0A, // bDescriptorSubType
0x01, // bClockID
0x01, // bmAttributes !! Internal fixed clock
0x01, // bmControls
0x00, // bAssocTerminal
0x00, // iClockSource
/* Audio Control Feature Unit descriptor size=14 */
0x0E, // bLength !!
0x24, // bDescriptorType
0x06, // bDescriptorSubType
0x05, // bUnitID !!
0x04, // bSourceID !!
0x0F, 0x00, 0x00, 0x00, // bmaControls(0) !!
0x0F, 0x00, 0x00, 0x00, // bmaControls(1) !!
0x00, // iFeature
};
UCHAR device_framework_hs[] = {
@ -119,53 +163,35 @@ UCHAR device_framework_hs[] = {
0x00,
};
UCHAR string_device_framework[] = {
/* Note: this is not the standard string descriptor. */
UCHAR device_framework_string[] = {
/* Manufacturer string descriptor : Index 1 */
0x09,
0x04,
0x01,
0x0c,
0x45,
0x78,
0x70,
0x72,
0x65,
0x73,
0x20,
0x4c,
0x6f,
0x67,
0x69,
0x63,
0x09, 0x04, // wLANGID
0x01, // bIndex
0x12, // bLength
'S', 'T', 'M', 'i', // ..DATA
'c', 'r', 'o', 'e', // -^
'l', 'e', 'c', 't', // -^
'r', 'o', 'n', 'i', // -^
'c', 's', // -^
/* Product string descriptor : Index 2 */
0x09,
0x04,
0x02,
0x0a,
0x46,
0x6c,
0x61,
0x73,
0x68,
0x20,
0x44,
0x69,
0x73,
0x6b,
0x09, 0x04, // wLANGID
0x02, // bIndex
0x0a, // bLength
'L', 'o', '-', 'R', // ..DATA
'e', 's', ' ', 'D', // -^
'A', 'C', // -^
/* Serial Number string descriptor : Index 3 */
0x09,
0x04,
0x03,
0x04,
0x30,
0x30,
0x30,
0x31,
0x04, // wLANGID
0x03, // bIndex
0x04, // bLength
0x30, 0x30, 0x30, 0x31, // "0001"
};
UCHAR language_id_framework[] = {
UCHAR device_framework_lang_id[] = {
/* English. */
0x09,
0x04,

View File

@ -132,11 +132,11 @@ void tx_application_define(void *first_unused_memory) {
memory_ptr += 32 * 1024;
_ux_device_stack_initialize(device_framework_hs, sizeof(device_framework_hs),
device_framework_fs, sizeof(device_framework_fs),
string_device_framework, sizeof(string_device_framework),
language_id_framework, sizeof(language_id_framework),
UX_NULL);
ux_device_stack_initialize(device_framework_hs, sizeof(device_framework_hs),
device_framework_fs, sizeof(device_framework_fs),
device_framework_string, sizeof(device_framework_string),
device_framework_lang_id, sizeof(device_framework_lang_id),
UX_NULL);
//_ux_device_stack_class_register(_ux_system_slave_class_audio_name, _ux_device_class_audio_entry, 1, 0, UX_NULL);