⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cciddriver.h

📁 AT91SAM7S256-USB-CDC for IAR5
💻 H
字号:
/* ----------------------------------------------------------------------------
 *         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.
 * ----------------------------------------------------------------------------
 */

//  Title: cciddriver.h
//
//  About: Purpose
//      Definition of methods for using a CCID device driver.

#ifndef CCID_DRIVER_H
#define CCID_DRIVER_H

// For reference, the absolute maximum block size 
// for a TPDU T=0 block is 260 bytes (5 bytes command; 255 bytes data), or 
// for a TPDU T=1 block is 259 bytes, or 
// for a short APDU T=1 block is 261 bytes, or 
// for an extended APDU T=1 block is 65544 bytes.
#define ABDATA_SIZE 260  //JCB

#define PROTOCOL_TO 0
#define PROTOCOL_T1 1

// Bulk CCID Message header structure
typedef struct
{
   unsigned char bMessageType;
   unsigned long wLength;
   unsigned char bSlot;
   unsigned char bSeq;
   unsigned char bStatus;
   unsigned char bError;
   unsigned char bSpecific;
   unsigned char abData[ABDATA_SIZE];
   unsigned char bSizeToSend;
} __attribute__ ((packed)) S_ccid_bulk_in_header;

// 6.1 Bulk Transfers
typedef struct
{
   unsigned char bMessageType;
   unsigned long wLength;
   unsigned char bSlot;
   unsigned char bSeq;
   unsigned char bSpecific_0;
   unsigned char bSpecific_1;
   unsigned char bSpecific_2;
   unsigned char APDU[ABDATA_SIZE];
} __attribute__ ((packed)) S_ccid_bulk_out_header;


// 6.1.11.2 PIN Verification Data Structure
typedef struct
{
    unsigned char bTimerOut;
    unsigned char bmFormatString;
    unsigned char bmPINBlockString;
    unsigned char bmPINLengthFormat;
    unsigned char wPINMaxExtraDigit;
    unsigned char bEntryValidationCondition;
    unsigned char bNumberMessage;
    unsigned char wLangId;
    unsigned char bMsgIndex;
    unsigned char bTeoPrologue[3];
    unsigned char abPINApdu[255];
}__attribute__ ((packed)) S_ccid_PIN_Verification;


//6.1.11.7 PIN Modification Data Structure
typedef struct
{
    // Number of seconds. If 00h then CCID default value is used.
    unsigned char bTimeOut;
    // Several parameters for the PIN format options (defined in 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -