Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2616468
  • 博文数量: 877
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 5921
  • 用 户 组: 普通用户
  • 注册时间: 2013-12-05 12:25
个人简介

技术的乐趣在于分享,欢迎多多交流,多多沟通。

文章分类

全部博文(877)

文章存档

2021年(2)

2016年(20)

2015年(471)

2014年(358)

2013年(26)

分类: C/C++

2014-07-04 15:33:41

http://blog.csdn.net/supergame111/article/details/8773756
设备描述符:
USB_DEVICE_DESCRIPTOR  device_descr={
        0x12,
        0x01,        //bDescriptorType: DEVICE
        SWAP(0x0200),        //bcdUSB: usb 2.0
        0,                                // Mass Storage Class
        0,                                //bDeviceSubClass: 0
        0,                                //bDeviceProtocol: class specific protocols NOT used on device basis
        0x40,                //bMaxPacketSize0: maximum packet size for endpoint zero
        SWAP(0x058F),        //idVendor
        SWAP(0x9540),        //idProduct
        SWAP(0x0100),        //bcdDevice
        0x01,                //iManufacturer: index of string
        0x02,            //iProduct: index of manufacturer string
        0x03,             //iSerialNumber: index of product string
        0x01               //bNumConfigurations: 1 configuration
};

配置描述符:
USB_CONFIGURATION_DESCRIPTOR  config_descr = {
        0x09,        //bLength
        0x02,        //bDescriptor 02
        SWAP(0x005d),        //wTotalLength  86=0x0056   32=0x0020  93=0x5d
        0x01,                //bNumInterface
        0x01,                //bConfiguration Value
        0x00,                        //iConfiguration
        0x80,                        //bmAttributes,BUS-POWER
        0xfa                        //bMaxPower,500mA
};

接口描述符:
USB_INTERFACE_DESCRIPTOR inter_descr = {
        0x09,                //bLength: 0x09 bytes
        0x04,                //bDescriptorType: INTERFACE
        0x00,           //bInterfaceNumber: interface 0
        0x00,           //bAlternateSetting: alternate setting 0
        0x03,           //bNumEndpoints: 2 endpoint ,not include zero ep
        0x0B,
        0x00,
        0x00,
        0x00            //iInterface: index of string
};

CCID类描述符:
BYTE ccid_descr[0x36] = {

        0x36,                // bLength: CCID Descriptor size
        0x21,                // bDescriptorType: HID To be updated with CCID specific number
        0x00,0x01,// bcdCCID 0x0110
        0x00,                // bMaxSlotIndex
        0x07,                // bVoltageSupport: 5v, 3v and 1.8v
        0x01,0x00,0x00,0x00,        // dwProtocols: supports T=0 and T=1
        0xA0,0x0F,0x00,0x00,        // dwDefaultClock: 4 Mhz (0x00000FA0)
        0xA0,0x0F,0x00,0x00,        // dwMaximumClock: 4 Mhz (0x00000FA0)
        0x00,                                        // bNumClockSupported => no manual setting
        0x80,0x25,0x00,0x00,        // dwDataRate: 9600 bps (0x00002A00)
        0x80,0x25,0x00,0x00,        // dwMaxDataRate: 9600 bps (0x0001F808)
        0x00,                                        // bNumDataRatesSupported => no manual setting
        0xfe,0x00,0x00,0x00,   /* dwMaxIFSD: 0 (T=0 only)   */
        0x00,0x00,0x00,0x00, /* dwSynchProtocols  */
        0x00,0x00,0x00,0x00,  /* dwMechanical: no special characteristics */
        0x30,0x00,0x01,0x00,        // dwFeatures: clk, baud rate, voltage : automatic CCID can set ICC in clock stop mode.
        0x0f,0x01,0x00,0x00,         /* dwMaxCCIDMessageLength : Maximun block size + header*/ /* 261 + 10   */                                             
        0x00,                        /* bClassGetResponse*/
        0x00,                        /* bClassEnvelope */
        0x00,0x00,                /* wLcdLayout */
        0x00,                        /* bPINSupport : no PIN verif and modif  */
        0x01         // bMaxCCIDBusySlot
        
};

端点描述符:
//Endpoint 1
USB_ENDPOINT_DESCRIPTOR ep_descr_in = {
        0x07,                        //bLength: 0x07 bytes
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x02,                   //bmAttributes: BULK-ONLY(00:Control 01:isoch 10:bulk 11:intr
        SWAP(0x0040),           //wMaxPacketSize: 64 bytes
        0x00                    //bInterval: polling interval is 1 ms
};

//Endpoint1
USB_ENDPOINT_DESCRIPTOR ep_descr_out = {
         0x07,                   //bLength: 0x07 bytes
         0x05,                   //bDescriptorType: ENDPOINT
         0x01,                   //bEndpointAddress: out endpoint 1
         0x02,                   //bmAttributes: BULK-ONLY
         SWAP(0x0040),           //wMaxPacketSize: 64 bytes
         0x00                        //bInterval: polling interval is 1 ms
};

USB_ENDPOINT_DESCRIPTOR ep_descr_intr = {
         0x07,                   //bLength: 0x07 bytes
         0x05,                   //bDescriptorType: ENDPOINT
         0x82,                   //bEndpointAddress: int endpoint 2
         0x03,                   //bmAttributes: intr
         SWAP(0x0010),           //wMaxPacketSize: 64 bytes
         0x18                        //bInterval: polling interval is 24 ms
};
阅读(502) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~