diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-03-08 08:15:23 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-03-08 08:15:23 +0000 |
commit | 8588e9642d632d6d84e9c48388cfb566ecd4a36e (patch) | |
tree | 9d5ae2d4e32efe315de79fcf478035527a84dc7f | |
parent | a5d0e873823ef5a407f3d08396cab0b25694f205 (diff) | |
download | ChibiOS-8588e9642d632d6d84e9c48388cfb566ecd4a36e.tar.gz ChibiOS-8588e9642d632d6d84e9c48388cfb566ecd4a36e.tar.bz2 ChibiOS-8588e9642d632d6d84e9c48388cfb566ecd4a36e.zip |
Fixes to the documentation, swapped the values of constants TIME_INFINITE and TIME_IMMEDIATE (previously TIME_ZERO).
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@816 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r-- | docs/index.html | 180 | ||||
-rw-r--r-- | docs/reports/STM32F103-72.txt | 6 | ||||
-rw-r--r-- | src/chcond.c | 10 | ||||
-rw-r--r-- | src/chevents.c | 12 | ||||
-rw-r--r-- | src/chmboxes.c | 12 | ||||
-rw-r--r-- | src/chschd.c | 2 | ||||
-rw-r--r-- | src/chsem.c | 6 | ||||
-rw-r--r-- | src/chthreads.c | 101 | ||||
-rw-r--r-- | src/chvt.c | 26 | ||||
-rw-r--r-- | src/include/scheduler.h | 8 | ||||
-rw-r--r-- | test/testsem.c | 2 |
11 files changed, 107 insertions, 258 deletions
diff --git a/docs/index.html b/docs/index.html index 87ea4e9f8..bf4fe4e3f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,172 +1,8 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html><head>
- <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
- <title>ChibiOS/RT embedded RTOS homepage</title></head>
-<body>
-<table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2">
- <tbody>
- <tr align="center">
- <td colspan="2" rowspan="1">
- <h2>ChibiOS/RT embedded RTOS homepage</h2>
- </td>
- </tr>
- <tr>
- <td style="text-align: center; vertical-align: top; width: 150px;">Current
-Versions<br>
-1.0.1 stable<br>
-1.1.0 unstable<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>
- <a href="http://sourceforge.net/project/showfiles.php?group_id=205897" rel="me" target="_top">Downloads</a><br>
- <a href="http://sourceforge.net/users/gdisirio/" rel="me" target="_top">Contact me</a><br>
--<br>
- <a href="#History">History</a><br>
- <a href="#Description">Description</a><br><a href="index.html#Current_ports">Current ports</a><br>
- <a href="#Design">Design</a><br><a href="#Performance_and_Size">Performance and Size</a><br>
- <a href="#Future">Future</a><br>
--<br>
- <a href="#Credits">Credits</a><br>
- <br>
- <a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=205897&type=4" alt="SourceForge.net Logo" border="0" height="37" width="125"></a><br>
- <br>
- <a href="http://sourceforge.net/donate/index.php?group_id=205897"><img src="http://images.sourceforge.net/images/project-support.jpg" alt="Support This Project" border="0" height="32" width="88"></a><br><br>
-<!-- Inizio Codice Shinystat -->
-<script type="text/javascript" language="JavaScript" src="http://codice.shinystat.com/cgi-bin/getcod.cgi?USER=ChibiOS"></script>
-<noscript>
-<a href="http://www.shinystat.com/it" target="_top">
-<img src="http://www.shinystat.com/cgi-bin/shinystat.cgi?USER=ChibiOS" alt="Statistiche" border="0"></a>
-</noscript>
-<!-- Fine Codice Shinystat -->
- </td>
- <td style="text-align: justify; vertical-align: top;">
- <h3><a name="History"></a>History</h3>
-This RTOS is something I wrote back in 1990 for use on boards
-equipped
-with M68K processors, the development was made on an Atari ST. The OS
-worked well for its intended purpose, Internet was not
-widespread at that time so the system had a limited use.<br>
-Recently I decided to release this system, formerly known as <span style="font-style: italic;">mkRTOS</span>, as Free
-Software. I cleaned up the code, improved the documentation, ported it
-to more modern architectures and it is finally ready.<br>
- <h3><a name="Description"></a>Description</h3>
-ChibiOS/RT is designed for embedded applications and it is meant to be
-linked with the application code. The design philosophy is to make it
-easy to use so I hope that all the APIs are meaningful, easy to
-understand and with the parameters you would expect from them.<br>The
-system offers threads, semaphores, mutexes, messages, events, virtual
-timers,
-queues, I/O channels with timeout capability and much more. The
-Priority Inheritance algorithm is implemented through the Mutexes
-mechaninsm, the implementation supports any number of threads and
-nested mutexes.<br>
- <h3><a name="Current_ports"></a>Current
-ports</h3>
-Currently the ChibiOS/RT is ported to the following architectures:<br>
- <ul>
- <li>ARM7TDMI-LPC214x, the port to other LPC2000 chips
-should be trivial. Both ARM and THUMB modes are supported.</li>
- <li>ARM7TDMI-AT91SAM7X256, this port also supports other Atmel
-chips: SAM7XC, SAM7S and the various sizes (128, 256, 512) with
-minimal changes.</li>
- <li>ARM Cortex-M3, ST Microelectronics STM32.</li>
- <li>Atmel AVR: AT90CAN128 and ATmega128 demos included.</li>
- <li>Texas Instruments MSP430.</li>
- <li>x86 as a Win32 process, this port allows to write
-your application on the PC without the need of a development
-board/simulator/emulator. Communication ports are simulated over
-sockets, you can telnet on the simulator ports for the debug. I am
-considering to create a similar simulator into a Linux process.</li>
- <li>M68K, this was the original target but it is
-currently removed from the source tree because currently I have no way
-to test it, my old Atari ST is long dead. It should be very easy to
-revive the port to the M68K or Coldfire CPUs.</li>
- </ul>
-In general the port is very easy on architectures that can handle well
-linked lists, the kernel is entirely reliant on lists so this
-is a
-very important efficiency factor. 16 and 32 bits architectures are
-always fine, 8 bit architectures should be evaluated case by case but
-are not ruled out, something like an H8 would not have problems. You
-could port it
-to a Z80/Z180 (I considered that too, and made tests using the SDCC
-compiler) but the
-resulting code is not much efficient because the instruction set is
-missing the indirect addressing for 16 bits values that is important
-for efficient linked lists traversal.
- <h3><a name="Design"></a>Design</h3>
-The system was designed to be stable and avoid trouble as much as
-possible so some rules were set:<br>
- <ul>
- <li>No arrays or tables, I don't like to have to
-configure limits
-for data structures, only use lists or other dynamic data structures.
-See
-the <a href="http://chibios.sourceforge.net/html/index.html" target="_top" rel="me">Documentation</a> and
-the demos.</li>
- <li>No memory allocation inside the kernel, an allocator
-can be
-troublesome for RT applications. All the data structures are declared
-in the application code and not allocated from a shared system heap.
-This does not prevent the application code to use an allocator if
-needed, it is just the kernel that does not require it.</li>
- <li>No weird macros in the user code, everything should
-look
-and feel like normal C code with a normal main() function.</li>
- <li>Encapsulate all the things that need changes while
-porting
-the OS to new architectures in few template files, fill the code into
-the templates and the port is done.</li></ul><h3><a name="Performance_and_Size"></a>Performance and Size</h3>ChibiOS/RT
-has a wide set of APIs but all the subsystems can be included or
-removed from the memory image by editing the kernel configuration file
-chconf.h. On ARM processors, the kernel size starts at just
-1.5KiB depending on the included subsystems and the choosen
-compiler optimizations.<br>As reference, a kernel configured with...<br><ul><li>System startup code</li><li>Chip initialization code</li><li>Multithreading APIs</li><li>Virtual Timer APIs</li><li>Semaphore APIs</li><li>System time + Sleep API</li><li>Suspend/Resume APIs</li><li>Small main() program with flashing LEDs demo and 3 threads</li></ul>...just takes 2.11KiB of program space when compiled using THUMB code and space optimizations. Note that this is quite a <span style="font-weight: bold;">typical configuration</span>
-not a minimal one. A kernel configured with all the options and
-optimized for speed takes about 6KiB. See the documentation about the
-many available subsystems.<br><br>About performance, on a 48MHz LPC
-ARM7 processor the kernel is capable of context switch time ranging
-from 3 to 6 microseconds depending on the code type (ARM/THUMB) and the
-choosen compiler/kernel optimizations. In the distribution is included
-a spreadsheet with the exact values and the various space/time trade
-offs.<br>The context switch time is *measured* using 2 threads
-exchanging messages and doing *real* work, it is not a calculated peak
-value. See the demo code, it includes the benchmark.
- <h3><a name="Future"></a>Future</h3>
-Expect:<br><ul>
-
- <li>Documentation improvements.</li>
-
- <li>Ports to more architectures/boards when I am able to
-put my hands on new hardware/tools.</li>
- <li>More demos.</li>
- <li>Creation of new subsystems.</li>
- <li>Integration with
-existing other free projects like: TCP/IP stacks, File Systems etc.</li>
- </ul>
- <h3><a name="Credits"></a>Credits</h3>
-ChibiOS/RT is 100% proprietary software free and was created using all the following FOSS projects:<br>
- <ul>
- <li>7-Zip, <a href="http://7-zip.org" target="_top">http://7-zip.org</a></li>
- <li>GCC and GNU binutils, <a href="http://gcc.gnu.org" target="_top">http://gcc.gnu.org</a></li>
- <li>Doxygen, <a href="http://www.doxygen.org" target="_top">http://www.doxygen.org</a></li>
- <li>Eclipse, <a href="http://www.eclipse.org" target="_top">http://www.eclipse.org</a></li>
- <li>Eclox, <a href="http://eclox.eu" target="_top">http://eclox.eu</a></li>
- <li>Freemarker, <a href="http://freemarker.org" target="_top">http://freemarker.org</a></li>
- <li>FMPP, <a href="http://fmpp.sourceforge.net" target="_top">http://fmpp.sourceforge.net</a></li>
- <li>Graphviz, <a href="http://www.graphviz.org" target="_top">http://www.graphviz.org</a></li>
- <li>Inkscape, <a href="http://www.inkscape.org" target="_top">http://www.inkscape.org</a></li>
- <li>MinGW, <a href="http://mingw.org" target="_top">http://mingw.org</a></li>
- <li>MSPGCC, <a href="http://mspgcc.sourceforge.net" target="_top">http://mspgcc.sourceforge.net</a></li>
- <li>NVU, <a href="http://www.nvu.com/" target="_top">http://www.nvu.com</a></li>
- <li>OpenOCD, <a href="http://openocd.berlios.de/web" target="_top">http://openocd.berlios.de/web</a></li>
- <li>WinARM, <a href="http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects" target="_top">http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects</a></li>
- <li>WinAVR, <a href="http://winavr.sourceforge.net" target="_top">http://winavr.sourceforge.net</a></li>
- <li>YAGARTO, <a href="http://www.yagarto.de" target="_top">http://www.yagarto.de</a></li>
- </ul>
- </td>
- </tr>
- </tbody>
-</table>
-
-</body></html>
\ No newline at end of file +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Refresh" content="0; URL=html/index.html">
+ </head>
+ <body>
+ </body>
+</html>
diff --git a/docs/reports/STM32F103-72.txt b/docs/reports/STM32F103-72.txt index e871e0c13..f7f0bcda0 100644 --- a/docs/reports/STM32F103-72.txt +++ b/docs/reports/STM32F103-72.txt @@ -60,7 +60,7 @@ Settings: SYSCLK=72, ACR=0x12 (2 wait states) --- Result: SUCCESS
---------------------------------------------------------------------------
--- Test Case 11.2 (Benchmark, context switch #2, empty ready list)
---- Score : 178664 msgs/S, 357328 ctxswc/S
+--- Score : 178663 msgs/S, 357326 ctxswc/S
--- Result: SUCCESS
---------------------------------------------------------------------------
--- Test Case 11.3 (Benchmark, context switch #3, 4 threads in ready list)
@@ -72,7 +72,7 @@ Settings: SYSCLK=72, ACR=0x12 (2 wait states) --- Result: SUCCESS
---------------------------------------------------------------------------
--- Test Case 11.5 (Benchmark, threads creation/termination, optimal)
---- Score : 210632 threads/S
+--- Score : 210633 threads/S
--- Result: SUCCESS
---------------------------------------------------------------------------
--- Test Case 11.6 (Benchmark, mass reschedulation, 5 threads)
@@ -92,7 +92,7 @@ Settings: SYSCLK=72, ACR=0x12 (2 wait states) --- Result: SUCCESS
---------------------------------------------------------------------------
--- Test Case 11.10 (Benchmark, mutexes lock/unlock)
---- Score : 601124 lock+unlock/S
+--- Score : 601120 lock+unlock/S
--- Result: SUCCESS
---------------------------------------------------------------------------
diff --git a/src/chcond.c b/src/chcond.c index fea5bebee..ef58f1ddf 100644 --- a/src/chcond.c +++ b/src/chcond.c @@ -164,8 +164,9 @@ msg_t chCondWaitS(CondVar *cp) { * @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_ZERO) as timeout
- * specification.
+ * It is not possible to specify zero @p TIME_IMMEDIATE
+ * as timeout specification because it would make no sense
+ * in this function.
* @return The wakep mode.
* @retval RDY_OK if the condvar was signaled using chCondSignal().
* @retval RDY_RESET if the condvar was signaled using chCondBroadcast().
@@ -191,8 +192,9 @@ msg_t chCondWaitTimeout(CondVar *cp, systime_t time) { * @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_ZERO) as timeout
- * specification.
+ * It is not possible to specify zero @p TIME_IMMEDIATE
+ * as timeout specification because it would make no sense
+ * in this function.
* @return The wakep mode.
* @retval RDY_OK if the condvar was signaled using chCondSignal().
* @retval RDY_RESET if the condvar was signaled using chCondBroadcast().
diff --git a/src/chevents.c b/src/chevents.c index 5633b7de3..a7089cb13 100644 --- a/src/chevents.c +++ b/src/chevents.c @@ -290,7 +290,7 @@ eventmask_t chEvtWaitAll(eventmask_t ewmask) { * @p ALL_EVENTS enables all the events
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_ZERO immediate timeout.
+ * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The mask of the lowest id served and cleared event.
@@ -307,7 +307,7 @@ eventmask_t chEvtWaitOneTimeout(eventmask_t ewmask, systime_t time) { chSysLock();
if ((m = (currp->p_epending & ewmask)) == 0) {
- if (TIME_ZERO == time)
+ if (TIME_IMMEDIATE == time)
return (eventmask_t)0;
currp->p_ewmask = ewmask;
if (chSchGoSleepTimeoutS(PRWTOREVT, time) < RDY_OK)
@@ -331,7 +331,7 @@ eventmask_t chEvtWaitOneTimeout(eventmask_t ewmask, systime_t time) { * @p ALL_EVENTS enables all the events
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_ZERO immediate timeout.
+ * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The mask of the served and cleared events.
@@ -343,7 +343,7 @@ eventmask_t chEvtWaitAnyTimeout(eventmask_t ewmask, systime_t time) { chSysLock();
if ((m = (currp->p_epending & ewmask)) == 0) {
- if (TIME_ZERO == time)
+ if (TIME_IMMEDIATE == time)
return (eventmask_t)0;
currp->p_ewmask = ewmask;
if (chSchGoSleepTimeoutS(PRWTOREVT, time) < RDY_OK)
@@ -364,7 +364,7 @@ eventmask_t chEvtWaitAnyTimeout(eventmask_t ewmask, systime_t time) { * @param[in] ewmask mask of the event ids that the function should wait for
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_ZERO immediate timeout.
+ * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The mask of the served and cleared events.
@@ -375,7 +375,7 @@ eventmask_t chEvtWaitAllTimeout(eventmask_t ewmask, systime_t time) { chSysLock();
if ((currp->p_epending & ewmask) != ewmask) {
- if (TIME_ZERO == time)
+ if (TIME_IMMEDIATE == time)
return (eventmask_t)0;
currp->p_ewmask = ewmask;
if (chSchGoSleepTimeoutS(PRWTANDEVT, time) < RDY_OK)
diff --git a/src/chmboxes.c b/src/chmboxes.c index 25c4001ef..743b5a568 100644 --- a/src/chmboxes.c +++ b/src/chmboxes.c @@ -72,7 +72,7 @@ void chMBReset(Mailbox *mbp) { * @param[in] msg the message to be posted on the mailbox
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_ZERO immediate timeout.
+ * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
@@ -98,7 +98,7 @@ msg_t chMBPost(Mailbox *mbp, msg_t msg, systime_t time) { * @param[in] msg the message to be posted on the mailbox
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_ZERO immediate timeout.
+ * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
@@ -131,7 +131,7 @@ msg_t chMBPostS(Mailbox *mbp, msg_t msg, systime_t time) { * @param[in] msg the message to be posted on the mailbox
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_ZERO immediate timeout.
+ * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
@@ -157,7 +157,7 @@ msg_t chMBPostAhead(Mailbox *mbp, msg_t msg, systime_t time) { * @param[in] msg the message to be posted on the mailbox
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_ZERO immediate timeout.
+ * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
@@ -190,7 +190,7 @@ msg_t chMBPostAheadS(Mailbox *mbp, msg_t msg, systime_t time) { * @param[out] msgp pointer to a message variable for the received message
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_ZERO immediate timeout.
+ * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
@@ -216,7 +216,7 @@ msg_t chMBFetch(Mailbox *mbp, msg_t *msgp, systime_t time) { * @param[out] msgp pointer to a message variable for the received message
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_ZERO immediate timeout.
+ * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The operation status.
diff --git a/src/chschd.c b/src/chschd.c index 629a659e0..8a5c27857 100644 --- a/src/chschd.c +++ b/src/chschd.c @@ -124,7 +124,7 @@ static void wakeup(void *p) { * @param[in] newstate the new thread state * @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_ZERO) as timeout + * It is not possible to specify @p TIME_IMMEDIATE as timeout * specification. * @return The wakeup message. * @retval RDY_TIMEOUT if a timeout occurs. diff --git a/src/chsem.c b/src/chsem.c index b5717e69c..6c254e836 100644 --- a/src/chsem.c +++ b/src/chsem.c @@ -134,7 +134,7 @@ msg_t chSemWaitS(Semaphore *sp) { * @param[in] sp pointer to a @p Semaphore structure
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_ZERO immediate timeout.
+ * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* @retval RDY_OK if the semaphore was signaled or not taken.
* @retval RDY_RESET if the semaphore was reset using @p chSemReset().
@@ -158,7 +158,7 @@ msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) { * @param[in] sp pointer to a @p Semaphore structure
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
- * - @a TIME_ZERO immediate timeout.
+ * - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @retval RDY_OK if the semaphore was signaled or not taken.
@@ -173,7 +173,7 @@ msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) { chDbgCheck(sp != NULL, "chSemWaitTimeoutS");
if (--sp->s_cnt < 0) {
- if (TIME_ZERO == time)
+ if (TIME_IMMEDIATE == time)
return RDY_TIMEOUT;
sem_insert(currp, &sp->s_queue);
currp->p_wtsemp = sp;
diff --git a/src/chthreads.c b/src/chthreads.c index 902867a41..a22514f09 100644 --- a/src/chthreads.c +++ b/src/chthreads.c @@ -69,15 +69,16 @@ static void memfill(uint8_t *startp, uint8_t *endp, uint8_t v) { /** * @brief Initializes a new thread. * @details The new thread is initialized but not inserted in the ready list, - * the initial state is @p PRSUSPENDED. + * the initial state is @p PRSUSPENDED. * - * @param prio the priority level for the new thread. Usually the threads are - * created with priority @p NORMALPRIO, priorities - * can range from @p LOWPRIO to @p HIGHPRIO. - * @param workspace pointer to a working area dedicated to the thread stack - * @param wsize size of the working area. - * @param pf the thread function - * @param arg an argument passed to the thread function. It can be @p NULL. + * @param[out] workspace pointer to a working area dedicated to the thread + * stack + * @param[in] wsize size of the working area. + * @param[in] prio the priority level for the new thread. Usually the threads + * are created with priority @p NORMALPRIO, priorities + * can range from @p LOWPRIO to @p HIGHPRIO. + * @param[in] pf the thread function + * @param[in] arg an argument passed to the thread function. It can be @p NULL. * @return The pointer to the @p Thread structure allocated for the * thread into the working space area. * @note A thread can terminate by calling @p chThdExit() or by simply @@ -109,13 +110,14 @@ Thread *chThdInit(void *workspace, size_t wsize, /** * @brief Creates a new thread into a static memory area. * - * @param workspace pointer to a working area dedicated to the thread stack - * @param wsize size of the working area. - * @param prio the priority level for the new thread. Usually the threads are - * created with priority @p NORMALPRIO, priorities + * @param[out] workspace pointer to a working area dedicated to the thread + * stack + * @param[in] wsize size of the working area. + * @param[in] prio the priority level for the new thread. Usually the threads + * are created with priority @p NORMALPRIO, priorities * can range from @p LOWPRIO to @p HIGHPRIO. - * @param pf the thread function - * @param arg an argument passed to the thread function. It can be @p NULL. + * @param[in] pf the thread function + * @param[in] arg an argument passed to the thread function. It can be @p NULL. * @return The pointer to the @p Thread structure allocated for the * thread into the working space area. * @note A thread can terminate by calling @p chThdExit() or by simply @@ -131,12 +133,12 @@ Thread *chThdCreateStatic(void *workspace, size_t wsize, /** * @brief Creates a new thread allocating the memory from the heap. * - * @param wsize size of the working area to be allocated - * @param prio the priority level for the new thread. Usually the threads are - * created with priority @p NORMALPRIO, priorities - * can range from @p LOWPRIO to @p HIGHPRIO. - * @param pf the thread function - * @param arg an argument passed to the thread function. It can be @p NULL. + * @param[in] wsize size of the working area to be allocated + * @param[in] prio the priority level for the new thread. Usually the threads + * are created with priority @p NORMALPRIO, priorities + * can range from @p LOWPRIO to @p HIGHPRIO. + * @param[in] pf the thread function + * @param[in] arg an argument passed to the thread function. It can be @p NULL. * @return The pointer to the @p Thread structure allocated for the * thread into the working space area. * @retval NULL if the memory cannot be allocated. @@ -163,14 +165,14 @@ Thread *chThdCreateFromHeap(size_t wsize, tprio_t prio, #if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_MEMPOOLS /** * @brief Creates a new thread allocating the memory from the specified Memory - * Pool. + * Pool. * - * @param mp the memory pool - * @param prio the priority level for the new thread. Usually the threads are - * created with priority @p NORMALPRIO, priorities - * can range from @p LOWPRIO to @p HIGHPRIO. - * @param pf the thread function - * @param arg an argument passed to the thread function. It can be @p NULL. + * @param[in] mp the memory pool + * @param[in] prio the priority level for the new thread. Usually the threads + * are created with priority @p NORMALPRIO, priorities + * can range from @p LOWPRIO to @p HIGHPRIO. + * @param[in] pf the thread function + * @param[in] arg an argument passed to the thread function. It can be @p NULL. * @return The pointer to the @p Thread structure allocated for the * thread into the working space area or @p NULL if the memory cannot * be allocated. @@ -200,9 +202,9 @@ Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio, /** * @brief Changes the running thread priority level then reschedules if - * necessary. + * necessary. * - * @param newprio the new priority level of the running thread + * @param[in] newprio the new priority level of the running thread * @return The old priority level. * @note The function returns the real thread priority regardless of the * actual priority that could be higher than the real priority because @@ -232,7 +234,7 @@ tprio_t chThdSetPriority(tprio_t newprio) { /** * @brief Resumes a suspended thread. * - * @param tp the pointer to the thread + * @param[in] tp the pointer to the thread * @return The pointer to the thread. * @note This call is supposed to resume threads created with @p chThdInit(). * It should not be used on threads suspended using @p chThdSuspend(). @@ -251,7 +253,7 @@ Thread *chThdResume(Thread *tp) { /** * @brief Requests a thread termination. * - * @param tp the pointer to the thread + * @param[in] tp the pointer to the thread * @note The thread is not termitated but a termination request is added to * its @p p_flags field. The thread can read this status by * invoking @p chThdShouldTerminate() and then terminate cleanly. @@ -266,10 +268,14 @@ void chThdTerminate(Thread *tp) { /** * @brief Suspends the invoking thread for the specified time. * - * @param time the delay in system ticks + * @param[in] time the delay in system ticks, the values @p TIME_IMMEDIATE and + * @p TIME_INFINITE are not allowed */ void chThdSleep(systime_t time) { + chDbgCheck((time != TIME_IMMEDIATE) && (time != TIME_INFINITE), + "chThdSleep"); + chSysLock(); chThdSleepS(time); chSysUnlock(); @@ -277,9 +283,9 @@ void chThdSleep(systime_t time) { /** * @brief Suspends the invoking thread until the system time arrives to the - * specified value. + * specified value. * - * @param time the absolute system time + * @param[in] time the absolute system time */ void chThdSleepUntil(systime_t time) { @@ -292,8 +298,8 @@ void chThdSleepUntil(systime_t time) { /** * @brief Terminates the current thread by specifying an exit status code. * - * @param msg the thread exit code. The code can be retrieved by using - * @p chThdWait(). + * @param[in] msg the thread exit code. The code can be retrieved by using + * @p chThdWait(). */ void chThdExit(msg_t msg) { Thread *tp = currp; @@ -311,18 +317,19 @@ void chThdExit(msg_t msg) { #if CH_USE_WAITEXIT /** * @brief Blocks the execution of the invoking thread until the specified - * thread terminates then the exit code is returned. + * thread terminates then the exit code is returned. * @details The memory used by the exited thread is handled in different ways - * depending on the API that spawned the thread: - * - If the thread was spawned by @p chThdCreateStatic() or by @p chThdInit() - * then nothing happens and the thread working area is not released or - * modified in any way. This is the default, totally static, behavior. - * - If the thread was spawned by @p chThdCreateFromHeap() then the working - * area is returned to the system heap. - * - If the thread was spawned by @p chThdCreateFromMemoryPool() then the - * working area is returned to the owning memory pool. - * - * @param tp the thread pointer + * depending on the API that spawned the thread: + * - If the thread was spawned by @p chThdCreateStatic() or by + * @p chThdInit() then nothing happens and the thread working area + * is not released or modified in any way. This is the default, + * totally static, behavior. + * - If the thread was spawned by @p chThdCreateFromHeap() then + * the working area is returned to the system heap. + * - If the thread was spawned by @p chThdCreateFromMemoryPool() + * then the working area is returned to the owning memory pool. + * . + * @param[in] tp the thread pointer * @return The exit code from the terminated thread * @note After invoking @p chThdWait() the thread pointer becomes invalid and * must not be used as parameter for further system calls. diff --git a/src/chvt.c b/src/chvt.c index f37ddd423..76ab6a7f3 100644 --- a/src/chvt.c +++ b/src/chvt.c @@ -43,13 +43,15 @@ void vt_init(void) { /**
* @brief Enables a virtual timer.
*
- * @param vtp the @p VirtualTimer structure pointer
- * @param time the number of time ticks, the values @p TIME_ZERO and
- * @p TIME_INFINITE are not allowed
- * @param vtfunc the timer callback function. After invoking the callback
- * the timer is disabled and the structure can be disposed or
- * reused.
- * @param par a parameter that will be passed to the callback function
+ * @param[out] vtp the @p VirtualTimer structure pointer
+ * @param[in] time the number of time ticks, the value @p TIME_INFINITE is not
+ * allowed. The value @p TIME_IMMEDIATE is allowed but
+ * interpreted as a normal time specification not as an
+ * immediate timeout specification.
+ * @param[in] vtfunc the timer callback function. After invoking the callback
+ * the timer is disabled and the structure can be disposed or
+ * reused.
+ * @param[in] par a parameter that will be passed to the callback function
* @note The associated function is invoked by an interrupt handler within
* the I-Locked state, see @ref system_states.
*/
@@ -57,7 +59,7 @@ void chVTSetI(VirtualTimer *vtp, systime_t time, vtfunc_t vtfunc, void *par) { VirtualTimer *p;
chDbgCheck((vtp != NULL) && (vtfunc != NULL) &&
- (time != TIME_ZERO) && (time != TIME_INFINITE), "chVTSetI");
+ (time != TIME_IMMEDIATE) && (time != TIME_INFINITE), "chVTSetI");
vtp->vt_par = par;
vtp->vt_func = vtfunc;
@@ -77,7 +79,7 @@ void chVTSetI(VirtualTimer *vtp, systime_t time, vtfunc_t vtfunc, void *par) { /**
* @brief Disables a Virtual Timer.
*
- * @param vtp the @p VirtualTimer structure pointer
+ * @param[in] vtp the @p VirtualTimer structure pointer
* @note The timer MUST be active when this function is invoked.
*/
void chVTResetI(VirtualTimer *vtp) {
@@ -96,8 +98,10 @@ void chVTResetI(VirtualTimer *vtp) { /**
* @brief Checks if the current system time is within the specified time window.
*
- * @param start the start of the time window (inclusive)
- * @param end the end of the time window (non inclusive)
+ * @param[in] start the start of the time window (inclusive)
+ * @param[in] end the end of the time window (non inclusive)
+ * @retval TRUE current time within the specified time window.
+ * @retval FALSE current time not within the specified time window.
*/
bool_t chSysInTimeWindow(systime_t start, systime_t end) {
diff --git a/src/include/scheduler.h b/src/include/scheduler.h index 565496dd3..648cb7bc5 100644 --- a/src/include/scheduler.h +++ b/src/include/scheduler.h @@ -44,16 +44,16 @@ /** * Zero time specification for some syscalls with a timeout * specification. - * @note Not all functions accept @p TIME_ZERO as timeout parameter, see the - * specific documentation. + * @note Not all functions accept @p TIME_IMMEDIATE as timeout parameter, + * see the specific function documentation. */ -#define TIME_ZERO ((systime_t)0) +#define TIME_IMMEDIATE ((systime_t)-1) /** * Infinite time specification for all the syscalls with a timeout * specification. */ -#define TIME_INFINITE ((systime_t)-1) +#define TIME_INFINITE ((systime_t)0) /** The priority of the first thread on the given ready list. */ #define firstprio(rlp) ((rlp)->p_next->p_prio) diff --git a/test/testsem.c b/test/testsem.c index 07fd40840..2482f1295 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -83,7 +83,7 @@ static void sem2_execute(void) { systime_t target_time;
msg_t msg;
- msg= chSemWaitTimeout(&sem1, TIME_ZERO);
+ msg= chSemWaitTimeout(&sem1, TIME_IMMEDIATE);
test_assert(msg == RDY_TIMEOUT, "#1");
target_time = chSysGetTime() + MS2ST(5 * 500);
|