From a41b2b0da8b419a0690a17a5e082dd827b6d4320 Mon Sep 17 00:00:00 2001 From: Audrey Diacre Date: Wed, 4 Jan 2012 15:53:41 +0000 Subject: [PATCH] nfc_initiator_transceive_bytes_timed() function does not now use pszRx as parameter because this function returns it. --- include/nfc/nfc.h | 2 +- libnfc/chips/pn53x.c | 11 +++++------ libnfc/chips/pn53x.h | 2 +- libnfc/nfc-internal.h | 2 +- libnfc/nfc.c | 5 ++--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/include/nfc/nfc.h b/include/nfc/nfc.h index b2f387a..6b8c588 100644 --- a/include/nfc/nfc.h +++ b/include/nfc/nfc.h @@ -79,7 +79,7 @@ extern "C" { NFC_EXPORT int nfc_initiator_deselect_target (nfc_device *pnd); NFC_EXPORT int nfc_initiator_transceive_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, size_t *pszRx, int timeout); NFC_EXPORT int nfc_initiator_transceive_bits (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, uint8_t *pbtRxPar); - NFC_EXPORT int nfc_initiator_transceive_bytes_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, size_t *pszRx, uint32_t *cycles); + NFC_EXPORT int nfc_initiator_transceive_bytes_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, uint32_t *cycles); NFC_EXPORT int nfc_initiator_transceive_bits_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, uint8_t *pbtRxPar, uint32_t *cycles); /* NFC target: act as tag (i.e. MIFARE Classic) or NFC target device. */ diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 99247ff..232b6ca 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1420,8 +1420,7 @@ pn53x_initiator_transceive_bits_timed (struct nfc_device *pnd, const uint8_t *pb } int -pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, - size_t *pszRx, uint32_t *cycles) +pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, uint32_t *cycles) { uint16_t i; uint8_t sz; @@ -1469,7 +1468,7 @@ pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *p } // Recv data - *pszRx = 0; + size_t szRx = 0; // we've to watch for coming data until we decide to timeout. // our PN53x timer saturates after 4.8ms so this function shouldn't be used for // responses coming very late anyway. @@ -1500,9 +1499,9 @@ pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *p return res; } for (i = 0; i < sz; i++) { - pbtRx[i+*pszRx] = abtRes[i+off]; + pbtRx[i+szRx] = abtRes[i+off]; } - *pszRx += (size_t) (sz & SYMBOL_FIFO_LEVEL); + szRx += (size_t) (sz & SYMBOL_FIFO_LEVEL); sz = abtRes[sz+off]; if (sz == 0) break; @@ -1520,7 +1519,7 @@ pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *p } else { *cycles = __pn53x_get_timer (pnd, pbtTx[szTx -1]); } - return *pszRx; + return szRx; } int diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index 057fe4a..73b1f06 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -304,7 +304,7 @@ int pn53x_initiator_transceive_bytes (struct nfc_device *pnd, const uint8_t int pn53x_initiator_transceive_bits_timed (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, uint8_t *pbtRxPar, uint32_t *cycles); int pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, - uint8_t *pbtRx, size_t *pszRx, uint32_t *cycles); + uint8_t *pbtRx, uint32_t *cycles); int pn53x_initiator_deselect_target (struct nfc_device *pnd); // NFC device as Target functions diff --git a/libnfc/nfc-internal.h b/libnfc/nfc-internal.h index 1477c2e..2092144 100644 --- a/libnfc/nfc-internal.h +++ b/libnfc/nfc-internal.h @@ -139,7 +139,7 @@ struct nfc_driver_t { int (*initiator_deselect_target) (struct nfc_device *pnd); int (*initiator_transceive_bytes) (struct nfc_device *pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, size_t * pszRx, int timeout); int (*initiator_transceive_bits) (struct nfc_device *pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar, uint8_t * pbtRx, uint8_t * pbtRxPar); - int (*initiator_transceive_bytes_timed) (struct nfc_device *pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, size_t * pszRx, uint32_t * cycles); + int (*initiator_transceive_bytes_timed) (struct nfc_device *pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, uint32_t * cycles); int (*initiator_transceive_bits_timed) (struct nfc_device *pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar, uint8_t * pbtRx, uint8_t * pbtRxPar, uint32_t * cycles); int (*target_init) (struct nfc_device *pnd, nfc_target * pnt, uint8_t * pbtRx, size_t * pszRx); diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 8e532ac..dfe7586 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -564,10 +564,9 @@ nfc_initiator_transceive_bits (nfc_device *pnd, const uint8_t *pbtTx, const size * @warning The configuration option \a NP_HANDLE_PARITY must be set to \c true (the default value). */ int -nfc_initiator_transceive_bytes_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, - size_t *pszRx, uint32_t *cycles) +nfc_initiator_transceive_bytes_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, uint32_t *cycles) { - HAL (initiator_transceive_bytes_timed, pnd, pbtTx, szTx, pbtRx, pszRx, cycles) + HAL (initiator_transceive_bytes_timed, pnd, pbtTx, szTx, pbtRx, cycles) } /**