29#define IRQ_MASK 0x00000080
31static inline unsigned __get_cpsr(
void)
34 __asm__
volatile(
" mrs %0, cpsr" :
"=r"(retval) : :
"memory");
38static inline void __set_cpsr(
unsigned val)
40 __asm__
volatile(
" msr cpsr, %0" : :
"r"(val) :
"memory");
46 __asm__
volatile(
" mrs %0, cpsr" :
"=r"(retval) : :
"memory");
47 return (retval & INTMode) == 18;
50static inline __attribute__((always_inline))
unsigned irq_disable(
void)
55 __set_cpsr(_cpsr | IRQ_MASK);
59static inline __attribute__((always_inline))
void irq_restore(
unsigned oldCPSR)
64static inline __attribute__((always_inline))
unsigned irq_enable(
void)
69 __set_cpsr(_cpsr & ~IRQ_MASK);
73static inline __attribute__((always_inline))
bool irq_is_enabled(
void)
75 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.