Prusa MINI Firmware overview
cmsis_os.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------
2  * $Date: 5. February 2013
3  * $Revision: V1.02
4  *
5  * Project: CMSIS-RTOS API
6  * Title: cmsis_os.h header file
7  *
8  * Version 0.02
9  * Initial Proposal Phase
10  * Version 0.03
11  * osKernelStart added, optional feature: main started as thread
12  * osSemaphores have standard behavior
13  * osTimerCreate does not start the timer, added osTimerStart
14  * osThreadPass is renamed to osThreadYield
15  * Version 1.01
16  * Support for C++ interface
17  * - const attribute removed from the osXxxxDef_t typedef's
18  * - const attribute added to the osXxxxDef macros
19  * Added: osTimerDelete, osMutexDelete, osSemaphoreDelete
20  * Added: osKernelInitialize
21  * Version 1.02
22  * Control functions for short timeouts in microsecond resolution:
23  * Added: osKernelSysTick, osKernelSysTickFrequency, osKernelSysTickMicroSec
24  * Removed: osSignalGet
25  *
26  *
27  *----------------------------------------------------------------------------
28  *
29  * Portions Copyright © 2016 STMicroelectronics International N.V. All rights reserved.
30  * Portions Copyright (c) 2013 ARM LIMITED
31  * All rights reserved.
32  * Redistribution and use in source and binary forms, with or without
33  * modification, are permitted provided that the following conditions are met:
34  * - Redistributions of source code must retain the above copyright
35  * notice, this list of conditions and the following disclaimer.
36  * - Redistributions in binary form must reproduce the above copyright
37  * notice, this list of conditions and the following disclaimer in the
38  * documentation and/or other materials provided with the distribution.
39  * - Neither the name of ARM nor the names of its contributors may be used
40  * to endorse or promote products derived from this software without
41  * specific prior written permission.
42  *
43  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
44  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46  * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
47  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
49  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
50  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
51  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
53  * POSSIBILITY OF SUCH DAMAGE.
54  *---------------------------------------------------------------------------*/
55 
56  /**
57  ******************************************************************************
58  * @file cmsis_os.h
59  * @author MCD Application Team
60  * @date 13-July-2017
61  * @brief Header of cmsis_os.c
62  * A new set of APIs are added in addition to existing ones, these APIs
63  * are specific to FreeRTOS.
64  ******************************************************************************
65  * @attention
66  *
67  * Redistribution and use in source and binary forms, with or without
68  * modification, are permitted, provided that the following conditions are met:
69  *
70  * 1. Redistribution of source code must retain the above copyright notice,
71  * this list of conditions and the following disclaimer.
72  * 2. Redistributions in binary form must reproduce the above copyright notice,
73  * this list of conditions and the following disclaimer in the documentation
74  * and/or other materials provided with the distribution.
75  * 3. Neither the name of STMicroelectronics nor the names of other
76  * contributors to this software may be used to endorse or promote products
77  * derived from this software without specific written permission.
78  * 4. This software, including modifications and/or derivative works of this
79  * software, must execute solely and exclusively on microcontroller or
80  * microprocessor devices manufactured by or for STMicroelectronics.
81  * 5. Redistribution and use of this software other than as permitted under
82  * this license is void and will automatically terminate your rights under
83  * this license.
84  *
85  * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
86  * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
87  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
88  * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
89  * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
90  * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
91  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
92  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
93  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
94  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
95  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
96  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
97  *
98  ******************************************************************************
99  */
100 
101 #include "FreeRTOS.h"
102 #include "task.h"
103 #include "timers.h"
104 #include "queue.h"
105 #include "semphr.h"
106 #include "event_groups.h"
107 
108 /**
109 cmsis_os_h Header File Template: cmsis_os.h
110 
111 The file \b cmsis_os.h is a template header file for a CMSIS-RTOS compliant Real-Time Operating System (RTOS).
112 Each RTOS that is compliant with CMSIS-RTOS shall provide a specific \b cmsis_os.h header file that represents
113 its implementation.
114 
115 The file cmsis_os.h contains:
116  - CMSIS-RTOS API function definitions
117  - struct definitions for parameters and return types
118  - status and priority values used by CMSIS-RTOS API functions
119  - macros for defining threads and other kernel objects
120 
121 
122 <b>Name conventions and header file modifications</b>
123 
124 All definitions are prefixed with \b os to give an unique name space for CMSIS-RTOS functions.
125 Definitions that are prefixed \b os_ are not used in the application code but local to this header file.
126 All definitions and functions that belong to a module are grouped and have a common prefix, i.e. \b osThread.
127 
128 Definitions that are marked with <b>CAN BE CHANGED</b> can be adapted towards the needs of the actual CMSIS-RTOS implementation.
129 These definitions can be specific to the underlying RTOS kernel.
130 
131 Definitions that are marked with <b>MUST REMAIN UNCHANGED</b> cannot be altered. Otherwise the CMSIS-RTOS implementation is no longer
132 compliant to the standard. Note that some functions are optional and need not to be provided by every CMSIS-RTOS implementation.
133 
134 
135 <b>Function calls from interrupt service routines</b>
136 
137 The following CMSIS-RTOS functions can be called from threads and interrupt service routines (ISR):
138  - \ref osSignalSet
139  - \ref osSemaphoreRelease
140  - \ref osPoolAlloc, \ref osPoolCAlloc, \ref osPoolFree
141  - \ref osMessagePut, \ref osMessageGet
142  - \ref osMailAlloc, \ref osMailCAlloc, \ref osMailGet, \ref osMailPut, \ref osMailFree
143 
144 Functions that cannot be called from an ISR are verifying the interrupt status and return in case that they are called
145 from an ISR context the status code \b osErrorISR. In some implementations this condition might be caught using the HARD FAULT vector.
146 
147 Some CMSIS-RTOS implementations support CMSIS-RTOS function calls from multiple ISR at the same time.
148 If this is impossible, the CMSIS-RTOS rejects calls by nested ISR functions with the status code \b osErrorISRRecursive.
149 
150 
151 <b>Define and reference object definitions</b>
152 
153 With <b>\#define osObjectsExternal</b> objects are defined as external symbols. This allows to create a consistent header file
154 that is used throughout a project as shown below:
155 
156 <i>Header File</i>
157 \code
158 #include <cmsis_os.h> // CMSIS RTOS header file
159 
160 // Thread definition
161 extern void thread_sample (void const *argument); // function prototype
162 osThreadDef (thread_sample, osPriorityBelowNormal, 1, 100);
163 
164 // Pool definition
165 osPoolDef(MyPool, 10, long);
166 \endcode
167 
168 
169 This header file defines all objects when included in a C/C++ source file. When <b>\#define osObjectsExternal</b> is
170 present before the header file, the objects are defined as external symbols. A single consistent header file can therefore be
171 used throughout the whole project.
172 
173 <i>Example</i>
174 \code
175 #include "osObjects.h" // Definition of the CMSIS-RTOS objects
176 \endcode
177 
178 \code
179 #define osObjectExternal // Objects will be defined as external symbols
180 #include "osObjects.h" // Reference to the CMSIS-RTOS objects
181 \endcode
182 
183 */
184 
185 #ifndef _CMSIS_OS_H
186 #define _CMSIS_OS_H
187 
188 /// \note MUST REMAIN UNCHANGED: \b osCMSIS identifies the CMSIS-RTOS API version.
189 #define osCMSIS 0x10002 ///< API version (main [31:16] .sub [15:0])
190 
191 /// \note CAN BE CHANGED: \b osCMSIS_KERNEL identifies the underlying RTOS kernel and version number.
192 #define osCMSIS_KERNEL 0x10000 ///< RTOS identification and version (main [31:16] .sub [15:0])
193 
194 /// \note MUST REMAIN UNCHANGED: \b osKernelSystemId shall be consistent in every CMSIS-RTOS.
195 #define osKernelSystemId "KERNEL V1.00" ///< RTOS identification string
196 
197 /// \note MUST REMAIN UNCHANGED: \b osFeature_xxx shall be consistent in every CMSIS-RTOS.
198 #define osFeature_MainThread 1 ///< main thread 1=main can be thread, 0=not available
199 #define osFeature_Pool 1 ///< Memory Pools: 1=available, 0=not available
200 #define osFeature_MailQ 1 ///< Mail Queues: 1=available, 0=not available
201 #define osFeature_MessageQ 1 ///< Message Queues: 1=available, 0=not available
202 #define osFeature_Signals 8 ///< maximum number of Signal Flags available per thread
203 #define osFeature_Semaphore 1 ///< osFeature_Semaphore function: 1=available, 0=not available
204 #define osFeature_Wait 0 ///< osWait function: 1=available, 0=not available
205 #define osFeature_SysTick 1 ///< osKernelSysTick functions: 1=available, 0=not available
206 
207 #ifdef __cplusplus
208 extern "C"
209 {
210 #endif
211 
212 
213 // ==== Enumeration, structures, defines ====
214 
215 /// Priority used for thread control.
216 /// \note MUST REMAIN UNCHANGED: \b osPriority shall be consistent in every CMSIS-RTOS.
217 typedef enum {
218  osPriorityIdle = -3, ///< priority: idle (lowest)
219  osPriorityLow = -2, ///< priority: low
220  osPriorityBelowNormal = -1, ///< priority: below normal
221  osPriorityNormal = 0, ///< priority: normal (default)
222  osPriorityAboveNormal = +1, ///< priority: above normal
223  osPriorityHigh = +2, ///< priority: high
224  osPriorityRealtime = +3, ///< priority: realtime (highest)
225  osPriorityError = 0x84 ///< system cannot determine priority or thread has illegal priority
226 } osPriority;
227 
228 /// Timeout value.
229 /// \note MUST REMAIN UNCHANGED: \b osWaitForever shall be consistent in every CMSIS-RTOS.
230 #define osWaitForever 0xFFFFFFFF ///< wait forever timeout value
231 
232 /// Status code values returned by CMSIS-RTOS functions.
233 /// \note MUST REMAIN UNCHANGED: \b osStatus shall be consistent in every CMSIS-RTOS.
234 typedef enum {
235  osOK = 0, ///< function completed; no error or event occurred.
236  osEventSignal = 0x08, ///< function completed; signal event occurred.
237  osEventMessage = 0x10, ///< function completed; message event occurred.
238  osEventMail = 0x20, ///< function completed; mail event occurred.
239  osEventTimeout = 0x40, ///< function completed; timeout occurred.
240  osErrorParameter = 0x80, ///< parameter error: a mandatory parameter was missing or specified an incorrect object.
241  osErrorResource = 0x81, ///< resource not available: a specified resource was not available.
242  osErrorTimeoutResource = 0xC1, ///< resource not available within given time: a specified resource was not available within the timeout period.
243  osErrorISR = 0x82, ///< not allowed in ISR context: the function cannot be called from interrupt service routines.
244  osErrorISRRecursive = 0x83, ///< function called multiple times from ISR with same object.
245  osErrorPriority = 0x84, ///< system cannot determine priority or thread has illegal priority.
246  osErrorNoMemory = 0x85, ///< system is out of memory: it was impossible to allocate or reserve memory for the operation.
247  osErrorValue = 0x86, ///< value of a parameter is out of range.
248  osErrorOS = 0xFF, ///< unspecified RTOS error: run-time error but no other error message fits.
249  os_status_reserved = 0x7FFFFFFF ///< prevent from enum down-size compiler optimization.
250 } osStatus;
251 
252 #if ( INCLUDE_eTaskGetState == 1 )
253 /* Thread state returned by osThreadGetState */
254 typedef enum {
255  osThreadRunning = 0x0, /* A thread is querying the state of itself, so must be running. */
256  osThreadReady = 0x1 , /* The thread being queried is in a read or pending ready list. */
257  osThreadBlocked = 0x2, /* The thread being queried is in the Blocked state. */
258  osThreadSuspended = 0x3, /* The thread being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */
259  osThreadDeleted = 0x4, /* The thread being queried has been deleted, but its TCB has not yet been freed. */
260  osThreadError = 0x7FFFFFFF
261 } osThreadState;
262 #endif /* INCLUDE_eTaskGetState */
263 
264 /// Timer type value for the timer definition.
265 /// \note MUST REMAIN UNCHANGED: \b os_timer_type shall be consistent in every CMSIS-RTOS.
266 typedef enum {
267  osTimerOnce = 0, ///< one-shot timer
268  osTimerPeriodic = 1 ///< repeating timer
269 } os_timer_type;
270 
271 /// Entry point of a thread.
272 /// \note MUST REMAIN UNCHANGED: \b os_pthread shall be consistent in every CMSIS-RTOS.
273 typedef void (*os_pthread) (void const *argument);
274 
275 /// Entry point of a timer call back function.
276 /// \note MUST REMAIN UNCHANGED: \b os_ptimer shall be consistent in every CMSIS-RTOS.
277 typedef void (*os_ptimer) (void const *argument);
278 
279 // >>> the following data type definitions may shall adapted towards a specific RTOS
280 
281 /// Thread ID identifies the thread (pointer to a thread control block).
282 /// \note CAN BE CHANGED: \b os_thread_cb is implementation specific in every CMSIS-RTOS.
284 
285 /// Timer ID identifies the timer (pointer to a timer control block).
286 /// \note CAN BE CHANGED: \b os_timer_cb is implementation specific in every CMSIS-RTOS.
288 
289 /// Mutex ID identifies the mutex (pointer to a mutex control block).
290 /// \note CAN BE CHANGED: \b os_mutex_cb is implementation specific in every CMSIS-RTOS.
292 
293 /// Semaphore ID identifies the semaphore (pointer to a semaphore control block).
294 /// \note CAN BE CHANGED: \b os_semaphore_cb is implementation specific in every CMSIS-RTOS.
296 
297 /// Pool ID identifies the memory pool (pointer to a memory pool control block).
298 /// \note CAN BE CHANGED: \b os_pool_cb is implementation specific in every CMSIS-RTOS.
299 typedef struct os_pool_cb *osPoolId;
300 
301 /// Message ID identifies the message queue (pointer to a message queue control block).
302 /// \note CAN BE CHANGED: \b os_messageQ_cb is implementation specific in every CMSIS-RTOS.
304 
305 /// Mail ID identifies the mail queue (pointer to a mail queue control block).
306 /// \note CAN BE CHANGED: \b os_mailQ_cb is implementation specific in every CMSIS-RTOS.
307 typedef struct os_mailQ_cb *osMailQId;
308 
309 
310 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
311 
312 typedef StaticTask_t osStaticThreadDef_t;
313 typedef StaticTimer_t osStaticTimerDef_t;
314 typedef StaticSemaphore_t osStaticMutexDef_t;
315 typedef StaticSemaphore_t osStaticSemaphoreDef_t;
316 typedef StaticQueue_t osStaticMessageQDef_t;
317 
318 #endif
319 
320 
321 
322 
323 /// Thread Definition structure contains startup information of a thread.
324 /// \note CAN BE CHANGED: \b os_thread_def is implementation specific in every CMSIS-RTOS.
325 typedef struct os_thread_def {
326  char *name; ///< Thread name
327  os_pthread pthread; ///< start address of thread function
328  osPriority tpriority; ///< initial thread priority
329  uint32_t instances; ///< maximum number of instances of that thread function
330  uint32_t stacksize; ///< stack size requirements in bytes; 0 is default stack size
331 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
332  uint32_t *buffer; ///< stack buffer for static allocation; NULL for dynamic allocation
333  osStaticThreadDef_t *controlblock; ///< control block to hold thread's data for static allocation; NULL for dynamic allocation
334 #endif
335 } osThreadDef_t;
336 
337 /// Timer Definition structure contains timer parameters.
338 /// \note CAN BE CHANGED: \b os_timer_def is implementation specific in every CMSIS-RTOS.
339 typedef struct os_timer_def {
340  os_ptimer ptimer; ///< start address of a timer function
341 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
342  osStaticTimerDef_t *controlblock; ///< control block to hold timer's data for static allocation; NULL for dynamic allocation
343 #endif
344 } osTimerDef_t;
345 
346 /// Mutex Definition structure contains setup information for a mutex.
347 /// \note CAN BE CHANGED: \b os_mutex_def is implementation specific in every CMSIS-RTOS.
348 typedef struct os_mutex_def {
349  uint32_t dummy; ///< dummy value.
350 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
351  osStaticMutexDef_t *controlblock; ///< control block for static allocation; NULL for dynamic allocation
352 #endif
353 } osMutexDef_t;
354 
355 /// Semaphore Definition structure contains setup information for a semaphore.
356 /// \note CAN BE CHANGED: \b os_semaphore_def is implementation specific in every CMSIS-RTOS.
357 typedef struct os_semaphore_def {
358  uint32_t dummy; ///< dummy value.
359 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
360  osStaticSemaphoreDef_t *controlblock; ///< control block for static allocation; NULL for dynamic allocation
361 #endif
363 
364 /// Definition structure for memory block allocation.
365 /// \note CAN BE CHANGED: \b os_pool_def is implementation specific in every CMSIS-RTOS.
366 typedef struct os_pool_def {
367  uint32_t pool_sz; ///< number of items (elements) in the pool
368  uint32_t item_sz; ///< size of an item
369  void *pool; ///< pointer to memory for pool
370 } osPoolDef_t;
371 
372 /// Definition structure for message queue.
373 /// \note CAN BE CHANGED: \b os_messageQ_def is implementation specific in every CMSIS-RTOS.
374 typedef struct os_messageQ_def {
375  uint32_t queue_sz; ///< number of elements in the queue
376  uint32_t item_sz; ///< size of an item
377 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
378  uint8_t *buffer; ///< buffer for static allocation; NULL for dynamic allocation
379  osStaticMessageQDef_t *controlblock; ///< control block to hold queue's data for static allocation; NULL for dynamic allocation
380 #endif
381  //void *pool; ///< memory array for messages
383 
384 /// Definition structure for mail queue.
385 /// \note CAN BE CHANGED: \b os_mailQ_def is implementation specific in every CMSIS-RTOS.
386 typedef struct os_mailQ_def {
387  uint32_t queue_sz; ///< number of elements in the queue
388  uint32_t item_sz; ///< size of an item
389  struct os_mailQ_cb **cb;
390 } osMailQDef_t;
391 
392 /// Event structure contains detailed information about an event.
393 /// \note MUST REMAIN UNCHANGED: \b os_event shall be consistent in every CMSIS-RTOS.
394 /// However the struct may be extended at the end.
395 typedef struct {
396  osStatus status; ///< status code: event or error information
397  union {
398  uint32_t v; ///< message as 32-bit value
399  void *p; ///< message or mail as void pointer
400  int32_t signals; ///< signal flags
401  } value; ///< event value
402  union {
403  osMailQId mail_id; ///< mail id obtained by \ref osMailCreate
404  osMessageQId message_id; ///< message id obtained by \ref osMessageCreate
405  } def; ///< event definition
406 } osEvent;
407 
408 
409 // ==== Kernel Control Functions ====
410 
411 /// Initialize the RTOS Kernel for creating objects.
412 /// \return status code that indicates the execution status of the function.
413 /// \note MUST REMAIN UNCHANGED: \b osKernelInitialize shall be consistent in every CMSIS-RTOS.
415 
416 /// Start the RTOS Kernel.
417 /// \return status code that indicates the execution status of the function.
418 /// \note MUST REMAIN UNCHANGED: \b osKernelStart shall be consistent in every CMSIS-RTOS.
419 osStatus osKernelStart (void);
420 
421 /// Check if the RTOS kernel is already started.
422 /// \note MUST REMAIN UNCHANGED: \b osKernelRunning shall be consistent in every CMSIS-RTOS.
423 /// \return 0 RTOS is not started, 1 RTOS is started.
424 int32_t osKernelRunning(void);
425 
426 #if (defined (osFeature_SysTick) && (osFeature_SysTick != 0)) // System Timer available
427 
428 /// Get the RTOS kernel system timer counter
429 /// \note MUST REMAIN UNCHANGED: \b osKernelSysTick shall be consistent in every CMSIS-RTOS.
430 /// \return RTOS kernel system timer as 32-bit value
431 uint32_t osKernelSysTick (void);
432 
433 /// The RTOS kernel system timer frequency in Hz
434 /// \note Reflects the system timer setting and is typically defined in a configuration file.
435 #define osKernelSysTickFrequency (configTICK_RATE_HZ)
436 
437 /// Convert a microseconds value to a RTOS kernel system timer value.
438 /// \param microsec time value in microseconds.
439 /// \return time value normalized to the \ref osKernelSysTickFrequency
440 #define osKernelSysTickMicroSec(microsec) (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000)
441 
442 #endif // System Timer available
443 
444 // ==== Thread Management ====
445 
446 /// Create a Thread Definition with function, priority, and stack requirements.
447 /// \param name name of the thread function.
448 /// \param priority initial priority of the thread function.
449 /// \param instances number of possible thread instances.
450 /// \param stacksz stack size (in bytes) requirements for the thread function.
451 /// \note CAN BE CHANGED: The parameters to \b osThreadDef shall be consistent but the
452 /// macro body is implementation specific in every CMSIS-RTOS.
453 #if defined (osObjectsExternal) // object is external
454 #define osThreadDef(name, thread, priority, instances, stacksz) \
455 extern const osThreadDef_t os_thread_def_##name
456 #else // define the object
457 
458 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
459 #define osThreadDef(name, thread, priority, instances, stacksz) \
460 const osThreadDef_t os_thread_def_##name = \
461 { #name, (thread), (priority), (instances), (stacksz), NULL, NULL }
462 
463 #define osThreadStaticDef(name, thread, priority, instances, stacksz, buffer, control) \
464 const osThreadDef_t os_thread_def_##name = \
465 { #name, (thread), (priority), (instances), (stacksz), (buffer), (control) }
466 #else //configSUPPORT_STATIC_ALLOCATION == 0
467 
468 #define osThreadDef(name, thread, priority, instances, stacksz) \
469 const osThreadDef_t os_thread_def_##name = \
470 { #name, (thread), (priority), (instances), (stacksz)}
471 #endif
472 #endif
473 
474 /// Access a Thread definition.
475 /// \param name name of the thread definition object.
476 /// \note CAN BE CHANGED: The parameter to \b osThread shall be consistent but the
477 /// macro body is implementation specific in every CMSIS-RTOS.
478 #define osThread(name) \
479 &os_thread_def_##name
480 
481 /// Create a thread and add it to Active Threads and set it to state READY.
482 /// \param[in] thread_def thread definition referenced with \ref osThread.
483 /// \param[in] argument pointer that is passed to the thread function as start argument.
484 /// \return thread ID for reference by other functions or NULL in case of error.
485 /// \note MUST REMAIN UNCHANGED: \b osThreadCreate shall be consistent in every CMSIS-RTOS.
486 osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument);
487 
488 /// Return the thread ID of the current running thread.
489 /// \return thread ID for reference by other functions or NULL in case of error.
490 /// \note MUST REMAIN UNCHANGED: \b osThreadGetId shall be consistent in every CMSIS-RTOS.
492 
493 /// Terminate execution of a thread and remove it from Active Threads.
494 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
495 /// \return status code that indicates the execution status of the function.
496 /// \note MUST REMAIN UNCHANGED: \b osThreadTerminate shall be consistent in every CMSIS-RTOS.
498 
499 /// Pass control to next thread that is in state \b READY.
500 /// \return status code that indicates the execution status of the function.
501 /// \note MUST REMAIN UNCHANGED: \b osThreadYield shall be consistent in every CMSIS-RTOS.
502 osStatus osThreadYield (void);
503 
504 /// Change priority of an active thread.
505 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
506 /// \param[in] priority new priority value for the thread function.
507 /// \return status code that indicates the execution status of the function.
508 /// \note MUST REMAIN UNCHANGED: \b osThreadSetPriority shall be consistent in every CMSIS-RTOS.
509 osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority);
510 
511 /// Get current priority of an active thread.
512 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
513 /// \return current priority value of the thread function.
514 /// \note MUST REMAIN UNCHANGED: \b osThreadGetPriority shall be consistent in every CMSIS-RTOS.
516 
517 
518 // ==== Generic Wait Functions ====
519 
520 /// Wait for Timeout (Time Delay).
521 /// \param[in] millisec time delay value
522 /// \return status code that indicates the execution status of the function.
523 osStatus osDelay (uint32_t millisec);
524 
525 #if (defined (osFeature_Wait) && (osFeature_Wait != 0)) // Generic Wait available
526 
527 /// Wait for Signal, Message, Mail, or Timeout.
528 /// \param[in] millisec timeout value or 0 in case of no time-out
529 /// \return event that contains signal, message, or mail information or error code.
530 /// \note MUST REMAIN UNCHANGED: \b osWait shall be consistent in every CMSIS-RTOS.
531 osEvent osWait (uint32_t millisec);
532 
533 #endif // Generic Wait available
534 
535 
536 // ==== Timer Management Functions ====
537 /// Define a Timer object.
538 /// \param name name of the timer object.
539 /// \param function name of the timer call back function.
540 /// \note CAN BE CHANGED: The parameter to \b osTimerDef shall be consistent but the
541 /// macro body is implementation specific in every CMSIS-RTOS.
542 #if defined (osObjectsExternal) // object is external
543 #define osTimerDef(name, function) \
544 extern const osTimerDef_t os_timer_def_##name
545 #else // define the object
546 
547 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
548 #define osTimerDef(name, function) \
549 const osTimerDef_t os_timer_def_##name = \
550 { (function), NULL }
551 
552 #define osTimerStaticDef(name, function, control) \
553 const osTimerDef_t os_timer_def_##name = \
554 { (function), (control) }
555 #else //configSUPPORT_STATIC_ALLOCATION == 0
556 #define osTimerDef(name, function) \
557 const osTimerDef_t os_timer_def_##name = \
558 { (function) }
559 #endif
560 #endif
561 
562 /// Access a Timer definition.
563 /// \param name name of the timer object.
564 /// \note CAN BE CHANGED: The parameter to \b osTimer shall be consistent but the
565 /// macro body is implementation specific in every CMSIS-RTOS.
566 #define osTimer(name) \
567 &os_timer_def_##name
568 
569 /// Create a timer.
570 /// \param[in] timer_def timer object referenced with \ref osTimer.
571 /// \param[in] type osTimerOnce for one-shot or osTimerPeriodic for periodic behavior.
572 /// \param[in] argument argument to the timer call back function.
573 /// \return timer ID for reference by other functions or NULL in case of error.
574 /// \note MUST REMAIN UNCHANGED: \b osTimerCreate shall be consistent in every CMSIS-RTOS.
575 osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument);
576 
577 /// Start or restart a timer.
578 /// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
579 /// \param[in] millisec time delay value of the timer.
580 /// \return status code that indicates the execution status of the function.
581 /// \note MUST REMAIN UNCHANGED: \b osTimerStart shall be consistent in every CMSIS-RTOS.
582 osStatus osTimerStart (osTimerId timer_id, uint32_t millisec);
583 
584 /// Stop the timer.
585 /// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
586 /// \return status code that indicates the execution status of the function.
587 /// \note MUST REMAIN UNCHANGED: \b osTimerStop shall be consistent in every CMSIS-RTOS.
588 osStatus osTimerStop (osTimerId timer_id);
589 
590 /// Delete a timer that was created by \ref osTimerCreate.
591 /// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
592 /// \return status code that indicates the execution status of the function.
593 /// \note MUST REMAIN UNCHANGED: \b osTimerDelete shall be consistent in every CMSIS-RTOS.
594 osStatus osTimerDelete (osTimerId timer_id);
595 
596 
597 // ==== Signal Management ====
598 
599 /// Set the specified Signal Flags of an active thread.
600 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
601 /// \param[in] signals specifies the signal flags of the thread that should be set.
602 /// \return osOK if successful, osErrorOS if failed.
603 /// \note MUST REMAIN UNCHANGED: \b osSignalSet shall be consistent in every CMSIS-RTOS.
604 int32_t osSignalSet (osThreadId thread_id, int32_t signals);
605 
606 /// Clear the specified Signal Flags of an active thread.
607 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
608 /// \param[in] signals specifies the signal flags of the thread that shall be cleared.
609 /// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
610 /// \note MUST REMAIN UNCHANGED: \b osSignalClear shall be consistent in every CMSIS-RTOS.
611 int32_t osSignalClear (osThreadId thread_id, int32_t signals);
612 
613 /// Wait for one or more Signal Flags to become signaled for the current \b RUNNING thread.
614 /// \param[in] signals wait until all specified signal flags set or 0 for any single signal flag.
615 /// \param[in] millisec timeout value or 0 in case of no time-out.
616 /// \return event flag information or error code.
617 /// \note MUST REMAIN UNCHANGED: \b osSignalWait shall be consistent in every CMSIS-RTOS.
618 osEvent osSignalWait (int32_t signals, uint32_t millisec);
619 
620 
621 // ==== Mutex Management ====
622 
623 /// Define a Mutex.
624 /// \param name name of the mutex object.
625 /// \note CAN BE CHANGED: The parameter to \b osMutexDef shall be consistent but the
626 /// macro body is implementation specific in every CMSIS-RTOS.
627 #if defined (osObjectsExternal) // object is external
628 #define osMutexDef(name) \
629 extern const osMutexDef_t os_mutex_def_##name
630 #else // define the object
631 
632 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
633 #define osMutexDef(name) \
634 const osMutexDef_t os_mutex_def_##name = { 0, NULL }
635 
636 #define osMutexStaticDef(name, control) \
637 const osMutexDef_t os_mutex_def_##name = { 0, (control) }
638 #else //configSUPPORT_STATIC_ALLOCATION == 0
639 #define osMutexDef(name) \
640 const osMutexDef_t os_mutex_def_##name = { 0 }
641 
642 #endif
643 
644 #endif
645 
646 /// Access a Mutex definition.
647 /// \param name name of the mutex object.
648 /// \note CAN BE CHANGED: The parameter to \b osMutex shall be consistent but the
649 /// macro body is implementation specific in every CMSIS-RTOS.
650 #define osMutex(name) \
651 &os_mutex_def_##name
652 
653 /// Create and Initialize a Mutex object.
654 /// \param[in] mutex_def mutex definition referenced with \ref osMutex.
655 /// \return mutex ID for reference by other functions or NULL in case of error.
656 /// \note MUST REMAIN UNCHANGED: \b osMutexCreate shall be consistent in every CMSIS-RTOS.
657 osMutexId osMutexCreate (const osMutexDef_t *mutex_def);
658 
659 /// Wait until a Mutex becomes available.
660 /// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
661 /// \param[in] millisec timeout value or 0 in case of no time-out.
662 /// \return status code that indicates the execution status of the function.
663 /// \note MUST REMAIN UNCHANGED: \b osMutexWait shall be consistent in every CMSIS-RTOS.
664 osStatus osMutexWait (osMutexId mutex_id, uint32_t millisec);
665 
666 /// Release a Mutex that was obtained by \ref osMutexWait.
667 /// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
668 /// \return status code that indicates the execution status of the function.
669 /// \note MUST REMAIN UNCHANGED: \b osMutexRelease shall be consistent in every CMSIS-RTOS.
671 
672 /// Delete a Mutex that was created by \ref osMutexCreate.
673 /// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
674 /// \return status code that indicates the execution status of the function.
675 /// \note MUST REMAIN UNCHANGED: \b osMutexDelete shall be consistent in every CMSIS-RTOS.
676 osStatus osMutexDelete (osMutexId mutex_id);
677 
678 
679 // ==== Semaphore Management Functions ====
680 
681 #if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0)) // Semaphore available
682 
683 /// Define a Semaphore object.
684 /// \param name name of the semaphore object.
685 /// \note CAN BE CHANGED: The parameter to \b osSemaphoreDef shall be consistent but the
686 /// macro body is implementation specific in every CMSIS-RTOS.
687 #if defined (osObjectsExternal) // object is external
688 #define osSemaphoreDef(name) \
689 extern const osSemaphoreDef_t os_semaphore_def_##name
690 #else // define the object
691 
692 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
693 #define osSemaphoreDef(name) \
694 const osSemaphoreDef_t os_semaphore_def_##name = { 0, NULL }
695 
696 #define osSemaphoreStaticDef(name, control) \
697 const osSemaphoreDef_t os_semaphore_def_##name = { 0, (control) }
698 
699 #else //configSUPPORT_STATIC_ALLOCATION == 0
700 #define osSemaphoreDef(name) \
701 const osSemaphoreDef_t os_semaphore_def_##name = { 0 }
702 #endif
703 #endif
704 
705 /// Access a Semaphore definition.
706 /// \param name name of the semaphore object.
707 /// \note CAN BE CHANGED: The parameter to \b osSemaphore shall be consistent but the
708 /// macro body is implementation specific in every CMSIS-RTOS.
709 #define osSemaphore(name) \
710 &os_semaphore_def_##name
711 
712 /// Create and Initialize a Semaphore object used for managing resources.
713 /// \param[in] semaphore_def semaphore definition referenced with \ref osSemaphore.
714 /// \param[in] count number of available resources.
715 /// \return semaphore ID for reference by other functions or NULL in case of error.
716 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreCreate shall be consistent in every CMSIS-RTOS.
717 osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count);
718 
719 /// Wait until a Semaphore token becomes available.
720 /// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
721 /// \param[in] millisec timeout value or 0 in case of no time-out.
722 /// \return number of available tokens, or -1 in case of incorrect parameters.
723 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreWait shall be consistent in every CMSIS-RTOS.
724 int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec);
725 
726 /// Release a Semaphore token.
727 /// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
728 /// \return status code that indicates the execution status of the function.
729 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreRelease shall be consistent in every CMSIS-RTOS.
731 
732 /// Delete a Semaphore that was created by \ref osSemaphoreCreate.
733 /// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
734 /// \return status code that indicates the execution status of the function.
735 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreDelete shall be consistent in every CMSIS-RTOS.
737 
738 #endif // Semaphore available
739 
740 
741 // ==== Memory Pool Management Functions ====
742 
743 #if (defined (osFeature_Pool) && (osFeature_Pool != 0)) // Memory Pool Management available
744 
745 /// \brief Define a Memory Pool.
746 /// \param name name of the memory pool.
747 /// \param no maximum number of blocks (objects) in the memory pool.
748 /// \param type data type of a single block (object).
749 /// \note CAN BE CHANGED: The parameter to \b osPoolDef shall be consistent but the
750 /// macro body is implementation specific in every CMSIS-RTOS.
751 #if defined (osObjectsExternal) // object is external
752 #define osPoolDef(name, no, type) \
753 extern const osPoolDef_t os_pool_def_##name
754 #else // define the object
755 #define osPoolDef(name, no, type) \
756 const osPoolDef_t os_pool_def_##name = \
757 { (no), sizeof(type), NULL }
758 #endif
759 
760 /// \brief Access a Memory Pool definition.
761 /// \param name name of the memory pool
762 /// \note CAN BE CHANGED: The parameter to \b osPool shall be consistent but the
763 /// macro body is implementation specific in every CMSIS-RTOS.
764 #define osPool(name) \
765 &os_pool_def_##name
766 
767 /// Create and Initialize a memory pool.
768 /// \param[in] pool_def memory pool definition referenced with \ref osPool.
769 /// \return memory pool ID for reference by other functions or NULL in case of error.
770 /// \note MUST REMAIN UNCHANGED: \b osPoolCreate shall be consistent in every CMSIS-RTOS.
771 osPoolId osPoolCreate (const osPoolDef_t *pool_def);
772 
773 /// Allocate a memory block from a memory pool.
774 /// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
775 /// \return address of the allocated memory block or NULL in case of no memory available.
776 /// \note MUST REMAIN UNCHANGED: \b osPoolAlloc shall be consistent in every CMSIS-RTOS.
777 void *osPoolAlloc (osPoolId pool_id);
778 
779 /// Allocate a memory block from a memory pool and set memory block to zero.
780 /// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
781 /// \return address of the allocated memory block or NULL in case of no memory available.
782 /// \note MUST REMAIN UNCHANGED: \b osPoolCAlloc shall be consistent in every CMSIS-RTOS.
783 void *osPoolCAlloc (osPoolId pool_id);
784 
785 /// Return an allocated memory block back to a specific memory pool.
786 /// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
787 /// \param[in] block address of the allocated memory block that is returned to the memory pool.
788 /// \return status code that indicates the execution status of the function.
789 /// \note MUST REMAIN UNCHANGED: \b osPoolFree shall be consistent in every CMSIS-RTOS.
790 osStatus osPoolFree (osPoolId pool_id, void *block);
791 
792 #endif // Memory Pool Management available
793 
794 
795 // ==== Message Queue Management Functions ====
796 
797 #if (defined (osFeature_MessageQ) && (osFeature_MessageQ != 0)) // Message Queues available
798 
799 /// \brief Create a Message Queue Definition.
800 /// \param name name of the queue.
801 /// \param queue_sz maximum number of messages in the queue.
802 /// \param type data type of a single message element (for debugger).
803 /// \note CAN BE CHANGED: The parameter to \b osMessageQDef shall be consistent but the
804 /// macro body is implementation specific in every CMSIS-RTOS.
805 #if defined (osObjectsExternal) // object is external
806 #define osMessageQDef(name, queue_sz, type) \
807 extern const osMessageQDef_t os_messageQ_def_##name
808 #else // define the object
809 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
810 #define osMessageQDef(name, queue_sz, type) \
811 const osMessageQDef_t os_messageQ_def_##name = \
812 { (queue_sz), sizeof (type), NULL, NULL }
813 
814 #define osMessageQStaticDef(name, queue_sz, type, buffer, control) \
815 const osMessageQDef_t os_messageQ_def_##name = \
816 { (queue_sz), sizeof (type) , (buffer), (control)}
817 #else //configSUPPORT_STATIC_ALLOCATION == 1
818 #define osMessageQDef(name, queue_sz, type) \
819 const osMessageQDef_t os_messageQ_def_##name = \
820 { (queue_sz), sizeof (type) }
821 
822 #endif
823 #endif
824 
825 /// \brief Access a Message Queue Definition.
826 /// \param name name of the queue
827 /// \note CAN BE CHANGED: The parameter to \b osMessageQ shall be consistent but the
828 /// macro body is implementation specific in every CMSIS-RTOS.
829 #define osMessageQ(name) \
830 &os_messageQ_def_##name
831 
832 /// Create and Initialize a Message Queue.
833 /// \param[in] queue_def queue definition referenced with \ref osMessageQ.
834 /// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.
835 /// \return message queue ID for reference by other functions or NULL in case of error.
836 /// \note MUST REMAIN UNCHANGED: \b osMessageCreate shall be consistent in every CMSIS-RTOS.
837 osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id);
838 
839 /// Put a Message to a Queue.
840 /// \param[in] queue_id message queue ID obtained with \ref osMessageCreate.
841 /// \param[in] info message information.
842 /// \param[in] millisec timeout value or 0 in case of no time-out.
843 /// \return status code that indicates the execution status of the function.
844 /// \note MUST REMAIN UNCHANGED: \b osMessagePut shall be consistent in every CMSIS-RTOS.
845 osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t millisec);
846 
847 /// Get a Message or Wait for a Message from a Queue.
848 /// \param[in] queue_id message queue ID obtained with \ref osMessageCreate.
849 /// \param[in] millisec timeout value or 0 in case of no time-out.
850 /// \return event information that includes status code.
851 /// \note MUST REMAIN UNCHANGED: \b osMessageGet shall be consistent in every CMSIS-RTOS.
852 osEvent osMessageGet (osMessageQId queue_id, uint32_t millisec);
853 
854 #endif // Message Queues available
855 
856 
857 // ==== Mail Queue Management Functions ====
858 
859 #if (defined (osFeature_MailQ) && (osFeature_MailQ != 0)) // Mail Queues available
860 
861 /// \brief Create a Mail Queue Definition.
862 /// \param name name of the queue
863 /// \param queue_sz maximum number of messages in queue
864 /// \param type data type of a single message element
865 /// \note CAN BE CHANGED: The parameter to \b osMailQDef shall be consistent but the
866 /// macro body is implementation specific in every CMSIS-RTOS.
867 #if defined (osObjectsExternal) // object is external
868 #define osMailQDef(name, queue_sz, type) \
869 extern struct os_mailQ_cb *os_mailQ_cb_##name \
870 extern osMailQDef_t os_mailQ_def_##name
871 #else // define the object
872 #define osMailQDef(name, queue_sz, type) \
873 struct os_mailQ_cb *os_mailQ_cb_##name; \
874 const osMailQDef_t os_mailQ_def_##name = \
875 { (queue_sz), sizeof (type), (&os_mailQ_cb_##name) }
876 #endif
877 
878 /// \brief Access a Mail Queue Definition.
879 /// \param name name of the queue
880 /// \note CAN BE CHANGED: The parameter to \b osMailQ shall be consistent but the
881 /// macro body is implementation specific in every CMSIS-RTOS.
882 #define osMailQ(name) \
883 &os_mailQ_def_##name
884 
885 /// Create and Initialize mail queue.
886 /// \param[in] queue_def reference to the mail queue definition obtain with \ref osMailQ
887 /// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.
888 /// \return mail queue ID for reference by other functions or NULL in case of error.
889 /// \note MUST REMAIN UNCHANGED: \b osMailCreate shall be consistent in every CMSIS-RTOS.
890 osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id);
891 
892 /// Allocate a memory block from a mail.
893 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
894 /// \param[in] millisec timeout value or 0 in case of no time-out
895 /// \return pointer to memory block that can be filled with mail or NULL in case of error.
896 /// \note MUST REMAIN UNCHANGED: \b osMailAlloc shall be consistent in every CMSIS-RTOS.
897 void *osMailAlloc (osMailQId queue_id, uint32_t millisec);
898 
899 /// Allocate a memory block from a mail and set memory block to zero.
900 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
901 /// \param[in] millisec timeout value or 0 in case of no time-out
902 /// \return pointer to memory block that can be filled with mail or NULL in case of error.
903 /// \note MUST REMAIN UNCHANGED: \b osMailCAlloc shall be consistent in every CMSIS-RTOS.
904 void *osMailCAlloc (osMailQId queue_id, uint32_t millisec);
905 
906 /// Put a mail to a queue.
907 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
908 /// \param[in] mail memory block previously allocated with \ref osMailAlloc or \ref osMailCAlloc.
909 /// \return status code that indicates the execution status of the function.
910 /// \note MUST REMAIN UNCHANGED: \b osMailPut shall be consistent in every CMSIS-RTOS.
911 osStatus osMailPut (osMailQId queue_id, void *mail);
912 
913 /// Get a mail from a queue.
914 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
915 /// \param[in] millisec timeout value or 0 in case of no time-out
916 /// \return event that contains mail information or error code.
917 /// \note MUST REMAIN UNCHANGED: \b osMailGet shall be consistent in every CMSIS-RTOS.
918 osEvent osMailGet (osMailQId queue_id, uint32_t millisec);
919 
920 /// Free a memory block from a mail.
921 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
922 /// \param[in] mail pointer to the memory block that was obtained with \ref osMailGet.
923 /// \return status code that indicates the execution status of the function.
924 /// \note MUST REMAIN UNCHANGED: \b osMailFree shall be consistent in every CMSIS-RTOS.
925 osStatus osMailFree (osMailQId queue_id, void *mail);
926 
927 #endif // Mail Queues available
928 
929 /*************************** Additional specific APIs to Free RTOS ************/
930 /**
931 * @brief Handles the tick increment
932 * @param none.
933 * @retval none.
934 */
935 void osSystickHandler(void);
936 
937 #if ( INCLUDE_eTaskGetState == 1 )
938 /**
939 * @brief Obtain the state of any thread.
940 * @param thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
941 * @retval the stae of the thread, states are encoded by the osThreadState enumerated type.
942 */
943 osThreadState osThreadGetState(osThreadId thread_id);
944 #endif /* INCLUDE_eTaskGetState */
945 
946 #if ( INCLUDE_eTaskGetState == 1 )
947 /**
948 * @brief Check if a thread is already suspended or not.
949 * @param thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
950 * @retval status code that indicates the execution status of the function.
951 */
952 
953 osStatus osThreadIsSuspended(osThreadId thread_id);
954 
955 #endif /* INCLUDE_eTaskGetState */
956 
957 /**
958 * @brief Suspend execution of a thread.
959 * @param thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
960 * @retval status code that indicates the execution status of the function.
961 */
963 
964 /**
965 * @brief Resume execution of a suspended thread.
966 * @param thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
967 * @retval status code that indicates the execution status of the function.
968 */
970 
971 /**
972 * @brief Suspend execution of a all active threads.
973 * @retval status code that indicates the execution status of the function.
974 */
976 
977 /**
978 * @brief Resume execution of a all suspended threads.
979 * @retval status code that indicates the execution status of the function.
980 */
982 
983 /**
984 * @brief Delay a task until a specified time
985 * @param PreviousWakeTime Pointer to a variable that holds the time at which the
986 * task was last unblocked. PreviousWakeTime must be initialised with the current time
987 * prior to its first use (PreviousWakeTime = osKernelSysTick() )
988 * @param millisec time delay value
989 * @retval status code that indicates the execution status of the function.
990 */
991 osStatus osDelayUntil (uint32_t *PreviousWakeTime, uint32_t millisec);
992 
993 /**
994 * @brief Abort the delay for a specific thread
995 * @param thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId
996 * @retval status code that indicates the execution status of the function.
997 */
998 osStatus osAbortDelay(osThreadId thread_id);
999 
1000 /**
1001 * @brief Lists all the current threads, along with their current state
1002 * and stack usage high water mark.
1003 * @param buffer A buffer into which the above mentioned details
1004 * will be written
1005 * @retval status code that indicates the execution status of the function.
1006 */
1007 osStatus osThreadList (uint8_t *buffer);
1008 
1009 /**
1010 * @brief Receive an item from a queue without removing the item from the queue.
1011 * @param queue_id message queue ID obtained with \ref osMessageCreate.
1012 * @param millisec timeout value or 0 in case of no time-out.
1013 * @retval event information that includes status code.
1014 */
1015 osEvent osMessagePeek (osMessageQId queue_id, uint32_t millisec);
1016 
1017 /**
1018 * @brief Get the number of messaged stored in a queue.
1019 * @param queue_id message queue ID obtained with \ref osMessageCreate.
1020 * @retval number of messages stored in a queue.
1021 */
1022 uint32_t osMessageWaiting(osMessageQId queue_id);
1023 
1024 /**
1025 * @brief Get the available space in a message queue.
1026 * @param queue_id message queue ID obtained with \ref osMessageCreate.
1027 * @retval available space in a message queue.
1028 */
1029 uint32_t osMessageAvailableSpace(osMessageQId queue_id);
1030 
1031 /**
1032 * @brief Delete a Message Queue
1033 * @param queue_id message queue ID obtained with \ref osMessageCreate.
1034 * @retval status code that indicates the execution status of the function.
1035 */
1037 
1038 /**
1039 * @brief Create and Initialize a Recursive Mutex
1040 * @param mutex_def mutex definition referenced with \ref osMutex.
1041 * @retval mutex ID for reference by other functions or NULL in case of error..
1042 */
1043 osMutexId osRecursiveMutexCreate (const osMutexDef_t *mutex_def);
1044 
1045 /**
1046 * @brief Release a Recursive Mutex
1047 * @param mutex_id mutex ID obtained by \ref osRecursiveMutexCreate.
1048 * @retval status code that indicates the execution status of the function.
1049 */
1051 
1052 /**
1053 * @brief Release a Recursive Mutex
1054 * @param mutex_id mutex ID obtained by \ref osRecursiveMutexCreate.
1055 * @param millisec timeout value or 0 in case of no time-out.
1056 * @retval status code that indicates the execution status of the function.
1057 */
1058 osStatus osRecursiveMutexWait (osMutexId mutex_id, uint32_t millisec);
1059 
1060 /**
1061 * @brief Returns the current count value of a counting semaphore
1062 * @param semaphore_id semaphore_id ID obtained by \ref osSemaphoreCreate.
1063 * @retval count value
1064 */
1065 uint32_t osSemaphoreGetCount(osSemaphoreId semaphore_id);
1066 
1067 #ifdef __cplusplus
1068 }
1069 #endif
1070 
1071 #endif // _CMSIS_OS_H
osTimerStart
osStatus osTimerStart(osTimerId timer_id, uint32_t millisec)
Start or restart a timer.
Definition: cmsis_os.c:447
os_pool_cb::pool
void * pool
Definition: cmsis_os.c:912
ff_wtoupper
WCHAR ff_wtoupper(WCHAR chr)
Definition: ccsbcs.c:303
ccsbcs.c
osMessageDelete
osStatus osMessageDelete(osMessageQId queue_id)
Delete a Message Queue.
Definition: cmsis_os.c:1668
os_mailQ_cb::handle
QueueHandle_t handle
Definition: cmsis_os.c:1203
os_thread_def::tpriority
osPriority tpriority
initial thread priority
Definition: cmsis_os.h:328
os_mailQ_cb::pool
osPoolId pool
Definition: cmsis_os.c:1204
osSignalWait
osEvent osSignalWait(int32_t signals, uint32_t millisec)
Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
Definition: cmsis_os.c:586
os_mailQ_cb::queue_def
const osMailQDef_t * queue_def
Definition: cmsis_os.c:1202
os_mailQ_def
Definition: cmsis_os.h:386
osSemaphoreGetCount
uint32_t osSemaphoreGetCount(osSemaphoreId semaphore_id)
Returns the current count value of a counting semaphore.
Definition: cmsis_os.c:1770
osThreadList
osStatus osThreadList(uint8_t *buffer)
Lists all the current threads, along with their current state and stack usage high water mark.
Definition: cmsis_os.c:1587
osMailCAlloc
void * osMailCAlloc(osMailQId queue_id, uint32_t millisec)
Allocate a memory block from a mail and set memory block to zero.
Definition: cmsis_os.c:1282
os_mailQ_cb
Definition: cmsis_os.c:1201
portMAX_DELAY
#define portMAX_DELAY
Definition: portmacro.h:106
task.h
osMutexRelease
osStatus osMutexRelease(osMutexId mutex_id)
Release a Mutex that was obtained by osMutexWait.
Definition: cmsis_os.c:709
osKernelSysTick
uint32_t osKernelSysTick(void)
Get the value of the Kernel SysTick timer.
Definition: cmsis_os.c:227
osMutexDelete
osStatus osMutexDelete(osMutexId mutex_id)
Delete a Mutex.
Definition: cmsis_os.c:733
osKernelStart
osStatus osKernelStart(void)
Start the RTOS Kernel with executing the specified thread.
Definition: cmsis_os.c:193
osMessageAvailableSpace
uint32_t osMessageAvailableSpace(osMessageQId queue_id)
Get the available space in a message queue.
Definition: cmsis_os.c:1658
portSET_INTERRUPT_MASK_FROM_ISR
#define portSET_INTERRUPT_MASK_FROM_ISR()
Definition: FreeRTOS.h:300
osTimerDef_t
struct os_timer_def osTimerDef_t
xTaskGenericNotifyFromISR
PRIVILEGED_FUNCTION BaseType_t xTaskGenericNotifyFromISR(TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken)
xTaskGetSchedulerState
PRIVILEGED_FUNCTION BaseType_t xTaskGetSchedulerState(void)
osPoolId
struct os_pool_cb * osPoolId
Definition: cmsis_os.h:299
event_groups.h
osKernelSysTick
uint32_t osKernelSysTick(void)
Get the value of the Kernel SysTick timer.
Definition: cmsis_os.c:227
osThreadId
TaskHandle_t osThreadId
Definition: cmsis_os.h:283
osMessagePeek
osEvent osMessagePeek(osMessageQId queue_id, uint32_t millisec)
Receive an item from a queue without removing the item from the queue.
Definition: cmsis_os.c:1601
xTaskNotifyWait
PRIVILEGED_FUNCTION BaseType_t xTaskNotifyWait(uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait)
osSemaphore
#define osSemaphore(name)
Definition: cmsis_os.h:709
osSemaphoreWait
int32_t osSemaphoreWait(osSemaphoreId semaphore_id, uint32_t millisec)
Wait until a Semaphore token becomes available.
Definition: cmsis_os.c:822
osPriorityAboveNormal
priority: above normal
Definition: cmsis_os.h:222
xTaskGenericNotify
PRIVILEGED_FUNCTION BaseType_t xTaskGenericNotify(TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue)
uxQueueSpacesAvailable
PRIVILEGED_FUNCTION UBaseType_t uxQueueSpacesAvailable(const QueueHandle_t xQueue)
Definition: queue.c:1595
eTaskState
eTaskState
Definition: task.h:112
vTaskStartScheduler
PRIVILEGED_FUNCTION void vTaskStartScheduler(void)
Definition: tasks.c:1826
osSignalSet
int32_t osSignalSet(osThreadId thread_id, int32_t signals)
Set the specified Signal Flags of an active thread.
Definition: cmsis_os.c:545
os_mailQ_cb_t
struct os_mailQ_cb os_mailQ_cb_t
osPoolDef_t
struct os_pool_def osPoolDef_t
pvPortMalloc
PRIVILEGED_FUNCTION void * pvPortMalloc(size_t xSize)
Definition: heap_4.c:155
osThreadCreate
osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *argument)
Create a thread and add it to Active Threads and set it to state READY.
Definition: cmsis_os.c:245
os_mailQ_def::item_sz
uint32_t item_sz
size of an item
Definition: cmsis_os.h:388
osPoolAlloc
void * osPoolAlloc(osPoolId pool_id)
Allocate a memory block from a memory pool.
Definition: cmsis_os.c:979
osMailPut
osStatus osMailPut(osMailQId queue_id, void *mail)
Put a mail to a queue.
Definition: cmsis_os.c:1303
type
uint8_t type
Definition: UsbCore.h:184
osMessageCreate
osMessageQId osMessageCreate(const osMessageQDef_t *queue_def, osThreadId thread_id)
Create and Initialize a Message Queue.
Definition: cmsis_os.c:1086
osMailFree
osStatus osMailFree(osMailQId queue_id, void *mail)
Free a memory block from a mail.
Definition: cmsis_os.c:1392
xSemaphoreTake
#define xSemaphoreTake(xSemaphore, xBlockTime)
Definition: semphr.h:331
osSemaphoreDef_t
struct os_semaphore_def osSemaphoreDef_t
osThreadResumeAll
osStatus osThreadResumeAll(void)
Resume execution of a all suspended threads.
Definition: cmsis_os.c:1529
osThreadResume
osStatus osThreadResume(osThreadId thread_id)
Resume execution of a suspended thread.
Definition: cmsis_os.c:1494
osKernelInitialize
osStatus osKernelInitialize(void)
Initialize the RTOS Kernel for creating objects.
ff_free
#define ff_free
Definition: ffconf.h:302
osStatus
osStatus
Definition: cmsis_os.h:234
os_thread_def::stacksize
uint32_t stacksize
stack size requirements in bytes; 0 is default stack size
Definition: cmsis_os.h:330
os_pool_cb::item_sz
uint32_t item_sz
Definition: cmsis_os.c:915
osEventTimeout
function completed; timeout occurred.
Definition: cmsis_os.h:239
xTaskGetTickCountFromISR
PRIVILEGED_FUNCTION TickType_t xTaskGetTickCountFromISR(void)
Definition: tasks.c:2142
xSemaphoreTakeFromISR
#define xSemaphoreTakeFromISR(xSemaphore, pxHigherPriorityTaskWoken)
Definition: semphr.h:700
i
uint8_t i
Definition: screen_test_graph.c:72
xTimerStopFromISR
#define xTimerStopFromISR(xTimer, pxHigherPriorityTaskWoken)
Definition: timers.h:978
os_mutex_def
Definition: cmsis_os.h:348
TimerHandle_t
void * TimerHandle_t
Definition: timers.h:118
osMessagePeek
osEvent osMessagePeek(osMessageQId queue_id, uint32_t millisec)
Receive an item from a queue without removing the item from the queue.
Definition: cmsis_os.c:1601
osRecursiveMutexWait
osStatus osRecursiveMutexWait(osMutexId mutex_id, uint32_t millisec)
Release a Recursive Mutex.
Definition: cmsis_os.c:1731
osErrorISR
not allowed in ISR context: the function cannot be called from interrupt service routines.
Definition: cmsis_os.h:243
xTaskGetTickCount
PRIVILEGED_FUNCTION TickType_t xTaskGetTickCount(void)
Definition: tasks.c:2127
osPriorityIdle
priority: idle (lowest)
Definition: cmsis_os.h:218
osSignalSet
int32_t osSignalSet(osThreadId thread_id, int32_t signal)
Set the specified Signal Flags of an active thread.
Definition: cmsis_os.c:545
osPoolCAlloc
void * osPoolCAlloc(osPoolId pool_id)
Allocate a memory block from a memory pool and set memory block to zero.
Definition: cmsis_os.c:1023
osSignalClear
int32_t osSignalClear(osThreadId thread_id, int32_t signal)
Clear the specified Signal Flags of an active thread.
osErrorTimeoutResource
resource not available within given time: a specified resource was not available within the timeout p...
Definition: cmsis_os.h:242
osPoolCreate
osPoolId osPoolCreate(const osPoolDef_t *pool_def)
Create and Initialize a memory pool.
Definition: cmsis_os.c:926
osThreadList
osStatus osThreadList(uint8_t *buffer)
Lists all the current threads, along with their current state and stack usage high water mark.
Definition: cmsis_os.c:1587
osMutexRelease
osStatus osMutexRelease(osMutexId mutex_id)
Release a Mutex that was obtained by osMutexWait.
Definition: cmsis_os.c:709
osKernelStart
osStatus osKernelStart(void)
Start the RTOS Kernel with executing the specified thread.
Definition: cmsis_os.c:193
osMessageAvailableSpace
uint32_t osMessageAvailableSpace(osMessageQId queue_id)
Get the available space in a message queue.
Definition: cmsis_os.c:1658
eTaskGetState
PRIVILEGED_FUNCTION eTaskState eTaskGetState(TaskHandle_t xTask)
osTimerDelete
osStatus osTimerDelete(osTimerId timer_id)
Delete a timer.
Definition: cmsis_os.c:515
os_semaphore_def::dummy
uint32_t dummy
dummy value.
Definition: cmsis_os.h:358
xSemaphoreGiveFromISR
#define xSemaphoreGiveFromISR(xSemaphore, pxHigherPriorityTaskWoken)
Definition: semphr.h:666
osMailGet
osEvent osMailGet(osMailQId queue_id, uint32_t millisec)
Get a mail from a queue.
Definition: cmsis_os.c:1336
_FS_TIMEOUT
#define _FS_TIMEOUT
Definition: ffconf.h:279
eSetBits
Definition: task.h:126
osRecursiveMutexCreate
osMutexId osRecursiveMutexCreate(const osMutexDef_t *mutex_def)
Create and Initialize a Recursive Mutex.
Definition: cmsis_os.c:1684
osMailQDef_t
struct os_mailQ_def osMailQDef_t
eRunning
Definition: task.h:114
osThreadGetId
osThreadId osThreadGetId(void)
Return the thread ID of the current running thread.
Definition: cmsis_os.c:283
os_semaphore_def
Definition: cmsis_os.h:357
xTimerStop
#define xTimerStop(xTimer, xTicksToWait)
Definition: timers.h:587
osThreadGetPriority
osPriority osThreadGetPriority(osThreadId thread_id)
Get current priority of an active thread.
Definition: cmsis_os.c:343
NULL
#define NULL
Definition: usbd_def.h:53
osDelayUntil
osStatus osDelayUntil(uint32_t *PreviousWakeTime, uint32_t millisec)
Delay a task until a specified time.
Definition: cmsis_os.c:1546
ff_malloc
#define ff_malloc
Definition: ffconf.h:301
osEvent::status
osStatus status
status code: event or error information
Definition: cmsis_os.h:396
osSemaphoreDelete
osStatus osSemaphoreDelete(osSemaphoreId semaphore_id)
Delete a Semaphore.
Definition: cmsis_os.c:889
vPortEnterCritical
void vPortEnterCritical(void)
Definition: port.c:407
osThreadResumeAll
osStatus osThreadResumeAll(void)
Resume execution of a all suspended threads.
Definition: cmsis_os.c:1529
vTaskSuspend
PRIVILEGED_FUNCTION void vTaskSuspend(TaskHandle_t xTaskToSuspend)
pdPASS
#define pdPASS
Definition: projdefs.h:89
osMessageQId
QueueHandle_t osMessageQId
Definition: cmsis_os.h:303
osMessageGet
osEvent osMessageGet(osMessageQId queue_id, uint32_t millisec)
Get a Message or Wait for a Message from a Queue.
Definition: cmsis_os.c:1145
eDeleted
Definition: task.h:118
osTimerStop
osStatus osTimerStop(osTimerId timer_id)
Stop a timer.
Definition: cmsis_os.c:486
os_status_reserved
prevent from enum down-size compiler optimization.
Definition: cmsis_os.h:249
xTaskAbortDelay
PRIVILEGED_FUNCTION BaseType_t xTaskAbortDelay(TaskHandle_t xTask)
os_pool_cb::currentIndex
uint32_t currentIndex
Definition: cmsis_os.c:916
xSTATIC_QUEUE
Definition: FreeRTOS.h:968
osDelay
osStatus osDelay(uint32_t millisec)
Wait for Timeout (Time Delay)
Definition: cmsis_os.c:365
TickType_t
uint32_t TickType_t
Definition: portmacro.h:105
osErrorResource
resource not available: a specified resource was not available.
Definition: cmsis_os.h:241
osErrorISRRecursive
function called multiple times from ISR with same object.
Definition: cmsis_os.h:244
osSemaphoreId
SemaphoreHandle_t osSemaphoreId
Definition: cmsis_os.h:295
osThreadDef_t
struct os_thread_def osThreadDef_t
osPoolCAlloc
void * osPoolCAlloc(osPoolId pool_id)
Allocate a memory block from a memory pool and set memory block to zero.
Definition: cmsis_os.c:1023
osEventMail
function completed; mail event occurred.
Definition: cmsis_os.h:238
osPoolAlloc
void * osPoolAlloc(osPoolId pool_id)
Allocate a memory block from a memory pool.
Definition: cmsis_os.c:979
osMutexWait
osStatus osMutexWait(osMutexId mutex_id, uint32_t millisec)
Wait until a Mutex becomes available.
Definition: cmsis_os.c:669
xTaskResumeFromISR
PRIVILEGED_FUNCTION BaseType_t xTaskResumeFromISR(TaskHandle_t xTaskToResume)
osEvent
Definition: cmsis_os.h:395
osMutexCreate
osMutexId osMutexCreate(const osMutexDef_t *mutex_def)
Create and Initialize a Mutex object.
Definition: cmsis_os.c:640
osSemaphoreCreate
osSemaphoreId osSemaphoreCreate(const osSemaphoreDef_t *semaphore_def, int32_t count)
Create and Initialize a Semaphore object used for managing resources.
Definition: cmsis_os.c:755
osMailFree
osStatus osMailFree(osMailQId queue_id, void *mail)
Free a memory block from a mail.
Definition: cmsis_os.c:1392
osSemaphoreDef
#define osSemaphoreDef(name)
Definition: cmsis_os.h:700
osThreadYield
osStatus osThreadYield(void)
Pass control to next thread that is in state READY.
Definition: cmsis_os.c:313
osMessageWaiting
uint32_t osMessageWaiting(osMessageQId queue_id)
Get the number of messaged stored in a queue.
Definition: cmsis_os.c:1642
TaskHandle_t
void * TaskHandle_t
Definition: task.h:103
osSignalWait
osEvent osSignalWait(int32_t signals, uint32_t millisec)
Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
Definition: cmsis_os.c:586
osMessageQDef_t
struct os_messageQ_def osMessageQDef_t
eReady
Definition: task.h:115
osRecursiveMutexCreate
osMutexId osRecursiveMutexCreate(const osMutexDef_t *mutex_def)
Create and Initialize a Recursive Mutex.
Definition: cmsis_os.c:1684
osThreadResume
osStatus osThreadResume(osThreadId thread_id)
Resume execution of a suspended thread.
Definition: cmsis_os.c:1494
osPoolFree
osStatus osPoolFree(osPoolId pool_id, void *block)
Return an allocated memory block back to a specific memory pool.
Definition: cmsis_os.c:1042
osPriorityError
system cannot determine priority or thread has illegal priority
Definition: cmsis_os.h:225
_SYNC_t
#define _SYNC_t
Definition: ffconf.h:280
pdFALSE
#define pdFALSE
Definition: projdefs.h:86
osMutexDef_t
struct os_mutex_def osMutexDef_t
vTaskDelete
PRIVILEGED_FUNCTION void vTaskDelete(TaskHandle_t xTaskToDelete)
osMailCAlloc
void * osMailCAlloc(osMailQId queue_id, uint32_t millisec)
Allocate a memory block from a mail and set memory block to zero.
Definition: cmsis_os.c:1282
os_pool_def::pool_sz
uint32_t pool_sz
number of items (elements) in the pool
Definition: cmsis_os.h:367
osMessagePut
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a Message to a Queue.
Definition: cmsis_os.c:1113
xTimerChangePeriod
#define xTimerChangePeriod(xTimer, xNewPeriod, xTicksToWait)
Definition: timers.h:667
osThreadSetPriority
osStatus osThreadSetPriority(osThreadId thread_id, osPriority priority)
Change priority of an active thread.
Definition: cmsis_os.c:327
osRecursiveMutexWait
osStatus osRecursiveMutexWait(osMutexId mutex_id, uint32_t millisec)
Release a Recursive Mutex.
Definition: cmsis_os.c:1731
uxQueueMessagesWaitingFromISR
PRIVILEGED_FUNCTION UBaseType_t uxQueueMessagesWaitingFromISR(const QueueHandle_t xQueue)
Definition: queue.c:1613
osEvent::def
union osEvent::@55 def
event definition
xSTATIC_TIMER
Definition: FreeRTOS.h:1041
os_pool_cb_t
struct os_pool_cb os_pool_cb_t
uxSemaphoreGetCount
#define uxSemaphoreGetCount(xSemaphore)
Definition: semphr.h:1167
xTimerDelete
#define xTimerDelete(xTimer, xTicksToWait)
Definition: timers.h:705
os_pool_def
Definition: cmsis_os.h:366
xTaskGetCurrentTaskHandle
PRIVILEGED_FUNCTION TaskHandle_t xTaskGetCurrentTaskHandle(void)
osPoolCreate
osPoolId osPoolCreate(const osPoolDef_t *pool_def)
Create and Initialize a memory pool.
Definition: cmsis_os.c:926
osOK
function completed; no error or event occurred.
Definition: cmsis_os.h:235
portYIELD_FROM_ISR
#define portYIELD_FROM_ISR(x)
Definition: portmacro.h:135
uxTaskPriorityGet
PRIVILEGED_FUNCTION UBaseType_t uxTaskPriorityGet(TaskHandle_t xTask)
osDelay
osStatus osDelay(uint32_t millisec)
Wait for Timeout (Time Delay)
Definition: cmsis_os.c:365
osMessagePut
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a Message to a Queue.
Definition: cmsis_os.c:1113
osThreadSetPriority
osStatus osThreadSetPriority(osThreadId thread_id, osPriority priority)
Change priority of an active thread.
Definition: cmsis_os.c:327
void
void
Definition: png.h:1083
osThreadSuspendAll
osStatus osThreadSuspendAll(void)
Suspend execution of a all active threads.
Definition: cmsis_os.c:1518
osEventMessage
function completed; message event occurred.
Definition: cmsis_os.h:237
osThreadSuspend
osStatus osThreadSuspend(osThreadId thread_id)
Suspend execution of a thread.
Definition: cmsis_os.c:1478
SemaphoreHandle_t
QueueHandle_t SemaphoreHandle_t
Definition: semphr.h:79
osMailGet
osEvent osMailGet(osMailQId queue_id, uint32_t millisec)
Get a mail from a queue.
Definition: cmsis_os.c:1336
osKernelRunning
int32_t osKernelRunning(void)
Check if the RTOS kernel is already started.
Definition: cmsis_os.c:208
vQueueDelete
PRIVILEGED_FUNCTION void vQueueDelete(QueueHandle_t xQueue)
Definition: queue.c:1625
vTaskResume
PRIVILEGED_FUNCTION void vTaskResume(TaskHandle_t xTaskToResume)
xQueueReceiveFromISR
PRIVILEGED_FUNCTION BaseType_t xQueueReceiveFromISR(QueueHandle_t xQueue, void *const pvBuffer, BaseType_t *const pxHigherPriorityTaskWoken)
Definition: queue.c:1434
osMailCreate
osMailQId osMailCreate(const osMailQDef_t *queue_def, osThreadId thread_id)
Create and Initialize mail queue.
Definition: cmsis_os.c:1214
portBASE_TYPE
#define portBASE_TYPE
Definition: portmacro.h:95
osSemaphoreCreate
osSemaphoreId osSemaphoreCreate(const osSemaphoreDef_t *semaphore_def, int32_t count)
Create and Initialize a Semaphore object used for managing resources.
Definition: cmsis_os.c:755
osThreadGetPriority
osPriority osThreadGetPriority(osThreadId thread_id)
Get current priority of an active thread.
Definition: cmsis_os.c:343
vSemaphoreDelete
#define vSemaphoreDelete(xSemaphore)
Definition: semphr.h:1140
osSemaphoreDelete
osStatus osSemaphoreDelete(osSemaphoreId semaphore_id)
Delete a Semaphore.
Definition: cmsis_os.c:889
taskSCHEDULER_NOT_STARTED
#define taskSCHEDULER_NOT_STARTED
Definition: task.h:258
os_thread_def
Definition: cmsis_os.h:325
osMessageWaiting
uint32_t osMessageWaiting(osMessageQId queue_id)
Get the number of messaged stored in a queue.
Definition: cmsis_os.c:1642
osThreadSuspend
osStatus osThreadSuspend(osThreadId thread_id)
Suspend execution of a thread.
Definition: cmsis_os.c:1478
osWaitForever
#define osWaitForever
wait forever timeout value
Definition: cmsis_os.h:230
taskYIELD
#define taskYIELD()
Definition: task.h:203
osMessageDelete
osStatus osMessageDelete(osMessageQId queue_id)
Delete a Message Queue.
Definition: cmsis_os.c:1668
osTimerStop
osStatus osTimerStop(osTimerId timer_id)
Stop a timer.
Definition: cmsis_os.c:486
os_thread_def::name
char * name
Thread name.
Definition: cmsis_os.h:326
xQueueSendFromISR
#define xQueueSendFromISR(xQueue, pvItemToQueue, pxHigherPriorityTaskWoken)
Definition: queue.h:1361
xSTATIC_TCB
Definition: FreeRTOS.h:910
osMailCreate
osMailQId osMailCreate(const osMailQDef_t *queue_def, osThreadId thread_id)
Create and Initialize mail queue.
Definition: cmsis_os.c:1214
os_thread_def::pthread
os_pthread pthread
start address of thread function
Definition: cmsis_os.h:327
makeFreeRtosPriority
static unsigned portBASE_TYPE makeFreeRtosPriority(osPriority priority)
Definition: cmsis_os.c:146
TaskFunction_t
void(* TaskFunction_t)(void *)
Definition: projdefs.h:77
portTICK_PERIOD_MS
#define portTICK_PERIOD_MS
Definition: portmacro.h:116
FreeRTOS.h
uint8_t
const uint8_t[]
Definition: 404_html.c:3
osPriorityRealtime
priority: realtime (highest)
Definition: cmsis_os.h:224
vTaskPrioritySet
PRIVILEGED_FUNCTION void vTaskPrioritySet(TaskHandle_t xTask, UBaseType_t uxNewPriority)
os_pool_cb::markers
uint8_t * markers
Definition: cmsis_os.c:913
osPriorityBelowNormal
priority: below normal
Definition: cmsis_os.h:220
osMailAlloc
void * osMailAlloc(osMailQId queue_id, uint32_t millisec)
Allocate a memory block from a mail.
Definition: cmsis_os.c:1260
QueueHandle_t
void * QueueHandle_t
Definition: queue.h:88
osErrorPriority
system cannot determine priority or thread has illegal priority.
Definition: cmsis_os.h:245
os_pthread
void(* os_pthread)(void const *argument)
Definition: cmsis_os.h:273
osPoolFree
osStatus osPoolFree(osPoolId pool_id, void *block)
Return an allocated memory block back to a specific memory pool.
Definition: cmsis_os.c:1042
osMailAlloc
void * osMailAlloc(osMailQId queue_id, uint32_t millisec)
Allocate a memory block from a mail.
Definition: cmsis_os.c:1260
osEventSignal
function completed; signal event occurred.
Definition: cmsis_os.h:236
osPriorityHigh
priority: high
Definition: cmsis_os.h:223
osSystickHandler
void osSystickHandler(void)
Handles the tick increment.
Definition: cmsis_os.c:1408
osMailQId
struct os_mailQ_cb * osMailQId
Definition: cmsis_os.h:307
osPriorityLow
priority: low
Definition: cmsis_os.h:219
osEvent::mail_id
osMailQId mail_id
mail id obtained by osMailCreate
Definition: cmsis_os.h:403
os_pool_def::pool
void * pool
pointer to memory for pool
Definition: cmsis_os.h:369
osTimerCreate
osTimerId osTimerCreate(const osTimerDef_t *timer_def, os_timer_type type, void *argument)
Create a timer.
Definition: cmsis_os.c:400
uxQueueMessagesWaiting
PRIVILEGED_FUNCTION UBaseType_t uxQueueMessagesWaiting(const QueueHandle_t xQueue)
Definition: queue.c:1579
portEND_SWITCHING_ISR
#define portEND_SWITCHING_ISR(xSwitchRequired)
Definition: portmacro.h:134
eSuspended
Definition: task.h:117
osThreadGetId
osThreadId osThreadGetId(void)
Return the thread ID of the current running thread.
Definition: cmsis_os.c:283
osErrorOS
unspecified RTOS error: run-time error but no other error message fits.
Definition: cmsis_os.h:248
os_mailQ_def::cb
struct os_mailQ_cb ** cb
Definition: cmsis_os.h:389
osDelayUntil
osStatus osDelayUntil(uint32_t *PreviousWakeTime, uint32_t millisec)
Delay a task until a specified time.
Definition: cmsis_os.c:1546
BaseType_t
long BaseType_t
Definition: portmacro.h:98
pdTRUE
#define pdTRUE
Definition: projdefs.h:87
osThreadTerminate
osStatus osThreadTerminate(osThreadId thread_id)
Terminate execution of a thread and remove it from Active Threads.
Definition: cmsis_os.c:298
osSystickHandler
void osSystickHandler(void)
Handles the tick increment.
Definition: cmsis_os.c:1408
osThreadSuspendAll
osStatus osThreadSuspendAll(void)
Suspend execution of a all active threads.
Definition: cmsis_os.c:1518
osKernelRunning
int32_t osKernelRunning(void)
Check if the RTOS kernel is already started.
Definition: cmsis_os.c:208
osErrorParameter
parameter error: a mandatory parameter was missing or specified an incorrect object.
Definition: cmsis_os.h:240
osTimerCreate
osTimerId osTimerCreate(const osTimerDef_t *timer_def, os_timer_type type, void *argument)
Create a timer.
Definition: cmsis_os.c:400
osErrorValue
value of a parameter is out of range.
Definition: cmsis_os.h:247
vTaskDelay
PRIVILEGED_FUNCTION void vTaskDelay(const TickType_t xTicksToDelay)
osTimerStart
osStatus osTimerStart(osTimerId timer_id, uint32_t millisec)
Start or restart a timer.
Definition: cmsis_os.c:447
osErrorNoMemory
system is out of memory: it was impossible to allocate or reserve memory for the operation.
Definition: cmsis_os.h:246
os_pool_def::item_sz
uint32_t item_sz
size of an item
Definition: cmsis_os.h:368
xTaskResumeAll
PRIVILEGED_FUNCTION BaseType_t xTaskResumeAll(void)
Definition: tasks.c:2017
xTimerChangePeriodFromISR
#define xTimerChangePeriodFromISR(xTimer, xNewPeriod, pxHigherPriorityTaskWoken)
Definition: timers.h:1051
xPortSysTickHandler
void xPortSysTickHandler(void)
Definition: port.c:493
osMessageGet
osEvent osMessageGet(osMessageQId queue_id, uint32_t millisec)
Get a Message or Wait for a Message from a Queue.
Definition: cmsis_os.c:1145
os_mutex_def::dummy
uint32_t dummy
dummy value.
Definition: cmsis_os.h:349
osMailPut
osStatus osMailPut(osMailQId queue_id, void *mail)
Put a mail to a queue.
Definition: cmsis_os.c:1303
osRecursiveMutexRelease
osStatus osRecursiveMutexRelease(osMutexId mutex_id)
Release a Recursive Mutex.
Definition: cmsis_os.c:1710
os_ptimer
void(* os_ptimer)(void const *argument)
Definition: cmsis_os.h:277
vPortFree
PRIVILEGED_FUNCTION void vPortFree(void *pv)
Definition: heap_4.c:305
BYTE
unsigned char BYTE
Definition: onboard_sd.h:13
osAbortDelay
osStatus osAbortDelay(osThreadId thread_id)
Abort the delay for a specific thread.
Definition: cmsis_os.c:1566
osMessageCreate
osMessageQId osMessageCreate(const osMessageQDef_t *queue_def, osThreadId thread_id)
Create and Initialize a Message Queue.
Definition: cmsis_os.c:1086
ff_convert
WCHAR ff_convert(WCHAR chr, UINT dir)
Definition: ccsbcs.c:275
createSpeedLookupTable.int
int
Definition: createSpeedLookupTable.py:15
osKernelInitialize
osStatus osKernelInitialize(void)
osMutexWait
osStatus osMutexWait(osMutexId mutex_id, uint32_t millisec)
Wait until a Mutex becomes available.
Definition: cmsis_os.c:669
osMutexCreate
osMutexId osMutexCreate(const osMutexDef_t *mutex_def)
Create and Initialize a Mutex object.
Definition: cmsis_os.c:640
osSemaphoreRelease
osStatus osSemaphoreRelease(osSemaphoreId semaphore_id)
Release a Semaphore token.
Definition: cmsis_os.c:862
osRecursiveMutexRelease
osStatus osRecursiveMutexRelease(osMutexId mutex_id)
Release a Recursive Mutex.
Definition: cmsis_os.c:1710
osMutexDelete
osStatus osMutexDelete(osMutexId mutex_id)
Delete a Mutex.
Definition: cmsis_os.c:733
osAbortDelay
osStatus osAbortDelay(osThreadId thread_id)
Abort the delay for a specific thread.
Definition: cmsis_os.c:1566
osMutexId
SemaphoreHandle_t osMutexId
Definition: cmsis_os.h:291
osEvent::value
union osEvent::@54 value
event value
osThreadYield
osStatus osThreadYield(void)
Pass control to next thread that is in state READY.
Definition: cmsis_os.c:313
portCLEAR_INTERRUPT_MASK_FROM_ISR
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(uxSavedStatusValue)
Definition: FreeRTOS.h:304
osTimerPeriodic
repeating timer
Definition: cmsis_os.h:268
os_timer_type
os_timer_type
Definition: cmsis_os.h:266
osTimerId
TimerHandle_t osTimerId
Definition: cmsis_os.h:287
os_pool_cb
Definition: cmsis_os.c:911
WCHAR
unsigned short WCHAR
Definition: integer.h:27
os_timer_def
Definition: cmsis_os.h:339
inHandlerMode
static int inHandlerMode(void)
Definition: cmsis_os.c:173
vPortExitCritical
void vPortExitCritical(void)
Definition: port.c:424
os_mailQ_def::queue_sz
uint32_t queue_sz
number of elements in the queue
Definition: cmsis_os.h:387
portCHAR
#define portCHAR
Definition: portmacro.h:89
osThreadTerminate
osStatus osThreadTerminate(osThreadId thread_id)
Terminate execution of a thread and remove it from Active Threads.
Definition: cmsis_os.c:298
osTimerDelete
osStatus osTimerDelete(osTimerId timer_id)
Delete a timer.
Definition: cmsis_os.c:515
os_timer_def::ptimer
os_ptimer ptimer
start address of a timer function
Definition: cmsis_os.h:340
osSemaphoreWait
int32_t osSemaphoreWait(osSemaphoreId semaphore_id, uint32_t millisec)
Wait until a Semaphore token becomes available.
Definition: cmsis_os.c:822
osEvent::v
uint32_t v
message as 32-bit value
Definition: cmsis_os.h:398
osPriorityNormal
priority: normal (default)
Definition: cmsis_os.h:221
os_messageQ_def
Definition: cmsis_os.h:374
osSemaphoreGetCount
uint32_t osSemaphoreGetCount(osSemaphoreId semaphore_id)
Returns the current count value of a counting semaphore.
Definition: cmsis_os.c:1770
xQueueSend
#define xQueueSend(xQueue, pvItemToQueue, xTicksToWait)
Definition: queue.h:521
vTaskSuspendAll
PRIVILEGED_FUNCTION void vTaskSuspendAll(void)
Definition: tasks.c:1944
os_pool_cb::pool_sz
uint32_t pool_sz
Definition: cmsis_os.c:914
semphr.h
osPriority
osPriority
Definition: cmsis_os.h:217
cmsis_os.h
Header of cmsis_os.c A new set of APIs are added in addition to existing ones, these APIs are specifi...
osEvent::message_id
osMessageQId message_id
message id obtained by osMessageCreate
Definition: cmsis_os.h:404
UINT
unsigned int UINT
Definition: onboard_sd.h:16
xSemaphoreGive
#define xSemaphoreGive(xSemaphore)
Definition: semphr.h:489
os_messageQ_def::queue_sz
uint32_t queue_sz
number of elements in the queue
Definition: cmsis_os.h:375
os_messageQ_def::item_sz
uint32_t item_sz
size of an item
Definition: cmsis_os.h:376
osTimerOnce
one-shot timer
Definition: cmsis_os.h:267
osSignalClear
int32_t osSignalClear(osThreadId thread_id, int32_t signals)
osThreadCreate
osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *argument)
Create a thread and add it to Active Threads and set it to state READY.
Definition: cmsis_os.c:245
xQueueReceive
#define xQueueReceive(xQueue, pvBuffer, xTicksToWait)
Definition: queue.h:914
os_thread_def::instances
uint32_t instances
maximum number of instances of that thread function
Definition: cmsis_os.h:329
osEvent::p
void * p
message or mail as void pointer
Definition: cmsis_os.h:399
vTaskList
PRIVILEGED_FUNCTION void vTaskList(char *pcWriteBuffer)
osSemaphoreRelease
osStatus osSemaphoreRelease(osSemaphoreId semaphore_id)
Release a Semaphore token.
Definition: cmsis_os.c:862
vTaskDelayUntil
PRIVILEGED_FUNCTION void vTaskDelayUntil(TickType_t *const pxPreviousWakeTime, const TickType_t xTimeIncrement)
tskIDLE_PRIORITY
#define tskIDLE_PRIORITY
Definition: task.h:193
eBlocked
Definition: task.h:116
xQueuePeek
#define xQueuePeek(xQueue, pvBuffer, xTicksToWait)
Definition: queue.h:788
osEvent::signals
int32_t signals
signal flags
Definition: cmsis_os.h:400
uxTaskPriorityGetFromISR
PRIVILEGED_FUNCTION UBaseType_t uxTaskPriorityGetFromISR(TaskHandle_t xTask)
info
uint8_t info[12]
Definition: masstorage.h:54