亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cciddriver.c

?? IAR5.2下 AT91SAM9260 ARM 對 MCP2515 控制源化碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* ----------------------------------------------------------------------------
 *         ATMEL Microcontroller Software Support 
 * ----------------------------------------------------------------------------
 * Copyright (c) 2008, Atmel Corporation
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the disclaimer below.
 *
 * Atmel's name may not be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ----------------------------------------------------------------------------
 */

//------------------------------------------------------------------------------
/// \unit
/// !Purpose
/// 
/// CCID driver
/// 
/// !Usage
/// 
/// Explanation on the usage of the code made available through the header file.
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//       Headers
//------------------------------------------------------------------------------


#include <board.h>
#include <utility/trace.h>
#include <usb/device/core/USBD.h>
#include <usb/device/core/USBDDriver.h>
#include <usb/common/core/USBGenericRequest.h>
#include <usb/common/core/USBStringDescriptor.h>
#include <usb/device/ccid/cciddriver.h>
#include <usb/device/ccid/cciddriverdescriptors.h>
#include <iso7816/iso7816_3.h>
#include <iso7816/iso7816_4.h>

#include <string.h>



//------------------------------------------------------------------------------
//  Constants: IDs
//      CCIDDriverDescriptors_PRODUCTID - Device product ID.
//      CCIDDriverDescriptors_VENDORID  - Device vendor ID.
//      CCIDDriverDescriptors_RELEASE   - Device release number.
//------------------------------------------------------------------------------
#define CCIDDriverDescriptors_PRODUCTID       0x6129
#define CCIDDriverDescriptors_VENDORID        0x03EB
#define CCIDDriverDescriptors_RELEASE         0x0100

//------------------------------------------------------------------------------
//         Macros
//------------------------------------------------------------------------------

/// Returns the minimum between two values.
#define MIN(a, b)       ((a < b) ? a : b)

//------------------------------------------------------------------------------
//    Type: CCIDDriverConfigurationDescriptors
//        List of descriptors that make up the configuration descriptors of a
//        device using the CCID driver.
//
//    Variables:
//        configuration - Configuration descriptor.
//        interface - Interface descriptor.
//        ccid - CCID descriptor.
//        bulkOut - Bulk OUT endpoint descriptor.
//        bulkIn - Bulk IN endpoint descriptor.
//        interruptOut - Interrupt OUT endpoint descriptor.
//------------------------------------------------------------------------------
typedef struct {

    USBConfigurationDescriptor configuration;
    USBInterfaceDescriptor     interface;
    CCIDDescriptor             ccid;
    USBEndpointDescriptor      bulkOut;
    USBEndpointDescriptor      bulkIn;
    USBEndpointDescriptor      interruptIn;

} __attribute__ ((packed)) CCIDDriverConfigurationDescriptors;

//------------------------------------------------------------------------------
//      Global variables
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//  Type: CCDIDriver
//      Driver structure for an CCID device.
//
//  Variables:
//      usbdDriver - Standard USB device driver instance.
//------------------------------------------------------------------------------
typedef struct {

    USBDDriver             usbdDriver;
    S_ccid_bulk_in_header  sCcidMessage;
    S_ccid_bulk_out_header sCcidCommand;
    unsigned char          BufferINT[4];
    unsigned char          ProtocolDataStructure[10];
    unsigned char          bProtocol;
    unsigned char          SlotStatus;

} CCIDDriver;

// SlotStatus
// Bit 0 = Slot 0 current state
// Bit 1 = Slot 0 changed status
// Bit 2 = Slot 1 current state
// Bit 3 = Slot 1 changed status
// Bit 4 = Slot 2 current state
// Bit 5 = Slot 2 changed status



//------------------------------------------------------------------------------
//         Internal variables
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//  Variable: ccidDriver
//      Static instance of the CCID device driver.
//------------------------------------------------------------------------------
static CCIDDriver ccidDriver;

