Update port.c

Error on my part, this is the right inline asm code to retreive CPSR register
This commit is contained in:
Simon Beaudoin 2020-07-19 22:14:37 -04:00 committed by GitHub
parent 7111a5a21b
commit ba19cf89ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -149,10 +149,14 @@
/* Adding the necessary stuff in order to be able to determine from C code wheter or not the IRQs are enabled at the processor level (not interrupt controller level) */ /* Adding the necessary stuff in order to be able to determine from C code wheter or not the IRQs are enabled at the processor level (not interrupt controller level) */
#define GET_CPSR() __asm__ __volatile__(\ #define GET_CPSR() ({u32 rval = 0U; \
"msr cpsr,%0\n"\ __asm__ __volatile__(\
: : "r" (v)\ "mrs %0, cpsr\n"\
) : "=r" (rval)\
);\
rval;\
})
#define CPSR_IRQ_ENABLE_MASK 0x80U #define CPSR_IRQ_ENABLE_MASK 0x80U
#define IS_IRQ_DISABLED() ({unsigned int val = 0; val = (GET_CPSR() & CPSR_IRQ_ENABLE_MASK) ? 1 : 0; val;}) #define IS_IRQ_DISABLED() ({unsigned int val = 0; val = (GET_CPSR() & CPSR_IRQ_ENABLE_MASK) ? 1 : 0; val;})