]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/iso14443.c
More annotations to iso14443b protocol listings
[proxmark3-svn] / armsrc / iso14443.c
index 0a6d2d67fd5ad5605e350b3ffe9aa8f09df7b335..1191c5bf5996f89ff9d9495438b282b688b11009 100644 (file)
@@ -154,7 +154,7 @@ static struct {
 static int Handle14443UartBit(int bit)
 {
     switch(Uart.state) {
-        case STATE_UNSYNCD:
+               case STATE_UNSYNCD:
                LED_A_OFF();
             if(!bit) {
                 // we went low, so this could be the beginning
@@ -633,6 +633,8 @@ static void UartReset()
        Uart.output = ((uint8_t *)BigBuf) + RECV_CMD_OFFSET;
        Uart.byteCntMax = MAX_FRAME_SIZE;
        Uart.state = STATE_UNSYNCD;
+       Uart.byteCnt = 0;
+       Uart.bitCnt = 0;
 }
 
 /*
@@ -1045,12 +1047,6 @@ void RAMFUNC SnoopIso14443(void)
        clear_trace();
        set_tracing(TRUE);
 
-       // The command (reader -> tag) that we're receiving.
-       uint8_t *receivedCmd = ((uint8_t *)BigBuf) + RECV_CMD_OFFSET;
-
-       // The response (tag -> reader) that we're receiving.
-       uint8_t *receivedResponse = ((uint8_t *)BigBuf) + RECV_RESP_OFFSET;
-
     // The DMA buffer, used to stream samples from the FPGA.
        int8_t *dmaBuf = ((int8_t *)BigBuf) + DMA_BUFFER_OFFSET;
     int lastRxCounter;
@@ -1115,11 +1111,13 @@ void RAMFUNC SnoopIso14443(void)
 
         samples += 2;
 
-        if(Handle14443UartBit(ci & 1)) {
+               if(Handle14443UartBit(ci & 1)) {
                        if(triggered && tracing) {
-                               GetParity(receivedCmd, Uart.byteCnt, parity);
-                               LogTrace(receivedCmd,Uart.byteCnt,samples, samples,parity,TRUE);
+                               GetParity(Uart.output, Uart.byteCnt, parity);
+                               LogTrace(Uart.output,Uart.byteCnt,samples, samples,parity,TRUE);
                        }
+                       if(Uart.byteCnt==0) Dbprintf("[1] Error, Uart.byteCnt==0, Uart.bitCnt=%d", Uart.bitCnt);
+
                        /* And ready to receive another command. */
                        UartReset();
                        /* And also reset the demod code, which might have been */
@@ -1128,9 +1126,11 @@ void RAMFUNC SnoopIso14443(void)
                }
         if(Handle14443UartBit(cq & 1)) {
                        if(triggered && tracing) {
-                               GetParity(receivedCmd, Uart.byteCnt, parity);
-                               LogTrace(receivedCmd,Uart.byteCnt,samples, samples,parity,TRUE);
+                               GetParity(Uart.output, Uart.byteCnt, parity);
+                               LogTrace(Uart.output,Uart.byteCnt,samples, samples,parity,TRUE);
                        }
+                       if(Uart.byteCnt==0) Dbprintf("[2] Error, Uart.byteCnt==0, Uart.bitCnt=%d", Uart.bitCnt);
+
                        /* And ready to receive another command. */
                        UartReset();
                        /* And also reset the demod code, which might have been */
@@ -1144,8 +1144,8 @@ void RAMFUNC SnoopIso14443(void)
                        if(tracing)
                        {
                                uint8_t parity[MAX_PARITY_SIZE];
-                               GetParity(receivedResponse, Demod.len, parity);
-                               LogTrace(receivedResponse,Demod.len,samples, samples,parity,FALSE);
+                               GetParity(Demod.output, Demod.len, parity);
+                               LogTrace(Demod.output,Demod.len,samples, samples,parity,FALSE);
                        }
             triggered = TRUE;
             LED_A_OFF();
Impressum, Datenschutz