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;
55static inline __attribute__((always_inline))
56unsigned
int irq_disable(
void)
58 uint32_t mask = __get_PRIMASK();
60 if ((mask == 0) &&
IS_USED(MODULE_DEBUG_IRQ_DISABLE)) {
71static inline __attribute__((always_inline)) __attribute__((used))
72unsigned
int irq_enable(
void)
74 unsigned result = __get_PRIMASK();
83static inline __attribute__((always_inline))
84#if !IS_USED(MODULE_DEBUG_IRQ_DISABLE)
90void _irq_restore(
unsigned int state,
const char *file,
unsigned line)
104#define irq_restore(state) _irq_restore(state, __FILE__, __LINE__);
110static inline __attribute__((always_inline))
111bool irq_is_enabled(
void)
116 return (__get_PRIMASK() == 0);
122static inline __attribute__((always_inline))
125 return (__get_IPSR() & 0xFF);
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.
MAYBE_INLINE void irq_restore(unsigned state)
This function restores the IRQ disable bit in the status register to the value contained within passe...
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.