mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
change: remove inline directive in armsrc, since we are optimizing for size
This commit is contained in:
parent
3e7512a5d5
commit
47634f5550
4 changed files with 11 additions and 28 deletions
|
@ -46,9 +46,9 @@ static mbedtls_des_context ctx;
|
||||||
static mbedtls_des3_context ctx3;
|
static mbedtls_des3_context ctx3;
|
||||||
static mbedtls_aes_context actx;
|
static mbedtls_aes_context actx;
|
||||||
|
|
||||||
static inline void update_key_schedules(desfirekey_t key);
|
static void update_key_schedules(desfirekey_t key);
|
||||||
|
|
||||||
static inline void update_key_schedules(desfirekey_t key) {
|
static void update_key_schedules(desfirekey_t key) {
|
||||||
// DES_set_key ((DES_cblock *)key->data, &(key->ks1));
|
// DES_set_key ((DES_cblock *)key->data, &(key->ks1));
|
||||||
// DES_set_key ((DES_cblock *)(key->data + 8), &(key->ks2));
|
// DES_set_key ((DES_cblock *)(key->data + 8), &(key->ks2));
|
||||||
// if (T_3K3DES == key->type) {
|
// if (T_3K3DES == key->type) {
|
||||||
|
|
|
@ -64,8 +64,7 @@ static uint32_t last_frame_end; /* ts of last bit of previews rx or tx frame */
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// I/O interface abstraction (FPGA -> ARM)
|
// I/O interface abstraction (FPGA -> ARM)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
static uint8_t rx_byte_from_fpga(void) {
|
||||||
static inline uint8_t rx_byte_from_fpga(void) {
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
|
|
||||||
|
@ -93,11 +92,7 @@ static inline uint8_t rx_byte_from_fpga(void) {
|
||||||
// Note: The SSC receiver is never synchronized the calculation may be performed
|
// Note: The SSC receiver is never synchronized the calculation may be performed
|
||||||
// on a i/q pair from two subsequent correlations, but does not matter.
|
// on a i/q pair from two subsequent correlations, but does not matter.
|
||||||
// Note: inlining this function would fail with -Os
|
// Note: inlining this function would fail with -Os
|
||||||
#ifdef __OPTIMIZE_SIZE__
|
|
||||||
static int32_t sample_power(void) {
|
static int32_t sample_power(void) {
|
||||||
#else
|
|
||||||
static inline int32_t sample_power(void) {
|
|
||||||
#endif
|
|
||||||
int32_t q = (int8_t)rx_byte_from_fpga();
|
int32_t q = (int8_t)rx_byte_from_fpga();
|
||||||
q = ABS(q);
|
q = ABS(q);
|
||||||
int32_t i = (int8_t)rx_byte_from_fpga();
|
int32_t i = (int8_t)rx_byte_from_fpga();
|
||||||
|
@ -115,11 +110,7 @@ static inline int32_t sample_power(void) {
|
||||||
// has a delay loop that aligns rx_bit calls to the TAG tx timeslots.
|
// has a delay loop that aligns rx_bit calls to the TAG tx timeslots.
|
||||||
|
|
||||||
// Note: inlining this function would fail with -Os
|
// Note: inlining this function would fail with -Os
|
||||||
#ifdef __OPTIMIZE_SIZE__
|
|
||||||
static bool rx_bit(void) {
|
static bool rx_bit(void) {
|
||||||
#else
|
|
||||||
static inline bool rx_bit(void) {
|
|
||||||
#endif
|
|
||||||
int32_t power;
|
int32_t power;
|
||||||
|
|
||||||
for (size_t i = 0; i < 5; ++i) {
|
for (size_t i = 0; i < 5; ++i) {
|
||||||
|
@ -138,7 +129,7 @@ static inline bool rx_bit(void) {
|
||||||
// be circumvented, but the adventage over bitbang would be little.
|
// be circumvented, but the adventage over bitbang would be little.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static inline void tx_bit(bool bit) {
|
static void tx_bit(bool bit) {
|
||||||
// insert pause
|
// insert pause
|
||||||
LOW(GPIO_SSC_DOUT);
|
LOW(GPIO_SSC_DOUT);
|
||||||
last_frame_end += RWD_TIME_PAUSE;
|
last_frame_end += RWD_TIME_PAUSE;
|
||||||
|
|
|
@ -66,11 +66,7 @@ static uint32_t last_frame_end; /* ts of last bit of previews rx or tx frame */
|
||||||
|
|
||||||
// Returns true if a pulse/pause is received within timeout
|
// Returns true if a pulse/pause is received within timeout
|
||||||
// Note: inlining this function would fail with -Os
|
// Note: inlining this function would fail with -Os
|
||||||
#ifdef __OPTIMIZE_SIZE__
|
|
||||||
static bool wait_for(bool value, const uint32_t timeout) {
|
static bool wait_for(bool value, const uint32_t timeout) {
|
||||||
#else
|
|
||||||
static inline bool wait_for(bool value, const uint32_t timeout) {
|
|
||||||
#endif
|
|
||||||
while ((bool)(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_DIN) != value) {
|
while ((bool)(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_DIN) != value) {
|
||||||
if (GetCountSspClk() > timeout) {
|
if (GetCountSspClk() > timeout) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -88,7 +84,7 @@ static inline bool wait_for(bool value, const uint32_t timeout) {
|
||||||
// - A bit length >80.2us is a 1
|
// - A bit length >80.2us is a 1
|
||||||
// - A bit length <80.2us is a 0
|
// - A bit length <80.2us is a 0
|
||||||
// - A bit length >148.6us is a code violation
|
// - A bit length >148.6us is a code violation
|
||||||
static inline int8_t rx_bit(void) {
|
static int8_t rx_bit(void) {
|
||||||
// backup ts for threshold calculation
|
// backup ts for threshold calculation
|
||||||
uint32_t bit_start = last_frame_end;
|
uint32_t bit_start = last_frame_end;
|
||||||
|
|
||||||
|
@ -132,11 +128,7 @@ static inline int8_t rx_bit(void) {
|
||||||
// not mandatory but results in a cleaner signal. tx_frame will disable
|
// not mandatory but results in a cleaner signal. tx_frame will disable
|
||||||
// the subcarrier when the frame is done.
|
// the subcarrier when the frame is done.
|
||||||
// Note: inlining this function would fail with -Os
|
// Note: inlining this function would fail with -Os
|
||||||
#ifdef __OPTIMIZE_SIZE__
|
|
||||||
static void tx_bit(bool bit) {
|
static void tx_bit(bool bit) {
|
||||||
#else
|
|
||||||
static inline void tx_bit(bool bit) {
|
|
||||||
#endif
|
|
||||||
LED_C_ON();
|
LED_C_ON();
|
||||||
|
|
||||||
if (bit) {
|
if (bit) {
|
||||||
|
|
|
@ -127,7 +127,7 @@ typedef struct {
|
||||||
|
|
||||||
|
|
||||||
// internal buffer output
|
// internal buffer output
|
||||||
static inline void _out_buffer(char character, void *buffer, size_t idx, size_t maxlen) {
|
static void _out_buffer(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||||
if (idx < maxlen) {
|
if (idx < maxlen) {
|
||||||
((char *)buffer)[idx] = character;
|
((char *)buffer)[idx] = character;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ static inline void _out_buffer(char character, void *buffer, size_t idx, size_t
|
||||||
|
|
||||||
|
|
||||||
// internal null output
|
// internal null output
|
||||||
static inline void _out_null(char character, void *buffer, size_t idx, size_t maxlen) {
|
static void _out_null(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||||
(void)character;
|
(void)character;
|
||||||
(void)buffer;
|
(void)buffer;
|
||||||
(void)idx;
|
(void)idx;
|
||||||
|
@ -144,7 +144,7 @@ static inline void _out_null(char character, void *buffer, size_t idx, size_t ma
|
||||||
|
|
||||||
|
|
||||||
// internal _putchar wrapper
|
// internal _putchar wrapper
|
||||||
static inline void _out_char(char character, void *buffer, size_t idx, size_t maxlen) {
|
static void _out_char(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||||
(void)buffer;
|
(void)buffer;
|
||||||
(void)idx;
|
(void)idx;
|
||||||
(void)maxlen;
|
(void)maxlen;
|
||||||
|
@ -155,7 +155,7 @@ static inline void _out_char(char character, void *buffer, size_t idx, size_t ma
|
||||||
|
|
||||||
|
|
||||||
// internal output function wrapper
|
// internal output function wrapper
|
||||||
static inline void _out_fct(char character, void *buffer, size_t idx, size_t maxlen) {
|
static void _out_fct(char character, void *buffer, size_t idx, size_t maxlen) {
|
||||||
(void)idx;
|
(void)idx;
|
||||||
(void)maxlen;
|
(void)maxlen;
|
||||||
if (character) {
|
if (character) {
|
||||||
|
@ -167,7 +167,7 @@ static inline void _out_fct(char character, void *buffer, size_t idx, size_t max
|
||||||
|
|
||||||
// internal secure strlen
|
// internal secure strlen
|
||||||
// \return The length of the string (excluding the terminating 0) limited by 'maxsize'
|
// \return The length of the string (excluding the terminating 0) limited by 'maxsize'
|
||||||
static inline unsigned int _strnlen_s(const char *str, size_t maxsize) {
|
static unsigned int _strnlen_s(const char *str, size_t maxsize) {
|
||||||
const char *s;
|
const char *s;
|
||||||
for (s = str; *s && maxsize--; ++s);
|
for (s = str; *s && maxsize--; ++s);
|
||||||
return (unsigned int)(s - str);
|
return (unsigned int)(s - str);
|
||||||
|
@ -176,7 +176,7 @@ static inline unsigned int _strnlen_s(const char *str, size_t maxsize) {
|
||||||
|
|
||||||
// internal test if char is a digit (0-9)
|
// internal test if char is a digit (0-9)
|
||||||
// \return true if char is a digit
|
// \return true if char is a digit
|
||||||
static inline bool _is_digit(char ch) {
|
static bool _is_digit(char ch) {
|
||||||
return (ch >= '0') && (ch <= '9');
|
return (ch >= '0') && (ch <= '9');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue