X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/aa5bbe6a9b16573b69c51f1a4a8c7a06ec5dc2c8..ad5bc8cc8c0a6573d6b2c7bc58bf94f7ab66ad4c:/armsrc/iclass.c

diff --git a/armsrc/iclass.c b/armsrc/iclass.c
index aff0dd75..42deea86 100644
--- a/armsrc/iclass.c
+++ b/armsrc/iclass.c
@@ -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)) {