diff options
author | Martijn Coenen <maco@google.com> | 2011-06-09 15:55:19 +0200 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2011-06-09 15:55:19 +0200 |
commit | 01a91eaddd15d39b85c9950eb88a1c6348290556 (patch) | |
tree | 511d6106958a4cdd9e0dcad0f6c8dc6e59a88894 | |
parent | 5a84ba3c21d1df214e8e95beee95ba5dbc4449f5 (diff) | |
download | external_libnfc-nxp-01a91eaddd15d39b85c9950eb88a1c6348290556.zip external_libnfc-nxp-01a91eaddd15d39b85c9950eb88a1c6348290556.tar.gz external_libnfc-nxp-01a91eaddd15d39b85c9950eb88a1c6348290556.tar.bz2 |
Make NfcA timeout configurable in libnfc.
Adds an interface for setting the NfcA timeout, which
is called "mifare raw" in libnfc. Also changed the default,
since it was set to only 2 ms, which is too short for most
commands. Current setting is around 600ms.
Change-Id: I00ccd85cd47a70895a3aca0f0bc34e1b0eab82c7
-rw-r--r-- | inc/phNfcConfig.h | 2 | ||||
-rw-r--r-- | src/phHciNfc_RFReaderA.c | 3 | ||||
-rw-r--r-- | src/phLibNfc.c | 6 | ||||
-rw-r--r-- | src/phLibNfc.h | 10 |
4 files changed, 19 insertions, 2 deletions
diff --git a/inc/phNfcConfig.h b/inc/phNfcConfig.h index 19a881b..563b7ae 100644 --- a/inc/phNfcConfig.h +++ b/inc/phNfcConfig.h @@ -176,7 +176,7 @@ #endif #ifndef NXP_MIFARE_XCHG_TIMEOUT -#define NXP_MIFARE_XCHG_TIMEOUT 0x03U +#define NXP_MIFARE_XCHG_TIMEOUT 0x0BU #endif #ifndef NXP_FELICA_XCHG_TIMEOUT diff --git a/src/phHciNfc_RFReaderA.c b/src/phHciNfc_RFReaderA.c index ba71724..1b1280a 100644 --- a/src/phHciNfc_RFReaderA.c +++ b/src/phHciNfc_RFReaderA.c @@ -67,6 +67,7 @@ #define RDR_A_MIFARE_RAW_LENGTH 0x03U +uint8_t nxp_nfc_mifareraw_timeout = NXP_MIFARE_XCHG_TIMEOUT; /* *************************** Structure and Enumeration *************************** */ @@ -1037,7 +1038,7 @@ phHciNfc_Send_ReaderA_Command( hcp_message = &(hcp_packet->msg.message); #ifdef ENABLE_MIFARE_RAW /* Time out */ - hcp_message->payload[i++] = NXP_MIFARE_XCHG_TIMEOUT ; + hcp_message->payload[i++] = nxp_nfc_mifareraw_timeout; /* Status */ hcp_message->payload[i++] = RDR_A_MIFARE_STATUS; #else diff --git a/src/phLibNfc.c b/src/phLibNfc.c index b47764e..efd186c 100644 --- a/src/phLibNfc.c +++ b/src/phLibNfc.c @@ -136,6 +136,12 @@ NFCSTATUS phLibNfc_SetFelicaTimeout(uint8_t timeout_in_ms) { return NFCSTATUS_SUCCESS; } +extern uint8_t nxp_nfc_mifareraw_timeout; +NFCSTATUS phLibNfc_SetMifareRawTimeout(uint8_t timeout) { + nxp_nfc_mifareraw_timeout = timeout; + return NFCSTATUS_SUCCESS; +} + /** * Initialize the phLibNfc interface. */ diff --git a/src/phLibNfc.h b/src/phLibNfc.h index 0e0a519..fa24866 100644 --- a/src/phLibNfc.h +++ b/src/phLibNfc.h @@ -860,6 +860,16 @@ NFCSTATUS phLibNfc_SetHciTimeout(uint32_t timeout_in_ms); // [1..255] -> timeout in ms NFCSTATUS phLibNfc_SetFelicaTimeout(uint8_t timeout_in_ms); +// MIFARE RAW timeout (ISO14443-3A / NfcA timeout) +// timeout is 8 bits +// bits [0..3] => timeout value, (256*16/13.56*10^6) * 2^value +// [0] -> 0.0003s +// .. +// [14] -> 4.9s +// [15] -> not allowed +// bits [4..7] => 0 +NFCSTATUS phLibNfc_SetMifareRawTimeout(uint8_t timeout); + /** * \ingroup grp_lib_nfc * |