Commit 2db4a0e7 authored by Philippe Teuwen's avatar Philippe Teuwen

make style

new version of astyle, better separation of XOR
parent a5d40cef
......@@ -38,29 +38,29 @@
extern "C" {
#endif /* __cplusplus */
struct nfc_emulator;
struct nfc_emulation_state_machine;
struct nfc_emulator;
struct nfc_emulation_state_machine;
/**
* @struct nfc_emulator
* @brief NFC emulator structure
*/
struct nfc_emulator {
nfc_target *target;
struct nfc_emulation_state_machine *state_machine;
void *user_data;
};
/**
* @struct nfc_emulator
* @brief NFC emulator structure
*/
struct nfc_emulator {
nfc_target *target;
struct nfc_emulation_state_machine *state_machine;
void *user_data;
};
/**
* @struct nfc_emulation_state_machine
* @brief NFC emulation state machine structure
*/
struct nfc_emulation_state_machine {
int (*io)(struct nfc_emulator *emulator, const uint8_t *data_in, const size_t data_in_len, uint8_t *data_out, const size_t data_out_len);
void *data;
};
/**
* @struct nfc_emulation_state_machine
* @brief NFC emulation state machine structure
*/
struct nfc_emulation_state_machine {
int (*io)(struct nfc_emulator *emulator, const uint8_t *data_in, const size_t data_in_len, uint8_t *data_out, const size_t data_out_len);
void *data;
};
NFC_EXPORT int nfc_emulate_target(nfc_device *pnd, struct nfc_emulator *emulator, const int timeout);
NFC_EXPORT int nfc_emulate_target(nfc_device *pnd, struct nfc_emulator *emulator, const int timeout);
#ifdef __cplusplus
}
......
This diff is collapsed.
......@@ -1466,10 +1466,10 @@ static uint32_t __pn53x_get_timer(struct nfc_device *pnd, const uint8_t last_cmd
u32cycles -= (5 * 128);
}
// Correction depending on last parity bit sent
parity = (last_cmd_byte >> 7) ^((last_cmd_byte >> 6) & 1) ^
((last_cmd_byte >> 5) & 1) ^((last_cmd_byte >> 4) & 1) ^
((last_cmd_byte >> 3) & 1) ^((last_cmd_byte >> 2) & 1) ^
((last_cmd_byte >> 1) & 1) ^(last_cmd_byte & 1);
parity = (last_cmd_byte >> 7) ^ ((last_cmd_byte >> 6) & 1) ^
((last_cmd_byte >> 5) & 1) ^ ((last_cmd_byte >> 4) & 1) ^
((last_cmd_byte >> 3) & 1) ^ ((last_cmd_byte >> 2) & 1) ^
((last_cmd_byte >> 1) & 1) ^ (last_cmd_byte & 1);
parity = parity ? 0 : 1;
// When sent ...YY (cmd ends with logical 1, so when last parity bit is 1):
if (parity) {
......@@ -2917,7 +2917,7 @@ pn53x_nm_to_ptt(const nfc_modulation nm)
}
int
pn53x_get_supported_modulation(nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type * *const supported_mt)
pn53x_get_supported_modulation(nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type **const supported_mt)
{
switch (mode) {
case N_TARGET:
......@@ -2933,7 +2933,7 @@ pn53x_get_supported_modulation(nfc_device *pnd, const nfc_mode mode, const nfc_m
}
int
pn53x_get_supported_baud_rate(nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate * *const supported_br)
pn53x_get_supported_baud_rate(nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br)
{
switch (nmt) {
case NMT_FELICA:
......
......@@ -51,9 +51,9 @@ iso14443a_crc(uint8_t *pbtData, size_t szLen, uint8_t *pbtCrc)
do {
bt = *pbtData++;
bt = (bt ^(uint8_t)(wCrc & 0x00FF));
bt = (bt ^(bt << 4));
wCrc = (wCrc >> 8) ^((uint32_t) bt << 8) ^((uint32_t) bt << 3) ^((uint32_t) bt >> 4);
bt = (bt ^ (uint8_t)(wCrc & 0x00FF));
bt = (bt ^ (bt << 4));
wCrc = (wCrc >> 8) ^ ((uint32_t) bt << 8) ^ ((uint32_t) bt << 3) ^ ((uint32_t) bt >> 4);
} while (--szLen);
*pbtCrc++ = (uint8_t)(wCrc & 0xFF);
......
......@@ -45,7 +45,7 @@ uint8_t
oddparity(const uint8_t bt)
{
// cf http://graphics.stanford.edu/~seander/bithacks.html#ParityParallel
return (0x9669 >> ((bt ^(bt >> 4)) & 0xF)) & 1;
return (0x9669 >> ((bt ^ (bt >> 4)) & 0xF)) & 1;
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment