const uint8_t MASS_DeviceDescriptor[MASS_SIZ_DEVICE_DESC] =
{
0x12, // bLength
USB_DEVICE_DESCRIPTOR_TYPE, // bDescriptorType
0x00, // bcdUSB, version 2.00
0x02,
0xef, // bDeviceClass : each interface define the device class
0x02, // bDeviceSubClass
0x01, // bDeviceProtocol
0x40, // bMaxPacketSize0 0x40 = 64
0x83, // idVendor (0483)
0x02,
0x40, // idProduct
0x57,
0x00, // bcdDevice 2.00
0x02,
1, // index of string Manufacturer
//
2, // index of string descriptor of product
//
3, //
//
//
0x01 //bNumConfigurations
};
const uint8_t MASS_ConfigDescriptor[MASS_SIZ_CONFIG_DESC] =
{
0x09, // bLength: Configuation Descriptor size
USB_CONFIGURATION_DESCRIPTOR_TYPE, // bDescriptorType: Configuration
MASS_SIZ_CONFIG_DESC,
0x00,
0x03, // bNumInterfaces: 3 interface
0x01, // bConfigurationValue:
// Configuration value
0x00, // iConfiguration:
// Index of string descriptor
// describing the configuration
0xC0, // bmAttributes:
// bus powered
0x32, // MaxPower 100 mA
// IAD
0x08, //描述符大小
0x0B, //IAD描述符类型
0x00, // bFirstInterface
0x01, // bInterfaceCount
0x08, // bFunctionClass: MASS STORAGE Class
0x06, // bFunctionSubClass
0x50, // bFunctionProtocol
0x04, // iFunction
//******************* Descriptor of Mass Storage interface *******************
// 09
0x09, // bLength: Interface Descriptor size
USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType:
// Interface descriptor type
0x00, // bInterfaceNumber: Number of Interface
0x00, // bAlternateSetting: Alternate setting
0x02, // bNumEndpoints
0x08, // bInterfaceClass: MASS STORAGE Class
0x06, // bInterfaceSubClass : SCSI transparent
0x50, // nInterfaceProtocol
4, // iInterface:
// 18
0x07, //Endpoint descriptor length = 7
USB_ENDPOINT_DESCRIPTOR_TYPE, //Endpoint descriptor type
0x84, //Endpoint address (IN, address 1)
0x02, //Bulk endpoint type
0x40, //Maximum packet size (64 bytes)
0x00,
0x00, //Polling interval in milliseconds
// 25
0x07, //Endpoint descriptor length = 7
USB_ENDPOINT_DESCRIPTOR_TYPE, //Endpoint descriptor type
0x05, //Endpoint address (OUT, address 2)
0x02, //Bulk endpoint type
0x40, //Maximum packet size (64 bytes)
0x00,
0x00, //Polling interval in milliseconds
//32
// IAD
0x08, //描述符大小
0x0B, //IAD描述符类型
0x01, // bFirstInterface
0x02, // bInterfaceCount
0x02, // bFunctionClass: MASS STORAGE Class
0x02, // bFunctionSubClass
0x01, // bFunctionProtocol
0x05, // iFunction
//Interface Descriptor
0x09, // bLength: Interface Descriptor size
USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType: Interface
// Interface descriptor type
0x01, // bInterfaceNumber: Number of Interface
0x00, // bAlternateSetting: Alternate setting
0x01, // bNumEndpoints: One endpoints used
0x02, // bInterfaceClass: Communication Interface Class
0x02, // bInterfaceSubClass: Abstract Control Model
0x01, // bInterfaceProtocol: Common AT commands
0x05, // iInterface:
//Header Functional Descriptor
0x05, // bLength: Endpoint Descriptor size
0x24, // bDescriptorType: CS_INTERFACE
0x00, // bDescriptorSubtype: Header Func Desc
0x10, // bcdCDC: spec release number
0x01,
//Call Managment Functional Descriptor
0x05, // bFunctionLength
0x24, // bDescriptorType: CS_INTERFACE
0x01, // bDescriptorSubtype: Call Management Func Desc
0x00, // bmCapabilities: D0+D1
0x01, // bDataInterface: 1
//ACM Functional Descriptor
0x04, // bFunctionLength
0x24, // bDescriptorType: CS_INTERFACE
0x02, // bDescriptorSubtype: Abstract Control Management desc
0x02, // bmCapabilities
//Union Functional Descriptor
0x05, // bFunctionLength
0x24, // bDescriptorType: CS_INTERFACE
0x06, // bDescriptorSubtype: Union func desc
0x00, // bMasterInterface: Communication class interface
0x01, // bSlaveInterface0: Data Class Interface
//Endpoint 2 Descriptor
0x07, // bLength: Endpoint Descriptor size
USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint
0x84, // bEndpointAddress: (IN3)
0x03, // bmAttributes: Interrupt
VIRTUAL_COM_PORT_INT_SIZE, // wMaxPacketSize:
0x00,
0xFF, // bInterval:
//Data class interface descriptor
0x09, // bLength: Endpoint Descriptor size
USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType:
0x02, // bInterfaceNumber: Number of Interface
0x00, // bAlternateSetting: Alternate setting
0x02, // bNumEndpoints: Two endpoints used
0x0A, // bInterfaceClass: CDC
0x00, // bInterfaceSubClass:
0x00, // bInterfaceProtocol:
0x05, // iInterface:
//Endpoint 3 Descriptor
0x07, // bLength: Endpoint Descriptor size
USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint
0x81, // bEndpointAddress: (IN3)
0x02, // bmAttributes: Bulk
64, // wMaxPacketSize:
0x00,
0x00, // bInterval: ignore for Bulk transfer
//Endpoint 1 Descriptor
0x07, // bLength: Endpoint Descriptor size
USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint
0x03, // bEndpointAddress: (OUT5)
0x02, // bmAttributes: Bulk
64, // wMaxPacketSize:
0x00,
0x00 // bInterval
};
USB复合设备配置,可以参考 |