astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60 --brackets=linux --pad-oper --unpad-paren --pad-header --align-pointer=name
This commit is contained in:
parent
01303fab0d
commit
568317929d
21 changed files with 94 additions and 94 deletions
|
|
@ -127,7 +127,7 @@ uart_flush_input(serial_port sp)
|
|||
if (available_bytes_count == 0) {
|
||||
return;
|
||||
}
|
||||
char* rx = malloc(available_bytes_count);
|
||||
char *rx = malloc(available_bytes_count);
|
||||
// There is something available, read the data
|
||||
res = read(UART_DATA(sp)->fd, rx, available_bytes_count);
|
||||
log_put(LOG_CATEGORY, NFC_PRIORITY_TRACE, "%d bytes have eatten.", available_bytes_count);
|
||||
|
|
@ -250,7 +250,7 @@ uart_close(const serial_port sp)
|
|||
int
|
||||
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 iAbortFd = abort_p ? *((int *)abort_p) : 0;
|
||||
int received_bytes_count = 0;
|
||||
int available_bytes_count = 0;
|
||||
const int expected_bytes_count = (int)szRx;
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ 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)
|
||||
uart_receive(serial_port sp, uint8_t *pbtRx, const size_t szRx, void *abort_p, int timeout)
|
||||
{
|
||||
DWORD dwBytesToGet = (DWORD)szRx;
|
||||
DWORD dwBytesReceived = 0;
|
||||
|
|
@ -163,7 +163,7 @@ uart_receive(serial_port sp, uint8_t * pbtRx, const size_t szRx, void * abort_p,
|
|||
|
||||
// TODO Enhance the reception method
|
||||
// - According to MSDN, it could be better to implement nfc_abort_command() mecanism using Cancello()
|
||||
volatile bool * abort_flag_p = (volatile bool *)abort_p;
|
||||
volatile bool *abort_flag_p = (volatile bool *)abort_p;
|
||||
do {
|
||||
log_put(LOG_CATEGORY, NFC_PRIORITY_TRACE, "ReadFile");
|
||||
res = ReadFile(((struct serial_port_windows *) sp)->hPort, pbtRx + dwTotalBytesReceived,
|
||||
|
|
@ -194,7 +194,7 @@ uart_receive(serial_port sp, uint8_t * pbtRx, const size_t szRx, void * abort_p,
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
DWORD dwTxLen = 0;
|
||||
|
||||
|
|
@ -238,12 +238,12 @@ 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++) {
|
||||
if (is_port_available(i)) {
|
||||
availablePorts[curIndex] = (char*)malloc(10);
|
||||
availablePorts[curIndex] = (char *)malloc(10);
|
||||
sprintf(availablePorts[curIndex], "COM%d", i);
|
||||
// printf("found candidate port: %s\n", availablePorts[curIndex]);
|
||||
curIndex++;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ pn53x_init(struct nfc_device *pnd)
|
|||
}
|
||||
|
||||
if (!CHIP_DATA(pnd)->supported_modulation_as_target) {
|
||||
CHIP_DATA(pnd)->supported_modulation_as_target = (nfc_modulation_type*) pn53x_supported_modulation_as_target;
|
||||
CHIP_DATA(pnd)->supported_modulation_as_target = (nfc_modulation_type *) pn53x_supported_modulation_as_target;
|
||||
}
|
||||
|
||||
// CRC handling should be enabled by default as declared in nfc_device_new
|
||||
|
|
@ -1189,7 +1189,7 @@ pn53x_initiator_select_dep_target(struct nfc_device *pnd,
|
|||
const int timeout)
|
||||
{
|
||||
const uint8_t abtPassiveInitiatorData[] = { 0x00, 0xff, 0xff, 0x00, 0x0f }; // 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;
|
||||
|
||||
switch (nbr) {
|
||||
case NBR_212:
|
||||
|
|
@ -2345,7 +2345,7 @@ pn53x_InRelease(struct nfc_device *pnd, const uint8_t ui8Target)
|
|||
int
|
||||
pn53x_InAutoPoll(struct nfc_device *pnd,
|
||||
const pn53x_target_type *ppttTargetTypes, const size_t szTargetTypes,
|
||||
const uint8_t btPollNr, const uint8_t btPeriod, nfc_target * pntTargets, const int timeout)
|
||||
const uint8_t btPollNr, const uint8_t btPeriod, nfc_target *pntTargets, const int timeout)
|
||||
{
|
||||
size_t szTargetFound = 0;
|
||||
if (CHIP_DATA(pnd)->type != PN532) {
|
||||
|
|
@ -2849,27 +2849,27 @@ pn53x_get_supported_baud_rate(nfc_device *pnd, const nfc_modulation_type nmt, co
|
|||
{
|
||||
switch (nmt) {
|
||||
case NMT_FELICA:
|
||||
*supported_br = (nfc_baud_rate*)pn53x_felica_supported_baud_rates;
|
||||
*supported_br = (nfc_baud_rate *)pn53x_felica_supported_baud_rates;
|
||||
break;
|
||||
case NMT_ISO14443A:
|
||||
*supported_br = (nfc_baud_rate*)pn53x_iso14443a_supported_baud_rates;
|
||||
*supported_br = (nfc_baud_rate *)pn53x_iso14443a_supported_baud_rates;
|
||||
break;
|
||||
case NMT_ISO14443B:
|
||||
case NMT_ISO14443BI:
|
||||
case NMT_ISO14443B2SR:
|
||||
case NMT_ISO14443B2CT: {
|
||||
if ((CHIP_DATA(pnd)->type != PN533)) {
|
||||
*supported_br = (nfc_baud_rate*)pn532_iso14443b_supported_baud_rates;
|
||||
*supported_br = (nfc_baud_rate *)pn532_iso14443b_supported_baud_rates;
|
||||
} else {
|
||||
*supported_br = (nfc_baud_rate*)pn533_iso14443b_supported_baud_rates;
|
||||
*supported_br = (nfc_baud_rate *)pn533_iso14443b_supported_baud_rates;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NMT_JEWEL:
|
||||
*supported_br = (nfc_baud_rate*)pn53x_jewel_supported_baud_rates;
|
||||
*supported_br = (nfc_baud_rate *)pn53x_jewel_supported_baud_rates;
|
||||
break;
|
||||
case NMT_DEP:
|
||||
*supported_br = (nfc_baud_rate*)pn53x_dep_supported_baud_rates;
|
||||
*supported_br = (nfc_baud_rate *)pn53x_dep_supported_baud_rates;
|
||||
break;
|
||||
default:
|
||||
return NFC_EINVARG;
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ acr122s_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszD
|
|||
}
|
||||
iDevice = 0;
|
||||
while ((acPort = acPorts[iDevice++])) {
|
||||
free((void*)acPort);
|
||||
free((void *)acPort);
|
||||
}
|
||||
free(acPorts);
|
||||
#endif /* SERIAL_AUTOPROBE_ENABLED */
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ arygon_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDe
|
|||
}
|
||||
iDevice = 0;
|
||||
while ((acPort = acPorts[iDevice++])) {
|
||||
free((void*)acPort);
|
||||
free((void *)acPort);
|
||||
}
|
||||
free(acPorts);
|
||||
#endif /* SERIAL_AUTOPROBE_ENABLED */
|
||||
|
|
@ -378,7 +378,7 @@ arygon_tama_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, i
|
|||
#ifndef WIN32
|
||||
abort_p = &(DRIVER_DATA(pnd)->iAbortFds[1]);
|
||||
#else
|
||||
abort_p = (void*) & (DRIVER_DATA(pnd)->abort_flag);
|
||||
abort_p = (void *) & (DRIVER_DATA(pnd)->abort_flag);
|
||||
#endif
|
||||
|
||||
pnd->last_error = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, 5, abort_p, timeout);
|
||||
|
|
@ -508,7 +508,7 @@ arygon_firmware(nfc_device *pnd, char *str)
|
|||
if (0 == memcmp(abtRx, arygon_error_none, 6)) {
|
||||
uint8_t *p = abtRx + 6;
|
||||
unsigned int szData;
|
||||
sscanf((const char*)p, "%02x%s", &szData, p);
|
||||
sscanf((const char *)p, "%02x%s", &szData, p);
|
||||
memcpy(str, p, szData);
|
||||
*(str + szData) = '\0';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ pn532_uart_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *p
|
|||
}
|
||||
iDevice = 0;
|
||||
while ((acPort = acPorts[iDevice++])) {
|
||||
free((void*)acPort);
|
||||
free((void *)acPort);
|
||||
}
|
||||
free(acPorts);
|
||||
#endif /* SERIAL_AUTOPROBE_ENABLED */
|
||||
|
|
@ -358,7 +358,7 @@ pn532_uart_receive(nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, in
|
|||
#ifndef WIN32
|
||||
abort_p = &(DRIVER_DATA(pnd)->iAbortFds[1]);
|
||||
#else
|
||||
abort_p = (void*) & (DRIVER_DATA(pnd)->abort_flag);
|
||||
abort_p = (void *) & (DRIVER_DATA(pnd)->abort_flag);
|
||||
#endif
|
||||
|
||||
pnd->last_error = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, 5, abort_p, timeout);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include "nfc-internal.h"
|
||||
|
||||
void
|
||||
prepare_initiator_data(const nfc_modulation nm, uint8_t **ppbtInitiatorData, size_t * pszInitiatorData)
|
||||
prepare_initiator_data(const nfc_modulation nm, uint8_t **ppbtInitiatorData, size_t *pszInitiatorData)
|
||||
{
|
||||
switch (nm.nmt) {
|
||||
case NMT_ISO14443B: {
|
||||
|
|
|
|||
|
|
@ -135,27 +135,27 @@
|
|||
|
||||
struct nfc_driver {
|
||||
const char *name;
|
||||
bool (*probe)(nfc_connstring connstrings[], size_t connstrings_len, size_t * pszDeviceFound);
|
||||
bool (*probe)(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound);
|
||||
struct nfc_device *(*open)(const nfc_connstring connstring);
|
||||
void (*close)(struct nfc_device *pnd);
|
||||
const char *(*strerror)(const struct nfc_device *pnd);
|
||||
|
||||
int (*initiator_init)(struct nfc_device *pnd);
|
||||
int (*initiator_select_passive_target)(struct nfc_device *pnd, const nfc_modulation nm, const uint8_t * pbtInitData, const size_t szInitData, nfc_target * pnt);
|
||||
int (*initiator_poll_target)(struct nfc_device *pnd, const nfc_modulation * pnmModulations, const size_t szModulations, const uint8_t uiPollNr, const uint8_t btPeriod, nfc_target * pnt);
|
||||
int (*initiator_select_dep_target)(struct nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info * pndiInitiator, nfc_target * pnt, const int timeout);
|
||||
int (*initiator_select_passive_target)(struct nfc_device *pnd, const nfc_modulation nm, const uint8_t *pbtInitData, const size_t szInitData, nfc_target *pnt);
|
||||
int (*initiator_poll_target)(struct nfc_device *pnd, const nfc_modulation *pnmModulations, const size_t szModulations, const uint8_t uiPollNr, const uint8_t btPeriod, nfc_target *pnt);
|
||||
int (*initiator_select_dep_target)(struct nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info *pndiInitiator, nfc_target *pnt, const int timeout);
|
||||
int (*initiator_deselect_target)(struct nfc_device *pnd);
|
||||
int (*initiator_transceive_bytes)(struct nfc_device *pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, const size_t szRx, 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, uint32_t * cycles);
|
||||
int (*initiator_transceive_bits_timed)(struct nfc_device *pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar, uint8_t * pbtRx, uint8_t * pbtRxPar, uint32_t * cycles);
|
||||
int (*initiator_transceive_bytes)(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRx, 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, uint32_t *cycles);
|
||||
int (*initiator_transceive_bits_timed)(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, uint8_t *pbtRxPar, uint32_t *cycles);
|
||||
int (*initiator_target_is_present)(struct nfc_device *pnd, const nfc_target nt);
|
||||
|
||||
int (*target_init)(struct nfc_device *pnd, nfc_target * pnt, uint8_t * pbtRx, const size_t szRx, 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, const size_t szRxLen, 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, const size_t szRxLen, uint8_t * pbtRxPar);
|
||||
int (*target_init)(struct nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, const size_t szRx, 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, const size_t szRxLen, 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, const size_t szRxLen, uint8_t *pbtRxPar);
|
||||
|
||||
int (*device_set_property_bool)(struct nfc_device *pnd, const nfc_property property, const bool bEnable);
|
||||
int (*device_set_property_int)(struct nfc_device *pnd, const nfc_property property, const int value);
|
||||
|
|
@ -201,8 +201,8 @@ struct nfc_device {
|
|||
nfc_device *nfc_device_new(const nfc_connstring connstring);
|
||||
void nfc_device_free(nfc_device *dev);
|
||||
|
||||
void iso14443_cascade_uid(const uint8_t abtUID[], const size_t szUID, uint8_t * pbtCascadedUID, size_t * pszCascadedUID);
|
||||
void iso14443_cascade_uid(const uint8_t abtUID[], const size_t szUID, uint8_t *pbtCascadedUID, size_t *pszCascadedUID);
|
||||
|
||||
void prepare_initiator_data(const nfc_modulation nm, uint8_t **ppbtInitiatorData, size_t * pszInitiatorData);
|
||||
void prepare_initiator_data(const nfc_modulation nm, uint8_t **ppbtInitiatorData, size_t *pszInitiatorData);
|
||||
|
||||
#endif // __NFC_INTERNAL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue