diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/kernel/include/scheduler.h | 4 | ||||
-rw-r--r-- | os/kernel/src/chschd.c | 7 | ||||
-rw-r--r-- | os/ports/GCC/ARM7/chcoreasm.s | 2 | ||||
-rw-r--r-- | os/ports/GCC/ARMCM3/chcore.c | 6 | ||||
-rw-r--r-- | os/ports/GCC/ARMCM3/chcore.h | 2 | ||||
-rw-r--r-- | os/ports/GCC/AVR/chcore.h | 2 | ||||
-rw-r--r-- | os/ports/GCC/MSP430/chcore.h | 2 |
7 files changed, 13 insertions, 12 deletions
diff --git a/os/kernel/include/scheduler.h b/os/kernel/include/scheduler.h index f3216bb7a..a8196a9b6 100644 --- a/os/kernel/include/scheduler.h +++ b/os/kernel/include/scheduler.h @@ -97,7 +97,7 @@ extern "C" { void chSchWakeupS(Thread *tp, msg_t msg); void chSchDoRescheduleI(void); void chSchRescheduleS(void); - bool_t chSchRescRequiredI(void); + bool_t chSchIsRescRequiredExI(void); #if CH_USE_ROUNDROBIN void chSchDoYieldS(void); #endif @@ -117,7 +117,7 @@ extern "C" { * @details This function returns @p TRUE if there is a ready thread with * higher priority. */ -#define chSchMustRescheduleS() (firstprio(&rlist.r_queue) > currp->p_prio) +#define chSchIsRescRequiredI() (firstprio(&rlist.r_queue) > currp->p_prio) #endif /* _SCHEDULER_H_ */ diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c index 08ecf46a0..7c65e3fd6 100644 --- a/os/kernel/src/chschd.c +++ b/os/kernel/src/chschd.c @@ -211,7 +211,7 @@ void chSchDoRescheduleI(void) { */ void chSchRescheduleS(void) { - if (chSchMustRescheduleS()) + if (chSchIsRescRequiredI()) chSchDoRescheduleI(); } @@ -222,8 +222,11 @@ void chSchRescheduleS(void) { * * @retval TRUE if there is a thread that should go in running state. * @retval FALSE if a reschedulation is not required. + * + * @note This function is meant to be used in the timer interrupt handler + * where @p chVTDoTickI() is invoked. */ -bool_t chSchRescRequiredI(void) { +bool_t chSchIsRescRequiredExI(void) { tprio_t p1 = firstprio(&rlist.r_queue); tprio_t p2 = currp->p_prio; #if CH_USE_ROUNDROBIN diff --git a/os/ports/GCC/ARM7/chcoreasm.s b/os/ports/GCC/ARM7/chcoreasm.s index da942269a..2b08d0607 100644 --- a/os/ports/GCC/ARM7/chcoreasm.s +++ b/os/ports/GCC/ARM7/chcoreasm.s @@ -166,7 +166,7 @@ _port_irq_common: .code 32
.globl _port_irq_common
_port_irq_common:
- bl chSchRescRequiredI
+ bl chSchIsRescRequiredExI
#endif /* !THUMB_NO_INTERWORKING */
cmp r0, #0 // Simply returns if a
ldmeqfd sp!, {r0-r3, r12, lr} // reschedule is not
diff --git a/os/ports/GCC/ARMCM3/chcore.c b/os/ports/GCC/ARMCM3/chcore.c index 4e9874f82..7973659fe 100644 --- a/os/ports/GCC/ARMCM3/chcore.c +++ b/os/ports/GCC/ARMCM3/chcore.c @@ -61,13 +61,11 @@ void _port_unlock(void) { */
CH_IRQ_HANDLER(SysTickVector) {
- CH_IRQ_PROLOGUE();
-
chSysLockFromIsr();
chSysTimerHandlerI();
+ if (chSchIsRescRequiredExI())
+ SCB_ICSR = ICSR_PENDSVSET;
chSysUnlockFromIsr();
-
- CH_IRQ_EPILOGUE();
}
/**
diff --git a/os/ports/GCC/ARMCM3/chcore.h b/os/ports/GCC/ARMCM3/chcore.h index daff52090..ffcb59b2a 100644 --- a/os/ports/GCC/ARMCM3/chcore.h +++ b/os/ports/GCC/ARMCM3/chcore.h @@ -211,7 +211,7 @@ struct context { */
#define PORT_IRQ_EPILOGUE() { \
chSysLockFromIsr(); \
- if (chSchRescRequiredI()) \
+ if (chSchIsRescRequiredI()) \
SCB_ICSR = ICSR_PENDSVSET; \
chSysUnlockFromIsr(); \
}
diff --git a/os/ports/GCC/AVR/chcore.h b/os/ports/GCC/AVR/chcore.h index 18439b9fe..b452e0227 100644 --- a/os/ports/GCC/AVR/chcore.h +++ b/os/ports/GCC/AVR/chcore.h @@ -190,7 +190,7 @@ struct context { * invoke system APIs.
*/
#define PORT_IRQ_EPILOGUE() { \
- if (chSchRescRequiredI()) \
+ if (chSchIsRescRequiredExI()) \
chSchDoRescheduleI(); \
}
diff --git a/os/ports/GCC/MSP430/chcore.h b/os/ports/GCC/MSP430/chcore.h index f903a116a..8ae84b5c1 100644 --- a/os/ports/GCC/MSP430/chcore.h +++ b/os/ports/GCC/MSP430/chcore.h @@ -157,7 +157,7 @@ struct context { * invoke system APIs.
*/
#define PORT_IRQ_EPILOGUE() { \
- if (chSchRescRequiredI()) \
+ if (chSchIsRescRequiredExI()) \
chSchDoRescheduleI(); \
}
|