µOS++ IIIe Reference  v6.3.15
“Perfekt ist nicht gut genug”
The third edition of µOS++, a POSIX inspired open source system, written in C++.
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 template 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 behaviour
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  * Copyright (c) 2013 ARM LIMITED
28  * All rights reserved.
29  * Redistribution and use in source and binary forms, with or without
30  * modification, are permitted provided that the following conditions are met:
31  * - Redistributions of source code must retain the above copyright
32  * notice, this list of conditions and the following disclaimer.
33  * - Redistributions in binary form must reproduce the above copyright
34  * notice, this list of conditions and the following disclaimer in the
35  * documentation and/or other materials provided with the distribution.
36  * - Neither the name of ARM nor the names of its contributors may be used
37  * to endorse or promote products derived from this software without
38  * specific prior written permission.
39  *
40  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
41  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43  * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
44  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
45  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
46  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
47  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
48  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
50  * POSSIBILITY OF SUCH DAMAGE.
51  *---------------------------------------------------------------------------*/
52 
53 /*
54  * This file is part of the µOS++ distribution.
55  * (https://github.com/micro-os-plus)
56  * Copyright (c) 2016 Liviu Ionescu.
57  *
58  * Permission is hereby granted, free of charge, to any person
59  * obtaining a copy of this software and associated documentation
60  * files (the "Software"), to deal in the Software without
61  * restriction, including without limitation the rights to use,
62  * copy, modify, merge, publish, distribute, sublicense, and/or
63  * sell copies of the Software, and to permit persons to whom
64  * the Software is furnished to do so, subject to the following
65  * conditions:
66  *
67  * The above copyright notice and this permission notice shall be
68  * included in all copies or substantial portions of the Software.
69  *
70  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
71  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
72  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
73  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
74  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
75  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
76  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
77  * OTHER DEALINGS IN THE SOFTWARE.
78  */
79 
80 /*
81  * The code exposes a fully compliant ARM CMSIS API in the
82  * context of the µOS++.
83  */
84 
85 /*
86  * Calls from Interrupt Service Routines
87  *
88  * The following CMSIS-RTOS functions can be called both from threads and
89  * Interrupt Service Routines (ISR):
90  *
91  * - osKernelRunning
92  * - osSignalSet
93  * - osSemaphoreRelease
94  * - osPoolAlloc, osPoolCAlloc, osPoolFree
95  * - osMessagePut, osMessageGet
96  * - osMailAlloc, osMailCAlloc, osMailGet, osMailPut, osMailFree
97  */
98 
99 #ifndef CMSIS_OS_H_
100 #define CMSIS_OS_H_
101 
103 #define osCMSIS 0x00010002
104 
105 #define osCMSIS_KERNEL 0x00010000
107 
108 #define osKernelSystemId "µOS++"
110 
111 #define osFeature_MainThread 0
113 #define osFeature_Pool 1
114 #define osFeature_MailQ 1
115 #define osFeature_MessageQ 1
116 #define osFeature_Signals 8
117 #define osFeature_Semaphore 30
118 #define osFeature_Wait 1
119 #define osFeature_SysTick 1
120 
121 // Include the µOS++ C API structures declarations.
123 
124 #include <stdint.h>
125 #include <stddef.h>
126 
127 #ifdef __cplusplus
128 extern "C"
129 {
130 #endif
131 
132 // ==== Enumeration, structures, defines ====
133 
136  typedef enum
137  {
146  } osPriority;
147 
152 #define osWaitForever 0xFFFFFFFF
153 
154 
158  typedef enum
159  {
160  osOK = 0,
161  osEventSignal = 0x08,
162  osEventMessage = 0x10,
163  osEventMail = 0x20,
164  osEventTimeout = 0x40,
168  osErrorISR = 0x82,
172  osErrorValue = 0x86,
173  osErrorOS = 0xFF,
174  os_status_reserved = 0x7FFFFFFF
175  } osStatus;
176 
181  typedef enum
182  {
185  } os_timer_type;
186 
191  typedef void
192  (*os_pthread) (void const *argument);
193 
198  typedef void
199  (*os_ptimer) (void const *argument);
200 
201  // Redefine some µOS++ struct's to the legacy code.
204 
207 
210 
213 
216 
219 
220  typedef struct os_mail_queue_s
221  {
224  } os_mail_queue_t;
225 
227 
232  typedef osThread* osThreadId;
233 
238  typedef osTimer* osTimerId;
239 
244  typedef osMutex* osMutexId;
245 
250  typedef osSemaphore* osSemaphoreId;
251 
256  typedef osPool* osPoolId;
257 
262  typedef osMessageQ* osMessageQId;
263 
268  typedef osMailQ* osMailQId;
269 
270 #pragma GCC diagnostic push
271 #pragma GCC diagnostic ignored "-Wpadded"
272 
277  typedef struct os_thread_def
278  {
279  const char* name;
281  osPriority tpriority;
282  uint32_t instances;
283  uint32_t stacksize;
284  osThread* data;
285  uint64_t* stack; // align the stack at 8 bytes
286  } osThreadDef_t;
287 
288 #pragma GCC diagnostic pop
289 
294  typedef struct os_timer_def
295  {
296  const char* name;
298  osTimer* data;
299  } osTimerDef_t;
300 
305  typedef struct os_mutex_def
306  {
307  const char* name;
308  osMutex* data;
309  } osMutexDef_t;
310 
315  typedef struct os_semaphore_def
316  {
317  const char* name;
318  osSemaphore* data;
320 
321 #pragma GCC diagnostic push
322 #pragma GCC diagnostic ignored "-Wpadded"
323 
328  typedef struct os_pool_def
329  {
330  const char* name;
331  uint32_t items;
332  uint32_t item_sz;
333  void* pool;
334  uint32_t pool_sz;
335  osPool* data;
336  } osPoolDef_t;
337 
342  typedef struct os_messageQ_def
343  {
344  const char* name;
345  uint32_t items;
346  uint32_t item_sz;
347  void* queue;
348  uint32_t queue_sz;
349  osMessageQ* data;
350  } osMessageQDef_t;
351 
356  typedef struct os_mailQ_def
357  {
358  const char* name;
359  uint32_t items;
360  uint32_t pool_item_sz;
361  uint32_t queue_item_sz;
362  void* pool;
363  uint32_t pool_sz;
364  void* queue;
365  uint32_t queue_sz;
366  osMailQ* data;
367  } osMailQDef_t;
368 
374  typedef struct
375  {
377  union
378  {
379  uint32_t v;
380  void* p;
381  int32_t signals;
382  } value;
383  union
384  {
385  osMailQId mail_id;
386  osMessageQId message_id;
387  } def;
388  } osEvent;
389 
390 #pragma GCC diagnostic pop
391 
392 // ==== Kernel Control Functions ====
393 
401  osStatus
402  osKernelInitialize (void);
403 
411  osStatus
412  osKernelStart (void);
413 
419  int32_t
420  osKernelRunning (void);
421 
422 #if (defined (osFeature_SysTick) && (osFeature_SysTick != 0)) // System Timer available
423 
430  uint32_t
431  osKernelSysTick (void);
432 
444 #define osKernelSysTickFrequency (OS_INTEGER_SYSTICK_FREQUENCY_HZ)
445 
457 #define osKernelSysTickMicroSec(microsec) (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000)
458 
459 #endif // System Timer available
460 
461 // ==== Thread Management ====
462 
478 #if defined (osObjectsExternal) // object is external
479 #define osThreadDef(name, priority, instances, stacksz) \
480 extern const osThreadDef_t os_thread_def_##name
481 #else // define the object
482 #define osThreadAllocatedDef(name, priority, instances, stacksz) \
483 struct { \
484  osThread data[instances]; \
485 } os_thread_##name; \
486 const osThreadDef_t os_thread_def_##name = \
487 { \
488  #name, \
489  (os_pthread)(name), \
490  (priority), \
491  (instances), \
492  (stacksz), \
493  &os_thread_##name.data[0], \
494  0 \
495 }
496 #define osThreadStaticDef(name, priority, instances, stacksz) \
497 struct { \
498  uint64_t stack[(instances)*((stacksz+sizeof(uint64_t)-1)/sizeof(uint64_t))]; \
499  osThread data[instances]; \
500 } os_thread_##name; \
501 const osThreadDef_t os_thread_def_##name = \
502 { \
503  #name, \
504  (os_pthread)(name), \
505  (priority), \
506  (instances), \
507  (stacksz), \
508  &os_thread_##name.data[0], \
509  &os_thread_##name.stack[0] \
510 }
511 #if defined(osObjectsStatic)
512 #define osThreadDef(name, priority, instances, stacksz) osThreadStaticDef(name, priority, instances, stacksz)
513 #else
514 #define osThreadDef(name, priority, instances, stacksz) osThreadAllocatedDef(name, priority, instances, stacksz)
515 #endif
516 #endif
517 
528 #define osThread(name) \
529 &os_thread_def_##name
530 
540  osThreadId
541  osThreadCreate (const osThreadDef_t* thread_def, void* args);
542 
550  osThreadId
551  osThreadGetId (void);
552 
564  osStatus
565  osThreadTerminate (osThreadId thread_id);
566 
575  osStatus
576  osThreadYield (void);
577 
591  osStatus
592  osThreadSetPriority (osThreadId thread_id, osPriority priority);
593 
602  osPriority
603  osThreadGetPriority (osThreadId thread_id);
604 
605 // ==== Generic Wait Functions ====
606 
613  osStatus
614  osDelay (uint32_t millisec);
615 
616 #if (defined (osFeature_Wait) && (osFeature_Wait != 0)) // Generic Wait available
617 
629  osEvent
630  osWait (uint32_t millisec);
631 
632 #endif // Generic Wait available
633 
634 // ==== Timer Management Functions ====
635 
647 #if defined (osObjectsExternal) // object is external
648 #define osTimerDef(name, function) \
649 extern const osTimerDef_t os_timer_def_##name
650 #else // define the object
651 #define osTimerDef(name, function) \
652 struct { \
653  osTimer data; \
654 } os_timer_##name; \
655 const osTimerDef_t os_timer_def_##name = \
656 { \
657  #name, \
658  (os_ptimer)(function), \
659  &os_timer_##name.data \
660 }
661 #endif
662 
673 #define osTimer(name) \
674 &os_timer_def_##name
675 
685  osTimerId
686  osTimerCreate (const osTimerDef_t* timer_def, os_timer_type type, void* args);
687 
698  osStatus
699  osTimerStart (osTimerId timer_id, uint32_t millisec);
700 
711  osStatus
712  osTimerStop (osTimerId timer_id);
713 
723  osStatus
724  osTimerDelete (osTimerId timer_id);
725 
726 // ==== Signal Management ====
727 
736  int32_t
737  osSignalSet (osThreadId thread_id, int32_t signals);
738 
747  int32_t
748  osSignalClear (osThreadId thread_id, int32_t signals);
749 
762  osEvent
763  osSignalWait (int32_t signals, uint32_t millisec);
764 
765 // ==== Mutex Management ====
766 
777 #if defined (osObjectsExternal) // object is external
778 #define osMutexDef(name) \
779 extern const osMutexDef_t os_mutex_def_##name
780 #else // define the object
781 #define osMutexDef(name) \
782 osMutex os_mutex_data_##name; \
783 const osMutexDef_t os_mutex_def_##name = \
784 { \
785  #name, \
786  &os_mutex_data_##name \
787 }
788 #endif
789 
800 #define osMutex(name) \
801 &os_mutex_def_##name
802 
811  osMutexId
812  osMutexCreate (const osMutexDef_t* mutex_def);
813 
827  osStatus
828  osMutexWait (osMutexId mutex_id, uint32_t millisec);
829 
841  osStatus
842  osMutexRelease (osMutexId mutex_id);
843 
855  osStatus
856  osMutexDelete (osMutexId mutex_id);
857 
858 // ==== Semaphore Management Functions ====
859 
860 #if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0)) // Semaphore available
861 
869 #if defined (osObjectsExternal) // object is external
870 #define osSemaphoreDef(name) \
871 extern const osSemaphoreDef_t os_semaphore_def_##name
872 #else // define the object
873 #define osSemaphoreDef(name) \
874 osSemaphore os_semaphore_data_##name; \
875 const osSemaphoreDef_t os_semaphore_def_##name = \
876 { \
877  #name, \
878  &os_semaphore_data_##name \
879 }
880 #endif
881 
890 #define osSemaphore(name) \
891 &os_semaphore_def_##name
892 
902  osSemaphoreId
903  osSemaphoreCreate (const osSemaphoreDef_t* semaphore_def, int32_t count);
904 
914  int32_t
915  osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec);
916 
927  osStatus
928  osSemaphoreRelease (osSemaphoreId semaphore_id);
929 
941  osStatus
942  osSemaphoreDelete (osSemaphoreId semaphore_id);
943 
944 #endif // Semaphore available
945 
946 // ==== Memory Pool Management Functions ====
947 
948 #if (defined (osFeature_Pool) && (osFeature_Pool != 0)) // Memory Pool Management available
949 
959 #if defined (osObjectsExternal) // object is external
960 #define osPoolDef(name, no, type) \
961 extern const osPoolDef_t os_pool_def_##name
962 #else // define the object
963 #define osPoolAllocatedDef(name, items, type) \
964 struct { \
965  osPool data; \
966 } os_pool_##name; \
967 const osPoolDef_t os_pool_def_##name = \
968 { \
969  #name, \
970  (items), \
971  sizeof(type), \
972  0, \
973  0, \
974  &os_pool_##name.data \
975 }
976 #define osPoolStaticDef(name, items, type) \
977 struct { \
978  osPool data; \
979  struct { \
980  type pool[items]; \
981  } storage; \
982 } os_pool_##name; \
983 const osPoolDef_t os_pool_def_##name = \
984 { \
985  #name, \
986  (items), \
987  sizeof(type), \
988  &os_pool_##name.storage, \
989  sizeof(os_pool_##name.storage), \
990  &os_pool_##name.data \
991 }
992 #if defined(osObjectsStatic)
993 #define osPoolDef(name, items, type) osPoolStaticDef(name, items, type)
994 #else
995 #define osPoolDef(name, items, type) osPoolAllocatedDef(name, items, type)
996 #endif
997 #endif
998 
1006 #define osPool(name) \
1007 &os_pool_def_##name
1008 
1017  osPoolId
1018  osPoolCreate (const osPoolDef_t* pool_def);
1019 
1028  void*
1029  osPoolAlloc (osPoolId pool_id);
1030 
1038  void*
1039  osPoolCAlloc (osPoolId pool_id);
1040 
1051  osStatus
1052  osPoolFree (osPoolId pool_id, void* block);
1053 
1054 #endif // Memory Pool Management available
1055 
1056 // ==== Message Queue Management Functions ====
1057 
1058 #if (defined (osFeature_MessageQ) && (osFeature_MessageQ != 0)) // Message Queues available
1059 
1069 #if defined (osObjectsExternal) // object is external
1070 #define osMessageQDef(name, queue_sz, type) \
1071 extern const osMessageQDef_t os_messageQ_def_##name
1072 #else // define the object
1073 #define osMessageQAllocatedDef(name, items, type) \
1074 struct { \
1075  osMessageQ data; \
1076 } os_messageQ_##name; \
1077 const osMessageQDef_t os_messageQ_def_##name = { \
1078  #name, \
1079  (items), \
1080  sizeof (void*), \
1081  0, \
1082  0, \
1083  &os_messageQ_##name.data \
1084 }
1085 #define osMessageQStaticDef(name, items, type) \
1086 struct { \
1087  osMessageQ data; \
1088  struct { \
1089  void* queue[items]; \
1090  os_mqueue_index_t links[2 * items]; \
1091  os_mqueue_prio_t prios[items]; \
1092  } storage; \
1093 } os_messageQ_##name; \
1094 const osMessageQDef_t os_messageQ_def_##name = { \
1095  #name, \
1096  (items), \
1097  sizeof (void*), \
1098  &os_messageQ_##name.storage, \
1099  sizeof(os_messageQ_##name.storage), \
1100  &os_messageQ_##name.data \
1101 }
1102 
1103 #if defined(osObjectsStatic)
1104 #define osMessageQDef(name, items, type) osMessageQStaticDef(name, items, type)
1105 #else
1106 #define osMessageQDef(name, items, type) osMessageQAllocatedDef(name, items, type)
1107 #endif
1108 #endif
1109 
1120 #define osMessageQ(name) \
1121 &os_messageQ_def_##name
1122 
1132  osMessageQId
1133  osMessageCreate (const osMessageQDef_t* queue_def, osThreadId thread_id);
1134 
1148  osStatus
1149  osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t millisec);
1150 
1163  osEvent
1164  osMessageGet (osMessageQId queue_id, uint32_t millisec);
1165 
1166 #endif // Message Queues available
1167 
1168 // ==== Mail Queue Management Functions ====
1169 
1170 #if (defined (osFeature_MailQ) && (osFeature_MailQ != 0)) // Mail Queues available
1171 
1180 #if defined (osObjectsExternal) // object is external
1181 #define osMailQDef(name, queue_sz, type) \
1182 extern const osMailQDef_t os_mailQ_def_##name
1183 #else // define the object
1184 #define osMailQAllocatedDef(name, items, type) \
1185 struct { \
1186  osMailQ data; \
1187  struct { \
1188  type pool[items]; \
1189  } pool_storage; \
1190  struct { \
1191  void* queue[items]; \
1192  os_mqueue_index_t links[2 * items]; \
1193  os_mqueue_prio_t prios[items]; \
1194  } queue_storage; \
1195 } os_mailQ_##name; \
1196 const osMailQDef_t os_mailQ_def_##name = { \
1197  #name, \
1198  (items), \
1199  sizeof (type), \
1200  sizeof (void*), \
1201  0, \
1202  0, \
1203  0, \
1204  0, \
1205  &os_mailQ_##name.data \
1206 }
1207 #define osMailQStaticDef(name, items, type) \
1208 struct { \
1209  osMailQ data; \
1210  struct { \
1211  type pool[items]; \
1212  } pool_storage; \
1213  struct { \
1214  void* queue[items]; \
1215  os_mqueue_index_t links[2 * items]; \
1216  os_mqueue_prio_t prios[items]; \
1217  } queue_storage; \
1218 } os_mailQ_##name; \
1219 const osMailQDef_t os_mailQ_def_##name = { \
1220  #name, \
1221  (items), \
1222  sizeof (type), \
1223  sizeof (void*), \
1224  &os_mailQ_##name.pool_storage, \
1225  sizeof(os_mailQ_##name.pool_storage), \
1226  &os_mailQ_##name.queue_storage, \
1227  sizeof(os_mailQ_##name.queue_storage), \
1228  &os_mailQ_##name.data \
1229 }
1230 #if defined(osObjectsStatic)
1231 #define osMailQDef(name, items, type) osMailQStaticDef(name, items, type)
1232 #else
1233 #define osMailQDef(name, items, type) osMailQAllocatedDef(name, items, type)
1234 #endif
1235 #endif
1236 
1244 #define osMailQ(name) \
1245 &os_mailQ_def_##name
1246 
1256  osMailQId
1257  osMailCreate (const osMailQDef_t* mail_def, osThreadId thread_id);
1258 
1268  void*
1269  osMailAlloc (osMailQId mail_id, uint32_t millisec);
1270 
1280  void*
1281  osMailCAlloc (osMailQId mail_id, uint32_t millisec);
1282 
1294  osStatus
1295  osMailPut (osMailQId mail_id, void* mail);
1296 
1309  osEvent
1310  osMailGet (osMailQId mail_id, uint32_t millisec);
1311 
1323  osStatus
1324  osMailFree (osMailQId mail_id, void* mail);
1325 
1326 #endif // Mail Queues available
1327 
1328 #ifdef __cplusplus
1329 }
1330 #endif
1331 
1332 #endif /* CMSIS_OS_H_ */
uint32_t queue_sz
Definition: cmsis_os.h:365
osStatus osThreadSetPriority(osThreadId thread_id, osPriority priority)
Change thread priority.
osMailQId mail_id
mail id obtained by osMailCreate
Definition: cmsis_os.h:385
Timer definition structure contains timer parameters.
Definition: cmsis_os.h:294
resource not available: a specified resource was not available.
Definition: cmsis_os.h:166
Thread definition structure contains startup information of a thread.
Definition: cmsis_os.h:277
uint64_t * stack
Definition: cmsis_os.h:285
function completed; signal event occurred.
Definition: cmsis_os.h:161
osStatus osSemaphoreDelete(osSemaphoreId semaphore_id)
Delete the semaphore.
#define osTimer(name)
Access the timer.
Definition: cmsis_os.h:673
uint32_t pool_item_sz
size of a pool item
Definition: cmsis_os.h:360
struct os_thread_def osThreadDef_t
Thread definition structure contains startup information of a thread.
Mutex definition structure contains setup information for a mutex.
Definition: cmsis_os.h:305
priority: below normal
Definition: cmsis_os.h:140
system cannot determine priority or thread has illegal priority.
Definition: cmsis_os.h:170
Message queue object storage.
Definition: os-c-decls.h:1307
Event structure contains detailed information about an event.
Definition: cmsis_os.h:374
value of a parameter is out of range.
Definition: cmsis_os.h:172
system is out of memory: it was impossible to allocate or reserve memory for the operation.
Definition: cmsis_os.h:171
Thread attributes.
Definition: os-c-decls.h:489
void(* os_pthread)(void const *argument)
Entry point of a thread.
Definition: cmsis_os.h:192
function completed; no error or event occurred.
Definition: cmsis_os.h:160
Mutex attributes.
Definition: os-c-decls.h:899
priority: low
Definition: cmsis_os.h:139
priority: realtime (highest)
Definition: cmsis_os.h:144
uint32_t item_sz
size of an item
Definition: cmsis_os.h:332
uint32_t pool_sz
Definition: cmsis_os.h:363
function completed; message event occurred.
Definition: cmsis_os.h:162
osPool * osPoolId
Pool ID identifies the memory pool (pointer to a memory pool control block).
Definition: cmsis_os.h:256
osStatus osThreadTerminate(osThreadId thread_id)
Terminate a thread.
uint32_t instances
maximum number of instances of that thread function
Definition: cmsis_os.h:282
osSemaphore * osSemaphoreId
Semaphore ID identifies the semaphore (pointer to a semaphore control block).
Definition: cmsis_os.h:250
uint32_t v
message as 32-bit value
Definition: cmsis_os.h:379
#define osSemaphore(name)
Access a Semaphore definition.
Definition: cmsis_os.h:890
struct os_mailQ_def osMailQDef_t
Definition structure for mail queue.
struct os_mail_queue_s os_mail_queue_t
one-shot timer
Definition: cmsis_os.h:183
osStatus osKernelInitialize(void)
Initialize the RTOS.
uint32_t stacksize
stack size requirements in bytes; 0 is default stack size
Definition: cmsis_os.h:283
unspecified RTOS error: run-time error but no other error message fits.
Definition: cmsis_os.h:173
uint32_t items
number of elements in the queue
Definition: cmsis_os.h:359
osSemaphore * data
Definition: cmsis_os.h:318
Timer object storage.
Definition: os-c-decls.h:764
#define osMessageQ(name)
Access a Message Queue.
Definition: cmsis_os.h:1120
const char * name
Definition: cmsis_os.h:330
parameter error: a mandatory parameter was missing or specified an incorrect object.
Definition: cmsis_os.h:165
Semaphore attributes.
Definition: os-c-decls.h:1079
osMessageQId message_id
message id obtained by osMessageCreate
Definition: cmsis_os.h:386
osMessageQId osMessageCreate(const osMessageQDef_t *queue_def, osThreadId thread_id)
Create a message queue.
void * osPoolCAlloc(osPoolId pool_id)
Allocate and clear a memory block.
struct os_mutex_def osMutexDef_t
Mutex definition structure contains setup information for a mutex.
os_thread_attr_t osThreadAttr
Definition: cmsis_os.h:203
priority: high
Definition: cmsis_os.h:143
const char * name
Definition: cmsis_os.h:358
struct os_messageQ_def osMessageQDef_t
Definition structure for message queue.
int32_t signals
signal flags
Definition: cmsis_os.h:381
Thread object storage.
Definition: os-c-decls.h:554
uint32_t queue_sz
Definition: cmsis_os.h:348
osStatus osMutexRelease(osMutexId mutex_id)
Release the mutex.
uint32_t osKernelSysTick(void)
Get the system timer counter.
int32_t osKernelRunning(void)
Check if the RTOS scheduler is started.
const char * name
Definition: cmsis_os.h:296
int32_t osSignalClear(osThreadId thread_id, int32_t signals)
Clear the specified Signal Flags of an active thread.
void * osMailAlloc(osMailQId mail_id, uint32_t millisec)
Allocate a memory block from a mail.
osStatus osDelay(uint32_t millisec)
Time Delay.
priority: normal (default)
Definition: cmsis_os.h:141
osMutex * osMutexId
Mutex ID identifies the mutex (pointer to a mutex control block).
Definition: cmsis_os.h:244
osTimerId osTimerCreate(const osTimerDef_t *timer_def, os_timer_type type, void *args)
Create a timer.
void * pool
pointer to memory array for pool
Definition: cmsis_os.h:362
osStatus osMutexWait(osMutexId mutex_id, uint32_t millisec)
Wait for mutex.
osTimer * data
Definition: cmsis_os.h:298
osMessageQ * osMessageQId
Message ID identifies the message queue (pointer to a message queue control block).
Definition: cmsis_os.h:262
#define osMailQ(name)
Access a mail queue definition.
Definition: cmsis_os.h:1244
repeating timer
Definition: cmsis_os.h:184
osThread * data
Definition: cmsis_os.h:284
void * osPoolAlloc(osPoolId pool_id)
Allocate a memory block.
os_mempool_attr_t osPoolAttr
Definition: cmsis_os.h:215
Memory pool attributes.
Definition: os-c-decls.h:1165
const char * name
Definition: cmsis_os.h:307
os_pthread pthread
start address of thread function
Definition: cmsis_os.h:280
void * osMailCAlloc(osMailQId mail_id, uint32_t millisec)
Allocate and clear a memory block from a mail.
struct os_timer_def osTimerDef_t
Timer definition structure contains timer parameters.
osStatus status
status code: event or error information
Definition: cmsis_os.h:376
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a message to a queue.
function completed; timeout occurred.
Definition: cmsis_os.h:164
os_semaphore_attr_t osSemaphoreAttr
Definition: cmsis_os.h:212
Timer attributes.
Definition: os-c-decls.h:734
os_mempool_t pool
Definition: cmsis_os.h:222
osMailQId osMailCreate(const osMailQDef_t *mail_def, osThreadId thread_id)
Create a mail queue.
not allowed in ISR context: the function cannot be called from interrupt service routines.
Definition: cmsis_os.h:168
osPool * data
Definition: cmsis_os.h:335
osMailQ * osMailQId
Mail ID identifies the mail queue (pointer to a mail queue control block).
Definition: cmsis_os.h:268
Semaphore object storage.
Definition: os-c-decls.h:1114
priority: idle (lowest)
Definition: cmsis_os.h:138
osPriority osThreadGetPriority(osThreadId thread_id)
Get thread priority.
resource not available within given time: a specified resource was not available within the timeout p...
Definition: cmsis_os.h:167
uint32_t items
number of items (elements) in the pool
Definition: cmsis_os.h:331
osStatus osTimerStart(osTimerId timer_id, uint32_t millisec)
Start the timer.
int32_t osSignalSet(osThreadId thread_id, int32_t signals)
Set signal flags.
os_mqueue_t queue
Definition: cmsis_os.h:223
os_timer_attr_t osTimerAttr
Definition: cmsis_os.h:206
priority: above normal
Definition: cmsis_os.h:142
osTimer * osTimerId
Timer ID identifies the timer (pointer to a timer control block).
Definition: cmsis_os.h:238
osSemaphoreId osSemaphoreCreate(const osSemaphoreDef_t *semaphore_def, int32_t count)
Create a semaphore.
uint32_t items
number of elements in the queue
Definition: cmsis_os.h:345
Semaphore definition structure contains setup information for a semaphore.
Definition: cmsis_os.h:315
osEvent osMessageGet(osMessageQId queue_id, uint32_t millisec)
Get a message or Wait for a Message from a Queue.
osEvent osSignalWait(int32_t signals, uint32_t millisec)
Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
void * p
message or mail as void pointer
Definition: cmsis_os.h:380
osStatus osMailFree(osMailQId mail_id, void *mail)
Free a memory block from a mail.
const char * name
Definition: cmsis_os.h:317
void * queue
pointer to memory array for queue
Definition: cmsis_os.h:364
const char * name
Definition: cmsis_os.h:279
Memory pool object storage.
Definition: os-c-decls.h:1200
osStatus osTimerDelete(osTimerId timer_id)
Delete the timer.
Definition structure for memory block allocation.
Definition: cmsis_os.h:328
osMutexId osMutexCreate(const osMutexDef_t *mutex_def)
Create a mutex.
osStatus osMutexDelete(osMutexId mutex_id)
Delete the mutex.
uint32_t item_sz
size of an item
Definition: cmsis_os.h:346
int32_t osSemaphoreWait(osSemaphoreId semaphore_id, uint32_t millisec)
Wait until a Semaphore token becomes available.
os_mutex_attr_t osMutexAttr
Definition: cmsis_os.h:209
const char * name
Definition: cmsis_os.h:344
#define osPool(name)
Access a Memory Pool definition.
Definition: cmsis_os.h:1006
uint32_t pool_sz
Definition: cmsis_os.h:334
prevent from enum down-size compiler optimization.
Definition: cmsis_os.h:174
struct os_pool_def osPoolDef_t
Definition structure for memory block allocation.
#define osThread(name)
Access a Thread definition.
Definition: cmsis_os.h:528
void * pool
pointer to memory for pool
Definition: cmsis_os.h:333
void(* os_ptimer)(void const *argument)
Entry point of a timer call back function.
Definition: cmsis_os.h:199
osPriority tpriority
initial thread priority
Definition: cmsis_os.h:281
osStatus osTimerStop(osTimerId timer_id)
Stop the timer.
osEvent osWait(uint32_t millisec)
Wait for Signal, Message, Mail, or Timeout.
osThreadId osThreadGetId(void)
Get the current thread.
osEvent osMailGet(osMailQId mail_id, uint32_t millisec)
Get a mail from a queue.
struct os_semaphore_def osSemaphoreDef_t
Semaphore definition structure contains setup information for a semaphore.
os_ptimer ptimer
start address of a timer function
Definition: cmsis_os.h:297
osStatus osSemaphoreRelease(osSemaphoreId semaphore_id)
Release the semaphore.
osThread * osThreadId
Thread ID identifies the thread (pointer to a thread control block).
Definition: cmsis_os.h:232
osStatus
Status code values returned by CMSIS-RTOS functions.
Definition: cmsis_os.h:158
osStatus osThreadYield(void)
Yield control.
Mutex object storage.
Definition: os-c-decls.h:949
void * queue
pointer to memory array for messages
Definition: cmsis_os.h:347
osMessageQ * data
Definition: cmsis_os.h:349
function called multiple times from ISR with same object.
Definition: cmsis_os.h:169
os_mqueue_attr_t osMessageQAttr
Definition: cmsis_os.h:218
osStatus osKernelStart(void)
function completed; mail event occurred.
Definition: cmsis_os.h:163
osMailQ * data
Definition: cmsis_os.h:366
osPoolId osPoolCreate(const osPoolDef_t *pool_def)
Create a memory pool.
Message queue attributes.
Definition: os-c-decls.h:1272
osStatus osMailPut(osMailQId mail_id, void *mail)
Put a mail to a queue.
Definition structure for message queue.
Definition: cmsis_os.h:342
Definition structure for mail queue.
Definition: cmsis_os.h:356
uint32_t queue_item_sz
size of a queue item
Definition: cmsis_os.h:361
#define osMutex(name)
Access a mutex.
Definition: cmsis_os.h:800
osMutex * data
Definition: cmsis_os.h:308
osPriority
Definition: cmsis_os.h:136
os_timer_type
Timer type value for the timer definition.
Definition: cmsis_os.h:181
osStatus osPoolFree(osPoolId pool_id, void *block)
Free a memory block.
system cannot determine priority or thread has illegal priority
Definition: cmsis_os.h:145
osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *args)
Create a thread.