switch away entirely from using DbpInteger to Dbprintf

This commit is contained in:
bushing 2010-01-02 00:34:43 +00:00
commit 850427c8a9
4 changed files with 105 additions and 194 deletions

View file

@ -83,6 +83,7 @@ void DbpString(char *str)
SpinDelay(50); SpinDelay(50);
} }
#if 0
void DbpIntegers(int x1, int x2, int x3) void DbpIntegers(int x1, int x2, int x3)
{ {
/* this holds up stuff unless we're connected to usb */ /* this holds up stuff unless we're connected to usb */
@ -99,6 +100,7 @@ void DbpIntegers(int x1, int x2, int x3)
// XXX // XXX
SpinDelay(50); SpinDelay(50);
} }
#endif
void Dbprintf(const char *fmt, ...) { void Dbprintf(const char *fmt, ...) {
// should probably limit size here; oh well, let's just use a big buffer // should probably limit size here; oh well, let's just use a big buffer
@ -249,12 +251,9 @@ void SimulateTagHfListen(void)
void ReadMem(int addr) void ReadMem(int addr)
{ {
const DWORD *data = ((DWORD *)addr); const DWORD *data = ((DWORD *)addr);
int i;
DbpString("Reading memory at address"); Dbprintf("Reading memory at address %x: %02x %02x %02x %02x %02x %02x %02x %02x",
DbpIntegers(0, 0, addr); addr, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
for (i = 0; i < 8; i+= 2)
DbpIntegers(0, data[i], data[i+1]);
} }
/* osimage version information is linked in */ /* osimage version information is linked in */
@ -340,8 +339,7 @@ void SamyRun()
SpinDelay(500); SpinDelay(500);
CmdHIDdemodFSK(1, &high[selected], &low[selected], 0); CmdHIDdemodFSK(1, &high[selected], &low[selected], 0);
DbpString("Recorded"); Dbprintf("Recorded %x %x %x", selected, high[selected], low[selected]);
DbpIntegers(selected, high[selected], low[selected]);
LEDsoff(); LEDsoff();
LED(selected + 1, 0); LED(selected + 1, 0);
@ -371,7 +369,7 @@ void SamyRun()
// wait for button to be released // wait for button to be released
while(BUTTON_PRESS()) while(BUTTON_PRESS())
WDT_HIT(); WDT_HIT();
DbpIntegers(selected, high[selected], low[selected]); Dbprintf("%x %x %x", selected, high[selected], low[selected]);
CmdHIDsimTAG(high[selected], low[selected], 0); CmdHIDsimTAG(high[selected], low[selected], 0);
DbpString("Done playing"); DbpString("Done playing");
if (BUTTON_HELD(1000) > 0) if (BUTTON_HELD(1000) > 0)
@ -449,17 +447,15 @@ void ListenReaderField(int limit)
lf_av=lf_max=ReadAdc(ADC_CHAN_LF); lf_av=lf_max=ReadAdc(ADC_CHAN_LF);
if(limit != HF_ONLY) { if(limit != HF_ONLY) {
DbpString("LF 125/134 Baseline:"); Dbprintf("LF 125/134 Baseline: %d", lf_av);
DbpIntegers(lf_av,0,0); lf_baseline = lf_av;
lf_baseline= lf_av;
} }
hf_av=hf_max=ReadAdc(ADC_CHAN_HF); hf_av=hf_max=ReadAdc(ADC_CHAN_HF);
if (limit != LF_ONLY) { if (limit != LF_ONLY) {
DbpString("HF 13.56 Baseline:"); Dbprintf("HF 13.56 Baseline: %d", hf_av);
DbpIntegers(hf_av,0,0); hf_baseline = hf_av;
hf_baseline= hf_av;
} }
for(;;) { for(;;) {
@ -490,9 +486,8 @@ void ListenReaderField(int limit)
lf_av_new= ReadAdc(ADC_CHAN_LF); lf_av_new= ReadAdc(ADC_CHAN_LF);
// see if there's a significant change // see if there's a significant change
if(abs(lf_av - lf_av_new) > 10) { if(abs(lf_av - lf_av_new) > 10) {
DbpString("LF 125/134 Field Change:"); Dbprintf("LF 125/134 Field Change: %x %x %x", lf_av, lf_av_new, lf_count);
DbpIntegers(lf_av,lf_av_new,lf_count); lf_av = lf_av_new;
lf_av= lf_av_new;
if (lf_av > lf_max) if (lf_av > lf_max)
lf_max = lf_av; lf_max = lf_av;
lf_count= 0; lf_count= 0;
@ -509,9 +504,8 @@ void ListenReaderField(int limit)
hf_av_new= ReadAdc(ADC_CHAN_HF); hf_av_new= ReadAdc(ADC_CHAN_HF);
// see if there's a significant change // see if there's a significant change
if(abs(hf_av - hf_av_new) > 10) { if(abs(hf_av - hf_av_new) > 10) {
DbpString("HF 13.56 Field Change:"); Dbprintf("HF 13.56 Field Change: %x %x %x", hf_av, hf_av_new, hf_count);
DbpIntegers(hf_av,hf_av_new,hf_count); hf_av = hf_av_new;
hf_av= hf_av_new;
if (hf_av > hf_max) if (hf_av > hf_max)
hf_max = hf_av; hf_max = hf_av;
hf_count= 0; hf_count= 0;

View file

@ -353,9 +353,8 @@ void SimulateIso14443Tag(void)
BYTE b1, b2; BYTE b1, b2;
if(!GetIso14443CommandFromReader(receivedCmd, &len, 100)) { if(!GetIso14443CommandFromReader(receivedCmd, &len, 100)) {
DbpIntegers(cmdsRecvd, 0, 0); Dbprintf("button pressed, received %d commands", cmdsRecvd);
DbpString("button press"); break;
break;
} }
// Good, look at the command now. // Good, look at the command now.
@ -363,8 +362,7 @@ void SimulateIso14443Tag(void)
if(len == sizeof(cmd1) && memcmp(receivedCmd, cmd1, len)==0) { if(len == sizeof(cmd1) && memcmp(receivedCmd, cmd1, len)==0) {
resp = resp1; respLen = resp1Len; resp = resp1; respLen = resp1Len;
} else { } else {
DbpString("new cmd from reader:"); Dbprintf("new cmd from reader: len=%d, cmdsRecvd=%d", len, cmdsRecvd);
DbpIntegers(len, 0x1234, cmdsRecvd);
// And print whether the CRC fails, just for good measure // And print whether the CRC fails, just for good measure
ComputeCrc14443(CRC_14443_B, receivedCmd, len-2, &b1, &b2); ComputeCrc14443(CRC_14443_B, receivedCmd, len-2, &b1, &b2);
if(b1 != receivedCmd[len-2] || b2 != receivedCmd[len-1]) { if(b1 != receivedCmd[len-2] || b2 != receivedCmd[len-1]) {
@ -688,7 +686,7 @@ static void GetSamplesFor14443Demod(BOOL weTx, int n, BOOL quiet)
} }
} }
AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS; AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS;
if (!quiet) DbpIntegers(max, gotFrame, Demod.len); if (!quiet) Dbprintf("%x %x %x", max, gotFrame, Demod.len);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -873,15 +871,15 @@ void AcquireRawAdcSamplesIso14443(DWORD parameter)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ReadSRI512Iso14443(DWORD parameter) void ReadSRI512Iso14443(DWORD parameter)
{ {
ReadSTMemoryIso14443(parameter,0x0F); ReadSTMemoryIso14443(parameter,0x0F);
} }
void ReadSRIX4KIso14443(DWORD parameter) void ReadSRIX4KIso14443(DWORD parameter)
{ {
ReadSTMemoryIso14443(parameter,0x7F); ReadSTMemoryIso14443(parameter,0x7F);
} }
void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast) void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
{ {
BYTE i = 0x00; BYTE i = 0x00;
// Make sure that we start from off, since the tags are stateful; // Make sure that we start from off, since the tags are stateful;
@ -912,8 +910,8 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
DbpString("No response from tag"); DbpString("No response from tag");
return; return;
} else { } else {
DbpString("Randomly generated UID from tag (+ 2 byte CRC):"); Dbprintf("Randomly generated UID from tag (+ 2 byte CRC): %x %x %x",
DbpIntegers(Demod.output[0], Demod.output[1],Demod.output[2]); Demod.output[0], Demod.output[1],Demod.output[2]);
} }
// There is a response, SELECT the uid // There is a response, SELECT the uid
DbpString("Now SELECT tag:"); DbpString("Now SELECT tag:");
@ -926,8 +924,7 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
GetSamplesFor14443Demod(TRUE, 2000,TRUE); GetSamplesFor14443Demod(TRUE, 2000,TRUE);
// LED_A_OFF(); // LED_A_OFF();
if (Demod.len != 3) { if (Demod.len != 3) {
DbpString("Expected 3 bytes from tag, got:"); Dbprintf("Expected 3 bytes from tag, got %d", Demod.len);
DbpIntegers(Demod.len,0x0,0x0);
return; return;
} }
// Check the CRC of the answer: // Check the CRC of the answer:
@ -938,8 +935,7 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
} }
// Check response from the tag: should be the same UID as the command we just sent: // Check response from the tag: should be the same UID as the command we just sent:
if (cmd1[1] != Demod.output[0]) { if (cmd1[1] != Demod.output[0]) {
DbpString("Bad response to SELECT from Tag, aborting:"); Dbprintf("Bad response to SELECT from Tag, aborting: %x %x", cmd1[1], Demod.output[0]);
DbpIntegers(cmd1[1],Demod.output[0],0x0);
return; return;
} }
// Tag is now selected, // Tag is now selected,
@ -952,27 +948,27 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
GetSamplesFor14443Demod(TRUE, 2000,TRUE); GetSamplesFor14443Demod(TRUE, 2000,TRUE);
// LED_A_OFF(); // LED_A_OFF();
if (Demod.len != 10) { if (Demod.len != 10) {
DbpString("Expected 10 bytes from tag, got:"); Dbprintf("Expected 10 bytes from tag, got %d", Demod.len);
DbpIntegers(Demod.len,0x0,0x0);
return; return;
} }
// The check the CRC of the answer (use cmd1 as temporary variable): // The check the CRC of the answer (use cmd1 as temporary variable):
ComputeCrc14443(CRC_14443_B, Demod.output, 8, &cmd1[2], &cmd1[3]); ComputeCrc14443(CRC_14443_B, Demod.output, 8, &cmd1[2], &cmd1[3]);
if(cmd1[2] != Demod.output[8] || cmd1[3] != Demod.output[9]) { if(cmd1[2] != Demod.output[8] || cmd1[3] != Demod.output[9]) {
DbpString("CRC Error reading block! - Below: expected, got"); Dbprintf("CRC Error reading block! - Below: expected, got %x %x",
DbpIntegers( (cmd1[2]<<8)+cmd1[3], (Demod.output[8]<<8)+Demod.output[9],0); (cmd1[2]<<8)+cmd1[3], (Demod.output[8]<<8)+Demod.output[9]);
// Do not return;, let's go on... (we should retry, maybe ?) // Do not return;, let's go on... (we should retry, maybe ?)
} }
DbpString("Tag UID (64 bits):"); Dbprintf("Tag UID (64 bits): %08x %08x",
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); (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]);
// Now loop to read all 16 blocks, address from 0 to 15 // Now loop to read all 16 blocks, address from 0 to 15
DbpString("Tag memory dump, block 0 to 15"); DbpString("Tag memory dump, block 0 to 15");
cmd1[0] = 0x08; cmd1[0] = 0x08;
i = 0x00; i = 0x00;
dwLast++; dwLast++;
for (;;) { for (;;) {
if (i == dwLast) { if (i == dwLast) {
DbpString("System area block (0xff):"); DbpString("System area block (0xff):");
i = 0xff; i = 0xff;
} }
@ -990,13 +986,14 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
// The check the CRC of the answer (use cmd1 as temporary variable): // The check the CRC of the answer (use cmd1 as temporary variable):
ComputeCrc14443(CRC_14443_B, Demod.output, 4, &cmd1[2], &cmd1[3]); ComputeCrc14443(CRC_14443_B, Demod.output, 4, &cmd1[2], &cmd1[3]);
if(cmd1[2] != Demod.output[4] || cmd1[3] != Demod.output[5]) { if(cmd1[2] != Demod.output[4] || cmd1[3] != Demod.output[5]) {
DbpString("CRC Error reading block! - Below: expected, got"); Dbprintf("CRC Error reading block! - Below: expected, got %x %x",
DbpIntegers( (cmd1[2]<<8)+cmd1[3], (Demod.output[4]<<8)+Demod.output[5],0); (cmd1[2]<<8)+cmd1[3], (Demod.output[4]<<8)+Demod.output[5]);
// Do not return;, let's go on... (we should retry, maybe ?) // Do not return;, let's go on... (we should retry, maybe ?)
} }
// Now print out the memory location: // Now print out the memory location:
DbpString("Address , Contents, CRC"); Dbprintf("Address=%x, Contents=%x, CRC=%x", i,
DbpIntegers(i, (Demod.output[3]<<24) + (Demod.output[2]<<16) + (Demod.output[1]<<8) + Demod.output[0], (Demod.output[4]<<8)+Demod.output[5]); (Demod.output[3]<<24) + (Demod.output[2]<<16) + (Demod.output[1]<<8) + Demod.output[0],
(Demod.output[4]<<8)+Demod.output[5]);
if (i == 0xff) { if (i == 0xff) {
break; break;
} }
@ -1084,8 +1081,7 @@ void SnoopIso14443(void)
if(behindBy > maxBehindBy) { if(behindBy > maxBehindBy) {
maxBehindBy = behindBy; maxBehindBy = behindBy;
if(behindBy > (DMA_BUFFER_SIZE-2)) { // TODO: understand whether we can increase/decrease as we want or not? if(behindBy > (DMA_BUFFER_SIZE-2)) { // TODO: understand whether we can increase/decrease as we want or not?
DbpString("blew circular buffer!"); Dbprintf("blew circular buffer! behindBy=%x", behindBy);
DbpIntegers(behindBy,0,0);
goto done; goto done;
} }
} }
@ -1173,9 +1169,8 @@ void SnoopIso14443(void)
} }
DbpString("in done pt"); DbpString("in done pt");
Dbprintf("%x %x %x", maxBehindBy, Uart.state, Uart.byteCnt);
DbpIntegers(maxBehindBy, Uart.state, Uart.byteCnt); Dbprintf("%x %x %x", Uart.byteCntMax, traceLen, 0x23);
DbpIntegers(Uart.byteCntMax, traceLen, 0x23);
done: done:
LED_D_OFF(); LED_D_OFF();

View file

@ -741,13 +741,13 @@ void SnoopIso14443a(void)
DbpString("COMMAND FINISHED"); DbpString("COMMAND FINISHED");
DbpIntegers(maxBehindBy, Uart.state, Uart.byteCnt); Dbprintf("%x %x %x", maxBehindBy, Uart.state, Uart.byteCnt);
DbpIntegers(Uart.byteCntMax, traceLen, (int)Uart.output[0]); Dbprintf("%x %x %x", Uart.byteCntMax, traceLen, (int)Uart.output[0]);
done: done:
AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS; AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS;
DbpIntegers(maxBehindBy, Uart.state, Uart.byteCnt); Dbprintf("%x %x %x", maxBehindBy, Uart.state, Uart.byteCnt);
DbpIntegers(Uart.byteCntMax, traceLen, (int)Uart.output[0]); Dbprintf("%x %x %x", Uart.byteCntMax, traceLen, (int)Uart.output[0]);
LED_A_OFF(); LED_A_OFF();
LED_B_OFF(); LED_B_OFF();
LED_C_OFF(); LED_C_OFF();
@ -1144,8 +1144,8 @@ ComputeCrc14443(CRC_14443_A, response3a, 1, &response3a[1], &response3a[2]);
} else if(receivedCmd[0] == 0x30) { } else if(receivedCmd[0] == 0x30) {
// Received a READ // Received a READ
resp = resp4; respLen = resp4Len; order = 4; // Do nothing resp = resp4; respLen = resp4Len; order = 4; // Do nothing
DbpString("Read request from reader:"); Dbprintf("Read request from reader: %x %x %x",
DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]); receivedCmd[0], receivedCmd[1], receivedCmd[2]);
} else if(receivedCmd[0] == 0x50) { } else if(receivedCmd[0] == 0x50) {
@ -1156,21 +1156,20 @@ ComputeCrc14443(CRC_14443_A, response3a, 1, &response3a[1], &response3a[2]);
} else if(receivedCmd[0] == 0x60) { } else if(receivedCmd[0] == 0x60) {
// Received an authentication request // Received an authentication request
resp = resp5; respLen = resp5Len; order = 7; resp = resp5; respLen = resp5Len; order = 7;
DbpString("Authenticate request from reader:"); Dbprintf("Authenticate request from reader: %x %x %x",
DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]); receivedCmd[0], receivedCmd[1], receivedCmd[2]);
} else if(receivedCmd[0] == 0xE0) { } else if(receivedCmd[0] == 0xE0) {
// Received a RATS request // Received a RATS request
resp = resp1; respLen = 0;order = 70; resp = resp1; respLen = 0;order = 70;
DbpString("RATS request from reader:"); Dbprintf("RATS request from reader: %x %x %x",
DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]); receivedCmd[0], receivedCmd[1], receivedCmd[2]);
} else { } else {
// Never seen this command before // Never seen this command before
DbpString("Unknown command received from reader:"); Dbprintf("Unknown command received from reader: %x %x %x %x %x %x %x %x %x",
DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]); receivedCmd[0], receivedCmd[1], receivedCmd[2],
DbpIntegers(receivedCmd[3], receivedCmd[4], receivedCmd[5]); receivedCmd[3], receivedCmd[3], receivedCmd[4],
DbpIntegers(receivedCmd[6], receivedCmd[7], receivedCmd[8]); receivedCmd[5], receivedCmd[6], receivedCmd[7]);
// Do not respond // Do not respond
resp = resp1; respLen = 0; order = 0; resp = resp1; respLen = 0; order = 0;
} }
@ -1234,7 +1233,7 @@ ComputeCrc14443(CRC_14443_A, response3a, 1, &response3a[1], &response3a[2]);
} }
DbpIntegers(happened, happened2, cmdsRecvd); Dbprintf("%x %x %x", happened, happened2, cmdsRecvd);
LED_A_OFF(); LED_A_OFF();
} }
@ -1694,7 +1693,7 @@ void ReaderIso14443a(DWORD parameter)
// Thats it... // Thats it...
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff(); LEDsoff();
DbpIntegers(rsamples, 0xCC, 0xCC); Dbprintf("%x %x %x", rsamples, 0xCC, 0xCC);
DbpString("ready.."); DbpString("ready..");
} }

