Microchip® Advanced Software Framework

compiler.h File Reference

Commonly used includes, types and macros.

Copyright (c) 2009-2018 Microchip Technology Inc. and its subsidiaries.

#include "preprocessor.h"
#include <parts.h>
#include <avr32/io.h>
#include "header_files/uc3d_defines_fix.h"
#include "header_files/uc3l3_l4_defines_fix.h"
#include <stddef.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include "interrupt.h"

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 ADDR_COPY_DST_SRC_16(dst, src)   memcpy((&(dst)), (&(src)), sizeof(uint16_t))
 Address copy from the source to the Destination Memory. More...
 
#define ADDR_COPY_DST_SRC_64(dst, src)   do {dst=src;}while(0)
 
#define Assert(expr)   ((void) 0)
 This macro is used to test fatal errors. More...
 
#define barrier()   asm volatile("" ::: "memory")
 Memory barrier. More...
 
#define CCPU_ENDIAN_TO_LE16(x)
 
#define CCPU_ENDIAN_TO_LE32(x)
 
#define CCPU_ENDIAN_TO_LE64(x)
 
#define CLE16_TO_CPU_ENDIAN(x)   CCPU_ENDIAN_TO_LE16(x)
 
#define CLE32_TO_CPU_ENDIAN(x)   CCPU_ENDIAN_TO_LE32(x)
 
#define CLE64_TO_CPU_ENDIAN(x)   CCPU_ENDIAN_TO_LE64(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 convert_32_bit_to_byte_array(value, data)   memcpy((data), (&(value)), sizeof(uint32_t))
 
#define convert_64_bit_to_byte_array(value, data)   memcpy((data), (&(value)), sizeof(uint64_t))
 
#define CPU_ENDIAN_TO_LE16(x)   swap16(x)
 
#define CPU_ENDIAN_TO_LE32(x)   swap32(x)
 
#define CPU_ENDIAN_TO_LE64(x)   swap64(x)
 
#define cpu_relax()   __asm__ __volatile__("sub pc, pc, -4" ::: "memory", "cc")
 This macro makes the CPU take a small break for a few cycles. This should be used when waiting for an event. It will reduce the internal bus load. More...
 
#define div_ceil(a, b)   (((a) + (b) - 1) / (b))
 Calculate \( \left\lceil \frac{a}{b} \right\rceil \) using integer arithmetic. More...
 
#define FLASH_DECLARE(x)   const x
 
#define FLASH_EXTERN(x)   extern const x
 
#define FUNC_PTR   void *
 
#define Get_system_register(reg)   sysreg_read(reg)
 
#define LE16_TO_CPU_ENDIAN(x)   swap16(x)
 
#define LE32_TO_CPU_ENDIAN(x)   swap32(x)
 
#define LE64_TO_CPU_ENDIAN(x)   swap64(x)
 
#define Long_call(addr)   ((*(void (*)(void))(addr))())
 Calls the routine at address addr. More...
 
#define MEMCPY_ENDIAN   memcpy_be
 
#define nop()   do { __asm__ __volatile__ ("nop"); } while (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 Reset_CPU()
 Resets the CPU by software. More...
 
#define Set_system_register(reg, val)   sysreg_write(reg, val)
 
#define SHORTENUM   __attribute__ ((packed))
 
#define sysreg_write(reg, val)   __builtin_mtsr(reg, val)
 Set value of system register. More...
 
#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...
 
System Register Access
#define sysreg_read(reg)   __builtin_mfsr(reg)
 Get value of system register. More...
 
Tag functions as deprecated

Tagging a function as deprecated will produce a warning when and only when the function is called.

Usage is to add the DEPRECATED symbol before the function definition. E.g.: DEPRECATED uint8_t some_deprecated_function (void) { ... }

Note
Only supported by GCC 3.1 and above, no IAR support
#define __DEPRECATED__   __attribute__((__deprecated__))
 
Usual Constants
#define DISABLE   0
 
#define ENABLE   1
 
#define false   0
 
#define true   1
 
#define PASS   0
 
#define FAIL   1
 
#define LOW   0
 
#define HIGH   1
 
Optimization Control
#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, (U32)(bitfield) << ctz(mask)))
 Writes the bit-field of a C lvalue specified by a given bit-mask. More...
 
Zero-Bit Counting

Under AVR32-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)   ((U16)(bit_reverse32((U16)(u16)) >> 16))
 Reverses the bits of u16. More...
 
#define bit_reverse32(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 AVR32-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:

  • Abs, Min and Max to apply to constant expressions (values known at compile time);
  • abs, min and max to apply to non-constant expressions (values unknown at compile time).
#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 abs(a)
 Takes the absolute value of a. More...
 
#define min(a, b)
 Takes the minimal value of a and b. More...
 
#define max(a, b)
 Takes the maximal value of a and b. More...
 
CPU Status Register Access
#define Is_global_exception_enabled()   (!Tst_bits(Get_system_register(AVR32_SR), AVR32_SR_EM_MASK))
 Tells whether exceptions are globally enabled. More...
 
