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

导读:
  首先分别按单接口调试
  设备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
  };

本文转自
http://blog.ednchina.com/Elecbug/25587/category.aspx
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值