nfc_initiator_transceive_bytes_timed() function does not now use pszRx as parameter because this function returns it.
This commit is contained in:
parent
b699743973
commit
a41b2b0da8
5 changed files with 10 additions and 12 deletions
|
@ -79,7 +79,7 @@ extern "C" {
|
||||||
NFC_EXPORT int nfc_initiator_deselect_target (nfc_device *pnd);
|
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_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_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_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. */
|
/* NFC target: act as tag (i.e. MIFARE Classic) or NFC target device. */
|
||||||
|
|
|
@ -1420,8 +1420,7 @@ pn53x_initiator_transceive_bits_timed (struct nfc_device *pnd, const uint8_t *pb
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx,
|
pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, uint32_t *cycles)
|
||||||
size_t *pszRx, uint32_t *cycles)
|
|
||||||
{
|
{
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
uint8_t sz;
|
uint8_t sz;
|
||||||
|
@ -1469,7 +1468,7 @@ pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *p
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recv data
|
// Recv data
|
||||||
*pszRx = 0;
|
size_t szRx = 0;
|
||||||
// we've to watch for coming data until we decide to timeout.
|
// 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
|
// our PN53x timer saturates after 4.8ms so this function shouldn't be used for
|
||||||
// responses coming very late anyway.
|
// responses coming very late anyway.
|
||||||
|
@ -1500,9 +1499,9 @@ pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *p
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
for (i = 0; i < sz; i++) {
|
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];
|
sz = abtRes[sz+off];
|
||||||
if (sz == 0)
|
if (sz == 0)
|
||||||
break;
|
break;
|
||||||
|
@ -1520,7 +1519,7 @@ pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *p
|
||||||
} else {
|
} else {
|
||||||
*cycles = __pn53x_get_timer (pnd, pbtTx[szTx -1]);
|
*cycles = __pn53x_get_timer (pnd, pbtTx[szTx -1]);
|
||||||
}
|
}
|
||||||
return *pszRx;
|
return szRx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -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,
|
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);
|
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,
|
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);
|
int pn53x_initiator_deselect_target (struct nfc_device *pnd);
|
||||||
|
|
||||||
// NFC device as Target functions
|
// NFC device as Target functions
|
||||||
|
|
|
@ -139,7 +139,7 @@ struct nfc_driver_t {
|
||||||
int (*initiator_deselect_target) (struct nfc_device *pnd);
|
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_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_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 (*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);
|
int (*target_init) (struct nfc_device *pnd, nfc_target * pnt, uint8_t * pbtRx, size_t * pszRx);
|
||||||
|
|
|
@ -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).
|
* @warning The configuration option \a NP_HANDLE_PARITY must be set to \c true (the default value).
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
nfc_initiator_transceive_bytes_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx,
|
nfc_initiator_transceive_bytes_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, uint32_t *cycles)
|
||||||
size_t *pszRx, uint32_t *cycles)
|
|
||||||
{
|
{
|
||||||
HAL (initiator_transceive_bytes_timed, pnd, pbtTx, szTx, pbtRx, pszRx, cycles)
|
HAL (initiator_transceive_bytes_timed, pnd, pbtTx, szTx, pbtRx, cycles)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue