git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@353 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
266206d33a
commit
eb9b4efd31
|
@ -38,6 +38,10 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_VIRTUAL_TIMERS
|
#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
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_SYSTEMTIME
|
#define CH_USE_SYSTEMTIME
|
||||||
|
@ -138,7 +142,8 @@
|
||||||
#define CH_FREQUENCY 1000
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** 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
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_VIRTUAL_TIMERS
|
#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
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_SYSTEMTIME
|
#define CH_USE_SYSTEMTIME
|
||||||
|
@ -138,7 +142,8 @@
|
||||||
#define CH_FREQUENCY 1000
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** 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
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_VIRTUAL_TIMERS
|
#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
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_SYSTEMTIME
|
#define CH_USE_SYSTEMTIME
|
||||||
|
@ -138,7 +142,8 @@
|
||||||
#define CH_FREQUENCY 1000
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** 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
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_VIRTUAL_TIMERS
|
#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
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_SYSTEMTIME
|
#define CH_USE_SYSTEMTIME
|
||||||
|
@ -138,7 +142,8 @@
|
||||||
#define CH_FREQUENCY 1000
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** 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
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_VIRTUAL_TIMERS
|
#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
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_SYSTEMTIME
|
#define CH_USE_SYSTEMTIME
|
||||||
|
@ -138,7 +142,8 @@
|
||||||
#define CH_FREQUENCY 1000
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** 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
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_VIRTUAL_TIMERS
|
#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
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_SYSTEMTIME
|
#define CH_USE_SYSTEMTIME
|
||||||
|
@ -138,7 +142,8 @@
|
||||||
#define CH_FREQUENCY 1000
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** 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
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_VIRTUAL_TIMERS
|
#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
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_SYSTEMTIME
|
#define CH_USE_SYSTEMTIME
|
||||||
|
@ -138,7 +142,8 @@
|
||||||
#define CH_FREQUENCY 1000
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** 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
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_VIRTUAL_TIMERS
|
#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
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_SYSTEMTIME
|
#define CH_USE_SYSTEMTIME
|
||||||
|
@ -138,7 +142,8 @@
|
||||||
#define CH_FREQUENCY 1000
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** 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
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
|
|
@ -39,6 +39,10 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_VIRTUAL_TIMERS
|
#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
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_SYSTEMTIME
|
#define CH_USE_SYSTEMTIME
|
||||||
|
@ -139,7 +143,8 @@
|
||||||
#define CH_FREQUENCY 1000
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** 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
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
|
|
@ -43,6 +43,10 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_VIRTUAL_TIMERS
|
#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
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_SYSTEMTIME
|
#define CH_USE_SYSTEMTIME
|
||||||
|
@ -143,7 +147,8 @@
|
||||||
#define CH_FREQUENCY 1000
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** 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
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
DOXYFILE_ENCODING = UTF-8
|
DOXYFILE_ENCODING = UTF-8
|
||||||
PROJECT_NAME = ChibiOS/RT
|
PROJECT_NAME = ChibiOS/RT
|
||||||
PROJECT_NUMBER = "0.6.8 beta"
|
PROJECT_NUMBER = "0.6.9 beta"
|
||||||
OUTPUT_DIRECTORY = .
|
OUTPUT_DIRECTORY = .
|
||||||
CREATE_SUBDIRS = NO
|
CREATE_SUBDIRS = NO
|
||||||
OUTPUT_LANGUAGE = English
|
OUTPUT_LANGUAGE = English
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center; vertical-align: top; width: 150px;">Current
|
<td style="text-align: center; vertical-align: top; width: 150px;">Current
|
||||||
Version 0.6.8<br>
|
Version 0.6.9<br>
|
||||||
-<br>
|
-<br>
|
||||||
<a href="http://sourceforge.net/projects/chibios/" rel="me" target="_top">Project on SourceForge</a><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>
|
<a href="html/index.html" target="_top" rel="me">Documentation</a><br>
|
||||||
|
|
|
@ -151,7 +151,9 @@ void PendSVVector(void) {
|
||||||
chSchReadyI(otp);
|
chSchReadyI(otp);
|
||||||
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
|
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
|
||||||
/* set the round-robin time quantum */
|
/* set the round-robin time quantum */
|
||||||
|
#ifdef CH_USE_ROUNDROBIN
|
||||||
rlist.r_preempt = CH_TIME_QUANTUM;
|
rlist.r_preempt = CH_TIME_QUANTUM;
|
||||||
|
#endif
|
||||||
#ifdef CH_USE_TRACE
|
#ifdef CH_USE_TRACE
|
||||||
chDbgTrace(otp, currp);
|
chDbgTrace(otp, currp);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -75,6 +75,13 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
||||||
*** Releases ***
|
*** 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 ***
|
*** 0.6.8 ***
|
||||||
- FIX: Fixed a bug in the priority inheritance mechanism, the bug was only a
|
- 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
|
problems when the CH_USE_MESSAGES_PRIORITY was enabled, this option is
|
||||||
|
|
|
@ -70,10 +70,12 @@ void chSysInit(void) {
|
||||||
* together with the \p CH_TIME_QUANTUM macro, the round robin interval.
|
* together with the \p CH_TIME_QUANTUM macro, the round robin interval.
|
||||||
*/
|
*/
|
||||||
void chSysTimerHandlerI(void) {
|
void chSysTimerHandlerI(void) {
|
||||||
|
#ifdef CH_USE_ROUNDROBIN
|
||||||
/* running thread has not used up quantum yet? */
|
/* running thread has not used up quantum yet? */
|
||||||
if (rlist.r_preempt > 0)
|
if (rlist.r_preempt > 0)
|
||||||
/* decrement remaining quantum */
|
/* decrement remaining quantum */
|
||||||
rlist.r_preempt--;
|
rlist.r_preempt--;
|
||||||
|
#endif
|
||||||
#ifdef CH_USE_SYSTEMTIME
|
#ifdef CH_USE_SYSTEMTIME
|
||||||
rlist.r_stime++;
|
rlist.r_stime++;
|
||||||
#endif
|
#endif
|
||||||
|
|
12
src/chschd.c
12
src/chschd.c
|
@ -36,7 +36,9 @@ void chSchInit(void) {
|
||||||
|
|
||||||
fifo_init(&rlist.r_queue);
|
fifo_init(&rlist.r_queue);
|
||||||
rlist.r_prio = NOPRIO;
|
rlist.r_prio = NOPRIO;
|
||||||
|
#ifdef CH_USE_ROUNDROBIN
|
||||||
rlist.r_preempt = CH_TIME_QUANTUM;
|
rlist.r_preempt = CH_TIME_QUANTUM;
|
||||||
|
#endif
|
||||||
#ifdef CH_USE_SYSTEMTIME
|
#ifdef CH_USE_SYSTEMTIME
|
||||||
rlist.r_stime = 0;
|
rlist.r_stime = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,7 +85,9 @@ void chSchGoSleepS(tstate_t newstate) {
|
||||||
|
|
||||||
(otp = currp)->p_state = newstate;
|
(otp = currp)->p_state = newstate;
|
||||||
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
|
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
|
||||||
|
#ifdef CH_USE_ROUNDROBIN
|
||||||
rlist.r_preempt = CH_TIME_QUANTUM;
|
rlist.r_preempt = CH_TIME_QUANTUM;
|
||||||
|
#endif
|
||||||
#ifdef CH_USE_TRACE
|
#ifdef CH_USE_TRACE
|
||||||
chDbgTrace(otp, currp);
|
chDbgTrace(otp, currp);
|
||||||
#endif
|
#endif
|
||||||
|
@ -152,7 +156,9 @@ void chSchWakeupS(Thread *ntp, msg_t msg) {
|
||||||
Thread *otp = currp;
|
Thread *otp = currp;
|
||||||
chSchReadyI(otp);
|
chSchReadyI(otp);
|
||||||
(currp = ntp)->p_state = PRCURR;
|
(currp = ntp)->p_state = PRCURR;
|
||||||
|
#ifdef CH_USE_ROUNDROBIN
|
||||||
rlist.r_preempt = CH_TIME_QUANTUM;
|
rlist.r_preempt = CH_TIME_QUANTUM;
|
||||||
|
#endif
|
||||||
#ifdef CH_USE_TRACE
|
#ifdef CH_USE_TRACE
|
||||||
chDbgTrace(otp, ntp);
|
chDbgTrace(otp, ntp);
|
||||||
#endif
|
#endif
|
||||||
|
@ -172,7 +178,9 @@ void chSchDoRescheduleI(void) {
|
||||||
chSchReadyI(otp);
|
chSchReadyI(otp);
|
||||||
/* pick the first thread from the ready queue */
|
/* pick the first thread from the ready queue */
|
||||||
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
|
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
|
||||||
|
#ifdef CH_USE_ROUNDROBIN
|
||||||
rlist.r_preempt = CH_TIME_QUANTUM;
|
rlist.r_preempt = CH_TIME_QUANTUM;
|
||||||
|
#endif
|
||||||
#ifdef CH_USE_TRACE
|
#ifdef CH_USE_TRACE
|
||||||
chDbgTrace(otp, currp);
|
chDbgTrace(otp, currp);
|
||||||
#endif
|
#endif
|
||||||
|
@ -204,12 +212,16 @@ void chSchRescheduleS(void) {
|
||||||
bool_t chSchRescRequiredI(void) {
|
bool_t chSchRescRequiredI(void) {
|
||||||
tprio_t p1 = firstprio(&rlist.r_queue);
|
tprio_t p1 = firstprio(&rlist.r_queue);
|
||||||
tprio_t p2 = currp->p_prio;
|
tprio_t p2 = currp->p_prio;
|
||||||
|
#ifdef CH_USE_ROUNDROBIN
|
||||||
/* If the running thread has not reached its time quantum, reschedule only
|
/* If the running thread has not reached its time quantum, reschedule only
|
||||||
* if the first thread on the ready queue has a higher priority.
|
* if the first thread on the ready queue has a higher priority.
|
||||||
* Otherwise, if the running thread has used up its time quantum, reschedule
|
* 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.
|
* if the first thread on the ready queue has equal or higher priority.
|
||||||
*/
|
*/
|
||||||
return rlist.r_preempt ? p1 > p2 : p1 >= p2;
|
return rlist.r_preempt ? p1 > p2 : p1 >= p2;
|
||||||
|
#else
|
||||||
|
return p1 > p2;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -41,7 +41,9 @@
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ThreadsQueue r_queue;
|
ThreadsQueue r_queue;
|
||||||
tprio_t r_prio;
|
tprio_t r_prio;
|
||||||
|
#ifdef CH_USE_ROUNDROBIN
|
||||||
cnt_t r_preempt;
|
cnt_t r_preempt;
|
||||||
|
#endif
|
||||||
#ifndef CH_CURRP_REGISTER_CACHE
|
#ifndef CH_CURRP_REGISTER_CACHE
|
||||||
/** the currently running thread */
|
/** the currently running thread */
|
||||||
Thread *r_current;
|
Thread *r_current;
|
||||||
|
|
|
@ -39,6 +39,10 @@
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_VIRTUAL_TIMERS
|
#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
|
/** Configuration option: if specified then the System Timer subsystem is
|
||||||
* included in the kernel.*/
|
* included in the kernel.*/
|
||||||
#define CH_USE_SYSTEMTIME
|
#define CH_USE_SYSTEMTIME
|
||||||
|
@ -139,7 +143,8 @@
|
||||||
#define CH_FREQUENCY 1000
|
#define CH_FREQUENCY 1000
|
||||||
|
|
||||||
/** Configuration option: This constant is the number of ticks allowed for the
|
/** 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
|
#define CH_TIME_QUANTUM 20
|
||||||
|
|
||||||
/** Configuration option: Defines a CPU register to be used as storage for the
|
/** Configuration option: Defines a CPU register to be used as storage for the
|
||||||
|
|
Loading…
Reference in New Issue