📄 iso14443b.c
字号:
#include <REGX52.H>
#include <main.h>
#include <iso14443b.h>
#include <src632.h>
#include <string.h>
#include <intrins.h>
extern unsigned char g_cFWI;
extern struct TranSciveBuffer{unsigned char MfCommand;
unsigned int MfLength;
unsigned char MfData[64];
};
//////////////////////////////////////////////////////////////////////
//REQUEST B
//////////////////////////////////////////////////////////////////////
char M531PiccRequestB(unsigned char req_code,
unsigned char AFI,
unsigned char N,
unsigned char *ATQB)
{
char status;
struct TranSciveBuffer MfComData;
struct TranSciveBuffer *pi;
pi=&MfComData;
ClearBitMask(RegControl,0x08); // disable crypto 1 unit
SetBitMask(RegTxControl,0x03); // Tx2RF-En, Tx1RF-En enable
PcdSetTmo(5);
MfComData.MfCommand = PCD_TRANSCEIVE;
MfComData.MfLength = 3;
MfComData.MfData[0] = ISO14443B_ANTICOLLISION; // APf code
MfComData.MfData[1] = AFI; //
MfComData.MfData[2] = ((req_code<<3)&0x08) | (N&0x07); // PARAM
status = PcdComTransceive(pi);
if (status!=MI_OK && status!=MI_NOTAGERR)
{ status = MI_COLLERR; }
if (MfComData.MfLength != 96)
{ status = MI_COM_ERR; }
if (status == MI_OK)
{
memcpy(ATQB, &MfComData.MfData[0], 16);
PcdSetTmo(ATQB[11]>>4);
}
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -