亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
91精品国产黑色紧身裤美女| 成人国产精品免费观看动漫| 一区二区三区中文在线| 国产精品久久久久久久久免费丝袜 | 亚洲综合网站在线观看| 国产精品女人毛片| 亚洲色欲色欲www| 亚洲女同ⅹxx女同tv| 亚洲视频1区2区| 亚洲综合在线电影| 同产精品九九九| 青青草国产精品亚洲专区无| 久久99精品一区二区三区三区| 日本成人在线一区| 日日摸夜夜添夜夜添国产精品| 亚洲综合小说图片| 免费在线观看视频一区| 精品一区二区在线播放| 成人在线视频一区| 色噜噜狠狠成人网p站| 欧美日韩激情一区二区三区| 91麻豆精品国产综合久久久久久| 欧美mv日韩mv| 最近日韩中文字幕| 天天操天天色综合| 国产精品原创巨作av| 波多野结衣亚洲| 欧美日韩成人激情| 国产亚洲污的网站| 亚洲大片一区二区三区| 国产美女视频一区| 在线免费观看日本一区| 欧美r级电影在线观看| 一区在线观看免费| 麻豆精品视频在线观看免费| jvid福利写真一区二区三区| 欧美影院一区二区| 欧美国产精品劲爆| 亚洲不卡av一区二区三区| 国内精品视频一区二区三区八戒| 日本精品裸体写真集在线观看| 日韩欧美美女一区二区三区| 中文字幕一区二区三区在线播放 | 国产精品全国免费观看高清 | 欧美一区二区精品在线| 久久久久久久久蜜桃| 亚洲一区影音先锋| 从欧美一区二区三区| 欧美日韩高清影院| 成人欧美一区二区三区黑人麻豆 | 国产ts人妖一区二区| 欧美日韩电影在线播放| 亚洲欧洲av色图| 国产成人丝袜美腿| 欧美mv和日韩mv国产网站| 午夜精品久久久久久| 91视视频在线观看入口直接观看www | 欧美日韩在线观看一区二区| 欧美激情一区二区三区四区 | 中文字幕av一区二区三区免费看 | 日韩电影在线观看一区| 亚洲摸摸操操av| 国产成人精品免费看| 91精品国产综合久久福利软件| 国产精品网站导航| 精品一区二区免费看| 欧美亚洲动漫精品| 亚洲图片激情小说| 国产精品综合网| 日韩一二在线观看| 国产精品久久久99| 91麻豆精东视频| 久久精品夜色噜噜亚洲aⅴ| 日韩一区欧美二区| 在线免费精品视频| 依依成人精品视频| av午夜一区麻豆| 久久久久99精品国产片| 久久国产生活片100| 色婷婷综合五月| 一区二区三区四区中文字幕| 成人app在线观看| 国产欧美视频一区二区三区| 精品一区二区在线视频| 日韩欧美高清一区| 久久黄色级2电影| 日韩欧美国产电影| 狠狠v欧美v日韩v亚洲ⅴ| 欧美一级二级在线观看| 日韩av不卡在线观看| 欧美日韩国产首页| 亚洲va欧美va国产va天堂影院| 在线观看国产精品网站| 亚洲午夜视频在线| 欧美日韩的一区二区| 日韩高清在线观看| 欧美日韩激情在线| 国产一区二区三区最好精华液| 久久夜色精品国产噜噜av| 精品午夜久久福利影院 | 色爱区综合激月婷婷| 亚洲男人的天堂在线aⅴ视频| 色天天综合久久久久综合片| 亚洲国产精品自拍| 欧美一区二区三区四区五区| 蜜臀久久99精品久久久久久9| 日韩亚洲国产中文字幕欧美| 九一久久久久久| 日韩一区二区三区精品视频| 激情综合五月天| 国产精品国产自产拍在线| 欧美日韩成人一区二区| 韩国三级在线一区| 亚洲色图在线看| 91精品国产色综合久久久蜜香臀| 久久er精品视频| 欧美国产97人人爽人人喊| 在线亚洲精品福利网址导航| 樱花影视一区二区| 亚洲国产精品成人综合色在线婷婷 | 秋霞国产午夜精品免费视频| 久久久精品国产99久久精品芒果| 99国产精品久久久| 日本亚洲天堂网| 欧美国产丝袜视频| 欧美一区二区三区四区高清| 99精品在线观看视频| 天堂精品中文字幕在线| 国产人伦精品一区二区| 欧美日韩成人一区| 成人高清免费观看| 麻豆91免费看| 亚洲人成7777| 国产亚洲欧美色| 欧美精品99久久久**| 福利一区在线观看| 亚洲色图20p| 中文字幕av一区二区三区 | 日韩成人dvd| 国产精品毛片久久久久久久| 欧美一区二区成人| 91香蕉视频黄| 国产成人av电影在线播放| 天天色图综合网| 一区二区三区.www| 亚洲国产成人在线| 精品国产乱子伦一区| 欧美美女一区二区在线观看| 成人免费看片app下载| 九九**精品视频免费播放| 午夜久久久久久电影| 国产精品久久网站| 日韩一卡二卡三卡| 欧美久久久久久蜜桃| 欧美性xxxxx极品少妇| 99精品黄色片免费大全| 毛片av中文字幕一区二区| 五月综合激情网| 亚洲一区二区中文在线| 最新国产精品久久精品| 国产精品免费视频观看| 国产亚洲精品中文字幕| 日韩精品一区二区三区在线播放| 91久久精品日日躁夜夜躁欧美| 色婷婷综合久久久中文字幕| 91在线视频播放地址| 91丝袜高跟美女视频| 92国产精品观看| 91香蕉视频污| 在线视频国产一区| 91亚洲永久精品| 91精品国产综合久久香蕉的特点 | 欧美大片拔萝卜| 日韩欧美高清一区| 久久青草欧美一区二区三区| 久久久不卡网国产精品二区| 久久网这里都是精品| 欧美高清在线视频| 国产婷婷精品av在线| 亚洲欧美日韩人成在线播放| 亚洲女同ⅹxx女同tv| 天天色 色综合| 国模一区二区三区白浆| 东方aⅴ免费观看久久av| 91丝袜高跟美女视频| 91亚洲精品久久久蜜桃网站| 91久久奴性调教| 日韩精品一区二区三区在线观看| 日韩欧美亚洲国产精品字幕久久久| 精品少妇一区二区三区在线播放| 精品精品欲导航| 中文字幕一区视频| 亚洲第一在线综合网站| 精品午夜久久福利影院| 国内精品视频一区二区三区八戒| 91福利视频网站| 2023国产精品自拍| 亚洲人成人一区二区在线观看| 日本一不卡视频| www.日韩在线|