📄 compositeddriverdescriptors.c
字号:
BOARD_USB_ENDPOINTS_MAXPACKETSIZE(0),
COMPOSITEDDriverDescriptors_VENDORID,
COMPOSITEDDriverDescriptors_PRODUCTID,
COMPOSITEDDriverDescriptors_RELEASE,
0, // No string descriptor for manufacturer
1, // Index of product string descriptor is #1
0, // No string descriptor for serial number
1 // Device has 1 possible configuration
};
#if defined(BOARD_USB_UDPHS)
/// USB device qualifier descriptor.
const USBDeviceQualifierDescriptor qualifierDescriptor = {
sizeof(USBDeviceQualifierDescriptor),
USBGenericDescriptor_DEVICEQUALIFIER,
USBDeviceDescriptor_USB2_00,
#if defined(usb_HIDMSD)
0x00,
0x00,
0x00,
#else
0xEF,// MI
0x02,//
0x01,//
#endif
BOARD_USB_ENDPOINTS_MAXPACKETSIZE(0),
1, // Device has one possible configuration
0 // Reserved
};
#endif
/// USB configuration descriptors for the composite device driver
const CompositeDriverConfigurationDescriptors configurationDescriptors = {
// Standard configuration descriptor
{
sizeof(USBConfigurationDescriptor),
USBGenericDescriptor_CONFIGURATION,
sizeof(CompositeDriverConfigurationDescriptors),
COMPOSITEDDriverDescriptors_NUMINTERFACE,
1, // This is configuration #1
0, // No string descriptor for this configuration
BOARD_USB_BMATTRIBUTES,
USBConfigurationDescriptor_POWER(100)
},
#if defined(usb_CDCAUDIO) || defined(usb_CDCHID) || defined(usb_CDCCDC) || defined(usb_CDCMSD)
// CDC
// IAD for CDC/ACM port
{
sizeof(USBInterfaceAssociationDescriptor),
USBGenericDescriptor_INTERFACEASSOCIATION,
CDCD_Descriptors_INTERFACENUM0,
2,
CDCCommunicationInterfaceDescriptor_CLASS,
CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
0 // No string descriptor for this interface
},
// Communication class interface standard descriptor
{
sizeof(USBInterfaceDescriptor),
USBGenericDescriptor_INTERFACE,
CDCD_Descriptors_INTERFACENUM0, // This is interface #0
0, // This is alternate setting #0 for this interface
1, // This interface uses 1 endpoint
CDCCommunicationInterfaceDescriptor_CLASS,
CDCCommunicationInterfaceDescriptor_ABSTRACTCONTROLMODEL,
CDCCommunicationInterfaceDescriptor_NOPROTOCOL,
0 // No string descriptor for this interface
},
// Class-specific header functional descriptor
{
sizeof(CDCHeaderDescriptor),
CDCGenericDescriptor_INTERFACE,
CDCGenericDescriptor_HEADER,
CDCGenericDescriptor_CDC1_10
},
// Class-specific call management functional descriptor
{
sizeof(CDCCallManagementDescriptor),
CDCGenericDescriptor_INTERFACE,
CDCGenericDescriptor_CALLMANAGEMENT,
CDCCallManagementDescriptor_SELFCALLMANAGEMENT,
CDCD_Descriptors_INTERFACENUM0 + 1 // No associated data interface
},
// Class-specific abstract control management functional descriptor
{
sizeof(CDCAbstractControlManagementDescriptor),
CDCGenericDescriptor_INTERFACE,
CDCGenericDescriptor_ABSTRACTCONTROLMANAGEMENT,
CDCAbstractControlManagementDescriptor_LINE
},
// Class-specific union functional descriptor with one slave interface
{
sizeof(CDCUnionDescriptor),
CDCGenericDescriptor_INTERFACE,
CDCGenericDescriptor_UNION,
CDCD_Descriptors_INTERFACENUM0, // Number of master interface is #0
CDCD_Descriptors_INTERFACENUM0 + 1 // First slave interface is #1
},
// Notification endpoint standard descriptor
{
sizeof(USBEndpointDescriptor),
USBGenericDescriptor_ENDPOINT,
USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
CDCD_Descriptors_NOTIFICATION0),
USBEndpointDescriptor_INTERRUPT,
MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCD_Descriptors_NOTIFICATION0),
USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
10 // Endpoint is polled every 10ms
},
// Data class interface standard descriptor
{
sizeof(USBInterfaceDescriptor),
USBGenericDescriptor_INTERFACE,
CDCD_Descriptors_INTERFACENUM0 + 1, // This is interface #1
0, // This is alternate setting #0 for this interface
2, // This interface uses 2 endpoints
CDCDataInterfaceDescriptor_CLASS,
CDCDataInterfaceDescriptor_SUBCLASS,
CDCDataInterfaceDescriptor_NOPROTOCOL,
0 // No string descriptor for this interface
},
// Bulk-OUT endpoint standard descriptor
{
sizeof(USBEndpointDescriptor),
USBGenericDescriptor_ENDPOINT,
USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_OUT,
CDCD_Descriptors_DATAOUT0),
USBEndpointDescriptor_BULK,
MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCD_Descriptors_DATAOUT0),
USBEndpointDescriptor_MAXBULKSIZE_FS),
0 // Must be 0 for full-speed bulk endpoints
},
// Bulk-IN endpoint descriptor
{
sizeof(USBEndpointDescriptor),
USBGenericDescriptor_ENDPOINT,
USBEndpointDescriptor_ADDRESS(USBEndpointDescriptor_IN,
CDCD_Descriptors_DATAIN0),
USBEndpointDescriptor_BULK,
MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CDCD_Descriptors_DATAIN0),
USBEndpointDescriptor_MAXBULKSIZE_FS),
0 // Must be 0 for full-speed bulk endpoints
},
#endif // (CDC defined)
#if defined(usb_CDCHID) || defined(usb_HIDAUDIO) || defined(usb_HIDMSD)
// Interface descriptor
{
sizeof(USBInterfaceDescriptor),
USBGenericDescriptor_INTERFACE,
HIDD_Descriptors_INTERFACENUM,
0, // This is alternate setting #0
2, // Two endpoints used
HIDInterfaceDescriptor_CLASS,
HIDInterfaceDescriptor_SUBCLASS_NONE,
HIDInterfaceDescriptor_PROTOCOL_NONE,
0 // No associated string descriptor
},
// HID descriptor
{
sizeof(HIDDescriptor),
HIDGenericDescriptor_HID,
HIDDescriptor_HID1_11,
0, // Device is not localized, no country code
1, // One HID-specific descriptor (apart from this one)
HIDGenericDescriptor_REPORT,
HIDD_Descriptors_REPORTSIZE
},
// Interrupt IN endpoint descriptor
{
sizeof(USBEndpointDescriptor),
USBGenericDescriptor_ENDPOINT,
USBEndpointDescriptor_ADDRESS(
USBEndpointDescriptor_IN,
HIDD_Descriptors_INTERRUPTIN),
USBEndpointDescriptor_INTERRUPT,
sizeof(HIDDKeyboardInputReport),
HIDD_Descriptors_INTERRUPTIN_POLLING
},
// Interrupt OUT endpoint descriptor
{
sizeof(USBEndpointDescriptor),
USBGenericDescriptor_ENDPOINT,
USBEndpointDescriptor_ADDRESS(
USBEndpointDescriptor_OUT,
HIDD_Descriptors_INTERRUPTOUT),
USBEndpointDescriptor_INTERRUPT,
sizeof(HIDDKeyboardOutputReport),
HIDD_Descriptors_INTERRUPTIN_POLLING
},
#endif // (HID defined)
#if defined(usb_CDCAUDIO) || defined(usb_HIDAUDIO)
// AUDIO
// IAD for AUDIO function
{
sizeof(USBInterfaceAssociationDescriptor),
USBGenericDescriptor_INTERFACEASSOCIATION,
AUDD_Descriptors_INTERFACE,
2,
AUDControlInterfaceDescriptor_CLASS,
AUDControlInterfaceDescriptor_SUBCLASS,
AUDControlInterfaceDescriptor_PROTOCOL,
0 // No string descriptor for this interface
},
// Audio control interface standard descriptor
{
sizeof(USBInterfaceDescriptor),
USBGenericDescriptor_INTERFACE,
AUDD_Descriptors_CONTROL,
0, // This is alternate setting #0
0, // This interface uses no endpoint
AUDControlInterfaceDescriptor_CLASS,
AUDControlInterfaceDescriptor_SUBCLASS,
AUDControlInterfaceDescriptor_PROTOCOL,
0 // No string descriptor
},
// Audio control interface descriptors
{
// Header descriptor
{
{
sizeof(AUDHeaderDescriptor1),
AUDGenericDescriptor_INTERFACE,
AUDGenericDescriptor_HEADER,
AUDHeaderDescriptor_AUD1_00,
sizeof(AUDDSpeakerDriverAudioControlDescriptors),
1 // One streaming interface
},
AUDD_Descriptors_STREAMING
},
// Input terminal descriptor
{
sizeof(AUDInputTerminalDescriptor),
AUDGenericDescriptor_INTERFACE,
AUDGenericDescriptor_INPUTTERMINAL,
AUDD_Descriptors_INPUTTERMINAL,
AUDInputTerminalDescriptor_USBSTREAMING,
AUDD_Descriptors_OUTPUTTERMINAL,
AUDD_NUMCHANNELS,
AUDInputTerminalDescriptor_LEFTFRONT
| AUDInputTerminalDescriptor_RIGHTFRONT,
0, // No string descriptor for channels
0 // No string descriptor for input terminal
},
// Output terminal descriptor
{
sizeof(AUDOutputTerminalDescriptor),
AUDGenericDescriptor_INTERFACE,
AUDGenericDescriptor_OUTPUTTERMINAL,
AUDD_Descriptors_OUTPUTTERMINAL,
AUDOutputTerminalDescriptor_SPEAKER,
AUDD_Descriptors_INPUTTERMINAL,
AUDD_Descriptors_FEATUREUNIT,
0 // No string descriptor
},
// Feature unit descriptor
{
{
sizeof(AUDFeatureUnitDescriptor3),
AUDGenericDescriptor_INTERFACE,
AUDGenericDescriptor_FEATUREUNIT,
AUDD_Descriptors_FEATUREUNIT,
AUDD_Descriptors_INPUTTERMINAL,
1, // 1 byte per channel for controls
},
{
AUDFeatureUnitDescriptor_MUTE, // Master channel controls
0, // Right channel controls
0 // Left channel controls
},
0 // No string descriptor
}
},
// Audio streaming interface with 0 endpoints
{
sizeof(USBInterfaceDescriptor),
USBGenericDescriptor_INTERFACE,
AUDD_Descriptors_STREAMING,
0, // This is alternate setting #0
0, // This interface uses no endpoints
AUDStreamingInterfaceDescriptor_CLASS,
AUDStreamingInterfaceDescriptor_SUBCLASS,
AUDStreamingInterfaceDescriptor_PROTOCOL,
0 // No string descriptor
},
// Audio streaming interface with data endpoint
{
sizeof(USBInterfaceDescriptor),
USBGenericDescriptor_INTERFACE,
AUDD_Descriptors_STREAMING,
1, // This is alternate setting #1
1, // This interface uses 1 endpoint
AUDStreamingInterfaceDescriptor_CLASS,
AUDStreamingInterfaceDescriptor_SUBCLASS,
AUDStreamingInterfaceDescriptor_PROTOCOL,
0 // No string descriptor
},
// Audio streaming class-specific descriptor
{
sizeof(AUDStreamingInterfaceDescriptor),
AUDGenericDescriptor_INTERFACE,
AUDStreamingInterfaceDescriptor_GENERAL,
AUDD_Descriptors_INPUTTERMINAL,
0, // No internal delay because of data path
AUDFormatTypeOneDescriptor_PCM
},
// Format type I descriptor
{
{
sizeof(AUDFormatTypeOneDescriptor1),
AUDGenericDescriptor_INTERFACE,
AUDStreamingInterfaceDescriptor_FORMATTYPE,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -