]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/iso15693.c
set svn:ignore
[proxmark3-svn] / armsrc / iso15693.c
index 723d297d11a7059288a2d1e524322f0128f21c14..4c9a7d607f28c2ca2d8bb6a254d0c21ae2eb5796 100644 (file)
@@ -926,24 +926,18 @@ void ReaderIso15693(DWORD parameter)
 \r
 //DbpString(parameter);\r
 \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 *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
        //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
 \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
 \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
        //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
 \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
        {\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
 \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
 \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
                //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
 \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
 \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
 \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
 \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
 \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
        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
 \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
 \r
        // Setup SSC\r
        FpgaSetupSsc();\r
@@ -1122,66 +1092,19 @@ void SimTagIso15693(DWORD parameter)
        int wait = 0;\r
        int elapsed = 0;\r
 \r
        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
 \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
        {\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
        }\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
 \r
        LED_A_OFF();\r
        LED_B_OFF();\r
Impressum, Datenschutz