]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
switch away entirely from using DbpInteger to Dbprintf
authorbushing <bushing@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Sat, 2 Jan 2010 00:34:43 +0000 (00:34 +0000)
committerbushing <bushing@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Sat, 2 Jan 2010 00:34:43 +0000 (00:34 +0000)
armsrc/appmain.c
armsrc/iso14443.c
armsrc/iso14443a.c
armsrc/iso15693.c

index 8d6c1812f08a522e1a0a811725f2af8fc340d160..6273317e8f8983b7fe36e091afe7fe95fd68e79f 100644 (file)
@@ -83,6 +83,7 @@ void DbpString(char *str)
        SpinDelay(50);\r
 }\r
 \r
+#if 0\r
 void DbpIntegers(int x1, int x2, int x3)\r
 {\r
        /* this holds up stuff unless we're connected to usb */\r
@@ -99,6 +100,7 @@ void DbpIntegers(int x1, int x2, int x3)
        // XXX\r
        SpinDelay(50);\r
 }\r
+#endif\r
 \r
 void Dbprintf(const char *fmt, ...) {\r
 // should probably limit size here; oh well, let's just use a big buffer\r
@@ -249,12 +251,9 @@ void SimulateTagHfListen(void)
 void ReadMem(int addr)\r
 {\r
        const DWORD *data = ((DWORD *)addr);\r
-       int i;\r
 \r
-       DbpString("Reading memory at address");\r
-       DbpIntegers(0, 0, addr);\r
-       for (i = 0; i < 8; i+= 2)\r
-               DbpIntegers(0, data[i], data[i+1]);\r
+       Dbprintf("Reading memory at address %x: %02x %02x %02x %02x %02x %02x %02x %02x",\r
+               addr, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);\r
 }\r
 \r
 /* osimage version information is linked in */\r
@@ -340,8 +339,7 @@ void SamyRun()
                        SpinDelay(500);\r
 \r
                        CmdHIDdemodFSK(1, &high[selected], &low[selected], 0);\r
-                       DbpString("Recorded");\r
-                       DbpIntegers(selected, high[selected], low[selected]);\r
+                       Dbprintf("Recorded %x %x %x", selected, high[selected], low[selected]);\r
 \r
                        LEDsoff();\r
                        LED(selected + 1, 0);\r
@@ -371,7 +369,7 @@ void SamyRun()
                                // wait for button to be released\r
                                while(BUTTON_PRESS())\r
                                        WDT_HIT();\r
-                               DbpIntegers(selected, high[selected], low[selected]);\r
+                               Dbprintf("%x %x %x", selected, high[selected], low[selected]);\r
                                CmdHIDsimTAG(high[selected], low[selected], 0);\r
                                DbpString("Done playing");\r
                                if (BUTTON_HELD(1000) > 0)\r
@@ -449,17 +447,15 @@ void ListenReaderField(int limit)
        lf_av=lf_max=ReadAdc(ADC_CHAN_LF);\r
 \r
        if(limit != HF_ONLY) {\r
-               DbpString("LF 125/134 Baseline:");\r
-               DbpIntegers(lf_av,0,0);\r
-               lf_baseline= lf_av;\r
+               Dbprintf("LF 125/134 Baseline: %d", lf_av);\r
+               lf_baseline = lf_av;\r
        }\r
 \r
        hf_av=hf_max=ReadAdc(ADC_CHAN_HF);\r
 \r
        if (limit != LF_ONLY) {\r
-               DbpString("HF 13.56 Baseline:");\r
-               DbpIntegers(hf_av,0,0);\r
-               hf_baseline= hf_av;\r
+               Dbprintf("HF 13.56 Baseline: %d", hf_av);\r
+               hf_baseline = hf_av;\r
        }\r
 \r
        for(;;) {\r
@@ -490,9 +486,8 @@ void ListenReaderField(int limit)
                        lf_av_new= ReadAdc(ADC_CHAN_LF);\r
                        // see if there's a significant change\r
                        if(abs(lf_av - lf_av_new) > 10) {\r
-                               DbpString("LF 125/134 Field Change:");\r
-                               DbpIntegers(lf_av,lf_av_new,lf_count);\r
-                               lf_av= lf_av_new;\r
+                               Dbprintf("LF 125/134 Field Change: %x %x %x", lf_av, lf_av_new, lf_count);\r
+                               lf_av = lf_av_new;\r
                                if (lf_av > lf_max)\r
                                        lf_max = lf_av;\r
                                lf_count= 0;\r
@@ -509,9 +504,8 @@ void ListenReaderField(int limit)
                        hf_av_new= ReadAdc(ADC_CHAN_HF);\r
                        // see if there's a significant change\r
                        if(abs(hf_av - hf_av_new) > 10) {\r
-                               DbpString("HF 13.56 Field Change:");\r
-                               DbpIntegers(hf_av,hf_av_new,hf_count);\r
-                               hf_av= hf_av_new;\r
+                               Dbprintf("HF 13.56 Field Change: %x %x %x", hf_av, hf_av_new, hf_count);\r
+                               hf_av = hf_av_new;\r
                                if (hf_av > hf_max)\r
                                        hf_max = hf_av;\r
                                hf_count= 0;\r
index fbc3a6d40009b1eca639705548704e613df0412b..b592742c9935cf7b437c58a89f714fa9d8c56ff6 100644 (file)
@@ -353,9 +353,8 @@ void SimulateIso14443Tag(void)
         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
@@ -363,8 +362,7 @@ void SimulateIso14443Tag(void)
         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
@@ -688,7 +686,7 @@ static void GetSamplesFor14443Demod(BOOL weTx, int n, BOOL quiet)
         }\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
@@ -873,15 +871,15 @@ void AcquireRawAdcSamplesIso14443(DWORD parameter)
 //-----------------------------------------------------------------------------\r
 void ReadSRI512Iso14443(DWORD parameter)\r
 {\r
-     ReadSTMemoryIso14443(parameter,0x0F);
-}
-void ReadSRIX4KIso14443(DWORD parameter)
-{
-     ReadSTMemoryIso14443(parameter,0x7F);
-}
-
-void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
-{
+     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
     // Make sure that we start from off, since the tags are stateful;\r
@@ -912,8 +910,8 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
        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
@@ -926,8 +924,7 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
     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
@@ -938,8 +935,7 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
     }\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
@@ -952,27 +948,27 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
     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++;
+    dwLast++;\r
     for (;;) {\r
-           if (i == dwLast) {
+           if (i == dwLast) {\r
                    DbpString("System area block (0xff):");\r
                    i = 0xff;\r
            }\r
@@ -990,13 +986,14 @@ void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast)
            // 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
@@ -1084,8 +1081,7 @@ void SnoopIso14443(void)
         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
@@ -1173,9 +1169,8 @@ void SnoopIso14443(void)
     }\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
index 4c04571e88025f0357c96a1a8d071ef58483d672..a7d094591f59c6196ea089c5d0683f4c6d622e0b 100644 (file)
@@ -741,13 +741,13 @@ void SnoopIso14443a(void)
 \r
     DbpString("COMMAND FINISHED");\r
 \r
-    DbpIntegers(maxBehindBy, Uart.state, Uart.byteCnt);\r
-    DbpIntegers(Uart.byteCntMax, traceLen, (int)Uart.output[0]);\r
+    Dbprintf("%x %x %x", maxBehindBy, Uart.state, Uart.byteCnt);\r
+    Dbprintf("%x %x %x", Uart.byteCntMax, traceLen, (int)Uart.output[0]);\r
 \r
 done:\r
     AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS;\r
-    DbpIntegers(maxBehindBy, Uart.state, Uart.byteCnt);\r
-    DbpIntegers(Uart.byteCntMax, traceLen, (int)Uart.output[0]);\r
+    Dbprintf("%x %x %x", maxBehindBy, Uart.state, Uart.byteCnt);\r
+    Dbprintf("%x %x %x", Uart.byteCntMax, traceLen, (int)Uart.output[0]);\r
     LED_A_OFF();\r
     LED_B_OFF();\r
        LED_C_OFF();\r
@@ -1144,8 +1144,8 @@ ComputeCrc14443(CRC_14443_A, response3a, 1, &response3a[1], &response3a[2]);
                } else if(receivedCmd[0] == 0x30) {\r
                        // Received a READ\r
                        resp = resp4; respLen = resp4Len; order = 4; // Do nothing\r
-                       DbpString("Read request from reader:");\r
-                       DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]);\r
+                       Dbprintf("Read request from reader: %x %x %x",\r
+                               receivedCmd[0], receivedCmd[1], receivedCmd[2]);\r
 \r
 \r
                } else if(receivedCmd[0] == 0x50) {\r
@@ -1156,21 +1156,20 @@ ComputeCrc14443(CRC_14443_A, response3a, 1, &response3a[1], &response3a[2]);
                } else if(receivedCmd[0] == 0x60) {\r
                        // Received an authentication request\r
                        resp = resp5; respLen = resp5Len; order = 7;\r
-                       DbpString("Authenticate request from reader:");\r
-                       DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]);\r
+                       Dbprintf("Authenticate request from reader: %x %x %x",\r
+                               receivedCmd[0], receivedCmd[1], receivedCmd[2]);\r
 \r
                } else if(receivedCmd[0] == 0xE0) {\r
                        // Received a RATS request\r
                        resp = resp1; respLen = 0;order = 70;\r
-                       DbpString("RATS request from reader:");\r
-                       DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]);\r
+                       Dbprintf("RATS request from reader: %x %x %x",\r
+                               receivedCmd[0], receivedCmd[1], receivedCmd[2]);\r
         } else {\r
             // Never seen this command before\r
-                       DbpString("Unknown command received from reader:");\r
-                       DbpIntegers(receivedCmd[0], receivedCmd[1], receivedCmd[2]);\r
-                       DbpIntegers(receivedCmd[3], receivedCmd[4], receivedCmd[5]);\r
-                       DbpIntegers(receivedCmd[6], receivedCmd[7], receivedCmd[8]);\r
-\r
+               Dbprintf("Unknown command received from reader: %x %x %x %x %x %x %x %x %x",\r
+                       receivedCmd[0], receivedCmd[1], receivedCmd[2],\r
+                       receivedCmd[3], receivedCmd[3], receivedCmd[4],\r
+                       receivedCmd[5], receivedCmd[6], receivedCmd[7]);\r
                        // Do not respond\r
                        resp = resp1; respLen = 0; order = 0;\r
         }\r
