nfc_initiator_transceive_bits_timed() function does not now use pszRxBits as parameter because this function returns it.
This commit is contained in:
parent
6e7092b160
commit
b699743973
6 changed files with 12 additions and 13 deletions
|
@ -52,7 +52,7 @@
|
|||
#define MAX_FRAME_LEN 264
|
||||
|
||||
static uint8_t abtRx[MAX_FRAME_LEN];
|
||||
static size_t szRxBits;
|
||||
static int szRxBits;
|
||||
static size_t szRx = sizeof(abtRx);
|
||||
static uint8_t abtRawUid[12];
|
||||
static uint8_t abtAtqa[2];
|
||||
|
|
|
@ -80,7 +80,7 @@ extern "C" {
|
|||
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_bits_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, size_t *pszRxBits, 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_EXPORT int nfc_target_init (nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, size_t *pszRx);
|
||||
|
|
|
@ -1318,7 +1318,7 @@ uint32_t __pn53x_get_timer(struct nfc_device *pnd, const uint8_t last_cmd_byte)
|
|||
|
||||
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, size_t *pszRxBits, uint8_t *pbtRxPar, uint32_t *cycles)
|
||||
const uint8_t *pbtTxPar, uint8_t *pbtRx, uint8_t *pbtRxPar, uint32_t *cycles)
|
||||
{
|
||||
// TODO Do something with these bytes...
|
||||
(void) pbtTxPar;
|
||||
|
@ -1326,6 +1326,7 @@ pn53x_initiator_transceive_bits_timed (struct nfc_device *pnd, const uint8_t *pb
|
|||
uint16_t i;
|
||||
uint8_t sz;
|
||||
int res = 0;
|
||||
size_t szRxBits = 0;
|
||||
|
||||
// Sorry, no arbitrary parity bits support for now
|
||||
if (!pnd->bPar) {
|
||||
|
@ -1373,7 +1374,6 @@ pn53x_initiator_transceive_bits_timed (struct nfc_device *pnd, const uint8_t *pb
|
|||
}
|
||||
|
||||
// Recv data
|
||||
*pszRxBits = 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.
|
||||
|
@ -1404,19 +1404,19 @@ pn53x_initiator_transceive_bits_timed (struct nfc_device *pnd, const uint8_t *pb
|
|||
return res;
|
||||
}
|
||||
for (i = 0; i < sz; i++) {
|
||||
pbtRx[i+*pszRxBits] = abtRes[i+off];
|
||||
pbtRx[i+szRxBits] = abtRes[i+off];
|
||||
}
|
||||
*pszRxBits += (size_t) (sz & SYMBOL_FIFO_LEVEL);
|
||||
szRxBits += (size_t) (sz & SYMBOL_FIFO_LEVEL);
|
||||
sz = abtRes[sz+off];
|
||||
if (sz == 0)
|
||||
break;
|
||||
}
|
||||
*pszRxBits *= 8; // in bits, not bytes
|
||||
szRxBits *= 8; // in bits, not bytes
|
||||
|
||||
// Recv corrected timer value
|
||||
*cycles = __pn53x_get_timer (pnd, pbtTx[szTxBits / 8]);
|
||||
|
||||
return *pszRxBits;
|
||||
return szRxBits;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -302,8 +302,7 @@ int pn53x_initiator_transceive_bits (struct nfc_device *pnd, const uint8_t *p
|
|||
int pn53x_initiator_transceive_bytes (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx,
|
||||
uint8_t *pbtRx, size_t *pszRx, int timeout);
|
||||
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, size_t *pszRxBits,
|
||||
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,
|
||||
uint8_t *pbtRx, size_t *pszRx, uint32_t *cycles);
|
||||
int pn53x_initiator_deselect_target (struct nfc_device *pnd);
|
||||
|
|
|
@ -140,7 +140,7 @@ struct nfc_driver_t {
|
|||
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_bits_timed) (struct nfc_device *pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar, uint8_t * pbtRx, size_t * pszRxBits, 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_send_bytes) (struct nfc_device *pnd, const uint8_t * pbtTx, const size_t szTx, int timeout);
|
||||
|
|
|
@ -593,9 +593,9 @@ nfc_initiator_transceive_bytes_timed (nfc_device *pnd, const uint8_t *pbtTx, con
|
|||
*/
|
||||
int
|
||||
nfc_initiator_transceive_bits_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar,
|
||||
uint8_t *pbtRx, size_t *pszRxBits, uint8_t *pbtRxPar, uint32_t *cycles)
|
||||
uint8_t *pbtRx, uint8_t *pbtRxPar, uint32_t *cycles)
|
||||
{
|
||||
HAL (initiator_transceive_bits_timed, pnd, pbtTx, szTxBits, pbtTxPar, pbtRx, pszRxBits, pbtRxPar, cycles);
|
||||
HAL (initiator_transceive_bits_timed, pnd, pbtTx, szTxBits, pbtTxPar, pbtRx, pbtRxPar, cycles);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue