Compiler abstraction layer and code utilities for Cortex-M0+ based Atmel SAM devices.
This module provides various abstraction layers and utilities to make code compatible between different compilers.
Modules | |
Status Codes | |
Preprocessor - Macro Repeat | |
Preprocessor - Stringize | |
Preprocessor - Macro Recursion | |
Preprocessor - Token Paste | |
Data Structures | |
struct | StructCPtr |
Structure of pointers to constant 64-, 32-, 16- and 8-bit unsigned integers. More... | |
struct | StructCVPtr |
Structure of pointers to constant volatile 64-, 32-, 16- and 8-bit unsigned integers. More... | |
struct | StructPtr |
Structure of pointers to 64-, 32-, 16- and 8-bit unsigned integers. More... | |
struct | StructVPtr |
Structure of pointers to volatile 64-, 32-, 16- and 8-bit unsigned integers. More... | |
union | Union16 |
16-bit union. More... | |
union | Union32 |
32-bit union. More... | |
union | Union64 |
64-bit union. More... | |
union | UnionCPtr |
Union of pointers to constant 64-, 32-, 16- and 8-bit unsigned integers. More... | |
union | UnionCVPtr |
Union of pointers to constant volatile 64-, 32-, 16- and 8-bit unsigned integers. More... | |
union | UnionPtr |
Union of pointers to 64-, 32-, 16- and 8-bit unsigned integers. More... | |
union | UnionVPtr |
Union of pointers to volatile 64-, 32-, 16- and 8-bit unsigned integers. More... | |
Macros | |
#define | __always_inline __attribute__((__always_inline__)) |
The function should always be inlined. More... | |
#define | __no_inline __attribute__((noinline)) |
The function should never be inlined. More... | |
#define | ADDR_COPY_DST_SRC_16(dst, src) ((dst) = (src)) |
#define | ADDR_COPY_DST_SRC_64(dst, src) ((dst) = (src)) |
#define | barrier() asm volatile("" ::: "memory") |
Memory barrier. More... | |
#define | CCPU_ENDIAN_TO_LE16(x) (x) |
#define | CCPU_ENDIAN_TO_LE32(x) (x) |
#define | CCPU_ENDIAN_TO_LE64(x) (x) |
#define | CLE16_TO_CPU_ENDIAN(x) (x) |
#define | CLE32_TO_CPU_ENDIAN(x) (x) |
#define | CLE64_TO_CPU_ENDIAN(x) (x) |
#define | CMD_ID_OCTET (0) |
#define | COMPILER_ALIGNED(a) __attribute__((__aligned__(a))) |
Set aligned boundary. More... | |
#define | COMPILER_PACK_RESET() COMPILER_PRAGMA(pack()) |
Set default alignment for subsequent struct and union definitions. More... | |
#define | COMPILER_PACK_SET(alignment) COMPILER_PRAGMA(pack(alignment)) |
Set maximum alignment for subsequent struct and union definitions to alignment. More... | |
#define | COMPILER_PRAGMA(arg) _Pragma(#arg) |
Emit the compiler pragma arg. More... | |
#define | COMPILER_WORD_ALIGNED __attribute__((__aligned__(4))) |
Set word-aligned boundary. More... | |
#define | CPU_ENDIAN_TO_LE16(x) (x) |
#define | CPU_ENDIAN_TO_LE32(x) (x) |
#define | CPU_ENDIAN_TO_LE64(x) (x) |
#define | div_ceil(a, b) (((a) + (b) - 1) / (b)) |
Calculate \( \left\lceil \frac{a}{b} \right\rceil \) using integer arithmetic. More... | |
#define | FAIL 1 |
#define | FLASH_DECLARE(x) const x |
#define | FLASH_EXTERN(x) extern const x |
#define | FUNC_PTR void * |
#define | HIGH 1 |
#define | LE16_TO_CPU_ENDIAN(x) (x) |
#define | LE32_TO_CPU_ENDIAN(x) (x) |
#define | LE64_TO_CPU_ENDIAN(x) (x) |
#define | Long_call(addr) ((*(void (*)(void))(addr))()) |
Calls the routine at address addr. More... | |
#define | LOW 0 |
#define | LSB(u16) (((U8 *)&(u16))[0]) |
Least significant byte of u16. More... | |
#define | LSB0(u32) LSB0W(u32) |
Least significant byte of 1st rank of u32. More... | |
#define | LSB0D(u64) MSB7D(u64) |
Least significant byte of 1st rank of u64. More... | |
#define | LSB0W(u32) MSB3W(u32) |
Least significant byte of 1st rank of u32. More... | |
#define | LSB1(u32) LSB1W(u32) |
Least significant byte of 2nd rank of u32. More... | |
#define | LSB1D(u64) MSB6D(u64) |
Least significant byte of 2nd rank of u64. More... | |
#define | LSB1W(u32) MSB2W(u32) |
Least significant byte of 2nd rank of u32. More... | |
#define | LSB2(u32) LSB2W(u32) |
Least significant byte of 3rd rank of u32. More... | |
#define | LSB2D(u64) MSB5D(u64) |
Least significant byte of 3rd rank of u64. More... | |
#define | LSB2W(u32) MSB1W(u32) |
Least significant byte of 3rd rank of u32. More... | |
#define | LSB3(u32) LSB3W(u32) |
Least significant byte of 4th rank of u32. More... | |
#define | LSB3D(u64) MSB4D(u64) |
Least significant byte of 4th rank of u64. More... | |
#define | LSB3W(u32) MSB0W(u32) |
Least significant byte of 4th rank of u32. More... | |
#define | LSB4D(u64) MSB3D(u64) |
Least significant byte of 5th rank of u64. More... | |
#define | LSB5D(u64) MSB2D(u64) |
Least significant byte of 6th rank of u64. More... | |
#define | LSB6D(u64) MSB1D(u64) |
Least significant byte of 7th rank of u64. More... | |
#define | LSB7D(u64) MSB0D(u64) |
Least significant byte of 8th rank of u64. More... | |
#define | LSH(u32) (((U16 *)&(u32))[0]) |
Least significant half-word of u32. More... | |
#define | LSH0(u64) MSH3(u64) |
Least significant half-word of 1st rank of u64. More... | |
#define | LSH1(u64) MSH2(u64) |
Least significant half-word of 2nd rank of u64. More... | |
#define | LSH2(u64) MSH1(u64) |
Least significant half-word of 3rd rank of u64. More... | |
#define | LSH3(u64) MSH0(u64) |
Least significant half-word of 4th rank of u64. More... | |
#define | LSW(u64) (((U32 *)&(u64))[0]) |
Least significant word of u64. More... | |
#define | MEMCPY_ENDIAN memcpy |
#define | MSB(u16) (((U8 *)&(u16))[1]) |
Most significant byte of u16. More... | |
#define | MSB0(u32) MSB0W(u32) |
Most significant byte of 1st rank of u32. More... | |
#define | MSB0D(u64) (((U8 *)&(u64))[7]) |
Most significant byte of 1st rank of u64. More... | |
#define | MSB0W(u32) (((U8 *)&(u32))[3]) |
Most significant byte of 1st rank of u32. More... | |
#define | MSB1(u32) MSB1W(u32) |
Most significant byte of 2nd rank of u32. More... | |
#define | MSB1D(u64) (((U8 *)&(u64))[6]) |
Most significant byte of 2nd rank of u64. More... | |
#define | MSB1W(u32) (((U8 *)&(u32))[2]) |
Most significant byte of 2nd rank of u32. More... | |
#define | MSB2(u32) MSB2W(u32) |
Most significant byte of 3rd rank of u32. More... | |
#define | MSB2D(u64) (((U8 *)&(u64))[5]) |
Most significant byte of 3rd rank of u64. More... | |
#define | MSB2W(u32) (((U8 *)&(u32))[1]) |
Most significant byte of 3rd rank of u32. More... | |
#define | MSB3(u32) MSB3W(u32) |
Most significant byte of 4th rank of u32. More... | |
#define | MSB3D(u64) (((U8 *)&(u64))[4]) |
Most significant byte of 4th rank of u64. More... | |
#define | MSB3W(u32) (((U8 *)&(u32))[0]) |
Most significant byte of 4th rank of u32. More... | |
#define | MSB4D(u64) (((U8 *)&(u64))[3]) |
Most significant byte of 5th rank of u64. More... | |
#define | MSB5D(u64) (((U8 *)&(u64))[2]) |
Most significant byte of 6th rank of u64. More... | |
#define | MSB6D(u64) (((U8 *)&(u64))[1]) |
Most significant byte of 7th rank of u64. More... | |
#define | MSB7D(u64) (((U8 *)&(u64))[0]) |
Most significant byte of 8th rank of u64. More... | |
#define | MSH(u32) (((U16 *)&(u32))[1]) |
Most significant half-word of u32. More... | |
#define | MSH0(u64) (((U16 *)&(u64))[3]) |
Most significant half-word of 1st rank of u64. More... | |
#define | MSH1(u64) (((U16 *)&(u64))[2]) |
Most significant half-word of 2nd rank of u64. More... | |
#define | MSH2(u64) (((U16 *)&(u64))[1]) |
Most significant half-word of 3rd rank of u64. More... | |
#define | MSH3(u64) (((U16 *)&(u64))[0]) |
Most significant half-word of 4th rank of u64. More... | |
#define | MSW(u64) (((U32 *)&(u64))[1]) |
Most significant word of u64. More... | |
#define | NO_INIT __attribute__((section(".no_init"))) |
#define | nop() __NOP() |
#define | OPTIMIZE_HIGH __attribute__((optimize("s"))) |
#define | PASS 0 |
#define | PGM_READ_BLOCK(dst, src, len) memcpy((dst), (src), (len)) |
#define | PGM_READ_BYTE(x) *(x) |
#define | PGM_READ_WORD(x) *(x) |
#define | RAMFUNC __attribute__ ((section(".ramfunc"))) |
#define | SHORTENUM __attribute__((packed)) |
#define | UNUSED(v) (void)(v) |
Marking v as a unused parameter or value. More... | |
#define | unused(v) do { (void)(v); } while(0) |
Marking v as a unused parameter or value. More... | |
#define | WEAK __attribute__ ((weak)) |
This macro is used to test fatal errors. More... | |
Typedefs | |
typedef float | F32 |
32-bit floating-point number. More... | |
typedef double | F64 |
64-bit floating-point number. More... | |
typedef int16_t | S16 |
16-bit signed integer. More... | |
typedef int32_t | S32 |
32-bit signed integer. More... | |
typedef int64_t | S64 |
64-bit signed integer. More... | |
typedef int8_t | S8 |
8-bit signed integer. More... | |
typedef uint16_t | U16 |
16-bit unsigned integer. More... | |
typedef uint32_t | U32 |
32-bit unsigned integer. More... | |
typedef uint64_t | U64 |
64-bit unsigned integer. More... | |
typedef uint8_t | U8 |
8-bit unsigned integer. More... | |
Functions | |
static void | convert_16_bit_to_byte_address (uint16_t value, uint8_t *data) |
static void | convert_16_bit_to_byte_array (uint16_t value, uint8_t *data) |
Converts a 16-Bit value into a 2 Byte array. More... | |
static void | convert_64_bit_to_byte_array (uint64_t value, uint8_t *data) |
Converts a 64-Bit value into a 8 Byte array. More... | |
static uint16_t | convert_byte_array_to_16_bit (uint8_t *data) |
static uint32_t | convert_byte_array_to_32_bit (uint8_t *data) |
static uint64_t | convert_byte_array_to_64_bit (uint8_t *data) |
Converts a 8 Byte array into a 64-Bit value. More... | |
static void | convert_spec_16_bit_to_byte_array (uint16_t value, uint8_t *data) |
Usual Types | |
typedef unsigned char | bool |
typedef uint16_t | le16_t |
typedef uint16_t | be16_t |
typedef uint32_t | le32_t |
typedef uint32_t | be32_t |
typedef uint32_t | iram_size_t |
Usual Constants | |
#define | DISABLE 0 |
#define | ENABLE 1 |
#define | false 0 |
#define | true 1 |
Optimization Control | |
#define | likely(exp) (exp) |
The expression exp is likely to be true. More... | |
#define | unlikely(exp) (exp) |
The expression exp is unlikely to be true. More... | |
#define | is_constant(exp) __builtin_constant_p(exp) |
Determine if an expression evaluates to a constant value. More... | |
Bit-Field Handling | |
#define | Rd_bits(value, mask) ((value) & (mask)) |
Reads the bits of a value specified by a given bit-mask. More... | |
#define | Wr_bits(lvalue, mask, bits) |
Writes the bits of a C lvalue specified by a given bit-mask. More... | |
#define | Tst_bits(value, mask) (Rd_bits(value, mask) != 0) |
Tests the bits of a value specified by a given bit-mask. More... | |
#define | Clr_bits(lvalue, mask) ((lvalue) &= ~(mask)) |
Clears the bits of a C lvalue specified by a given bit-mask. More... | |
#define | Set_bits(lvalue, mask) ((lvalue) |= (mask)) |
Sets the bits of a C lvalue specified by a given bit-mask. More... | |
#define | Tgl_bits(lvalue, mask) ((lvalue) ^= (mask)) |
Toggles the bits of a C lvalue specified by a given bit-mask. More... | |
#define | Rd_bitfield(value, mask) (Rd_bits( value, mask) >> ctz(mask)) |
Reads the bit-field of a value specified by a given bit-mask. More... | |
#define | Wr_bitfield(lvalue, mask, bitfield) (Wr_bits(lvalue, mask, (uint32_t)(bitfield) << ctz(mask))) |
Writes the bit-field of a C lvalue specified by a given bit-mask. More... | |
Zero-Bit Counting | |
Under GCC, __builtin_clz and __builtin_ctz behave like macros when applied to constant expressions (values known at compile time), so they are more optimized than the use of the corresponding assembly instructions and they can be used as constant expressions e.g. to initialize objects having static storage duration, and like the corresponding assembly instructions when applied to non-constant expressions (values unknown at compile time), so they are more optimized than an assembly periphrasis. Hence, clz and ctz ensure a possible and optimized behavior for both constant and non-constant expressions. | |
#define | clz(u) ((u) ? __builtin_clz(u) : 32) |
Counts the leading zero bits of the given value considered as a 32-bit integer. More... | |
#define | ctz(u) ((u) ? __builtin_ctz(u) : 32) |
Counts the trailing zero bits of the given value considered as a 32-bit integer. More... | |
Bit Reversing | |
#define | bit_reverse8(u8) ((U8)(bit_reverse32((U8)(u8)) >> 24)) |
Reverses the bits of u8. More... | |
#define | bit_reverse16(u16) ((uint16_t)(bit_reverse32((uint16_t)(u16)) >> 16)) |
Reverses the bits of u16. More... | |
#define | bit_reverse32(u32) __RBIT(u32) |
Reverses the bits of u32. More... | |
#define | bit_reverse64(u64) |
Reverses the bits of u64. More... | |
Alignment | |
#define | Test_align(val, n) (!Tst_bits( val, (n) - 1 ) ) |
Tests alignment of the number val with the n boundary. More... | |
#define | Get_align(val, n) ( Rd_bits( val, (n) - 1 ) ) |
Gets alignment of the number val with respect to the n boundary. More... | |
#define | Set_align(lval, n, alg) ( Wr_bits(lval, (n) - 1, alg) ) |
Sets alignment of the lvalue number lval to alg with respect to the n boundary. More... | |
#define | Align_up(val, n) (((val) + ((n) - 1)) & ~((n) - 1)) |
Aligns the number val with the upper n boundary. More... | |
#define | Align_down(val, n) ( (val) & ~((n) - 1)) |
Aligns the number val with the lower n boundary. More... | |
Mathematics | |
The same considerations as for clz and ctz apply here but GCC does not provide built-in functions to access the assembly instructions abs, min and max and it does not produce them by itself in most cases, so two sets of macros are defined here:
| |
#define | Abs(a) (((a) < 0 ) ? -(a) : (a)) |
Takes the absolute value of a. More... | |
#define | Min(a, b) (((a) < (b)) ? (a) : (b)) |
Takes the minimal value of a and b. More... | |
#define | Max(a, b) (((a) > (b)) ? (a) : (b)) |
Takes the maximal value of a and b. More... | |
#define | min(a, b) Min(a, b) |
Takes the minimal value of a and b. More... | |
#define | max(a, b) Max(a, b) |
Takes the maximal value of a and b. More... | |
MCU Endianism Handling | |
#define | BE16(x) swap16(x) |
#define | LE16(x) (x) |
#define | le16_to_cpu(x) (x) |
#define | cpu_to_le16(x) (x) |
#define | LE16_TO_CPU(x) (x) |
#define | CPU_TO_LE16(x) (x) |
#define | be16_to_cpu(x) swap16(x) |
#define | cpu_to_be16(x) swap16(x) |
#define | BE16_TO_CPU(x) swap16(x) |
#define | CPU_TO_BE16(x) swap16(x) |
#define | le32_to_cpu(x) (x) |
#define | cpu_to_le32(x) (x) |
#define | LE32_TO_CPU(x) (x) |
#define | CPU_TO_LE32(x) (x) |
#define | be32_to_cpu(x) swap32(x) |
#define | cpu_to_be32(x) swap32(x) |
#define | BE32_TO_CPU(x) swap32(x) |
#define | CPU_TO_BE32(x) swap32(x) |
Endianism Conversion | |
The same considerations as for clz and ctz apply here but GCC's __builtin_bswap_32 and __builtin_bswap_64 do not behave like macros when applied to constant expressions, so two sets of macros are defined here:
| |
#define | Swap16(u16) |
Toggles the endianism of u16 (by swapping its bytes). More... | |
#define | Swap32(u32) |
Toggles the endianism of u32 (by swapping its bytes). More... | |
#define | Swap64(u64) |
Toggles the endianism of u64 (by swapping its bytes). More... | |
#define | swap16(u16) Swap16(u16) |
Toggles the endianism of u16 (by swapping its bytes). More... | |
#define | swap32(u32) ((uint32_t)__builtin_bswap32((uint32_t)(u32))) |
Toggles the endianism of u32 (by swapping its bytes). More... | |
#define | swap64(u64) ((uint64_t)__builtin_bswap64((uint64_t)(u64))) |
Toggles the endianism of u64 (by swapping its bytes). More... | |
Target Abstraction | |
#define | _GLOBEXT_ extern |
extern storage-class specifier. More... | |
#define | _CONST_TYPE_ const |
const type qualifier. More... | |
#define | _MEM_TYPE_SLOW_ |
Slow memory type. More... | |
#define | _MEM_TYPE_MEDFAST_ |
Fairly fast memory type. More... | |
#define | _MEM_TYPE_FAST_ |
Fast memory type. More... | |
#define | memcmp_ram2ram memcmp |
Target-specific memcmp of RAM to RAM. More... | |
#define | memcmp_code2ram memcmp |
Target-specific memcmp of RAM to NVRAM. More... | |
#define | memcpy_ram2ram memcpy |
Target-specific memcpy from RAM to RAM. More... | |
#define | memcpy_code2ram memcpy |
Target-specific memcpy from NVRAM to RAM. More... | |
#define __always_inline __attribute__((__always_inline__)) |
The function should always be inlined.
This annotation instructs the compiler to ignore its inlining heuristics and inline the function no matter how big it thinks it becomes.
#define __no_inline __attribute__((noinline)) |
The function should never be inlined.
This annotation instructs the compiler to ignore its inlining heuristics and not inline the function no matter how small it thinks it becomes.
#define _CONST_TYPE_ const |
const type qualifier.
#define _GLOBEXT_ extern |
extern storage-class specifier.
#define _MEM_TYPE_FAST_ |
Fast memory type.
#define _MEM_TYPE_MEDFAST_ |
Fairly fast memory type.
#define _MEM_TYPE_SLOW_ |
Slow memory type.
#define Abs | ( | a | ) | (((a) < 0 ) ? -(a) : (a)) |
Takes the absolute value of a.
[in] | a | Input value. |
Referenced by init_xosc32k_fail_detector().
#define ADDR_COPY_DST_SRC_16 | ( | dst, | |
src | |||
) | ((dst) = (src)) |
Referenced by handle_gts_data_req(), mac_process_data_frame(), mcps_data_request(), and mlme_get().
#define ADDR_COPY_DST_SRC_64 | ( | dst, | |
src | |||
) | ((dst) = (src)) |
Referenced by mac_process_data_frame(), mcps_data_ind(), mlme_get(), and wpan_mcps_data_req().
Aligns the number val with the lower n boundary.
[in] | val | Input value. |
[in] | n | Boundary. |
Aligns the number val with the upper n boundary.
[in] | val | Input value. |
[in] | n | Boundary. |
#define barrier | ( | ) | asm volatile("" ::: "memory") |
Memory barrier.
Referenced by eeprom_emulator_commit_page_buffer(), eeprom_emulator_write_page(), rww_eeprom_emulator_commit_page_buffer(), rww_eeprom_emulator_write_page(), ser_fifo_pull_uint16(), ser_fifo_pull_uint16_nocheck(), ser_fifo_pull_uint32(), ser_fifo_pull_uint32_nocheck(), ser_fifo_pull_uint8(), ser_fifo_pull_uint8_nocheck(), ser_fifo_push_uint16(), ser_fifo_push_uint16_nocheck(), ser_fifo_push_uint32(), ser_fifo_push_uint32_nocheck(), ser_fifo_push_uint8(), and ser_fifo_push_uint8_nocheck().
#define BE16 | ( | x | ) | swap16(x) |
#define be16_to_cpu | ( | x | ) | swap16(x) |
Referenced by ieee11073_decode_metadata().
#define BE16_TO_CPU | ( | x | ) | swap16(x) |
#define be32_to_cpu | ( | x | ) | swap32(x) |
Referenced by uhi_msc_scsi_read_capacity_done().
#define BE32_TO_CPU | ( | x | ) | swap32(x) |
#define bit_reverse16 | ( | u16 | ) | ((uint16_t)(bit_reverse32((uint16_t)(u16)) >> 16)) |
Reverses the bits of u16.
[in] | u16 | U16 of which to reverse the bits. |
#define bit_reverse32 | ( | u32 | ) | __RBIT(u32) |
Reverses the bits of u32.
[in] | u32 | U32 of which to reverse the bits. |
#define bit_reverse64 | ( | u64 | ) |
Reverses the bits of u64.
[in] | u64 | U64 of which to reverse the bits. |
#define bit_reverse8 | ( | u8 | ) | ((U8)(bit_reverse32((U8)(u8)) >> 24)) |
Reverses the bits of u8.
[in] | u8 | U8 of which to reverse the bits. |
#define CCPU_ENDIAN_TO_LE16 | ( | x | ) | (x) |
#define CCPU_ENDIAN_TO_LE32 | ( | x | ) | (x) |
#define CCPU_ENDIAN_TO_LE64 | ( | x | ) | (x) |
#define CLE16_TO_CPU_ENDIAN | ( | x | ) | (x) |
Referenced by parse_mpdu().
#define CLE32_TO_CPU_ENDIAN | ( | x | ) | (x) |
#define CLE64_TO_CPU_ENDIAN | ( | x | ) | (x) |
#define Clr_bits | ( | lvalue, | |
mask | |||
) | ((lvalue) &= ~(mask)) |
Clears the bits of a C lvalue specified by a given bit-mask.
[in] | lvalue | C lvalue of which to clear bits. |
[in] | mask | Bit-mask indicating bits to clear. |
#define clz | ( | u | ) | ((u) ? __builtin_clz(u) : 32) |
Counts the leading zero bits of the given value considered as a 32-bit integer.
[in] | u | Value of which to count the leading zero bits. |
Referenced by udd_ctrl_ep_enable(), and usb_host_pipe_set_config().
#define CMD_ID_OCTET (0) |
Referenced by dispatch_event().
#define COMPILER_ALIGNED | ( | a | ) | __attribute__((__aligned__(a))) |
Set aligned boundary.
Referenced by stream_mem_to_mem().
#define COMPILER_PACK_RESET | ( | ) | COMPILER_PRAGMA(pack()) |
Set default alignment for subsequent struct and union definitions.
#define COMPILER_PACK_SET | ( | alignment | ) | COMPILER_PRAGMA(pack(alignment)) |
Set maximum alignment for subsequent struct and union definitions to alignment.
#define COMPILER_PRAGMA | ( | arg | ) | _Pragma(#arg) |
Emit the compiler pragma arg.
[in] | arg | The pragma directive as it would appear after #pragma (i.e. not stringified). |
#define COMPILER_WORD_ALIGNED __attribute__((__aligned__(4))) |
Set word-aligned boundary.
#define CPU_ENDIAN_TO_LE16 | ( | x | ) | (x) |
Referenced by assign_new_short_addr(), and wpan_mcps_data_req().
#define CPU_ENDIAN_TO_LE32 | ( | x | ) | (x) |
#define CPU_ENDIAN_TO_LE64 | ( | x | ) | (x) |
#define cpu_to_be16 | ( | x | ) | swap16(x) |
Referenced by udi_msc_spc_mode_sense().
#define CPU_TO_BE16 | ( | x | ) | swap16(x) |
#define cpu_to_be32 | ( | x | ) | swap32(x) |
Referenced by udi_msc_sbc_read_capacity().
#define CPU_TO_BE32 | ( | x | ) | swap32(x) |
Referenced by UDC_BSS(), udi_msc_cbw_received(), udi_msc_sbc_read_capacity(), and uhi_msc_csw_received().
#define cpu_to_le16 | ( | x | ) | (x) |
#define CPU_TO_LE16 | ( | x | ) | (x) |
Referenced by udc_req_std_dev_clear_feature(), udc_req_std_dev_set_feature(), udc_reset(), and udi_cdc_comm_enable().
#define cpu_to_le32 | ( | x | ) | (x) |
Referenced by udi_msc_csw_process(), uhi_msc_cbw_sent(), and uhi_msc_scsi().
#define CPU_TO_LE32 | ( | x | ) | (x) |
Referenced by udi_cdc_comm_enable().
#define ctz | ( | u | ) | ((u) ? __builtin_ctz(u) : 32) |
Counts the trailing zero bits of the given value considered as a 32-bit integer.
[in] | u | Value of which to count the trailing zero bits. |
Referenced by _usb_host_interrupt_handler().
#define DISABLE 0 |
#define div_ceil | ( | a, | |
b | |||
) | (((a) + (b) - 1) / (b)) |
Calculate \( \left\lceil \frac{a}{b} \right\rceil \) using integer arithmetic.
[in] | a | An integer |
[in] | b | Another integer |
#define ENABLE 1 |
#define FAIL 1 |
#define false 0 |
#define FLASH_DECLARE | ( | x | ) | const x |
#define FLASH_EXTERN | ( | x | ) | extern const x |
#define FUNC_PTR void * |
Referenced by app_led_event(), bc_data_cb(), bcn_payload_update_cb(), csma_backoff_calculation(), gts_data_cb(), indirect_data_cb(), led_blinker_timer_handler_cb(), mac_process_tal_tx_status(), mac_t_gts_cb(), marker_rsp_timer_handler_cb(), marker_tx_timer_handler_cb(), network_search_indication_cb(), peer_req_send_task(), per_mode_initiator_init(), per_mode_initiator_rx_cb(), per_mode_initiator_task(), per_mode_receptor_rx_cb(), per_mode_receptor_task(), pktstream_test(), process_data_ind_not_transient(), range_test_timer_handler_cb(), range_test_tx_on_init(), range_test_tx_timer_handler_cb(), rf212_init(), rf233_init(), send_range_test_marker_rsp(), send_remote_cmd(), serial_data_handler(), set_trx_state(), start_beacon_loss_timer(), start_range_test(), stop_pkt_streaming(), tal_init(), tal_reset(), tal_trx_wakeup(), usr_mcps_data_ind(), usr_mlme_gts_ind(), and wait_for_conf_init().
Gets alignment of the number val with respect to the n boundary.
[in] | val | Input value. |
[in] | n | Boundary. |
#define HIGH 1 |
Referenced by adc_window_monitor(), get_batmon_voltage(), and tfa_get_batmon_voltage().
#define is_constant | ( | exp | ) | __builtin_constant_p(exp) |
Determine if an expression evaluates to a constant value.
[in] | exp | Any expression |
#define LE16 | ( | x | ) | (x) |
Referenced by udi_cdc_comm_enable(), and uhc_enumeration_step15().
#define le16_to_cpu | ( | x | ) | (x) |
Referenced by udc_get_eof_conf(), udc_iface_enable(), udc_req_std_dev_get_descriptor(), udi_hid_reqstdifaceget_descriptor(), uhc_dev_get_string(), uhc_enumeration_step13(), uhc_enumeration_step14(), uhc_enumeration_step17_lpm(), uhc_enumeration_step18_lpm(), uhd_ep_alloc(), uhi_aoa_install(), uhi_aoa_mode_enable_step2(), uhi_cdc_install(), uhi_hid_mouse_install(), and uhi_vendor_install().
#define LE16_TO_CPU | ( | x | ) | (x) |
#define LE16_TO_CPU_ENDIAN | ( | x | ) | (x) |
Referenced by usr_mcps_data_ind().
#define le32_to_cpu | ( | x | ) | (x) |
Referenced by udi_msc_cbw_received(), and uhi_msc_csw_received().
#define LE32_TO_CPU | ( | x | ) | (x) |
Referenced by uart_config().
#define LE32_TO_CPU_ENDIAN | ( | x | ) | (x) |
#define LE64_TO_CPU_ENDIAN | ( | x | ) | (x) |
#define likely | ( | exp | ) | (exp) |
The expression exp is likely to be true.
Calls the routine at address addr.
It generates a long call opcode.
For example, `Long_call(0x80000000)' generates a software reset on a UC3 if it is invoked from the CPU supervisor mode.
[in] | addr | Address of the routine to call. |
#define LOW 0 |
Referenced by adc_window_monitor(), get_batmon_voltage(), and tfa_get_batmon_voltage().
#define LSB | ( | u16 | ) | (((U8 *)&(u16))[0]) |
Least significant byte of u16.
Referenced by udi_msc_sbc_trans().
#define LSB0 | ( | u32 | ) | LSB0W(u32) |
Least significant byte of 1st rank of u32.
#define LSB0D | ( | u64 | ) | MSB7D(u64) |
Least significant byte of 1st rank of u64.
#define LSB0W | ( | u32 | ) | MSB3W(u32) |
Least significant byte of 1st rank of u32.
#define LSB1 | ( | u32 | ) | LSB1W(u32) |
Least significant byte of 2nd rank of u32.
#define LSB1D | ( | u64 | ) | MSB6D(u64) |
Least significant byte of 2nd rank of u64.
#define LSB1W | ( | u32 | ) | MSB2W(u32) |
Least significant byte of 2nd rank of u32.
#define LSB2 | ( | u32 | ) | LSB2W(u32) |
Least significant byte of 3rd rank of u32.
#define LSB2D | ( | u64 | ) | MSB5D(u64) |
Least significant byte of 3rd rank of u64.
#define LSB2W | ( | u32 | ) | MSB1W(u32) |
Least significant byte of 3rd rank of u32.
#define LSB3 | ( | u32 | ) | LSB3W(u32) |
Least significant byte of 4th rank of u32.
#define LSB3D | ( | u64 | ) | MSB4D(u64) |
Least significant byte of 4th rank of u64.
#define LSB3W | ( | u32 | ) | MSB0W(u32) |
Least significant byte of 4th rank of u32.
#define LSB4D | ( | u64 | ) | MSB3D(u64) |
Least significant byte of 5th rank of u64.
#define LSB5D | ( | u64 | ) | MSB2D(u64) |
Least significant byte of 6th rank of u64.
#define LSB6D | ( | u64 | ) | MSB1D(u64) |
Least significant byte of 7th rank of u64.
#define LSB7D | ( | u64 | ) | MSB0D(u64) |
Least significant byte of 8th rank of u64.
#define LSH | ( | u32 | ) | (((U16 *)&(u32))[0]) |
Least significant half-word of u32.
#define LSH0 | ( | u64 | ) | MSH3(u64) |
Least significant half-word of 1st rank of u64.
#define LSH1 | ( | u64 | ) | MSH2(u64) |
Least significant half-word of 2nd rank of u64.
#define LSH2 | ( | u64 | ) | MSH1(u64) |
Least significant half-word of 3rd rank of u64.
#define LSH3 | ( | u64 | ) | MSH0(u64) |
Least significant half-word of 4th rank of u64.
#define LSW | ( | u64 | ) | (((U32 *)&(u64))[0]) |
Least significant word of u64.
#define Max | ( | a, | |
b | |||
) | (((a) > (b)) ? (a) : (b)) |
Takes the maximal value of a and b.
[in] | a | Input value. |
[in] | b | Input value. |
Referenced by main_extra_string(), udd_ctrl_ep_enable(), uhi_cdc_install(), and virtual_mem_2_ram().
#define max | ( | a, | |
b | |||
) | Max(a, b) |
Takes the maximal value of a and b.
[in] | a | Input value. |
[in] | b | Input value. |
Referenced by main(), memp_init(), pbuf_memfind(), and usb_host_pipe_set_config().
#define memcmp_code2ram memcmp |
Target-specific memcmp of RAM to NVRAM.
#define memcmp_ram2ram memcmp |
Target-specific memcmp of RAM to RAM.
#define memcpy_code2ram memcpy |
Target-specific memcpy from NVRAM to RAM.
#define MEMCPY_ENDIAN memcpy |
Referenced by handle_incoming_msg(), mlme_get(), pal_get_current_time(), usr_perf_get_confirm(), and usr_perf_set_confirm().
#define memcpy_ram2ram memcpy |
Target-specific memcpy from RAM to RAM.
#define Min | ( | a, | |
b | |||
) | (((a) < (b)) ? (a) : (b)) |
Takes the minimal value of a and b.
[in] | a | Input value. |
[in] | b | Input value. |
Referenced by udd_ctrl_ep_enable().
#define min | ( | a, | |
b | |||
) | Min(a, b) |
Takes the minimal value of a and b.
[in] | a | Input value. |
[in] | b | Input value. |
#define MSB | ( | u16 | ) | (((U8 *)&(u16))[1]) |
Most significant byte of u16.
Referenced by udi_msc_sbc_trans().
#define MSB0 | ( | u32 | ) | MSB0W(u32) |
Most significant byte of 1st rank of u32.
Referenced by udi_msc_sbc_trans().
#define MSB0D | ( | u64 | ) | (((U8 *)&(u64))[7]) |
Most significant byte of 1st rank of u64.
#define MSB0W | ( | u32 | ) | (((U8 *)&(u32))[3]) |
Most significant byte of 1st rank of u32.
Referenced by get_length(), main(), uhi_msc_scsi_read_10(), and uhi_msc_scsi_write_10().
#define MSB1 | ( | u32 | ) | MSB1W(u32) |
Most significant byte of 2nd rank of u32.
Referenced by udi_msc_sbc_trans().
#define MSB1D | ( | u64 | ) | (((U8 *)&(u64))[6]) |
Most significant byte of 2nd rank of u64.
#define MSB1W | ( | u32 | ) | (((U8 *)&(u32))[2]) |
Most significant byte of 2nd rank of u32.
Referenced by get_length(), main(), uhi_msc_scsi_read_10(), and uhi_msc_scsi_write_10().
#define MSB2 | ( | u32 | ) | MSB2W(u32) |
Most significant byte of 3rd rank of u32.
Referenced by udi_msc_sbc_trans().
#define MSB2D | ( | u64 | ) | (((U8 *)&(u64))[5]) |
Most significant byte of 3rd rank of u64.
#define MSB2W | ( | u32 | ) | (((U8 *)&(u32))[1]) |
Most significant byte of 3rd rank of u32.
Referenced by get_length(), main(), uhi_msc_scsi_read_10(), and uhi_msc_scsi_write_10().
#define MSB3 | ( | u32 | ) | MSB3W(u32) |
Most significant byte of 4th rank of u32.
Referenced by udi_msc_sbc_trans().
#define MSB3D | ( | u64 | ) | (((U8 *)&(u64))[4]) |
Most significant byte of 4th rank of u64.
#define MSB3W | ( | u32 | ) | (((U8 *)&(u32))[0]) |
Most significant byte of 4th rank of u32.
Referenced by get_length(), main(), uhi_msc_scsi_read_10(), and uhi_msc_scsi_write_10().
#define MSB4D | ( | u64 | ) | (((U8 *)&(u64))[3]) |
Most significant byte of 5th rank of u64.
#define MSB5D | ( | u64 | ) | (((U8 *)&(u64))[2]) |
Most significant byte of 6th rank of u64.
#define MSB6D | ( | u64 | ) | (((U8 *)&(u64))[1]) |
Most significant byte of 7th rank of u64.
#define MSB7D | ( | u64 | ) | (((U8 *)&(u64))[0]) |
Most significant byte of 8th rank of u64.
#define MSH | ( | u32 | ) | (((U16 *)&(u32))[1]) |
Most significant half-word of u32.
#define MSH0 | ( | u64 | ) | (((U16 *)&(u64))[3]) |
Most significant half-word of 1st rank of u64.
#define MSH1 | ( | u64 | ) | (((U16 *)&(u64))[2]) |
Most significant half-word of 2nd rank of u64.
#define MSH2 | ( | u64 | ) | (((U16 *)&(u64))[1]) |
Most significant half-word of 3rd rank of u64.
#define MSH3 | ( | u64 | ) | (((U16 *)&(u64))[0]) |
Most significant half-word of 4th rank of u64.
#define MSW | ( | u64 | ) | (((U32 *)&(u64))[1]) |
Most significant word of u64.
#define NO_INIT __attribute__((section(".no_init"))) |
#define nop | ( | ) | __NOP() |
Referenced by dma_crc_io_calculation().
#define OPTIMIZE_HIGH __attribute__((optimize("s"))) |
#define PASS 0 |
#define PGM_READ_BYTE | ( | x | ) | *(x) |
Referenced by convert_phyTransmitPower_to_reg_value(), get_param_length(), limit_tx_pwr(), and mac_get_pib_attribute_size().
#define PGM_READ_WORD | ( | x | ) | *(x) |
Referenced by dispatch_event().
#define RAMFUNC __attribute__ ((section(".ramfunc"))) |
Reads the bit-field of a value specified by a given bit-mask.
[in] | value | Value to read a bit-field from. |
[in] | mask | Bit-mask indicating the bit-field to read. |
#define Rd_bits | ( | value, | |
mask | |||
) | ((value) & (mask)) |
Reads the bits of a value specified by a given bit-mask.
[in] | value | Value to read bits from. |
[in] | mask | Bit-mask indicating bits to read. |
Sets alignment of the lvalue number lval to alg with respect to the n boundary.
[in] | lval | Input/output lvalue. |
[in] | n | Boundary. |
[in] | alg | Alignment. |
#define Set_bits | ( | lvalue, | |
mask | |||
) | ((lvalue) |= (mask)) |
Sets the bits of a C lvalue specified by a given bit-mask.
[in] | lvalue | C lvalue of which to set bits. |
[in] | mask | Bit-mask indicating bits to set. |
#define SHORTENUM __attribute__((packed)) |
#define Swap16 | ( | u16 | ) |
Toggles the endianism of u16 (by swapping its bytes).
[in] | u16 | U16 of which to toggle the endianism. |
#define swap16 | ( | u16 | ) | Swap16(u16) |
Toggles the endianism of u16 (by swapping its bytes).
[in] | u16 | U16 of which to toggle the endianism. |
#define Swap32 | ( | u32 | ) |
Toggles the endianism of u32 (by swapping its bytes).
[in] | u32 | U32 of which to toggle the endianism. |
#define swap32 | ( | u32 | ) | ((uint32_t)__builtin_bswap32((uint32_t)(u32))) |
Toggles the endianism of u32 (by swapping its bytes).
[in] | u32 | U32 of which to toggle the endianism. |
#define Swap64 | ( | u64 | ) |
Toggles the endianism of u64 (by swapping its bytes).
[in] | u64 | U64 of which to toggle the endianism. |
#define swap64 | ( | u64 | ) | ((uint64_t)__builtin_bswap64((uint64_t)(u64))) |
Toggles the endianism of u64 (by swapping its bytes).
[in] | u64 | U64 of which to toggle the endianism. |
Tests alignment of the number val with the n boundary.
[in] | val | Input value. |
[in] | n | Boundary. |
1
if the number val is aligned with the n boundary, else 0
. #define Tgl_bits | ( | lvalue, | |
mask | |||
) | ((lvalue) ^= (mask)) |
Toggles the bits of a C lvalue specified by a given bit-mask.
[in] | lvalue | C lvalue of which to toggle bits. |
[in] | mask | Bit-mask indicating bits to toggle. |
#define true 1 |
#define Tst_bits | ( | value, | |
mask | |||
) | (Rd_bits(value, mask) != 0) |
Tests the bits of a value specified by a given bit-mask.
[in] | value | Value of which to test bits. |
[in] | mask | Bit-mask indicating bits to test. |
1
if at least one of the tested bits is set, else 0
. #define unlikely | ( | exp | ) | (exp) |
The expression exp is unlikely to be true.
#define UNUSED | ( | v | ) | (void)(v) |
Marking v as a unused parameter or value.
Referenced by _at25dfx_chip_get_nonbusy_status(), _at25dfx_chip_issue_read_command_wait(), _at25dfx_chip_issue_write_command_wait(), _spi_interrupt_handler(), _spi_master_vec_int_handler(), _spi_read_dummy(), anp_client_init(), anp_client_security_done_handler(), anp_client_write_notification_handler(), bas_send_notification(), ble_device_config(), ble_dummy_handler(), BLE_UNUSED2_VAR(), cgi_GetStaus(), cgi_SetLed(), csc_prf_write_notification_handler(), dac_callback(), dac_chan_abort_job(), dac_chan_disable(), dac_chan_disable_callback(), dac_chan_disable_output_buffer(), dac_chan_enable(), dac_chan_enable_callback(), dac_chan_enable_output_buffer(), dac_chan_get_job_status(), dac_chan_set_config(), dac_chan_write(), dac_chan_write_buffer_job(), dac_chan_write_buffer_wait(), dac_chan_write_job(), dac_register_callback(), dac_unregister_callback(), hid_prf_init(), main(), main_control_transfer_done(), main_iso_in_done(), main_iso_out_done(), main_keyboard_led(), main_transfer_done(), main_usb_connection_event(), main_usb_vendor_change(), main_vendor_bulk_in_received(), main_vendor_bulk_out_received(), main_vendor_int_in_received(), main_vendor_int_out_received(), main_vendor_iso_in_received(), main_vendor_iso_out_received(), mem_name(), mem_removal(), mem_unload(), memory_2_ram(), pas_client_init(), portable_delay_cycles(), pxp_monitor_init(), ram_2_memory(), run_usb_cdc_test(), run_usb_mouse_test(), sd_mmc_is_write_protected(), sd_mmc_removal(), sd_mmc_spi_get_bus_width(), sd_mmc_spi_get_response_128(), sleepmgr_lock_mode(), sleepmgr_sleep(), sleepmgr_unlock_mode(), stream_state(), stream_stop(), time_info_disconnected_event_handler(), time_info_encryption_status_changed_handler(), time_info_pair_done_handler(), transfer_done(), uart_close(), uart_config(), uart_open(), uart_rx_notify(), udi_cdc_data_sent(), udi_cdc_line_coding_received(), udi_cdc_serial_state_msg_sent(), udi_hid_generic_report_in_sent(), udi_hid_generic_report_out_received(), udi_hid_kbd_report_sent(), udi_hid_mouse_report_sent(), udi_hid_multi_touch_report_in_sent(), udi_msc_cbw_received(), udi_msc_csw_sent(), udi_msc_data_sent(), udi_msc_trans_ack(), uhc_dev_get_string(), uhc_enumeration_step10(), uhc_enumeration_step12(), uhc_enumeration_step13(), uhc_enumeration_step14(), uhc_enumeration_step15(), uhc_enumeration_step17_lpm(), uhc_enumeration_step18_lpm(), uhc_enumeration_step6(), uhc_setup_request_callback(), uhd_disable(), uhi_cdc_rx_received(), uhi_cdc_sof(), uhi_cdc_tx_send(), uhi_hid_mouse_report_reception(), uhi_msc_cbw_rst_stall(), uhi_msc_cbw_sent(), uhi_msc_csw_received(), uhi_msc_data_csw_rst_stall(), uhi_msc_data_transfered(), uhi_msc_enable_step2(), uhi_msc_enable_step5(), ui_com_close(), and ui_com_open().
#define WEAK __attribute__ ((weak)) |
This macro is used to test fatal errors.
The macro tests if the expression is false. If it is, a fatal error is detected and the application hangs up. If TEST_SUITE_DEFINE_ASSERT_MACRO
is defined, a unit test version of the macro is used, to allow execution of further tests after a false expression.
[in] | expr | Expression to evaluate and supposed to be nonzero. |
#define Wr_bitfield | ( | lvalue, | |
mask, | |||
bitfield | |||
) | (Wr_bits(lvalue, mask, (uint32_t)(bitfield) << ctz(mask))) |
Writes the bit-field of a C lvalue specified by a given bit-mask.
[in] | lvalue | C lvalue to write a bit-field to. |
[in] | mask | Bit-mask indicating the bit-field to write. |
[in] | bitfield | Bit-field to write. |
#define Wr_bits | ( | lvalue, | |
mask, | |||
bits | |||
) |
Writes the bits of a C lvalue specified by a given bit-mask.
[in] | lvalue | C lvalue to write bits to. |
[in] | mask | Bit-mask indicating bits to write. |
[in] | bits | Bits to write. |
typedef uint16_t be16_t |
typedef uint32_t be32_t |
typedef unsigned char bool |
typedef float F32 |
32-bit floating-point number.
typedef double F64 |
64-bit floating-point number.
typedef uint32_t iram_size_t |
typedef uint16_t le16_t |
typedef uint32_t le32_t |
typedef int16_t S16 |
16-bit signed integer.
typedef int32_t S32 |
32-bit signed integer.
typedef int64_t S64 |
64-bit signed integer.
typedef int8_t S8 |
8-bit signed integer.
typedef uint16_t U16 |
16-bit unsigned integer.
typedef uint32_t U32 |
32-bit unsigned integer.
typedef uint64_t U64 |
64-bit unsigned integer.
typedef uint8_t U8 |
8-bit unsigned integer.
|
inlinestatic |
Referenced by build_data_frame().
|
inlinestatic |
Converts a 16-Bit value into a 2 Byte array.
[in] | value | 16-Bit value |
[out] | data | Pointer to the 2 Byte array to be updated with 16-Bit value |
Referenced by build_data_frame(), configure_frame_sending(), configure_pkt_stream_frames(), configure_range_test_frame_sending(), esurl_write_authorize_event(), mlme_gts_request(), and transmit_frame().
|
inlinestatic |
Converts a 64-Bit value into a 8 Byte array.
[in] | value | 64-Bit value |
[out] | data | Pointer to the 8 Byte array to be updated with 64-Bit value |
Referenced by build_data_frame(), and transmit_frame().
|
inlinestatic |
Referenced by eddystone_adv_start(), esurl_write_authorize_event(), mac_extract_mhr_addr_info(), and parse_mpdu().
|
inlinestatic |
|
inlinestatic |
Converts a 8 Byte array into a 64-Bit value.
data | Specifies the pointer to the 8 Byte array |
Referenced by mac_extract_mhr_addr_info().
|
inlinestatic |
Referenced by build_data_frame(), and mlme_gts_request().