]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/RTOS2/src/cmsis_os2.txt
RTOS2: updated API - limited osThreadFlagsClear/Get to current running thread and...
[cmsis] / CMSIS / DoxyGen / RTOS2 / src / cmsis_os2.txt
1 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2 /**
3 \mainpage
4
5 The CMSIS-RTOS manages the resources of the microcontroller system and implements the concept of parallel threads that run concurrently. 
6 There are many advantages of using an CMSIS-RTOS v2 compliant kernel as it provides a standardized interface.
7
8 Applications frequently require several concurrent activities. CMSIS-RTOS can manage multiple concurrent activities at the time when 
9 they are needed. Each activity gets a separate thread which executes a specific task and this simplifies the overall program structure.
10 The CMSIS-RTOS system is scalable and additional threads can be added easily at a later time. Threads have a priority allowing faster 
11 execution of time-critical parts of an user application.
12
13 The CMSIS-RTOS offers services needed in many real-time applications, for example, periodical activation of timer functions, 
14 memory management, and message exchange between threads with time limits.
15
16 The <b>CMSIS-RTOS API v2</b> addresses the following new requirements:
17  - Dynamic object creation no longer requires static memory, static memory buffers are now optional.
18  - Support for ARMv8-M architecture that provides a Secure and Non-Secure state of code execution.
19  - Provisions for message passing in multi-core systems.
20  - Full support of C++ run-time environments.
21  - C interface which is binary compatible across <a class="el" href="http://infocenter.arm.com/help/topic/com.arm.doc.subset.swdev.abi/index.html">ABI compatible compilers</a>.
22
23 As a consequence of these requirements the CMSIS-RTOS API v2 has the following fundamental modifications:
24  - The functions osXxxxNew replace osXxxxCreate functions; osXxxxNew and osXxxxDelete create and destroy objects.
25  - The C function main is not longer started as a thread (this was an optional feature in CMSIS-RTOS v1).
26  - Functions that return osEvent have been replaced.
27
28 CMSIS-RTOS API v2 provides an translation layer for the
29 <a class="el" href="../../RTOS/html/index.html">CMSIS-RTOS API v1</a>. 
30 It is possible to intermix CMSIS-RTOS API v2 and CMSIS-RTOS API v1 within the same application.
31 You may migrate overtime to the new API as explained in \ref os2Migration.
32
33 CMSIS-RTOS API v2 is not POSIX compliant, but has provisions to enable a POSIX translation layer and a C++ interface.
34 \todo Investigate into a flexible C++ interface and potential POSIX translation
35
36 <hr>
37
38 CMSIS-RTOS in ARM::CMSIS Pack
39 -----------------------------
40
41 The following files relevant to CMSIS-RTOS are present in the <b>ARM::CMSIS</b> Pack directories:
42 File/Folder                  | Content                                                                
43 -----------------------------|------------------------------------------------------------------------
44 \b CMSIS/Documentation/RTOS2 | This documentation                                                     
45 \b CMSIS/Documentation/RTOS  | CMSIS-RTOS API v1 documentation                                 
46 \b CMSIS/RTOS2/Include       | \ref cmsis_os2_h                                                 
47 */
48
49
50 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
51 /**
52 \page rtos_revisionHistory Revision History
53
54 <table class="cmtable" summary="Revision History">
55     <tr>
56       <th>Version</th>
57       <th>Description</th>
58     </tr>
59     <tr>
60       <td>V2.00 Alpha</td>
61       <td>
62         - Kernel:\n
63          -- added: osKernelGetInfo, osKernelGetState.\n
64          -- added: osKernelLock, osKernelUnlock.\n
65          -- added: osKernelSuspend, osKernelResume.\n
66          -- added: osKernelGetTime.\n
67          -- renamed osKernelSysTick to osKernelGetSysTick.\n
68         - Thread:\n
69          -- extended number of thread priorities.\n
70          -- changed thread return value.\n
71          -- replaced osThreadCreate with osThreadNew.\n
72          -- added: osThreadGetState.\n
73          -- added: osThreadSuspend, osThreadResume.\n
74          -- added: osThreadJoin, osThreadDetach, osThreadExit.\n
75         - Signals:\n
76          -- renamed osSignals to osThreadFlags.\n
77          -- changed return value of Set/Clear/Wait functions.\n
78          -- Clear function limited to current running thread.\n
79          -- extended Wait function (options).\n
80          -- added: osThreadFlagsGet.\n        
81         - Event Flags: added new independent object for handling Event Flags.\n
82         - Delay and Wait functions:\n
83          -- added: osDelayUntil.\n
84          -- deprecated: osWait.\n
85         - Timer:\n
86          -- replaced osTimerCreate with osTimerNew.\n
87          -- added: osTimerIsRunning.\n
88         - Mutex:\n
89          -- extended: attributes (Recursive, Priority Inherit, Robust).\n
90          -- replaced osMutexCreate with osMutexNew.\n
91          -- renamed osMutexWait to osMutexAcquire.\n
92          -- added: osMutexGetOwner.\n
93         - Semaphore:\n
94          -- extended: maximum and initial token count.\n
95          -- replaced osSemaphoreCreate with osSemaphoreNew.\n
96          -- renamed osSemaphoreWait to osSemaphoreAcquire (changed return value).\n
97          -- added: osSemaphoreGetCount.\n
98         - Memory Pool:\n
99          -- using osMemoryPool prefix instead of osPool.\n
100          -- replaced osPoolCreate with osMemoryPoolNew.\n
101          -- extended: osMemoryPoolAlloc (timeout).\n
102          -- added: osMemoryPoolGetCapacity, osMemoryPoolGetBlockSize.\n
103          -- added: osMemoryPoolGetCount, osMemoryPoolGetSpace.\n
104          -- added: osMemoryPoolDelete.\n
105          -- deprecated: osPoolCAlloc.\n
106         - Message Queue:\n
107          -- fixed size messages instead of a single 32-bit values.\n
108          -- using osMessageQueue prefix instead of osMessage.\n
109          -- replaced osMessageCreate with osMessageQueueNew.\n
110          -- updated: osMessageQueuePut, osMessageQueueGet.\n 
111          -- added: osMessageQueueGetCapacity, osMessageQueueGetMsgSize.\n
112          -- added: osMessageQueueGetCount, osMessageQueueGetSpace.\n
113          -- added: osMessageQueueReset, osMessageQueueDelete.\n
114         - Mail Queue: deprecated (superseded by extended Message Queue functionality).\n
115      </td>
116     </tr>
117     <tr>
118       <td>V1.02 - only documentation changes</td>
119       <td>
120       Added: Overview of the \ref rtosValidation "CMSIS-RTOS Validation" Software Pack.\n
121           Clarified: Behavior of \ref CMSIS_RTOS_TimeOutValue.
122      </td>
123     </tr>
124     <tr>
125       <td>V1.02</td>
126       <td>Added: New control functions for short timeouts in microsecond resolution \b osKernelSysTick,
127       \b osKernelSysTickFrequency, \b osKernelSysTickMicroSec.\n
128       Removed: osSignalGet.
129      </td>
130     </tr>
131     <tr>
132       <td>V1.01</td>
133       <td>Added capabilities for C++, kernel initialization and object deletion.\n
134       Prepared for C++ class interface. In this context to \em const attribute has been moved from osXxxxDef_t typedefs to
135       the osXxxxDef macros.\n
136       Added: \ref osTimerDelete, \ref osMutexDelete, \ref osSemaphoreDelete.\n
137       Added: \ref osKernelInitialize that prepares the Kernel for object creation.\n
138       </td>
139     </tr>
140     <tr>
141       <td>
142       V1.00</td>
143       <td>First official Release.\n
144       Added: \ref osKernelStart; starting 'main' as a thread is now an optional feature.\n
145       Semaphores have now the standard behavior.\n
146       \b osTimerCreate does no longer start the timer. Added: \ref osTimerStart (replaces osTimerRestart).\n
147       Changed: osThreadPass is renamed to \ref osThreadYield.
148       </td>
149     </tr>
150     <tr>
151       <td>V0.02</td>
152       <td>Preview Release.</td>
153     </tr>
154 </table>
155 */
156
157
158 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
159 /**
160 \page functionOverview Function Overview
161
162 CMSIS-RTOS v2 provides multiple API interfaces:
163   - \subpage rtos_api2 is the new C function API that supports dynamic object creation, ARMv8-M, and multi-processor communication.
164   - <a class="el" href="../../RTOS/html/functionOverview.html">CMSIS-RTOS C API v1</a> is a C function API the is backward compatible with CMSIS-RTOS v1.
165   - \subpage rtos_apicpp is a C++ class function API.
166
167 It is possible to intermix the different API variants in the same application and even in the same C/C++ source module.
168 However, the functions of the <b>C API Version 1</b> may be deprecated in future versions of CMSIS-RTOS.
169
170 \section CMSIS_RTOS_TimeOutValue Timeout Value   
171
172 Timeout values are an argument to several \b osXxx functions to allow time for resolving a request.
173 A timeout value of \b 0 means that the RTOS does not wait and returns instantly, even when no resource is available.   
174 A timeout value of \ref osWaitForever means that the RTOS waits infinite until a resource becomes available.
175  
176 The timeout value specifies the number of timer ticks until the time delay elapses. The value is an upper bound and 
177 depends on the actual time elapsed since the last timer tick. 
178
179 Examples:
180   - timeout value \b 0 : the system does not wait, even when no resource is available the RTOS function returns instantly. 
181   - timeout value \b 1 : the system waits until the next timer tick occurs; depending on the previous timer tick, it may be a very short wait time.
182   - timeout value \b 2 : actual wait time is between 1 and 2 timer ticks.
183   - timeout value \ref osWaitForever : system waits infinite until a resource becomes available. 
184   
185 \todo B: remove first '|' to make the picture clearer, make ... before first tick, add word 'time' after the arrow. 
186
187 \image html TimerValues.png "Timer Values"
188
189 \section CMSIS_RTOS_ISR_Calls Calls from Interrupt Service Routines 
190
191 The following CMSIS-RTOS2 functions can be called from threads and Interrupt Service Routines (ISR):
192   - \ref osThreadFlagsSet
193   - \ref osEventFlagsSet, \ref osEventFlagsClear, \ref osEventFlagsGet, \ref osEventFlagsWait
194   - \ref osSemaphoreAcquire, \ref osSemaphoreRelease, \ref osSemaphoreGetCount
195   - \ref osMemoryPoolAlloc, \ref osMemoryPoolFree, \ref osMemoryPoolGetCapacity, \ref osMemoryPoolGetBlockSize, \ref osMemoryPoolGetCount, \ref osMemoryPoolGetSpace
196   - \ref osMessageQueuePut, \ref osMessageQueueGet, \ref osMessageQueueGetCapacity, \ref osMessageQueueGetMsgSize, \ref osMessageQueueGetCount, \ref osMessageQueueGetSpace
197
198
199 Functions that cannot be called from an ISR are verifying the interrupt status and return, in case they are called
200 from an ISR context, the status code \b osErrorISR. In some implementations, this condition might be caught using the HARD
201 FAULT vector.
202
203 */
204
205
206
207 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
208 /**
209 \page rtos_api2 CMSIS-RTOS C API v2  
210
211 Overview of all CMSIS-RTOS C API v2 functions.
212
213  - \ref CMSIS_RTOS_KernelCtrl
214    - \ref osKernelGetInfo : \copybrief osKernelGetInfo
215    - \ref osKernelGetState : \copybrief osKernelGetState
216    - \ref osKernelGetTick : \copybrief osKernelGetTick
217    - \ref osKernelGetTime : \copybrief osKernelGetTime
218    - \ref osKernelInitialize : \copybrief osKernelInitialize
219    - \ref osKernelLock : \copybrief osKernelLock
220    - \ref osKernelResume : \copybrief osKernelResume
221    - \ref osKernelStart : \copybrief osKernelStart
222    - \ref osKernelSuspend : \copybrief osKernelSuspend
223    - \ref osKernelTickMicroSec : \copybrief osKernelTickMicroSec
224    - \ref osKernelUnlock : \copybrief osKernelUnlock
225
226  - \ref CMSIS_RTOS_ThreadMgmt
227    - \ref osThreadDetach : \copybrief osThreadDetach
228    - \ref osThreadExit : \copybrief osThreadExit
229    - \ref osThreadGetId : \copybrief osThreadGetId
230    - \ref osThreadGetPriority : \copybrief osThreadGetPriority
231    - \ref osThreadGetState : \copybrief osThreadGetState
232    - \ref osThreadJoin : \copybrief osThreadJoin
233    - \ref osThreadNew : \copybrief osThreadNew
234    - \ref osThreadResume : \copybrief osThreadResume
235    - \ref osThreadSetPriority : \copybrief osThreadSetPriority
236    - \ref osThreadSuspend : \copybrief osThreadSuspend
237    - \ref osThreadTerminate : \copybrief osThreadTerminate
238    - \ref osThreadYield : \copybrief osThreadYield
239
240  - \ref CMSIS_RTOS_Wait
241    - \ref osDelay : \copybrief osDelay
242    - \ref osDelayUntil : \copybrief osDelayUntil
243
244  - \ref CMSIS_RTOS_TimerMgmt
245    - \ref osTimerDelete : \copybrief osTimerDelete
246    - \ref osTimerIsRunning : \copybrief osTimerIsRunning
247    - \ref osTimerNew : \copybrief osTimerNew
248    - \ref osTimerStart : \copybrief osTimerStart
249    - \ref osTimerStop : \copybrief osTimerStop
250
251  - \ref CMSIS_RTOS_EventFlags
252    - \ref osEventFlagsNew : \copybrief osEventFlagsNew
253    - \ref osEventFlagsDelete : \copybrief osEventFlagsDelete
254    - \ref osEventFlagsSet : \copybrief osEventFlagsSet
255    - \ref osEventFlagsClear : \copybrief osEventFlagsClear
256    - \ref osEventFlagsGet : \copybrief osEventFlagsGet
257    - \ref osEventFlagsWait : \copybrief osEventFlagsWait
258
259  - \ref CMSIS_RTOS_ThreadFlagsMgmt
260    - \ref osThreadFlagsSet : \copybrief osThreadFlagsSet
261    - \ref osThreadFlagsClear : \copybrief osThreadFlagsClear
262    - \ref osThreadFlagsGet : \copybrief osThreadFlagsGet
263    - \ref osThreadFlagsWait : \copybrief osThreadFlagsWait
264
265  - \ref CMSIS_RTOS_Message
266    - \ref osMessageQueueDelete : \copybrief osMessageQueueDelete
267    - \ref osMessageQueueGet : \copybrief osMessageQueueGet
268    - \ref osMessageQueueGetCapacity : \copybrief osMessageQueueGetCapacity
269    - \ref osMessageQueueGetCount : \copybrief osMessageQueueGetCount
270    - \ref osMessageQueueGetMsgSize : \copybrief osMessageQueueGetMsgSize
271    - \ref osMessageQueueGetSpace : \copybrief osMessageQueueGetSpace
272    - \ref osMessageQueueNew : \copybrief osMessageQueueNew
273    - \ref osMessageQueuePut : \copybrief osMessageQueuePut
274    - \ref osMessageQueueReset : \copybrief osMessageQueueReset
275
276  - \ref CMSIS_RTOS_PoolMgmt
277    - \ref osMemoryPoolAlloc : \copybrief osMemoryPoolAlloc
278    - \ref osMemoryPoolDelete : \copybrief osMemoryPoolDelete
279    - \ref osMemoryPoolFree : \copybrief osMemoryPoolFree
280    - \ref osMemoryPoolGetBlockSize : \copybrief osMemoryPoolGetBlockSize
281    - \ref osMemoryPoolGetCapacity : \copybrief osMemoryPoolGetCapacity
282    - \ref osMemoryPoolGetCount : \copybrief osMemoryPoolGetCount
283    - \ref osMemoryPoolGetSpace : \copybrief osMemoryPoolGetSpace
284    - \ref osMemoryPoolNew : \copybrief osMemoryPoolNew
285
286  - \ref CMSIS_RTOS_MutexMgmt
287    - \ref osMutexAcquire : \copybrief osMutexAcquire
288    - \ref osMutexDelete : \copybrief osMutexDelete
289    - \ref osMutexGetOwner : \copybrief osMutexGetOwner
290    - \ref osMutexNew : \copybrief osMutexNew
291    - \ref osMutexRelease : \copybrief osMutexRelease
292
293  - \ref CMSIS_RTOS_SemaphoreMgmt
294    - \ref osSemaphoreAcquire : \copybrief osSemaphoreAcquire
295    - \ref osSemaphoreDelete : \copybrief osSemaphoreDelete
296    - \ref osSemaphoreGetCount : \copybrief osSemaphoreGetCount
297    - \ref osSemaphoreNew : \copybrief osSemaphoreNew
298    - \ref osSemaphoreRelease : \copybrief osSemaphoreRelease
299 */
300
301 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
302 /**
303 \page rtos_apicpp CMSIS-RTOS C++ API
304
305 Coming soon
306 */
307
308
309 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
310 /**
311 \page cmsis_os2_h Header File: cmsis_os2.h
312
313 The file \b cmsis_os2.h is a standard header file that interfaces to every CMSIS-RTOS API v2 compliant Real-Time Operating Systems (RTOS).
314 Each implementation is provided the same cmsis_os2.h which defines the interface to the \ref rtos_api2.
315
316 Using the \b cmsis_os2.h along with dynamic object allocation allows to create source code or libraries that require no modifications
317 when using on a different CMSIS-RTOS v2 implementation.
318
319 <b>Header file %cmsis_os2.h</b>
320
321 \include cmsis_os2.h
322 */
323
324 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
325 /**
326 \page rtx5_impl RTX v5 Implementation
327
328 The RTX version 5 implements the CMSIS-RTOS API v2 as native RTOS interface for Cortex-M processor-based devices.
329 A translation layer to CMSIS-RTOS API v1 is provided and with minimal effort RTX version 5 can be used in applications that 
330 where previously based on RTX version 4 and CMSIS-RTOS v1.
331
332 The following sections provide further details:
333  - \subpage theory_op : provides general information about the operation of RTX version 5.
334  - \subpage cre_rtx_proj
335  - \subpage config_rtx
336 */
337
338 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
339 /**
340 \page theory_op Theory of Operation
341
342 This section describes how RTX version 5 manages the resources of the target system. Many aspects of the kernel are configurable 
343 and the configuration options are mentioned where applicable.
344
345 \section KernelTimer RTX Kernel Timer Tick and Thread Management
346
347 By default, CMSIS-RTOS RTX5 uses the Cortex-M
348 <a href="http://www.keil.com/support/man/docs/gsac/GSAC_SYSTICKtimer.htm" target="_blank">SysTick</a> timer to generate
349 periodic interrupts for the RTX kernel timer tick. CMSIS-RTOS provides \ref CMSIS_RTOS_TimerMgmt functions and several
350 CMSIS-RTOS functions have a timeout parameter. This periodic RTX kernel timer tick interrupt is used to derive the required
351 time interval. CMSIS-RTOS RTX also provides configuration options for a alternative timer and tick-less operation. 
352
353 To handle timeout and time delays for threads, the CMSIS-RTOS RTX thread management is controlled by the RTX kernel timer
354 tick interrupt. The thread context contains all CPU registers (R0 - R12), the return address (LR), the program counter (PC), and the processor
355 status register (xPSR). For the Cortex-M4 FPU and Cortex-M7 FPU the floating point status and registers (S0 - S32, FPSCR) are
356 also part of the thread context.
357
358 When a thread switch occurs:
359  - the thread context of the current running thread is stored on the local stack of this thread.
360  - the stack pointer is switched to the next running thread.
361  - the thread context of this next running thread is restored and this thread starts to run.
362
363 \note 
364 - For Cortex-M0, Cortex-M3, Cortex-M4, and Cortex-M7 the thread context requires 64 bytes on the local stack.
365 - For Cortex-M4 FPU and Cortex-M7 FPU the thread context requires 200 bytes on the local stack. For devices with Cortex-M4 FPU and Cortex-M7 FPU the default stack space should be increased to a minimum of 300 bytes.
366
367 Each thread is provided with an separate stack that holds the thread context and stack space for automatic variables and return addresses for function call nesting. The stack sizes of the RTX threads are flexible configurable as explained in the section \ref threadConfig. RTX even offers a configurable checking for stack overflows and stack utilization. 
368
369 */
370
371 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
372 /**
373 \page cre_rtx_proj Create an RTX Project
374
375 Example projects using CMSIS-RTOS RTX are available for various development boards. To make use of these examples, you need
376 to install a Device Family Pack in µVision and use Pack Installer to open a CMSIS-RTOS2 Blinky project. If you wish to start a CMSIS-RTOS RTX5 from scratch, follow these steps:
377 - Create a new project and select a device.
378 - In the Manage Run-Time Environment window that opens, select <b>CMSIS\::CORE</b> and <b>CMSIS\::RTOS2 (API)\::Keil RTX5</b>.
379   If the <b>Validation Output</b> requires other components to be present, try to use the \b Resolve button:
380
381    \image html manage_rte_output.png
382
383 - Click \b OK. In the \b Project window, you will see the files that have been automatically added to you project, such as
384   \b %RTX_Config.c and the system and startup files:
385
386    \image html project_window.png
387    
388 - You can add template files to the project by right-clicking on <b>Source Group 1</b> and selecting
389   <b>Add New Item to 'Source Group 1'</b>. In the new window, click on <b>User Code Template</b>. On the right-hand side
390   you will see all available template files for CMSIS-RTOS RTX:
391   
392    \image html add_item.png
393
394 - Finally, \ref config_rtx "configure" RTX to the application's needs using the \b %RTX_Config.c file.
395 */
396
397 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
398 /**
399 \page config_rtx Configure RTX
400
401 The file "RTX_Config.c" is used to define the configuration parameters of CMSIS-RTOS RTX. This file must be part of every project that is using the CMSIS-RTOS RTX kernel.
402
403 The configuration file uses
404 <a class="el" href="http://www.keil.com/pack/doc/CMSIS/Pack/html/_config_wizard.html" target="_blank">Configuration Wizard Annotations</a>.
405 Depending on the development tool that is used, this might lead to a more user friendly graphical representation of the settings. The following is a screenshot of the same configuration file using µVision's Configuration Wizard view:
406
407 \image html config_wizard.png "RTX_Conf_CM.c in Configuration Wizard View"
408
409 The configuration options are explained on these pages:
410 - \subpage threadConfig
411
412 */
413
414
415 /* ========================================================================================================================== */
416 /**
417 \page threadConfig Thread Configuration
418
419 The CMSIS-RTOS RTX provides several parameters for the thread configuration.
420
421 \section stackConfig Configuration of Thread count and Stack Space
422
423 \ref osThreadAttr_t is passed to osThreadNew to set the options of a thread.
424
425 CMSIS-RTOS RTX defines two methods for defining the stack requirements:
426  - when \a *stack_mem in osThreadAttr_t is NULL, a fixed-size memory pool is used to for the thread stack.  In this case \b OS_STKSIZE specifies the stack size for the thread function.
427  - when \a *stack_mem specifies a memory location, the thread stack provided there. The size of this user space is specified with \b stack_size. 
428  
429 Stack memory for threads is configured either statically by Static Resources - Number of Threads (total). Static memory in the size of Number of Threads * Default Thread Stack size is reserved.
430 Alternatively the memory is allocated on demand from the Dynamic Resources pool (configured by System Configuration - Dynamic Resources - Memory size [bytes] for Stack).
431
432 The CMSIS-RTOS RTX kernel uses a separate stack for each thread it creates. However, before the kernel is started by the\ref osKernelInitialize() function, the main stack size that is configured in the file startup_<i>device</i>.s is used.
433
434 Main stack is also used when:
435 - the user application calls the majority of RTX functions from Thread mode (ending up in an SVC call)
436 - running from handlers (user interrupt of exception handlers like SVCm PendSV, Faults, etc.)
437
438 |Name                                                               |\#define         |Description|
439 |-------------------------------------------------------------------|-----------------|-----------|
440 |Number of concurrent running user threads                          |\c OS_THREAD_NUM    |Indicates the maximum number of threads that will run at the same time (including main).|
441 |Default Thread stack size [bytes]                                  |\c OS_STACK_SIZE    |Specifies the default stack size (in words) for threads that are defined with osThreadDef \a stacksz = 0.|
442 |Number of threads with user-provided stack size                    |\c OS_THREAD_USER_STACK_NUM    |Indicates the number of threads that are created with \ref osThreadNew \a stack_size specifies the stack size requirement of that thread.|
443 |stackCheck                                            |\c OS_STACK_CHECK   |If a stack overflow is detected at a thread switch, the function \b os_error with error code = 1 is called.  By default, this function is implemented as endless loop and will practically stop code execution.|
444 |stackUsage                                              |\c OS_STACK_WATERMARK    |Initializes the thread stack with a watermark pattern that can be used to determine the maximum stack usage within each thread.|
445 |processorMode                                |\c OS_PRIVILEGE_MODE    |Controls the processor mode (privileged/unprivileged)|
446 */
447
448 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
449 /**
450 \page rtosValidation RTOS Validation
451
452 \note
453 The test suite is available only for RTOS v1 API.
454
455 ARM offers a <a class=el href="http://www.keil.com/pack" target="_blank">Software Pack</a> for the CMSIS-RTOS Validation.
456 The <b>ARM::CMSIS-RTOS_Validation</b> Pack contains the following:
457
458  - Source code of a CMSIS-RTOS Validation Suite along with configuration file.
459  - Documentation of the CMSIS-RTOS Validation Suite.
460  - Example that shows the usage of the CMSIS-RTOS Validation Suite using simulation.
461
462 The CMSIS-RTOS Validation Suite is currently available in beta release and performs generic validation of various
463 RTOS features. The test cases verify the functional behavior, test invalid parameters and call management 
464 functions from ISR.
465
466 The following CMSIS-RTOS features can be tested with the current release:
467  - Thread : Create multiple threads, terminate, restart, yield, change priority 
468  - Timer : Create periodic and one-shot timers
469  - GenWait : Call generic wait functions (osDelay and osWait)
470  - WaitFunc : Measure wait ticks (delay, mail, message, mutex, semaphore, signal)
471  
472 Moreover the following inter-thread communication functions can be tested: 
473  - Signal : Verify signal events
474  - Memory Pool : Verify memory allocation
475  - Message Queue : Exchange messages between threads
476  - Mail Queue : Exchange data between threads
477  - Mutex : Synchronize resource access 
478  - Semaphore : Access shared resources 
479  
480 The RTOS Validation output can be printed to a console, output via ITM printf, or output to a memory buffer.
481  
482 \section test_output Sample Test Output
483 \verbatim
484 CMSIS-RTOS Test Suite   Oct 21 2015   16:39:16 
485
486 TEST 01: TC_ThreadCreate                  PASSED
487 TEST 02: TC_ThreadMultiInstance           PASSED
488 TEST 03: TC_ThreadTerminate               PASSED
489   :
490   :
491 TEST 08: TC_ThreadChainedCreate           PASSED
492 TEST 09: TC_ThreadYield                   NOT EXECUTED
493 TEST 10: TC_ThreadParam                   PASSED
494   :
495   :
496 TEST 60: TC_MailFromISRToThread           PASSED
497
498 Test Summary: 60 Tests, 59 Executed, 59 Passed, 0 Failed, 0 Warnings.
499 Test Result: PASSED
500 \endverbatim
501 */
502
503 /* ========================================================================================================================== */
504 // Group creation for Reference 
505 /** 
506 \addtogroup CMSIS_RTOS1 CMSIS-RTOS API v1
507 \brief This section describes the CMSIS-RTOS API v1. 
508 \details 
509 The CMSIS-RTOS is a generic API layer that interfaces to an existing RTOS kernel.
510
511 CMSIS-RTOS API v2 provides an translation layer for the
512 <a class="el" href="../../RTOS/html/index.html">CMSIS-RTOS API v1</a> that simplifies migration.
513
514 Refer to the <a class="el" href="../../RTOS/html/modules.html">Reference</a> guide of the CMSIS-RTOS API v1 for details.
515 */
516
517 // Group creation for Reference 
518 /** 
519 \addtogroup CMSIS_RTOS CMSIS-RTOS API v2
520 \brief This section describes the CMSIS-RTOS API v2. 
521 \details 
522 The CMSIS-RTOS is a generic API layer that interfaces to an existing RTOS kernel.
523
524 */
525