X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=bertos%2Fcpu%2Firq.h;h=6eac70fdea50424752119224ac1165fc794f3a50;hb=9792a2d2230d9e4e8bd3dec96e37e4107a6d8a37;hp=40571142bc33d3bb7be821c185b18099dafa4728;hpb=8e10a209b0401d9393f4f6418bdf1fec4a875a24;p=bertos.git diff --git a/bertos/cpu/irq.h b/bertos/cpu/irq.h index 40571142..6eac70fd 100644 --- a/bertos/cpu/irq.h +++ b/bertos/cpu/irq.h @@ -286,7 +286,7 @@ sreg; \ }) - #define IRQ_ENABLED() (!(CPU_READ_FLAGS() & 0x80)) + #define IRQ_ENABLED() ((CPU_READ_FLAGS() & 0xc0) != 0xc0) #if CONFIG_KERN_PREEMPT EXTERN_C void asm_irq_switch_context(void); @@ -350,7 +350,7 @@ __isr_##func(); \ IRQ_EXIT(); \ } \ - static void __isr_##func(void) + static NOINLINE void __isr_##func(void) /** * Interrupt service routine prototype: can be used for * forward declarations. @@ -377,7 +377,7 @@ #endif /* CONFIG_KERN_PREEMPT */ #ifndef ISR_FUNC - #define ISR_FUNC __attribute__((interrupt)) + #define ISR_FUNC __attribute__((naked)) #endif #ifndef DECLARE_ISR #define DECLARE_ISR(func) \ @@ -394,9 +394,14 @@ static NOINLINE void __isr_##func(void); \ void ISR_FUNC func(void) \ { \ + asm volatile ( \ + "sub lr, lr, #4\n\t" \ + "stmfd sp!, {r0-r3, ip, lr}\n\t"); \ __isr_##func(); \ + asm volatile ( \ + "ldmfd sp!, {r0-r3, ip, pc}^\n\t"); \ } \ - static void __isr_##func(void) + static NOINLINE void __isr_##func(void) #endif #ifndef DECLARE_ISR_CONTEXT_SWITCH #define DECLARE_ISR_CONTEXT_SWITCH(func) DECLARE_ISR(func)