38 SysTick->LOAD = SysTick_LOAD_RELOAD_Msk;
39 SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;
47 uint32_t ticks = SysTick_LOAD_RELOAD_Msk - SysTick->VAL;
55 static inline __attribute__((always_inline))
58 uint32_t mask = __get_PRIMASK();
60 if ((mask == 0) &&
IS_USED(MODULE_DEBUG_IRQ_DISABLE)) {
71 static inline __attribute__((always_inline)) __attribute__((used))
74 unsigned result = __get_PRIMASK();
83 static inline __attribute__((always_inline))
84 #if !IS_USED(MODULE_DEBUG_IRQ_DISABLE)
90 void _irq_restore(
unsigned int state,
const char *file,
unsigned line)
104 #define irq_restore(state) _irq_restore(state, __FILE__, __LINE__);
110 static inline __attribute__((always_inline))
116 return (__get_PRIMASK() == 0);
122 static inline __attribute__((always_inline))
125 return (__get_IPSR() & 0xFF);
static void irq_restore(unsigned int state)
Restore the state of the IRQ flags.
static unsigned int irq_disable(void)
Disable all maskable interrupts.
static uint32_t _irq_debug_stop_count(void)
Stop SysTick timer, return time spent with IRQ disabled.
static void _irq_debug_start_count(void)
Start SysTick timer to measure time spent with IRQ disabled.
static bool irq_is_enabled(void)
See if IRQs are currently enabled.
static bool irq_is_in(void)
See if the current context is inside an ISR.
static unsigned int irq_enable(void)
Enable all maskable interrupts.
void debug_irq_disable_print(const char *file, unsigned line, uint32_t ticks)
Print time spent with IRQ disabled.
Common macros and compiler attributes/pragmas configuration.
#define IS_USED(module)
Checks whether a module is being used or not.