📄 icc.h
字号:
/************************
* icc.h *
* Designe by 刘俐训 *
* T = 0 for ic card *
************************/
#ifndef ICC_H
#define ICC_H
#ifndef IC_TYPE
#define IC_TYPE
#define IC_SAM1 0
#define IC_SAM2 1
#define IC_SAM3 2
#define IC_SAMMAX 2 // the last sam card
#define IC_USER 3
#define IC_M1 10 // M1卡
#define IC_MPRO 11 // Mpro卡(特指射频接口)
#define MCU 20 // 单片机
#define SEC 21
#endif
#define CARD_ASYNC 1
#define CARD_SYNC 0
/*
typedef struct _ICC_INFO
{
unsigned char dir; // 字符传送方向,0:先低后高,1:相反
unsigned char protocolid; // 通讯协议,t=0或t=1
unsigned char vpp; // 编成电压信息,t=0,1时存在
unsigned char guardtime; // 保护时间,t=0,1时存在
unsigned int infolen; // IC卡信息域大小
unsigned char historylen; // 历史字符长度
unsigned char history[16]; // 历史字符,包含卡号
} ICC_INFO;
*/
void IccSelect(unsigned char cardid);
int IccRead(char *buf, int len);
int IccWrite(char *buf, int len);
void IccClear(void);
void IccSetTimeout(unsigned int ms);
int IccOpen(char *buf);
void IccInit(void);
void IccClose(void);
bit IccUserTest(void);
// 有卡返回 1,无卡返回 0
bit IccUserEject(void);
// 成功返回 1,失败返回 0
// power on/off user card
void IccUserPower(bit en);
// get overload status
bit IccUserOverLoad(void);
// set user card type
// 1: async, 0: sync
void IccUserSetType(unsigned char type);
/******************* sync card operations *********************/
// write some bytes and read some bytes
bit IccSyncWRWithACK(void *wbuf, int wlen, void *rbuf, int rlen);
// start communication with card
void IccSyncStart(void);
// stop communication with card
void IccSyncStop(void);
// write a char to card and wait for ACK/NAK
bit IccSyncPutCharWaitACK(unsigned char ch);
// read a char from card and write ACK/NAK
unsigned char IccSyncGetCharSendACK(bit fack);
// write some bytes and read some bytes
void IccSyncWR(void *wbuf, int wlen, void *rbuf, int rlen);
// put char
void IccSyncPutChar(unsigned char ch);
// get char
unsigned char IccSyncGetChar(void);
// polling the complete of a processing by reading I/O line.
bit IccSyncPollingIO(unsigned int tm);
// reset
int IccSyncReset(void *buf);
// send a clock puls
void IccSyncClock(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -