41#define _GENERAL_INTERRUPT_ENABLE (0x0008)
43__attribute__((always_inline))
static inline unsigned int irq_disable(
void)
47 "mov.w SR, %[state]" "\n\t"
48 "bic %[gie], SR" "\n\t"
50 "and %[gie], %[state]" "\n\t"
52 : [gie]
"i"(_GENERAL_INTERRUPT_ENABLE)
59__attribute__((always_inline))
static inline unsigned int irq_enable(
void)
63 "mov.w SR, %[state]" "\n\t"
65 "bis %[gie], SR" "\n\t"
67 "and %[gie], %[state]" "\n\t"
69 : [gie]
"i"(_GENERAL_INTERRUPT_ENABLE)
76__attribute__((always_inline))
static inline void irq_restore(
unsigned int state)
79 "bis %[state], SR" "\n\t"
87__attribute__((always_inline))
static inline bool irq_is_in(
void)
92__attribute__((always_inline))
static inline bool irq_is_enabled(
void)
96 "mov.w SR,%[state]" "\n\t"
102 return (state & GIE);
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.
volatile int __irq_is_in
The current ISR state (inside or not)