原创 usb多重接口设备开发——1 单接口配置

2008-7-27 12:31 2734 5 5 分类: MCU/ 嵌入式
首先分别按单接口调试

设备1描述符
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,
   
    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*/
        DSCR_INTRFC_LEN,               /* bLength: Interface Descriptor size */
        DSCR_INTRFC,                   /* bDescriptorType:  Interface descriptor type */
        0x00,                       /* bInterfaceNumber: Number of Interface */
        0x00,                       /* bAlternateSetting: Alternate setting */
        0x02,                       /* bNumEndpoints*/
        0xFF,                          /* bInterfaceClass:   DFU */
        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*/

};

设备2描述符(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 */
        0x00,   /* 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
};

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
我要评论
0
5
关闭 站长推荐上一条 /1 下一条