Remove whitespace after star symbol for pointers

This commit is contained in:
Audrey Diacre 2011-11-25 13:32:29 +00:00
parent 90b5961b40
commit 5a9a778879
2 changed files with 116 additions and 116 deletions

View file

@ -51,15 +51,15 @@ const uint8_t pn53x_nack_frame[] = { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 };
static const uint8_t pn53x_error_frame[] = { 0x00, 0x00, 0xff, 0x01, 0xff, 0x7f, 0x81, 0x00 }; static const uint8_t pn53x_error_frame[] = { 0x00, 0x00, 0xff, 0x01, 0xff, 0x7f, 0x81, 0x00 };
/* prototypes */ /* prototypes */
bool pn53x_reset_settings (nfc_device * pnd); bool pn53x_reset_settings (nfc_device *pnd);
bool pn53x_writeback_register (nfc_device * pnd); bool pn53x_writeback_register (nfc_device *pnd);
nfc_modulation pn53x_ptt_to_nm (const pn53x_target_type ptt); nfc_modulation pn53x_ptt_to_nm (const pn53x_target_type ptt);
pn53x_modulation pn53x_nm_to_pm (const nfc_modulation nm); pn53x_modulation pn53x_nm_to_pm (const nfc_modulation nm);
pn53x_target_type pn53x_nm_to_ptt (const nfc_modulation nm); pn53x_target_type pn53x_nm_to_ptt (const nfc_modulation nm);
bool bool
pn53x_init(nfc_device * pnd) pn53x_init(nfc_device *pnd)
{ {
// GetFirmwareVersion command is used to set PN53x chips type (PN531, PN532 or PN533) // GetFirmwareVersion command is used to set PN53x chips type (PN531, PN532 or PN533)
char abtFirmwareText[22]; char abtFirmwareText[22];
@ -89,7 +89,7 @@ pn53x_init(nfc_device * pnd)
} }
bool bool
pn53x_reset_settings(nfc_device * pnd) pn53x_reset_settings(nfc_device *pnd)
{ {
// Reset the ending transmission bits register, it is unknown what the last tranmission used there // Reset the ending transmission bits register, it is unknown what the last tranmission used there
CHIP_DATA (pnd)->ui8TxBits = 0; CHIP_DATA (pnd)->ui8TxBits = 0;
@ -100,7 +100,7 @@ pn53x_reset_settings(nfc_device * pnd)
} }
bool bool
pn53x_transceive (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, size_t *pszRx, int timeout) pn53x_transceive (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, size_t *pszRx, int timeout)
{ {
if (CHIP_DATA (pnd)->wb_trigged) { if (CHIP_DATA (pnd)->wb_trigged) {
if (!pn53x_writeback_register (pnd)) { if (!pn53x_writeback_register (pnd)) {
@ -190,7 +190,7 @@ pn53x_transceive (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, ui
} }
bool bool
pn53x_set_parameters (nfc_device * pnd, const uint8_t ui8Parameter, const bool bEnable) pn53x_set_parameters (nfc_device *pnd, const uint8_t ui8Parameter, const bool bEnable)
{ {
uint8_t ui8Value = (bEnable) ? (CHIP_DATA (pnd)->ui8Parameters | ui8Parameter) : (CHIP_DATA (pnd)->ui8Parameters & ~(ui8Parameter)); uint8_t ui8Value = (bEnable) ? (CHIP_DATA (pnd)->ui8Parameters | ui8Parameter) : (CHIP_DATA (pnd)->ui8Parameters & ~(ui8Parameter));
if (ui8Value != CHIP_DATA (pnd)->ui8Parameters) { if (ui8Value != CHIP_DATA (pnd)->ui8Parameters) {
@ -200,7 +200,7 @@ pn53x_set_parameters (nfc_device * pnd, const uint8_t ui8Parameter, const bool b
} }
bool bool
pn53x_set_tx_bits (nfc_device * pnd, const uint8_t ui8Bits) pn53x_set_tx_bits (nfc_device *pnd, const uint8_t ui8Bits)
{ {
// Test if we need to update the transmission bits register setting // Test if we need to update the transmission bits register setting
if (CHIP_DATA (pnd)->ui8TxBits != ui8Bits) { if (CHIP_DATA (pnd)->ui8TxBits != ui8Bits) {
@ -215,8 +215,8 @@ pn53x_set_tx_bits (nfc_device * pnd, const uint8_t ui8Bits)
} }
bool bool
pn53x_wrap_frame (const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar, pn53x_wrap_frame (const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar,
uint8_t * pbtFrame, size_t * pszFrameBits) uint8_t *pbtFrame, size_t *pszFrameBits)
{ {
uint8_t btFrame; uint8_t btFrame;
uint8_t btData; uint8_t btData;
@ -271,8 +271,8 @@ pn53x_wrap_frame (const uint8_t * pbtTx, const size_t szTxBits, const uint8_t *
} }
bool bool
pn53x_unwrap_frame (const uint8_t * pbtFrame, const size_t szFrameBits, uint8_t * pbtRx, size_t * pszRxBits, pn53x_unwrap_frame (const uint8_t *pbtFrame, const size_t szFrameBits, uint8_t *pbtRx, size_t *pszRxBits,
uint8_t * pbtRxPar) uint8_t *pbtRxPar)
{ {
uint8_t btFrame; uint8_t btFrame;
uint8_t btData; uint8_t btData;
@ -318,8 +318,8 @@ pn53x_unwrap_frame (const uint8_t * pbtFrame, const size_t szFrameBits, uint8_t
} }
bool bool
pn53x_decode_target_data (const uint8_t * pbtRawData, size_t szRawData, pn53x_type type, nfc_modulationype nmt, pn53x_decode_target_data (const uint8_t *pbtRawData, size_t szRawData, pn53x_type type, nfc_modulationype nmt,
nfc_target_info * pnti) nfc_target_info *pnti)
{ {
uint8_t szAttribRes; uint8_t szAttribRes;
@ -462,7 +462,7 @@ pn53x_decode_target_data (const uint8_t * pbtRawData, size_t szRawData, pn53x_ty
} }
bool bool
pn53x_ReadRegister (nfc_device * pnd, uint16_t ui16RegisterAddress, uint8_t * ui8Value) pn53x_ReadRegister (nfc_device *pnd, uint16_t ui16RegisterAddress, uint8_t *ui8Value)
{ {
uint8_t abtCmd[] = { ReadRegister, ui16RegisterAddress >> 8, ui16RegisterAddress & 0xff }; uint8_t abtCmd[] = { ReadRegister, ui16RegisterAddress >> 8, ui16RegisterAddress & 0xff };
uint8_t abtRegValue[2]; uint8_t abtRegValue[2];
@ -481,13 +481,13 @@ pn53x_ReadRegister (nfc_device * pnd, uint16_t ui16RegisterAddress, uint8_t * ui
return true; return true;
} }
bool pn53x_read_register (nfc_device * pnd, uint16_t ui16RegisterAddress, uint8_t * ui8Value) bool pn53x_read_register (nfc_device *pnd, uint16_t ui16RegisterAddress, uint8_t *ui8Value)
{ {
return pn53x_ReadRegister (pnd, ui16RegisterAddress, ui8Value); return pn53x_ReadRegister (pnd, ui16RegisterAddress, ui8Value);
} }
bool bool
pn53x_WriteRegister (nfc_device * pnd, const uint16_t ui16RegisterAddress, const uint8_t ui8Value) pn53x_WriteRegister (nfc_device *pnd, const uint16_t ui16RegisterAddress, const uint8_t ui8Value)
{ {
uint8_t abtCmd[] = { WriteRegister, ui16RegisterAddress >> 8, ui16RegisterAddress & 0xff, ui8Value }; uint8_t abtCmd[] = { WriteRegister, ui16RegisterAddress >> 8, ui16RegisterAddress & 0xff, ui8Value };
PNREG_TRACE (ui16RegisterAddress); PNREG_TRACE (ui16RegisterAddress);
@ -495,7 +495,7 @@ pn53x_WriteRegister (nfc_device * pnd, const uint16_t ui16RegisterAddress, const
} }
bool bool
pn53x_write_register (nfc_device * pnd, const uint16_t ui16RegisterAddress, const uint8_t ui8SymbolMask, const uint8_t ui8Value) pn53x_write_register (nfc_device *pnd, const uint16_t ui16RegisterAddress, const uint8_t ui8SymbolMask, const uint8_t ui8Value)
{ {
if ((ui16RegisterAddress < PN53X_CACHE_REGISTER_MIN_ADDRESS) || (ui16RegisterAddress > PN53X_CACHE_REGISTER_MAX_ADDRESS)) { if ((ui16RegisterAddress < PN53X_CACHE_REGISTER_MIN_ADDRESS) || (ui16RegisterAddress > PN53X_CACHE_REGISTER_MAX_ADDRESS)) {
// Direct write // Direct write
@ -521,7 +521,7 @@ pn53x_write_register (nfc_device * pnd, const uint16_t ui16RegisterAddress, cons
} }
bool bool
pn53x_writeback_register (nfc_device * pnd) pn53x_writeback_register (nfc_device *pnd)
{ {
// TODO Check at each step (ReadRegister, WriteRegister) if we didn't exceed max supported frame length // TODO Check at each step (ReadRegister, WriteRegister) if we didn't exceed max supported frame length
BUFFER_INIT (abtReadRegisterCmd, PN53x_EXTENDED_FRAME__DATA_MAX_LEN); BUFFER_INIT (abtReadRegisterCmd, PN53x_EXTENDED_FRAME__DATA_MAX_LEN);
@ -589,7 +589,7 @@ pn53x_writeback_register (nfc_device * pnd)
} }
bool bool
pn53x_get_firmware_version (nfc_device * pnd, char abtFirmwareText[22]) pn53x_get_firmware_version (nfc_device *pnd, char abtFirmwareText[22])
{ {
const uint8_t abtCmd[] = { GetFirmwareVersion }; const uint8_t abtCmd[] = { GetFirmwareVersion };
uint8_t abtFw[4]; uint8_t abtFw[4];
@ -640,7 +640,7 @@ pn53x_get_firmware_version (nfc_device * pnd, char abtFirmwareText[22])
} }
bool bool
pn53x_configure (nfc_device * pnd, const nfc_device_option ndo, const bool bEnable) pn53x_configure (nfc_device *pnd, const nfc_device_option ndo, const bool bEnable)
{ {
uint8_t btValue; uint8_t btValue;
switch (ndo) { switch (ndo) {
@ -839,7 +839,7 @@ pn53x_check_communication (nfc_device *pnd)
} }
bool bool
pn53x_initiator_init (nfc_device * pnd) pn53x_initiator_init (nfc_device *pnd)
{ {
pn53x_reset_settings(pnd); pn53x_reset_settings(pnd);
@ -852,10 +852,10 @@ pn53x_initiator_init (nfc_device * pnd)
} }
bool bool
pn53x_initiator_select_passive_target_ext (nfc_device * pnd, pn53x_initiator_select_passive_target_ext (nfc_device *pnd,
const nfc_modulation nm, const nfc_modulation nm,
const uint8_t * pbtInitData, const size_t szInitData, const uint8_t *pbtInitData, const size_t szInitData,
nfc_target * pnt, nfc_target *pnt,
int timeout) int timeout)
{ {
uint8_t abtTargetsData[PN53x_EXTENDED_FRAME__DATA_MAX_LEN]; uint8_t abtTargetsData[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
@ -962,19 +962,19 @@ pn53x_initiator_select_passive_target_ext (nfc_device * pnd,
} }
bool bool
pn53x_initiator_select_passive_target (nfc_device * pnd, pn53x_initiator_select_passive_target (nfc_device *pnd,
const nfc_modulation nm, const nfc_modulation nm,
const uint8_t * pbtInitData, const size_t szInitData, const uint8_t *pbtInitData, const size_t szInitData,
nfc_target * pnt) nfc_target *pnt)
{ {
return pn53x_initiator_select_passive_target_ext (pnd, nm, pbtInitData, szInitData, pnt, 0); return pn53x_initiator_select_passive_target_ext (pnd, nm, pbtInitData, szInitData, pnt, 0);
} }
bool bool
pn53x_initiator_poll_target (nfc_device * pnd, pn53x_initiator_poll_target (nfc_device *pnd,
const nfc_modulation * pnmModulations, const size_t szModulations, const nfc_modulation *pnmModulations, const size_t szModulations,
const uint8_t uiPollNr, const uint8_t uiPeriod, const uint8_t uiPollNr, const uint8_t uiPeriod,
nfc_target * pnt) nfc_target *pnt)
{ {
if (CHIP_DATA(pnd)->type == PN532) { if (CHIP_DATA(pnd)->type == PN532) {
size_t szTargetTypes = 0; size_t szTargetTypes = 0;
@ -1035,10 +1035,10 @@ pn53x_initiator_poll_target (nfc_device * pnd,
} }
bool bool
pn53x_initiator_select_dep_target(nfc_device * pnd, pn53x_initiator_select_dep_target(nfc_device *pnd,
const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_mode ndm, const nfc_baud_rate nbr,
const nfc_dep_info * pndiInitiator, const nfc_dep_info *pndiInitiator,
nfc_target * pnt) nfc_target *pnt)
{ {
const uint8_t abtPassiveInitiatorData[] = { 0x00, 0xff, 0xff, 0x00, 0x00 }; // Only for 212/424 kpbs: First 4 bytes shall be set like this according to NFCIP-1, last byte is TSN (Time Slot Number) const uint8_t abtPassiveInitiatorData[] = { 0x00, 0xff, 0xff, 0x00, 0x00 }; // Only for 212/424 kpbs: First 4 bytes shall be set like this according to NFCIP-1, last byte is TSN (Time Slot Number)
const uint8_t * pbtPassiveInitiatorData = NULL; const uint8_t * pbtPassiveInitiatorData = NULL;
@ -1063,8 +1063,8 @@ pn53x_initiator_select_dep_target(nfc_device * pnd,
} }
bool bool
pn53x_initiator_transceive_bits (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTxBits, pn53x_initiator_transceive_bits (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits,
const uint8_t * pbtTxPar, uint8_t * pbtRx, size_t * pszRxBits, uint8_t * pbtRxPar) const uint8_t *pbtTxPar, uint8_t *pbtRx, size_t *pszRxBits, uint8_t *pbtRxPar)
{ {
size_t szFrameBits = 0; size_t szFrameBits = 0;
size_t szFrameBytes = 0; size_t szFrameBytes = 0;
@ -1127,8 +1127,8 @@ pn53x_initiator_transceive_bits (nfc_device * pnd, const uint8_t * pbtTx, const
} }
bool bool
pn53x_initiator_transceive_bytes (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, pn53x_initiator_transceive_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx,
size_t * pszRx, int timeout) size_t *pszRx, int timeout)
{ {
size_t szExtraTxLen; size_t szExtraTxLen;
uint8_t abtCmd[PN53x_EXTENDED_FRAME__DATA_MAX_LEN]; uint8_t abtCmd[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
@ -1173,7 +1173,7 @@ pn53x_initiator_transceive_bytes (nfc_device * pnd, const uint8_t * pbtTx, const
return true; return true;
} }
void __pn53x_init_timer(nfc_device * pnd, const uint32_t max_cycles) void __pn53x_init_timer(nfc_device *pnd, const uint32_t max_cycles)
{ {
// The prescaler will dictate what will be the precision and // The prescaler will dictate what will be the precision and
// the largest delay to measure before saturation. Some examples: // the largest delay to measure before saturation. Some examples:
@ -1194,7 +1194,7 @@ void __pn53x_init_timer(nfc_device * pnd, const uint32_t max_cycles)
pn53x_write_register (pnd, PN53X_REG_CIU_TReloadVal_lo, 0xFF, reloadval & 0xFF); pn53x_write_register (pnd, PN53X_REG_CIU_TReloadVal_lo, 0xFF, reloadval & 0xFF);
} }
uint32_t __pn53x_get_timer(nfc_device * pnd, const uint8_t last_cmd_byte) uint32_t __pn53x_get_timer(nfc_device *pnd, const uint8_t last_cmd_byte)
{ {
uint8_t parity; uint8_t parity;
uint8_t counter_hi, counter_lo; uint8_t counter_hi, counter_lo;
@ -1255,8 +1255,8 @@ uint32_t __pn53x_get_timer(nfc_device * pnd, const uint8_t last_cmd_byte)
} }
bool bool
pn53x_initiator_transceive_bits_timed (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTxBits, pn53x_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) const uint8_t *pbtTxPar, uint8_t *pbtRx, size_t *pszRxBits, uint8_t *pbtRxPar, uint32_t *cycles)
{ {
// TODO Do something with these bytes... // TODO Do something with these bytes...
(void) pbtTxPar; (void) pbtTxPar;
@ -1357,8 +1357,8 @@ pn53x_initiator_transceive_bits_timed (nfc_device * pnd, const uint8_t * pbtTx,
} }
bool bool
pn53x_initiator_transceive_bytes_timed (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, pn53x_initiator_transceive_bytes_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx,
size_t * pszRx, uint32_t * cycles) size_t *pszRx, uint32_t *cycles)
{ {
uint16_t i; uint16_t i;
uint8_t sz; uint8_t sz;
@ -1460,7 +1460,7 @@ pn53x_initiator_transceive_bytes_timed (nfc_device * pnd, const uint8_t * pbtTx,
} }
bool bool
pn53x_initiator_deselect_target (nfc_device * pnd) pn53x_initiator_deselect_target (nfc_device *pnd)
{ {
return (pn53x_InDeselect (pnd, 0)); // 0 mean deselect all selected targets return (pn53x_InDeselect (pnd, 0)); // 0 mean deselect all selected targets
} }
@ -1468,7 +1468,7 @@ pn53x_initiator_deselect_target (nfc_device * pnd)
#define SAK_ISO14443_4_COMPLIANT 0x20 #define SAK_ISO14443_4_COMPLIANT 0x20
#define SAK_ISO18092_COMPLIANT 0x40 #define SAK_ISO18092_COMPLIANT 0x40
bool bool
pn53x_target_init (nfc_device * pnd, nfc_target * pnt, uint8_t * pbtRx, size_t * pszRx) pn53x_target_init (nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, size_t *pszRx)
{ {
pn53x_reset_settings(pnd); pn53x_reset_settings(pnd);
@ -1689,7 +1689,7 @@ pn53x_target_init (nfc_device * pnd, nfc_target * pnt, uint8_t * pbtRx, size_t *
} }
bool bool
pn53x_target_receive_bits (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRxBits, uint8_t * pbtRxPar) pn53x_target_receive_bits (nfc_device *pnd, uint8_t *pbtRx, size_t *pszRxBits, uint8_t *pbtRxPar)
{ {
uint8_t abtCmd[] = { TgGetInitiatorCommand }; uint8_t abtCmd[] = { TgGetInitiatorCommand };
@ -1724,7 +1724,7 @@ pn53x_target_receive_bits (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRxBits
} }
bool bool
pn53x_target_receive_bytes (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRx, int timeout) pn53x_target_receive_bytes (nfc_device *pnd, uint8_t *pbtRx, size_t *pszRx, int timeout)
{ {
uint8_t abtCmd[1]; uint8_t abtCmd[1];
@ -1773,7 +1773,7 @@ pn53x_target_receive_bytes (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRx, i
} }
bool bool
pn53x_target_send_bits (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar) pn53x_target_send_bits (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar)
{ {
size_t szFrameBits = 0; size_t szFrameBits = 0;
size_t szFrameBytes = 0; size_t szFrameBytes = 0;
@ -1811,7 +1811,7 @@ pn53x_target_send_bits (nfc_device * pnd, const uint8_t * pbtTx, const size_t sz
} }
bool bool
pn53x_target_send_bytes (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, int timeout) pn53x_target_send_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, int timeout)
{ {
uint8_t abtCmd[PN53x_EXTENDED_FRAME__DATA_MAX_LEN]; uint8_t abtCmd[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
@ -1910,7 +1910,7 @@ static struct sErrorMessage {
}; };
const char * const char *
pn53x_strerror (const nfc_device * pnd) pn53x_strerror (const nfc_device *pnd)
{ {
const char *pcRes = "Unknown error"; const char *pcRes = "Unknown error";
size_t i; size_t i;
@ -1926,14 +1926,14 @@ pn53x_strerror (const nfc_device * pnd)
} }
bool bool
pn53x_RFConfiguration__RF_field (nfc_device * pnd, bool bEnable) pn53x_RFConfiguration__RF_field (nfc_device *pnd, bool bEnable)
{ {
uint8_t abtCmd[] = { RFConfiguration, RFCI_FIELD, (bEnable) ? 0x01 : 0x00 }; uint8_t abtCmd[] = { RFConfiguration, RFCI_FIELD, (bEnable) ? 0x01 : 0x00 };
return pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL, 0); return pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL, 0);
} }
bool bool
pn53x_RFConfiguration__Various_timings (nfc_device * pnd, const uint8_t fATR_RES_Timeout, const uint8_t fRetryTimeout) pn53x_RFConfiguration__Various_timings (nfc_device *pnd, const uint8_t fATR_RES_Timeout, const uint8_t fRetryTimeout)
{ {
uint8_t abtCmd[] = { uint8_t abtCmd[] = {
RFConfiguration, RFConfiguration,
@ -1946,7 +1946,7 @@ pn53x_RFConfiguration__Various_timings (nfc_device * pnd, const uint8_t fATR_RES
} }
bool bool
pn53x_RFConfiguration__MaxRtyCOM (nfc_device * pnd, const uint8_t MaxRtyCOM) pn53x_RFConfiguration__MaxRtyCOM (nfc_device *pnd, const uint8_t MaxRtyCOM)
{ {
uint8_t abtCmd[] = { uint8_t abtCmd[] = {
RFConfiguration, RFConfiguration,
@ -1957,7 +1957,7 @@ pn53x_RFConfiguration__MaxRtyCOM (nfc_device * pnd, const uint8_t MaxRtyCOM)
} }
bool bool
pn53x_RFConfiguration__MaxRetries (nfc_device * pnd, const uint8_t MxRtyATR, const uint8_t MxRtyPSL, const uint8_t MxRtyPassiveActivation) pn53x_RFConfiguration__MaxRetries (nfc_device *pnd, const uint8_t MxRtyATR, const uint8_t MxRtyPSL, const uint8_t MxRtyPassiveActivation)
{ {
// Retry format: 0x00 means only 1 try, 0xff means infinite // Retry format: 0x00 means only 1 try, 0xff means infinite
uint8_t abtCmd[] = { uint8_t abtCmd[] = {
@ -1971,7 +1971,7 @@ pn53x_RFConfiguration__MaxRetries (nfc_device * pnd, const uint8_t MxRtyATR, con
} }
bool bool
pn53x_SetParameters (nfc_device * pnd, const uint8_t ui8Value) pn53x_SetParameters (nfc_device *pnd, const uint8_t ui8Value)
{ {
uint8_t abtCmd[] = { SetParameters, ui8Value }; uint8_t abtCmd[] = { SetParameters, ui8Value };
@ -1984,7 +1984,7 @@ pn53x_SetParameters (nfc_device * pnd, const uint8_t ui8Value)
} }
bool bool
pn53x_SAMConfiguration (nfc_device * pnd, const pn532_sam_mode ui8Mode, int timeout) pn53x_SAMConfiguration (nfc_device *pnd, const pn532_sam_mode ui8Mode, int timeout)
{ {
uint8_t abtCmd[] = { SAMConfiguration, ui8Mode, 0x00, 0x00 }; uint8_t abtCmd[] = { SAMConfiguration, ui8Mode, 0x00, 0x00 };
size_t szCmd = sizeof(abtCmd); size_t szCmd = sizeof(abtCmd);
@ -2013,7 +2013,7 @@ pn53x_SAMConfiguration (nfc_device * pnd, const pn532_sam_mode ui8Mode, int time
} }
bool bool
pn53x_PowerDown (nfc_device * pnd) pn53x_PowerDown (nfc_device *pnd)
{ {
uint8_t abtCmd[] = { PowerDown, 0xf0 }; uint8_t abtCmd[] = { PowerDown, 0xf0 };
return (pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL, 0)); return (pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL, 0));
@ -2034,10 +2034,10 @@ pn53x_PowerDown (nfc_device * pnd)
* @note To decode theses TargetData[n], there is @fn pn53x_decode_target_data * @note To decode theses TargetData[n], there is @fn pn53x_decode_target_data
*/ */
bool bool
pn53x_InListPassiveTarget (nfc_device * pnd, pn53x_InListPassiveTarget (nfc_device *pnd,
const pn53x_modulation pmInitModulation, const uint8_t szMaxTargets, const pn53x_modulation pmInitModulation, const uint8_t szMaxTargets,
const uint8_t * pbtInitiatorData, const size_t szInitiatorData, const uint8_t *pbtInitiatorData, const size_t szInitiatorData,
uint8_t * pbtTargetsData, size_t * pszTargetsData, uint8_t *pbtTargetsData, size_t *pszTargetsData,
int timeout) int timeout)
{ {
uint8_t abtCmd[15] = { InListPassiveTarget }; uint8_t abtCmd[15] = { InListPassiveTarget };
@ -2087,7 +2087,7 @@ pn53x_InListPassiveTarget (nfc_device * pnd,
} }
bool bool
pn53x_InDeselect (nfc_device * pnd, const uint8_t ui8Target) pn53x_InDeselect (nfc_device *pnd, const uint8_t ui8Target)
{ {
if (CHIP_DATA(pnd)->type == RCS360) { if (CHIP_DATA(pnd)->type == RCS360) {
// We should do act here *only* if a target was previously selected // We should do act here *only* if a target was previously selected
@ -2109,7 +2109,7 @@ pn53x_InDeselect (nfc_device * pnd, const uint8_t ui8Target)
} }
bool bool
pn53x_InRelease (nfc_device * pnd, const uint8_t ui8Target) pn53x_InRelease (nfc_device *pnd, const uint8_t ui8Target)
{ {
if (CHIP_DATA(pnd)->type == RCS360) { if (CHIP_DATA(pnd)->type == RCS360) {
// We should do act here *only* if a target was previously selected // We should do act here *only* if a target was previously selected
@ -2131,9 +2131,9 @@ pn53x_InRelease (nfc_device * pnd, const uint8_t ui8Target)
} }
bool bool
pn53x_InAutoPoll (nfc_device * pnd, pn53x_InAutoPoll (nfc_device *pnd,
const pn53x_target_type * ppttTargetTypes, const size_t szTargetTypes, const pn53x_target_type *ppttTargetTypes, const size_t szTargetTypes,
const uint8_t btPollNr, const uint8_t btPeriod, nfc_target * pntTargets, size_t * pszTargetFound) const uint8_t btPollNr, const uint8_t btPeriod, nfc_target * pntTargets, size_t *pszTargetFound)
{ {
if (CHIP_DATA(pnd)->type != PN532) { if (CHIP_DATA(pnd)->type != PN532) {
// This function is not supported by pn531 neither pn533 // This function is not supported by pn531 neither pn533
@ -2193,13 +2193,13 @@ pn53x_InAutoPoll (nfc_device * pnd,
* @param[out] pnt \a nfc_target which will be filled by this function * @param[out] pnt \a nfc_target which will be filled by this function
*/ */
bool bool
pn53x_InJumpForDEP (nfc_device * pnd, pn53x_InJumpForDEP (nfc_device *pnd,
const nfc_dep_mode ndm, const nfc_dep_mode ndm,
const nfc_baud_rate nbr, const nfc_baud_rate nbr,
const uint8_t * pbtPassiveInitiatorData, const uint8_t *pbtPassiveInitiatorData,
const uint8_t * pbtNFCID3i, const uint8_t *pbtNFCID3i,
const uint8_t * pbtGBi, const size_t szGBi, const uint8_t *pbtGBi, const size_t szGBi,
nfc_target * pnt) nfc_target *pnt)
{ {
// Max frame size = 1 (Command) + 1 (ActPass) + 1 (Baud rate) + 1 (Next) + 5 (PassiveInitiatorData) + 10 (NFCID3) + 48 (General bytes) = 67 bytes // Max frame size = 1 (Command) + 1 (ActPass) + 1 (Baud rate) + 1 (Next) + 5 (PassiveInitiatorData) + 10 (NFCID3) + 48 (General bytes) = 67 bytes
uint8_t abtCmd[67] = { InJumpForDEP, (ndm == NDM_ACTIVE) ? 0x01 : 0x00 }; uint8_t abtCmd[67] = { InJumpForDEP, (ndm == NDM_ACTIVE) ? 0x01 : 0x00 };
@ -2287,12 +2287,12 @@ pn53x_InJumpForDEP (nfc_device * pnd,
} }
bool bool
pn53x_TgInitAsTarget (nfc_device * pnd, pn53x_target_mode ptm, pn53x_TgInitAsTarget (nfc_device *pnd, pn53x_target_mode ptm,
const uint8_t * pbtMifareParams, const uint8_t *pbtMifareParams,
const uint8_t * pbtTkt, size_t szTkt, const uint8_t *pbtTkt, size_t szTkt,
const uint8_t * pbtFeliCaParams, const uint8_t *pbtFeliCaParams,
const uint8_t * pbtNFCID3t, const uint8_t * pbtGBt, const size_t szGBt, const uint8_t *pbtNFCID3t, const uint8_t *pbtGBt, const size_t szGBt,
uint8_t * pbtRx, size_t * pszRx, uint8_t * pbtModeByte) uint8_t *pbtRx, size_t * pszRx, uint8_t *pbtModeByte)
{ {
uint8_t abtCmd[39 + 47 + 48] = { TgInitAsTarget }; // Worst case: 39-byte base, 47 bytes max. for General Bytes, 48 bytes max. for Historical Bytes uint8_t abtCmd[39 + 47 + 48] = { TgInitAsTarget }; // Worst case: 39-byte base, 47 bytes max. for General Bytes, 48 bytes max. for Historical Bytes
size_t szOptionalBytes = 0; size_t szOptionalBytes = 0;
@ -2358,7 +2358,7 @@ pn53x_TgInitAsTarget (nfc_device * pnd, pn53x_target_mode ptm,
} }
bool bool
pn53x_check_ack_frame (nfc_device * pnd, const uint8_t * pbtRxFrame, const size_t szRxFrameLen) pn53x_check_ack_frame (nfc_device *pnd, const uint8_t *pbtRxFrame, const size_t szRxFrameLen)
{ {
if (szRxFrameLen >= sizeof (pn53x_ack_frame)) { if (szRxFrameLen >= sizeof (pn53x_ack_frame)) {
if (0 == memcmp (pbtRxFrame, pn53x_ack_frame, sizeof (pn53x_ack_frame))) { if (0 == memcmp (pbtRxFrame, pn53x_ack_frame, sizeof (pn53x_ack_frame))) {
@ -2372,7 +2372,7 @@ pn53x_check_ack_frame (nfc_device * pnd, const uint8_t * pbtRxFrame, const size_
} }
bool bool
pn53x_check_error_frame (nfc_device * pnd, const uint8_t * pbtRxFrame, const size_t szRxFrameLen) pn53x_check_error_frame (nfc_device *pnd, const uint8_t *pbtRxFrame, const size_t szRxFrameLen)
{ {
if (szRxFrameLen >= sizeof (pn53x_error_frame)) { if (szRxFrameLen >= sizeof (pn53x_error_frame)) {
if (0 == memcmp (pbtRxFrame, pn53x_error_frame, sizeof (pn53x_error_frame))) { if (0 == memcmp (pbtRxFrame, pn53x_error_frame, sizeof (pn53x_error_frame))) {
@ -2391,7 +2391,7 @@ pn53x_check_error_frame (nfc_device * pnd, const uint8_t * pbtRxFrame, const siz
* @note The first byte of pbtData is the Command Code (CC) * @note The first byte of pbtData is the Command Code (CC)
*/ */
bool bool
pn53x_build_frame (uint8_t * pbtFrame, size_t * pszFrame, const uint8_t * pbtData, const size_t szData) pn53x_build_frame (uint8_t *pbtFrame, size_t *pszFrame, const uint8_t *pbtData, const size_t szData)
{ {
if (szData <= PN53x_NORMAL_FRAME__DATA_MAX_LEN) { if (szData <= PN53x_NORMAL_FRAME__DATA_MAX_LEN) {
// LEN - Packet length = data length (len) + checksum (1) + end of stream marker (1) // LEN - Packet length = data length (len) + checksum (1) + end of stream marker (1)
@ -2607,7 +2607,7 @@ pn53x_nm_to_ptt(const nfc_modulation nm)
} }
void void
pn53x_data_new (nfc_device * pnd, const struct pn53x_io* io) pn53x_data_new (nfc_device *pnd, const struct pn53x_io* io)
{ {
pnd->chip_data = malloc(sizeof(struct pn53x_data)); pnd->chip_data = malloc(sizeof(struct pn53x_data));
@ -2633,7 +2633,7 @@ pn53x_data_new (nfc_device * pnd, const struct pn53x_io* io)
} }
void void
pn53x_data_free (nfc_device * pnd) pn53x_data_free (nfc_device *pnd)
{ {
if (CHIP_DATA (pnd)->current_target) { if (CHIP_DATA (pnd)->current_target) {
free (CHIP_DATA (pnd)->current_target); free (CHIP_DATA (pnd)->current_target);

View file

@ -78,7 +78,7 @@ const struct nfc_driver_t *nfc_drivers[] = {
bool bool
nfc_get_default_device (nfc_connstring *connstring) nfc_get_default_device (nfc_connstring *connstring)
{ {
char * env_default_connstring = getenv ("LIBNFC_DEFAULT_DEVICE"); char *env_default_connstring = getenv ("LIBNFC_DEFAULT_DEVICE");
if (NULL == env_default_connstring) { if (NULL == env_default_connstring) {
// LIBNFC_DEFAULT_DEVICE is not set, we fallback on probing for the first available device // LIBNFC_DEFAULT_DEVICE is not set, we fallback on probing for the first available device
size_t szDeviceFound; size_t szDeviceFound;
@ -163,7 +163,7 @@ nfc_connect (const nfc_connstring connstring)
* Initiator's selected tag is disconnected and the device, including allocated \a nfc_device struct, is released. * Initiator's selected tag is disconnected and the device, including allocated \a nfc_device struct, is released.
*/ */
void void
nfc_disconnect (nfc_device * pnd) nfc_disconnect (nfc_device *pnd)
{ {
if (pnd) { if (pnd) {
// Go in idle mode // Go in idle mode
@ -182,7 +182,7 @@ nfc_disconnect (nfc_device * pnd)
* @param[out] pszDeviceFound number of devices found. * @param[out] pszDeviceFound number of devices found.
*/ */
void void
nfc_list_devices (nfc_connstring connstrings[] , size_t szDevices, size_t * pszDeviceFound) nfc_list_devices (nfc_connstring connstrings[] , size_t szDevices, size_t *pszDeviceFound)
{ {
size_t szN; size_t szN;
*pszDeviceFound = 0; *pszDeviceFound = 0;
@ -216,7 +216,7 @@ nfc_list_devices (nfc_connstring connstrings[] , size_t szDevices, size_t * pszD
* accept). * accept).
*/ */
bool bool
nfc_configure (nfc_device * pnd, const nfc_device_option ndo, const bool bEnable) nfc_configure (nfc_device *pnd, const nfc_device_option ndo, const bool bEnable)
{ {
HAL (configure, pnd, ndo, bEnable); HAL (configure, pnd, ndo, bEnable);
} }
@ -242,7 +242,7 @@ nfc_configure (nfc_device * pnd, const nfc_device_option ndo, const bool bEnable
* - RF field is shortly dropped (if it was enabled) then activated again * - RF field is shortly dropped (if it was enabled) then activated again
*/ */
bool bool
nfc_initiator_init (nfc_device * pnd) nfc_initiator_init (nfc_device *pnd)
{ {
// Drop the field for a while // Drop the field for a while
if (!nfc_configure (pnd, NDO_ACTIVATE_FIELD, false)) if (!nfc_configure (pnd, NDO_ACTIVATE_FIELD, false))
@ -304,10 +304,10 @@ nfc_initiator_init (nfc_device * pnd)
* the initial modulation and speed (106, 212 or 424 kbps) should be supplied. * the initial modulation and speed (106, 212 or 424 kbps) should be supplied.
*/ */
bool bool
nfc_initiator_select_passive_target (nfc_device * pnd, nfc_initiator_select_passive_target (nfc_device *pnd,
const nfc_modulation nm, const nfc_modulation nm,
const uint8_t * pbtInitData, const size_t szInitData, const uint8_t *pbtInitData, const size_t szInitData,
nfc_target * pnt) nfc_target *pnt)
{ {
uint8_t abtInit[MAX(12, szInitData)]; uint8_t abtInit[MAX(12, szInitData)];
size_t szInit; size_t szInit;
@ -344,9 +344,9 @@ nfc_initiator_select_passive_target (nfc_device * pnd,
* should be supplied. * should be supplied.
*/ */
bool bool
nfc_initiator_list_passive_targets (nfc_device * pnd, nfc_initiator_list_passive_targets (nfc_device *pnd,
const nfc_modulation nm, const nfc_modulation nm,
nfc_target ant[], const size_t szTargets, size_t * pszTargetFound) nfc_target ant[], const size_t szTargets, size_t *pszTargetFound)
{ {
nfc_target nt; nfc_target nt;
size_t szTargetFound = 0; size_t szTargetFound = 0;
@ -405,10 +405,10 @@ nfc_initiator_list_passive_targets (nfc_device * pnd,
* @param[out] pnt pointer on \a nfc_target (over)writable struct * @param[out] pnt pointer on \a nfc_target (over)writable struct
*/ */
bool bool
nfc_initiator_poll_target (nfc_device * pnd, nfc_initiator_poll_target (nfc_device *pnd,
const nfc_modulation * pnmModulations, const size_t szModulations, const nfc_modulation *pnmModulations, const size_t szModulations,
const uint8_t uiPollNr, const uint8_t uiPeriod, const uint8_t uiPollNr, const uint8_t uiPeriod,
nfc_target * pnt) nfc_target *pnt)
{ {
HAL (initiator_poll_target, pnd, pnmModulations, szModulations, uiPollNr, uiPeriod, pnt); HAL (initiator_poll_target, pnd, pnmModulations, szModulations, uiPollNr, uiPeriod, pnt);
} }
@ -430,9 +430,9 @@ nfc_initiator_poll_target (nfc_device * pnd,
* @note \a nfc_dep_info will be returned when the target was acquired successfully. * @note \a nfc_dep_info will be returned when the target was acquired successfully.
*/ */
bool bool
nfc_initiator_select_dep_target (nfc_device * pnd, nfc_initiator_select_dep_target (nfc_device *pnd,
const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_mode ndm, const nfc_baud_rate nbr,
const nfc_dep_info * pndiInitiator, nfc_target * pnt) const nfc_dep_info *pndiInitiator, nfc_target *pnt)
{ {
HAL (initiator_select_dep_target, pnd, ndm, nbr, pndiInitiator, pnt); HAL (initiator_select_dep_target, pnd, ndm, nbr, pndiInitiator, pnt);
} }
@ -450,7 +450,7 @@ nfc_initiator_select_dep_target (nfc_device * pnd,
* the next tag until the correct tag is found. * the next tag until the correct tag is found.
*/ */
bool bool
nfc_initiator_deselect_target (nfc_device * pnd) nfc_initiator_deselect_target (nfc_device *pnd)
{ {
HAL (initiator_deselect_target, pnd); HAL (initiator_deselect_target, pnd);
} }
@ -479,8 +479,8 @@ nfc_initiator_deselect_target (nfc_device * pnd)
* @warning The configuration option \a NDO_HANDLE_PARITY must be set to \c true (the default value). * @warning The configuration option \a NDO_HANDLE_PARITY must be set to \c true (the default value).
*/ */
bool bool
nfc_initiator_transceive_bytes (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, nfc_initiator_transceive_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx,
size_t * pszRx, int timeout) size_t *pszRx, int timeout)
{ {
HAL (initiator_transceive_bytes, pnd, pbtTx, szTx, pbtRx, pszRx, timeout) HAL (initiator_transceive_bytes, pnd, pbtTx, szTx, pbtRx, pszRx, timeout)
} }
@ -521,8 +521,8 @@ nfc_initiator_transceive_bytes (nfc_device * pnd, const uint8_t * pbtTx, const s
* CRC bytes. Using this feature you are able to simulate these frames. * CRC bytes. Using this feature you are able to simulate these frames.
*/ */
bool bool
nfc_initiator_transceive_bits (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar, nfc_initiator_transceive_bits (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar,
uint8_t * pbtRx, size_t * pszRxBits, uint8_t * pbtRxPar) uint8_t *pbtRx, size_t *pszRxBits, uint8_t *pbtRxPar)
{ {
HAL (initiator_transceive_bits, pnd, pbtTx, szTxBits, pbtTxPar, pbtRx, pszRxBits, pbtRxPar); HAL (initiator_transceive_bits, pnd, pbtTx, szTxBits, pbtTxPar, pbtRx, pszRxBits, pbtRxPar);
} }
@ -548,8 +548,8 @@ nfc_initiator_transceive_bits (nfc_device * pnd, const uint8_t * pbtTx, const si
* @warning The configuration option \a NDO_HANDLE_PARITY must be set to \c true (the default value). * @warning The configuration option \a NDO_HANDLE_PARITY must be set to \c true (the default value).
*/ */
bool bool
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,
size_t * pszRx, 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, pszRx, cycles)
} }
@ -576,8 +576,8 @@ nfc_initiator_transceive_bytes_timed (nfc_device * pnd, const uint8_t * pbtTx, c
* @warning The configuration option \a NDO_HANDLE_PARITY must be set to \c true (the default value). * @warning The configuration option \a NDO_HANDLE_PARITY must be set to \c true (the default value).
*/ */
bool bool
nfc_initiator_transceive_bits_timed (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar, 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, size_t *pszRxBits, 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, pszRxBits, pbtRxPar, cycles);
} }
@ -613,7 +613,7 @@ nfc_initiator_transceive_bits_timed (nfc_device * pnd, const uint8_t * pbtTx, co
* receive functions can be used. * receive functions can be used.
*/ */
bool bool
nfc_target_init (nfc_device * pnd, nfc_target * pnt, uint8_t * pbtRx, size_t * pszRx) nfc_target_init (nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, size_t * pszRx)
{ {
// Disallow invalid frame // Disallow invalid frame
if (!nfc_configure (pnd, NDO_ACCEPT_INVALID_FRAMES, false)) if (!nfc_configure (pnd, NDO_ACCEPT_INVALID_FRAMES, false))
@ -653,7 +653,7 @@ nfc_target_init (nfc_device * pnd, nfc_target * pnt, uint8_t * pbtRx, size_t * p
* In target mode, the emulation is stoped (no target available from external initiator) and the device is set to low power mode (if avaible). * In target mode, the emulation is stoped (no target available from external initiator) and the device is set to low power mode (if avaible).
*/ */
bool bool
nfc_idle (nfc_device * pnd) nfc_idle (nfc_device *pnd)
{ {
HAL (idle, pnd); HAL (idle, pnd);
} }
@ -670,7 +670,7 @@ nfc_idle (nfc_device * pnd)
* @note The blocking function (ie. nfc_target_init()) will failed with DEABORT error. * @note The blocking function (ie. nfc_target_init()) will failed with DEABORT error.
*/ */
bool bool
nfc_abort_command (nfc_device * pnd) nfc_abort_command (nfc_device *pnd)
{ {
HAL (abort_command, pnd); HAL (abort_command, pnd);
} }
@ -691,7 +691,7 @@ nfc_abort_command (nfc_device * pnd)
* If timeout is a null pointer, the function blocks indefinitely (until an error is raised or function is completed). * If timeout is a null pointer, the function blocks indefinitely (until an error is raised or function is completed).
*/ */
bool bool
nfc_target_send_bytes (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, int timeout) nfc_target_send_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, int timeout)
{ {
HAL (target_send_bytes, pnd, pbtTx, szTx, timeout); HAL (target_send_bytes, pnd, pbtTx, szTx, timeout);
} }
@ -711,7 +711,7 @@ nfc_target_send_bytes (nfc_device * pnd, const uint8_t * pbtTx, const size_t szT
* If timeout is a null pointer, the function blocks indefinitely (until an error is raised or function is completed). * If timeout is a null pointer, the function blocks indefinitely (until an error is raised or function is completed).
*/ */
bool bool
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, size_t *pszRx, int timeout)
{ {
HAL (target_receive_bytes, pnd, pbtRx, pszRx, timeout); HAL (target_receive_bytes, pnd, pbtRx, pszRx, timeout);
} }
@ -724,7 +724,7 @@ nfc_target_receive_bytes (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRx, int
* using the specified NFC device (configured as \e target). * using the specified NFC device (configured as \e target).
*/ */
bool bool
nfc_target_send_bits (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar) nfc_target_send_bits (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar)
{ {
HAL (target_send_bits, pnd, pbtTx, szTxBits, pbtTxPar); HAL (target_send_bits, pnd, pbtTx, szTxBits, pbtTxPar);
} }
@ -741,7 +741,7 @@ nfc_target_send_bits (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx
* frames. * frames.
*/ */
bool bool
nfc_target_receive_bits (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRxBits, uint8_t * pbtRxPar) nfc_target_receive_bits (nfc_device *pnd, uint8_t *pbtRx, size_t *pszRxBits, uint8_t *pbtRxPar)
{ {
HAL (target_receive_bits, pnd, pbtRx, pszRxBits, pbtRxPar); HAL (target_receive_bits, pnd, pbtRx, pszRxBits, pbtRxPar);
} }
@ -751,7 +751,7 @@ nfc_target_receive_bits (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRxBits,
* @return Returns a string * @return Returns a string
*/ */
const char * const char *
nfc_strerror (const nfc_device * pnd) nfc_strerror (const nfc_device *pnd)
{ {
return pnd->driver->strerror (pnd); return pnd->driver->strerror (pnd);
} }
@ -761,7 +761,7 @@ nfc_strerror (const nfc_device * pnd)
* @return Returns 0 upon success * @return Returns 0 upon success
*/ */
int int
nfc_strerror_r (const nfc_device * pnd, char *pcStrErrBuf, size_t szBufLen) nfc_strerror_r (const nfc_device *pnd, char *pcStrErrBuf, size_t szBufLen)
{ {
return (snprintf (pcStrErrBuf, szBufLen, "%s", nfc_strerror (pnd)) < 0) ? -1 : 0; return (snprintf (pcStrErrBuf, szBufLen, "%s", nfc_strerror (pnd)) < 0) ? -1 : 0;
} }
@ -770,7 +770,7 @@ nfc_strerror_r (const nfc_device * pnd, char *pcStrErrBuf, size_t szBufLen)
* @brief Display the PCD error a-la perror * @brief Display the PCD error a-la perror
*/ */
void void
nfc_perror (const nfc_device * pnd, const char *pcString) nfc_perror (const nfc_device *pnd, const char *pcString)
{ {
fprintf (stderr, "%s: %s\n", pcString, nfc_strerror (pnd)); fprintf (stderr, "%s: %s\n", pcString, nfc_strerror (pnd));
} }
@ -782,7 +782,7 @@ nfc_perror (const nfc_device * pnd, const char *pcString)
* @return Returns a string with the device name * @return Returns a string with the device name
*/ */
const char * const char *
nfc_device_name (nfc_device * pnd) nfc_device_name (nfc_device *pnd)
{ {
return pnd->acName; return pnd->acName;
} }