25#define IRQ_MASK 0x00000080
27static inline unsigned __get_cpsr(
void)
30 __asm__
volatile(
" mrs %0, cpsr" :
"=r"(retval) : :
"memory");
34static inline void __set_cpsr(
unsigned val)
36 __asm__
volatile(
" msr cpsr, %0" : :
"r"(val) :
"memory");
41 return (__get_cpsr() & INTMode) == 18;
44static inline __attribute__((always_inline))
unsigned irq_disable(
void)
49 __set_cpsr(_cpsr | IRQ_MASK);
53static inline __attribute__((always_inline))
void irq_restore(
unsigned oldCPSR)
58static inline __attribute__((always_inline))
unsigned irq_enable(
void)
63 __set_cpsr(_cpsr & ~IRQ_MASK);
67static inline __attribute__((always_inline))
bool irq_is_enabled(
void)
69 return !(__get_cpsr() & IRQ_MASK);
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.