@@ -1234,7 +1233,7 @@ ComputeCrc14443(CRC_14443_A, response3a, 1, &response3a[1], &response3a[2]);
 \r
     }\r
 \r
-       DbpIntegers(happened, happened2, cmdsRecvd);\r
+       Dbprintf("%x %x %x", happened, happened2, cmdsRecvd);\r
        LED_A_OFF();\r
 }\r
 \r
@@ -1694,7 +1693,7 @@ void ReaderIso14443a(DWORD parameter)
   // Thats it...\r
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);\r
        LEDsoff();\r
-       DbpIntegers(rsamples, 0xCC, 0xCC);\r
+       Dbprintf("%x %x %x", rsamples, 0xCC, 0xCC);\r
        DbpString("ready..");\r
 }\r
 \r
index 723d297d11a7059288a2d1e524322f0128f21c14..4c9a7d607f28c2ca2d8bb6a254d0c21ae2eb5796 100644 (file)
@@ -926,24 +926,18 @@ void ReaderIso15693(DWORD parameter)
 \r
 //DbpString(parameter);\r
 \r
-       BYTE *receivedAnswer0 = (((BYTE *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much)\r
-       BYTE *receivedAnswer1 = (((BYTE *)BigBuf) + 3660); //\r
-       BYTE *receivedAnswer2 = (((BYTE *)BigBuf) + 3760);\r
-       BYTE *receivedAnswer3 = (((BYTE *)BigBuf) + 3860);\r
+       //BYTE *answer0 = (((BYTE *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much)\r
+       BYTE *answer1 = (((BYTE *)BigBuf) + 3660); //\r
+       BYTE *answer2 = (((BYTE *)BigBuf) + 3760);\r
+       BYTE *answer3 = (((BYTE *)BigBuf) + 3860);\r
        //BYTE *TagUID= (((BYTE *)BigBuf) + 3960);              // where we hold the uid for hi15reader\r
-//     int responseLen0 = 0;\r
-       int responseLen1 = 0;\r
-       int responseLen2 = 0;\r
-       int responseLen3 = 0;\r
+//     int answerLen0 = 0;\r
+       int answerLen1 = 0;\r
+       int answerLen2 = 0;\r
+       int answerLen3 = 0;\r
 \r
        // Blank arrays\r
-       int j;\r
-       for(j = 0; j < 100; j++) {\r
-               receivedAnswer3[j] = 0;\r
-               receivedAnswer2[j] =0;\r
-               receivedAnswer1[j] = 0;\r
-               receivedAnswer0[j] = 0;\r
-       }\r
+       memset(BigBuf + 3660, 0, 300);\r
 \r
        // Setup SSC\r
        FpgaSetupSsc();\r
@@ -997,24 +991,24 @@ void ReaderIso15693(DWORD parameter)
        //TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);\r
        TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait);  // No longer ToSendMax+3\r
        // Now wait for a response\r
-       responseLen1 = GetIso15693AnswerFromTag(receivedAnswer1, 100, &samples, &elapsed) ;\r
+       answerLen1 = GetIso15693AnswerFromTag(answer1, 100, &samples, &elapsed) ;\r
 \r
-       if (responseLen1 >=12) // we should do a better check than this\r
+       if (answerLen1 >=12) // we should do a better check than this\r
        {\r
 \r
-               TagUID[0] = receivedAnswer1[2];\r
-               TagUID[1] = receivedAnswer1[3];\r
-               TagUID[2] = receivedAnswer1[4];\r
-               TagUID[3] = receivedAnswer1[5];\r
-               TagUID[4] = receivedAnswer1[6];\r
-               TagUID[5] = receivedAnswer1[7];\r
-               TagUID[6] = receivedAnswer1[8]; // IC Manufacturer code\r
+               TagUID[0] = answer1[2];\r
+               TagUID[1] = answer1[3];\r
+               TagUID[2] = answer1[4];\r
+               TagUID[3] = answer1[5];\r
+               TagUID[4] = answer1[6];\r
+               TagUID[5] = answer1[7];\r
+               TagUID[6] = answer1[8]; // IC Manufacturer code\r
 \r
                // Now send the SELECT command\r
                BuildSelectRequest(TagUID);\r
                TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait);  // No longer ToSendMax+3\r
                // Now wait for a response\r
-               responseLen2 = GetIso15693AnswerFromTag(receivedAnswer2, 100, &samples, &elapsed);\r
+               answerLen2 = GetIso15693AnswerFromTag(answer2, 100, &samples, &elapsed);\r
 \r
                // Now send the MULTI READ command\r
 //             BuildArbitraryRequest(*TagUID,parameter);\r
@@ -1024,34 +1018,25 @@ void ReaderIso15693(DWORD parameter)
                //TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);\r
                TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait);  // No longer ToSendMax+3\r
                // Now wait for a response\r
