BYTE b1, b2;\r
\r
if(!GetIso14443CommandFromReader(receivedCmd, &len, 100)) {\r
- DbpIntegers(cmdsRecvd, 0, 0);\r
- DbpString("button press");\r
- break;\r
+ Dbprintf("button pressed, received %d commands", cmdsRecvd);\r
+ break;\r
}\r
\r
// Good, look at the command now.\r
if(len == sizeof(cmd1) && memcmp(receivedCmd, cmd1, len)==0) {\r
resp = resp1; respLen = resp1Len;\r
} else {\r
- DbpString("new cmd from reader:");\r
- DbpIntegers(len, 0x1234, cmdsRecvd);\r
+ Dbprintf("new cmd from reader: len=%d, cmdsRecvd=%d", len, cmdsRecvd);\r
// And print whether the CRC fails, just for good measure\r
ComputeCrc14443(CRC_14443_B, receivedCmd, len-2, &b1, &b2);\r
if(b1 != receivedCmd[len-2] || b2 != receivedCmd[len-1]) {\r
}\r
}\r
AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS;\r
- if (!quiet) DbpIntegers(max, gotFrame, Demod.len);\r
+ if (!quiet) Dbprintf("%x %x %x", max, gotFrame, Demod.len);\r
}\r
\r
//-----------------------------------------------------------------------------\r
// I tried to be systematic and check every answer of the tag, every CRC, etc...\r
//-----------------------------------------------------------------------------\r
void ReadSRI512Iso14443(DWORD parameter)\r
+{\r
+ ReadSTMemoryIso14443(parameter,0x0F);\r
+}\r
+void ReadSRIX4KIso14443(DWORD parameter)\r
+{\r
+ ReadSTMemoryIso14443(parameter,0x7F);\r
+}\r
+\r
+void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)\r
{\r
BYTE i = 0x00;\r
\r
DbpString("No response from tag");\r
return;\r
} else {\r
- DbpString("Randomly generated UID from tag (+ 2 byte CRC):");\r
- DbpIntegers(Demod.output[0], Demod.output[1],Demod.output[2]);\r
+ Dbprintf("Randomly generated UID from tag (+ 2 byte CRC): %x %x %x",\r
+ Demod.output[0], Demod.output[1],Demod.output[2]);\r
}\r
// There is a response, SELECT the uid\r
DbpString("Now SELECT tag:");\r
GetSamplesFor14443Demod(TRUE, 2000,TRUE);\r
// LED_A_OFF();\r
if (Demod.len != 3) {\r
- DbpString("Expected 3 bytes from tag, got:");\r
- DbpIntegers(Demod.len,0x0,0x0);\r
+ Dbprintf("Expected 3 bytes from tag, got %d", Demod.len);\r
return;\r
}\r
// Check the CRC of the answer:\r
}\r
// Check response from the tag: should be the same UID as the command we just sent:\r
if (cmd1[1] != Demod.output[0]) {\r
- DbpString("Bad response to SELECT from Tag, aborting:");\r
- DbpIntegers(cmd1[1],Demod.output[0],0x0);\r
+ Dbprintf("Bad response to SELECT from Tag, aborting: %x %x", cmd1[1], Demod.output[0]);\r
return;\r
}\r
// Tag is now selected,\r
GetSamplesFor14443Demod(TRUE, 2000,TRUE);\r
// LED_A_OFF();\r
if (Demod.len != 10) {\r
- DbpString("Expected 10 bytes from tag, got:");\r
- DbpIntegers(Demod.len,0x0,0x0);\r
+ Dbprintf("Expected 10 bytes from tag, got %d", Demod.len);\r
return;\r
}\r
// The check the CRC of the answer (use cmd1 as temporary variable):\r
ComputeCrc14443(CRC_14443_B, Demod.output, 8, &cmd1[2], &cmd1[3]);\r
if(cmd1[2] != Demod.output[8] || cmd1[3] != Demod.output[9]) {\r
- DbpString("CRC Error reading block! - Below: expected, got");\r
- DbpIntegers( (cmd1[2]<<8)+cmd1[3], (Demod.output[8]<<8)+Demod.output[9],0);\r
+ Dbprintf("CRC Error reading block! - Below: expected, got %x %x",\r
+ (cmd1[2]<<8)+cmd1[3], (Demod.output[8]<<8)+Demod.output[9]);\r
// Do not return;, let's go on... (we should retry, maybe ?)\r
}\r
- DbpString("Tag UID (64 bits):");\r
- DbpIntegers((Demod.output[7]<<24) + (Demod.output[6]<<16) + (Demod.output[5]<<8) + Demod.output[4], (Demod.output[3]<<24) + (Demod.output[2]<<16) + (Demod.output[1]<<8) + Demod.output[0], 0);\r
+ Dbprintf("Tag UID (64 bits): %08x %08x",\r
+ (Demod.output[7]<<24) + (Demod.output[6]<<16) + (Demod.output[5]<<8) + Demod.output[4],\r
+ (Demod.output[3]<<24) + (Demod.output[2]<<16) + (Demod.output[1]<<8) + Demod.output[0]);\r
\r
// Now loop to read all 16 blocks, address from 0 to 15\r
DbpString("Tag memory dump, block 0 to 15");\r
cmd1[0] = 0x08;\r
i = 0x00;\r
+ dwLast++;\r
for (;;) {\r
- if (i == 0x10) {\r
+ if (i == dwLast) {\r
DbpString("System area block (0xff):");\r
i = 0xff;\r
}\r
// The check the CRC of the answer (use cmd1 as temporary variable):\r
ComputeCrc14443(CRC_14443_B, Demod.output, 4, &cmd1[2], &cmd1[3]);\r
if(cmd1[2] != Demod.output[4] || cmd1[3] != Demod.output[5]) {\r
- DbpString("CRC Error reading block! - Below: expected, got");\r
- DbpIntegers( (cmd1[2]<<8)+cmd1[3], (Demod.output[4]<<8)+Demod.output[5],0);\r
+ Dbprintf("CRC Error reading block! - Below: expected, got %x %x",\r
+ (cmd1[2]<<8)+cmd1[3], (Demod.output[4]<<8)+Demod.output[5]);\r
// Do not return;, let's go on... (we should retry, maybe ?)\r
}\r
// Now print out the memory location:\r
- DbpString("Address , Contents, CRC");\r
- DbpIntegers(i, (Demod.output[3]<<24) + (Demod.output[2]<<16) + (Demod.output[1]<<8) + Demod.output[0], (Demod.output[4]<<8)+Demod.output[5]);\r
+ Dbprintf("Address=%x, Contents=%x, CRC=%x", i,\r
+ (Demod.output[3]<<24) + (Demod.output[2]<<16) + (Demod.output[1]<<8) + Demod.output[0],\r
+ (Demod.output[4]<<8)+Demod.output[5]);\r
if (i == 0xff) {\r
break;\r
}\r
if(behindBy > maxBehindBy) {\r
maxBehindBy = behindBy;\r
if(behindBy > (DMA_BUFFER_SIZE-2)) { // TODO: understand whether we can increase/decrease as we want or not?\r
- DbpString("blew circular buffer!");\r
- DbpIntegers(behindBy,0,0);\r
+ Dbprintf("blew circular buffer! behindBy=%x", behindBy);\r
goto done;\r
}\r
}\r
}\r
\r
DbpString("in done pt");\r
-\r
- DbpIntegers(maxBehindBy, Uart.state, Uart.byteCnt);\r
- DbpIntegers(Uart.byteCntMax, traceLen, 0x23);\r
+ Dbprintf("%x %x %x", maxBehindBy, Uart.state, Uart.byteCnt);\r
+ Dbprintf("%x %x %x", Uart.byteCntMax, traceLen, 0x23);\r
\r
done:\r
LED_D_OFF();\r