From d688b84d2585d3bedbd682417313bcb581b1a1fc Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 13 Sep 2009 12:06:08 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1162 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/MSP430-MSP430x1611-GCC/Makefile | 2 +- docs/reports/STM32F103-72.txt | 24 ++++++++++++------------ os/kernel/include/scheduler.h | 4 ++-- os/kernel/src/chschd.c | 7 +++++-- os/ports/GCC/ARM7/chcoreasm.s | 2 +- os/ports/GCC/ARMCM3/chcore.c | 6 ++---- os/ports/GCC/ARMCM3/chcore.h | 2 +- os/ports/GCC/AVR/chcore.h | 2 +- os/ports/GCC/MSP430/chcore.h | 2 +- 9 files changed, 26 insertions(+), 25 deletions(-) diff --git a/demos/MSP430-MSP430x1611-GCC/Makefile b/demos/MSP430-MSP430x1611-GCC/Makefile index 6183fccf5..98265abf8 100644 --- a/demos/MSP430-MSP430x1611-GCC/Makefile +++ b/demos/MSP430-MSP430x1611-GCC/Makefile @@ -145,4 +145,4 @@ ULIBS = # End of user defines ############################################################################## -include ../../ports/MSP430/rules.mk +include ../../os/ports/GCC/MSP430/rules.mk diff --git a/docs/reports/STM32F103-72.txt b/docs/reports/STM32F103-72.txt index 78b3dded3..3dcd6bb1b 100644 --- a/docs/reports/STM32F103-72.txt +++ b/docs/reports/STM32F103-72.txt @@ -90,51 +90,51 @@ Settings: SYSCLK=72, ACR=0x12 (2 wait states) --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.1 (Benchmark, messages #1) ---- Score : 221722 msgs/S, 443444 ctxswc/S +--- Score : 221751 msgs/S, 443502 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.2 (Benchmark, messages #2) ---- Score : 185630 msgs/S, 371260 ctxswc/S +--- Score : 185654 msgs/S, 371308 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.3 (Benchmark, messages #3) ---- Score : 185630 msgs/S, 371260 ctxswc/S +--- Score : 185654 msgs/S, 371308 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.4 (Benchmark, context switch) ---- Score : 696632 ctxswc/S +--- Score : 696720 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.5 (Benchmark, threads, full cycle) ---- Score : 173525 threads/S +--- Score : 173548 threads/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.6 (Benchmark, threads, create only) ---- Score : 222415 threads/S +--- Score : 222442 threads/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.7 (Benchmark, mass reschedulation, 5 threads) ---- Score : 56929 reschedulations/S, 341574 ctxswc/S +--- Score : 56936 reschedulations/S, 341616 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.8 (Benchmark, round robin context switching) ---- Score : 505056 reschedulations/S, 505056 ctxswc/S +--- Score : 505120 reschedulations/S, 505120 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.9 (Benchmark, I/O Queues throughput) ---- Score : 474812 bytes/S +--- Score : 474880 bytes/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.10 (Benchmark, virtual timers set/reset) ---- Score : 647250 timers/S +--- Score : 647326 timers/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.11 (Benchmark, semaphores wait/signal) ---- Score : 833064 wait+signal/S +--- Score : 833164 wait+signal/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.12 (Benchmark, mutexes lock/unlock) ---- Score : 586532 lock+unlock/S +--- Score : 586596 lock+unlock/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.13 (Benchmark, RAM footprint) 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(); \ }