#define Disable_global_exception()   ({__asm__ __volatile__ ("ssrf\t%0" : : "i" (AVR32_SR_EM_OFFSET));})
 Disables exceptions globally. More...
 
#define Enable_global_exception()   ({__asm__ __volatile__ ("csrf\t%0" : : "i" (AVR32_SR_EM_OFFSET));})
 Enables exceptions globally. More...
 
Debug Register Access
#define Get_debug_register(dbgreg)   __builtin_mfdr(dbgreg)
 Gets the value of the dbgreg debug register. More...
 
#define Set_debug_register(dbgreg, value)   __builtin_mtdr(dbgreg, value)
 Sets the value of the dbgreg debug register to value. More...
 
Force Assembly Inline Code Section
#define __always_inline   inline __attribute__((__always_inline__))
 
MCU Endianism Handling

AVR32 is MCU big endianism.

#define MSB(u16)   (((U8 *)&(u16))[0])
 Most significant byte of u16. More...
 
#define LSB(u16)   (((U8 *)&(u16))[1])
 Least significant byte of u16. More...
 
#define MSH(u32)   (((U16 *)&(u32))[0])
 Most significant half-word of u32. More...
 
#define LSH(u32)   (((U16 *)&(u32))[1])
 Least significant half-word of u32. More...
 
#define MSB0W(u32)   (((U8 *)&(u32))[0])
 Most significant byte of 1st rank of u32. More...
 
#define MSB1W(u32)   (((U8 *)&(u32))[1])
 Most significant byte of 2nd rank of u32. More...
 
#define MSB2W(u32)   (((U8 *)&(u32))[2])
 Most significant byte of 3rd rank of u32. More...
 
#define MSB3W(u32)   (((U8 *)&(u32))[3])
 Most significant byte of 4th rank of u32. More...
 
#define LSB3W(u32)   MSB0W(u32)
 Least significant byte of 4th rank of u32. More...
 
#define LSB2W(u32)   MSB1W(u32)
 Least significant byte of 3rd rank of u32. More...
 
#define LSB1W(u32)   MSB2W(u32)
 Least significant byte of 2nd rank of u32. More...
 
#define LSB0W(u32)   MSB3W(u32)
 Least significant byte of 1st rank of u32. More...
 
#define MSW(u64)   (((U32 *)&(u64))[0])
 Most significant word of u64. More...
 
#define LSW(u64)   (((U32 *)&(u64))[1])
 Least significant word of u64. More...
 
#define MSH0(u64)   (((U16 *)&(u64))[0])
 Most significant half-word of 1st rank of u64. More...
 
#define MSH1(u64)   (((U16 *)&(u64))[1])
 Most significant half-word of 2nd rank of u64. More...
 
#define MSH2(u64)   (((U16 *)&(u64))[2])
 Most significant half-word of 3rd rank of u64. More...
 
#define MSH3(u64)   (((U16 *)&(u64))[3])
 Most significant half-word of 4th rank of u64. More...
 
#define LSH3(u64)   MSH0(u64)
 Least significant half-word of 4th rank of u64. More...
 
#define LSH2(u64)   MSH1(u64)
 Least significant half-word of 3rd rank of u64. More...
 
#define LSH1(u64)   MSH2(u64)
 Least significant half-word of 2nd rank of u64. More...
 
#define LSH0(u64)   MSH3(u64)
 Least significant half-word of 1st rank of u64. More...
 
#define MSB0D(u64)   (((U8 *)&(u64))[0])
 Most significant byte of 1st rank of u64. More...
 
#define MSB1D(u64)   (((U8 *)&(u64))[1])
 Most significant byte of 2nd rank of u64. More...
 
#define MSB2D(u64)   (((U8 *)&(u64))[2])
 Most significant byte of 3rd rank of u64. More...
 
#define MSB3D(u64)   (((U8 *)&(u64))[3])
 Most significant byte of 4th rank of u64. More...
 
#define MSB4D(u64)   (((U8 *)&(u64))[4])
 Most significant byte of 5th rank of u64. More...
 
#define MSB5D(u64)   (((U8 *)&(u64))[5])
 Most significant byte of 6th rank of u64. More...
 
#define MSB6D(u64)   (((U8 *)&(u64))[6])
 Most significant byte of 7th rank of u64. More...
 
#define MSB7D(u64)   (((U8 *)&(u64))[7])
 Most significant byte of 8th rank of u64. More...
 
#define LSB7D(u64)   MSB0D(u64)
 Least significant byte of 8th rank of u64. More...
 
#define LSB6D(u64)   MSB1D(u64)
 Least significant byte of 7th rank of u64. More...
 
#define LSB5D(u64)   MSB2D(u64)
 Least significant byte of 6th rank of u64. More...
 
#define LSB4D(u64)   MSB3D(u64)
 Least significant byte of 5th rank of u64. More...
 
#define LSB3D(u64)   MSB4D(u64)
 Least significant byte of 4th rank of u64. More...
 
#define LSB2D(u64)   MSB5D(u64)
 Least significant byte of 3rd rank of u64. More...
 
