+ ci = *upTo >> 8;
+ cq = *upTo;
+ upTo++;
+ lastRxCounter--;
+ if(upTo >= dmaBuf + ISO14443B_DMA_BUFFER_SIZE) { // we have read all of the DMA buffer content.
+ upTo = dmaBuf; // start reading the circular buffer from the beginning
+ lastRxCounter += ISO14443B_DMA_BUFFER_SIZE;
+ }
+ if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_ENDRX)) { // DMA Counter Register had reached 0, already rotated.
+ AT91C_BASE_PDC_SSC->PDC_RNPR = (uint32_t) dmaBuf; // refresh the DMA Next Buffer and
+ AT91C_BASE_PDC_SSC->PDC_RNCR = ISO14443B_DMA_BUFFER_SIZE; // DMA Next Counter registers
+ }
+ samples++;
+
+ if(Handle14443bSamplesDemod(ci, cq)) {
+ gotFrame = true;
+ break;