diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-02-26 12:44:06 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-02-26 12:44:06 +0000 |
commit | a7ce64bb324a4d56808a806070de42adbef9a215 (patch) | |
tree | ac9e68e36076b68a1cdfe75a93a28ad904e0f18d /os/ports/IAR/ARMCMx | |
parent | a34c2444c227b41a397fa8bde985e5015dc01a1d (diff) | |
download | ChibiOS-a7ce64bb324a4d56808a806070de42adbef9a215.tar.gz ChibiOS-a7ce64bb324a4d56808a806070de42adbef9a215.tar.bz2 ChibiOS-a7ce64bb324a4d56808a806070de42adbef9a215.zip |
Fixed bug 3193062 (IAR).
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2765 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ports/IAR/ARMCMx')
-rw-r--r-- | os/ports/IAR/ARMCMx/chcore_v6m.c | 5 | ||||
-rw-r--r-- | os/ports/IAR/ARMCMx/chcore_v6m.h | 12 | ||||
-rw-r--r-- | os/ports/IAR/ARMCMx/chcoreasm_v6m.s | 32 |
3 files changed, 17 insertions, 32 deletions
diff --git a/os/ports/IAR/ARMCMx/chcore_v6m.c b/os/ports/IAR/ARMCMx/chcore_v6m.c index 25b360809..d8ede674d 100644 --- a/os/ports/IAR/ARMCMx/chcore_v6m.c +++ b/os/ports/IAR/ARMCMx/chcore_v6m.c @@ -33,11 +33,6 @@ regarm_t _port_saved_pc;
/**
- * @brief IRQ nesting counter.
- */
-unsigned _port_irq_nesting;
-
-/**
* @brief System Timer vector.
* @details This interrupt is used as system tick.
* @note The timer must be initialized in the startup code.
diff --git a/os/ports/IAR/ARMCMx/chcore_v6m.h b/os/ports/IAR/ARMCMx/chcore_v6m.h index a2d1a40d3..fdbde0641 100644 --- a/os/ports/IAR/ARMCMx/chcore_v6m.h +++ b/os/ports/IAR/ARMCMx/chcore_v6m.h @@ -118,18 +118,14 @@ struct intctx { * @details This macro must be inserted at the start of all IRQ handlers
* enabled to invoke system APIs.
*/
-#define PORT_IRQ_PROLOGUE() { \
- port_lock_from_isr(); \
- _port_irq_nesting++; \
- port_unlock_from_isr(); \
-}
+#define PORT_IRQ_PROLOGUE() regarm_t _saved_lr = (regarm_t)__get_LR()
/**
* @brief IRQ epilogue code.
* @details This macro must be inserted at the end of all IRQ handlers
* enabled to invoke system APIs.
*/
-#define PORT_IRQ_EPILOGUE() _port_irq_epilogue()
+#define PORT_IRQ_EPILOGUE() _port_irq_epilogue(_saved_lr)
/**
* @brief IRQ handler function declaration.
@@ -149,7 +145,6 @@ struct intctx { * @brief Port-related initialization code.
*/
#define port_init() { \
- _port_irq_nesting = 0; \
SCB_AIRCR = AIRCR_VECTKEY | AIRCR_PRIGROUP(0); \
NVICSetSystemHandlerPriority(HANDLER_SYSTICK, \
CORTEX_PRIORITY_MASK(CORTEX_PRIORITY_SYSTICK)); \
@@ -238,7 +233,6 @@ struct intctx { #if !defined(__DOXYGEN__)
extern regarm_t _port_saved_pc;
-extern unsigned _port_irq_nesting;
#endif
#ifdef __cplusplus
@@ -246,7 +240,7 @@ extern "C" { #endif
void port_halt(void);
void _port_switch(Thread *ntp, Thread *otp);
- void _port_irq_epilogue(void);
+ void _port_irq_epilogue(regarm_t lr);
void _port_switch_from_isr(void);
void _port_thread_start(void);
#ifdef __cplusplus
diff --git a/os/ports/IAR/ARMCMx/chcoreasm_v6m.s b/os/ports/IAR/ARMCMx/chcoreasm_v6m.s index 1b8a5583c..5333d4ab9 100644 --- a/os/ports/IAR/ARMCMx/chcoreasm_v6m.s +++ b/os/ports/IAR/ARMCMx/chcoreasm_v6m.s @@ -105,27 +105,23 @@ _port_switch_from_isr: */
PUBLIC _port_irq_epilogue
_port_irq_epilogue:
- push {r4, lr}
+ push {r3, lr}
+ adds r0, r0, #15
+ beq stillnested
cpsid i
- ldr r2, =_port_irq_nesting
- ldr r3, [r2]
- subs r3, r3, #1
- str r3, [r2]
- cmp r3, #0
- beq skipexit
-notrequired
- cpsie i
- pop {r4, pc}
-skipexit
bl chSchIsRescRequiredExI
cmp r0, #0
- beq notrequired
- mrs r1, PSP
+ bne doresch
+ cpsie i
+stillnested
+ pop {r3, pc}
+doresch
+ mrs r3, PSP
ldr r2, =_port_saved_pc
- ldr r3, [r1, #24]
- str r3, [r2]
- ldr r3, =_port_switch_from_isr
- str r3, [r1, #24]
- pop {r4, pc}
+ ldr r1, [r3, #24]
+ str r1, [r2]
+ ldr r2, =_port_switch_from_isr
+ str r2, [r3, #24]
+ pop {r3, pc}
END
|