View file

@ -926,24 +926,18 @@ void ReaderIso15693(DWORD parameter)
//DbpString(parameter); //DbpString(parameter);
BYTE *receivedAnswer0 = (((BYTE *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much) //BYTE *answer0 = (((BYTE *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much)
BYTE *receivedAnswer1 = (((BYTE *)BigBuf) + 3660); // BYTE *answer1 = (((BYTE *)BigBuf) + 3660); //
BYTE *receivedAnswer2 = (((BYTE *)BigBuf) + 3760); BYTE *answer2 = (((BYTE *)BigBuf) + 3760);
BYTE *receivedAnswer3 = (((BYTE *)BigBuf) + 3860); BYTE *answer3 = (((BYTE *)BigBuf) + 3860);
//BYTE *TagUID= (((BYTE *)BigBuf) + 3960); // where we hold the uid for hi15reader //BYTE *TagUID= (((BYTE *)BigBuf) + 3960); // where we hold the uid for hi15reader
// int responseLen0 = 0; // int answerLen0 = 0;
int responseLen1 = 0; int answerLen1 = 0;
int responseLen2 = 0; int answerLen2 = 0;
int responseLen3 = 0; int answerLen3 = 0;
// Blank arrays // Blank arrays
int j; memset(BigBuf + 3660, 0, 300);
for(j = 0; j < 100; j++) {
receivedAnswer3[j] = 0;
receivedAnswer2[j] =0;
receivedAnswer1[j] = 0;
receivedAnswer0[j] = 0;
}
// Setup SSC // Setup SSC
FpgaSetupSsc(); FpgaSetupSsc();
@ -997,24 +991,24 @@ void ReaderIso15693(DWORD parameter)
//TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait); //TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3 TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3
// Now wait for a response // Now wait for a response
responseLen1 = GetIso15693AnswerFromTag(receivedAnswer1, 100, &samples, &elapsed) ; answerLen1 = GetIso15693AnswerFromTag(answer1, 100, &samples, &elapsed) ;
if (responseLen1 >=12) // we should do a better check than this if (answerLen1 >=12) // we should do a better check than this
{ {
TagUID[0] = receivedAnswer1[2]; TagUID[0] = answer1[2];
TagUID[1] = receivedAnswer1[3]; TagUID[1] = answer1[3];
TagUID[2] = receivedAnswer1[4]; TagUID[2] = answer1[4];
TagUID[3] = receivedAnswer1[5]; TagUID[3] = answer1[5];
TagUID[4] = receivedAnswer1[6]; TagUID[4] = answer1[6];
TagUID[5] = receivedAnswer1[7]; TagUID[5] = answer1[7];
TagUID[6] = receivedAnswer1[8]; // IC Manufacturer code TagUID[6] = answer1[8]; // IC Manufacturer code
// Now send the SELECT command // Now send the SELECT command
BuildSelectRequest(TagUID); BuildSelectRequest(TagUID);
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3 TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3
// Now wait for a response // Now wait for a response
responseLen2 = GetIso15693AnswerFromTag(receivedAnswer2, 100, &samples, &elapsed); answerLen2 = GetIso15693AnswerFromTag(answer2, 100, &samples, &elapsed);
// Now send the MULTI READ command // Now send the MULTI READ command
// BuildArbitraryRequest(*TagUID,parameter); // BuildArbitraryRequest(*TagUID,parameter);
@ -1024,34 +1018,25 @@ void ReaderIso15693(DWORD parameter)
//TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait); //TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3 TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3
// Now wait for a response // Now wait for a response
responseLen3 = GetIso15693AnswerFromTag(receivedAnswer3, 100, &samples, &elapsed) ; answerLen3 = GetIso15693AnswerFromTag(answer3, 100, &samples, &elapsed) ;
} }
char str1 [4]; Dbprintf("%d octets read from IDENTIFY request: %x %x %x %x %x %x %x %x %x", answerLen1,
//char str2 [200]; answer1[0], answer1[1], answer1[2],
int i; answer1[3], answer1[4], answer1[5],
answer1[6], answer1[7], answer1[8]);
itoa(responseLen1,str1); Dbprintf("%d octets read from SELECT request: %x %x %x %x %x %x %x %x %x", answerLen2,
strcat(str1," octets read from IDENTIFY request"); answer2[0], answer2[1], answer2[2],
DbpString(str1); answer2[3], answer2[4], answer2[5],
for(i = 0; i < responseLen1; i+=3) { answer2[6], answer2[7], answer2[8]);
DbpIntegers(receivedAnswer1[i],receivedAnswer1[i+1],receivedAnswer1[i+2]);
}
itoa(responseLen2,str1); Dbprintf("%d octets read from XXX request: %x %x %x %x %x %x %x %x %x", answerLen3,
strcat(str1," octets read from SELECT request"); answer3[0], answer3[1], answer3[2],
DbpString(str1); answer3[3], answer3[4], answer3[5],
for(i = 0; i < responseLen2; i+=3) { answer3[6], answer3[7], answer3[8]);
DbpIntegers(receivedAnswer2[i],receivedAnswer2[i+1],receivedAnswer2[i+2]);
}
itoa(responseLen3,str1);
strcat(str1," octets read from XXX request");
DbpString(str1);
for(i = 0; i < responseLen3; i+=3) {
DbpIntegers(receivedAnswer3[i],receivedAnswer3[i+1],receivedAnswer3[i+2]);
}
// str2[0]=0; // str2[0]=0;
// for(i = 0; i < responseLen3; i++) { // for(i = 0; i < responseLen3; i++) {
@ -1077,26 +1062,11 @@ void SimTagIso15693(DWORD parameter)
LED_C_OFF(); LED_C_OFF();
LED_D_OFF(); LED_D_OFF();
//DbpString(parameter); BYTE *answer1 = (((BYTE *)BigBuf) + 3660); //
int answerLen1 = 0;
BYTE *receivedAnswer0 = (((BYTE *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much)
BYTE *receivedAnswer1 = (((BYTE *)BigBuf) + 3660); //
BYTE *receivedAnswer2 = (((BYTE *)BigBuf) + 3760);
BYTE *receivedAnswer3 = (((BYTE *)BigBuf) + 3860);
//BYTE *TagUID= (((BYTE *)BigBuf) + 3960); // where we hold the uid for hi15reader
// int responseLen0 = 0;
int responseLen1 = 0;
// int responseLen2 = 0;
// int responseLen3 = 0;
// Blank arrays // Blank arrays
int j; memset(answer1, 0, 100);
for(j = 0; j < 100; j++) {
receivedAnswer3[j] = 0;
receivedAnswer2[j] =0;
receivedAnswer1[j] = 0;
receivedAnswer0[j] = 0;
}
// Setup SSC // Setup SSC
FpgaSetupSsc(); FpgaSetupSsc();
@ -1122,66 +1092,19 @@ void SimTagIso15693(DWORD parameter)
int wait = 0; int wait = 0;
int elapsed = 0; int elapsed = 0;
// FIRST WE RUN AN INVENTORY TO GET THE TAG UID answerLen1 = GetIso15693AnswerFromSniff(answer1, 100, &samples, &elapsed) ;
// THIS MEANS WE CAN PRE-BUILD REQUESTS TO SAVE CPU TIME
// BYTE TagUID[7]; // where we hold the uid for hi15reader
// Now send the IDENTIFY command if (answerLen1 >=1) // we should do a better check than this
// BuildIdentifyRequest();
// TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3
// Now wait for a command from the reader
responseLen1=0;
// while(responseLen1=0) {
// if(BUTTON_PRESS()) break;
responseLen1 = GetIso15693AnswerFromSniff(receivedAnswer1, 100, &samples, &elapsed) ;
// }
if (responseLen1 >=1) // we should do a better check than this
{ {
// Build a suitable reponse to the reader INVENTORY cocmmand // Build a suitable reponse to the reader INVENTORY cocmmand
BuildInventoryResponse(); BuildInventoryResponse();
TransmitTo15693Reader(ToSend,ToSendMax,&tsamples, &wait); TransmitTo15693Reader(ToSend,ToSendMax, &tsamples, &wait);
// Now wait for a command from the reader
// responseLen2 = GetIso15693AnswerFromTag(receivedAnswer2, 100, &samples, &elapsed);
// Now wait for a command from the reader
// responseLen3 = GetIso15693AnswerFromTag(receivedAnswer3, 100, &samples, &elapsed) ;
} }
char str1 [4]; Dbprintf("%d octets read from reader command: %x %x %x %x %x %x %x %x %x", answerLen1,
//char str2 [200]; answer1[0], answer1[1], answer1[2],
int i; answer1[3], answer1[4], answer1[5],
answer1[6], answer1[7], answer1[8]);
itoa(responseLen1,str1);
strcat(str1," octets read from reader command");
DbpString(str1);
for(i = 0; i < responseLen1; i+=3) {
DbpIntegers(receivedAnswer1[i],receivedAnswer1[i+1],receivedAnswer1[i+2]);
}
// itoa(responseLen2,str1);
// strcat(str1," octets read from SELECT request");
// DbpString(str1);
// for(i = 0; i < responseLen2; i+=3) {
// DbpIntegers(receivedAnswer2[i],receivedAnswer2[i+1],receivedAnswer2[i+2]);
// }
//
// itoa(responseLen3,str1);
// strcat(str1," octets read from XXX request");
// DbpString(str1);
// for(i = 0; i < responseLen3; i+=3) {
// DbpIntegers(receivedAnswer3[i],receivedAnswer3[i+1],receivedAnswer3[i+2]);
// }
// str2[0]=0;
// for(i = 0; i < responseLen3; i++) {
// itoa(str1,receivedAnswer3[i]);
// strcat(str2,str1);
// }
// DbpString(str2);
LED_A_OFF(); LED_A_OFF();
LED_B_OFF(); LED_B_OFF();