nfc_target_receive_bytes() function does not now use pszRx as parameter because this function returns it.

This commit is contained in:
Audrey Diacre 2012-01-05 16:33:55 +00:00
parent 7e7ee3299e
commit 642f9a38f7
11 changed files with 25 additions and 26 deletions

View file

@ -1851,7 +1851,7 @@ pn53x_target_receive_bits (struct nfc_device *pnd, uint8_t *pbtRx, uint8_t *pbtR
}
int
pn53x_target_receive_bytes (struct nfc_device *pnd, uint8_t *pbtRx, size_t *pszRx, int timeout)
pn53x_target_receive_bytes (struct nfc_device *pnd, uint8_t *pbtRx, int timeout)
{
uint8_t abtCmd[1];
@ -1890,13 +1890,13 @@ pn53x_target_receive_bytes (struct nfc_device *pnd, uint8_t *pbtRx, size_t *pszR
return pnd->last_error;
// Save the received bytes count
*pszRx = szRx - 1;
szRx -= 1;
// Copy the received bytes
memcpy (pbtRx, abtRx + 1, *pszRx);
memcpy (pbtRx, abtRx + 1, szRx);
// Everyting seems ok, return received bytes count
return *pszRx;
return szRx;
}
int

View file

@ -310,7 +310,7 @@ int pn53x_initiator_deselect_target (struct nfc_device *pnd);
// NFC device as Target functions
int pn53x_target_init (struct nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, size_t *pszRx, int timeout);
int pn53x_target_receive_bits (struct nfc_device *pnd, uint8_t *pbtRx, uint8_t *pbtRxPar);
int pn53x_target_receive_bytes (struct nfc_device *pnd, uint8_t *pbtRx, size_t *pszRx, int timeout);
int pn53x_target_receive_bytes (struct nfc_device *pnd, uint8_t *pbtRx, int timeout);
int pn53x_target_send_bits (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar);
int pn53x_target_send_bytes (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, int timeout);

View file

@ -47,7 +47,7 @@ nfc_emulate_target (nfc_device *pnd, struct nfc_emulator *emulator)
}
}
if (res >= 0) {
if (nfc_target_receive_bytes(pnd, abtRx, &szRx, 0) < 0) {
if ((int) ((szRx = (size_t) nfc_target_receive_bytes(pnd, abtRx, 0))) < 0) {
return -1;
}
}

View file

@ -144,7 +144,7 @@ struct nfc_driver_t {
int (*target_init) (struct nfc_device *pnd, nfc_target * pnt, uint8_t * pbtRx, size_t * pszRx, int timeout);
int (*target_send_bytes) (struct nfc_device *pnd, const uint8_t * pbtTx, const size_t szTx, int timeout);
int (*target_receive_bytes) (struct nfc_device *pnd, uint8_t * pbtRx, size_t * pszRx, int timeout);
int (*target_receive_bytes) (struct nfc_device *pnd, uint8_t * pbtRx, int timeout);
int (*target_send_bits) (struct nfc_device *pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar);
int (*target_receive_bits) (struct nfc_device *pnd, uint8_t * pbtRx, uint8_t * pbtRxPar);

View file

@ -719,7 +719,6 @@ nfc_target_send_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx,
*
* @param pnd \a nfc_device struct pointer that represent currently used device
* @param[out] pbtRx pointer to Rx buffer
* @param[out] pszRx received byte count
* @param timeout in milliseconds
*
* This function retrieves bytes frames (e.g. ADPU) sent by the \e initiator to the NFC device (configured as \e target).
@ -728,9 +727,9 @@ nfc_target_send_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx,
* If timeout is a null pointer, the function blocks indefinitely (until an error is raised or function is completed).
*/
int
nfc_target_receive_bytes (nfc_device *pnd, uint8_t *pbtRx, size_t *pszRx, int timeout)
nfc_target_receive_bytes (nfc_device *pnd, uint8_t *pbtRx, int timeout)
{
HAL (target_receive_bytes, pnd, pbtRx, pszRx, timeout);
HAL (target_receive_bytes, pnd, pbtRx, timeout);
}
/**