-               responseLen3 = GetIso15693AnswerFromTag(receivedAnswer3, 100, &samples, &elapsed) ;\r
+               answerLen3 = GetIso15693AnswerFromTag(answer3, 100, &samples, &elapsed) ;\r
 \r
        }\r
 \r
-       char str1 [4];\r
-       //char str2 [200];\r
-       int i;\r
+       Dbprintf("%d octets read from IDENTIFY request: %x %x %x %x %x %x %x %x %x", answerLen1,\r
+               answer1[0], answer1[1], answer1[2],\r
+               answer1[3], answer1[4], answer1[5],\r
+               answer1[6], answer1[7], answer1[8]);\r
 \r
-       itoa(responseLen1,str1);\r
-       strcat(str1," octets read from IDENTIFY request");\r
-       DbpString(str1);\r
-       for(i = 0; i < responseLen1; i+=3) {\r
-               DbpIntegers(receivedAnswer1[i],receivedAnswer1[i+1],receivedAnswer1[i+2]);\r
-       }\r
+       Dbprintf("%d octets read from SELECT request: %x %x %x %x %x %x %x %x %x", answerLen2,\r
+               answer2[0], answer2[1], answer2[2],\r
+               answer2[3], answer2[4], answer2[5],\r
+               answer2[6], answer2[7], answer2[8]);\r
 \r
