40 #define _GENERAL_INTERRUPT_ENABLE (0x0008)
42 __attribute__((always_inline))
static inline unsigned int irq_disable(
void)
46 "mov.w SR, %[state]" "\n\t"
47 "bic %[gie], SR" "\n\t"
49 "and %[gie], %[state]" "\n\t"
51 : [gie]
"i"(_GENERAL_INTERRUPT_ENABLE)
58 __attribute__((always_inline))
static inline unsigned int irq_enable(
void)
62 "mov.w SR, %[state]" "\n\t"
64 "bis %[gie], SR" "\n\t"
66 "and %[gie], %[state]" "\n\t"
68 : [gie]
"i"(_GENERAL_INTERRUPT_ENABLE)
75 __attribute__((always_inline))
static inline void irq_restore(
unsigned int state)
78 "bis %[state], SR" "\n\t"
86 __attribute__((always_inline))
static inline bool irq_is_in(
void)
91 __attribute__((always_inline))
static inline bool irq_is_enabled(
void)
95 "mov.w SR,%[state]" "\n\t"
101 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)