]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
CHG: FpgaSetupDMA can fail and returns NULL. Added a check for it.
authoriceman1001 <iceman@iuse.se>
Tue, 26 Apr 2016 19:31:43 +0000 (21:31 +0200)
committericeman1001 <iceman@iuse.se>
Tue, 26 Apr 2016 19:31:43 +0000 (21:31 +0200)
armsrc/iclass.c

index aff0dd758f7c87246ccfd7919dab0d8cf2fca44d..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));
@@ -1539,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