X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcpu%2Firq.h;h=3a2dab5b21beb26aebf7c0c4b3c68269a348fe90;hb=5b8c7d324c8934f7686aeb4c23454cebbfd1f83f;hp=466b524da2959f637f495be8121a3ef7ab63f624;hpb=ae8a609173e4490fd03875f96e388038053b9288;p=bertos.git diff --git a/bertos/cpu/irq.h b/bertos/cpu/irq.h index 466b524d..3a2dab5b 100644 --- a/bertos/cpu/irq.h +++ b/bertos/cpu/irq.h @@ -63,7 +63,43 @@ #define IRQ_RESTORE(x) FIXME #endif /* OS_EMBEDDED */ +#elif CPU_ARM_LM3S1968 + #define IRQ_DISABLE asm volatile ("cpsid i" : : : "memory", "cc") + #define IRQ_ENABLE asm volatile ("cpsie i" : : : "memory", "cc") + + #define IRQ_SAVE_DISABLE(x) \ + ({ \ + asm volatile ( \ + "mrs %0, PRIMASK\n" \ + "cpsid i" \ + : "=r" (x) : : "memory", "cc"); \ + }) + + #define IRQ_RESTORE(x) \ + ({ \ + if (x) \ + IRQ_DISABLE; \ + else \ + IRQ_ENABLE; \ + }) + + #define CPU_READ_FLAGS() \ + ({ \ + cpu_flags_t sreg; \ + asm volatile ( \ + "mrs %0, PRIMASK\n\t" \ + : "=r" (sreg) : : "memory", "cc"); \ + sreg; \ + }) + + #define IRQ_ENABLED() (!CPU_READ_FLAGS()) + + /* TODO: context switch is not yet supported */ + #define DECLARE_ISR_CONTEXT_SWITCH(func) void func(void) + + /* TODO: context switch is not yet supported */ + #define ISR_PROTO_CONTEXT_SWITCH(func) void func(void) #elif CPU_ARM #ifdef __IAR_SYSTEMS_ICC__