git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@353 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2008-07-25 14:32:39 +00:00
parent 266206d33a
commit eb9b4efd31
18 changed files with 93 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}
/** @} */

View File

@ -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;

View File

@ -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