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

📄 iso_7816_3.h

📁 This zip describes an ISO7816 configuration to read the ATR. Includes main.html file for help. For u
💻 H
字号:
//*----------------------------------------------------------------------------
//*      ATMEL Microcontroller Software Support  -  ROUSSET  -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name           : iso7816_3.h
//* Object              : Types and structures relative to 7816-3
//* 1.0 16/12/97 JLV    : Creation
//* 1.1 15/12/00 JPP    : Change on AT91 Lib
//*----------------------------------------------------------------------------


#ifndef iso7816_3_h
#define iso7816_3_h

/*----- Files to be included Definition -----*/

#include "periph\stdc\std_c.h"

/*---------- Constants Definition ----------*/

// Default values for format and interface characters of Answer To Reset
#define ISO_TS_VAL     0x3B        // Direct convention
#define ISO_T0_VAL     0x7E        // TA1, TB1 and TC1 + 14 historical bytes
#define ISO_CAT_VAL    0x00        // Historical bytes category indicator
#define ISO_PRE_VAL    0x6A        // Pre-issuing data

// Maskbit for T0 ATR
#define T0_BIT_TA1_MASK		0x10
#define T0_BIT_TB1_MASK		0x20
#define T0_BIT_TC1_MASK		0x40
#define T0_BIT_TD1_MASK		0x80

#define T0_HISTORICAL_MASK    0x0F

#define CLASS_PTS    0xFF

#define TIME_ISO_GUARD		11 //* 11 ISO bits time

#define ISO_INIT_RATIO		372
#define ISO_DI_PTS_MASK     0x0F

#define IS0_7813_ATR_HISTORICAL		14
#define IS0_7813_MAX_HISTORICAL  	(IS0_7813_ATR_HISTORICAL+4)
/*-------------- Types Definition ----------*/

/*----------------------------*/
/* Answer To Reset Definition */
/*----------------------------*/
typedef struct ISO_7816_ATR {
   u_char   TS;             // Initial
   u_char   T0;             // Format
   u_char   TA1;            // FI,DI
   u_char   TB1;            // II and PI1
   u_char   TC1;            // N
   u_char   TD1;            // N
   u_char   CAT;            // category indicator
   u_char   PRE;            // Pre-sending data
   u_int    data_size;      //
   u_char   data[IS0_7813_ATR_HISTORICAL];    // Serial number
} ISO_7816_ATR;

/*--------------------*/
/* PTS command format */
/*--------------------*/
typedef struct ISO_7813_T0_PTS {
   u_char  Ptss;    // Instruction class (0xFF)
   u_char  Pts0;    // PTS Format
   u_char  Pts1;    // Parameter 1
   u_char  Pts2;    // Parameter 2
   u_char  Pts3;    // Parameter 3
   u_char  Pck;     // Checksum
} ISO_7813_T0_PTS;


#define ISO_NULL_VAL  0x60    // NULL byte to restart byte procedure


#define mPTS(b)  ((ISO_7813_T0_PTS *)(b))

#endif /* iso7816_3_h */

⌨️ 快捷键说明

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