-       itoa(responseLen2,str1);\r
-       strcat(str1," octets read from SELECT request");\r
-       DbpString(str1);\r
-       for(i = 0; i < responseLen2; i+=3) {\r
-               DbpIntegers(receivedAnswer2[i],receivedAnswer2[i+1],receivedAnswer2[i+2]);\r
-       }\r
+       Dbprintf("%d octets read from XXX request: %x %x %x %x %x %x %x %x %x", answerLen3,\r
+               answer3[0], answer3[1], answer3[2],\r
+               answer3[3], answer3[4], answer3[5],\r
+               answer3[6], answer3[7], answer3[8]);\r
 \r
-       itoa(responseLen3,str1);\r
-       strcat(str1," octets read from XXX request");\r
-       DbpString(str1);\r
-       for(i = 0; i < responseLen3; i+=3) {\r
-               DbpIntegers(receivedAnswer3[i],receivedAnswer3[i+1],receivedAnswer3[i+2]);\r
-       }\r
 \r
 //     str2[0]=0;\r
 //     for(i = 0; i < responseLen3; i++) {\r
@@ -1077,26 +1062,11 @@ void SimTagIso15693(DWORD parameter)
        LED_C_OFF();\r
        LED_D_OFF();\r
 \r
-//DbpString(parameter);\r
-\r
-       BYTE *receivedAnswer0 = (((BYTE *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much)\r
-       BYTE *receivedAnswer1 = (((BYTE *)BigBuf) + 3660); //\r
-       BYTE *receivedAnswer2 = (((BYTE *)BigBuf) + 3760);\r
-       BYTE *receivedAnswer3 = (((BYTE *)BigBuf) + 3860);\r
-       //BYTE *TagUID= (((BYTE *)BigBuf) + 3960);              // where we hold the uid for hi15reader\r
-//     int responseLen0 = 0;\r
-       int responseLen1 = 0;\r
-//     int responseLen2 = 0;\r
-//     int responseLen3 = 0;\r
+       BYTE *answer1 = (((BYTE *)BigBuf) + 3660); //\r
+       int answerLen1 = 0;\r
 \r
        // Blank arrays\r
-       int j;\r
-       for(j = 0; j < 100; j++) {\r
-               receivedAnswer3[j] = 0;\r
-               receivedAnswer2[j] =0;\r
-               receivedAnswer1[j] = 0;\r
-               receivedAnswer0[j] = 0;\r
-       }\r
+       memset(answer1, 0, 100);\r
 \r
        // Setup SSC\r
        FpgaSetupSsc();\r
@@ -1122,66 +1092,19 @@ void SimTagIso15693(DWORD parameter)
        int wait = 0;\r
        int elapsed = 0;\r
 \r
-       // FIRST WE RUN AN INVENTORY TO GET THE TAG UID\r
-       // THIS MEANS WE CAN PRE-BUILD REQUESTS TO SAVE CPU TIME\r
-       // BYTE TagUID[7];              // where we hold the uid for hi15reader\r
+       answerLen1 = GetIso15693AnswerFromSniff(answer1, 100, &samples, &elapsed) ;\r
 \r
-       // Now send the IDENTIFY command\r
-       //      BuildIdentifyRequest();\r
-       //      TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait);  // No longer ToSendMax+3\r
-\r
-       // Now wait for a command from the reader\r
-       responseLen1=0;\r
-       //      while(responseLen1=0) {\r
-       //              if(BUTTON_PRESS()) break;\r
-               responseLen1 = GetIso15693AnswerFromSniff(receivedAnswer1, 100, &samples, &elapsed) ;\r
-       //              }\r
-\r
-       if (responseLen1 >=1) // we should do a better check than this\r
+       if (answerLen1 >=1) // we should do a better check than this\r
        {\r
                // Build a suitable reponse to the reader INVENTORY cocmmand\r
                BuildInventoryResponse();\r
-               TransmitTo15693Reader(ToSend,ToSendMax,&tsamples, &wait);\r
-\r
-               // Now wait for a command from the reader\r
-//             responseLen2 = GetIso15693AnswerFromTag(receivedAnswer2, 100, &samples, &elapsed);\r
-\r
-               // Now wait for a command from the reader\r
-//             responseLen3 = GetIso15693AnswerFromTag(receivedAnswer3, 100, &samples, &elapsed) ;\r
-\r
+               TransmitTo15693Reader(ToSend,ToSendMax, &tsamples, &wait);\r
        }\r
 \r
-       char str1 [4];\r
-       //char str2 [200];\r
-       int i;\r
-\r
-       itoa(responseLen1,str1);\r
-       strcat(str1," octets read from reader command");\r
-       DbpString(str1);\r
-       for(i = 0; i < responseLen1; i+=3) {\r
-               DbpIntegers(receivedAnswer1[i],receivedAnswer1[i+1],receivedAnswer1[i+2]);\r
-       }\r
-\r
-//     itoa(responseLen2,str1);\r
-//     strcat(str1," octets read from SELECT request");\r
-//     DbpString(str1);\r
-//     for(i = 0; i < responseLen2; i+=3) {\r
-//             DbpIntegers(receivedAnswer2[i],receivedAnswer2[i+1],receivedAnswer2[i+2]);\r
-//     }\r
-//\r
-//     itoa(responseLen3,str1);\r
-//     strcat(str1," octets read from XXX request");\r
-//     DbpString(str1);\r
-//     for(i = 0; i < responseLen3; i+=3) {\r
-//             DbpIntegers(receivedAnswer3[i],receivedAnswer3[i+1],receivedAnswer3[i+2]);\r
-//     }\r
-\r
-//     str2[0]=0;\r
-//     for(i = 0; i < responseLen3; i++) {\r
-//             itoa(str1,receivedAnswer3[i]);\r
-//             strcat(str2,str1);\r
-//     }\r
-//     DbpString(str2);\r
+       Dbprintf("%d octets read from reader command: %x %x %x %x %x %x %x %x %x", answerLen1,\r
+               answer1[0], answer1[1], answer1[2],\r
+               answer1[3], answer1[4], answer1[5],\r
+               answer1[6], answer1[7], answer1[8]);\r
 \r
        LED_A_OFF();\r
        LED_B_OFF();\r
Impressum, Datenschutz