diff --git a/examples/nfc-anticol.c b/examples/nfc-anticol.c index 7077949..710dd6a 100644 --- a/examples/nfc-anticol.c +++ b/examples/nfc-anticol.c @@ -75,7 +75,7 @@ uint8_t abtHalt[4] = { 0x50, 0x00, 0x00, 0x00 }; #define CASCADE_BIT 0x04 static bool -transmit_bits (const uint8_t * pbtTx, const size_t szTxBits) +transmit_bits (const uint8_t *pbtTx, const size_t szTxBits) { // Show transmitted command if (!quiet_output) { @@ -97,7 +97,7 @@ transmit_bits (const uint8_t * pbtTx, const size_t szTxBits) static bool -transmit_bytes (const uint8_t * pbtTx, const size_t szTx) +transmit_bytes (const uint8_t *pbtTx, const size_t szTx) { // Show transmitted command if (!quiet_output) { diff --git a/examples/nfc-emulate-tag.c b/examples/nfc-emulate-tag.c index e07f645..62dcd32 100644 --- a/examples/nfc-emulate-tag.c +++ b/examples/nfc-emulate-tag.c @@ -71,7 +71,7 @@ intr_hdlr (void) } bool -target_io( nfc_target * pnt, const uint8_t * pbtInput, const size_t szInput, uint8_t * pbtOutput, size_t *pszOutput ) +target_io( nfc_target *pnt, const uint8_t *pbtInput, const size_t szInput, uint8_t *pbtOutput, size_t *pszOutput ) { bool loop = true; *pszOutput = 0; @@ -134,7 +134,7 @@ target_io( nfc_target * pnt, const uint8_t * pbtInput, const size_t szInput, uin } bool -nfc_target_emulate_tag(nfc_device* pnd, nfc_target * pnt) +nfc_target_emulate_tag(nfc_device *pnd, nfc_target *pnt) { size_t szTx; uint8_t abtTx[MAX_FRAME_LEN]; diff --git a/examples/pn53x-tamashell.c b/examples/pn53x-tamashell.c index b92bc6e..8fe5c61 100644 --- a/examples/pn53x-tamashell.c +++ b/examples/pn53x-tamashell.c @@ -71,7 +71,7 @@ int main(int argc, const char* argv[]) { - nfc_device* pnd; + nfc_device *pnd; uint8_t abtRx[MAX_FRAME_LEN]; uint8_t abtTx[MAX_FRAME_LEN]; size_t szRx = sizeof(abtRx); @@ -97,8 +97,8 @@ int main(int argc, const char* argv[]) printf ("Connected to NFC reader: %s\n", pnd->acName); nfc_initiator_init(pnd); - char * cmd; - char * prompt="> "; + char *cmd; + char *prompt = "> "; while(1) { int offset=0; #if defined(HAVE_READLINE) @@ -113,7 +113,7 @@ int main(int argc, const char* argv[]) } else { #endif //HAVE_READLINE size_t n = 255; - char * ret = NULL; + char *ret = NULL; cmd = malloc(n); printf("%s", prompt); fflush(0); diff --git a/include/nfc/nfc-types.h b/include/nfc/nfc-types.h index 3ada1b0..28f4a21 100644 --- a/include/nfc/nfc-types.h +++ b/include/nfc/nfc-types.h @@ -42,8 +42,8 @@ typedef struct { /** Driver's functions for handling device specific wrapping */ const struct nfc_driver_t *driver; - void* driver_data; - void* chip_data; + void *driver_data; + void *chip_data; /** Device name string, including device wrapper firmware */ char acName[DEVICE_NAME_LENGTH]; diff --git a/libnfc/buses/uart.h b/libnfc/buses/uart.h index 77b5658..728d998 100644 --- a/libnfc/buses/uart.h +++ b/libnfc/buses/uart.h @@ -49,8 +49,8 @@ void uart_flush_input (const serial_port sp); void uart_set_speed (serial_port sp, const uint32_t uiPortSpeed); uint32_t uart_get_speed (const serial_port sp); -int uart_receive (serial_port sp, uint8_t * pbtRx, const size_t szRx, void * abort_p, int timeout); -int uart_send (serial_port sp, const uint8_t * pbtTx, const size_t szTx, int timeout); +int uart_receive (serial_port sp, uint8_t *pbtRx, const size_t szRx, void *abort_p, int timeout); +int uart_send (serial_port sp, const uint8_t *pbtTx, const size_t szTx, int timeout); char **uart_list_ports (void); diff --git a/libnfc/buses/uart_posix.c b/libnfc/buses/uart_posix.c index 8017384..f427cbe 100644 --- a/libnfc/buses/uart_posix.c +++ b/libnfc/buses/uart_posix.c @@ -249,7 +249,7 @@ uart_close (const serial_port sp) * @return 0 on success, otherwise driver error code */ int -uart_receive (serial_port sp, uint8_t * pbtRx, const size_t szRx, void * abort_p, int timeout) +uart_receive (serial_port sp, uint8_t *pbtRx, const size_t szRx, void *abort_p, int timeout) { int iAbortFd = abort_p ? *((int*)abort_p) : 0; int received_bytes_count = 0; @@ -323,7 +323,7 @@ select: * @return 0 on success, otherwise a driver error is returned */ int -uart_send (serial_port sp, const uint8_t * pbtTx, const size_t szTx, int timeout) +uart_send (serial_port sp, const uint8_t *pbtTx, const size_t szTx, int timeout) { (void) timeout; LOG_HEX ("TX", pbtTx, szTx); diff --git a/libnfc/buses/uart_win32.c b/libnfc/buses/uart_win32.c index 3e9c951..8ae25ef 100644 --- a/libnfc/buses/uart_win32.c +++ b/libnfc/buses/uart_win32.c @@ -238,7 +238,7 @@ BOOL is_port_available(int nPort) char ** uart_list_ports (void) { - char ** availablePorts = malloc((1 + MAX_SERIAL_PORT_WIN) * sizeof(char*)); + char **availablePorts = malloc((1 + MAX_SERIAL_PORT_WIN) * sizeof(char*)); int curIndex = 0; int i; for (i = 1; i <= MAX_SERIAL_PORT_WIN; i++) { diff --git a/libnfc/chips/pn53x-internal.h b/libnfc/chips/pn53x-internal.h index b133d38..ceb8a80 100644 --- a/libnfc/chips/pn53x-internal.h +++ b/libnfc/chips/pn53x-internal.h @@ -115,7 +115,7 @@ typedef struct { uint8_t ui8Code; uint8_t ui8CompatFlags; #ifdef LOGGING - const char * abtCommandText; + const char *abtCommandText; #endif } pn53x_command; @@ -203,8 +203,8 @@ static const pn53x_command pn53x_commands[] = { #ifdef LOGGING typedef struct { uint16_t ui16Address; - const char * abtRegisterText; - const char * abtRegisterDescription; + const char *abtRegisterText; + const char *abtRegisterDescription; } pn53x_register; # define PNREG( X, Y ) { X , #X, Y } diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 95b337c..46b873c 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1447,7 +1447,7 @@ pn53x_initiator_transceive_bytes_timed (nfc_device *pnd, const uint8_t *pbtTx, c // Recv corrected timer value if (pnd->bCrc) { // We've to compute CRC ourselves to know last byte actually sent - uint8_t * pbtTxRaw; + uint8_t *pbtTxRaw; pbtTxRaw = (uint8_t *) malloc(szTx+2); memcpy (pbtTxRaw, pbtTx, szTx); iso14443a_crc_append (pbtTxRaw, szTx); @@ -1519,15 +1519,15 @@ pn53x_target_init (nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, size_t *psz return false; uint8_t abtMifareParams[6]; - uint8_t * pbtMifareParams = NULL; - uint8_t * pbtTkt = NULL; + uint8_t *pbtMifareParams = NULL; + uint8_t *pbtTkt = NULL; size_t szTkt = 0; uint8_t abtFeliCaParams[18]; - uint8_t * pbtFeliCaParams = NULL; + uint8_t *pbtFeliCaParams = NULL; - const uint8_t * pbtNFCID3t = NULL; - const uint8_t * pbtGBt = NULL; + const uint8_t *pbtNFCID3t = NULL; + const uint8_t *pbtGBt = NULL; size_t szGBt = 0; switch(pnt->nm.nmt) { @@ -2292,7 +2292,7 @@ pn53x_TgInitAsTarget (nfc_device *pnd, pn53x_target_mode ptm, const uint8_t *pbtTkt, size_t szTkt, const uint8_t *pbtFeliCaParams, 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 size_t szOptionalBytes = 0; @@ -2607,7 +2607,7 @@ pn53x_nm_to_ptt(const nfc_modulation nm) } 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)); diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index 5e57c3c..431dd42 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -127,8 +127,8 @@ typedef enum { } pn53x_operating_mode; struct pn53x_io { - bool (*send)(nfc_device * pnd, const uint8_t * pbtData, const size_t szData, int timeout); - int (*receive)(nfc_device * pnd, uint8_t * pbtData, const size_t szDataLen, int timeout); + bool (*send)(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout); + int (*receive)(nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, int timeout); }; /* defines */ @@ -143,9 +143,9 @@ struct pn53x_data { /** Current operating mode */ pn53x_operating_mode operating_mode; /** Current emulated target */ - nfc_target* current_target; + nfc_target *current_target; /** PN53x I/O functions stored in struct */ - const struct pn53x_io * io; + const struct pn53x_io *io; /** Register cache for REG_CIU_BIT_FRAMING, SYMBOL_TX_LAST_BITS: The last TX bits setting, we need to reset this if it does not apply anymore */ uint8_t ui8TxBits; /** Register cache for SetParameters function. */ @@ -255,99 +255,99 @@ typedef enum { extern const uint8_t pn53x_ack_frame[6]; extern const uint8_t pn53x_nack_frame[6]; -bool pn53x_init(nfc_device * pnd); -bool pn53x_transceive (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, size_t *pszRx, int timeout); +bool pn53x_init(nfc_device *pnd); +bool pn53x_transceive (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, size_t *pszRx, int timeout); -bool pn53x_set_parameters (nfc_device * pnd, const uint8_t ui8Value, const bool bEnable); -bool pn53x_set_tx_bits (nfc_device * pnd, const uint8_t ui8Bits); -bool pn53x_wrap_frame (const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar, uint8_t * pbtFrame, - size_t * pszFrameBits); -bool pn53x_unwrap_frame (const uint8_t * pbtFrame, const size_t szFrameBits, uint8_t * pbtRx, size_t * pszRxBits, - uint8_t * pbtRxPar); -bool pn53x_decode_target_data (const uint8_t * pbtRawData, size_t szRawData, +bool pn53x_set_parameters (nfc_device *pnd, const uint8_t ui8Value, const bool bEnable); +bool pn53x_set_tx_bits (nfc_device *pnd, const uint8_t ui8Bits); +bool pn53x_wrap_frame (const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtFrame, + size_t *pszFrameBits); +bool pn53x_unwrap_frame (const uint8_t *pbtFrame, const size_t szFrameBits, uint8_t *pbtRx, size_t *pszRxBits, + uint8_t *pbtRxPar); +bool pn53x_decode_target_data (const uint8_t *pbtRawData, size_t szRawData, pn53x_type chip_type, nfc_modulationype nmt, - nfc_target_info * pnti); -bool pn53x_read_register (nfc_device * pnd, uint16_t ui16Reg, uint8_t * ui8Value); -bool pn53x_write_register (nfc_device * pnd, uint16_t ui16Reg, uint8_t ui8SymbolMask, uint8_t ui8Value); -bool pn53x_get_firmware_version (nfc_device * pnd, char abtFirmwareText[22]); -bool pn53x_configure (nfc_device * pnd, const nfc_device_option ndo, const bool bEnable); + nfc_target_info *pnti); +bool pn53x_read_register (nfc_device *pnd, uint16_t ui16Reg, uint8_t *ui8Value); +bool pn53x_write_register (nfc_device *pnd, uint16_t ui16Reg, uint8_t ui8SymbolMask, uint8_t ui8Value); +bool pn53x_get_firmware_version (nfc_device *pnd, char abtFirmwareText[22]); +bool pn53x_configure (nfc_device *pnd, const nfc_device_option ndo, const bool bEnable); bool pn53x_check_communication (nfc_device *pnd); -bool pn53x_idle (nfc_device * pnd); +bool pn53x_idle (nfc_device *pnd); // NFC device as Initiator functions -bool pn53x_initiator_init (nfc_device * pnd); -bool pn53x_initiator_select_passive_target (nfc_device * pnd, +bool pn53x_initiator_init (nfc_device *pnd); +bool pn53x_initiator_select_passive_target (nfc_device *pnd, const nfc_modulation nm, - const uint8_t * pbtInitData, const size_t szInitData, - nfc_target * pnt); -bool pn53x_initiator_poll_target (nfc_device * pnd, - const nfc_modulation * pnmModulations, const size_t szModulations, + const uint8_t *pbtInitData, const size_t szInitData, + nfc_target *pnt); +bool pn53x_initiator_poll_target (nfc_device *pnd, + const nfc_modulation *pnmModulations, const size_t szModulations, const uint8_t uiPollNr, const uint8_t uiPeriod, - nfc_target * pnt); -bool pn53x_initiator_select_dep_target (nfc_device * pnd, + nfc_target *pnt); +bool pn53x_initiator_select_dep_target (nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, - const nfc_dep_info * pndiInitiator, - nfc_target * pnt); -bool 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); -bool pn53x_initiator_transceive_bytes (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, - uint8_t * pbtRx, size_t * pszRx, int timeout); -bool 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); -bool 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); -bool pn53x_initiator_deselect_target (nfc_device * pnd); + const nfc_dep_info *pndiInitiator, + nfc_target *pnt); +bool 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); +bool pn53x_initiator_transceive_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, + uint8_t *pbtRx, size_t *pszRx, int timeout); +bool 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); +bool 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); +bool pn53x_initiator_deselect_target (nfc_device *pnd); // NFC device as Target functions -bool pn53x_target_init (nfc_device * pnd, nfc_target * pnt, uint8_t * pbtRx, size_t * pszRx); -bool pn53x_target_receive_bits (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRxBits, uint8_t * pbtRxPar); -bool pn53x_target_receive_bytes (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRx, int timeout); -bool pn53x_target_send_bits (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar); -bool pn53x_target_send_bytes (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, int timeout); +bool pn53x_target_init (nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, size_t *pszRx); +bool pn53x_target_receive_bits (nfc_device *pnd, uint8_t *pbtRx, size_t *pszRxBits, uint8_t *pbtRxPar); +bool pn53x_target_receive_bytes (nfc_device *pnd, uint8_t *pbtRx, size_t *pszRx, int timeout); +bool pn53x_target_send_bits (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar); +bool pn53x_target_send_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, int timeout); // Error handling functions -const char *pn53x_strerror (const nfc_device * pnd); +const char *pn53x_strerror (const nfc_device *pnd); // C wrappers for PN53x commands -bool pn53x_SetParameters (nfc_device * pnd, const uint8_t ui8Value); -bool pn53x_SAMConfiguration (nfc_device * pnd, const pn532_sam_mode mode, int timeout); -bool pn53x_PowerDown (nfc_device * pnd); -bool pn53x_InListPassiveTarget (nfc_device * pnd, const pn53x_modulation pmInitModulation, - const uint8_t szMaxTargets, const uint8_t * pbtInitiatorData, - const size_t szInitiatorDataLen, uint8_t * pbtTargetsData, size_t * pszTargetsData, +bool pn53x_SetParameters (nfc_device *pnd, const uint8_t ui8Value); +bool pn53x_SAMConfiguration (nfc_device *pnd, const pn532_sam_mode mode, int timeout); +bool pn53x_PowerDown (nfc_device *pnd); +bool pn53x_InListPassiveTarget (nfc_device *pnd, const pn53x_modulation pmInitModulation, + const uint8_t szMaxTargets, const uint8_t *pbtInitiatorData, + const size_t szInitiatorDataLen, uint8_t *pbtTargetsData, size_t *pszTargetsData, int timeout); -bool pn53x_InDeselect (nfc_device * pnd, const uint8_t ui8Target); -bool pn53x_InRelease (nfc_device * pnd, const uint8_t ui8Target); -bool pn53x_InAutoPoll (nfc_device * pnd, const pn53x_target_type * ppttTargetTypes, const size_t szTargetTypes, - const uint8_t btPollNr, const uint8_t btPeriod, nfc_target * pntTargets, - size_t * pszTargetFound); -bool pn53x_InJumpForDEP (nfc_device * pnd, +bool pn53x_InDeselect (nfc_device *pnd, const uint8_t ui8Target); +bool pn53x_InRelease (nfc_device *pnd, const uint8_t ui8Target); +bool pn53x_InAutoPoll (nfc_device *pnd, const pn53x_target_type *ppttTargetTypes, const size_t szTargetTypes, + const uint8_t btPollNr, const uint8_t btPeriod, nfc_target *pntTargets, + size_t *pszTargetFound); +bool pn53x_InJumpForDEP (nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, - const uint8_t * pbtPassiveInitiatorData, - const uint8_t * pbtNFCID3i, - const uint8_t * pbtGB, const size_t szGB, - nfc_target * pnt); -bool pn53x_TgInitAsTarget (nfc_device * pnd, pn53x_target_mode ptm, - const uint8_t * pbtMifareParams, - const uint8_t * pbtTkt, size_t szTkt, - const uint8_t * pbtFeliCaParams, - const uint8_t * pbtNFCID3t, const uint8_t * pbtGB, const size_t szGB, - uint8_t * pbtRx, size_t * pszRx, uint8_t * pbtModeByte); + const uint8_t *pbtPassiveInitiatorData, + const uint8_t *pbtNFCID3i, + const uint8_t *pbtGB, const size_t szGB, + nfc_target *pnt); +bool pn53x_TgInitAsTarget (nfc_device *pnd, pn53x_target_mode ptm, + const uint8_t *pbtMifareParams, + const uint8_t *pbtTkt, size_t szTkt, + const uint8_t *pbtFeliCaParams, + const uint8_t *pbtNFCID3t, const uint8_t *pbtGB, const size_t szGB, + uint8_t *pbtRx, size_t *pszRx, uint8_t *pbtModeByte); // RFConfiguration -bool pn53x_RFConfiguration__RF_field (nfc_device * pnd, bool bEnable); -bool pn53x_RFConfiguration__Various_timings (nfc_device * pnd, const uint8_t fATR_RES_Timeout, const uint8_t fRetryTimeout); -bool pn53x_RFConfiguration__MaxRtyCOM (nfc_device * pnd, const uint8_t MaxRtyCOM); -bool pn53x_RFConfiguration__MaxRetries (nfc_device * pnd, const uint8_t MxRtyATR, const uint8_t MxRtyPSL, const uint8_t MxRtyPassiveActivation); +bool pn53x_RFConfiguration__RF_field (nfc_device *pnd, bool bEnable); +bool pn53x_RFConfiguration__Various_timings (nfc_device *pnd, const uint8_t fATR_RES_Timeout, const uint8_t fRetryTimeout); +bool pn53x_RFConfiguration__MaxRtyCOM (nfc_device *pnd, const uint8_t MaxRtyCOM); +bool pn53x_RFConfiguration__MaxRetries (nfc_device *pnd, const uint8_t MxRtyATR, const uint8_t MxRtyPSL, const uint8_t MxRtyPassiveActivation); // Misc -bool pn53x_check_ack_frame (nfc_device * pnd, const uint8_t * pbtRxFrame, const size_t szRxFrameLen); -bool pn53x_check_error_frame (nfc_device * pnd, const uint8_t * pbtRxFrame, const size_t szRxFrameLen); -bool pn53x_build_frame (uint8_t * pbtFrame, size_t * pszFrame, const uint8_t * pbtData, const size_t szData); +bool pn53x_check_ack_frame (nfc_device *pnd, const uint8_t *pbtRxFrame, const size_t szRxFrameLen); +bool pn53x_check_error_frame (nfc_device *pnd, const uint8_t *pbtRxFrame, const size_t szRxFrameLen); +bool pn53x_build_frame (uint8_t *pbtFrame, size_t *pszFrame, const uint8_t *pbtData, const size_t szData); -void pn53x_data_new (nfc_device * pnd, const struct pn53x_io* io); -void pn53x_data_free (nfc_device * pnd); +void pn53x_data_new (nfc_device *pnd, const struct pn53x_io *io); +void pn53x_data_free (nfc_device *pnd); #endif // __NFC_CHIPS_PN53X_H__ diff --git a/libnfc/drivers/acr122.c b/libnfc/drivers/acr122.c index 23234fd..dd7e2a6 100644 --- a/libnfc/drivers/acr122.c +++ b/libnfc/drivers/acr122.c @@ -133,7 +133,7 @@ acr122_free_scardcontext (void) * @return true if succeeded, false otherwise. */ bool -acr122_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t * pszDeviceFound) +acr122_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound) { size_t szPos = 0; char acDeviceNames[256 + 64 * PCSC_MAX_DEVICES]; @@ -300,7 +300,7 @@ error: } void -acr122_disconnect (nfc_device * pnd) +acr122_disconnect (nfc_device *pnd) { SCardDisconnect (DRIVER_DATA (pnd)->hCard, SCARD_LEAVE_CARD); acr122_free_scardcontext (); @@ -310,7 +310,7 @@ acr122_disconnect (nfc_device * pnd) } bool -acr122_send (nfc_device * pnd, const uint8_t * pbtData, const size_t szData, int timeout) +acr122_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout) { // FIXME: timeout is not handled (void) timeout; @@ -381,7 +381,7 @@ acr122_send (nfc_device * pnd, const uint8_t * pbtData, const size_t szData, int } int -acr122_receive (nfc_device * pnd, uint8_t * pbtData, const size_t szData, int timeout) +acr122_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout) { // FIXME: timeout is not handled (void) timeout; diff --git a/libnfc/drivers/acr122.h b/libnfc/drivers/acr122.h index 00c46fc..b364258 100644 --- a/libnfc/drivers/acr122.h +++ b/libnfc/drivers/acr122.h @@ -26,13 +26,13 @@ # include -bool acr122_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t * pszDeviceFound); +bool acr122_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound); // Functions used by developer to handle connection to this device nfc_device *acr122_connect (const nfc_connstring connstring); -bool acr122_send (nfc_device * pnd, const uint8_t * pbtData, const size_t szData, int timeout); -int acr122_receive (nfc_device * pnd, uint8_t * pbtData, const size_t szData, int timeout); -void acr122_disconnect (nfc_device * pnd); +bool acr122_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout); +int acr122_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout); +void acr122_disconnect (nfc_device *pnd); extern const struct nfc_driver_t acr122_driver; diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index f27a245..ecd36b6 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -88,11 +88,11 @@ static const uint8_t arygon_error_none[] = "FF000000\x0d\x0a"; static const uint8_t arygon_error_incomplete_command[] = "FF0C0000\x0d\x0a"; static const uint8_t arygon_error_unknown_mode[] = "FF060000\x0d\x0a"; -bool arygon_reset_tama (nfc_device * pnd); -void arygon_firmware (nfc_device * pnd, char * str); +bool arygon_reset_tama (nfc_device *pnd); +void arygon_firmware (nfc_device *pnd, char *str); bool -arygon_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t * pszDeviceFound) +arygon_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound) { /** @note: Due to UART bus we can't know if its really an ARYGON without * sending some commands. But using this way to probe devices, we can @@ -197,7 +197,7 @@ arygon_connstring_decode (const nfc_connstring connstring, struct arygon_descrip strncpy (desc->port, port, sizeof(desc->port)-1); desc->port[sizeof(desc->port)-1] = '\0'; - const char* speed_s = strtok (NULL, ":"); + const char *speed_s = strtok (NULL, ":"); if (!speed_s) { // speed not specified (or parsing error) free (cs); @@ -286,7 +286,7 @@ arygon_connect (const nfc_connstring connstring) } void -arygon_disconnect (nfc_device * pnd) +arygon_disconnect (nfc_device *pnd) { // Release UART port uart_close (DRIVER_DATA (pnd)->port); @@ -304,7 +304,7 @@ arygon_disconnect (nfc_device * pnd) #define ARYGON_TX_BUFFER_LEN (PN53x_NORMAL_FRAME__DATA_MAX_LEN + PN53x_NORMAL_FRAME__OVERHEAD + 1) #define ARYGON_RX_BUFFER_LEN (PN53x_EXTENDED_FRAME__DATA_MAX_LEN + PN53x_EXTENDED_FRAME__OVERHEAD) bool -arygon_tama_send (nfc_device * pnd, const uint8_t * pbtData, const size_t szData, int timeout) +arygon_tama_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout) { // Before sending anything, we need to discard from any junk bytes uart_flush_input (DRIVER_DATA(pnd)->port); @@ -366,11 +366,11 @@ arygon_abort (nfc_device *pnd) } int -arygon_tama_receive (nfc_device * pnd, uint8_t * pbtData, const size_t szDataLen, int timeout) +arygon_tama_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, int timeout) { uint8_t abtRxBuf[5]; size_t len; - void * abort_p = NULL; + void *abort_p = NULL; #ifndef WIN32 abort_p = &(DRIVER_DATA (pnd)->iAbortFds[1]); @@ -484,7 +484,7 @@ arygon_tama_receive (nfc_device * pnd, uint8_t * pbtData, const size_t szDataLen } void -arygon_firmware (nfc_device * pnd, char * str) +arygon_firmware (nfc_device *pnd, char *str) { const uint8_t arygon_firmware_version_cmd[] = { DEV_ARYGON_PROTOCOL_ARYGON_ASCII, 'a', 'v' }; uint8_t abtRx[16]; @@ -503,7 +503,7 @@ arygon_firmware (nfc_device * pnd, char * str) } if ( 0 == memcmp (abtRx, arygon_error_none, 6)) { - uint8_t * p = abtRx + 6; + uint8_t *p = abtRx + 6; unsigned int szData; sscanf ((const char*)p, "%02x%s", &szData, p); memcpy (str, p, szData); @@ -512,7 +512,7 @@ arygon_firmware (nfc_device * pnd, char * str) } bool -arygon_reset_tama (nfc_device * pnd) +arygon_reset_tama (nfc_device *pnd) { const uint8_t arygon_reset_tama_cmd[] = { DEV_ARYGON_PROTOCOL_ARYGON_ASCII, 'a', 'r' }; uint8_t abtRx[10]; // Attempted response is 10 bytes long @@ -537,7 +537,7 @@ arygon_reset_tama (nfc_device * pnd) } bool -arygon_abort_command (nfc_device * pnd) +arygon_abort_command (nfc_device *pnd) { if (pnd) { #ifndef WIN32 diff --git a/libnfc/drivers/arygon.h b/libnfc/drivers/arygon.h index a3d52f9..b63fbc2 100644 --- a/libnfc/drivers/arygon.h +++ b/libnfc/drivers/arygon.h @@ -30,13 +30,13 @@ # include -bool arygon_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t * pszDeviceFound); +bool arygon_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound); nfc_device *arygon_connect (const nfc_connstring connstring); -void arygon_disconnect (nfc_device * pnd); +void arygon_disconnect (nfc_device *pnd); -bool arygon_tama_send (nfc_device * pnd, const uint8_t * pbtData, const size_t szData, int timeout); -int arygon_tama_receive (nfc_device * pnd, uint8_t * pbtData, const size_t szDat, int timeouta); +bool arygon_tama_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout); +int arygon_tama_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szDat, int timeouta); extern const struct nfc_driver_t arygon_driver; diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index e7759db..7b61090 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -48,8 +48,8 @@ #define PN532_UART_DRIVER_NAME "pn532_uart" #define LOG_CATEGORY "libnfc.driver.pn532_uart" -int pn532_uart_ack (nfc_device * pnd); -int pn532_uart_wakeup (nfc_device * pnd); +int pn532_uart_ack (nfc_device *pnd); +int pn532_uart_wakeup (nfc_device *pnd); const struct pn53x_io pn532_uart_io; @@ -65,7 +65,7 @@ struct pn532_uart_data { #define DRIVER_DATA(pnd) ((struct pn532_uart_data*)(pnd->driver_data)) bool -pn532_uart_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t * pszDeviceFound) +pn532_uart_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound) { /** @note: Due to UART bus we can't know if its really a pn532 without * sending some PN53x commands. But using this way to probe devices, we can @@ -178,7 +178,7 @@ pn532_connstring_decode (const nfc_connstring connstring, struct pn532_uart_desc strncpy (desc->port, port, sizeof(desc->port)-1); desc->port[sizeof(desc->port)-1] = '\0'; - const char* speed_s = strtok (NULL, ":"); + const char *speed_s = strtok (NULL, ":"); if (!speed_s) { // speed not specified (or parsing error) free (cs); @@ -262,7 +262,7 @@ pn532_uart_connect (const nfc_connstring connstring) } void -pn532_uart_disconnect (nfc_device * pnd) +pn532_uart_disconnect (nfc_device *pnd) { // Release UART port uart_close (DRIVER_DATA(pnd)->port); @@ -278,7 +278,7 @@ pn532_uart_disconnect (nfc_device * pnd) } int -pn532_uart_wakeup (nfc_device * pnd) +pn532_uart_wakeup (nfc_device *pnd) { /* High Speed Unit (HSU) wake up consist to send 0x55 and wait a "long" delay for PN532 being wakeup. */ const uint8_t pn532_wakeup_preamble[] = { 0x55, 0x55, 0x00, 0x00, 0x00 }; @@ -289,7 +289,7 @@ pn532_uart_wakeup (nfc_device * pnd) #define PN532_BUFFER_LEN (PN53x_EXTENDED_FRAME__DATA_MAX_LEN + PN53x_EXTENDED_FRAME__OVERHEAD) bool -pn532_uart_send (nfc_device * pnd, const uint8_t * pbtData, const size_t szData, int timeout) +pn532_uart_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout) { // Before sending anything, we need to discard from any junk bytes uart_flush_input (DRIVER_DATA(pnd)->port); @@ -349,11 +349,11 @@ pn532_uart_send (nfc_device * pnd, const uint8_t * pbtData, const size_t szData, } int -pn532_uart_receive (nfc_device * pnd, uint8_t * pbtData, const size_t szDataLen, int timeout) +pn532_uart_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, int timeout) { uint8_t abtRxBuf[5]; size_t len; - void * abort_p = NULL; + void *abort_p = NULL; #ifndef WIN32 abort_p = &(DRIVER_DATA (pnd)->iAbortFds[1]); @@ -473,7 +473,7 @@ pn532_uart_receive (nfc_device * pnd, uint8_t * pbtData, const size_t szDataLen, } int -pn532_uart_ack (nfc_device * pnd) +pn532_uart_ack (nfc_device *pnd) { if (POWERDOWN == CHIP_DATA(pnd)->power_mode) { if (-1 == pn532_uart_wakeup(pnd)) { @@ -484,7 +484,7 @@ pn532_uart_ack (nfc_device * pnd) } bool -pn532_uart_abort_command (nfc_device * pnd) +pn532_uart_abort_command (nfc_device *pnd) { if (pnd) { #ifndef WIN32 diff --git a/libnfc/drivers/pn532_uart.h b/libnfc/drivers/pn532_uart.h index 51874c0..74194f1 100644 --- a/libnfc/drivers/pn532_uart.h +++ b/libnfc/drivers/pn532_uart.h @@ -29,12 +29,12 @@ # include -bool pn532_uart_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t * pszDeviceFound); +bool pn532_uart_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound); nfc_device *pn532_uart_connect (const nfc_connstring connstring); -void pn532_uart_disconnect (nfc_device * pnd); -bool pn532_uart_send (nfc_device * pnd, const uint8_t * pbtData, const size_t szData, int timeout); -int pn532_uart_receive (nfc_device * pnd, uint8_t * pbtData, const size_t szData, int timeout); +void pn532_uart_disconnect (nfc_device *pnd); +bool pn532_uart_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout); +int pn532_uart_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout); extern const struct nfc_driver_t pn532_uart_driver; diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index 5a9027d..b8d2ed8 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -190,7 +190,7 @@ pn53x_usb_get_device_model (uint16_t vendor_id, uint16_t product_id) return UNKNOWN; } -int pn53x_usb_ack (nfc_device * pnd); +int pn53x_usb_ack (nfc_device *pnd); // Find transfer endpoints for bulk transfers void @@ -223,7 +223,7 @@ pn53x_usb_get_end_points (struct usb_device *dev, struct pn53x_usb_data *data) } bool -pn53x_usb_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t * pszDeviceFound) +pn53x_usb_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound) { usb_init (); @@ -492,7 +492,7 @@ error: } void -pn53x_usb_disconnect (nfc_device * pnd) +pn53x_usb_disconnect (nfc_device *pnd) { pn53x_usb_ack (pnd); @@ -519,7 +519,7 @@ pn53x_usb_disconnect (nfc_device * pnd) #define PN53X_USB_BUFFER_LEN (PN53x_EXTENDED_FRAME__DATA_MAX_LEN + PN53x_EXTENDED_FRAME__OVERHEAD) bool -pn53x_usb_send (nfc_device * pnd, const uint8_t * pbtData, const size_t szData, int timeout) +pn53x_usb_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout) { uint8_t abtFrame[PN53X_USB_BUFFER_LEN] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff" size_t szFrame = 0; @@ -565,7 +565,7 @@ pn53x_usb_send (nfc_device * pnd, const uint8_t * pbtData, const size_t szData, } int -pn53x_usb_receive (nfc_device * pnd, uint8_t * pbtData, const size_t szDataLen, int timeout) +pn53x_usb_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, int timeout) { size_t len; off_t offset = 0; @@ -716,7 +716,7 @@ read: } int -pn53x_usb_ack (nfc_device * pnd) +pn53x_usb_ack (nfc_device *pnd) { return pn53x_usb_bulk_write (DRIVER_DATA (pnd), (uint8_t *) pn53x_ack_frame, sizeof (pn53x_ack_frame), 0); } @@ -779,7 +779,7 @@ On ASK LoGO hardware: } bool -pn53x_usb_configure (nfc_device * pnd, const nfc_device_option ndo, const bool bEnable) +pn53x_usb_configure (nfc_device *pnd, const nfc_device_option ndo, const bool bEnable) { if (!pn53x_configure (pnd, ndo, bEnable)) return false; @@ -807,7 +807,7 @@ pn53x_usb_configure (nfc_device * pnd, const nfc_device_option ndo, const bool b } bool -pn53x_usb_abort_command (nfc_device * pnd) +pn53x_usb_abort_command (nfc_device *pnd) { DRIVER_DATA (pnd)->abort_flag = true; return true; diff --git a/libnfc/drivers/pn53x_usb.h b/libnfc/drivers/pn53x_usb.h index 00f0d31..21dbfdb 100644 --- a/libnfc/drivers/pn53x_usb.h +++ b/libnfc/drivers/pn53x_usb.h @@ -29,11 +29,11 @@ # include -bool pn53x_usb_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t * pszDeviceFound); +bool pn53x_usb_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound); nfc_device *pn53x_usb_connect (const nfc_connstring connstring); -bool pn53x_usb_send (nfc_device * pnd, const uint8_t * pbtData, const size_t szData, int timeout); -int pn53x_usb_receive (nfc_device * pnd, uint8_t * pbtData, const size_t szData, int timeout); -void pn53x_usb_disconnect (nfc_device * pnd); +bool pn53x_usb_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout); +int pn53x_usb_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout); +void pn53x_usb_disconnect (nfc_device *pnd); extern const struct nfc_driver_t pn53x_usb_driver; diff --git a/libnfc/iso14443-subr.c b/libnfc/iso14443-subr.c index 42e291e..ec0e002 100644 --- a/libnfc/iso14443-subr.c +++ b/libnfc/iso14443-subr.c @@ -32,7 +32,7 @@ #include void -iso14443a_crc (uint8_t * pbtData, size_t szLen, uint8_t * pbtCrc) +iso14443a_crc (uint8_t *pbtData, size_t szLen, uint8_t *pbtCrc) { uint8_t bt; uint32_t wCrc = 0x6363; @@ -49,13 +49,13 @@ iso14443a_crc (uint8_t * pbtData, size_t szLen, uint8_t * pbtCrc) } void -iso14443a_crc_append (uint8_t * pbtData, size_t szLen) +iso14443a_crc_append (uint8_t *pbtData, size_t szLen) { iso14443a_crc (pbtData, szLen, pbtData + szLen); } uint8_t * -iso14443a_locate_historical_bytes (uint8_t * pbtAts, size_t szAts, size_t * pszTk) +iso14443a_locate_historical_bytes (uint8_t *pbtAts, size_t szAts, size_t *pszTk) { if (szAts) { size_t offset = 1; @@ -82,7 +82,7 @@ iso14443a_locate_historical_bytes (uint8_t * pbtAts, size_t szAts, size_t * pszT * @see ISO/IEC 14443-3 (6.4.4 UID contents and cascade levels) */ void -iso14443_cascade_uid (const uint8_t abtUID[], const size_t szUID, uint8_t * pbtCascadedUID, size_t * pszCascadedUID) +iso14443_cascade_uid (const uint8_t abtUID[], const size_t szUID, uint8_t *pbtCascadedUID, size_t *pszCascadedUID) { switch (szUID) { case 7: diff --git a/libnfc/mirror-subr.c b/libnfc/mirror-subr.c index d85ef88..361038f 100644 --- a/libnfc/mirror-subr.c +++ b/libnfc/mirror-subr.c @@ -60,7 +60,7 @@ mirror (uint8_t bt) } void -mirror_bytes (uint8_t * pbts, size_t szLen) +mirror_bytes (uint8_t *pbts, size_t szLen) { size_t szByteNr; diff --git a/libnfc/mirror-subr.h b/libnfc/mirror-subr.h index 0560053..081bc88 100644 --- a/libnfc/mirror-subr.h +++ b/libnfc/mirror-subr.h @@ -32,6 +32,6 @@ uint8_t mirror (uint8_t bt); uint32_t mirror32 (uint32_t ui32Bits); uint64_t mirror64 (uint64_t ui64Bits); -void mirror_uint8_ts (uint8_t * pbts, size_t szLen); +void mirror_uint8_ts (uint8_t *pbts, size_t szLen); #endif // _LIBNFC_MIRROR_SUBR_H_ diff --git a/libnfc/nfc-emulation.c b/libnfc/nfc-emulation.c index c892837..c8a7af9 100644 --- a/libnfc/nfc-emulation.c +++ b/libnfc/nfc-emulation.c @@ -28,7 +28,7 @@ #include "iso7816.h" int -nfc_emulate_target (nfc_device* pnd, struct nfc_emulator *emulator) +nfc_emulate_target (nfc_device *pnd, struct nfc_emulator *emulator) { uint8_t abtRx[ISO7816_SHORT_R_APDU_MAX_LEN]; size_t szRx = sizeof(abtRx); diff --git a/libnfc/nfc-internal.h b/libnfc/nfc-internal.h index 04333e9..d34c706 100644 --- a/libnfc/nfc-internal.h +++ b/libnfc/nfc-internal.h @@ -128,29 +128,29 @@ struct nfc_driver_t { const char *name; bool (*probe)(nfc_connstring connstrings[], size_t connstrings_len, size_t * pszDeviceFound); nfc_device * (*connect) (const nfc_connstring connstring); - void (*disconnect) (nfc_device * pnd); - const char *(*strerror) (const nfc_device * pnd); + void (*disconnect) (nfc_device *pnd); + const char *(*strerror) (const nfc_device *pnd); - bool (*initiator_init) (nfc_device * pnd); - bool (*initiator_select_passive_target) (nfc_device * pnd, const nfc_modulation nm, const uint8_t * pbtInitData, const size_t szInitData, nfc_target * pnt); - bool (*initiator_poll_target) (nfc_device * pnd, const nfc_modulation * pnmModulations, const size_t szModulations, const uint8_t uiPollNr, const uint8_t btPeriod, nfc_target * pnt); - bool (*initiator_select_dep_target) (nfc_device * pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info * pndiInitiator, nfc_target * pnt); - bool (*initiator_deselect_target) (nfc_device * pnd); - bool (*initiator_transceive_bytes) (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, size_t * pszRx, int timeout); - bool (*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); - bool (*initiator_transceive_bytes_timed) (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, size_t * pszRx, uint32_t * cycles); - bool (*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); + bool (*initiator_init) (nfc_device *pnd); + bool (*initiator_select_passive_target) (nfc_device *pnd, const nfc_modulation nm, const uint8_t * pbtInitData, const size_t szInitData, nfc_target * pnt); + bool (*initiator_poll_target) (nfc_device *pnd, const nfc_modulation * pnmModulations, const size_t szModulations, const uint8_t uiPollNr, const uint8_t btPeriod, nfc_target * pnt); + bool (*initiator_select_dep_target) (nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info * pndiInitiator, nfc_target * pnt); + bool (*initiator_deselect_target) (nfc_device *pnd); + bool (*initiator_transceive_bytes) (nfc_device *pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, size_t * pszRx, int timeout); + bool (*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); + bool (*initiator_transceive_bytes_timed) (nfc_device *pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, size_t * pszRx, uint32_t * cycles); + bool (*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); - bool (*target_init) (nfc_device * pnd, nfc_target * pnt, uint8_t * pbtRx, size_t * pszRx); - bool (*target_send_bytes) (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, int timeout); - bool (*target_receive_bytes) (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRx, int timeout); - bool (*target_send_bits) (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar); - bool (*target_receive_bits) (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRxBits, uint8_t * pbtRxPar); + bool (*target_init) (nfc_device *pnd, nfc_target * pnt, uint8_t * pbtRx, size_t * pszRx); + bool (*target_send_bytes) (nfc_device *pnd, const uint8_t * pbtTx, const size_t szTx, int timeout); + bool (*target_receive_bytes) (nfc_device *pnd, uint8_t * pbtRx, size_t * pszRx, int timeout); + bool (*target_send_bits) (nfc_device *pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar); + bool (*target_receive_bits) (nfc_device *pnd, uint8_t * pbtRx, size_t * pszRxBits, uint8_t * pbtRxPar); - bool (*configure) (nfc_device * pnd, const nfc_device_option ndo, const bool bEnable); + bool (*configure) (nfc_device *pnd, const nfc_device_option ndo, const bool bEnable); - bool (*abort_command) (nfc_device * pnd); - bool (*idle) (nfc_device * pnd); + bool (*abort_command) (nfc_device *pnd); + bool (*idle) (nfc_device *pnd); }; nfc_device *nfc_device_new (void); diff --git a/utils/mifare.c b/utils/mifare.c index 92ecfad..91daf0d 100644 --- a/utils/mifare.c +++ b/utils/mifare.c @@ -48,7 +48,7 @@ * The MIFARE Classic Specification (http://www.nxp.com/acrobat/other/identification/M001053_MF1ICS50_rev5_3.pdf) explains more about this process. */ bool -nfc_initiator_mifare_cmd (nfc_device * pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param * pmp) +nfc_initiator_mifare_cmd (nfc_device *pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param *pmp) { uint8_t abtRx[265]; size_t szRx = sizeof(abtRx); diff --git a/utils/mifare.h b/utils/mifare.h index 726d669..5260308 100644 --- a/utils/mifare.h +++ b/utils/mifare.h @@ -75,7 +75,7 @@ typedef union { // Reset struct alignment to default # pragma pack() -bool nfc_initiator_mifare_cmd (nfc_device * pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param * pmp); +bool nfc_initiator_mifare_cmd (nfc_device *pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param *pmp); // Compiler directive, set struct alignment to 1 uint8_t for compatibility # pragma pack(1) diff --git a/utils/nfc-mfclassic.c b/utils/nfc-mfclassic.c index 9a7bb1b..35c3d33 100644 --- a/utils/nfc-mfclassic.c +++ b/utils/nfc-mfclassic.c @@ -92,7 +92,7 @@ uint8_t abtUnlock1[1] = { 0x40 }; uint8_t abtUnlock2[1] = { 0x43 }; static bool -transmit_bits (const uint8_t * pbtTx, const size_t szTxBits) +transmit_bits (const uint8_t *pbtTx, const size_t szTxBits) { // Show transmitted command printf ("Sent bits: "); @@ -110,7 +110,7 @@ transmit_bits (const uint8_t * pbtTx, const size_t szTxBits) static bool -transmit_bytes (const uint8_t * pbtTx, const size_t szTx) +transmit_bytes (const uint8_t *pbtTx, const size_t szTx) { // Show transmitted command printf ("Sent bits: "); @@ -127,7 +127,7 @@ transmit_bytes (const uint8_t * pbtTx, const size_t szTx) } static void -print_success_or_failure (bool bFailure, uint32_t * uiBlockCounter) +print_success_or_failure (bool bFailure, uint32_t *uiBlockCounter) { printf ("%c", (bFailure) ? 'x' : '.'); if (uiBlockCounter && !bFailure) diff --git a/utils/nfc-mfsetuid.c b/utils/nfc-mfsetuid.c index d610fcf..0c33a53 100644 --- a/utils/nfc-mfsetuid.c +++ b/utils/nfc-mfsetuid.c @@ -88,7 +88,7 @@ uint8_t abtBlank[18] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0 static bool -transmit_bits (const uint8_t * pbtTx, const size_t szTxBits) +transmit_bits (const uint8_t *pbtTx, const size_t szTxBits) { // Show transmitted command if (!quiet_output) { @@ -110,7 +110,7 @@ transmit_bits (const uint8_t * pbtTx, const size_t szTxBits) static bool -transmit_bytes (const uint8_t * pbtTx, const size_t szTx) +transmit_bytes (const uint8_t *pbtTx, const size_t szTx) { // Show transmitted command if (!quiet_output) { diff --git a/utils/nfc-read-forum-tag3.c b/utils/nfc-read-forum-tag3.c index 2ea3fc1..ccba19d 100644 --- a/utils/nfc-read-forum-tag3.c +++ b/utils/nfc-read-forum-tag3.c @@ -77,7 +77,7 @@ void stop_select (int sig) } void -build_felica_frame(const nfc_felica_info nfi, const uint8_t command, const uint8_t* payload, const size_t payload_len, uint8_t * frame, size_t * frame_len) +build_felica_frame(const nfc_felica_info nfi, const uint8_t command, const uint8_t *payload, const size_t payload_len, uint8_t *frame, size_t *frame_len) { frame[0] = 1 + 1 + 8 + payload_len; *frame_len = frame[0]; @@ -88,7 +88,7 @@ build_felica_frame(const nfc_felica_info nfi, const uint8_t command, const uint8 #define CHECK 0x06 int -nfc_forum_tag_type3_check (nfc_device *pnd, const nfc_target nt, const uint16_t block, const uint8_t block_count, uint8_t * data, size_t * data_len) +nfc_forum_tag_type3_check (nfc_device *pnd, const nfc_target nt, const uint16_t block, const uint8_t block_count, uint8_t *data, size_t *data_len) { uint8_t payload[1024] = { 1, // Services diff --git a/utils/nfc-relay-picc.c b/utils/nfc-relay-picc.c index b8df5ec..1ac0391 100644 --- a/utils/nfc-relay-picc.c +++ b/utils/nfc-relay-picc.c @@ -92,7 +92,7 @@ print_usage (char *argv[]) printf ("\t-n N\tAdds a waiting time of N seconds (integer) in the relay to mimic long distance.\n"); } -bool print_hex_fd4 (const uint8_t * pbtData, const size_t szBytes, const char * pchPrefix) +bool print_hex_fd4 (const uint8_t *pbtData, const size_t szBytes, const char *pchPrefix) { size_t szPos; if (szBytes > MAX_FRAME_LEN) { @@ -114,7 +114,7 @@ bool print_hex_fd4 (const uint8_t * pbtData, const size_t szBytes, const char * return EXIT_SUCCESS; } -bool scan_hex_fd3 (uint8_t *pbtData, size_t *pszBytes, const char * pchPrefix) +bool scan_hex_fd3 (uint8_t *pbtData, size_t *pszBytes, const char *pchPrefix) { size_t szPos; unsigned int uiBytes; diff --git a/utils/nfc-utils.c b/utils/nfc-utils.c index 51c4a1f..b0e81d5 100644 --- a/utils/nfc-utils.c +++ b/utils/nfc-utils.c @@ -59,7 +59,7 @@ oddparity (const uint8_t bt) } void -oddparity_bytes_ts (const uint8_t * pbtData, const size_t szLen, uint8_t * pbtPar) +oddparity_bytes_ts (const uint8_t *pbtData, const size_t szLen, uint8_t *pbtPar) { size_t szByteNr; // Calculate the parity bits for the command @@ -69,7 +69,7 @@ oddparity_bytes_ts (const uint8_t * pbtData, const size_t szLen, uint8_t * pbtPa } void -print_hex (const uint8_t * pbtData, const size_t szBytes) +print_hex (const uint8_t *pbtData, const size_t szBytes) { size_t szPos; @@ -80,7 +80,7 @@ print_hex (const uint8_t * pbtData, const size_t szBytes) } void -print_hex_bits (const uint8_t * pbtData, const size_t szBits) +print_hex_bits (const uint8_t *pbtData, const size_t szBits) { uint8_t uRemainder; size_t szPos; @@ -102,7 +102,7 @@ print_hex_bits (const uint8_t * pbtData, const size_t szBits) } void -print_hex_par (const uint8_t * pbtData, const size_t szBits, const uint8_t * pbtDataPar) +print_hex_par (const uint8_t *pbtData, const size_t szBits, const uint8_t *pbtDataPar) { uint8_t uRemainder; size_t szPos; diff --git a/utils/nfc-utils.h b/utils/nfc-utils.h index 86c5d08..50abdf3 100644 --- a/utils/nfc-utils.h +++ b/utils/nfc-utils.h @@ -80,11 +80,11 @@ #endif uint8_t oddparity (const uint8_t bt); -void oddparity_uint8_ts (const uint8_t * pbtData, const size_t szLen, uint8_t * pbtPar); +void oddparity_uint8_ts (const uint8_t *pbtData, const size_t szLen, uint8_t *pbtPar); -void print_hex (const uint8_t * pbtData, const size_t szLen); -void print_hex_bits (const uint8_t * pbtData, const size_t szBits); -void print_hex_par (const uint8_t * pbtData, const size_t szBits, const uint8_t * pbtDataPar); +void print_hex (const uint8_t *pbtData, const size_t szLen); +void print_hex_bits (const uint8_t *pbtData, const size_t szBits); +void print_hex_par (const uint8_t *pbtData, const size_t szBits, const uint8_t *pbtDataPar); void print_nfc_iso14443a_info (const nfc_iso14443a_info nai, bool verbose); void print_nfc_iso14443b_info (const nfc_iso14443b_info nbi, bool verbose);