37 SysTick->LOAD = SysTick_LOAD_RELOAD_Msk;
38 SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;
46 uint32_t ticks = SysTick_LOAD_RELOAD_Msk - SysTick->VAL;
54 static inline __attribute__((always_inline))
57 uint32_t mask = __get_PRIMASK();
59 if ((mask == 0) &&
IS_USED(MODULE_DEBUG_IRQ_DISABLE)) {
70 static inline __attribute__((always_inline)) __attribute__((used))
73 unsigned result = __get_PRIMASK();
82 static inline __attribute__((always_inline))
83 #if !IS_USED(MODULE_DEBUG_IRQ_DISABLE)
89 void _irq_restore(
unsigned int state,
const char *file,
unsigned line)
103 #define irq_restore(state) _irq_restore(state, __FILE__, __LINE__);
109 static inline __attribute__((always_inline))
115 return (__get_PRIMASK() == 0);
121 static inline __attribute__((always_inline))
124 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.