Got rid of distance-bounding code in armsrc/iso14443a.c, updated RHR to be 1 byte.

This commit is contained in:
Dom 2018-04-05 15:14:50 +01:00
commit 8255d0c837

View file

@ -88,9 +88,6 @@ uint8_t trigger = 0;
// the block number for the ISO14443-4 PCB
static uint8_t iso14_pcb_blocknum = 0;
int manchester_recv_started = 0;
int recorded = 0;
//
// ISO14443 timing:
//
@ -1589,10 +1586,6 @@ int EmSendPrecompiledCmd(tag_response_info_t *response_info) {
static int GetIso14443aAnswerFromTag(uint8_t *receivedResponse, uint8_t *receivedResponsePar, uint16_t offset)
{
uint32_t c;
//uint32_t start_ts = GetCountSspClk();
uint32_t end_ts = 0;
manchester_recv_started = 0;
recorded = 0;
// Set FPGA mode to "reader listen mode", no modulation (listen
// only, since we are receiving, not transmitting).
@ -1601,9 +1594,9 @@ static int GetIso14443aAnswerFromTag(uint8_t *receivedResponse, uint8_t *receive
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_ISO14443A | FPGA_HF_ISO14443A_READER_LISTEN);
/* Now, get the answer from the card.
32-bit registers used on the AT91:
SSC_RHR = Receive Holding Register
SSC_SR = Status Register (contains RXRDY, which is one bit. 0 is RHR is empty, or 1 if RHR has 32 bits of data in it)
Registers used on the AT91:
SSC_RHR = Receive Holding Register (8 bits)
SSC_SR = Status Register (contains RXRDY, which is one bit. 0 is RHR is empty, or 1 if RHR has 8 bits of data in it)
*/
DemodInit(receivedResponse, receivedResponsePar);
@ -1617,22 +1610,15 @@ static int GetIso14443aAnswerFromTag(uint8_t *receivedResponse, uint8_t *receive
WDT_HIT(); //Watchdog Timer
if(AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY) {
b = (uint8_t)AT91C_BASE_SSC->SSC_RHR; //read in 4 bytes of data from the RHR
// if(manchester_recv_started){
// end_ts = GetCountSspClk();
// manchester_recv_started = 0;
// recorded = 1;
// }
b = (uint8_t)AT91C_BASE_SSC->SSC_RHR; //read in 1 byte of data from the RHR
//Perform the manchester decoding on the 4 bytes just received.
if(ManchesterDecoding(b, offset, 0)) {
NextTransferTime = MAX(NextTransferTime, Demod.endTime - (DELAY_AIR2ARM_AS_READER + DELAY_ARM2AIR_AS_READER)/16 + FRAME_DELAY_TIME_PICC_TO_PCD);
//uint32_t cycle_count = end_ts - start_ts;
//Dbprintf("Finished decoding (Manchester). Value of c=%d. Cycle count (for one bit) = %d", c, cycle_count);
return true;
} else if (c++ > iso14a_timeout && Demod.state == DEMOD_UNSYNCD) {
//we reach here only if we time out (i.e. receiving the data from the PICC takes too long)
//Dbprintf("Timed out while waiting for PICC response (c = %d)!", c);
return false;
}
}
@ -2046,7 +2032,6 @@ void ReaderIso14443a(UsbCommand *c)
byte_t buf[USB_CMD_DATA_SIZE] = {0};
uint8_t par[MAX_PARITY_SIZE];
bool cantSELECT = false;
uint32_t start_ts = 0, end_ts = 0;
set_tracing(true);
@ -2123,11 +2108,7 @@ void ReaderIso14443a(UsbCommand *c)
ReaderTransmit(cmd,len, NULL); // 8 bits, odd parity
}
}
//start_ts = GetCountSspClk(); //started just after we send all our bytes to the PICC
arg0 = ReaderReceive(buf, par);
//end_ts = GetCountSspClk(); //ended just after we have received all the response bytes from the PICC.
//uint32_t cycle_count = end_ts - start_ts;
//Dbprintf("Cycle count (all bytes) = %d", cycle_count);
LED_B_ON();
cmd_send(CMD_ACK,arg0,0,0,buf,sizeof(buf));