//------------------------------------------------------------------------------
//  Variable: deviceDescriptor
//     Standard USB device descriptor.
//------------------------------------------------------------------------------
static const USBDeviceDescriptor deviceDescriptor = {

    sizeof(USBDeviceDescriptor),
    USBGenericDescriptor_DEVICE,
    USBDeviceDescriptor_USB2_00,
    0,
    0,
    0,
    BOARD_USB_ENDPOINTS_MAXPACKETSIZE(0),
    CCIDDriverDescriptors_VENDORID,
    CCIDDriverDescriptors_PRODUCTID,
    CCIDDriverDescriptors_RELEASE,
    1, // Index of manufacturer description
    2, // Index of product description
    3, // Index of serial number description
    1  // One possible configuration
};


//------------------------------------------------------------------------------
//  Variable: configurationDescriptors
//      List of configuration descriptors.
//------------------------------------------------------------------------------
static const CCIDDriverConfigurationDescriptors configurationDescriptorsFS = {

    // Standard USB configuration descriptor
    {
        sizeof(USBConfigurationDescriptor),
        USBGenericDescriptor_CONFIGURATION,
        sizeof(CCIDDriverConfigurationDescriptors),
        1, // One interface in this configuration
        1, // This is configuration #1
        0, // No associated string descriptor
        BOARD_USB_BMATTRIBUTES,
        USBConfigurationDescriptor_POWER(100)
    },
    // CCID interface descriptor
    // Table 4.3-1 Interface Descriptor
    // Interface descriptor
    {
        sizeof(USBInterfaceDescriptor),
        USBGenericDescriptor_INTERFACE,
        0,                       // Interface 0
        0,                       // No alternate settings
        3,                       // uses bulk-IN, bulk-OUT and interrupt朓N
        SMART_CARD_DEVICE_CLASS,
        0,                       // Subclass code
        0,                       // bulk transfers optional interrupt-IN
        0                        // No associated string descriptor
    },
    {
        sizeof(CCIDDescriptor), // bLength: Size of this descriptor in bytes
        CCID_DECRIPTOR_TYPE,    // bDescriptorType:Functional descriptor type
        CCID1_10,               // bcdCCID: CCID version
        0,               // bMaxSlotIndex: Value 0 indicates that one slot is supported
        VOLTS_5_0,       // bVoltageSupport
        PROTOCOL_TO,     // dwProtocols
        3580,            // dwDefaultClock
        3580,            // dwMaxClock
        0,               // bNumClockSupported
        9600,            // dwDataRate : 9600 bauds
        9600,            // dwMaxDataRate : 9600 bauds
        0,               // bNumDataRatesSupported
        0xfe,            // dwMaxIFSD
        0,               // dwSynchProtocols
        0,               // dwMechanical
        //0x00010042,      // dwFeatures: Short APDU level exchanges
        CCID_FEATURES_AUTO_PCONF | CCID_FEATURES_AUTO_PNEGO | CCID_FEATURES_EXC_TPDU,
        0x0000010F,      // dwMaxCCIDMessageLength: For extended APDU level the value shall be between 261 + 10
        0xFF,            // bClassGetResponse: Echoes the class of the APDU
        0xFF,            // bClassEnvelope: Echoes the class of the APDU
        0,               // wLcdLayout: no LCD
        0,               // bPINSupport: No PIN
        1                // bMaxCCIDBusySlot
    },
    // Bulk-OUT endpoint descriptor
    {
        sizeof(USBEndpointDescriptor),
        USBGenericDescriptor_ENDPOINT,
        USBEndpointDescriptor_ADDRESS( USBEndpointDescriptor_OUT, CCID_EPT_DATA_OUT ),
        USBEndpointDescriptor_BULK,
        MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CCID_EPT_DATA_OUT),
            USBEndpointDescriptor_MAXBULKSIZE_FS),
        0x00                               // Does not apply to Bulk endpoints
    },
    // Bulk-IN endpoint descriptor
    {
        sizeof(USBEndpointDescriptor),
        USBGenericDescriptor_ENDPOINT,
        USBEndpointDescriptor_ADDRESS( USBEndpointDescriptor_IN, CCID_EPT_DATA_IN ),
        USBEndpointDescriptor_BULK,
        MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CCID_EPT_DATA_IN),
            USBEndpointDescriptor_MAXBULKSIZE_FS),
        0x00                               // Does not apply to Bulk endpoints
    },
    // Notification endpoint descriptor
    {
        sizeof(USBEndpointDescriptor),
        USBGenericDescriptor_ENDPOINT,
        USBEndpointDescriptor_ADDRESS( USBEndpointDescriptor_IN, CCID_EPT_NOTIFICATION ),
        USBEndpointDescriptor_INTERRUPT,
        MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CCID_EPT_NOTIFICATION),
            USBEndpointDescriptor_MAXINTERRUPTSIZE_FS),
        0x10                              
    }
};

