"); //-->
usb描述的层次结构:
设备描述符
配置描述符
接口0描述符
(类)描述符
端点描述符
接口2描述符
(类)描述符
端点描述符
const u8 BIOSCAN_ConfigDescriptor[DSCR_CNFG_TOTAL] =
{
DSCR_CONFIG_LEN, /* bLength: Configuation Descriptor size */
DSCR_CONFIG, /* bDescriptorType: Configuration */
DSCR_CNFG_TOTAL & 0xFF,
(DSCR_CNFG_TOTAL >> 8) & 0xFF,
0x02,//0x01, /* bNumInterfaces: 1 interface */
0x01, /* bConfigurationValue: Configuration value */
0x00, /* iConfiguration: Index of string descriptor */
/* describing the configuration */
0x80, /* bmAttributes: bus powered */
0x32, /* MaxPower 100 mA: this current is used for detecting Vbus */
//========================================================================================
// Descriptor of Interface
// ---------------------------------------------------------------------------------------
// Interface 0 Alternate setting 0: Descriptor of DFU
//========================================================================================
0x09, // bLength: Interface Descriptor size
0x04, // bDescriptorType: Interface descriptor type
0x00, // bInterfaceNumber: Number of Interface
0x00, // bAlternateSetting: Alternate setting
0x00, // bNumEndpoints
0xFE, // bInterfaceClass: DFU
0x01, // bInterfaceSubClass
0x01, // nInterfaceProtocol
0x05, // iInterface:
//----------- DFU Functional Descriptor -----------
0x09, // bLength
0x21, // bDescriptorType
0x0B, // bmAttributes
0x00,
0x02, // wDetachTimeOut
0x00,
0x04, // wTransferSize
0x1A,
0x01, // bcdDFUVersion
//========================================================================================
// Interface 1 Alternate setting 0 :
//========================================================================================
DSCR_INTRFC_LEN, /* bLength: Interface Descriptor size */
DSCR_INTRFC, /* bDescriptorType: Interface descriptor*/
0x01, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints*/
0xFF, /* bInterfaceClass: BioScan */
0x00, /* bInterfaceSubClass */
0x00, /* nInterfaceProtocol */
0x04, /* iInterface: */
/******************** Descriptor of Endpoint 1********************/
DSCR_ENDPNT_LEN, /*Endpoint descriptor length = 7*/
DSCR_ENDPNT, /*Endpoint descriptor type */
0x81, /*Endpoint address (IN, address 1) */
EP_TYPE_BULK, /*Bulk endpoint type */
0x40, /*Maximum packet size (64 bytes) */
0x00,
0x00, /*Polling interval in milliseconds */
/******************** Descriptor of Endpoint 2********************/
DSCR_ENDPNT_LEN, /*Endpoint descriptor length = 7 */
DSCR_ENDPNT, /*Endpoint descriptor type */
0x02, /*Endpoint address (OUT, address 2) */
EP_TYPE_BULK, /*Bulk endpoint type */
0x40, /*Maximum packet size (64 bytes) */
0x00,
0x00 /*Polling interval in milliseconds*/
};
根据DFU协议,进入dfu状态后
const u8 DFU_ConfigDescriptor[DFU_SIZ_CONFIG_DESC] =
{
0x09, /* bLength: Configuation Descriptor size */
0x02, /* bDescriptorType: Configuration */
DFU_SIZ_CONFIG_DESC, /* wTotalLength: Bytes returned */
0x00,
0x01, // bNumInterfaces: 1 interface
0x01, // bConfigurationValue: Configuration value
0x00, // iConfiguration: Index of string descriptor, describing the configuration
0x80, // bmAttributes: bus powered
0x32, // MaxPower 100 mA: this current is used for detecting Vbus
/* 09 */
/************ Descriptor of DFU interface 0 Alternate setting 0 *********/
0x09, /* bLength: Interface Descriptor size */
0x04, /* bDescriptorType: Interface descriptor type */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x00, /* bNumEndpoints*/
0xFE, /* bInterfaceClass: DFU */
0x01, /* bInterfaceSubClass */
0x02, /* nInterfaceProtocol */
0x04, /* iInterface: Index of string descriptor */
//----------- DFU Functional Descriptor -----------
0x09, // bLength
0x21, // bDescriptorType
0x0B, // bmAttributes
0x00,
0x02, // wDetachTimeOut
0x00,
0x04, // wTransferSize
0x1A,
0x01 // bcdDFUVersion
};
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。