diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-07-25 14:32:39 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-07-25 14:32:39 +0000 |
commit | eb9b4efd31018e4949e3cc09830a5ecfc1304664 (patch) | |
tree | 99b3f334b22c57eed4147463e769b2296b5c169d | |
parent | 266206d33a7626341f3a206d730cb842dd39d2bc (diff) | |
download | ChibiOS-eb9b4efd31018e4949e3cc09830a5ecfc1304664.tar.gz ChibiOS-eb9b4efd31018e4949e3cc09830a5ecfc1304664.tar.bz2 ChibiOS-eb9b4efd31018e4949e3cc09830a5ecfc1304664.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@353 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r-- | demos/ARM7-AT91SAM7X-GCC/chconf.h | 7 | ||||
-rw-r--r-- | demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h | 7 | ||||
-rw-r--r-- | demos/ARM7-LPC214x-G++/chconf.h | 7 | ||||
-rw-r--r-- | demos/ARM7-LPC214x-GCC-minimal/chconf.h | 7 | ||||
-rw-r--r-- | demos/ARM7-LPC214x-GCC/chconf.h | 7 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F103-GCC/chconf.h | 7 | ||||
-rw-r--r-- | demos/AVR-AT90CANx-GCC/chconf.h | 7 | ||||
-rw-r--r-- | demos/AVR-ATmega128-GCC/chconf.h | 7 | ||||
-rw-r--r-- | demos/MSP430-MSP430x1611-GCC/chconf.h | 7 | ||||
-rw-r--r-- | demos/Win32-MinGW/chconf.h | 7 | ||||
-rw-r--r-- | docs/Doxyfile | 2 | ||||
-rw-r--r-- | docs/index.html | 2 | ||||
-rw-r--r-- | ports/ARMCM3/chcore.c | 2 | ||||
-rw-r--r-- | readme.txt | 7 | ||||
-rw-r--r-- | src/chinit.c | 2 | ||||
-rw-r--r-- | src/chschd.c | 12 | ||||
-rw-r--r-- | src/include/scheduler.h | 2 | ||||
-rw-r--r-- | src/templates/chconf.h | 7 |
18 files changed, 93 insertions, 13 deletions
diff --git a/demos/ARM7-AT91SAM7X-GCC/chconf.h b/demos/ARM7-AT91SAM7X-GCC/chconf.h index c8817f85c..8db71b445 100644 --- a/demos/ARM7-AT91SAM7X-GCC/chconf.h +++ b/demos/ARM7-AT91SAM7X-GCC/chconf.h @@ -38,6 +38,10 @@ * included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
+/** Configuration option: if specified then the kernel performs the round
+ * robin scheduling algorithm on threads of equal priority. */
+#define CH_USE_ROUNDROBIN
+
/** Configuration option: if specified then the System Timer subsystem is
* included in the kernel.*/
#define CH_USE_SYSTEMTIME
@@ -138,7 +142,8 @@ #define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
- * threads before preemption occurs.*/
+ * threads before preemption occurs. This option is only meaningful if the
+ * option \p CH_USE_ROUNDROBIN is also active.*/
#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
diff --git a/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h b/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h index c8817f85c..8db71b445 100644 --- a/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h +++ b/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h @@ -38,6 +38,10 @@ * included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
+/** Configuration option: if specified then the kernel performs the round
+ * robin scheduling algorithm on threads of equal priority. */
+#define CH_USE_ROUNDROBIN
+
/** Configuration option: if specified then the System Timer subsystem is
* included in the kernel.*/
#define CH_USE_SYSTEMTIME
@@ -138,7 +142,8 @@ #define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
- * threads before preemption occurs.*/
+ * threads before preemption occurs. This option is only meaningful if the
+ * option \p CH_USE_ROUNDROBIN is also active.*/
#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
diff --git a/demos/ARM7-LPC214x-G++/chconf.h b/demos/ARM7-LPC214x-G++/chconf.h index c8817f85c..8db71b445 100644 --- a/demos/ARM7-LPC214x-G++/chconf.h +++ b/demos/ARM7-LPC214x-G++/chconf.h @@ -38,6 +38,10 @@ * included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
+/** Configuration option: if specified then the kernel performs the round
+ * robin scheduling algorithm on threads of equal priority. */
+#define CH_USE_ROUNDROBIN
+
/** Configuration option: if specified then the System Timer subsystem is
* included in the kernel.*/
#define CH_USE_SYSTEMTIME
@@ -138,7 +142,8 @@ #define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
- * threads before preemption occurs.*/
+ * threads before preemption occurs. This option is only meaningful if the
+ * option \p CH_USE_ROUNDROBIN is also active.*/
#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
diff --git a/demos/ARM7-LPC214x-GCC-minimal/chconf.h b/demos/ARM7-LPC214x-GCC-minimal/chconf.h index d12a1827e..9f903df06 100644 --- a/demos/ARM7-LPC214x-GCC-minimal/chconf.h +++ b/demos/ARM7-LPC214x-GCC-minimal/chconf.h @@ -38,6 +38,10 @@ * included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
+/** Configuration option: if specified then the kernel performs the round
+ * robin scheduling algorithm on threads of equal priority. */
+#define CH_USE_ROUNDROBIN
+
/** Configuration option: if specified then the System Timer subsystem is
* included in the kernel.*/
#define CH_USE_SYSTEMTIME
@@ -138,7 +142,8 @@ #define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
- * threads before preemption occurs.*/
+ * threads before preemption occurs. This option is only meaningful if the
+ * option \p CH_USE_ROUNDROBIN is also active.*/
#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
diff --git a/demos/ARM7-LPC214x-GCC/chconf.h b/demos/ARM7-LPC214x-GCC/chconf.h index c8817f85c..8db71b445 100644 --- a/demos/ARM7-LPC214x-GCC/chconf.h +++ b/demos/ARM7-LPC214x-GCC/chconf.h @@ -38,6 +38,10 @@ * included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
+/** Configuration option: if specified then the kernel performs the round
+ * robin scheduling algorithm on threads of equal priority. */
+#define CH_USE_ROUNDROBIN
+
/** Configuration option: if specified then the System Timer subsystem is
* included in the kernel.*/
#define CH_USE_SYSTEMTIME
@@ -138,7 +142,8 @@ #define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
- * threads before preemption occurs.*/
+ * threads before preemption occurs. This option is only meaningful if the
+ * option \p CH_USE_ROUNDROBIN is also active.*/
#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
diff --git a/demos/ARMCM3-STM32F103-GCC/chconf.h b/demos/ARMCM3-STM32F103-GCC/chconf.h index c8817f85c..8db71b445 100644 --- a/demos/ARMCM3-STM32F103-GCC/chconf.h +++ b/demos/ARMCM3-STM32F103-GCC/chconf.h @@ -38,6 +38,10 @@ * included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
+/** Configuration option: if specified then the kernel performs the round
+ * robin scheduling algorithm on threads of equal priority. */
+#define CH_USE_ROUNDROBIN
+
/** Configuration option: if specified then the System Timer subsystem is
* included in the kernel.*/
#define CH_USE_SYSTEMTIME
@@ -138,7 +142,8 @@ #define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
- * threads before preemption occurs.*/
+ * threads before preemption occurs. This option is only meaningful if the
+ * option \p CH_USE_ROUNDROBIN is also active.*/
#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
diff --git a/demos/AVR-AT90CANx-GCC/chconf.h b/demos/AVR-AT90CANx-GCC/chconf.h index 17c2c3d38..fca0159a2 100644 --- a/demos/AVR-AT90CANx-GCC/chconf.h +++ b/demos/AVR-AT90CANx-GCC/chconf.h @@ -38,6 +38,10 @@ * included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
+/** Configuration option: if specified then the kernel performs the round
+ * robin scheduling algorithm on threads of equal priority. */
+#define CH_USE_ROUNDROBIN
+
/** Configuration option: if specified then the System Timer subsystem is
* included in the kernel.*/
#define CH_USE_SYSTEMTIME
@@ -138,7 +142,8 @@ #define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
- * threads before preemption occurs.*/
+ * threads before preemption occurs. This option is only meaningful if the
+ * option \p CH_USE_ROUNDROBIN is also active.*/
#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
diff --git a/demos/AVR-ATmega128-GCC/chconf.h b/demos/AVR-ATmega128-GCC/chconf.h index 17c2c3d38..fca0159a2 100644 --- a/demos/AVR-ATmega128-GCC/chconf.h +++ b/demos/AVR-ATmega128-GCC/chconf.h @@ -38,6 +38,10 @@ * included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
+/** Configuration option: if specified then the kernel performs the round
+ * robin scheduling algorithm on threads of equal priority. */
+#define CH_USE_ROUNDROBIN
+
/** Configuration option: if specified then the System Timer subsystem is
* included in the kernel.*/
#define CH_USE_SYSTEMTIME
@@ -138,7 +142,8 @@ #define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
- * threads before preemption occurs.*/
+ * threads before preemption occurs. This option is only meaningful if the
+ * option \p CH_USE_ROUNDROBIN is also active.*/
#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
diff --git a/demos/MSP430-MSP430x1611-GCC/chconf.h b/demos/MSP430-MSP430x1611-GCC/chconf.h index 4ca12304e..7e29d314e 100644 --- a/demos/MSP430-MSP430x1611-GCC/chconf.h +++ b/demos/MSP430-MSP430x1611-GCC/chconf.h @@ -39,6 +39,10 @@ * included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
+/** Configuration option: if specified then the kernel performs the round
+ * robin scheduling algorithm on threads of equal priority. */
+#define CH_USE_ROUNDROBIN
+
/** Configuration option: if specified then the System Timer subsystem is
* included in the kernel.*/
#define CH_USE_SYSTEMTIME
@@ -139,7 +143,8 @@ #define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
- * threads before preemption occurs.*/
+ * threads before preemption occurs. This option is only meaningful if the
+ * option \p CH_USE_ROUNDROBIN is also active.*/
#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 15cf3d323..b17295c65 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -43,6 +43,10 @@ * included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
+/** Configuration option: if specified then the kernel performs the round
+ * robin scheduling algorithm on threads of equal priority. */
+#define CH_USE_ROUNDROBIN
+
/** Configuration option: if specified then the System Timer subsystem is
* included in the kernel.*/
#define CH_USE_SYSTEMTIME
@@ -143,7 +147,8 @@ #define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
- * threads before preemption occurs.*/
+ * threads before preemption occurs. This option is only meaningful if the
+ * option \p CH_USE_ROUNDROBIN is also active.*/
#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
diff --git a/docs/Doxyfile b/docs/Doxyfile index 03115e918..ffc6c03e1 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -5,7 +5,7 @@ #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = ChibiOS/RT -PROJECT_NUMBER = "0.6.8 beta" +PROJECT_NUMBER = "0.6.9 beta" OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English diff --git a/docs/index.html b/docs/index.html index 86ad1030d..40ce2d19d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -12,7 +12,7 @@ </tr>
<tr>
<td style="text-align: center; vertical-align: top; width: 150px;">Current
-Version 0.6.8<br>
+Version 0.6.9<br>
-<br>
<a href="http://sourceforge.net/projects/chibios/" rel="me" target="_top">Project on SourceForge</a><br>
<a href="html/index.html" target="_top" rel="me">Documentation</a><br>
diff --git a/ports/ARMCM3/chcore.c b/ports/ARMCM3/chcore.c index c09de270c..4aa797c63 100644 --- a/ports/ARMCM3/chcore.c +++ b/ports/ARMCM3/chcore.c @@ -151,7 +151,9 @@ void PendSVVector(void) { chSchReadyI(otp); (currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR; /* set the round-robin time quantum */ +#ifdef CH_USE_ROUNDROBIN rlist.r_preempt = CH_TIME_QUANTUM; +#endif #ifdef CH_USE_TRACE chDbgTrace(otp, currp); #endif diff --git a/readme.txt b/readme.txt index 6d2b7bba2..54de58ab3 100644 --- a/readme.txt +++ b/readme.txt @@ -75,6 +75,13 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process, *** Releases ***
*****************************************************************************
+*** 0.6.9 ***
+- NEW: Added an option to exclude the support for the round robin scheduling,
+ this can save some extra program space and makes the context switch a bit
+ faster if the feature is not required. Threads at the same priority are
+ still supported when the feature is disabled but the scheduling among them
+ becomes cooperative.
+
*** 0.6.8 ***
- FIX: Fixed a bug in the priority inheritance mechanism, the bug was only a
problems when the CH_USE_MESSAGES_PRIORITY was enabled, this option is
diff --git a/src/chinit.c b/src/chinit.c index b8d36a6e5..2aee810a0 100644 --- a/src/chinit.c +++ b/src/chinit.c @@ -70,10 +70,12 @@ void chSysInit(void) { * together with the \p CH_TIME_QUANTUM macro, the round robin interval. */ void chSysTimerHandlerI(void) { +#ifdef CH_USE_ROUNDROBIN /* running thread has not used up quantum yet? */ if (rlist.r_preempt > 0) /* decrement remaining quantum */ rlist.r_preempt--; +#endif #ifdef CH_USE_SYSTEMTIME rlist.r_stime++; #endif diff --git a/src/chschd.c b/src/chschd.c index 6a82eb1d8..c3e0fbaed 100644 --- a/src/chschd.c +++ b/src/chschd.c @@ -36,7 +36,9 @@ void chSchInit(void) { fifo_init(&rlist.r_queue); rlist.r_prio = NOPRIO; +#ifdef CH_USE_ROUNDROBIN rlist.r_preempt = CH_TIME_QUANTUM; +#endif #ifdef CH_USE_SYSTEMTIME rlist.r_stime = 0; #endif @@ -83,7 +85,9 @@ void chSchGoSleepS(tstate_t newstate) { (otp = currp)->p_state = newstate; (currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR; +#ifdef CH_USE_ROUNDROBIN rlist.r_preempt = CH_TIME_QUANTUM; +#endif #ifdef CH_USE_TRACE chDbgTrace(otp, currp); #endif @@ -152,7 +156,9 @@ void chSchWakeupS(Thread *ntp, msg_t msg) { Thread *otp = currp; chSchReadyI(otp); (currp = ntp)->p_state = PRCURR; +#ifdef CH_USE_ROUNDROBIN rlist.r_preempt = CH_TIME_QUANTUM; +#endif #ifdef CH_USE_TRACE chDbgTrace(otp, ntp); #endif @@ -172,7 +178,9 @@ void chSchDoRescheduleI(void) { chSchReadyI(otp); /* pick the first thread from the ready queue */ (currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR; +#ifdef CH_USE_ROUNDROBIN rlist.r_preempt = CH_TIME_QUANTUM; +#endif #ifdef CH_USE_TRACE chDbgTrace(otp, currp); #endif @@ -204,12 +212,16 @@ void chSchRescheduleS(void) { bool_t chSchRescRequiredI(void) { tprio_t p1 = firstprio(&rlist.r_queue); tprio_t p2 = currp->p_prio; +#ifdef CH_USE_ROUNDROBIN /* 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 * if the first thread on the ready queue has equal or higher priority. */ return rlist.r_preempt ? p1 > p2 : p1 >= p2; +#else + return p1 > p2; +#endif } /** @} */ diff --git a/src/include/scheduler.h b/src/include/scheduler.h index 3a6486efe..362dd9d31 100644 --- a/src/include/scheduler.h +++ b/src/include/scheduler.h @@ -41,7 +41,9 @@ typedef struct { ThreadsQueue r_queue; tprio_t r_prio; +#ifdef CH_USE_ROUNDROBIN cnt_t r_preempt; +#endif #ifndef CH_CURRP_REGISTER_CACHE /** the currently running thread */ Thread *r_current; diff --git a/src/templates/chconf.h b/src/templates/chconf.h index cc4f992f2..d059f3097 100644 --- a/src/templates/chconf.h +++ b/src/templates/chconf.h @@ -39,6 +39,10 @@ * included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
+/** Configuration option: if specified then the kernel performs the round
+ * robin scheduling algorithm on threads of equal priority. */
+#define CH_USE_ROUNDROBIN
+
/** Configuration option: if specified then the System Timer subsystem is
* included in the kernel.*/
#define CH_USE_SYSTEMTIME
@@ -139,7 +143,8 @@ #define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
- * threads before preemption occurs.*/
+ * threads before preemption occurs. This option is only meaningful if the
+ * option \p CH_USE_ROUNDROBIN is also active.*/
#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
|