14 #include "interrupt-utils.h"
16 #define IRQ_MASK 0x00000080
17 #define FIQ_MASK 0x00000040
18 #define INT_MASK (IRQ_MASK | FIQ_MASK)
20 static inline unsigned __get_cpsr(
void)
23 asm volatile (
" mrs %0, cpsr" :
"=r" (retval) : );
27 static inline void __set_cpsr(
unsigned val)
29 asm volatile (
" msr cpsr_c, %0" : :
"r" (val) );
32 unsigned disableIRQ(
void)
37 __set_cpsr(_cpsr | IRQ_MASK);
41 unsigned restoreIRQ(
unsigned oldCPSR)
46 __set_cpsr((_cpsr & ~IRQ_MASK) | (oldCPSR & IRQ_MASK));
50 unsigned enableIRQ(
void)
55 __set_cpsr(_cpsr & ~IRQ_MASK);
59 unsigned disableFIQ(
void)
64 __set_cpsr(_cpsr | FIQ_MASK);
68 unsigned restoreFIQ(
unsigned oldCPSR)
73 __set_cpsr((_cpsr & ~FIQ_MASK) | (oldCPSR & FIQ_MASK));
77 unsigned enableFIQ(
void)
82 __set_cpsr(_cpsr & ~FIQ_MASK);