#define LSB1D(u64)   MSB6D(u64)
 Least significant byte of 2nd rank of u64. More...
 
#define LSB0D(u64)   MSB7D(u64)
 Least significant byte of 1st rank of u64. More...
 
#define LE16(x)   Swap16(x)
 
#define le16_to_cpu(x)   swap16(x)
 
#define cpu_to_le16(x)   swap16(x)
 
#define LE16_TO_CPU(x)   Swap16(x)
 
#define CPU_TO_LE16(x)   Swap16(x)
 
#define be16_to_cpu(x)   (x)
 
#define cpu_to_be16(x)   (x)
 
#define BE16_TO_CPU(x)   (x)
 
#define CPU_TO_BE16(x)   (x)
 
#define le32_to_cpu(x)   swap32(x)
 
#define cpu_to_le32(x)   swap32(x)
 
#define LE32_TO_CPU(x)   Swap32(x)
 
#define CPU_TO_LE32(x)   Swap32(x)
 
#define be32_to_cpu(x)   (x)
 
#define cpu_to_be32(x)   (x)
 
#define BE32_TO_CPU(x)   (x)
 
#define CPU_TO_BE32(x)   (x)
 
Endianism Conversion

The same considerations as for clz and ctz apply here but AVR32-GCC's __builtin_bswap_16 and __builtin_bswap_32 do not behave like macros when applied to constant expressions, so two sets of macros are defined here:

  • Swap16, Swap32 and Swap64 to apply to constant expressions (values known at compile time);
  • swap16, swap32 and swap64 to apply to non-constant expressions (values unknown at compile time).
#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)   ((U16)__builtin_bswap_16((U16)(u16)))
 Toggles the endianism of u16 (by swapping its bytes). More...
 
#define swap32(u32)   ((U32)__builtin_bswap_32((U32)(u32)))
 Toggles the endianism of u32 (by swapping its bytes). More...
 
#define swap64(u64)
 Toggles the endianism of u64 (by swapping its bytes). More...
 

Typedefs

Usual Types
typedef unsigned char Bool
 Boolean. More...
 
typedef unsigned char bool
 Boolean. More...
 
typedef int8_t S8
 8-bit signed integer. More...
 
typedef uint8_t U8
 8-bit unsigned integer. More...
 
typedef int16_t S16
 16-bit signed integer. More...
 
typedef uint16_t U16
 16-bit unsigned integer. More...
 
typedef uint16_t le16_t
 
typedef uint16_t be16_t
 
typedef int32_t S32
 32-bit signed integer. More...
 
typedef uint32_t U32
 32-bit unsigned integer. More...
 
typedef uint32_t le32_t
 
typedef uint32_t be32_t
 
typedef signed long long int S64
 64-bit signed integer. More...
 
typedef unsigned long long int U64
 64-bit unsigned integer. More...
 
typedef float F32
 32-bit floating-point number. More...
 
typedef double F64
 64-bit floating-point number. More...
 
typedef uint32_t iram_size_t
 
Status Types
typedef bool Status_bool_t
 Boolean status. More...
 
typedef U8 Status_t
 8-bit-coded status. More...
 

Functions

static void convert_16_bit_to_byte_address (uint64_t value, uint8_t *data)
 
static void convert_16_bit_to_byte_array (uint16_t value, uint8_t *data)
 
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)
 
static void convert_spec_16_bit_to_byte_array (uint16_t value, uint8_t *data)
 
static voidmemcpy_be (void *s1, const void *s2, char n)
 
Logarithmic functions
int_fast8_t ilog2_undefined (void)
 
static int_fast8_t ilog2 (uint32_t x)
 Calculate the base-2 logarithm of a number rounded down to the nearest integer. 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 LSB0(u32)   LSB0W(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 LSB2(u32)   LSB2W(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 MSB3(u32)   MSB3W(u32)
 Most significant byte of 4th rank of u32. More...
 
#define MSB2(u32)   MSB2W(u32)
 Most significant byte of 3rd rank of u32. More...
 
#define MSB1(u32)   MSB1W(u32)
 Most significant byte of 2nd rank of u32. More...
 
#define MSB0(u32)   MSB0W(u32)
 Most significant byte of 1st rank of u32. More...
 
typedef U8 Byte
 8-bit unsigned integer. More...
 

#define __always_inline   inline __attribute__((__always_inline__))
#define _CONST_TYPE_   const

const type qualifier.

Referenced by fat_select_filesystem().

#define _GLOBEXT_   extern

extern storage-class specifier.

#define _MEM_TYPE_FAST_
#define _MEM_TYPE_MEDFAST_

Fairly fast memory type.

#define Abs (   a)    (((a) < 0 ) ? -(a) : (a))

Takes the absolute value of a.

Parameters
aInput value.
Returns
Absolute value of a.
Note
More optimized if only used with values known at compile time.
#define abs (   a)
Value:
(\
{\
int __value = (a);\
__asm__ ("abs\t%0" : "+r" (__value) : : "cc");\
__value;\
}\
)

Takes the absolute value of a.

Parameters
aInput value.
Returns
Absolute value of a.
Note
More optimized if only used with values unknown at compile time.
#define ADDR_COPY_DST_SRC_16 (   dst,
  src 
)    memcpy((&(dst)), (&(src)), sizeof(uint16_t))

Address copy from the source to the Destination Memory.

#define ADDR_COPY_DST_SRC_64 (   dst,
  src 
)    do {dst=src;}while(0)
#define Align_down (   val,
 
)    ( (val) & ~((n) - 1))

