Compiler file for AVR32. More...
#include <avr32/io.h>#include "preprocessor.h"#include <stddef.h>#include <stdlib.h>Go to the source code of this file.
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... | |
Defines | |
| #define | Assert(expr) |
| This macro is used to test fatal errors. | |
| #define | BIG_ENDIAN_MCU (!LITTLE_ENDIAN_MCU) |
| Boolean evaluating MCU big endianism. | |
| #define | LITTLE_ENDIAN_MCU FALSE |
| Boolean evaluating MCU little endianism. | |
| #define | Long_call(addr) ((*(void (*)(void))(addr))()) |
| Calls the routine at address addr. | |
| #define | Reset_CPU() |
| Resets the CPU by software. | |
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:
| |
| #define | abs(a) |
| Takes the absolute value of a. | |
| #define | Abs(a) (((a) < 0 ) ? -(a) : (a)) |
| Takes the absolute value of a. | |
| #define | max(a, b) |
| Takes the maximal value of a and b. | |
| #define | Max(a, b) (((a) > (b)) ? (a) : (b)) |
| Takes the maximal value of a and b. | |
| #define | min(a, b) |
| Takes the minimal value of a and b. | |
| #define | Min(a, b) (((a) < (b)) ? (a) : (b)) |
| Takes the minimal value of a and b. | |
Alignment | |
| #define | Align_down(val, n) ( (val) & ~((n) - 1)) |
| Aligns the number val with the lower n boundary. | |
| #define | Align_up(val, n) (((val) + ((n) - 1)) & ~((n) - 1)) |
| Aligns the number val with the upper n boundary. | |
| #define | Get_align(val, n) ( Rd_bits( val, (n) - 1 ) ) |
| Gets alignment of the number val with respect to the n boundary. | |
| #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. | |
| #define | Test_align(val, n) (!Tst_bits( val, (n) - 1 ) ) |
| Tests alignment of the number val with the n boundary. | |
CPU Status Register Access | |
| #define | AVR32_ENTER_CRITICAL_REGION() |
| Protects subsequent code from interrupts. | |
| #define | AVR32_LEAVE_CRITICAL_REGION() |
| This macro must always be used in conjunction with AVR32_ENTER_CRITICAL_REGION so that interrupts are enabled again. | |
| #define | Disable_global_exception() ({__asm__ __volatile__ ("ssrf\t%0" : : "i" (AVR32_SR_EM_OFFSET));}) |
| Disables exceptions globally. | |
| #define | Disable_global_interrupt() ({__asm__ __volatile__ ("ssrf\t%0" : : "i" (AVR32_SR_GM_OFFSET));}) |
| Disables interrupts globally. | |
| #define | Disable_interrupt_level(int_level) ({__asm__ __volatile__ ("ssrf\t%0" : : "i" (TPASTE3(AVR32_SR_I, int_level, M_OFFSET)));}) |
| Disables interrupt level int_level. | |
| #define | Enable_global_exception() ({__asm__ __volatile__ ("csrf\t%0" : : "i" (AVR32_SR_EM_OFFSET));}) |
| Enables exceptions globally. | |
| #define | Enable_global_interrupt() ({__asm__ __volatile__ ("csrf\t%0" : : "i" (AVR32_SR_GM_OFFSET));}) |
| Enables interrupts globally. | |
| #define | Enable_interrupt_level(int_level) ({__asm__ __volatile__ ("csrf\t%0" : : "i" (TPASTE3(AVR32_SR_I, int_level, M_OFFSET)));}) |
| Enables interrupt level int_level. | |
| #define | Is_global_exception_enabled() (!Tst_bits(Get_system_register(AVR32_SR), AVR32_SR_EM_MASK)) |
| Tells whether exceptions are globally enabled. | |
| #define | Is_global_interrupt_enabled() (!Tst_bits(Get_system_register(AVR32_SR), AVR32_SR_GM_MASK)) |
| Tells whether interrupts are globally enabled. | |
| #define | Is_interrupt_level_enabled(int_level) (!Tst_bits(Get_system_register(AVR32_SR), TPASTE3(AVR32_SR_I, int_level, M_MASK))) |
| Tells whether interrupt level int_level is enabled. | |
Bit Reversing | |
| #define | bit_reverse16(u16) ((U16)(bit_reverse32((U16)(u16)) >> 16)) |
| Reverses the bits of u16. | |
| #define | bit_reverse32(u32) |
| Reverses the bits of u32. | |
| #define | bit_reverse64(u64) |
| Reverses the bits of u64. | |
| #define | bit_reverse8(u8) ((U8)(bit_reverse32((U8)(u8)) >> 24)) |
| Reverses the bits of u8. | |
Usual Constants | |
| #define | CLR 0 |
| #define | DISABLE 0 |
| #define | DISABLED 0 |
| #define | ENABLE 1 |
| #define | ENABLED 1 |
| #define | FAIL 1 |
| #define | false FALSE |
| #define | FALSE 0 |
| #define | HIGH 1 |
| #define | KO 0 |
| #define | LOW 0 |
| #define | OFF 0 |
| #define | OK 1 |
| #define | ON 1 |
| #define | PASS 0 |
| #define | SET 1 |
| #define | true TRUE |
| #define | TRUE 1 |
Bit-Field Handling | |
| #define | Clr_bits(lvalue, mask) ((lvalue) &= ~(mask)) |
| Clears the bits of a C lvalue specified by a given bit-mask. | |
| #define | Rd_bitfield(value, mask) (Rd_bits( value, mask) >> ctz(mask)) |
| Reads the bit-field of a value specified by a given bit-mask. | |
| #define | Rd_bits(value, mask) ((value) & (mask)) |
| Reads the bits of a value specified by a given bit-mask. | |
| #define | Set_bits(lvalue, mask) ((lvalue) |= (mask)) |
| Sets the bits of a C lvalue specified by a given bit-mask. | |
| #define | Tgl_bits(lvalue, mask) ((lvalue) ^= (mask)) |
| Toggles the bits of a C lvalue specified by a given bit-mask. | |
| #define | Tst_bits(value, mask) (Rd_bits(value, mask) != 0) |
| Tests the bits of a value specified by a given bit-mask. | |
| #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. | |
| #define | Wr_bits(lvalue, mask, bits) |
| Writes the bits of a C lvalue specified by a given bit-mask. | |
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) __builtin_clz(u) |
| Counts the leading zero bits of the given value considered as a 32-bit integer. | |
| #define | ctz(u) __builtin_ctz(u) |
| Counts the trailing zero bits of the given value considered as a 32-bit integer. | |
Debug Register Access | |
| #define | Get_debug_register(dbgreg) __builtin_mfdr(dbgreg) |
| Gets the value of the dbgreg debug register. | |
| #define | Set_debug_register(dbgreg, value) __builtin_mtdr(dbgreg, value) |
| Sets the value of the dbgreg debug register to value. | |
System Register Access | |
| #define | Get_system_register(sysreg) __builtin_mfsr(sysreg) |
| Gets the value of the sysreg system register. | |
| #define | Set_system_register(sysreg, value) __builtin_mtsr(sysreg, value) |
| Sets the value of the sysreg system register to value. | |
MCU Endianism Handling | |
| #define | LSB(u16) (((U8 *)&(u16))[1]) |
| Least significant byte of u16. | |
| #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 | 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 | 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 | 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))[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 | MSB(u16) (((U8 *)&(u16))[0]) |
| Most significant byte of u16. | |
| #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. | |
| #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. | |
| #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. | |
| #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. | |
| #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. | |
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:
| |
| #define | swap16(u16) ((U16)__builtin_bswap_16((U16)(u16))) |
| Toggles the endianism of u16 (by swapping its bytes). | |
| #define | Swap16(u16) |
| Toggles the endianism of u16 (by swapping its bytes). | |
| #define | swap32(u32) ((U32)__builtin_bswap_32((U32)(u32))) |
| Toggles the endianism of u32 (by swapping its bytes). | |
| #define | Swap32(u32) |
| Toggles the endianism of u32 (by swapping its bytes). | |
| #define | swap64(u64) |
| Toggles the endianism of u64 (by swapping its bytes). | |
| #define | Swap64(u64) |
| Toggles the endianism of u64 (by swapping its bytes). | |
Typedefs | |
Usual Types | |
| typedef unsigned char | bool |
| Boolean. | |
| typedef unsigned char | Bool |
| Boolean. | |
| typedef float | F32 |
| 32-bit floating-point number. | |
| typedef double | F64 |
| 64-bit floating-point number. | |
| typedef signed short int | S16 |
| 16-bit signed integer. | |
| typedef signed long int | S32 |
| 32-bit signed integer. | |
| typedef signed long long int | S64 |
| 64-bit signed integer. | |
| typedef signed char | S8 |
| 8-bit signed integer. | |
| typedef unsigned short int | U16 |
| 16-bit unsigned integer. | |
| typedef unsigned long int | U32 |
| 32-bit unsigned integer. | |
| typedef unsigned long long int | U64 |
| 64-bit unsigned integer. | |
| typedef unsigned char | U8 |
| 8-bit unsigned integer. | |
Status Types | |
| typedef Bool | Status_bool_t |
| Boolean status. | |
| typedef U8 | Status_t |
| 8-bit-coded status. | |
Target Abstraction | |
|
| |
| #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 | LSB0(u32) LSB0W(u32) |
| Least significant byte of 1st rank of u32. | |
| #define | LSB1(u32) LSB1W(u32) |
| Least significant byte of 2nd rank of u32. | |
| #define | LSB2(u32) LSB2W(u32) |
| Least significant byte of 3rd rank of u32. | |
| #define | LSB3(u32) LSB3W(u32) |
| Least significant byte of 4th rank of u32. | |
| #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_ram2ram memcpy |
| Target-specific memcpy from RAM to RAM. | |
| #define | MSB0(u32) MSB0W(u32) |
| Most significant byte of 1st rank of u32. | |
| #define | MSB1(u32) MSB1W(u32) |
| Most significant byte of 2nd rank of u32. | |
| #define | MSB2(u32) MSB2W(u32) |
| Most significant byte of 3rd rank of u32. | |
| #define | MSB3(u32) MSB3W(u32) |
| Most significant byte of 4th rank of u32. | |
| typedef U8 | Byte |
| 8-bit unsigned integer. | |
Compiler file for AVR32.
This file defines commonly used types and macros.
Definition in file compiler.h.
| #define _CONST_TYPE_ const |
const type qualifier.
Definition at line 1115 of file compiler.h.
| #define _GLOBEXT_ extern |
extern storage-class specifier.
Definition at line 1114 of file compiler.h.
| #define _MEM_TYPE_FAST_ |
Fast memory type.
Definition at line 1118 of file compiler.h.
| #define _MEM_TYPE_MEDFAST_ |
Fairly fast memory type.
Definition at line 1117 of file compiler.h.
| #define _MEM_TYPE_SLOW_ |
Slow memory type.
Definition at line 1116 of file compiler.h.
| #define abs | ( | a | ) |
(\
{\
int __value = (a);\
__asm__ ("abs\t%0" : "+r" (__value) : : "cc");\
__value;\
}\
)
Takes the absolute value of a.
| a | Input value. |
Definition at line 589 of file compiler.h.
| #define Abs | ( | a | ) | (((a) < 0 ) ? -(a) : (a)) |
Takes the absolute value of a.
| a | Input value. |
Definition at line 556 of file compiler.h.
| #define Align_down | ( | val, | |||
| n | ) | ( (val) & ~((n) - 1)) |
Aligns the number val with the lower n boundary.
| val | Input value. | |
| n | Boundary. |
Definition at line 530 of file compiler.h.
Referenced by flashcdw_memcpy(), and flashcdw_memset64().
| #define Align_up | ( | val, | |||
| n | ) | (((val) + ((n) - 1)) & ~((n) - 1)) |
Aligns the number val with the upper n boundary.
| val | Input value. | |
| n | Boundary. |
Definition at line 521 of file compiler.h.
| #define Assert | ( | expr | ) |
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.
| expr | Expression to evaluate and supposed to be nonzero. |
Definition at line 386 of file compiler.h.
| #define AVR32_ENTER_CRITICAL_REGION | ( | ) |
{ \
Bool global_interrupt_enabled = Is_global_interrupt_enabled(); \
Disable_global_interrupt();
Protects subsequent code from interrupts.
Definition at line 862 of file compiler.h.
Referenced by pm_config_mainclk_safety(), pm_disable_clk_domain_div(), pm_disable_module(), pm_enable_module(), pm_set_clk_domain_div(), pm_set_mclk_source(), scif_configure_osc_crystalmode(), scif_dfll0_closedloop_start(), scif_dfll0_openloop_start(), scif_dfll0_openloop_stop(), scif_dfll0_openloop_updatefreq(), scif_dfll0_ssg_enable(), scif_enable_osc(), scif_start_osc(), scif_start_osc32(), scif_start_rc120M(), scif_start_rc32k(), scif_stop_osc(), scif_stop_osc32(), scif_stop_rc120M(), and scif_stop_rc32k().
| #define AVR32_LEAVE_CRITICAL_REGION | ( | ) |
if (global_interrupt_enabled) Enable_global_interrupt(); \ }
This macro must always be used in conjunction with AVR32_ENTER_CRITICAL_REGION so that interrupts are enabled again.
Definition at line 870 of file compiler.h.
Referenced by pm_config_mainclk_safety(), pm_disable_clk_domain_div(), pm_disable_module(), pm_enable_module(), pm_set_clk_domain_div(), pm_set_mclk_source(), scif_configure_osc_crystalmode(), scif_dfll0_closedloop_start(), scif_dfll0_openloop_start(), scif_dfll0_openloop_stop(), scif_dfll0_openloop_updatefreq(), scif_dfll0_ssg_enable(), scif_enable_osc(), scif_start_osc(), scif_start_osc32(), scif_start_rc120M(), scif_start_rc32k(), scif_stop_osc(), scif_stop_osc32(), scif_stop_rc120M(), and scif_stop_rc32k().
| #define BIG_ENDIAN_MCU (!LITTLE_ENDIAN_MCU) |
Boolean evaluating MCU big endianism.
Definition at line 923 of file compiler.h.
Reverses the bits of u16.
| u16 | U16 of which to reverse the bits. |
Definition at line 449 of file compiler.h.
| #define bit_reverse32 | ( | u32 | ) |
(\
{\
unsigned int __value = (U32)(u32);\
__asm__ ("brev\t%0" : "+r" (__value) : : "cc");\
(U32)__value;\
}\
)
Reverses the bits of u32.
| u32 | U32 of which to reverse the bits. |
Definition at line 458 of file compiler.h.
| #define bit_reverse64 | ( | u64 | ) |
((U64)(((U64)bit_reverse32((U64)(u64) >> 32)) |\ ((U64)bit_reverse32((U64)(u64)) << 32)))
Reverses the bits of u64.
| u64 | U64 of which to reverse the bits. |
Definition at line 476 of file compiler.h.
Reverses the bits of u8.
| u8 | U8 of which to reverse the bits. |
Definition at line 441 of file compiler.h.
| #define CLR 0 |
Definition at line 284 of file compiler.h.
| #define Clr_bits | ( | lvalue, | |||
| mask | ) | ((lvalue) &= ~(mask)) |
Clears the bits of a C lvalue specified by a given bit-mask.
| lvalue | C lvalue of which to clear bits. | |
| mask | Bit-mask indicating bits to clear. |
Definition at line 331 of file compiler.h.
Referenced by LED_Off().
| #define clz | ( | u | ) | __builtin_clz(u) |
Counts the leading zero bits of the given value considered as a 32-bit integer.
| u | Value of which to count the leading zero bits. |
Definition at line 411 of file compiler.h.
Referenced by _get_interrupt_handler(), and flashcdw_set_bootloader_protected_size().
| #define ctz | ( | u | ) | __builtin_ctz(u) |
Counts the trailing zero bits of the given value considered as a 32-bit integer.
| u | Value of which to count the trailing zero bits. |
Definition at line 423 of file compiler.h.
Referenced by LED_Display_Field(), LED_Display_Mask(), LED_Get_Intensity(), LED_Off(), LED_On(), LED_Set_Intensity(), LED_Toggle(), and pm_find_divratio().
| #define DISABLE 0 |
Definition at line 264 of file compiler.h.
Referenced by pm_disable_clk_domain_div(), and scif_dfll0_ssg_gc_enable().
| #define Disable_global_exception | ( | ) | ({__asm__ __volatile__ ("ssrf\t%0" : : "i" (AVR32_SR_EM_OFFSET));}) |
Disables exceptions globally.
Definition at line 797 of file compiler.h.
| #define Disable_global_interrupt | ( | ) | ({__asm__ __volatile__ ("ssrf\t%0" : : "i" (AVR32_SR_GM_OFFSET));}) |
Disables interrupts globally.
Definition at line 819 of file compiler.h.
Referenced by pm_bod_disable_irq().
| #define Disable_interrupt_level | ( | int_level | ) | ({__asm__ __volatile__ ("ssrf\t%0" : : "i" (TPASTE3(AVR32_SR_I, int_level, M_OFFSET)));}) |
Disables interrupt level int_level.
| int_level | Interrupt level to disable (0 to 3). |
Definition at line 845 of file compiler.h.
| #define DISABLED 0 |
Definition at line 266 of file compiler.h.
| #define ENABLE 1 |
Definition at line 265 of file compiler.h.
Referenced by scif_dfll0_closedloop_start(), scif_dfll0_openloop_start(), scif_dfll0_ssg_enable(), scif_enable_osc(), scif_start_osc(), and scif_start_osc32().
| #define Enable_global_exception | ( | ) | ({__asm__ __volatile__ ("csrf\t%0" : : "i" (AVR32_SR_EM_OFFSET));}) |
Enables exceptions globally.
Definition at line 805 of file compiler.h.
| #define Enable_global_interrupt | ( | ) | ({__asm__ __volatile__ ("csrf\t%0" : : "i" (AVR32_SR_GM_OFFSET));}) |
Enables interrupts globally.
Definition at line 827 of file compiler.h.
Referenced by pm_bod_disable_irq().
| #define Enable_interrupt_level | ( | int_level | ) | ({__asm__ __volatile__ ("csrf\t%0" : : "i" (TPASTE3(AVR32_SR_I, int_level, M_OFFSET)));}) |
Enables interrupt level int_level.
| int_level | Interrupt level to enable (0 to 3). |
Definition at line 855 of file compiler.h.
| #define ENABLED 1 |
Definition at line 267 of file compiler.h.
| #define FAIL 1 |
Definition at line 281 of file compiler.h.
Referenced by pcl_configure_clocks().
| #define false FALSE |
Definition at line 274 of file compiler.h.
| #define FALSE 0 |
Definition at line 270 of file compiler.h.
Referenced by flashcdw_enable_jtag_user_protection(), flashcdw_enable_lock_error_int(), flashcdw_enable_prog_error_int(), flashcdw_enable_ready_int(), flashcdw_erase_gp_fuse_bitfield(), flashcdw_erase_gp_fuse_byte(), flashcdw_is_secure_state_enabled(), flashcdw_memcpy(), flashcdw_memset64(), flashcdw_set_all_gp_fuses(), flashcdw_set_gp_fuse_bit(), flashcdw_set_gp_fuse_byte(), pcl_configure_clocks(), and pm_configure_clocks().
| #define Get_align | ( | val, | |||
| n | ) | ( Rd_bits( val, (n) - 1 ) ) |
Gets alignment of the number val with respect to the n boundary.
| val | Input value. | |
| n | Boundary. |
Definition at line 502 of file compiler.h.
Referenced by flashcdw_memcpy(), and flashcdw_memset64().
| #define Get_debug_register | ( | dbgreg | ) | __builtin_mfdr(dbgreg) |
Gets the value of the dbgreg debug register.
| dbgreg | Address of the debug register of which to get the value. |
Definition at line 888 of file compiler.h.
| #define Get_system_register | ( | sysreg | ) | __builtin_mfsr(sysreg) |
Gets the value of the sysreg system register.
| sysreg | Address of the system register of which to get the value. |
Definition at line 765 of file compiler.h.
Referenced by gpio_local_init().
| #define HIGH 1 |
Definition at line 283 of file compiler.h.
| #define Is_global_exception_enabled | ( | ) | (!Tst_bits(Get_system_register(AVR32_SR), AVR32_SR_EM_MASK)) |
Tells whether exceptions are globally enabled.
1 if exceptions are globally enabled, else 0. Definition at line 792 of file compiler.h.
| #define Is_global_interrupt_enabled | ( | ) | (!Tst_bits(Get_system_register(AVR32_SR), AVR32_SR_GM_MASK)) |
Tells whether interrupts are globally enabled.
1 if interrupts are globally enabled, else 0. Definition at line 814 of file compiler.h.
Referenced by pm_bod_disable_irq().
| #define Is_interrupt_level_enabled | ( | int_level | ) | (!Tst_bits(Get_system_register(AVR32_SR), TPASTE3(AVR32_SR_I, int_level, M_MASK))) |
Tells whether interrupt level int_level is enabled.
| int_level | Interrupt level (0 to 3). |
1 if interrupt level int_level is enabled, else 0. Definition at line 838 of file compiler.h.
| #define KO 0 |
Definition at line 278 of file compiler.h.
| #define LITTLE_ENDIAN_MCU FALSE |
Boolean evaluating MCU little endianism.
Definition at line 911 of file compiler.h.
| #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.
| addr | Address of the routine to call. |
Definition at line 659 of file compiler.h.
| #define LOW 0 |
Definition at line 282 of file compiler.h.
| #define LSB | ( | u16 | ) | (((U8 *)&(u16))[1]) |
Least significant byte of u16.
Definition at line 976 of file compiler.h.
| #define LSB0 | ( | u32 | ) | LSB0W(u32) |
Least significant byte of 1st rank of u32.
Definition at line 1127 of file compiler.h.
| #define LSB0D | ( | u64 | ) | MSB7D(u64) |
Least significant byte of 1st rank of u64.
Definition at line 1014 of file compiler.h.
| #define LSB0W | ( | u32 | ) | MSB3W(u32) |
Least significant byte of 1st rank of u32.
Definition at line 987 of file compiler.h.
| #define LSB1 | ( | u32 | ) | LSB1W(u32) |
Least significant byte of 2nd rank of u32.
Definition at line 1128 of file compiler.h.
| #define LSB1D | ( | u64 | ) | MSB6D(u64) |
Least significant byte of 2nd rank of u64.
Definition at line 1013 of file compiler.h.
| #define LSB1W | ( | u32 | ) | MSB2W(u32) |
Least significant byte of 2nd rank of u32.
Definition at line 986 of file compiler.h.
| #define LSB2 | ( | u32 | ) | LSB2W(u32) |
Least significant byte of 3rd rank of u32.
Definition at line 1129 of file compiler.h.
| #define LSB2D | ( | u64 | ) | MSB5D(u64) |
Least significant byte of 3rd rank of u64.
Definition at line 1012 of file compiler.h.
| #define LSB2W | ( | u32 | ) | MSB1W(u32) |
Least significant byte of 3rd rank of u32.
Definition at line 985 of file compiler.h.
| #define LSB3 | ( | u32 | ) | LSB3W(u32) |
Least significant byte of 4th rank of u32.
Definition at line 1130 of file compiler.h.
| #define LSB3D | ( | u64 | ) | MSB4D(u64) |
Least significant byte of 4th rank of u64.
Definition at line 1011 of file compiler.h.
| #define LSB3W | ( | u32 | ) | MSB0W(u32) |
Least significant byte of 4th rank of u32.
Definition at line 984 of file compiler.h.
| #define LSB4D | ( | u64 | ) | MSB3D(u64) |
Least significant byte of 5th rank of u64.
Definition at line 1010 of file compiler.h.
| #define LSB5D | ( | u64 | ) | MSB2D(u64) |
Least significant byte of 6th rank of u64.
Definition at line 1009 of file compiler.h.
| #define LSB6D | ( | u64 | ) | MSB1D(u64) |
Least significant byte of 7th rank of u64.
Definition at line 1008 of file compiler.h.
| #define LSB7D | ( | u64 | ) | MSB0D(u64) |
Least significant byte of 8th rank of u64.
Definition at line 1007 of file compiler.h.
| #define LSH | ( | u32 | ) | (((U16 *)&(u32))[1]) |
Least significant half-word of u32.
Definition at line 979 of file compiler.h.
| #define LSH0 | ( | u64 | ) | MSH3(u64) |
Least significant half-word of 1st rank of u64.
Definition at line 998 of file compiler.h.
| #define LSH1 | ( | u64 | ) | MSH2(u64) |
Least significant half-word of 2nd rank of u64.
Definition at line 997 of file compiler.h.
| #define LSH2 | ( | u64 | ) | MSH1(u64) |
Least significant half-word of 3rd rank of u64.
Definition at line 996 of file compiler.h.
| #define LSH3 | ( | u64 | ) | MSH0(u64) |
Least significant half-word of 4th rank of u64.
Definition at line 995 of file compiler.h.
| #define LSW | ( | u64 | ) | (((U32 *)&(u64))[1]) |
Least significant word of u64.
Definition at line 990 of file compiler.h.
| #define max | ( | a, | |||
| b | ) |
(\
{\
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.
| a | Input value. | |
| b | Input value. |
Definition at line 633 of file compiler.h.
Referenced by flashcdw_set_bootloader_protected_size().
| #define Max | ( | a, | |||
| b | ) | (((a) > (b)) ? (a) : (b)) |
Takes the maximal value of a and b.
| a | Input value. | |
| b | Input value. |
Definition at line 578 of file compiler.h.
| #define memcmp_code2ram memcmp |
Target-specific memcmp of RAM to NVRAM.
Definition at line 1123 of file compiler.h.
| #define memcmp_ram2ram memcmp |
Target-specific memcmp of RAM to RAM.
Definition at line 1122 of file compiler.h.
| #define memcpy_code2ram memcpy |
Target-specific memcpy from NVRAM to RAM.
Definition at line 1125 of file compiler.h.
| #define memcpy_ram2ram memcpy |
Target-specific memcpy from RAM to RAM.
Definition at line 1124 of file compiler.h.
| #define min | ( | a, | |||
| b | ) |
(\
{\
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.
| a | Input value. | |
| b | Input value. |
Definition at line 611 of file compiler.h.
Referenced by flashcdw_erase_gp_fuse_bitfield(), flashcdw_memcpy(), flashcdw_memset64(), flashcdw_read_gp_fuse_bitfield(), flashcdw_set_bootloader_protected_size(), flashcdw_set_gp_fuse_bitfield(), and flashcdw_write_gp_fuse_bitfield().
| #define Min | ( | a, | |||
| b | ) | (((a) < (b)) ? (a) : (b)) |
Takes the minimal value of a and b.
| a | Input value. | |
| b | Input value. |
Definition at line 567 of file compiler.h.
| #define MSB | ( | u16 | ) | (((U8 *)&(u16))[0]) |
Most significant byte of u16.
Definition at line 975 of file compiler.h.
| #define MSB0 | ( | u32 | ) | MSB0W(u32) |
Most significant byte of 1st rank of u32.
Definition at line 1134 of file compiler.h.
| #define MSB0D | ( | u64 | ) | (((U8 *)&(u64))[0]) |
Most significant byte of 1st rank of u64.
Definition at line 999 of file compiler.h.
| #define MSB0W | ( | u32 | ) | (((U8 *)&(u32))[0]) |
Most significant byte of 1st rank of u32.
Definition at line 980 of file compiler.h.
| #define MSB1 | ( | u32 | ) | MSB1W(u32) |
Most significant byte of 2nd rank of u32.
Definition at line 1133 of file compiler.h.
| #define MSB1D | ( | u64 | ) | (((U8 *)&(u64))[1]) |
Most significant byte of 2nd rank of u64.
Definition at line 1000 of file compiler.h.
| #define MSB1W | ( | u32 | ) | (((U8 *)&(u32))[1]) |
Most significant byte of 2nd rank of u32.
Definition at line 981 of file compiler.h.
| #define MSB2 | ( | u32 | ) | MSB2W(u32) |
Most significant byte of 3rd rank of u32.
Definition at line 1132 of file compiler.h.
| #define MSB2D | ( | u64 | ) | (((U8 *)&(u64))[2]) |
Most significant byte of 3rd rank of u64.
Definition at line 1001 of file compiler.h.
| #define MSB2W | ( | u32 | ) | (((U8 *)&(u32))[2]) |
Most significant byte of 3rd rank of u32.
Definition at line 982 of file compiler.h.
| #define MSB3 | ( | u32 | ) | MSB3W(u32) |
Most significant byte of 4th rank of u32.
Definition at line 1131 of file compiler.h.
| #define MSB3D | ( | u64 | ) | (((U8 *)&(u64))[3]) |
Most significant byte of 4th rank of u64.
Definition at line 1002 of file compiler.h.
| #define MSB3W | ( | u32 | ) | (((U8 *)&(u32))[3]) |
Most significant byte of 4th rank of u32.
Definition at line 983 of file compiler.h.
| #define MSB4D | ( | u64 | ) | (((U8 *)&(u64))[4]) |
Most significant byte of 5th rank of u64.
Definition at line 1003 of file compiler.h.
| #define MSB5D | ( | u64 | ) | (((U8 *)&(u64))[5]) |
Most significant byte of 6th rank of u64.
Definition at line 1004 of file compiler.h.
| #define MSB6D | ( | u64 | ) | (((U8 *)&(u64))[6]) |
Most significant byte of 7th rank of u64.
Definition at line 1005 of file compiler.h.
| #define MSB7D | ( | u64 | ) | (((U8 *)&(u64))[7]) |
Most significant byte of 8th rank of u64.
Definition at line 1006 of file compiler.h.
| #define MSH | ( | u32 | ) | (((U16 *)&(u32))[0]) |
Most significant half-word of u32.
Definition at line 978 of file compiler.h.
| #define MSH0 | ( | u64 | ) | (((U16 *)&(u64))[0]) |
Most significant half-word of 1st rank of u64.
Definition at line 991 of file compiler.h.
| #define MSH1 | ( | u64 | ) | (((U16 *)&(u64))[1]) |
Most significant half-word of 2nd rank of u64.
Definition at line 992 of file compiler.h.
| #define MSH2 | ( | u64 | ) | (((U16 *)&(u64))[2]) |
Most significant half-word of 3rd rank of u64.
Definition at line 993 of file compiler.h.
| #define MSH3 | ( | u64 | ) | (((U16 *)&(u64))[3]) |
Most significant half-word of 4th rank of u64.
Definition at line 994 of file compiler.h.
| #define MSW | ( | u64 | ) | (((U32 *)&(u64))[0]) |
Most significant word of u64.
Definition at line 989 of file compiler.h.
| #define OFF 0 |
Definition at line 268 of file compiler.h.
Referenced by local_start_dfll_clock(), and scif_dfll0_closedloop_configure_and_start().
| #define OK 1 |
Definition at line 279 of file compiler.h.
| #define ON 1 |
Definition at line 269 of file compiler.h.
| #define PASS 0 |
Definition at line 280 of file compiler.h.
Referenced by pcl_configure_clocks(), pcl_configure_synchronous_clocks(), pcl_configure_usb_clock(), pcl_switch_to_osc(), pm_config_mainclk_safety(), pm_disable_clk_domain_div(), pm_disable_module(), pm_enable_module(), pm_set_clk_domain_div(), pm_set_mclk_source(), pm_wait_for_clk_ready(), scif_configure_osc_crystalmode(), scif_dfll0_closedloop_configure_and_start(), scif_dfll0_closedloop_start(), scif_dfll0_openloop_start(), scif_dfll0_openloop_stop(), scif_dfll0_openloop_updatefreq(), scif_dfll0_ssg_enable(), scif_enable_osc(), scif_gc_enable(), scif_gc_setup(), scif_pclksr_statushigh_wait(), scif_start_gclk(), scif_start_osc(), scif_start_osc32(), scif_stop_gclk(), scif_stop_osc(), and scif_stop_osc32().
| #define Rd_bitfield | ( | value, | |||
| mask | ) | (Rd_bits( value, mask) >> ctz(mask)) |
Reads the bit-field of a value specified by a given bit-mask.
| value | Value to read a bit-field from. | |
| mask | Bit-mask indicating the bit-field to read. |
Definition at line 358 of file compiler.h.
Referenced by LED_Read_Display_Field().
| #define Rd_bits | ( | value, | |||
| mask | ) | ((value) & (mask)) |
Reads the bits of a value specified by a given bit-mask.
| value | Value to read bits from. | |
| mask | Bit-mask indicating bits to read. |
Definition at line 302 of file compiler.h.
Referenced by LED_Read_Display_Mask().
| #define Reset_CPU | ( | ) |
Resets the CPU by software.
Definition at line 666 of file compiler.h.
| #define SET 1 |
Definition at line 285 of file compiler.h.
| #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.
| lval | Input/output lvalue. | |
| n | Boundary. | |
| alg | Alignment. |
Definition at line 512 of file compiler.h.
| #define Set_bits | ( | lvalue, | |||
| mask | ) | ((lvalue) |= (mask)) |
Sets the bits of a C lvalue specified by a given bit-mask.
| lvalue | C lvalue of which to set bits. | |
| mask | Bit-mask indicating bits to set. |
Definition at line 340 of file compiler.h.
Referenced by LED_On().
| #define Set_debug_register | ( | dbgreg, | |||
| value | ) | __builtin_mtdr(dbgreg, value) |
Sets the value of the dbgreg debug register to value.
| dbgreg | Address of the debug register of which to set the value. | |
| value | Value to set the dbgreg debug register to. |
Definition at line 899 of file compiler.h.
| #define Set_system_register | ( | sysreg, | |||
| value | ) | __builtin_mtsr(sysreg, value) |
Sets the value of the sysreg system register to value.
| sysreg | Address of the system register of which to set the value. | |
| value | Value to set the sysreg system register to. |
Definition at line 776 of file compiler.h.
Referenced by gpio_local_init(), and INTC_init_evba().
Toggles the endianism of u16 (by swapping its bytes).
| u16 | U16 of which to toggle the endianism. |
Definition at line 1077 of file compiler.h.
| #define Swap16 | ( | u16 | ) |
Toggles the endianism of u16 (by swapping its bytes).
| u16 | U16 of which to toggle the endianism. |
Definition at line 1043 of file compiler.h.
Toggles the endianism of u32 (by swapping its bytes).
| u32 | U32 of which to toggle the endianism. |
Definition at line 1091 of file compiler.h.
| #define Swap32 | ( | u32 | ) |
Toggles the endianism of u32 (by swapping its bytes).
| u32 | U32 of which to toggle the endianism. |
Definition at line 1054 of file compiler.h.
| #define swap64 | ( | u64 | ) |
Toggles the endianism of u64 (by swapping its bytes).
| u64 | U64 of which to toggle the endianism. |
Definition at line 1104 of file compiler.h.
| #define Swap64 | ( | u64 | ) |
Toggles the endianism of u64 (by swapping its bytes).
| u64 | U64 of which to toggle the endianism. |
Definition at line 1065 of file compiler.h.
| #define Test_align | ( | val, | |||
| n | ) | (!Tst_bits( val, (n) - 1 ) ) |
Tests alignment of the number val with the n boundary.
| val | Input value. | |
| n | Boundary. |
1 if the number val is aligned with the n boundary, else 0. Definition at line 493 of file compiler.h.
Referenced by flashcdw_memcpy(), and flashcdw_memset64().
| #define Tgl_bits | ( | lvalue, | |||
| mask | ) | ((lvalue) ^= (mask)) |
Toggles the bits of a C lvalue specified by a given bit-mask.
| lvalue | C lvalue of which to toggle bits. | |
| mask | Bit-mask indicating bits to toggle. |
Definition at line 349 of file compiler.h.
Referenced by LED_Toggle().
| #define true TRUE |
Definition at line 275 of file compiler.h.
| #define TRUE 1 |
Definition at line 271 of file compiler.h.
Referenced by _unhandled_interrupt(), flashcdw_disable_jtag_user_protection(), flashcdw_erase_all_gp_fuses(), flashcdw_erase_all_pages(), flashcdw_erase_gp_fuse_bit(), flashcdw_erase_gp_fuse_bitfield(), flashcdw_erase_gp_fuse_byte(), flashcdw_erase_page(), flashcdw_erase_user_page(), flashcdw_is_secure_state_enabled(), flashcdw_memcpy(), gpio_configure_pin_periph_event_mode(), pcl_configure_clocks(), pcl_configure_clocks_dfll0(), pm_configure_clocks(), and scif_dfll0_closedloop_configure_and_start().
| #define Tst_bits | ( | value, | |||
| mask | ) | (Rd_bits(value, mask) != 0) |
Tests the bits of a value specified by a given bit-mask.
| value | Value of which to test bits. | |
| mask | Bit-mask indicating bits to test. |
1 if at least one of the tested bits is set, else 0. Definition at line 322 of file compiler.h.
Referenced by LED_Test().
| #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.
| lvalue | C lvalue to write a bit-field to. | |
| mask | Bit-mask indicating the bit-field to write. | |
| bitfield | Bit-field to write. |
Definition at line 368 of file compiler.h.
| #define Wr_bits | ( | lvalue, | |||
| mask, | |||||
| bits | ) |
((lvalue) = ((lvalue) & ~(mask)) |\
((bits ) & (mask)))
Writes the bits of a C lvalue specified by a given bit-mask.
| lvalue | C lvalue to write bits to. | |
| mask | Bit-mask indicating bits to write. | |
| bits | Bits to write. |
Definition at line 312 of file compiler.h.
Referenced by LED_Display_Mask().
| typedef unsigned char bool |
Boolean.
Definition at line 89 of file compiler.h.
| typedef unsigned char Bool |
Boolean.
Definition at line 86 of file compiler.h.
8-bit unsigned integer.
Definition at line 1120 of file compiler.h.
| typedef float F32 |
32-bit floating-point number.
Definition at line 100 of file compiler.h.
| typedef double F64 |
64-bit floating-point number.
Definition at line 101 of file compiler.h.
| typedef signed short int S16 |
16-bit signed integer.
Definition at line 94 of file compiler.h.
| typedef signed long int S32 |
32-bit signed integer.
Definition at line 96 of file compiler.h.
| typedef signed long long int S64 |
64-bit signed integer.
Definition at line 98 of file compiler.h.
| typedef signed char S8 |
8-bit signed integer.
Definition at line 92 of file compiler.h.
| typedef Bool Status_bool_t |
Boolean status.
Definition at line 108 of file compiler.h.
8-bit-coded status.
Definition at line 109 of file compiler.h.
| typedef unsigned short int U16 |
16-bit unsigned integer.
Definition at line 95 of file compiler.h.
| typedef unsigned long int U32 |
32-bit unsigned integer.
Definition at line 97 of file compiler.h.
| typedef unsigned long long int U64 |
64-bit unsigned integer.
Definition at line 99 of file compiler.h.
| typedef unsigned char U8 |
8-bit unsigned integer.
Definition at line 93 of file compiler.h.
1.6.1