#ifdef BOARD_USB_UDPHS
static const CCIDDriverConfigurationDescriptors configurationDescriptorsHS = {

    // Standard USB configuration descriptor
    {
        sizeof(USBConfigurationDescriptor),
        USBGenericDescriptor_CONFIGURATION,
        sizeof(CCIDDriverConfigurationDescriptors),
        1, // One interface in this configuration
        1, // This is configuration #1
        0, // No associated string descriptor
        BOARD_USB_BMATTRIBUTES,
        USBConfigurationDescriptor_POWER(100)
    },
    // CCID interface descriptor
    // Table 4.3-1 Interface Descriptor
    // Interface descriptor
    {
        sizeof(USBInterfaceDescriptor),
        USBGenericDescriptor_INTERFACE,
        0,                       // Interface 0
        0,                       // No alternate settings
        3,                       // uses bulk-IN, bulk-OUT and interrupt朓N
        SMART_CARD_DEVICE_CLASS,
        0,                       // Subclass code
        0,                       // bulk transfers optional interrupt-IN
        0                        // No associated string descriptor
    },
    {
        sizeof(CCIDDescriptor), // bLength: Size of this descriptor in bytes
        CCID_DECRIPTOR_TYPE,    // bDescriptorType:Functional descriptor type
        CCID1_10,               // bcdCCID: CCID version
        0,               // bMaxSlotIndex: Value 0 indicates that one slot is supported
        VOLTS_5_0,       // bVoltageSupport
        PROTOCOL_TO,     // dwProtocols
        3580,            // dwDefaultClock
        3580,            // dwMaxClock
        0,               // bNumClockSupported
        9600,            // dwDataRate : 9600 bauds
        9600,            // dwMaxDataRate : 9600 bauds
        0,               // bNumDataRatesSupported
        0xfe,            // dwMaxIFSD
        0,               // dwSynchProtocols
        0,               // dwMechanical
        //0x00010042,      // dwFeatures: Short APDU level exchanges
        CCID_FEATURES_AUTO_PCONF | CCID_FEATURES_AUTO_PNEGO | CCID_FEATURES_EXC_TPDU,
        0x0000010F,      // dwMaxCCIDMessageLength: For extended APDU level the value shall be between 261 + 10
        0xFF,            // bClassGetResponse: Echoes the class of the APDU
        0xFF,            // bClassEnvelope: Echoes the class of the APDU
        0,               // wLcdLayout: no LCD
        0,               // bPINSupport: No PIN
        1                // bMaxCCIDBusySlot
    },
    // Bulk-OUT endpoint descriptor
    {
        sizeof(USBEndpointDescriptor),
        USBGenericDescriptor_ENDPOINT,
        USBEndpointDescriptor_ADDRESS( USBEndpointDescriptor_OUT, CCID_EPT_DATA_OUT ),
        USBEndpointDescriptor_BULK,
        MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CCID_EPT_DATA_OUT),
            USBEndpointDescriptor_MAXBULKSIZE_HS),
        0x00                               // Does not apply to Bulk endpoints
    },
    // Bulk-IN endpoint descriptor
    {
        sizeof(USBEndpointDescriptor),
        USBGenericDescriptor_ENDPOINT,
        USBEndpointDescriptor_ADDRESS( USBEndpointDescriptor_IN, CCID_EPT_DATA_IN ),
        USBEndpointDescriptor_BULK,
        MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CCID_EPT_DATA_IN),
            USBEndpointDescriptor_MAXBULKSIZE_HS),
        0x00                               // Does not apply to Bulk endpoints
    },
    // Notification endpoint descriptor
    {
        sizeof(USBEndpointDescriptor),
        USBGenericDescriptor_ENDPOINT,
        USBEndpointDescriptor_ADDRESS( USBEndpointDescriptor_IN, CCID_EPT_NOTIFICATION ),
        USBEndpointDescriptor_INTERRUPT,
        MIN(BOARD_USB_ENDPOINTS_MAXPACKETSIZE(CCID_EPT_NOTIFICATION),
            USBEndpointDescriptor_MAXINTERRUPTSIZE_HS),
        0x10                              
    }
};

