From b3b1028036a2f18327fb97f2126192a2ace62bb2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 21 Feb 2011 19:06:46 +0000 Subject: TIME_IMMEDIATE and TIME_INFINITE values swapped. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2757 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- docs/reports/STM32F103-72-GCC.txt | 2 +- docs/reports/kernel.txt | 38 +++++++++++++++++++------------------- os/kernel/include/chschd.h | 4 ++-- os/kernel/include/chthreads.h | 4 +--- os/kernel/src/chcond.c | 22 +++++++++++----------- os/kernel/src/chschd.c | 4 +--- os/kernel/src/chthreads.c | 6 ++---- os/kernel/src/chvt.c | 12 +++++++----- readme.txt | 2 ++ 9 files changed, 46 insertions(+), 48 deletions(-) diff --git a/docs/reports/STM32F103-72-GCC.txt b/docs/reports/STM32F103-72-GCC.txt index 8d85ad7ce..e35cb5270 100644 --- a/docs/reports/STM32F103-72-GCC.txt +++ b/docs/reports/STM32F103-72-GCC.txt @@ -130,7 +130,7 @@ Settings: SYSCLK=72, ACR=0x12 (2 wait states) --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.9 (Benchmark, I/O Queues throughput) ---- Score : 465772 bytes/S +--- Score : 474232 bytes/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.10 (Benchmark, virtual timers set/reset) diff --git a/docs/reports/kernel.txt b/docs/reports/kernel.txt index c53f23df6..d67788fd3 100644 --- a/docs/reports/kernel.txt +++ b/docs/reports/kernel.txt @@ -38,67 +38,67 @@ Platform : ARM Cortex-M3 OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=TRUE -Kernel Size = 6180 +Kernel Size = 6172 Platform : ARM Cortex-M3 OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=FALSE -Kernel Size = 5680 +Kernel Size = 5672 Platform : ARM Cortex-M3 OS Setup : Minimal kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -O2 -mthumb -Kernel Size = 1428 +Kernel Size = 1432 Platform : ARM Cortex-M3 OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -Os -mthumb -DCH_OPTIMIZE_SPEED=TRUE -Kernel Size = 5576 +Kernel Size = 5568 Platform : ARM Cortex-M3 OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -Os -mthumb -DCH_OPTIMIZE_SPEED=FALSE -Kernel Size = 5168 +Kernel Size = 5156 Platform : ARM Cortex-M3 OS Setup : Minimal kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -Os -mthumb -Kernel Size = 1244 +Kernel Size = 1248 Platform : ARM Cortex-M3 OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -Os -mthumb -ffixed-r7 -DCH_CURRP_REGISTER_CACHE=\"r7\" -DCH_OPTIMIZE_SPEED=TRUE -Kernel Size = 5356 +Kernel Size = 5348 Platform : ARM Cortex-M3 OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -Os -mthumb -ffixed-r7 -DCH_CURRP_REGISTER_CACHE=\"r7\" -DCH_OPTIMIZE_SPEED=FALSE -Kernel Size = 4976 +Kernel Size = 4964 Platform : ARM Cortex-M3 OS Setup : Minimal kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -Os -mthumb -ffixed-r7 -DCH_CURRP_REGISTER_CACHE=\"r7\" -Kernel Size = 1196 +Kernel Size = 1200 Platform : ARM Cortex-M0 OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=TRUE -Kernel Size = 5428 +Kernel Size = 5432 Platform : ARM Cortex-M0 OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=FALSE -Kernel Size = 5232 +Kernel Size = 5236 Platform : ARM Cortex-M0 OS Setup : Minimal kernel @@ -146,13 +146,13 @@ Platform : ARM7TDMI (ARM mode) OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -Os -DCH_OPTIMIZE_SPEED=TRUE -Kernel Size = 8340 +Kernel Size = 8344 Platform : ARM7TDMI (ARM mode) OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -Os -DCH_OPTIMIZE_SPEED=FALSE -Kernel Size = 7984 +Kernel Size = 7988 Platform : ARM7TDMI (ARM mode) OS Setup : Minimal kernel @@ -182,13 +182,13 @@ Platform : ARM7TDMI (ARM mode) OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -Os -ffixed-r7 -DCH_CURRP_REGISTER_CACHE=\"r7\" -DCH_OPTIMIZE_SPEED=TRUE -Kernel Size = 8048 +Kernel Size = 8052 Platform : ARM7TDMI (ARM mode) OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -Os -ffixed-r7 -DCH_CURRP_REGISTER_CACHE=\"r7\" -DCH_OPTIMIZE_SPEED=FALSE -Kernel Size = 7712 +Kernel Size = 7716 Platform : ARM7TDMI (ARM mode) OS Setup : Minimal kernel @@ -200,13 +200,13 @@ Platform : ARM7TDMI (THUMB mode) OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=TRUE -DTHUMB -DTHUMB_PRESENT -DTHUMB_NO_INTERWORKING -Kernel Size = 6004 +Kernel Size = 6008 Platform : ARM7TDMI (THUMB mode) OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=FALSE -DTHUMB -DTHUMB_PRESENT -DTHUMB_NO_INTERWORKING -Kernel Size = 5796 +Kernel Size = 5800 Platform : ARM7TDMI (THUMB mode) OS Setup : Minimal kernel @@ -236,7 +236,7 @@ Platform : ARM7TDMI (THUMB mode) OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -O2 -mthumb -ffixed-r7 -DCH_CURRP_REGISTER_CACHE=\"r7\" -DCH_OPTIMIZE_SPEED=TRUE -DTHUMB -DTHUMB_PRESENT -DTHUMB_NO_INTERWORKING -Kernel Size = 5848 +Kernel Size = 5852 Platform : ARM7TDMI (THUMB mode) OS Setup : Full kernel @@ -260,7 +260,7 @@ Platform : ARM7TDMI (THUMB mode) OS Setup : Full kernel Compiler : arm-none-eabi-gcc (GCC) 4.5.2 Options : -Os -mthumb -ffixed-r7 -DCH_CURRP_REGISTER_CACHE=\"r7\" -DCH_OPTIMIZE_SPEED=FALSE -DTHUMB -DTHUMB_PRESENT -DTHUMB_NO_INTERWORKING -Kernel Size = 5208 +Kernel Size = 5212 Platform : ARM7TDMI (THUMB mode) OS Setup : Minimal kernel diff --git a/os/kernel/include/chschd.h b/os/kernel/include/chschd.h index a9283c290..5d3aee7a0 100644 --- a/os/kernel/include/chschd.h +++ b/os/kernel/include/chschd.h @@ -48,13 +48,13 @@ * @note Not all functions accept @p TIME_IMMEDIATE as timeout parameter, * see the specific function documentation. */ -#define TIME_IMMEDIATE ((systime_t)-1) +#define TIME_IMMEDIATE ((systime_t)0) /** * @brief Infinite time specification for all the syscalls with a timeout * specification. */ -#define TIME_INFINITE ((systime_t)0) +#define TIME_INFINITE ((systime_t)-1) /** * @brief Returns the priority of the first thread on the given ready list. diff --git a/os/kernel/include/chthreads.h b/os/kernel/include/chthreads.h index 677f0be58..c22255ad0 100644 --- a/os/kernel/include/chthreads.h +++ b/os/kernel/include/chthreads.h @@ -292,9 +292,7 @@ extern "C" { * handled as follow: * - @a TIME_INFINITE the thread enters an infinite sleep * state. - * - @a TIME_IMMEDIATE this value is accepted but - * interpreted as a normal time specification not as - * an immediate timeout specification. + * - @a TIME_IMMEDIATE this value is not allowed. * . * * @sclass diff --git a/os/kernel/src/chcond.c b/os/kernel/src/chcond.c index 0ad9d459d..a6534eabc 100644 --- a/os/kernel/src/chcond.c +++ b/os/kernel/src/chcond.c @@ -203,11 +203,11 @@ msg_t chCondWaitS(CondVar *cp) { * mutex, the mutex ownership is lost. * * @param[in] cp pointer to the @p CondVar structure - * @param[in] time the number of ticks before the operation timeouts, - * the special value @p TIME_INFINITE is allowed. - * It is not possible to specify zero @p TIME_IMMEDIATE - * as timeout specification because it would make no sense - * in this function. + * @param[in] time the number of ticks before the operation timeouts, the + * special values are handled as follow: + * - @a TIME_INFINITE no timeout. + * - @a TIME_IMMEDIATE this value is not allowed. + * . * @return A message specifying how the invoking thread has been * released from the condition variable. * @retval RDY_OK if the condvar has been signaled using @@ -240,11 +240,11 @@ msg_t chCondWaitTimeout(CondVar *cp, systime_t time) { * mutex, the mutex ownership is lost. * * @param[in] cp pointer to the @p CondVar structure - * @param[in] time the number of ticks before the operation timeouts, - * the special value @p TIME_INFINITE is allowed. - * It is not possible to specify zero @p TIME_IMMEDIATE - * as timeout specification because it would make no sense - * in this function. + * @param[in] time the number of ticks before the operation timeouts, the + * special values are handled as follow: + * - @a TIME_INFINITE no timeout. + * - @a TIME_IMMEDIATE this value is not allowed. + * . * @return A message specifying how the invoking thread has been * released from the condition variable. * @retval RDY_OK if the condvar has been signaled using @@ -260,7 +260,7 @@ msg_t chCondWaitTimeoutS(CondVar *cp, systime_t time) { Mutex *mp; msg_t msg; - chDbgCheck(cp != NULL, "chCondWaitTimeoutS"); + chDbgCheck((cp != NULL) && (time != TIME_IMMEDIATE), "chCondWaitTimeoutS"); chDbgAssert(currp->p_mtxlist != NULL, "chCondWaitTimeoutS(), #1", "not owning a mutex"); diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c index 5b04c1f3d..85e968904 100644 --- a/os/kernel/src/chschd.c +++ b/os/kernel/src/chschd.c @@ -160,9 +160,7 @@ static void wakeup(void *p) { * - @a TIME_INFINITE the thread enters an infinite sleep * state, this is equivalent to invoking * @p chSchGoSleepS() but, of course, less efficient. - * - @a TIME_IMMEDIATE this value is accepted but - * interpreted as a normal time specification not as an - * immediate timeout specification. + * - @a TIME_IMMEDIATE this value is not allowed. * . * @return The wakeup message. * @retval RDY_TIMEOUT if a timeout occurs. diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c index 51efc20d1..a00b5d3db 100644 --- a/os/kernel/src/chthreads.c +++ b/os/kernel/src/chthreads.c @@ -273,16 +273,14 @@ void chThdTerminate(Thread *tp) { * handled as follow: * - @a TIME_INFINITE the thread enters an infinite sleep * state. - * - @a TIME_IMMEDIATE this value is accepted but - * interpreted as a normal time specification not as an - * immediate timeout specification. + * - @a TIME_IMMEDIATE this value is not allowed. * . * * @api */ void chThdSleep(systime_t time) { - chDbgCheck(time != TIME_INFINITE, "chThdSleep"); + chDbgCheck(time != TIME_IMMEDIATE, "chThdSleep"); chSysLock(); chThdSleepS(time); diff --git a/os/kernel/src/chvt.c b/os/kernel/src/chvt.c index b622bb493..016849186 100644 --- a/os/kernel/src/chvt.c +++ b/os/kernel/src/chvt.c @@ -52,10 +52,12 @@ void vt_init(void) { * the I-Locked state, see @ref system_states. * * @param[out] vtp the @p VirtualTimer structure pointer - * @param[in] time the number of time ticks, the value @p TIME_INFINITE - * is notallowed. The value @p TIME_IMMEDIATE is allowed - * but interpreted as a normal time specification not as - * an immediate timeout specification. + * @param[in] time the number of ticks before the operation timeouts, the + * special values are handled as follow: + * - @a TIME_INFINITE is allowed but interpreted as a + * normal time specification. + * - @a TIME_IMMEDIATE this value is not allowed. + * . * @param[in] vtfunc the timer callback function. After invoking the * callback the timer is disabled and the structure can * be disposed or reused. @@ -67,7 +69,7 @@ void vt_init(void) { void chVTSetI(VirtualTimer *vtp, systime_t time, vtfunc_t vtfunc, void *par) { VirtualTimer *p; - chDbgCheck((vtp != NULL) && (vtfunc != NULL) && (time != TIME_INFINITE), + chDbgCheck((vtp != NULL) && (vtfunc != NULL) && (time != TIME_IMMEDIATE), "chVTSetI"); vtp->vt_par = par; diff --git a/readme.txt b/readme.txt index 0ef32b5b7..4ca9da65d 100644 --- a/readme.txt +++ b/readme.txt @@ -94,6 +94,8 @@ driver. This event marks the physical transmission end of a data stream. - NEW: Implemented the new IO_TRANSMISSION_END event in the STM32 serial driver. +- CHANGE: Swapped the numeric values of the TIME_IMMEDIATE and TIME_INFINITE + constants. Fixed the relative documentation in various places. *** 2.1.8 *** - FIX: Fixed error in STM32 ADC driver macro names (bug 3160306)(backported -- cgit v1.2.3