36 #if defined(__SAMV71Q21__) 37 #include "include/samv71/samv71.h" 38 #elif defined(__SAME70Q21__) 39 #include "include/same70/same70.h" 40 #elif defined(__SAMS70N20__) 42 #elif defined(__SAME70Q20B__) 45 #error "please define correct macro for the chip first!" 61 #if defined (__CC_ARM) 62 #define WEAK __attribute__ ((weak)) 63 #elif defined (__ICCARM__) 65 #elif defined (__GNUC__) 66 #define WEAK __attribute__ ((weak)) 72 #if defined (__CC_ARM) 73 #define COMPILER_NAME "KEIL" 74 #elif defined (__ICCARM__) 75 #define COMPILER_NAME "IAR" 76 #elif defined (__GNUC__) 77 #define COMPILER_NAME "GCC" 79 #endif // COMPILER_NAME 83 #if defined (__CC_ARM) 85 #elif defined (__ICCARM__) 86 #define NO_INIT __no_init 87 #elif defined (__GNUC__) 93 #if defined (__CC_ARM) 94 #define memory_sync() __dsb(15);__isb(15); 95 #elif defined (__ICCARM__) 96 #define memory_sync() __DSB();__ISB(); 97 #elif defined (__GNUC__) 98 #define memory_sync() __DSB();__ISB(); 102 #if defined (__CC_ARM) 103 #define memory_barrier() __dmb(15); 104 #elif defined (__ICCARM__) 105 #define memory_barrier() __DMB(); 106 #elif defined (__GNUC__) 107 #define memory_barrier() __DMB(); 120 #define TPASTE2(a, b) a##b 122 #define TPASTE3(a, b, c) a##b##c 136 #define ATPASTE2(a, b) TPASTE2(a, b) 137 #define ATPASTE3(a, b, c) TPASTE3(a, b, c) 148 #define COMPILER_PRAGMA(arg) _Pragma(#arg) 155 #define COMPILER_PACK_SET(alignment) COMPILER_PRAGMA(pack(alignment)) 162 #define COMPILER_PACK_RESET() COMPILER_PRAGMA(pack()) 168 #if defined (__CC_ARM) 169 #define COMPILER_SECTION(a) __attribute__((__section__(a))) 170 #elif defined (__ICCARM__) 171 #define COMPILER_SECTION(a) COMPILER_PRAGMA(location = a) 172 #elif defined (__GNUC__) 173 #define COMPILER_SECTION(a) __attribute__((__section__(a))) 179 #if defined (__CC_ARM) 180 #define COMPILER_ALIGNED(a) __attribute__((__aligned__(a))) 181 #elif defined (__ICCARM__) 182 #define COMPILER_ALIGNED(a) COMPILER_PRAGMA(data_alignment = a) 183 #elif defined (__GNUC__) 184 #define COMPILER_ALIGNED(a) __attribute__((__aligned__(a))) 191 #ifndef COMPILER_WORD_ALIGNED 192 #if defined (__CC_ARM) 193 #define COMPILER_WORD_ALIGNED __attribute__((__aligned__(4))) 194 #elif defined (__ICCARM__) 195 #define COMPILER_WORD_ALIGNED COMPILER_PRAGMA(data_alignment = 4) 196 #elif defined (__GNUC__) 197 #define COMPILER_WORD_ALIGNED __attribute__((__aligned__(4))) 199 #endif // COMPILER_WORD_ALIGNED 225 #define Abs(a) (((a) < 0) ? -(a) : (a)) 236 #define Min(a, b) (((a) < (b)) ? (a) : (b)) 247 #define Max(a, b) (((a) > (b)) ? (a) : (b)) 261 #define min(a, b) Min(a, b) 272 #define max(a, b) Max(a, b) 277 #define be32_to_cpu(x) __REV(x) 278 #define cpu_to_be32(x) __REV(x) 279 #define BE32_TO_CPU(x) __REV(x) 280 #define CPU_TO_BE32(x) __REV(x) 287 #define UNUSED(v) (void)(v) 311 # define irq_initialize_vectors() \ 332 # define irq_register_handler(int_num, int_prio) \ 333 NVIC_ClearPendingIRQ((IRQn_Type)int_num); \ 334 NVIC_SetPriority((IRQn_Type)int_num, int_prio); \ 335 NVIC_EnableIRQ((IRQn_Type)int_num); \ 340 # define cpu_irq_enable() \ 346 # define cpu_irq_disable() \ 355 #if !defined(__DOXYGEN__) 359 #define cpu_irq_is_enabled() (__get_PRIMASK() == 0) 391 #define Enable_global_interrupt() cpu_irq_enable() 392 #define Disable_global_interrupt() cpu_irq_disable() 393 #define Is_global_interrupt_enabled() cpu_irq_is_enabled() 410 #if !defined(__bool_true_false_are_defined) 432 #define ctz(u) ((u) & (1ul << 0) ? 0 : \ 433 (u) & (1ul << 1) ? 1 : \ 434 (u) & (1ul << 2) ? 2 : \ 435 (u) & (1ul << 3) ? 3 : \ 436 (u) & (1ul << 4) ? 4 : \ 437 (u) & (1ul << 5) ? 5 : \ 438 (u) & (1ul << 6) ? 6 : \ 439 (u) & (1ul << 7) ? 7 : \ 440 (u) & (1ul << 8) ? 8 : \ 441 (u) & (1ul << 9) ? 9 : \ 442 (u) & (1ul << 10) ? 10 : \ 443 (u) & (1ul << 11) ? 11 : \ 444 (u) & (1ul << 12) ? 12 : \ 445 (u) & (1ul << 13) ? 13 : \ 446 (u) & (1ul << 14) ? 14 : \ 447 (u) & (1ul << 15) ? 15 : \ 448 (u) & (1ul << 16) ? 16 : \ 449 (u) & (1ul << 17) ? 17 : \ 450 (u) & (1ul << 18) ? 18 : \ 451 (u) & (1ul << 19) ? 19 : \ 452 (u) & (1ul << 20) ? 20 : \ 453 (u) & (1ul << 21) ? 21 : \ 454 (u) & (1ul << 22) ? 22 : \ 455 (u) & (1ul << 23) ? 23 : \ 456 (u) & (1ul << 24) ? 24 : \ 457 (u) & (1ul << 25) ? 25 : \ 458 (u) & (1ul << 26) ? 26 : \ 459 (u) & (1ul << 27) ? 27 : \ 460 (u) & (1ul << 28) ? 28 : \ 461 (u) & (1ul << 29) ? 29 : \ 462 (u) & (1ul << 30) ? 30 : \ 463 (u) & (1ul << 31) ? 31 : \ 467 #endif // __ASSEMBLY__ 469 #endif // _COMPILER_H_ #define cpu_irq_disable()
Disable interrupts globally.
static volatile uint32_t cpu_irq_critical_section_counter
#define cpu_irq_is_enabled()
Check if interrupts are globally enabled.
static irqflags_t cpu_irq_save(void)
Get and clear the global interrupt flags.
volatile bool g_interrupt_enabled
static void cpu_irq_restore(irqflags_t flags)
Restore global interrupt flags.
Commonly used includes, types and macros.
static bool cpu_irq_is_enabled_flags(irqflags_t flags)
Check if interrupts are globally enabled in supplied flags.
static volatile bool cpu_irq_prev_interrupt_state
uint32_t irqflags_t
Type used for holding state of interrupt flag.
#define cpu_irq_enable()
Enable interrupts globally.