Aligns the number val with the lower n boundary.

Parameters
valInput value.
nBoundary.
Returns
Value resulting from the number val aligned with the lower n boundary.

Referenced by flashc_memset64(), host_read_p_rxpacket(), host_set_p_txpacket(), host_write_p_txpacket(), usb_read_ep_rxpacket(), usb_set_ep_txpacket(), and usb_write_ep_txpacket().

#define Align_up (   val,
 
)    (((val) + ((n) - 1)) & ~((n) - 1))

Aligns the number val with the upper n boundary.

Parameters
valInput value.
nBoundary.
Returns
Value resulting from the number val aligned with the upper n boundary.
#define Assert (   expr)    ((void) 0)
#define be16_to_cpu (   x)    (x)
#define BE16_TO_CPU (   x)    (x)
#define be32_to_cpu (   x)    (x)
#define BE32_TO_CPU (   x)    (x)
#define bit_reverse16 (   u16)    ((U16)(bit_reverse32((U16)(u16)) >> 16))

Reverses the bits of u16.

Parameters
u16U16 of which to reverse the bits.
Returns
Value resulting from u16 with reversed bits.
#define bit_reverse32 (   u32)
Value:
(\
{\
unsigned int __value = (U32)(u32);\
__asm__ ("brev\t%0" : "+r" (__value) : : "cc");\
(U32)__value;\
}\
)
uint32_t U32
32-bit unsigned integer.
Definition: compiler.h:218

Reverses the bits of u32.

Parameters
u32U32 of which to reverse the bits.
Returns
Value resulting from u32 with reversed bits.
#define bit_reverse64 (   u64)
Value:
((U64)(((U64)bit_reverse32((U64)(u64) >> 32)) |\
((U64)bit_reverse32((U64)(u64)) << 32)))
unsigned long long int U64
64-bit unsigned integer.
Definition: compiler.h:222
#define bit_reverse32(u32)
Reverses the bits of u32.
Definition: compiler.h:694

Reverses the bits of u64.

Parameters
u64U64 of which to reverse the bits.
Returns
Value resulting from u64 with reversed bits.
#define bit_reverse8 (   u8)    ((U8)(bit_reverse32((U8)(u8)) >> 24))

Reverses the bits of u8.

Parameters
u8U8 of which to reverse the bits.
Returns
Value resulting from u8 with reversed bits.

Referenced by dip204_read_byte(), and dip204_write_byte().