// Qualifier descriptor
const USBDeviceQualifierDescriptor deviceQualifierDescriptor = {

    sizeof(USBDeviceQualifierDescriptor),  // Size of this descriptor in bytes
    USBGenericDescriptor_DEVICEQUALIFIER,  // Qualifier Descriptor Type
    USBDeviceDescriptor_USB2_00,           // USB specification 2.00
    0x00,                                  // Class is specified in interface

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲精品福利| 午夜一区二区三区在线观看| 久久精品99国产国产精| 欧美久久久久久久久中文字幕| www.成人在线| 日韩欧美激情一区| 亚洲自拍与偷拍| av午夜精品一区二区三区| 精品乱码亚洲一区二区不卡| 亚洲成av人片观看| av电影在线观看不卡| 国产三级久久久| 日本不卡高清视频| 欧美日韩国产一二三| 亚洲天堂福利av| 国产精品夜夜嗨| 精品剧情v国产在线观看在线| 亚洲一二三四区不卡| 99久久精品免费看国产| 国产欧美日韩视频在线观看| 日本伊人精品一区二区三区观看方式| 91丨九色丨黑人外教| 欧美国产乱子伦| 成人永久看片免费视频天堂| 91麻豆精品国产综合久久久久久| 一区二区三区国产精华| 一本一道久久a久久精品综合蜜臀| 久久久久久久久久久久电影| 极品美女销魂一区二区三区| 日韩视频免费观看高清完整版在线观看 | 亚洲免费av观看| 99精品一区二区三区| 中文字幕一区二区在线观看| eeuss影院一区二区三区| 亚洲欧美综合色| 99麻豆久久久国产精品免费优播| 日本一二三四高清不卡| 成人网页在线观看| 亚洲视频在线一区二区| 色老综合老女人久久久| 亚洲一区二区黄色| 制服丝袜亚洲播放| 极品尤物av久久免费看| 久久男人中文字幕资源站| 岛国精品在线观看| |精品福利一区二区三区| 色综合久久66| 日韩黄色在线观看| 久久久久久久久久看片| av成人免费在线| 天天做天天摸天天爽国产一区 | 91久久精品一区二区三区| 亚洲一区在线观看免费观看电影高清| 色综合久久66| 久久精品国产免费| 国产精品美日韩| 欧美性受xxxx| 国产一区二区在线影院| 中文字幕永久在线不卡| 欧美日精品一区视频| 国产乱人伦精品一区二区在线观看| 国产日韩v精品一区二区| 97成人超碰视| 奇米精品一区二区三区四区| 中文文精品字幕一区二区| 欧美性色aⅴ视频一区日韩精品| 日韩黄色片在线观看| 国产人妖乱国产精品人妖| 在线看一区二区| 国产成人欧美日韩在线电影| 亚洲国产日韩av| 日本一区二区综合亚洲| 91精品国产综合久久久久久漫画 | 精品综合免费视频观看| 亚洲天堂精品视频| 久久久精品综合| 欧美年轻男男videosbes| 成人精品视频一区二区三区 | 欧美日韩大陆在线| 国产成人自拍网| 日本麻豆一区二区三区视频| 亚洲天天做日日做天天谢日日欢| 精品久久久久久亚洲综合网 | 日韩电影在线观看电影| 中文字幕免费一区| 日韩精品一区在线观看| 在线观看视频欧美| 高清国产午夜精品久久久久久| 日韩国产高清影视| 一区二区三区在线观看欧美| 国产日韩欧美亚洲| 亚洲精品一区二区三区精华液| 欧美日韩一区国产| 91高清视频免费看| 91热门视频在线观看| 国产91综合一区在线观看| 久久av中文字幕片| 麻豆久久一区二区| 视频一区在线视频| 午夜精品久久久久久久久久久| 亚洲精品第1页| 综合婷婷亚洲小说| 国产精品久久久久影院色老大| 精品国产髙清在线看国产毛片| 欧美情侣在线播放| 欧美日韩激情一区二区| 欧美日韩高清一区| 欧美喷水一区二区| 9191久久久久久久久久久| 欧美丝袜丝交足nylons图片| 色视频欧美一区二区三区| 97se亚洲国产综合自在线观| 色综合中文综合网| 99精品在线观看视频| www.一区二区| www.欧美.com| av一本久道久久综合久久鬼色| 成人高清视频免费观看| 成人av网在线| 99久久精品情趣| 岛国精品一区二区| 成人涩涩免费视频| 色综合中文综合网| 精品国产百合女同互慰| 久久综合久久综合亚洲| 精品国产一二三区| 国产欧美日韩在线视频| 亚洲国产精品二十页| 亚洲欧洲成人自拍| 亚洲图片欧美视频| 看片的网站亚洲| 国产成a人亚洲精品| 在线国产亚洲欧美| 日韩天堂在线观看| 欧美极品美女视频| 伊人一区二区三区| 久久成人麻豆午夜电影| 福利一区二区在线观看| 色丁香久综合在线久综合在线观看| 欧美性大战久久| 精品久久久久久久久久久院品网 | 免费黄网站欧美| 国产在线国偷精品产拍免费yy| 岛国一区二区三区| 欧美日韩另类国产亚洲欧美一级| 欧美一区二区三区男人的天堂| 久久久亚洲午夜电影| 一区二区三区四区亚洲| 免费国产亚洲视频| 91免费国产在线| 欧美精品一区视频| 一区二区三区产品免费精品久久75| 喷水一区二区三区| 色综合网色综合| 精品精品国产高清a毛片牛牛 | 欧美—级在线免费片| 亚洲电影一区二区| 国产成人免费视频网站高清观看视频| 91九色02白丝porn| 久久久国产午夜精品| 亚洲成人黄色影院| 成人av手机在线观看| 欧美草草影院在线视频| 亚洲一线二线三线视频| 粉嫩aⅴ一区二区三区四区| 欧美一区二区三区婷婷月色| 亚洲日本电影在线| 国产aⅴ精品一区二区三区色成熟| 欧美视频完全免费看| 国产色91在线| 久久国产婷婷国产香蕉| 欧洲另类一二三四区| 中文字幕一区二区三区在线观看| 麻豆久久一区二区| 在线不卡a资源高清| 亚洲视频香蕉人妖| 国产精品亚洲成人| 精品久久久久一区二区国产| 日韩高清不卡在线| 欧美在线色视频| 亚洲欧洲av色图| 成人app软件下载大全免费| 久久久久久毛片| 久久99国产精品免费| 欧美一区欧美二区| 亚洲成av人片在www色猫咪| 日本韩国欧美国产| 中文字幕综合网| 99r国产精品| 中文字幕日韩一区二区| 成人高清免费在线播放| 国产三级精品在线| 成人爽a毛片一区二区免费| 欧美国产日韩精品免费观看| 国产91在线观看丝袜| 亚洲国产成人在线| 99精品欧美一区二区三区小说| 中文字幕一区免费在线观看 | 国产精一区二区三区| 久久精品欧美一区二区三区麻豆|