]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/iclass.c
Update README.md
[proxmark3-svn] / armsrc / iclass.c
index 134e7a5ec0aeab918ec5acceb674efb46676ad0a..42deea86040145dcf3b82d5b7e1a9722b551da3d 100644 (file)
@@ -677,7 +677,11 @@ void RAMFUNC SnoopIClass(void)
     FpgaSetupSsc();
     upTo = dmaBuf;
     lastRxCounter = DMA_BUFFER_SIZE;
-    FpgaSetupSscDma((uint8_t *)dmaBuf, DMA_BUFFER_SIZE);
+       // Setup and start DMA.
+       if ( !FpgaSetupSscDma((uint8_t*) dmaBuf, DMA_BUFFER_SIZE) ){
+               if (MF_DBGLEVEL > 1) Dbprintf("FpgaSetupSscDma failed. Exiting"); 
+               return;
+       }
 
     // And the reader -> tag commands
     memset(&Uart, 0, sizeof(Uart));
@@ -807,7 +811,7 @@ void RAMFUNC SnoopIClass(void)
        Dbprintf("%x %x %x", Uart.byteCntMax, BigBuf_get_traceLen(), (int)Uart.output[0]);
 
 done:
-    AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS;
+    FpgaDisableSscDma();
     Dbprintf("%x %x %x", maxBehindBy, Uart.state, Uart.byteCnt);
        Dbprintf("%x %x %x", Uart.byteCntMax, BigBuf_get_traceLen(), (int)Uart.output[0]);
        LEDsoff();
@@ -1296,7 +1300,8 @@ int doIClassSimulation( int simulationMode, uint8_t *reader_mac_buf)
                        receivedCmd[3], receivedCmd[4], receivedCmd[5],
                        receivedCmd[6], receivedCmd[7], receivedCmd[8]);
                        // Do not respond
-                       modulated_response = resp_sof; modulated_response_size = 0; //order = 0;
+                       modulated_response = resp_sof;
+                       modulated_response_size = 0; //order = 0;
                        trace_data = NULL;
                        trace_data_size = 0;
                }
@@ -1538,9 +1543,15 @@ static int GetIClassAnswer(uint8_t *receivedResponse, int maxLen, int *samples,
                        if (elapsed) (*elapsed)++;
                }
                if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
-                       if(c < timeout) { c++; } else { return FALSE; }
+                       if(c < timeout)
+                               c++;
+                       else 
+                               return FALSE;
+                       
                        b = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
+                       
                        skip = !skip;
+                       
                        if(skip) continue;
                
                        if(ManchesterDecoding(b & 0x0f)) {
Impressum, Datenschutz