#define CCPU_ENDIAN_TO_LE16 (   x)
Value:
((uint16_t)(\
(((uint16_t)(x) & (uint16_t)0x00ffU) << 8) | \
(((uint16_t)(x) & (uint16_t)0xff00U) >> 8)))
#define CCPU_ENDIAN_TO_LE32 (   x)
Value:
((uint32_t)(\
(((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \
(((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \
(((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \
(((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24)))
#define CCPU_ENDIAN_TO_LE64 (   x)
Value:
((uint64_t)(\
(((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \
(((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
(((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
(((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
(((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
(((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
(((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
(((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56)))
#define CLE16_TO_CPU_ENDIAN (   x)    CCPU_ENDIAN_TO_LE16(x)
#define CLE32_TO_CPU_ENDIAN (   x)    CCPU_ENDIAN_TO_LE32(x)
#define CLE64_TO_CPU_ENDIAN (   x)    CCPU_ENDIAN_TO_LE64(x)
#define Clr_bits (   lvalue,
  mask 
)    ((lvalue) &= ~(mask))

Clears the bits of a C lvalue specified by a given bit-mask.

Parameters
lvalueC lvalue of which to clear bits.
maskBit-mask indicating bits to clear.
Returns
Resulting value with cleared bits.

Referenced by fsaccess_free_nav_id(), LED_Off(), and prvjoystick_ISR_NonNakedBehaviour().

#define clz (   u)    ((u) ? __builtin_clz(u) : 32)

Counts the leading zero bits of the given value considered as a 32-bit integer.

Parameters
uValue of which to count the leading zero bits.
Returns
The count of leading zero bits in u.

Referenced by _get_interrupt_handler(), flashc_set_bootloader_protected_size(), and ilog2().

#define CMD_ID_OCTET   (0)
#define convert_32_bit_to_byte_array (   value,
  data 
)    memcpy((data), (&(value)), sizeof(uint32_t))
#define convert_64_bit_to_byte_array (   value,
  data 
)    memcpy((data), (&(value)), sizeof(uint64_t))
#define CPU_ENDIAN_TO_LE16 (   x)    swap16(x)
#define CPU_ENDIAN_TO_LE32 (   x)    swap32(x)
#define CPU_ENDIAN_TO_LE64 (   x)    swap64(x)
#define cpu_relax ( )    __asm__ __volatile__("sub pc, pc, -4" ::: "memory", "cc")

This macro makes the CPU take a small break for a few cycles. This should be used when waiting for an event. It will reduce the internal bus load.

"sub pc, pc, -4" (or "sub pc, -2") forces the IF stage to wait until the result of the calculation before it can fetch the next instruction. This makes sure there are nothing stuck in the LS pipe when you start a new iteration and guarantee to flush the pipeline without having any other effect. (A nop doesn't have any effect on the IF stage.)

#define cpu_to_be16 (   x)    (x)
#define CPU_TO_BE16 (   x)    (x)
#define cpu_to_be32 (   x)    (x)
#define CPU_TO_BE32 (   x)    (x)
#define cpu_to_le16 (   x)    swap16(x)
#define CPU_TO_LE16 (   x)    Swap16(x)
#define cpu_to_le32 (   x)    swap32(x)
#define CPU_TO_LE32 (   x)    Swap32(x)
#define ctz (   u)    ((u) ? __builtin_ctz(u) : 32)

Counts the trailing zero bits of the given value considered as a 32-bit integer.

Parameters
uValue of which to count the trailing zero bits.
Returns
The count of trailing zero bits in u.

Referenced by LED_Display_Field(), LED_Display_Mask(), LED_Get_Intensity(), LED_Off(), LED_On(), LED_Set_Intensity(), and LED_Toggle().

#define DISABLE   0
#define Disable_global_exception ( )    ({__asm__ __volatile__ ("ssrf\t%0" : : "i" (AVR32_SR_EM_OFFSET));})

Disables exceptions globally.

#define div_ceil (   a,
 
)    (((a) + (b) - 1) / (b))

Calculate \( \left\lceil \frac{a}{b} \right\rceil \) using integer arithmetic.

Parameters
aAn integer
bAnother integer
Returns
(a / b) rounded up to the nearest integer.

Referenced by getBaudDiv().

#define ENABLE   1
#define Enable_global_exception ( )    ({__asm__ __volatile__ ("csrf\t%0" : : "i" (AVR32_SR_EM_OFFSET));})

Enables exceptions globally.

#define FAIL   1

Referenced by adc_check_ovr().

#define false   0

Referenced by fsaccess_IsDirPresent().

#define FLASH_DECLARE (   x)    const x
#define FLASH_EXTERN (   x)    extern const x
#define FUNC_PTR   void *
#define Get_align (   val,
 
)    ( Rd_bits( val, (n) - 1 ) )

Gets alignment of the number val with respect to the n boundary.

Parameters
valInput value.
nBoundary.
Returns
Alignment of the number val with respect to the n boundary.

Referenced by flashc_memset64(), host_read_p_rxpacket(), host_write_p_txpacket(), usb_read_ep_rxpacket(), and usb_write_ep_txpacket().

#define Get_debug_register (   dbgreg)    __builtin_mfdr(dbgreg)

Gets the value of the dbgreg debug register.

Parameters
dbgregAddress of the debug register of which to get the value.
Returns
Value of the dbgreg debug register.
#define HIGH   1
#define is_constant (   exp)    __builtin_constant_p(exp)

Determine if an expression evaluates to a constant value.

Parameters
expAny expression
Returns
true if exp is constant, false otherwise.

Referenced by ilog2().

#define Is_global_exception_enabled ( )    (!Tst_bits(Get_system_register(AVR32_SR), AVR32_SR_EM_MASK))

Tells whether exceptions are globally enabled.

Returns
1 if exceptions are globally enabled, else 0.
#define LE16 (   x)    Swap16(x)
#define le16_to_cpu (   x)    swap16(x)
#define LE16_TO_CPU (   x)    Swap16(x)
#define LE16_TO_CPU_ENDIAN (   x)    swap16(x)
#define le32_to_cpu (   x)    swap32(x)
#define LE32_TO_CPU (   x)    Swap32(x)
#define LE32_TO_CPU_ENDIAN (   x)    swap32(x)
#define LE64_TO_CPU_ENDIAN (   x)    swap64(x)
#define Long_call (   addr)    ((*(void (*)(void))(addr))())

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.

Parameters
addrAddress of the routine to call.
Note
It may be used as a long jump opcode in some special cases.
#define LOW   0
#define LSB (   u16)    (((U8 *)&(u16))[1])
#define LSB0 (   u32)    LSB0W(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.

Referenced by at45dbx_read_open(), at45dbx_write_open(), host_read_10_extram(), host_read_10_ram(), and host_write_10_extram().

#define LSB1 (   u32)    LSB1W(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.

Referenced by at45dbx_read_open(), at45dbx_write_open(), host_read_10_extram(), host_read_10_ram(), and host_write_10_extram().

#define LSB2 (   u32)    LSB2W(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.

Referenced by at45dbx_read_open(), at45dbx_write_open(), host_read_10_extram(), host_read_10_ram(), and host_write_10_extram().

#define LSB3 (   u32)    LSB3W(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.

Referenced by host_read_10_extram(), host_read_10_ram(), and host_write_10_extram().

#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))[1])

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))[1])

Least significant word of u64.

#define Max (   a,
 
)    (((a) > (b)) ? (a) : (b))

Takes the maximal value of a and b.

Parameters
aInput value.
bInput value.
Returns
Maximal value of a and b.
Note
More optimized if only used with values known at compile time.

Referenced by dip204_set_backlight(), fat_invert_nav(), and vMMI_UserMenuDisplayPreviousItem().

#define max (   a,
 
)
Value:
(\
{\
int __value, __arg_a = (a), __arg_b = (b);\
__asm__ ("max\t%0, %1, %2" : "=r" (__value) : "r" (__arg_a), "r" (__arg_b));\
__value;\
}\
)

Takes the maximal value of a and b.

Parameters
aInput value.
bInput value.
Returns
Maximal value of a and b.
Note
More optimized if only used with values unknown at compile time.

Referenced by flashc_set_bootloader_protected_size(), memp_init(), and pbuf_memfind().

#define memcmp_code2ram   memcmp

Target-specific memcmp of RAM to NVRAM.

Referenced by fat_read_fat32_FSInfo().

#define memcmp_ram2ram   memcmp

Target-specific memcmp of RAM to RAM.

Referenced by fat_entry_shortname_compare().

#define memcpy_code2ram   memcpy

Target-specific memcpy from NVRAM to RAM.

Referenced by fat_initialize_fat(), and fat_write_PBR().

#define MEMCPY_ENDIAN   memcpy_be
#define memcpy_ram2ram   memcpy

Target-specific memcpy from RAM to RAM.

Referenced by fat_copy_nav(), fat_garbage_collector_entry(), fat_invert_nav(), file_read_buf(), and file_write_buf().

#define Min (   a,
 
)    (((a) < (b)) ? (a) : (b))

Takes the minimal value of a and b.

Parameters
aInput value.
bInput value.
Returns
Minimal value of a and b.
Note
More optimized if only used with values known at compile time.

Referenced by dip204_set_backlight(), e_smtpclient_cmd_set_config(), and vMMI_UserMenuDisplayNextItem().

#define min (   a,
 
)
Value:
(\
{\
int __value, __arg_a = (a), __arg_b = (b);\
__asm__ ("min\t%0, %1, %2" : "=r" (__value) : "r" (__arg_a), "r" (__arg_b));\
__value;\
}\
)

Takes the minimal value of a and b.

Parameters
aInput value.
bInput value.
Returns
Minimal value of a and b.
Note
More optimized if only used with values unknown at compile time.

Referenced by flashc_erase_gp_fuse_bitfield(), flashc_memset64(), flashc_read_gp_fuse_bitfield(), flashc_set_bootloader_protected_size(), flashc_set_gp_fuse_bitfield(), flashc_write_gp_fuse_bitfield(), host_check_class(), host_read_p_rxpacket(), host_set_p_txpacket(), host_write_p_txpacket(), sbc_inquiry(), sbc_request_sense(), usb_read_ep_rxpacket(), usb_set_ep_txpacket(), and usb_write_ep_txpacket().

#define MSB (   u16)    (((U8 *)&(u16))[0])
#define MSB0 (   u32)    MSB0W(u32)

Most significant byte of 1st rank of u32.

Referenced by fat_cluster_list().

#define MSB0D (   u64)    (((U8 *)&(u64))[0])

Most significant byte of 1st rank of u64.

#define MSB0W (   u32)    (((U8 *)&(u32))[0])

Most significant byte of 1st rank of u32.

Referenced by host_read_10_extram(), host_read_10_ram(), host_write_10_extram(), sbc_read_10(), and sbc_write_10().

#define MSB1 (   u32)    MSB1W(u32)

Most significant byte of 2nd rank of u32.

#define MSB1D (   u64)    (((U8 *)&(u64))[1])

Most significant byte of 2nd rank of u64.

#define MSB1W (   u32)    (((U8 *)&(u32))[1])

Most significant byte of 2nd rank of u32.

Referenced by host_read_10_extram(), host_read_10_ram(), host_write_10_extram(), sbc_read_10(), and sbc_write_10().

#define MSB2 (   u32)    MSB2W(u32)

Most significant byte of 3rd rank of u32.

#define MSB2D (   u64)    (((U8 *)&(u64))[2])

Most significant byte of 3rd rank of u64.

#define MSB2W (   u32)    (((U8 *)&(u32))[2])

Most significant byte of 3rd rank of u32.

Referenced by host_read_10_extram(), host_read_10_ram(), host_write_10_extram(), sbc_read_10(), and sbc_write_10().

#define MSB3 (   u32)    MSB3W(u32)

Most significant byte of 4th rank of u32.

#define MSB3D (   u64)    (((U8 *)&(u64))[3])

Most significant byte of 4th rank of u64.

#define MSB3W (   u32)    (((U8 *)&(u32))[3])

Most significant byte of 4th rank of u32.

Referenced by host_read_10_extram(), host_read_10_ram(), host_write_10_extram(), sbc_read_10(), and sbc_write_10().

#define MSB4D (   u64)    (((U8 *)&(u64))[4])

Most significant byte of 5th rank of u64.

#define MSB5D (   u64)    (((U8 *)&(u64))[5])

Most significant byte of 6th rank of u64.

#define MSB6D (   u64)    (((U8 *)&(u64))[6])

Most significant byte of 7th rank of u64.

#define MSB7D (   u64)    (((U8 *)&(u64))[7])

Most significant byte of 8th rank of u64.

#define MSH (   u32)    (((U16 *)&(u32))[0])

Most significant half-word of u32.

#define MSH0 (   u64)    (((U16 *)&(u64))[0])

Most significant half-word of 1st rank of u64.

#define MSH1 (   u64)    (((U16 *)&(u64))[1])

Most significant half-word of 2nd rank of u64.

#define MSH2 (   u64)    (((U16 *)&(u64))[2])

Most significant half-word of 3rd rank of u64.

#define MSH3 (   u64)    (((U16 *)&(u64))[3])

Most significant half-word of 4th rank of u64.

#define MSW (   u64)    (((U32 *)&(u64))[0])

Most significant word of u64.

#define nop ( )    do { __asm__ __volatile__ ("nop"); } while (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 Rd_bitfield (   value,
  mask 
)    (Rd_bits( value, mask) >> ctz(mask))

Reads the bit-field of a value specified by a given bit-mask.

Parameters
valueValue to read a bit-field from.
maskBit-mask indicating the bit-field to read.
Returns
Read bit-field.

Referenced by at45dbx_read_byte(), at45dbx_read_open(), at45dbx_read_sector_2_ram(), at45dbx_write_byte(), at45dbx_write_close(), at45dbx_write_open(), at45dbx_write_sector_from_ram(), LED_Read_Display_Field(), tc_read_ra(), tc_read_rb(), tc_read_rc(), and tc_read_tc().

#define Rd_bits (   value,
  mask 
)    ((value) & (mask))

Reads the bits of a value specified by a given bit-mask.

Parameters
valueValue to read bits from.
maskBit-mask indicating bits to read.
Returns
Read bits.

Referenced by LED_Read_Display_Mask().

#define Reset_CPU ( )

Resets the CPU by software.

Warning
It shall not be called from the CPU application mode.
#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.

Parameters
lvalInput/output lvalue.
nBoundary.
algAlignment.
Returns
New value of lval resulting from its alignment set to alg with respect to the n boundary.
#define Set_bits (   lvalue,
  mask 
)    ((lvalue) |= (mask))

Sets the bits of a C lvalue specified by a given bit-mask.

Parameters
lvalueC lvalue of which to set bits.
maskBit-mask indicating bits to set.
Returns
Resulting value with set bits.

Referenced by fsaccess_alloc_nav_id(), LED_On(), prvjoystick_ISR_NonNakedBehaviour(), usb_device_task_init(), and usb_set_feature().

#define Set_debug_register (   dbgreg,
  value 
)    __builtin_mtdr(dbgreg, value)

Sets the value of the dbgreg debug register to value.

Parameters
dbgregAddress of the debug register of which to set the value.
valueValue to set the dbgreg debug register to.
#define SHORTENUM   __attribute__ ((packed))
#define Swap16 (   u16)
Value:
((U16)(((U16)(u16) >> 8) |\
((U16)(u16) << 8)))
uint16_t U16
16-bit unsigned integer.
Definition: compiler.h:214

Toggles the endianism of u16 (by swapping its bytes).

Parameters
u16U16 of which to toggle the endianism.
Returns
Value resulting from u16 with toggled endianism.
Note
More optimized if only used with values known at compile time.
#define swap16 (   u16)    ((U16)__builtin_bswap_16((U16)(u16)))

Toggles the endianism of u16 (by swapping its bytes).

Parameters
u16U16 of which to toggle the endianism.
Returns
Value resulting from u16 with toggled endianism.
Note
More optimized if only used with values unknown at compile time.
#define Swap32 (   u32)
Value:
((U32)(((U32)Swap16((U32)(u32) >> 16)) |\
((U32)Swap16((U32)(u32)) << 16)))
uint32_t U32
32-bit unsigned integer.
Definition: compiler.h:218
#define Swap16(u16)
Toggles the endianism of u16 (by swapping its bytes).
Definition: compiler.h:1148

Toggles the endianism of u32 (by swapping its bytes).

Parameters
u32U32 of which to toggle the endianism.
Returns
Value resulting from u32 with toggled endianism.
Note
More optimized if only used with values known at compile time.
#define swap32 (   u32)    ((U32)__builtin_bswap_32((U32)(u32)))

Toggles the endianism of u32 (by swapping its bytes).

Parameters
u32U32 of which to toggle the endianism.
Returns
Value resulting from u32 with toggled endianism.
Note
More optimized if only used with values unknown at compile time.
#define Swap64 (   u64)
Value:
((U64)(((U64)Swap32((U64)(u64) >> 32)) |\
((U64)Swap32((U64)(u64)) << 32)))
unsigned long long int U64
64-bit unsigned integer.
Definition: compiler.h:222
#define Swap32(u32)
Toggles the endianism of u32 (by swapping its bytes).
Definition: compiler.h:1159

Toggles the endianism of u64 (by swapping its bytes).

Parameters
u64U64 of which to toggle the endianism.
Returns
Value resulting from u64 with toggled endianism.
Note
More optimized if only used with values known at compile time.
#define swap64 (   u64)
Value:
((U64)(((U64)swap32((U64)(u64) >> 32)) |\
((U64)swap32((U64)(u64)) << 32)))
unsigned long long int U64
64-bit unsigned integer.
Definition: compiler.h:222
#define swap32(u32)
Toggles the endianism of u32 (by swapping its bytes).
Definition: compiler.h:1201

Toggles the endianism of u64 (by swapping its bytes).

Parameters
u64U64 of which to toggle the endianism.
Returns
Value resulting from u64 with toggled endianism.
Note
More optimized if only used with values unknown at compile time.
#define Test_align (   val,
 
)    (!Tst_bits( val, (n) - 1 ) )

Tests alignment of the number val with the n boundary.

Parameters
valInput value.
nBoundary.
Returns
1 if the number val is aligned with the n boundary, else 0.

Referenced by file_read_buf(), file_write_buf(), flashc_memset64(), host_read_p_rxpacket(), host_set_p_txpacket(), host_write_p_txpacket(), usb_read_ep_rxpacket(), usb_set_ep_txpacket(), and usb_write_ep_txpacket().

#define Tgl_bits (   lvalue,
  mask 
)    ((lvalue) ^= (mask))

Toggles the bits of a C lvalue specified by a given bit-mask.

Parameters
lvalueC lvalue of which to toggle bits.
maskBit-mask indicating bits to toggle.
Returns
Resulting value with toggled bits.

Referenced by LED_Toggle().

#define true   1

Referenced by xMACBInit().

#define Tst_bits (   value,
  mask 
)    (Rd_bits(value, mask) != 0)

Tests the bits of a value specified by a given bit-mask.

Parameters
valueValue of which to test bits.
maskBit-mask indicating bits to test.
Returns
1 if at least one of the tested bits is set, else 0.

Referenced by fsaccess_alloc_nav_id(), LED_Test(), tc_write_ra(), tc_write_rb(), and tc_write_rc().

#define Wr_bitfield (   lvalue,
  mask,
  bitfield 
)    (Wr_bits(lvalue, mask, (U32)(bitfield) << ctz(mask)))

Writes the bit-field of a C lvalue specified by a given bit-mask.

Parameters
lvalueC lvalue to write a bit-field to.
maskBit-mask indicating the bit-field to write.
bitfieldBit-field to write.
Returns
Resulting value with written bit-field.

Referenced by tc_write_ra(), tc_write_rb(), tc_write_rc(), and usb_set_feature().

#define Wr_bits (   lvalue,
  mask,
  bits 
)
Value:
((lvalue) = ((lvalue) & ~(mask)) |\
((bits ) & (mask)))

Writes the bits of a C lvalue specified by a given bit-mask.

Parameters
lvalueC lvalue to write bits to.
maskBit-mask indicating bits to write.
bitsBits to write.
Returns
Resulting value with written bits.

Referenced by LED_Display_Mask().

typedef uint16_t be16_t
typedef uint32_t be32_t
typedef unsigned char Bool

Boolean.

typedef unsigned char bool

Boolean.

typedef U8 Byte

8-bit unsigned integer.

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 signed long long int S64

64-bit signed integer.

typedef int8_t S8

8-bit signed integer.

Boolean status.

typedef U8 Status_t

8-bit-coded status.

typedef uint16_t U16

16-bit unsigned integer.

typedef uint32_t U32

32-bit unsigned integer.

typedef unsigned long long int U64

64-bit unsigned integer.

typedef uint8_t U8

8-bit unsigned integer.

static void convert_16_bit_to_byte_address ( uint64_t  value,
uint8_t *  data 
)
inlinestatic
static void convert_16_bit_to_byte_array ( uint16_t  value,
uint8_t *  data 
)
inlinestatic
static uint16_t convert_byte_array_to_16_bit ( uint8_t *  data)
inlinestatic
static uint32_t convert_byte_array_to_32_bit ( uint8_t *  data)
inlinestatic
static uint64_t convert_byte_array_to_64_bit ( uint8_t *  data)
inlinestatic
static void convert_spec_16_bit_to_byte_array ( uint16_t  value,
uint8_t *  data 
)
inlinestatic
static int_fast8_t ilog2 ( uint32_t  x)
inlinestatic

Calculate the base-2 logarithm of a number rounded down to the nearest integer.

Parameters
xA 32-bit value
Returns
The base-2 logarithm of x, or -1 if x is 0.

References clz, ilog2_undefined(), and is_constant.

int_fast8_t ilog2_undefined ( void  )

Undefined function. Will cause a link failure if ilog2() is called with an invalid constant value.

Referenced by ilog2().

static void* memcpy_be ( void s1,
const void s2,
char  n 
)
inlinestatic