astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60
This commit is contained in:
parent
26569c2202
commit
a2cd236441
45 changed files with 1096 additions and 1082 deletions
|
|
@ -13,43 +13,43 @@
|
|||
void
|
||||
test_access_storm (void)
|
||||
{
|
||||
int n = NTESTS;
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
int res = 0;
|
||||
int n = NTESTS;
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
int res = 0;
|
||||
|
||||
nfc_init (NULL);
|
||||
nfc_init (NULL);
|
||||
|
||||
size_t ref_device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
if (!ref_device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
size_t ref_device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
if (!ref_device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
|
||||
while (n) {
|
||||
size_t i;
|
||||
while (n) {
|
||||
size_t i;
|
||||
|
||||
size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
cut_assert_equal_int (ref_device_count, device_count, cut_message ("device count"));
|
||||
size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
cut_assert_equal_int (ref_device_count, device_count, cut_message ("device count"));
|
||||
|
||||
for (i = 0; i < device_count; i++) {
|
||||
nfc_device *device;
|
||||
nfc_target ant[MAX_TARGET_COUNT];
|
||||
for (i = 0; i < device_count; i++) {
|
||||
nfc_device *device;
|
||||
nfc_target ant[MAX_TARGET_COUNT];
|
||||
|
||||
device = nfc_open (NULL, connstrings[i]);
|
||||
cut_assert_not_null (device, cut_message ("nfc_open"));
|
||||
device = nfc_open (NULL, connstrings[i]);
|
||||
cut_assert_not_null (device, cut_message ("nfc_open"));
|
||||
|
||||
res = nfc_initiator_init(device);
|
||||
cut_assert_equal_int (0, res, cut_message ("nfc_initiator_init"));
|
||||
res = nfc_initiator_init(device);
|
||||
cut_assert_equal_int (0, res, cut_message ("nfc_initiator_init"));
|
||||
|
||||
const nfc_modulation nm = {
|
||||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_106,
|
||||
};
|
||||
res = nfc_initiator_list_passive_targets(device, nm, ant, MAX_TARGET_COUNT);
|
||||
cut_assert_operator_int (res, >=, 0, cut_message ("nfc_initiator_list_passive_targets"));
|
||||
const nfc_modulation nm = {
|
||||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_106,
|
||||
};
|
||||
res = nfc_initiator_list_passive_targets(device, nm, ant, MAX_TARGET_COUNT);
|
||||
cut_assert_operator_int (res, >=, 0, cut_message ("nfc_initiator_list_passive_targets"));
|
||||
|
||||
nfc_close (device);
|
||||
}
|
||||
|
||||
n--;
|
||||
nfc_close (device);
|
||||
}
|
||||
nfc_exit (NULL);
|
||||
|
||||
n--;
|
||||
}
|
||||
nfc_exit (NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ initiator_thread (void *arg)
|
|||
cut_assert_operator_int (res, >=, 0, cut_message ("Can't deselect target: %s", nfc_strerror (device)));
|
||||
if (res < 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
// Passive mode / 424Kbps
|
||||
// Passive mode / 424Kbps
|
||||
printf ("=========== INITIATOR %s (Passive mode / 424Kbps) =========\n", nfc_device_get_name (device));
|
||||
res = nfc_initiator_select_dep_target (device, NDM_PASSIVE, NBR_424, NULL, &nt, 1000);
|
||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't select any DEP target: %s", nfc_strerror (device)));
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ test_dep_states (void)
|
|||
.cut_test_context = test_context,
|
||||
};
|
||||
|
||||
struct thread_data initiator_data = {
|
||||
struct thread_data initiator_data = {
|
||||
.device = second_device,
|
||||
.cut_test_context = test_context,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,40 +9,40 @@
|
|||
void
|
||||
test_register_endianness (void)
|
||||
{
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
int res = 0;
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
int res = 0;
|
||||
|
||||
nfc_init (NULL);
|
||||
nfc_init (NULL);
|
||||
|
||||
size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
if (!device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
if (!device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
|
||||
nfc_device *device;
|
||||
nfc_device *device;
|
||||
|
||||
device = nfc_open (NULL, connstrings[0]);
|
||||
cut_assert_not_null (device, cut_message ("nfc_open"));
|
||||
device = nfc_open (NULL, connstrings[0]);
|
||||
cut_assert_not_null (device, cut_message ("nfc_open"));
|
||||
|
||||
uint8_t value;
|
||||
uint8_t value;
|
||||
|
||||
/* Set a 0xAA test value in writable register memory to test register access */
|
||||
res = pn53x_write_register (device, PN53X_REG_CIU_TxMode, 0xFF, 0xAA);
|
||||
cut_assert_equal_int (0, res, cut_message ("write register value to 0xAA"));
|
||||
/* Set a 0xAA test value in writable register memory to test register access */
|
||||
res = pn53x_write_register (device, PN53X_REG_CIU_TxMode, 0xFF, 0xAA);
|
||||
cut_assert_equal_int (0, res, cut_message ("write register value to 0xAA"));
|
||||
|
||||
/* Get test value from register memory */
|
||||
res = pn53x_read_register (device, PN53X_REG_CIU_TxMode, &value);
|
||||
cut_assert_equal_int (0, res, cut_message ("read register value"));
|
||||
cut_assert_equal_uint (0xAA, value, cut_message ("check register value"));
|
||||
/* Get test value from register memory */
|
||||
res = pn53x_read_register (device, PN53X_REG_CIU_TxMode, &value);
|
||||
cut_assert_equal_int (0, res, cut_message ("read register value"));
|
||||
cut_assert_equal_uint (0xAA, value, cut_message ("check register value"));
|
||||
|
||||
/* Set a 0x55 test value in writable register memory to test register access */
|
||||
res = pn53x_write_register (device, PN53X_REG_CIU_TxMode, 0xFF, 0x55);
|
||||
cut_assert_equal_int (0, res, cut_message ("write register value to 0x55"));
|
||||
/* Set a 0x55 test value in writable register memory to test register access */
|
||||
res = pn53x_write_register (device, PN53X_REG_CIU_TxMode, 0xFF, 0x55);
|
||||
cut_assert_equal_int (0, res, cut_message ("write register value to 0x55"));
|
||||
|
||||
/* Get test value from register memory */
|
||||
res = pn53x_read_register (device, PN53X_REG_CIU_TxMode, &value);
|
||||
cut_assert_equal_int (0, res, cut_message ("read register value"));
|
||||
cut_assert_equal_uint (0x55, value, cut_message ("check register value"));
|
||||
/* Get test value from register memory */
|
||||
res = pn53x_read_register (device, PN53X_REG_CIU_TxMode, &value);
|
||||
cut_assert_equal_int (0, res, cut_message ("read register value"));
|
||||
cut_assert_equal_uint (0x55, value, cut_message ("check register value"));
|
||||
|
||||
nfc_close (device);
|
||||
nfc_exit (NULL);
|
||||
nfc_close (device);
|
||||
nfc_exit (NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,30 +10,30 @@
|
|||
void
|
||||
test_register_endianness (void)
|
||||
{
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
int res = 0;
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
int res = 0;
|
||||
|
||||
nfc_init (NULL);
|
||||
nfc_init (NULL);
|
||||
|
||||
size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
if (!device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
if (!device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
|
||||
nfc_device *device;
|
||||
nfc_device *device;
|
||||
|
||||
device = nfc_open (NULL, connstrings[0]);
|
||||
cut_assert_not_null (device, cut_message ("nfc_open"));
|
||||
device = nfc_open (NULL, connstrings[0]);
|
||||
cut_assert_not_null (device, cut_message ("nfc_open"));
|
||||
|
||||
uint8_t value;
|
||||
uint8_t value;
|
||||
|
||||
/* Read valid XRAM memory */
|
||||
res = pn53x_read_register (device, 0xF0FF, &value);
|
||||
cut_assert_equal_int (0, res, cut_message ("read register 0xF0FF"));
|
||||
/* Read valid XRAM memory */
|
||||
res = pn53x_read_register (device, 0xF0FF, &value);
|
||||
cut_assert_equal_int (0, res, cut_message ("read register 0xF0FF"));
|
||||
|
||||
/* Read invalid SFR register */
|
||||
res = pn53x_read_register (device, 0xFFF0, &value);
|
||||
cut_assert_equal_int (0, res, cut_message ("read register 0xFFF0"));
|
||||
/* Read invalid SFR register */
|
||||
res = pn53x_read_register (device, 0xFFF0, &value);
|
||||
cut_assert_equal_int (0, res, cut_message ("read register 0xFFF0"));
|
||||
|
||||
nfc_close (device);
|
||||
nfc_exit (NULL);
|
||||
nfc_close (device);
|
||||
nfc_exit (NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue