mirror of
https://github.com/Proxmark/proxmark3.git
synced 2024-09-21 15:26:35 +08:00
switch away entirely from using DbpInteger to Dbprintf
This commit is contained in:
parent
a9bc033bdd
commit
850427c8a9
|
@ -83,6 +83,7 @@ void DbpString(char *str)
|
|||
SpinDelay(50);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void DbpIntegers(int x1, int x2, int x3)
|
||||
{
|
||||
/* this holds up stuff unless we're connected to usb */
|
||||
|
@ -99,6 +100,7 @@ void DbpIntegers(int x1, int x2, int x3)
|
|||
// XXX
|
||||
SpinDelay(50);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Dbprintf(const char *fmt, ...) {
|
||||
// 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)
|
||||
{
|
||||
const DWORD *data = ((DWORD *)addr);
|
||||
int i;
|
||||
|
||||
DbpString("Reading memory at address");
|
||||
DbpIntegers(0, 0, addr);
|
||||
for (i = 0; i < 8; i+= 2)
|
||||
DbpIntegers(0, data[i], data[i+1]);
|
||||
Dbprintf("Reading memory at address %x: %02x %02x %02x %02x %02x %02x %02x %02x",
|
||||
addr, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
|
||||
}
|
||||
|
||||
/* osimage version information is linked in */
|
||||
|
@ -340,8 +339,7 @@ void SamyRun()
|
|||
SpinDelay(500);
|
||||
|
||||
CmdHIDdemodFSK(1, &high[selected], &low[selected], 0);
|
||||
DbpString("Recorded");
|
||||
DbpIntegers(selected, high[selected], low[selected]);
|
||||
Dbprintf("Recorded %x %x %x", selected, high[selected], low[selected]);
|
||||
|
||||
LEDsoff();
|
||||
LED(selected + 1, 0);
|
||||
|
@ -371,7 +369,7 @@ void SamyRun()
|
|||
// wait for button to be released
|
||||
while(BUTTON_PRESS())
|
||||
WDT_HIT();
|
||||
DbpIntegers(selected, high[selected], low[selected]);
|
||||
Dbprintf("%x %x %x", selected, high[selected], low[selected]);
|
||||
CmdHIDsimTAG(high[selected], low[selected], 0);
|
||||
DbpString("Done playing");
|
||||
if (BUTTON_HELD(1000) > 0)
|
||||
|
@ -449,17 +447,15 @@ void ListenReaderField(int limit)
|
|||
lf_av=lf_max=ReadAdc(ADC_CHAN_LF);
|
||||
|
||||
if(limit != HF_ONLY) {
|
||||
DbpString("LF 125/134 Baseline:");
|
||||
DbpIntegers(lf_av,0,0);
|
||||
lf_baseline= lf_av;
|
||||
Dbprintf("LF 125/134 Baseline: %d", lf_av);
|
||||
lf_baseline = lf_av;
|
||||
}
|
||||
|
||||
hf_av=hf_max=ReadAdc(ADC_CHAN_HF);
|
||||
|
||||
if (limit != LF_ONLY) {
|
||||
DbpString("HF 13.56 Baseline:");
|
||||
DbpIntegers(hf_av,0,0);
|
||||
hf_baseline= hf_av;
|
||||
Dbprintf("HF 13.56 Baseline: %d", hf_av);
|
||||
hf_baseline = hf_av;
|
||||
}
|
||||
|
||||
for(;;) {
|
||||
|
@ -490,9 +486,8 @@ void ListenReaderField(int limit)
|
|||
lf_av_new= ReadAdc(ADC_CHAN_LF);
|
||||
// see if there's a significant change
|
||||
if(abs(lf_av - lf_av_new) > 10) {
|
||||
DbpString("LF 125/134 Field Change:");
|
||||
DbpIntegers(lf_av,lf_av_new,lf_count);
|
||||
lf_av= lf_av_new;
|
||||
Dbprintf("LF 125/134 Field Change: %x %x %x", lf_av, lf_av_new, lf_count);
|
||||
lf_av = lf_av_new;
|
||||
if (lf_av > lf_max)
|
||||
lf_max = lf_av;
|
||||
lf_count= 0;
|
||||
|
@ -509,9 +504,8 @@ void ListenReaderField(int limit)
|
|||
hf_av_new= ReadAdc(ADC_CHAN_HF);
|
||||
// see if there's a significant change
|
||||
if(abs(hf_av - hf_av_new) > 10) {
|
||||
DbpString("HF 13.56 Field Change:");
|
||||
DbpIntegers(hf_av,hf_av_new,hf_count);
|
||||
hf_av= hf_av_new;
|
||||
Dbprintf("HF 13.56 Field Change: %x %x %x", hf_av, hf_av_new, hf_count);
|
||||
hf_av = hf_av_new;
|
||||
if (hf_av > hf_max)
|
||||
hf_max = hf_av;
|
||||
hf_count= 0;
|
||||
|
|
|
@ -353,9 +353,8 @@ void SimulateIso14443Tag(void)
|
|||
BYTE b1, b2;
|
||||
|
||||
if(!GetIso14443CommandFromReader(receivedCmd, &len, 100)) {
|
||||
DbpIntegers(cmdsRecvd, 0, 0);
|
||||
DbpString("button press");
|
||||
break;
|
||||
Dbprintf("button pressed, received %d commands", cmdsRecvd);
|
||||
break;
|
||||
}
|
||||
|
||||
// Good, look at the command now.
|
||||
|
@ -363,8 +362,7 @@ void SimulateIso14443Tag(void)
|
|||
if(len == sizeof(cmd1) && memcmp(receivedCmd, cmd1, len)==0) {
|
||||
resp = resp1; respLen = resp1Len;
|
||||
} else {
|
||||
DbpString("new cmd from reader:");
|
||||
DbpIntegers(len, 0x1234, cmdsRecvd);
|
||||
Dbprintf("new cmd from reader: len=%d, cmdsRecvd=%d", len, cmdsRecvd);
|
||||
// And print whether the CRC fails, just for good measure
|
||||
ComputeCrc14443(CRC_14443_B, receivedCmd, len-2, &b1, &b2);
|
||||
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;
|
||||
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)
|
||||
{
|
||||
ReadSTMemoryIso14443(parameter,0x0F);
|
||||
}
|
||||
void ReadSRIX4KIso14443(DWORD parameter)
|
||||
{
|
||||
ReadSTMemoryIso14443(parameter,0x7F);
|
||||
}
|
||||
|
||||
void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
|
||||
{
|
||||
ReadSTMemoryIso14443(parameter,0x0F);
|
||||
}
|
||||
void ReadSRIX4KIso14443(DWORD parameter)
|
||||
{
|
||||
ReadSTMemoryIso14443(parameter,0x7F);
|
||||
}
|
||||
|
||||
void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
|
||||
{
|
||||
BYTE i = 0x00;
|
||||
|
||||
// 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");
|
||||
return;
|
||||
} else {
|
||||
DbpString("Randomly generated UID from tag (+ 2 byte CRC):");
|
||||
DbpIntegers(Demod.output[0], Demod.output[1],Demod.output[2]);
|
||||
Dbprintf("Randomly generated UID from tag (+ 2 byte CRC): %x %x %x",
|
||||
Demod.output[0], Demod.output[1],Demod.output[2]);
|
||||
}
|
||||
// There is a response, SELECT the uid
|
||||
DbpString("Now SELECT tag:");
|
||||
|
@ -926,8 +924,7 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
|
|||
GetSamplesFor14443Demod(TRUE, 2000,TRUE);
|
||||
// LED_A_OFF();
|
||||
if (Demod.len != 3) {
|
||||
DbpString("Expected 3 bytes from tag, got:");
|
||||
DbpIntegers(Demod.len,0x0,0x0);
|
||||
Dbprintf("Expected 3 bytes from tag, got %d", Demod.len);
|
||||
return;
|
||||
}
|
||||
// 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:
|
||||
if (cmd1[1] != Demod.output[0]) {
|
||||
DbpString("Bad response to SELECT from Tag, aborting:");
|
||||
DbpIntegers(cmd1[1],Demod.output[0],0x0);
|
||||
Dbprintf("Bad response to SELECT from Tag, aborting: %x %x", cmd1[1], Demod.output[0]);
|
||||
return;
|
||||
}
|
||||
// Tag is now selected,
|
||||
|
@ -952,27 +948,27 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
|
|||
GetSamplesFor14443Demod(TRUE, 2000,TRUE);
|
||||
// LED_A_OFF();
|
||||
if (Demod.len != 10) {
|
||||
DbpString("Expected 10 bytes from tag, got:");
|
||||
DbpIntegers(Demod.len,0x0,0x0);
|
||||
Dbprintf("Expected 10 bytes from tag, got %d", Demod.len);
|
||||
return;
|
||||
}
|
||||
// The check the CRC of the answer (use cmd1 as temporary variable):
|
||||
ComputeCrc14443(CRC_14443_B, Demod.output, 8, &cmd1[2], &cmd1[3]);
|
||||
if(cmd1[2] != Demod.output[8] || cmd1[3] != Demod.output[9]) {
|
||||
DbpString("CRC Error reading block! - Below: expected, got");
|
||||
DbpIntegers( (cmd1[2]<<8)+cmd1[3], (Demod.output[8]<<8)+Demod.output[9],0);
|
||||
Dbprintf("CRC Error reading block! - Below: expected, got %x %x",
|
||||
(cmd1[2]<<8)+cmd1[3], (Demod.output[8]<<8)+Demod.output[9]);
|
||||
// Do not return;, let's go on... (we should retry, maybe ?)
|
||||
}
|
||||
DbpString("Tag UID (64 bits):");
|
||||
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);
|
||||
Dbprintf("Tag UID (64 bits): %08x %08x",
|
||||
(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
|
||||
DbpString("Tag memory dump, block 0 to 15");
|
||||
cmd1[0] = 0x08;
|
||||
i = 0x00;
|
||||
dwLast++;
|
||||
dwLast++;
|
||||
for (;;) {
|
||||
if (i == dwLast) {
|
||||
if (i == dwLast) {
|
||||
DbpString("System area block (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):
|
||||
ComputeCrc14443(CRC_14443_B, Demod.output, 4, &cmd1[2], &cmd1[3]);
|
||||
if(cmd1[2] != Demod.output[4] || cmd1[3] != Demod.output[5]) {
|
||||
DbpString("CRC Error reading block! - Below: expected, got");
|
||||
DbpIntegers( (cmd1[2]<<8)+cmd1[3], (Demod.output[4]<<8)+Demod.output[5],0);
|
||||
Dbprintf("CRC Error reading block! - Below: expected, got %x %x",
|
||||
(cmd1[2]<<8)+cmd1[3], (Demod.output[4]<<8)+Demod.output[5]);
|
||||
// Do not return;, let's go on... (we should retry, maybe ?)
|
||||
}
|
||||
// Now print out the memory location:
|
||||
DbpString("Address , Contents, CRC");
|
||||
DbpIntegers(i, (Demod.output[3]<<24) + (Demod.output[2]<<16) + (Demod.output[1]<<8) + Demod.output[0], (Demod.output[4]<<8)+Demod.output[5]);
|
||||
Dbprintf("Address=%x, Contents=%x, CRC=%x", i,
|
||||
(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) {
|
||||
break;
|
||||
}
|
||||
|
@ -1084,8 +1081,7 @@ void SnoopIso14443(void)
|
|||
if(behindBy > maxBehindBy) {
|
||||
maxBehindBy = behindBy;
|
||||
if(behindBy > (DMA_BUFFER_SIZE-2)) { // TODO: understand whether we can increase/decrease as we want or not?
|
||||
DbpString("blew circular buffer!");
|
||||
DbpIntegers(behindBy,0,0);
|
||||
Dbprintf("blew circular buffer! behindBy=%x", behindBy);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
@ -1173,9 +1169,8 @@ void SnoopIso14443(void)
|
|||
}
|
||||
|
||||
DbpString("in done pt");
|
||||
|
||||
DbpIntegers(maxBehindBy, Uart.state, Uart.byteCnt);
|
||||
DbpIntegers(Uart.byteCntMax, traceLen, 0x23);
|
||||
Dbprintf("%x %x %x", maxBehindBy, Uart.state, Uart.byteCnt);
|
||||
Dbprintf("%x %x %x", Uart.byteCntMax, traceLen, 0x23);
|
||||
|
||||
done:
|
||||
LED_D_OFF();
|
||||
|
|
|
@ -741,13 +741,13 @@ void SnoopIso14443a(void)
|
|||
|
||||
DbpString("COMMAND FINISHED");
|
||||
|
||||
DbpIntegers(maxBehindBy, Uart.state, Uart.byteCnt);
|
||||
DbpIntegers(Uart.byteCntMax, traceLen, (int)Uart.output[0]);
|
||||
Dbprintf("%x %x %x", maxBehindBy, Uart.state, Uart.byteCnt);
|
||||
Dbprintf("%x %x %x", Uart.byteCntMax, traceLen, (int)Uart.output[0]);
|
||||
|
||||
done:
|
||||
AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS;
|
||||
DbpIntegers(maxBehindBy, Uart.state, Uart.byteCnt);
|
||||
DbpIntegers(Uart.byteCntMax, traceLen, (int)Uart.output[0]);
|
||||
Dbprintf("%x %x %x", maxBehindBy, Uart.state, Uart.byteCnt);
|
||||
Dbprintf("%x %x %x", Uart.byteCntMax, traceLen, (int)Uart.output[0]);
|
||||
LED_A_OFF();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
|
@ -1144,8 +1144,8 @@ ComputeCrc14443(CRC_14443_A, response3a, 1, &response3a[1], &response3a[2]);
|
|||
} else if(receivedCmd[0] == 0x30) {
|
||||
// Received a READ
|
||||
resp = resp4; respLen = resp4Len; order = 4; // Do nothing
|
||||
DbpString("Read request from reader:");
|
||||
DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]);
|
||||
Dbprintf("Read request from reader: %x %x %x",
|
||||
receivedCmd[0], receivedCmd[1], receivedCmd[2]);
|
||||
|
||||
|
||||
} else if(receivedCmd[0] == 0x50) {
|
||||
|
@ -1156,21 +1156,20 @@ ComputeCrc14443(CRC_14443_A, response3a, 1, &response3a[1], &response3a[2]);
|
|||
} else if(receivedCmd[0] == 0x60) {
|
||||
// Received an authentication request
|
||||
resp = resp5; respLen = resp5Len; order = 7;
|
||||
DbpString("Authenticate request from reader:");
|
||||
DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]);
|
||||
Dbprintf("Authenticate request from reader: %x %x %x",
|
||||
receivedCmd[0], receivedCmd[1], receivedCmd[2]);
|
||||
|
||||
} else if(receivedCmd[0] == 0xE0) {
|
||||
// Received a RATS request
|
||||
resp = resp1; respLen = 0;order = 70;
|
||||
DbpString("RATS request from reader:");
|
||||
DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]);
|
||||
Dbprintf("RATS request from reader: %x %x %x",
|
||||
receivedCmd[0], receivedCmd[1], receivedCmd[2]);
|
||||
} else {
|
||||
// Never seen this command before
|
||||
DbpString("Unknown command received from reader:");
|
||||
DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]);
|
||||
DbpIntegers(receivedCmd[3], receivedCmd[4], receivedCmd[5]);
|
||||
DbpIntegers(receivedCmd[6], receivedCmd[7], receivedCmd[8]);
|
||||
|
||||
Dbprintf("Unknown command received from reader: %x %x %x %x %x %x %x %x %x",
|
||||
receivedCmd[0], receivedCmd[1], receivedCmd[2],
|
||||
receivedCmd[3], receivedCmd[3], receivedCmd[4],
|
||||
receivedCmd[5], receivedCmd[6], receivedCmd[7]);
|
||||
// Do not respond
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -1694,7 +1693,7 @@ void ReaderIso14443a(DWORD parameter)
|
|||
// Thats it...
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
LEDsoff();
|
||||
DbpIntegers(rsamples, 0xCC, 0xCC);
|
||||
Dbprintf("%x %x %x", rsamples, 0xCC, 0xCC);
|
||||
DbpString("ready..");
|
||||
}
|
||||
|
||||
|
|
|
@ -926,24 +926,18 @@ void ReaderIso15693(DWORD parameter)
|
|||
|
||||
//DbpString(parameter);
|
||||
|
||||
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 *answer0 = (((BYTE *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much)
|
||||
BYTE *answer1 = (((BYTE *)BigBuf) + 3660); //
|
||||
BYTE *answer2 = (((BYTE *)BigBuf) + 3760);
|
||||
BYTE *answer3 = (((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;
|
||||
// int answerLen0 = 0;
|
||||
int answerLen1 = 0;
|
||||
int answerLen2 = 0;
|
||||
int answerLen3 = 0;
|
||||
|
||||
// Blank arrays
|
||||
int j;
|
||||
for(j = 0; j < 100; j++) {
|
||||
receivedAnswer3[j] = 0;
|
||||
receivedAnswer2[j] =0;
|
||||
receivedAnswer1[j] = 0;
|
||||
receivedAnswer0[j] = 0;
|
||||
}
|
||||
memset(BigBuf + 3660, 0, 300);
|
||||
|
||||
// Setup SSC
|
||||
FpgaSetupSsc();
|
||||
|
@ -997,24 +991,24 @@ void ReaderIso15693(DWORD parameter)
|
|||
//TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);
|
||||
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3
|
||||
// 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[1] = receivedAnswer1[3];
|
||||
TagUID[2] = receivedAnswer1[4];
|
||||
TagUID[3] = receivedAnswer1[5];
|
||||
TagUID[4] = receivedAnswer1[6];
|
||||
TagUID[5] = receivedAnswer1[7];
|
||||
TagUID[6] = receivedAnswer1[8]; // IC Manufacturer code
|
||||
TagUID[0] = answer1[2];
|
||||
TagUID[1] = answer1[3];
|
||||
TagUID[2] = answer1[4];
|
||||
TagUID[3] = answer1[5];
|
||||
TagUID[4] = answer1[6];
|
||||
TagUID[5] = answer1[7];
|
||||
TagUID[6] = answer1[8]; // IC Manufacturer code
|
||||
|
||||
// Now send the SELECT command
|
||||
BuildSelectRequest(TagUID);
|
||||
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3
|
||||
// Now wait for a response
|
||||
responseLen2 = GetIso15693AnswerFromTag(receivedAnswer2, 100, &samples, &elapsed);
|
||||
answerLen2 = GetIso15693AnswerFromTag(answer2, 100, &samples, &elapsed);
|
||||
|
||||
// Now send the MULTI READ command
|
||||
// BuildArbitraryRequest(*TagUID,parameter);
|
||||
|
@ -1024,34 +1018,25 @@ void ReaderIso15693(DWORD parameter)
|
|||
//TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);
|
||||
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3
|
||||
// Now wait for a response
|
||||
responseLen3 = GetIso15693AnswerFromTag(receivedAnswer3, 100, &samples, &elapsed) ;
|
||||
answerLen3 = GetIso15693AnswerFromTag(answer3, 100, &samples, &elapsed) ;
|
||||
|
||||
}
|
||||
|
||||
char str1 [4];
|
||||
//char str2 [200];
|
||||
int i;
|
||||
Dbprintf("%d octets read from IDENTIFY request: %x %x %x %x %x %x %x %x %x", answerLen1,
|
||||
answer1[0], answer1[1], answer1[2],
|
||||
answer1[3], answer1[4], answer1[5],
|
||||
answer1[6], answer1[7], answer1[8]);
|
||||
|
||||
itoa(responseLen1,str1);
|
||||
strcat(str1," octets read from IDENTIFY request");
|
||||
DbpString(str1);
|
||||
for(i = 0; i < responseLen1; i+=3) {
|
||||
DbpIntegers(receivedAnswer1[i],receivedAnswer1[i+1],receivedAnswer1[i+2]);
|
||||
}
|
||||
Dbprintf("%d octets read from SELECT request: %x %x %x %x %x %x %x %x %x", answerLen2,
|
||||
answer2[0], answer2[1], answer2[2],
|
||||
answer2[3], answer2[4], answer2[5],
|
||||
answer2[6], answer2[7], answer2[8]);
|
||||
|
||||
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]);
|
||||
}
|
||||
Dbprintf("%d octets read from XXX request: %x %x %x %x %x %x %x %x %x", answerLen3,
|
||||
answer3[0], answer3[1], answer3[2],
|
||||
answer3[3], answer3[4], answer3[5],
|
||||
answer3[6], answer3[7], answer3[8]);
|
||||
|
||||
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++) {
|
||||
|
@ -1077,26 +1062,11 @@ void SimTagIso15693(DWORD parameter)
|
|||
LED_C_OFF();
|
||||
LED_D_OFF();
|
||||
|
||||
//DbpString(parameter);
|
||||
|
||||
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;
|
||||
BYTE *answer1 = (((BYTE *)BigBuf) + 3660); //
|
||||
int answerLen1 = 0;
|
||||
|
||||
// Blank arrays
|
||||
int j;
|
||||
for(j = 0; j < 100; j++) {
|
||||
receivedAnswer3[j] = 0;
|
||||
receivedAnswer2[j] =0;
|
||||
receivedAnswer1[j] = 0;
|
||||
receivedAnswer0[j] = 0;
|
||||
}
|
||||
memset(answer1, 0, 100);
|
||||
|
||||
// Setup SSC
|
||||
FpgaSetupSsc();
|
||||
|
@ -1122,66 +1092,19 @@ void SimTagIso15693(DWORD parameter)
|
|||
int wait = 0;
|
||||
int elapsed = 0;
|
||||
|
||||
// FIRST WE RUN AN INVENTORY TO GET THE TAG UID
|
||||
// THIS MEANS WE CAN PRE-BUILD REQUESTS TO SAVE CPU TIME
|
||||
// BYTE TagUID[7]; // where we hold the uid for hi15reader
|
||||
answerLen1 = GetIso15693AnswerFromSniff(answer1, 100, &samples, &elapsed) ;
|
||||
|
||||
// Now send the IDENTIFY command
|
||||
// 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
|
||||
if (answerLen1 >=1) // we should do a better check than this
|
||||
{
|
||||
// Build a suitable reponse to the reader INVENTORY cocmmand
|
||||
BuildInventoryResponse();
|
||||
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) ;
|
||||
|
||||
TransmitTo15693Reader(ToSend,ToSendMax, &tsamples, &wait);
|
||||
}
|
||||
|
||||
char str1 [4];
|
||||
//char str2 [200];
|
||||
int i;
|
||||
|
||||
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);
|
||||
Dbprintf("%d octets read from reader command: %x %x %x %x %x %x %x %x %x", answerLen1,
|
||||
answer1[0], answer1[1], answer1[2],
|
||||
answer1[3], answer1[4], answer1[5],
|
||||
answer1[6], answer1[7], answer1[8]);
|
||||
|
||||
LED_A_OFF();
|
||||
LED_B_OFF();
|
||||
|
|
Loading…
Reference in a new issue