Merge pull request #3557 from Antiklesys/master
Bugfix: stale ISO14443A scheduler delay
This commit is contained in:
3 files changed
+10
No files matched your search
@@ -314,6 +314,12 @@ uint32_t iso14a_get_timeout(void) {
|
||||
return iso14a_timeout - (DELAY_AIR2ARM_AS_READER + DELAY_ARM2AIR_AS_READER) / 128 - 2;
|
||||
}
|
||||
|
||||
void iso14a_rebase_transfer_time(void) {
|
||||
//Restarting StartCountSspClk() resets NextTransferTime clock-counts to zero; retaining old value makes ReaderTransmit() wait stale time from previous APDU.
|
||||
//Do not reset PCB or ATS state here.
|
||||
NextTransferTime = 2 * DELAY_ARM2AIR_AS_READER;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Generate the parity value for a byte sequence
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -129,6 +129,8 @@ void setHf14aConfig(const hf14a_config_t *hc);
|
||||
hf14a_config_t *getHf14aConfig(void);
|
||||
void iso14a_set_timeout(uint32_t timeout);
|
||||
uint32_t iso14a_get_timeout(void);
|
||||
// Rebase absolute reader-transfer schedule after a caller restarts the SSP clock counter.
|
||||
void iso14a_rebase_transfer_time(void);
|
||||
|
||||
void GetParity(const uint8_t *pbtCmd, uint16_t len, uint8_t *par);
|
||||
|
||||
|
||||
@@ -366,6 +366,8 @@ static int sam_sc_card_api_loop(uint8_t *response, uint16_t *response_len,
|
||||
}
|
||||
if (iso14a) {
|
||||
switch_clock_to_countsspclk();
|
||||
//Keep absolute transfer scheduler in the same time base; so it doesn't wait on a stale timestamp from the preceding Card-API APDU.
|
||||
iso14a_rebase_transfer_time();
|
||||
int apdu_len = iso14_apdu((uint8_t *)op_value, op_len, false,
|
||||
nfc_rx, sizeof(nfc_rx), NULL);
|
||||
switch_clock_to_ticks();
|
||||
|
||||
Reference in new issue
Block a user