\r
void MifareEMemSet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain){\r
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);\r
- //emlSetMem(datain, arg0, arg1); // data, block num, blocks count \r
+ if (arg2==0) arg2 = 16; // backwards compat... default bytewidth\r
emlSetMem_xt(datain, arg0, arg1, arg2); // data, block num, blocks count, block byte width\r
}\r
\r
if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {\r
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card");\r
OnErrorMagic(MAGIC_UID);\r
- };\r
- };\r
+ }\r
+ }\r
\r
// wipe tag, fill it with zeros\r
if (workFlags & MAGIC_WIPE){\r
if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("wupC1 error");\r
OnErrorMagic(MAGIC_WIPE);\r
- };\r
+ }\r
\r
ReaderTransmit(wipeC, sizeof(wipeC), NULL);\r
if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("wipeC error");\r
OnErrorMagic(MAGIC_WIPE);\r
- };\r
- }; \r
+ }\r
+ } \r
\r
// write block\r
if (workFlags & MAGIC_WUPC) {\r
if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("wupC1 error");\r
OnErrorMagic(MAGIC_WUPC);\r
- };\r
+ }\r
\r
ReaderTransmit(wupC2, sizeof(wupC2), NULL);\r
if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("wupC2 error");\r
OnErrorMagic(MAGIC_WUPC);\r
- };\r
+ }\r
}\r
\r
if ((mifare_sendcmd_short(NULL, 0, ISO14443A_CMD_WRITEBLOCK, blockNo, receivedAnswer, receivedAnswerPar, NULL) != 1) || (receivedAnswer[0] != 0x0a)) {\r
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("write block send command error");\r
OnErrorMagic(4);\r
- };\r
+ }\r
\r
memcpy(data, datain, 16);\r
AppendCrc14443a(data, 16);\r
if ((ReaderReceive(receivedAnswer, receivedAnswerPar) != 1) || (receivedAnswer[0] != 0x0a)) {\r
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("write block send data error");\r
OnErrorMagic(0);\r
- }; \r
+ } \r
\r
if (workFlags & MAGIC_OFF) \r
mifare_classic_halt_ex(NULL);\r
if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("wupC1 error");\r
OnErrorMagic(MAGIC_WUPC);\r
- };\r
+ }\r
\r
ReaderTransmit(wupC2, sizeof(wupC2), NULL);\r
if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("wupC2 error");\r
OnErrorMagic(MAGIC_WUPC);\r
- };\r
+ }\r
}\r
\r
// read block \r
if ((mifare_sendcmd_short(NULL, 0, ISO14443A_CMD_READBLOCK, blockNo, receivedAnswer, receivedAnswerPar, NULL) != 18)) {\r
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("read block send command error");\r
OnErrorMagic(0);\r
- };\r
+ }\r
\r
memcpy(data, receivedAnswer, sizeof(data));\r
\r
void MifareCIdent(){\r
\r
// variables\r
- byte_t isOK = 1; \r
+ bool isOK = true; \r
uint8_t receivedAnswer[1];\r
uint8_t receivedAnswerPar[1];\r
\r
ReaderTransmitBitsPar(wupC1,7,0, NULL);\r
if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
- isOK = 0;\r
- };\r
+ isOK = false;\r
+ }\r
\r
ReaderTransmit(wupC2, sizeof(wupC2), NULL);\r
if(!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {\r
- isOK = 0;\r
- };\r
+ isOK = false;\r
+ }\r
\r
// removed the if, since some magic tags misbehavies and send an answer to it.\r
mifare_classic_halt(NULL, 0);\r