aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/reports/STM32F407-168-GCC.txt20
-rw-r--r--os/kernel/include/chschd.h19
-rw-r--r--os/kernel/include/chthreads.h6
-rw-r--r--os/kernel/src/chschd.c95
-rw-r--r--os/kernel/src/chsys.c4
-rw-r--r--os/kernel/src/chthreads.c3
-rw-r--r--os/ports/GCC/ARM/chtypes.h1
-rw-r--r--os/ports/GCC/ARMCMx/chcore.h4
-rw-r--r--os/ports/GCC/ARMCMx/chtypes.h1
-rw-r--r--os/ports/GCC/AVR/chtypes.h1
-rw-r--r--os/ports/GCC/MSP430/chtypes.h1
-rw-r--r--os/ports/GCC/PPC/chtypes.h1
-rw-r--r--os/ports/GCC/SIMIA32/chtypes.h1
-rw-r--r--os/ports/IAR/ARMCMx/chtypes.h1
-rw-r--r--os/ports/RC/STM8/chtypes.h60
-rw-r--r--os/ports/RVCT/ARMCMx/chtypes.h1
-rw-r--r--os/ports/cosmic/STM8/chtypes.h60
-rw-r--r--readme.txt4
18 files changed, 148 insertions, 135 deletions
diff --git a/docs/reports/STM32F407-168-GCC.txt b/docs/reports/STM32F407-168-GCC.txt
index e7b27daa6..1ac46ae2d 100644
--- a/docs/reports/STM32F407-168-GCC.txt
+++ b/docs/reports/STM32F407-168-GCC.txt
@@ -5,8 +5,8 @@ Settings: SYSCLK=168, ACR=0x705 (5 wait states)
*** ChibiOS/RT test suite
***
-*** Kernel: 2.4.0
-*** Compiled: Jan 15 2012 - 20:10:20
+*** Kernel: 2.5.0
+*** Compiled: Feb 6 2012 - 20:30:43
*** Compiler: GCC 4.6.2
*** Architecture: ARMv7-ME
*** Core Variant: Cortex-M4
@@ -100,11 +100,11 @@ Settings: SYSCLK=168, ACR=0x705 (5 wait states)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.1 (Benchmark, messages #1)
---- Score : 749359 msgs/S, 1498718 ctxswc/S
+--- Score : 752723 msgs/S, 1505446 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.2 (Benchmark, messages #2)
---- Score : 617119 msgs/S, 1234238 ctxswc/S
+--- Score : 617124 msgs/S, 1234248 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.3 (Benchmark, messages #3)
@@ -112,23 +112,23 @@ Settings: SYSCLK=168, ACR=0x705 (5 wait states)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.4 (Benchmark, context switch)
---- Score : 2491424 ctxswc/S
+--- Score : 2528968 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.5 (Benchmark, threads, full cycle)
---- Score : 451234 threads/S
+--- Score : 448823 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.6 (Benchmark, threads, create only)
---- Score : 635830 threads/S
+--- Score : 635833 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.7 (Benchmark, mass reschedule, 5 threads)
---- Score : 193114 reschedules/S, 1158684 ctxswc/S
+--- Score : 193383 reschedules/S, 1160298 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.8 (Benchmark, round robin context switching)
---- Score : 1367460 ctxswc/S
+--- Score : 1356420 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.9 (Benchmark, I/O Queues throughput)
@@ -148,7 +148,7 @@ Settings: SYSCLK=168, ACR=0x705 (5 wait states)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.13 (Benchmark, RAM footprint)
---- System: 376 bytes
+--- System: 372 bytes
--- Thread: 72 bytes
--- Timer : 20 bytes
--- Semaph: 12 bytes
diff --git a/os/kernel/include/chschd.h b/os/kernel/include/chschd.h
index 54076ec56..215398659 100644
--- a/os/kernel/include/chschd.h
+++ b/os/kernel/include/chschd.h
@@ -95,9 +95,6 @@ typedef struct {
Thread *r_older; /**< @brief Older registry element. */
#endif
/* End of the fields shared with the Thread structure.*/
-#if (CH_TIME_QUANTUM > 0) || defined(__DOXYGEN__)
- cnt_t r_preempt; /**< @brief Round robin counter. */
-#endif
Thread *r_current; /**< @brief The currently running
thread. */
} ReadyList;
@@ -154,6 +151,12 @@ extern "C" {
#if !defined(PORT_OPTIMIZED_ISPREEMPTIONREQUIRED)
bool_t chSchIsPreemptionRequired(void);
#endif
+#if !defined(PORT_OPTIMIZED_DORESCHEDULEBEHIND) || defined(__DOXYGEN__)
+ void chSchDoRescheduleBehind(void);
+#endif
+#if !defined(PORT_OPTIMIZED_DORESCHEDULEAHEAD) || defined(__DOXYGEN__)
+ void chSchDoRescheduleAhead(void);
+#endif
#if !defined(PORT_OPTIMIZED_DORESCHEDULE)
void chSchDoReschedule(void);
#endif
@@ -197,7 +200,7 @@ extern "C" {
#if !defined(PORT_OPTIMIZED_DOYIELDS) || defined(__DOXYGEN__)
#define chSchDoYieldS() { \
if (chSchCanYieldS()) \
- chSchDoReschedule(); \
+ chSchDoRescheduleBehind(); \
}
#endif /* !defined(PORT_OPTIMIZED_DOYIELDS) */
@@ -212,19 +215,19 @@ extern "C" {
#define chSchPreemption() { \
tprio_t p1 = firstprio(&rlist.r_queue); \
tprio_t p2 = currp->p_prio; \
- if (rlist.r_preempt) { \
+ if (currp->p_preempt) { \
if (p1 > p2) \
- chSchDoReschedule(); \
+ chSchDoRescheduleAhead(); \
} \
else { \
if (p1 >= p2) \
- chSchDoReschedule(); \
+ chSchDoRescheduleBehind(); \
} \
}
#else /* CH_TIME_QUANTUM == 0 */
#define chSchPreemption() { \
if (p1 >= p2) \
- chSchDoReschedule(); \
+ chSchDoRescheduleAhead(); \
}
#endif /* CH_TIME_QUANTUM == 0 */
/** @} */
diff --git a/os/kernel/include/chthreads.h b/os/kernel/include/chthreads.h
index 66b593818..421a3e23f 100644
--- a/os/kernel/include/chthreads.h
+++ b/os/kernel/include/chthreads.h
@@ -122,6 +122,12 @@ struct Thread {
*/
trefs_t p_refs;
#endif
+ /**
+ * @brief Number of ticks remaining to this thread.
+ */
+#if (CH_TIME_QUANTUM > 0) || defined(__DOXYGEN__)
+ tslices_t p_preempt;
+#endif
#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__)
/**
* @brief Thread consumed time in ticks.
diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c
index 4acc500af..3dd226b1b 100644
--- a/os/kernel/src/chschd.c
+++ b/os/kernel/src/chschd.c
@@ -49,9 +49,6 @@ void _scheduler_init(void) {
queue_init(&rlist.r_queue);
rlist.r_prio = NOPRIO;
-#if CH_TIME_QUANTUM > 0
- rlist.r_preempt = CH_TIME_QUANTUM;
-#endif
#if CH_USE_REGISTRY
rlist.r_newer = rlist.r_older = (Thread *)&rlist;
#endif
@@ -59,6 +56,8 @@ void _scheduler_init(void) {
/**
* @brief Inserts a thread in the Ready List.
+ * @details The thread is positioned behind all threads with higher or equal
+ * priority.
* @pre The thread must not be already inserted in any list through its
* @p p_next and @p p_prev or list corruption would occur.
* @post This function does not reschedule so a call to a rescheduling
@@ -111,7 +110,9 @@ void chSchGoSleepS(tstate_t newstate) {
(otp = currp)->p_state = newstate;
#if CH_TIME_QUANTUM > 0
- rlist.r_preempt = CH_TIME_QUANTUM;
+ /* The thread is renouncing its remaining time slices so it will have a new
+ time quantum when it will wakeup.*/
+ otp->p_preempt = CH_TIME_QUANTUM;
#endif
setcurrp(fifo_remove(&rlist.r_queue));
currp->p_state = THD_STATE_CURRENT;
@@ -222,9 +223,6 @@ void chSchWakeupS(Thread *ntp, msg_t msg) {
chSchReadyI(ntp);
else {
Thread *otp = chSchReadyI(currp);
-#if CH_TIME_QUANTUM > 0
- rlist.r_preempt = CH_TIME_QUANTUM;
-#endif
setcurrp(ntp);
ntp->p_state = THD_STATE_CURRENT;
chSysSwitch(ntp, otp);
@@ -237,7 +235,7 @@ void chSchWakeupS(Thread *ntp, msg_t msg) {
* @details If a thread with a higher priority than the current thread is in
* the ready list then make the higher priority thread running.
*
- * @iclass
+ * @sclass
*/
#if !defined(PORT_OPTIMIZED_RESCHEDULES) || defined(__DOXYGEN__)
void chSchRescheduleS(void) {
@@ -245,7 +243,7 @@ void chSchRescheduleS(void) {
chDbgCheckClassS();
if (chSchIsRescRequiredI())
- chSchDoReschedule();
+ chSchDoRescheduleAhead();
}
#endif /* !defined(PORT_OPTIMIZED_RESCHEDULES) */
@@ -271,7 +269,7 @@ bool_t chSchIsPreemptionRequired(void) {
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;
+ return currp->r_preempt ? p1 > p2 : p1 >= p2;
#else
/* If the round robin preemption feature is not enabled then performs a
simpler comparison.*/
@@ -282,25 +280,92 @@ bool_t chSchIsPreemptionRequired(void) {
/**
* @brief Switches to the first thread on the runnable queue.
+ * @details The current thread is positioned in the ready list behind all
+ * threads having the same priority. The thread regains its time
+ * quantum.
* @note Not a user function, it is meant to be invoked by the scheduler
* itself or from within the port layer.
*
* @special
*/
-#if !defined(PORT_OPTIMIZED_DORESCHEDULE) || defined(__DOXYGEN__)
-void chSchDoReschedule(void) {
+#if !defined(PORT_OPTIMIZED_DORESCHEDULEBEHIND) || defined(__DOXYGEN__)
+void chSchDoRescheduleBehind(void) {
Thread *otp;
-#if CH_TIME_QUANTUM > 0
- rlist.r_preempt = CH_TIME_QUANTUM;
-#endif
otp = currp;
/* Picks the first thread from the ready queue and makes it current.*/
setcurrp(fifo_remove(&rlist.r_queue));
currp->p_state = THD_STATE_CURRENT;
+ otp->p_preempt = CH_TIME_QUANTUM;
chSchReadyI(otp);
chSysSwitch(currp, otp);
}
+#endif /* !defined(PORT_OPTIMIZED_DORESCHEDULEBEHIND) */
+
+/**
+ * @brief Switches to the first thread on the runnable queue.
+ * @details The current thread is positioned in the ready list ahead of all
+ * threads having the same priority.
+ * @note Not a user function, it is meant to be invoked by the scheduler
+ * itself or from within the port layer.
+ *
+ * @special
+ */
+#if !defined(PORT_OPTIMIZED_DORESCHEDULEAHEAD) || defined(__DOXYGEN__)
+void chSchDoRescheduleAhead(void) {
+ Thread *otp, *cp;
+
+ otp = currp;
+ /* Picks the first thread from the ready queue and makes it current.*/
+ setcurrp(fifo_remove(&rlist.r_queue));
+ currp->p_state = THD_STATE_CURRENT;
+
+ otp->p_state = THD_STATE_READY;
+ cp = (Thread *)&rlist.r_queue;
+ do {
+ cp = cp->p_next;
+ } while (cp->p_prio > otp->p_prio);
+ /* Insertion on p_prev.*/
+ otp->p_next = cp;
+ otp->p_prev = cp->p_prev;
+ otp->p_prev->p_next = cp->p_prev = otp;
+
+ chSysSwitch(currp, otp);
+}
+#endif /* !defined(PORT_OPTIMIZED_DORESCHEDULEAHEAD) */
+
+/**
+ * @brief Switches to the first thread on the runnable queue.
+ * @details The current thread is positioned in the ready list behind or
+ * ahead of all threads having the same priority depending on
+ * if it used its whole time slice.
+ * @note Not a user function, it is meant to be invoked by the scheduler
+ * itself or from within the port layer.
+ *
+ * @special
+ */
+#if !defined(PORT_OPTIMIZED_DORESCHEDULE) || defined(__DOXYGEN__)
+void chSchDoReschedule(void) {
+
+#if CH_TIME_QUANTUM > 0
+ /* If CH_TIME_QUANTUM is enabled then there are two different scenarios to
+ handle on preemption: time quantum elapsed or not.*/
+ if (currp->p_preempt == 0) {
+ /* The thread consumed its time quantum so it is enqueued behind threads
+ with same priority level, however, it acquires a new time quantum.*/
+ chSchDoRescheduleBehind();
+ }
+ else {
+ /* The thread didn't consume all its time quantum so it is put ahead of
+ threads with equal priority and does not acquire a new time quantum.*/
+ chSchDoRescheduleAhead();
+ }
+#else /* !(CH_TIME_QUANTUM > 0) */
+ /* If the round-robin mechanism is disabled then the thread goes always
+ ahead of its peers.*/
+ chSchDoRescheduleAhead();
+#endif /* !(CH_TIME_QUANTUM > 0) */
+}
#endif /* !defined(PORT_OPTIMIZED_DORESCHEDULE) */
/** @} */
diff --git a/os/kernel/src/chsys.c b/os/kernel/src/chsys.c
index 41946cdaf..e433a8e42 100644
--- a/os/kernel/src/chsys.c
+++ b/os/kernel/src/chsys.c
@@ -129,9 +129,9 @@ void chSysTimerHandlerI(void) {
#if CH_TIME_QUANTUM > 0
/* Running thread has not used up quantum yet? */
- if (rlist.r_preempt > 0)
+ if (currp->p_preempt > 0)
/* Decrement remaining quantum.*/
- rlist.r_preempt--;
+ currp->p_preempt--;
#endif
#if CH_DBG_THREADS_PROFILING
currp->p_time++;
diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c
index a73697eb4..eccf466d0 100644
--- a/os/kernel/src/chthreads.c
+++ b/os/kernel/src/chthreads.c
@@ -71,6 +71,9 @@ Thread *_thread_init(Thread *tp, tprio_t prio) {
tp->p_prio = prio;
tp->p_state = THD_STATE_SUSPENDED;
tp->p_flags = THD_MEM_MODE_STATIC;
+#if CH_TIME_QUANTUM > 0
+ tp->p_preempt = CH_TIME_QUANTUM;
+#endif
#if CH_USE_MUTEXES
tp->p_realprio = prio;
tp->p_mtxlist = NULL;
diff --git a/os/ports/GCC/ARM/chtypes.h b/os/ports/GCC/ARM/chtypes.h
index 41dffc938..eb0c04c77 100644
--- a/os/ports/GCC/ARM/chtypes.h
+++ b/os/ports/GCC/ARM/chtypes.h
@@ -42,6 +42,7 @@ typedef int32_t bool_t; /**< Fast boolean type. */
typedef uint8_t tmode_t; /**< Thread flags. */
typedef uint8_t tstate_t; /**< Thread state. */
typedef uint8_t trefs_t; /**< Thread references counter. */
+typedef uint8_t tslices_t; /**< Thread time slices counter. */
typedef uint32_t tprio_t; /**< Thread priority. */
typedef int32_t msg_t; /**< Inter-thread message. */
typedef int32_t eventid_t; /**< Event Id. */
diff --git a/os/ports/GCC/ARMCMx/chcore.h b/os/ports/GCC/ARMCMx/chcore.h
index 7f97cde5d..b2cf4deaa 100644
--- a/os/ports/GCC/ARMCMx/chcore.h
+++ b/os/ports/GCC/ARMCMx/chcore.h
@@ -168,8 +168,8 @@ struct intctx {};
* @brief Inlineable version of this kernel function.
*/
#define chSchIsPreemptionRequired() \
- (rlist.r_preempt ? firstprio(&rlist.r_queue) > currp->p_prio : \
- firstprio(&rlist.r_queue) >= currp->p_prio)
+ (currp->p_preempt ? firstprio(&rlist.r_queue) > currp->p_prio : \
+ firstprio(&rlist.r_queue) >= currp->p_prio)
#else /* CH_TIME_QUANTUM == 0 */
#define chSchIsPreemptionRequired() \
(firstprio(&rlist.r_queue) > currp->p_prio)
diff --git a/os/ports/GCC/ARMCMx/chtypes.h b/os/ports/GCC/ARMCMx/chtypes.h
index 2105c7130..4d896fea0 100644
--- a/os/ports/GCC/ARMCMx/chtypes.h
+++ b/os/ports/GCC/ARMCMx/chtypes.h
@@ -40,6 +40,7 @@ typedef int32_t bool_t; /**< Fast boolean type. */
typedef uint8_t tmode_t; /**< Thread flags. */
typedef uint8_t tstate_t; /**< Thread state. */
typedef uint8_t trefs_t; /**< Thread references counter. */
+typedef uint8_t tslices_t; /**< Thread time slices counter. */
typedef uint32_t tprio_t; /**< Thread priority. */
typedef int32_t msg_t; /**< Inter-thread message. */
typedef int32_t eventid_t; /**< Event Id. */
diff --git a/os/ports/GCC/AVR/chtypes.h b/os/ports/GCC/AVR/chtypes.h
index 3831f0f7c..0c8197823 100644
--- a/os/ports/GCC/AVR/chtypes.h
+++ b/os/ports/GCC/AVR/chtypes.h
@@ -42,6 +42,7 @@ typedef int8_t bool_t; /**< Fast boolean type. */
typedef uint8_t tmode_t; /**< Thread flags. */
typedef uint8_t tstate_t; /**< Thread state. */
typedef uint8_t trefs_t; /**< Thread references counter. */
+typedef uint8_t tslices_t; /**< Thread time slices counter. */
typedef uint8_t tprio_t; /**< Thread priority. */
typedef int16_t msg_t; /**< Inter-thread message. */
typedef uint8_t eventid_t; /**< Event Id. */
diff --git a/os/ports/GCC/MSP430/chtypes.h b/os/ports/GCC/MSP430/chtypes.h
index cd35a341e..a56351016 100644
--- a/os/ports/GCC/MSP430/chtypes.h
+++ b/os/ports/GCC/MSP430/chtypes.h
@@ -42,6 +42,7 @@ typedef int16_t bool_t; /**< Fast boolean type. */
typedef uint8_t tmode_t; /**< Thread flags. */
typedef uint8_t tstate_t; /**< Thread state. */
typedef uint8_t trefs_t; /**< Thread references counter. */
+typedef uint8_t tslices_t; /**< Thread time slices counter. */
typedef uint16_t tprio_t; /**< Thread priority. */
typedef int16_t msg_t; /**< Inter-thread message. */
typedef int16_t eventid_t; /**< Event Id. */
diff --git a/os/ports/GCC/PPC/chtypes.h b/os/ports/GCC/PPC/chtypes.h
index 88e9742b7..debc5f0f8 100644
--- a/os/ports/GCC/PPC/chtypes.h
+++ b/os/ports/GCC/PPC/chtypes.h
@@ -54,6 +54,7 @@ typedef int32_t bool_t; /**< Fast boolean type. */
typedef uint8_t tmode_t; /**< Thread flags. */
typedef uint8_t tstate_t; /**< Thread state. */
typedef uint8_t trefs_t; /**< Thread references counter. */
+typedef uint8_t tslices_t; /**< Thread time slices counter. */
typedef uint32_t tprio_t; /**< Thread priority. */
typedef int32_t msg_t; /**< Inter-thread message. */
typedef int32_t eventid_t; /**< Event Id. */
diff --git a/os/ports/GCC/SIMIA32/chtypes.h b/os/ports/GCC/SIMIA32/chtypes.h
index 693ade588..54d701044 100644
--- a/os/ports/GCC/SIMIA32/chtypes.h
+++ b/os/ports/GCC/SIMIA32/chtypes.h
@@ -34,6 +34,7 @@ typedef int32_t bool_t; /**< Fast boolean type. */
typedef uint8_t tmode_t; /**< Thread flags. */
typedef uint8_t tstate_t; /**< Thread state. */
typedef uint8_t trefs_t; /**< Thread references counter. */
+typedef uint8_t tslices_t; /**< Thread time slices counter. */
typedef uint32_t tprio_t; /**< Thread priority. */
typedef int32_t msg_t; /**< Inter-thread message. */
typedef int32_t eventid_t; /**< Event Id. */
diff --git a/os/ports/IAR/ARMCMx/chtypes.h b/os/ports/IAR/ARMCMx/chtypes.h
index e8a6a7dc4..36e24e5c7 100644
--- a/os/ports/IAR/ARMCMx/chtypes.h
+++ b/os/ports/IAR/ARMCMx/chtypes.h
@@ -40,6 +40,7 @@ typedef int32_t bool_t; /**< Fast boolean type. */
typedef uint8_t tmode_t; /**< Thread flags. */
typedef uint8_t tstate_t; /**< Thread state. */
typedef uint8_t trefs_t; /**< Thread references counter. */
+typedef uint8_t tslices_t; /**< Thread time slices counter. */
typedef uint32_t tprio_t; /**< Thread priority. */
typedef int32_t msg_t; /**< Inter-thread message. */
typedef int32_t eventid_t; /**< Event Id. */
diff --git a/os/ports/RC/STM8/chtypes.h b/os/ports/RC/STM8/chtypes.h
index 3a0efe78a..7d5ebdb31 100644
--- a/os/ports/RC/STM8/chtypes.h
+++ b/os/ports/RC/STM8/chtypes.h
@@ -47,55 +47,17 @@ typedef uint8_t uint_fast8_t; /**< C99-style 8 bits unsigned. */
typedef uint16_t uint_fast16_t; /**< C99-style 16 bits unsigned. */
typedef uint32_t uint_fast32_t; /**< C99-style 32 bits unsigned. */
-/**
- * @brief Boolean, recommended the fastest signed.
- */
-typedef int8_t bool_t;
-
-/**
- * @brief Thread mode flags, uint8_t is ok.
- */
-typedef uint8_t tmode_t;
-
-/**
- * @brief Thread state, uint8_t is ok.
- */
-typedef uint8_t tstate_t;
-
-/**
- * @brief Thread references counter, uint8_t is ok.
- */
-typedef uint8_t trefs_t;
-
-/**
- * @brief Priority, use the fastest unsigned type.
- */
-typedef uint8_t tprio_t;
-
-/**
- * @brief Message, use signed pointer equivalent.
- */
-typedef int16_t msg_t;
-
-/**
- * @brief Event Id, use fastest signed.
- */
-typedef int8_t eventid_t;
-
-/**
- * @brief Event Mask, recommended fastest unsigned.
- */
-typedef uint8_t eventmask_t;
-
-/**
- * @brief System Time, recommended fastest unsigned.
- */
-typedef uint16_t systime_t;
-
-/**
- * @brief Counter, recommended fastest signed.
- */
-typedef int8_t cnt_t;
+typedef int8_t bool_t; /**< Fast boolean type. */
+typedef uint8_t tmode_t; /**< Thread flags. */
+typedef uint8_t tstate_t; /**< Thread state. */
+typedef uint8_t trefs_t; /**< Thread references counter. */
+typedef uint8_t tslices_t; /**< Thread time slices counter. */
+typedef uint8_t tprio_t; /**< Thread priority. */
+typedef int16_t msg_t; /**< Inter-thread message. */
+typedef int8_t eventid_t; /**< Event Id. */
+typedef uint8_t eventmask_t; /**< Events mask. */
+typedef uint16_t systime_t; /**< System time. */
+typedef int8_t cnt_t; /**< Resources counter. */
/**
* @brief Inline function modifier.
diff --git a/os/ports/RVCT/ARMCMx/chtypes.h b/os/ports/RVCT/ARMCMx/chtypes.h
index 41f37c6f4..b9baf2502 100644
--- a/os/ports/RVCT/ARMCMx/chtypes.h
+++ b/os/ports/RVCT/ARMCMx/chtypes.h
@@ -40,6 +40,7 @@ typedef int32_t bool_t; /**< Fast boolean type. */
typedef uint8_t tmode_t; /**< Thread flags. */
typedef uint8_t tstate_t; /**< Thread state. */
typedef uint8_t trefs_t; /**< Thread references counter. */
+typedef uint8_t tslices_t; /**< Thread time slices counter. */
typedef uint32_t tprio_t; /**< Thread priority. */
typedef int32_t msg_t; /**< Inter-thread message. */
typedef int32_t eventid_t; /**< Event Id. */
diff --git a/os/ports/cosmic/STM8/chtypes.h b/os/ports/cosmic/STM8/chtypes.h
index c957863d4..9c1749a96 100644
--- a/os/ports/cosmic/STM8/chtypes.h
+++ b/os/ports/cosmic/STM8/chtypes.h
@@ -47,55 +47,17 @@ typedef uint8_t uint_fast8_t; /**< C99-style 8 bits unsigned. */
typedef uint16_t uint_fast16_t; /**< C99-style 16 bits unsigned. */
typedef uint32_t uint_fast32_t; /**< C99-style 32 bits unsigned. */
-/**
- * @brief Boolean, recommended the fastest signed.
- */
-typedef int8_t bool_t;
-
-/**
- * @brief Thread mode flags, uint8_t is ok.
- */
-typedef uint8_t tmode_t;
-
-/**
- * @brief Thread state, uint8_t is ok.
- */
-typedef uint8_t tstate_t;
-
-/**
- * @brief Thread references counter, uint8_t is ok.
- */
-typedef uint8_t trefs_t;
-
-/**
- * @brief Priority, use the fastest unsigned type.
- */
-typedef uint8_t tprio_t;
-
-/**
- * @brief Message, use signed pointer equivalent.
- */
-typedef int16_t msg_t;
-
-/**
- * @brief Event Id, use fastest signed.
- */
-typedef int8_t eventid_t;
-
-/**
- * @brief Event Mask, recommended fastest unsigned.
- */
-typedef uint8_t eventmask_t;
-
-/**
- * @brief System Time, recommended fastest unsigned.
- */
-typedef uint16_t systime_t;
-
-/**
- * @brief Counter, recommended fastest signed.
- */
-typedef int8_t cnt_t;
+typedef int8_t bool_t; /**< Fast boolean type. */
+typedef uint8_t tmode_t; /**< Thread flags. */
+typedef uint8_t tstate_t; /**< Thread state. */
+typedef uint8_t trefs_t; /**< Thread references counter. */
+typedef uint8_t tslices_t; /**< Thread time slices counter. */
+typedef uint8_t tprio_t; /**< Thread priority. */
+typedef int16_t msg_t; /**< Inter-thread message. */
+typedef int8_t eventid_t; /**< Event Id. */
+typedef uint8_t eventmask_t; /**< Events mask. */
+typedef uint16_t systime_t; /**< System time. */
+typedef int8_t cnt_t; /**< Resources counter. */
/**
* @brief Inline function modifier.
diff --git a/readme.txt b/readme.txt
index eccfa8b92..e881c767e 100644
--- a/readme.txt
+++ b/readme.txt
@@ -82,6 +82,10 @@
- NEW: Updated debug plugin 1.0.8 (backported to 2.4.0).
- NEW: Added more accurate UBRR calculation in AVR serial driver (backported
to 2.4.0).
+- NEW: Revision of the round-robin scheduling, now threads do not lose their
+ time slice when preempted. Each thread has its own time slices counter.
+ TODO: Half done, extend it to all ports.
+ TODO: Seek optimizations.
*** 2.3.5 ***
- FIX: Fixed RTC compile problem on STM32F103 (bug 3468445).