]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/RTOS2/src/cmsis_os2.txt
Merge branch 'develop' of https://github.com/ARM-software/CMSIS_5 into develop
[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-RTOS2 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-RTOS2 compliant kernel as it provides a standardized interface.
7
8 Applications frequently require several concurrent activities. CMSIS-RTOS2 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-RTOS2 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-RTOS2 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 C++11/C++14 interface.
34
35 The following sections provide further details about CMSIS-RTOS2 and the RTX reference implementation.
36  - \subpage rtos_revisionHistory documents changes made in each version for CMSIS-RTOS2 and RTX version 5.
37  - \subpage rtx5_impl provides general information about the operation of RTX version 5.
38  - \subpage config_rtx explains the configuration options of RTX version 5.
39  - \subpage cre_rtx_proj describes how to create projects using RTX version 5.
40  - \subpage os2Migration shows how to use CMSIS-RTOS2 in existing projects and lists function differences to CMSIS-RTOS v1.
41  - \subpage rtosValidation describes the validation suite that is public available.
42  - \subpage functionOverview lists the CMSIS-RTOS2 API functions and the header file cmsis_os2.h.
43
44 <hr>
45
46 CMSIS-RTOS2 in ARM::CMSIS Pack
47 -----------------------------
48
49 The following files relevant to CMSIS-RTOS2 are present in the <b>ARM::CMSIS</b> Pack directories:
50 File/Folder                  | Content                                                                
51 -----------------------------|------------------------------------------------------------------------
52 \b CMSIS/Documentation/RTOS2 | This documentation                                                     
53 \b CMSIS/RTOS2/Include       | \ref cmsis_os2_h                                                 
54 \b CMSIS/RTOS2/RTX           | CMSIS-RTOS v2 reference implementation based on RTX version 5
55 \b CMSIS/RTOS2/Template      | compatiblity layer to CMSIS-RTOS v1
56 */
57
58
59 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
60 /**
61 \page rtos_revisionHistory Revision History
62
63 <table class="cmtable" summary="Revision History">
64     <tr>
65       <th>Version</th>
66       <th>Description</th>
67     </tr>
68     <tr>
69       <td>V2.0.0</td>
70       <td>
71         - Kernel:\n
72          -- added: osKernelGetInfo, osKernelGetState.\n
73          -- added: osKernelLock, osKernelUnlock.\n
74          -- added: osKernelSuspend, osKernelResume.\n
75          -- added: osKernelGetTime.\n
76          -- renamed osKernelSysTick to osKernelGetSysTick.\n
77         - Thread:\n
78          -- extended number of thread priorities.\n
79          -- changed thread return value.\n
80          -- replaced osThreadCreate with osThreadNew.\n
81          -- added: osThreadGetState.\n
82          -- added: osThreadSuspend, osThreadResume.\n
83          -- added: osThreadJoin, osThreadDetach, osThreadExit.\n
84         - Signals:\n
85          -- renamed osSignals to osThreadFlags.\n
86          -- changed return value of Set/Clear/Wait functions.\n
87          -- Clear function limited to current running thread.\n
88          -- extended Wait function (options).\n
89          -- added: osThreadFlagsGet.\n        
90         - Event Flags: added new independent object for handling Event Flags.\n
91         - Delay and Wait functions:\n
92          -- added: osDelayUntil.\n
93          -- deprecated: osWait.\n
94         - Timer:\n
95          -- replaced osTimerCreate with osTimerNew.\n
96          -- added: osTimerIsRunning.\n
97         - Mutex:\n
98          -- extended: attributes (Recursive, Priority Inherit, Robust).\n
99          -- replaced osMutexCreate with osMutexNew.\n
100          -- renamed osMutexWait to osMutexAcquire.\n
101          -- added: osMutexGetOwner.\n
102         - Semaphore:\n
103          -- extended: maximum and initial token count.\n
104          -- replaced osSemaphoreCreate with osSemaphoreNew.\n
105          -- renamed osSemaphoreWait to osSemaphoreAcquire (changed return value).\n
106          -- added: osSemaphoreGetCount.\n
107         - Memory Pool:\n
108          -- using osMemoryPool prefix instead of osPool.\n
109          -- replaced osPoolCreate with osMemoryPoolNew.\n
110          -- extended: osMemoryPoolAlloc (timeout).\n
111          -- added: osMemoryPoolGetCapacity, osMemoryPoolGetBlockSize.\n
112          -- added: osMemoryPoolGetCount, osMemoryPoolGetSpace.\n
113          -- added: osMemoryPoolDelete.\n
114          -- deprecated: osPoolCAlloc.\n
115         - Message Queue:\n
116          -- fixed size messages instead of a single 32-bit values.\n
117          -- using osMessageQueue prefix instead of osMessage.\n
118          -- replaced osMessageCreate with osMessageQueueNew.\n
119          -- updated: osMessageQueuePut, osMessageQueueGet.\n 
120          -- added: osMessageQueueGetCapacity, osMessageQueueGetMsgSize.\n
121          -- added: osMessageQueueGetCount, osMessageQueueGetSpace.\n
122          -- added: osMessageQueueReset, osMessageQueueDelete.\n
123         - Mail Queue: deprecated (superseded by extended Message Queue functionality).\n
124      </td>
125     </tr>
126     <tr>
127       <td>V1.02 - only documentation changes</td>
128       <td>
129       Added: Overview of the \ref rtosValidation "CMSIS-RTOS Validation" Software Pack.\n
130           Clarified: Behavior of \ref CMSIS_RTOS_TimeOutValue.
131      </td>
132     </tr>
133     <tr>
134       <td>V1.02</td>
135       <td>Added: New control functions for short timeouts in microsecond resolution \b osKernelSysTick,
136       \b osKernelSysTickFrequency, \b osKernelSysTickMicroSec.\n
137       Removed: osSignalGet.
138      </td>
139     </tr>
140     <tr>
141       <td>V1.01</td>
142       <td>Added capabilities for C++, kernel initialization and object deletion.\n
143       Prepared for C++ class interface. In this context to \em const attribute has been moved from osXxxxDef_t typedefs to
144       the osXxxxDef macros.\n
145       Added: \ref osTimerDelete, \ref osMutexDelete, \ref osSemaphoreDelete.\n
146       Added: \ref osKernelInitialize that prepares the Kernel for object creation.\n
147       </td>
148     </tr>
149     <tr>
150       <td>
151       V1.00</td>
152       <td>First official Release.\n
153       Added: \ref osKernelStart; starting 'main' as a thread is now an optional feature.\n
154       Semaphores have now the standard behavior.\n
155       \b osTimerCreate does no longer start the timer. Added: \ref osTimerStart (replaces osTimerRestart).\n
156       Changed: osThreadPass is renamed to \ref osThreadYield.
157       </td>
158     </tr>
159     <tr>
160       <td>V0.02</td>
161       <td>Preview Release.</td>
162     </tr>
163 </table>
164 */
165
166
167 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
168 /**
169 \page rtx5_impl RTX v5 Implementation
170
171 The RTX version 5 implements the CMSIS-RTOS API v2 as native RTOS interface for Cortex-M processor-based devices.
172 A translation layer to CMSIS-RTOS API v1 is provided and with minimal effort RTX version 5 can be used in applications that 
173 where previously based on RTX version 4 and CMSIS-RTOS v1.
174
175 <b>Theory of Operation</b>
176
177 This section describes the internal operations of RTX version 5:
178  - \subpage SystemStartup describes the C/C++ library initialization process.
179  - \subpage MemoryAllocation describes the resource management in the target system.
180  - \subpage ThreadStack explains how RTX manages the stack memory for threads.
181  - \subpage lowPower explains how to utilize power saving modes of Cortex-M devices.
182  - \subpage KernelTimer explains the options for time delays and timeouts.
183  - \subpage CMSIS_RTOS_TimeOutValue explains behaviour of timeouts including \token{0}=no wait and \ref osWaitForever.
184  - \subpage TickLess enables ultra-low power operation with custom timer.
185  - \subpage CMSIS_RTOS_ISR_Calls lists the functions calls that are supported from interrupt context.
186
187 Many aspects of the kernel are configurable and the configuration options are mentioned where applicable.
188
189 \page SystemStartup System Startup
190
191 Since main is no longer a thread RTX5 does not interfere with the system startup until main is reached.
192 Once the execution reaches main() there is a recommended order to initialize the hardware and start the kernel. This is also reflected in the "CMSIS-RTOS2 main Template" supplied with the RTX5 component.
193
194 The main() of you application should implement at least the following in the given order:
195 -# Initialization and configuration of hardware including peripheral, memory, pin, clock and interrupt system.
196 -# Update \ref SystemCoreClock using the respective <a href=../../Core/html/group__system__init__gr.html>CMSIS-CORE function</a>.
197 -# Initialize CMSIS-RTOS kernel using \ref osKernelInitialize.
198 -# Optionally create a new thread app_main, which is used as a main thread using \ref osThreadCreate. Alternatively threads can be created in main directly.
199 -# Start RTOS scheduler using \ref osKernelStart. Any application code after osKernelStart will not be executed unless \ref osKernelStart fails.            
200
201 \note Interrupts like SVC used by the Kernel are initialized in \ref osKernelInitialize. In case priorities and groupings in the NVIC are altered by the application after the above sequence it might be necessary to call \ref osKernelInitialize again.
202
203 \page MemoryAllocation Memory Allocation 
204
205 The RTX objects (thread, mutex, semaphore, timer, message, event and memory pool) require dedicated RAM memory.
206 Objects can be created using os<i>object</i>New() calls and deleted using os<i>object</i>Delete() calls. The related
207 object memory needs to be available during the life-time of the object.
208
209 RTX5 offers three different memory allocation methods for objects:
210
211   - \ref GlobalMemoryPool uses a single global memory pool for all objects. It is easy to configure, but may have 
212     the disadvantage for memory fragmentation when objects with different sizes are created and destroyed.
213
214   - \ref ObjectMemoryPool uses a fixed-size memory pool for each object type. The method is time deterministic
215      and avoids memory fragmentation.
216
217   - \ref StaticObjectMemory reserves memory during compile time and completely avoids that a system can be out of memory.
218     This is typically a required for some safety critical systems.
219         
220 It possible to intermix all the memory allocation methods in the same application.
221
222 \section GlobalMemoryPool Global Memory Pool
223
224 The global memory pool allocates all objects from a one memory area.
225 This method of memory allocation is the default configuration setting of RTX5.
226
227 \image html MemAllocGlob.png "Global Memory Pool for all objects"
228
229 When pool does not provide sufficient memory the creation of the object fails and the related os<i>object</i>New() function returns \token{NULL}.
230
231 \todo refer to object counters once available
232
233 Enabled in \ref systemConfig.
234
235 \section ObjectMemoryPool Object-specific Memory Pools
236
237 Object-specific Memory Pools avoids memory fragmentation with a dedicated fixed-size memory management for each object type.
238 This type of memory pools are fully time deterministic, which means object creation and destruction takes always the same fixed amount of time.
239 As a fixed-size memory pool is specific to an object type the handling of out-of-memory situations is simplified.
240
241 \image html MemAllocSpec.png "One memory pool per object type"
242
243 Object-specific memory pools are selectively enabled for each object type, e.g: mutex or thread using the RTX configuration file:
244  - Enabled in \ref threadConfig for thread objects.
245  - Enabled in \ref timerConfig for timer objects.
246  - Enabled in \ref eventFlagsConfig for event objects.
247  - Enabled in \ref mutexConfig for mutex objects.
248  - Enabled in \ref semaphoreConfig for semaphore.
249  - Enabled in \ref memPoolConfig for memory pools.
250  - Enabled in \ref msgQueueConfig for message objects.
251
252 When memory pool does not provide sufficient memory the creation of the object fails and the related os<i>object</i>New() function returns \token{NULL}.
253
254 \todo explain how to Map pools to different memory spaces (e.g. for systems with different speed grades of RAM memory)
255
256 \section StaticObjectMemory Static Object Memory
257 In contrast to the dynamic memory allocations the static memory allocation requires compile-time allocation of object memory. 
258
259 \image html MemAllocStat.png "Statically allocated memory for all objects"
260
261 The following code example shows how to create an OS object using static memory.
262
263 <b> Code Example: </b> 
264 \code{.c}
265 /*----------------------------------------------------------------------------
266  * CMSIS-RTOS 'main' function template
267  *---------------------------------------------------------------------------*/
268
269 #include "RTE_Components.h"
270 #include  CMSIS_device_header
271 #include "cmsis_os2.h"
272  
273 //include rtx_os.h for types of RTX objects
274 #include "rtx_os.h"
275  
276 //The thread function instanced in this example
277 void worker(void *arg)
278 {
279   while(1) 
280   {
281     //work
282         osDelay(10000);
283   }  
284 }
285  
286 // Define objects that are statically allocated for worker threads 1 and 2
287 os_thread_t worker_thread_tcb_1;
288  
289 // Reserve two areas for the stacks of worker threads 1 and 2
290 // uint64_t makes sure the memory alignment is 8
291 uint64_t worker_thread_stk_1[64];
292  
293 // Define the attributes which are used for thread creation
294 // Optional const saves RAM memory and includes the values in periodic ROM tests 
295 const osThreadAttr_t worker_attr_1 = { 
296         "wrk1", 
297         osThreadJoinable, 
298         &worker_thread_tcb_1, 
299         sizeof(worker_thread_tcb_1),
300         &worker_thread_stk_1[0],  
301         sizeof(worker_thread_stk_1),
302         osPriorityAboveNormal,
303         0
304 };
305  
306
307 // Define ID object for thread
308 osThreadId_t th1;
309  
310 /*----------------------------------------------------------------------------
311  * Application main thread
312  *---------------------------------------------------------------------------*/
313 void app_main (void *argument) {
314   uint32_t param = NULL;
315  
316   // Create an instance of the worker thread with static resources (TCB and stack)
317   th1 = osThreadNew(worker, &param, &worker_attr_1);
318  
319   for (;;) {}
320 }
321  
322 int main (void) {
323   // System Initialization
324   SystemCoreClockUpdate();
325   // ...
326
327   osKernelInitialize();                 // Initialize CMSIS-RTOS
328   osThreadNew(app_main, NULL, NULL);    // Create application main thread
329   osKernelStart();                      // Start thread execution
330   for (;;) {}
331 }
332 \endcode
333
334 */
335
336 /* ========================================================================================================================== */
337 /**
338 \page ThreadStack Thread Stack Management
339
340
341
342 For Cortex-M processors without floating point unit the thread context requires 64 bytes on the local stack.
343 \note
344 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.
345
346 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. 
347
348
349 */
350
351 /* ========================================================================================================================== */
352 /**
353 \page lowPower Low-Power Operation
354
355 The system thread \b os_IdleThread can be use to switch the system into a low-power mode.  The easiest form to enter a
356 low-power mode is the execution of the \c __WFE function that puts the processor into a sleep mode where it waits for an
357 event.
358
359 <b>Configuration Example:</b>
360
361 \code
362 #include "RTE_Components.h"
363 #include CMSIS_device_header            /* Device definitions                 */
364  
365 void os_IdleThread (void) {
366   /* The idle demon is a system thread, running when no other thread is       */
367   /* ready to run.                                                            */
368  
369   for (;;) {
370     __WFE();                            /* Enter sleep mode                   */
371   }
372 }
373 \endcode
374
375 \note
376 \c __WFE() is not available at every Cortex-M implementation. Check device manuals for availability.
377
378 */
379
380 /* ========================================================================================================================== */
381 /**
382 \page KernelTimer RTX Kernel Timer Tick
383
384 By default, CMSIS-RTOS RTX5 uses the Cortex-M
385 <a href="http://www.keil.com/support/man/docs/gsac/GSAC_SYSTICKtimer.htm" target="_blank">SysTick</a> timer to generate
386 periodic interrupts for the RTX kernel timer tick. CMSIS-RTOS provides \ref CMSIS_RTOS_TimerMgmt functions and several
387 CMSIS-RTOS functions have a timeout parameter. This periodic RTX kernel timer tick interrupt is used to derive the required
388 time interval. CMSIS-RTOS RTX also provides configuration options for a alternative timer and tick-less operation. 
389
390 To handle timeout and time delays for threads, the CMSIS-RTOS RTX thread management is controlled by the RTX kernel timer
391 tick interrupt. The thread context contains all CPU registers (R0 - R12), the return address (LR), the program counter (PC), and the processor
392 status register (xPSR). For the Cortex-M4 FPU and Cortex-M7 FPU the floating point status and registers (S0 - S32, FPSCR) are
393 also part of the thread context.
394
395 When a thread switch occurs:
396  - the thread context of the current running thread is stored on the local stack of this thread.
397  - the stack pointer is switched to the next running thread.
398  - the thread context of this next running thread is restored and this thread starts to run.
399
400
401 \page CMSIS_RTOS_TimeOutValue Timeout Value   
402
403 Timeout values are an argument to several \b osXxx functions to allow time for resolving a request.
404 A timeout value of \b 0 means that the RTOS does not wait and returns instantly, even when no resource is available.   
405 A timeout value of \ref osWaitForever means that the RTOS waits infinite until a resource becomes available.
406  
407 The timeout value specifies the number of timer ticks until the time delay elapses. The value is an upper bound and 
408 depends on the actual time elapsed since the last timer tick. 
409
410 Examples:
411   - timeout value \b 0 : the system does not wait, even when no resource is available the RTOS function returns instantly. 
412   - 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.
413   - timeout value \b 2 : actual wait time is between 1 and 2 timer ticks.
414   - timeout value \ref osWaitForever : system waits infinite until a resource becomes available. 
415   
416 \todo B: remove first '|' to make the picture clearer, make ... before first tick, add word 'time' after the arrow. 
417
418 \image html TimerValues.png "Example of timeout using osDelay()"
419
420 \page CMSIS_RTOS_ISR_Calls Calls from Interrupt Service Routines 
421
422 The following CMSIS-RTOS2 functions can be called from threads and Interrupt Service Routines (ISR):
423   - \ref osThreadFlagsSet
424   - \ref osEventFlagsSet, \ref osEventFlagsClear, \ref osEventFlagsGet, \ref osEventFlagsWait
425   - \ref osSemaphoreAcquire, \ref osSemaphoreRelease, \ref osSemaphoreGetCount
426   - \ref osMemoryPoolAlloc, \ref osMemoryPoolFree, \ref osMemoryPoolGetCapacity, \ref osMemoryPoolGetBlockSize, \ref osMemoryPoolGetCount, \ref osMemoryPoolGetSpace
427   - \ref osMessageQueuePut, \ref osMessageQueueGet, \ref osMessageQueueGetCapacity, \ref osMessageQueueGetMsgSize, \ref osMessageQueueGetCount, \ref osMessageQueueGetSpace
428
429 Functions that cannot be called from an ISR are verifying the interrupt status and return, in case they are called
430 from an ISR context, the status code \b osErrorISR. In some implementations, this condition might be caught using the HARD
431 FAULT vector.
432
433 */
434
435 /* ========================================================================================================================== */
436 /**
437 \page TickLess Tick-less Low-Power Operation
438
439 RTX5 provides extension for tick-less operation which is useful for applications that use extensively low-power
440 modes where the SysTick timer is also disabled. To provide a time-tick in such power-saving modes a wake-up timer is used to
441 derive timer intervals. The CMSIS-RTOS2 functions \ref osKernelSuspend and \ref osKernelResume control the tick-less operation.
442
443 Using this functions allows the RTX5 thread scheduler to stop the periodic kernel tick interrupt. When all active threads
444 are suspended, the system enters power-down and calculates how long it can stay in this power-down mode. In the power-down
445 mode the processor and potentially peripherals can be switched off. Only a wake-up timer must remain powered, because this
446 timer is responsible to wake-up the system after the power-down period expires.
447
448 The tick-less operation is controlled from the \b os_IdleThread thread. The wake-up timeout value is set before the system
449 enters the power-down mode. The function \ref osKernelSuspend calculates the wake-up timeout measured in RTX Timer Ticks; this
450 value is used to setup the wake-up timer that runs during the power-down mode of the system.
451
452 Once the system resumes operation (either by a wake-up time out or other interrupts) the RTX5 thread scheduler is started with
453 the function \ref osKernelResume. The parameter \a sleep_time specifies the time (in RTX Timer Ticks) that the system was in
454 power-down mode.
455
456 <b>Code Example:</b>
457 \code
458 #include "msp.h"                        // Device header
459
460 /*----------------------------------------------------------------------------
461  *      MSP432 Low-Power Extension Functions
462  *---------------------------------------------------------------------------*/
463 static void MSP432_LP_Entry(void) {
464   /* Enable PCM rude mode, which allows to device to enter LPM3 without waiting for peripherals */
465   PCM->CTL1 = PCM_CTL1_KEY_VAL | PCM_CTL1_FORCE_LPM_ENTRY;       
466   /* Enable all SRAM bank retentions prior to going to LPM3  */
467   SYSCTL->SRAM_BANKRET |= SYSCTL_SRAM_BANKRET_BNK7_RET;
468   __enable_interrupt();         
469   NVIC_EnableIRQ(RTC_C_IRQn);
470   /* Do not wake up on exit from ISR */ 
471   SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk;    
472   /* Setting the sleep deep bit */
473   SCB->SCR |= (SCB_SCR_SLEEPDEEP_Msk);  
474 }
475  
476 static volatile unsigned int tc;
477 static volatile unsigned int tc_wakeup;
478  
479 void RTC_C_IRQHandler(void)
480 {
481   if (tc++ > tc_wakeup) 
482   {
483     SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk;    
484     NVIC_DisableIRQ(RTC_C_IRQn);
485     NVIC_ClearPendingIRQ(RTC_C_IRQn);
486     return;
487   }
488   if (RTC_C->PS0CTL & RTC_C_PS0CTL_RT0PSIFG)
489   {
490     RTC_C->CTL0 = RTC_C_KEY_VAL;                 // Unlock RTC key protected registers
491     RTC_C->PS0CTL &= ~RTC_C_PS0CTL_RT0PSIFG;
492     RTC_C->CTL0 = 0;
493     SCB->SCR |= (SCB_SCR_SLEEPDEEP_Msk);
494   }
495 }
496  
497 uint32_t g_enable_sleep = 0;
498   
499 void os_IdleThread (void) {
500  
501   for (;;) {      
502         tc_wakeup = osKernelSuspend();
503         /* Is there some time to sleep? */
504     if (tc_wakeup > 0) {
505       tc = 0;
506           /* Enter the low power state */
507       MSP432_LP_Entry();
508           __WFI();
509         } 
510     /* Adjust the kernel ticks with the amount of ticks slept */        
511         osKernelResume (tc);            
512   }
513 }
514 \endcode
515
516 \note
517 \c __WFI() is not available at every Cortex-M implementation. Check device manuals for availability.
518 */
519
520
521 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
522 /**
523 \page cre_rtx_proj Create an RTX Project
524
525 Example projects using CMSIS-RTOS RTX are available for various development boards. To make use of these examples, you need
526 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:
527 - Create a new project and select a device.
528 - In the Manage Run-Time Environment window that opens, select <b>CMSIS\::CORE</b> and <b>CMSIS\::RTOS2 (API)\::Keil RTX5</b>.
529   If the <b>Validation Output</b> requires other components to be present, try to use the \b Resolve button:
530
531    \image html manage_rte_output.png
532
533 - Click \b OK. In the \b Project window, you will see the files that have been automatically added to you project, such as
534   \b %RTX_Config.c and the system and startup files:
535
536    \image html project_window.png
537    
538 - You can add template files to the project by right-clicking on <b>Source Group 1</b> and selecting
539   <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
540   you will see all available template files for CMSIS-RTOS RTX:
541   
542    \image html add_item.png
543
544 - Finally, \ref config_rtx "configure" RTX to the application's needs using the \b %RTX_Config.c file.
545 */
546
547 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
548 /**
549 \page config_rtx Configure RTX v5
550
551 The file "RTX_Config.c" defines the configuration parameters of CMSIS-RTOS RTX and must be part of every project that is using the CMSIS-RTOS RTX kernel.
552
553 The configuration file uses
554 <a class="el" href="http://www.keil.com/pack/doc/CMSIS/Pack/html/_config_wizard.html" target="_blank">Configuration Wizard Annotations</a>.
555 Depending on the development tool, the annotations might lead to a more user-friendly graphical representation of the settings. 
556 The screenshot below shows the configuration file represented by the µVision Configuration Wizard:
557
558 \image html config_wizard.png "RTX_Conf_CM.c in Configuration Wizard View"
559
560 The configuration options are explained on these pages:
561 - \subpage systemConfig
562 - \subpage threadConfig
563 - \subpage timerConfig
564 - \subpage eventFlagsConfig
565 - \subpage mutexConfig
566 - \subpage semaphoreConfig
567 - \subpage memPoolConfig
568 - \subpage msgQueueConfig
569 */
570
571
572 /* ========================================================================================================================== */
573 /**
574 \page systemConfig System Configuration
575
576 \image html config_wizard_system.png "RTX_Conf_CM.c: System Configuration"
577
578
579 Name                                   | \#define                 | Description
580 ---------------------------------------|--------------------------|----------------------------------------------------------------
581 Global Dynamic Memory size [bytes]     | \c OS_DYNAMIC_MEM_SIZE   | Defines the combined global dynamic memory size for the \ref GlobalMemoryPool. Default value is \token{4096}. Value range is \token{[0-1073741824]} bytes, in multiples of \token{8} bytes.
582 Round-Robin Thread switching           | \c OS_ROBIN_ENABLE       | Enables Round-Robin Thread switching.
583 Round-Robin Timeout [ms]               | \c OS_ROBIN_TIMEOUT      | Defines how long a thread will execute before a thread switch. Default value is \token{5}. Value range is \token{[1-1000]}.
584 ISR FIFO Queue                         | \c OS_ISR_FIFO_QUEUE     | RTOS Functions called from ISR store requests to this buffer. Default value is \token{16 entries}. Value range is \token{[4-256]} entries in multiples of \token{4}.
585 */
586
587 /* ========================================================================================================================== */
588 /**
589 \page threadConfig Thread Configuration
590
591 The CMSIS-RTOS RTX provides several parameters to configure threads.
592
593 \section stackConfig Configuration of Thread Count and Stack Space
594
595 \ref osThreadAttr_t is passed to osThreadNew to set the options of a thread.
596
597 CMSIS-RTOS RTX defines two methods for defining the stack requirements:
598  - when \a *stack_mem in osThreadAttr_t is NULL, a fixed-size memory pool is used for the thread stack.  In this case, \b OS_STKSIZE specifies the stack size for the thread function.
599  - 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. 
600  
601 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.
602 Alternatively the memory is allocated on demand from the Dynamic Resources pool (configured by System Configuration - Dynamic Resources - Memory size [bytes] for Stack).
603
604 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.
605
606 \image html config_wizard_threads.png "RTX_Conf_CM.c: Thread Configuration"
607
608 Main stack is also used when:
609 - the user application calls the majority of RTX functions from Thread mode (ending up in an SVC call)
610 - running from handlers (user interrupt of exception handlers like SVCm PendSV, Faults, etc.)
611
612 Name                                                     | \#define               | Description
613 ---------------------------------------------------------|------------------------|----------------------------------------------------------------
614 Object specific Memory allocation                        | \c OS_THREAD_OBJ_MEM   | Enables object specific memory allocation. See /ref ObjectMemoryPool.
615 Number of user Threads (total)               | \c OS_THREAD_NUM       | Defines maximum number of user threads that can be active at the same time. Applies to user threads with system provided memory for control blocks. Default value is \token{6}. Value range is \token{[1-1000]}.
616 Number of user Threads with user-provided Stack size | \c OS_THREAD_USER_STACK_NUM     | Defines maximum number of user threads with user-provided stack size. Default value is \token{0}. Value range is \token{[0-1000]}.
617 Total Stack size [bytes] for user Threads with user-provided Stack size    | \c OS_THREAD_USER_STACK_SIZE | Defines the combined stack size for user threads with user-provided stack size. Default value is \token{0}. Value range is \token{[0-1073741824]} bits, sepping \token{8} bits. 
618 Default Thread Stack size [bytes]                        | \c OS_STACK_SIZE    | Defines stack size for threads with zero stack size specified. Default value is \token{200}. Value range is \token{[96-1073741824]} bits, sepping \token{8} bits. 
619 Idle Thread Stack size [bytes]                           | \c OS_IDLE_THREAD_STACK_SIZE              | Defines stack size for Idle thread. Default value is \token{200}. Value range is \token{[72-1073741824]} bits, sepping \token{8} bits. 
620 Stack overrun checking                                   | \c OS_STACK_CHECK   | Enable stack overrun checks at thread switch. Enabling this option increases slightly the execution time of a thread switch. 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.
621 Stack usage watermark                                    | \c OS_STACK_WATERMARK    | Initialize thread stack with watermark pattern for analyzing stack usage. Enabling this option increases significantly the execution time of thread creation.
622 Processor mode for Thread execution                      | \c OS_PRIVILEGE_MODE     | Controls the processor mode. Default value is \token{Privileged} mode. Value range is \token{[0=Unprivileged; 1=Privileged]} mode.
623 */
624
625
626 /* ========================================================================================================================== */
627 /**
628 \page timerConfig Timer Configuration
629
630 \image html config_wizard_timer.png "RTX_Conf_CM.c: Timer Configuration"
631
632
633 Name                                   | \#define                 | Description
634 ---------------------------------------|--------------------------|----------------------------------------------------------------
635 Object specific Memory allocation      | \c OS_TIMER_OBJ_MEM      | Enables object specific memory allocation. See /ref ObjectMemoryPool.
636 Number of Timer objects                | \c OS_TIMER_NUM          | Defines maximum number of objects that can be active at the same time. Applies to objects with system provided memory for control blocks. Value range is \token{[1-1000]}.
637 Timer Thread Priority                  | \c OS_TIMER_THREAD_PRIO        | Defines priority for timer thread. Default value is \token{40}. Value range is \token{[8-48]}, stepping \token{8}. The numbers have the following priority correlation: \token{8=Low}; \token{16=Below Normal}; \token{24=Normal}; \token{32=Above Normal}; \token{40=High}; \token{48=Realtime} 
638 Timer Thread Stack size [bytes]        | \c OS_TIMER_THREAD_STACK_SIZE  | Defines stack size for Timer thread. May be set to 0 when timers are not used. Default value is \token{200}. Value range is \token{[0-1073741824]}, stepping \token{8}.
639 Timer Callback Queue entries           | \c OS_TIMER_CB_QUEUE           | Number of concurrent active timer callback functions. May be set to 0 when timers are not used. Default value is \token{4}. Value range is \token{[0-256]}.
640 */
641
642 /* ========================================================================================================================== */
643 /**
644 \page eventFlagsConfig Event Flags Configuration
645
646 \image html config_wizard_eventFlags.png "RTX_Conf_CM.c: Event Flags Configuration"
647
648
649 Name                                   | \#define                 | Description
650 ---------------------------------------|--------------------------|----------------------------------------------------------------
651 Object specific Memory allocation      | \c OS_EVFLAGS_OBJ_MEM    | Enables object specific memory allocation. See /ref ObjectMemoryPool.
652 Number of Event Flags objects          | \c OS_EVFLAGS_NUM        | Defines maximum number of objects that can be active at the same time. Applies to objects with system provided memory for control blocks. Value range is \token{[0-1000]}.
653 */
654
655
656 /* ========================================================================================================================== */
657 /**
658 \page mutexConfig Mutex Configuration
659
660 \image html config_wizard_mutex.png "RTX_Conf_CM.c: Mutex Configuration"
661
662
663 Name                                   | \#define                 | Description
664 ---------------------------------------|--------------------------|----------------------------------------------------------------
665 Object specific Memory allocation      | \c OS_MUTEX_OBJ_MEM      | Enables object specific memory allocation. See /ref ObjectMemoryPool.
666 Number of Mutex objects                | \c OS_MUTEX_NUM          | Defines maximum number of objects that can be active at the same time. Applies to objects with system provided memory for control blocks. Value range is \token{[0-1000]}.
667 */
668
669
670 /* ========================================================================================================================== */
671 /**
672 \page semaphoreConfig Semaphore Configuration
673
674 \image html config_wizard_semaphore.png "RTX_Conf_CM.c: Semaphore Configuration"
675
676
677 Name                                   | \#define                 | Description
678 ---------------------------------------|--------------------------|----------------------------------------------------------------
679 Object specific Memory allocation      | \c OS_SEMAPHORE_OBJ_MEM  | Enables object specific memory allocation. See /ref ObjectMemoryPool.
680 Number of Semaphore objects            | \c OS_SEMAPHORE_NUM      | Defines maximum number of objects that can be active at the same time. Applies to objects with system provided memory for control blocks. Value range is \token{[0-1000]}.
681 */
682
683
684 /* ========================================================================================================================== */
685 /**
686 \page memPoolConfig Memory Pool Configuration
687
688 \image html config_wizard_memPool.png "RTX_Conf_CM.c: Memory Pool Configuration"
689
690
691 Name                                   | \#define                 | Description
692 ---------------------------------------|--------------------------|----------------------------------------------------------------
693 Object specific Memory allocation      | \c OS_MEMPOOL_OBJ_MEM    | Enables object specific memory allocation. See /ref ObjectMemoryPool.
694 Number of Memory Pool objects          | \c OS_MEMPOOL_NUM        | Defines maximum number of objects that can be active at the same time. Applies to objects with system provided memory for control blocks. Value range is \token{[0-1000]}.
695 Data Storage Memory size [bytes]       | \c OS_MEMPOOL_DATA_SIZE  | Defines the combined data storage memory size. Applies to objects with system provided memory for data storage. Default value is \token{0}. Value range is \token{[0-1073741824]}, stepping \token{4}.
696
697 */
698
699
700 /* ========================================================================================================================== */
701 /**
702 \page msgQueueConfig Message Queue Configuration
703
704 \image html config_wizard_msgQueue.png "RTX_Conf_CM.c: Message Queue Configuration"
705
706
707 Name                                   | \#define                 | Description
708 ---------------------------------------|--------------------------|----------------------------------------------------------------
709 Object specific Memory allocation      | \c OS_MSGQUEUE_OBJ_MEM   | Enables object specific memory allocation. See /ref ObjectMemoryPool.
710 Number of Message Queue objects        | \c OS_MSGQUEUE_NUM       | Defines maximum number of objects that can be active at the same time. Applies to objects with system provided memory for control blocks. Value range is \token{[0-1000]}.
711 Data Storage Memory size [bytes]       | \c OS_MSGQUEUE_DATA_SIZE | Defines the combined data storage memory size. Applies to objects with system provided memory for data storage. Default value is \token{0}. Value range is \token{[0-1073741824]}, stepping \token{4}.
712
713 */
714
715 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
716 /**
717 \page rtosValidation RTOS Validation
718
719 ARM offers a <a class=el href="http://www.keil.com/pack" target="_blank">Software Pack</a> for the CMSIS-RTOS Validation.
720 The <b>ARM::CMSIS-RTOS_Validation</b> Pack contains the following:
721
722  - Source code of a CMSIS-RTOS Validation Suite along with configuration file.
723  - Documentation of the CMSIS-RTOS Validation Suite.
724  - Example that shows the usage of the CMSIS-RTOS Validation Suite using simulation.
725
726 \note
727 A public version of the test suite is available only for CMSIS-RTOS v1 API.
728
729 The CMSIS-RTOS Validation Suite performs generic validation of various RTOS features. The test cases verify the 
730 functional behavior, test invalid parameters and call management functions from ISR.
731
732 The following CMSIS-RTOS features can be tested with the current release:
733  - Thread : Create multiple threads, terminate, restart, yield, change priority 
734  - Timer : Create periodic and one-shot timers
735  - GenWait : Call generic wait functions (osDelay and osWait)
736  - WaitFunc : Measure wait ticks (delay, mail, message, mutex, semaphore, signal)
737  
738 Moreover the following inter-thread communication functions can be tested: 
739  - Signal : Verify signal events
740  - Memory Pool : Verify memory allocation
741  - Message Queue : Exchange messages between threads
742  - Mail Queue : Exchange data between threads
743  - Mutex : Synchronize resource access 
744  - Semaphore : Access shared resources 
745  
746 The RTOS Validation output can be printed to a console, output via ITM printf, or output to a memory buffer.
747  
748 \section test_output Sample Test Output
749 \verbatim
750 CMSIS-RTOS Test Suite   Oct 21 2015   16:39:16 
751
752 TEST 01: TC_ThreadCreate                  PASSED
753 TEST 02: TC_ThreadMultiInstance           PASSED
754 TEST 03: TC_ThreadTerminate               PASSED
755   :
756   :
757 TEST 08: TC_ThreadChainedCreate           PASSED
758 TEST 09: TC_ThreadYield                   NOT EXECUTED
759 TEST 10: TC_ThreadParam                   PASSED
760   :
761   :
762 TEST 60: TC_MailFromISRToThread           PASSED
763
764 Test Summary: 60 Tests, 59 Executed, 59 Passed, 0 Failed, 0 Warnings.
765 Test Result: PASSED
766 \endverbatim
767 */
768
769
770 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
771 /**
772 \page functionOverview Function Overview
773
774 CMSIS-RTOS v2 provides multiple API interfaces:
775   - \subpage rtos_api2 is the new C function API that supports dynamic object creation, ARMv8-M, and multi-processor communication.
776   - <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.
777   - \subpage rtos_apicpp is a C++ class function API.
778
779 It is possible to intermix the different API variants in the same application and even in the same C/C++ source module.
780 However, the functions of the <b>C API Version 1</b> may be deprecated in future versions of CMSIS-RTOS.
781
782 \section rtos_api2 CMSIS-RTOS2
783
784 Overview of all CMSIS-RTOS C API v2 functions that are implemented in the \subpage cmsis_os2_h. 
785
786  - \ref CMSIS_RTOS_KernelCtrl
787    - \ref osKernelGetInfo : \copybrief osKernelGetInfo
788    - \ref osKernelGetState : \copybrief osKernelGetState
789    - \ref osKernelGetSysTimerCount : \copybrief osKernelGetSysTimerCount
790    - \ref osKernelGetSysTimerFreq : \copybrief osKernelGetSysTimerFreq
791    - \ref osKernelInitialize : \copybrief osKernelInitialize
792    - \ref osKernelLock : \copybrief osKernelLock
793    - \ref osKernelResume : \copybrief osKernelResume
794    - \ref osKernelStart : \copybrief osKernelStart
795    - \ref osKernelSuspend : \copybrief osKernelSuspend
796    - \ref osKernelGetTickCount : \copybrief osKernelGetTickCount
797    - \ref osKernelGetTickFreq : \copybrief osKernelGetTickFreq
798    - \ref osKernelUnlock : \copybrief osKernelUnlock
799
800  - \ref CMSIS_RTOS_ThreadMgmt
801    - \ref osThreadDetach : \copybrief osThreadDetach
802    - \ref osThreadExit : \copybrief osThreadExit
803    - \ref osThreadGetName : \copybrief osThreadGetName
804    - \ref osThreadGetId : \copybrief osThreadGetId
805    - \ref osThreadGetPriority : \copybrief osThreadGetPriority
806    - \ref osThreadGetState : \copybrief osThreadGetState
807    - \ref osThreadJoin : \copybrief osThreadJoin
808    - \ref osThreadNew : \copybrief osThreadNew
809    - \ref osThreadResume : \copybrief osThreadResume
810    - \ref osThreadSetPriority : \copybrief osThreadSetPriority
811    - \ref osThreadSuspend : \copybrief osThreadSuspend
812    - \ref osThreadTerminate : \copybrief osThreadTerminate
813    - \ref osThreadYield : \copybrief osThreadYield
814
815  - \ref CMSIS_RTOS_Wait
816    - \ref osDelay : \copybrief osDelay
817    - \ref osDelayUntil : \copybrief osDelayUntil
818
819  - \ref CMSIS_RTOS_TimerMgmt
820    - \ref osTimerDelete : \copybrief osTimerDelete
821    - \ref osTimerIsRunning : \copybrief osTimerIsRunning
822    - \ref osTimerNew : \copybrief osTimerNew
823    - \ref osTimerStart : \copybrief osTimerStart
824    - \ref osTimerStop : \copybrief osTimerStop
825
826  - \ref CMSIS_RTOS_EventFlags
827    - \ref osEventFlagsNew : \copybrief osEventFlagsNew
828    - \ref osEventFlagsDelete : \copybrief osEventFlagsDelete
829    - \ref osEventFlagsSet : \copybrief osEventFlagsSet
830    - \ref osEventFlagsClear : \copybrief osEventFlagsClear
831    - \ref osEventFlagsGet : \copybrief osEventFlagsGet
832    - \ref osEventFlagsWait : \copybrief osEventFlagsWait
833
834  - \ref CMSIS_RTOS_ThreadFlagsMgmt
835    - \ref osThreadFlagsSet : \copybrief osThreadFlagsSet
836    - \ref osThreadFlagsClear : \copybrief osThreadFlagsClear
837    - \ref osThreadFlagsGet : \copybrief osThreadFlagsGet
838    - \ref osThreadFlagsWait : \copybrief osThreadFlagsWait
839
840  - \ref CMSIS_RTOS_Message
841    - \ref osMessageQueueDelete : \copybrief osMessageQueueDelete
842    - \ref osMessageQueueGet : \copybrief osMessageQueueGet
843    - \ref osMessageQueueGetCapacity : \copybrief osMessageQueueGetCapacity
844    - \ref osMessageQueueGetCount : \copybrief osMessageQueueGetCount
845    - \ref osMessageQueueGetMsgSize : \copybrief osMessageQueueGetMsgSize
846    - \ref osMessageQueueGetSpace : \copybrief osMessageQueueGetSpace
847    - \ref osMessageQueueNew : \copybrief osMessageQueueNew
848    - \ref osMessageQueuePut : \copybrief osMessageQueuePut
849    - \ref osMessageQueueReset : \copybrief osMessageQueueReset
850
851  - \ref CMSIS_RTOS_PoolMgmt
852    - \ref osMemoryPoolAlloc : \copybrief osMemoryPoolAlloc
853    - \ref osMemoryPoolDelete : \copybrief osMemoryPoolDelete
854    - \ref osMemoryPoolFree : \copybrief osMemoryPoolFree
855    - \ref osMemoryPoolGetBlockSize : \copybrief osMemoryPoolGetBlockSize
856    - \ref osMemoryPoolGetCapacity : \copybrief osMemoryPoolGetCapacity
857    - \ref osMemoryPoolGetCount : \copybrief osMemoryPoolGetCount
858    - \ref osMemoryPoolGetSpace : \copybrief osMemoryPoolGetSpace
859    - \ref osMemoryPoolNew : \copybrief osMemoryPoolNew
860
861  - \ref CMSIS_RTOS_MutexMgmt
862    - \ref osMutexAcquire : \copybrief osMutexAcquire
863    - \ref osMutexDelete : \copybrief osMutexDelete
864    - \ref osMutexGetOwner : \copybrief osMutexGetOwner
865    - \ref osMutexNew : \copybrief osMutexNew
866    - \ref osMutexRelease : \copybrief osMutexRelease
867
868  - \ref CMSIS_RTOS_SemaphoreMgmt
869    - \ref osSemaphoreAcquire : \copybrief osSemaphoreAcquire
870    - \ref osSemaphoreDelete : \copybrief osSemaphoreDelete
871    - \ref osSemaphoreGetCount : \copybrief osSemaphoreGetCount
872    - \ref osSemaphoreNew : \copybrief osSemaphoreNew
873    - \ref osSemaphoreRelease : \copybrief osSemaphoreRelease
874
875 The following CMSIS-RTOS2 functions can be called from threads and Interrupt Service Routines (ISR):
876   - \ref osThreadFlagsSet
877   - \ref osEventFlagsSet, \ref osEventFlagsClear, \ref osEventFlagsGet, \ref osEventFlagsWait
878   - \ref osSemaphoreAcquire, \ref osSemaphoreRelease, \ref osSemaphoreGetCount
879   - \ref osMemoryPoolAlloc, \ref osMemoryPoolFree, \ref osMemoryPoolGetCapacity, \ref osMemoryPoolGetBlockSize, \ref osMemoryPoolGetCount, \ref osMemoryPoolGetSpace
880   - \ref osMessageQueuePut, \ref osMessageQueueGet, \ref osMessageQueueGetCapacity, \ref osMessageQueueGetMsgSize, \ref osMessageQueueGetCount, \ref osMessageQueueGetSpace
881
882 */
883
884
885 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
886 /**
887 \page rtos_apicpp CMSIS-RTOS C++ API
888
889 The C++11/C++14 interface is planned to be released in January 2017.
890 */
891
892
893 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
894 /**
895 \page cmsis_os2_h cmsis_os2.h header file
896
897 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).
898 Each implementation is provided the same cmsis_os2.h which defines the interface to the \ref rtos_api2.
899
900 Using the \b cmsis_os2.h along with dynamic object allocation allows to create source code or libraries that require no modifications
901 when using on a different CMSIS-RTOS v2 implementation.
902
903 <b>Header file %cmsis_os2.h</b>
904
905 \include cmsis_os2.h
906 */
907
908 /* ========================================================================================================================== */
909 // Group creation for Reference 
910 /* 
911 \addtogroup CMSIS_RTOS1 CMSIS-RTOS API v1
912 \brief This section describes the CMSIS-RTOS API v1. 
913 \details 
914 The CMSIS-RTOS is a generic API layer that interfaces to an existing RTOS kernel.
915
916 CMSIS-RTOS API v2 provides an translation layer for the
917 <a class="el" href="../../RTOS/html/index.html">CMSIS-RTOS API v1</a> that simplifies migration.
918
919 Refer to the <a class="el" href="../../RTOS/html/modules.html">Reference</a> guide of the CMSIS-RTOS API v1 for details.
920 */
921
922 // Group creation for Reference 
923 /** 
924 \addtogroup CMSIS_RTOS CMSIS-RTOS2 API
925 \brief Describes the C function interface of CMSIS-RTOS API v2. 
926 \details 
927 The CMSIS-RTOS2 is a generic API layer that interfaces to an RTOS kernel.
928
929 The complete API interface is defined in the \ref cmsis_os2_h. When using dynamic memory allocation for objects, source code or libraries require no modifications
930 when using on a different CMSIS-RTOS2 implementation.
931
932 */
933