34 SysTick->LOAD = SysTick_LOAD_RELOAD_Msk;
35 SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;
43 uint32_t ticks = SysTick_LOAD_RELOAD_Msk - SysTick->VAL;
51static inline __attribute__((always_inline))
54 uint32_t mask = __get_PRIMASK();
56 if ((mask == 0) &&
IS_USED(MODULE_DEBUG_IRQ_DISABLE)) {
67static inline __attribute__((always_inline)) __attribute__((used))
70 unsigned result = __get_PRIMASK();
79static inline __attribute__((always_inline))
80#if !IS_USED(MODULE_DEBUG_IRQ_DISABLE)
86void _irq_restore(
unsigned int state,
const char *file,
unsigned line)
100#define irq_restore(state) _irq_restore(state, __FILE__, __LINE__);
106static inline __attribute__((always_inline))
112 return (__get_PRIMASK() == 0);
118static inline __attribute__((always_inline))
121 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...
MAYBE_INLINE unsigned irq_disable(void)
This function sets the IRQ disable bit in the status register.
MAYBE_INLINE bool irq_is_enabled(void)
Test if IRQs are currently enabled.
MAYBE_INLINE unsigned irq_enable(void)
This function clears the IRQ disable bit in the status register.
MAYBE_INLINE bool irq_is_in(void)
Check whether called from interrupt service routine.
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.