资源描述:
《基于arn9的射频驱动》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、驱动程序:#include#include//#include#include#include#include#include#include#include#include#include#d
2、efineDEVICE_NAME"shep"#defineled_MAJOR231staticchardevicecount=0;staticintnum=0;///////////////////////////////////////////////////////////////////////函数原型/////////////////////////////////////////////////////////////////////charPcdReset(void);voidPcdAntennaOn(void);voidPcdAnte
3、nnaOff(void);charPcdRequest(unsignedcharreq_code,unsignedchar*pTagType);charPcdAnticoll(unsignedchar*pSnr);charPcdSelect(unsignedchar*pSnr);charPcdAuthState(unsignedcharauth_mode,unsignedcharaddr,unsignedchar*pKey,unsignedchar*pSnr);charPcdRead(unsignedcharaddr,unsignedchar*pD
4、ata);charPcdWrite(unsignedcharaddr,unsignedchar*pData);charPcdValue(unsignedchardd_mode,unsignedcharaddr,unsignedchar*pValue);charPcdBakValue(unsignedcharsourceaddr,unsignedchargoaladdr);charPcdHalt(void);charPcdComMF522(unsignedcharCommand,unsignedchar*pInData,unsignedcharInL
5、enByte,unsignedchar*pOutData,unsignedint*pOutLenBit);voidCalulateCRC(unsignedchar*pIndata,unsignedcharlen,unsignedchar*pOutData);voidWriteRawRC(unsignedcharAddress,unsignedcharvalue);unsignedcharReadRawRC(unsignedcharAddress);voidSetBitMask(unsignedcharreg,unsignedcharmask);vo
6、idClearBitMask(unsignedcharreg,unsignedcharmask);unsignedchardata1[16]={0x12,0x34,0x56,0x78,0xED,0xCB,0xA9,0x87,0x12,0x34,0x56,0x78,0x01,0xFE,0x01,0xFE};//M1卡的某一块写为如下格式,则该块为钱包,可接收扣款和充值命令//4字节金额(低字节在前)+4字节金额取反+4字节金额+1字节块地址+1字节块地址取反+1字节块地址+1字节块地址取反unsignedchardata2[4]={0x12,0,0,
7、0};unsignedcharDefaultKey[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};unsignedcharg_ucTempbuf[20];///////////////////////////////////////////////////////////////////////MF522命令字/////////////////////////////////////////////////////////////////////#definePCD_IDLE0x00//取消当前命令#definePCD_AU
8、THENT0x0E//验证密钥#definePCD_RECEIVE0x08//接收数据#definePCD_TRANSMI