aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/kernel/include/scheduler.h4
-rw-r--r--os/kernel/include/threads.h4
-rw-r--r--os/kernel/src/chschd.c17
-rw-r--r--os/kernel/src/chsys.c2
-rw-r--r--os/kernel/src/chthreads.c2
-rw-r--r--os/ports/GCC/ARMCM3/chcore.c2
-rw-r--r--readme.txt2
-rw-r--r--test/testbmk.c4
8 files changed, 15 insertions, 22 deletions
diff --git a/os/kernel/include/scheduler.h b/os/kernel/include/scheduler.h
index a8196a9b6..539c678fa 100644
--- a/os/kernel/include/scheduler.h
+++ b/os/kernel/include/scheduler.h
@@ -68,7 +68,7 @@ typedef struct {
tprio_t r_prio; /**< This field must be initialized to
zero.*/
/* End of the fields shared with the Thread structure.*/
-#if CH_USE_ROUNDROBIN
+#if CH_TIME_QUANTUM > 0
cnt_t r_preempt; /**< Round robin counter.*/
#endif
#ifndef CH_CURRP_REGISTER_CACHE
@@ -98,9 +98,7 @@ extern "C" {
void chSchDoRescheduleI(void);
void chSchRescheduleS(void);
bool_t chSchIsRescRequiredExI(void);
-#if CH_USE_ROUNDROBIN
void chSchDoYieldS(void);
-#endif
#ifdef __cplusplus
}
#endif
diff --git a/os/kernel/include/threads.h b/os/kernel/include/threads.h
index ccafc3e96..edcf1f42a 100644
--- a/os/kernel/include/threads.h
+++ b/os/kernel/include/threads.h
@@ -179,13 +179,11 @@ extern "C" {
void chThdTerminate(Thread *tp);
void chThdSleep(systime_t time);
void chThdSleepUntil(systime_t time);
+ void chThdYield(void);
void chThdExit(msg_t msg);
#if CH_USE_WAITEXIT
msg_t chThdWait(Thread *tp);
#endif
-#if CH_USE_ROUNDROBIN
- void chThdYield(void);
-#endif
#ifdef __cplusplus
}
#endif
diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c
index 7c65e3fd6..150169481 100644
--- a/os/kernel/src/chschd.c
+++ b/os/kernel/src/chschd.c
@@ -39,7 +39,7 @@ void scheduler_init(void) {
queue_init(&rlist.r_queue);
rlist.r_prio = NOPRIO;
-#if CH_USE_ROUNDROBIN
+#if CH_TIME_QUANTUM > 0
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
}
@@ -83,7 +83,7 @@ void chSchGoSleepS(tstate_t newstate) {
(otp = currp)->p_state = newstate;
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
-#if CH_USE_ROUNDROBIN
+#if CH_TIME_QUANTUM > 0
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
chDbgTrace(otp, currp);
@@ -176,7 +176,7 @@ void chSchWakeupS(Thread *ntp, msg_t msg) {
else {
Thread *otp = currp;
chSchReadyI(otp);
-#if CH_USE_ROUNDROBIN
+#if CH_TIME_QUANTUM > 0
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
(currp = ntp)->p_state = PRCURR;
@@ -197,7 +197,7 @@ void chSchDoRescheduleI(void) {
/* Pick the first thread from the ready queue and makes it current.*/
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
chSchReadyI(otp);
-#if CH_USE_ROUNDROBIN
+#if CH_TIME_QUANTUM > 0
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
chDbgTrace(otp, currp);
@@ -229,7 +229,7 @@ void chSchRescheduleS(void) {
bool_t chSchIsRescRequiredExI(void) {
tprio_t p1 = firstprio(&rlist.r_queue);
tprio_t p2 = currp->p_prio;
-#if CH_USE_ROUNDROBIN
+#if CH_TIME_QUANTUM > 0
/* If the running thread has not reached its time quantum, reschedule only
* if the first thread on the ready queue has a higher priority.
* Otherwise, if the running thread has used up its time quantum, reschedule
@@ -242,7 +242,11 @@ bool_t chSchIsRescRequiredExI(void) {
#endif
}
-#if CH_USE_ROUNDROBIN
+/**
+ * @brief Yields the time slot.
+ * @details Yields the CPU control to the next thread in the ready list with
+ * equal priority, if any.
+ */
void chSchDoYieldS(void) {
if (chSchCanYieldS()) {
@@ -269,6 +273,5 @@ void chSchDoYieldS(void) {
chSysSwitchI(otp, currp);
}
}
-#endif /* CH_USE_ROUNDROBIN */
/** @} */
diff --git a/os/kernel/src/chsys.c b/os/kernel/src/chsys.c
index 326699ea0..06fdbc822 100644
--- a/os/kernel/src/chsys.c
+++ b/os/kernel/src/chsys.c
@@ -98,7 +98,7 @@ void chSysInit(void) {
*/
void chSysTimerHandlerI(void) {
-#if CH_USE_ROUNDROBIN
+#if CH_TIME_QUANTUM > 0
/* running thread has not used up quantum yet? */
if (rlist.r_preempt > 0)
/* decrement remaining quantum */
diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c
index 89d1d6329..70b0c3ace 100644
--- a/os/kernel/src/chthreads.c
+++ b/os/kernel/src/chthreads.c
@@ -293,7 +293,6 @@ void chThdSleepUntil(systime_t time) {
chSysUnlock();
}
-#if CH_USE_ROUNDROBIN
/**
* @brief Yields the time slot.
* @details Yields the CPU control to the next thread in the ready list with
@@ -305,7 +304,6 @@ void chThdYield(void) {
chSchDoYieldS();
chSysUnlock();
}
-#endif /* CH_USE_ROUNDROBIN */
/**
* @brief Terminates the current thread by specifying an exit status code.
diff --git a/os/ports/GCC/ARMCM3/chcore.c b/os/ports/GCC/ARMCM3/chcore.c
index 8f99d3dec..a2334dcf7 100644
--- a/os/ports/GCC/ARMCM3/chcore.c
+++ b/os/ports/GCC/ARMCM3/chcore.c
@@ -158,7 +158,7 @@ void PendSVVector(void) {
(otp = currp)->p_ctx.r13 = sp_thd;
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
chSchReadyI(otp);
-#if CH_USE_ROUNDROBIN
+#if CH_TIME_QUANTUM > 0
/* set the round-robin time quantum */
rlist.r_preempt = CH_TIME_QUANTUM;
#endif
diff --git a/readme.txt b/readme.txt
index 2ea99dca7..6f9b05139 100644
--- a/readme.txt
+++ b/readme.txt
@@ -21,7 +21,7 @@
- CHANGE: Because the changes in the allocators some API prototypes changed:
chHeapAlloc(), chHeapStatus(), chThdCreateFromHeap().
- CHANGE: Because the changes in the allocators some configuration options
- changed, see the template chconf.h file.
+ changed and some were removed, see the new template chconf.h file.
- CHANGE: renamed ./demos/ARM7-AT91SAM7X-WEB-GCC in ARM7-AT91SAM7X-UIP-GCC.
- FIX: Added the most restrictive GCC warning option to the makefiles (-Wextra)
and fixed some warnings in the code, mostly unused function parameters.
diff --git a/test/testbmk.c b/test/testbmk.c
index dd92dcbf6..534ac8a81 100644
--- a/test/testbmk.c
+++ b/test/testbmk.c
@@ -432,7 +432,6 @@ const struct testcase testbmk7 = {
* a second of continuous operations.
*/
-#if CH_USE_ROUNDROBIN
static msg_t thread8(void *p) {
do {
@@ -482,7 +481,6 @@ const struct testcase testbmk8 = {
NULL,
bmk8_execute
};
-#endif
/**
* @page test_benchmarks_009 I/O Queues throughput
@@ -760,9 +758,7 @@ const struct testcase * const patternbmk[] = {
&testbmk5,
&testbmk6,
&testbmk7,
-#if CH_USE_ROUNDROBIN
&testbmk8,
-#endif
&testbmk9,
&testbmk10,
&testbmk11,