CCID枚举

设备描述符:
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
};


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值