µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
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
106#define osCMSIS_KERNEL 0x00010000
107
109#define osKernelSystemId "µOS++"
110
112#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
128extern "C"
129{
130#endif
131
132// ==== Enumeration, structures, defines ====
133
136 typedef enum
137 {
147
152#define osWaitForever 0xFFFFFFFF
153
158 typedef enum
159 {
160 osOK = 0,
163 osEventMail = 0x20,
168 osErrorISR = 0x82,
173 osErrorOS = 0xFF,
174 os_status_reserved = 0x7FFFFFFF
176
181 typedef enum
182 {
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 {
225
227
233
239
245
251
256 typedef osPool* osPoolId;
257
263
269
270#pragma GCC diagnostic push
271#pragma GCC diagnostic ignored "-Wpadded"
272
277 typedef struct os_thread_def
278 {
279 const char* name;
282 uint32_t instances;
283 uint32_t stacksize;
285 uint64_t* stack; // align the stack at 8 bytes
287
288#pragma GCC diagnostic pop
289
294 typedef struct os_timer_def
295 {
296 const char* name;
300
305 typedef struct os_mutex_def
306 {
307 const char* name;
310
315 typedef struct os_semaphore_def
316 {
317 const char* name;
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;
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;
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;
368
374 typedef struct
375 {
377 union
378 {
379 uint32_t v;
380 void* p;
381 int32_t signals;
382 } value;
383 union
384 {
387 } def;
388 } osEvent;
389
390#pragma GCC diagnostic pop
391
392// ==== Kernel Control Functions ====
393
402 osKernelInitialize (void);
403
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
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) \
480extern const osThreadDef_t os_thread_def_##name
481#else // define the object
482#define osThreadAllocatedDef(name, priority, instances, stacksz) \
483struct { \
484 osThread data[instances]; \
485} os_thread_##name; \
486const 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) \
497struct { \
498 uint64_t stack[(instances)*((stacksz+sizeof(uint64_t)-1)/sizeof(uint64_t))]; \
499 osThread data[instances]; \
500} os_thread_##name; \
501const 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
541 osThreadCreate (const osThreadDef_t* thread_def, void* args);
542
551 osThreadGetId (void);
552
565 osThreadTerminate (osThreadId thread_id);
566
576 osThreadYield (void);
577
592 osThreadSetPriority (osThreadId thread_id, osPriority priority);
593
604
605// ==== Generic Wait Functions ====
606
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) \
649extern const osTimerDef_t os_timer_def_##name
650#else // define the object
651#define osTimerDef(name, function) \
652struct { \
653 osTimer data; \
654} os_timer_##name; \
655const 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
686 osTimerCreate (const osTimerDef_t* timer_def, os_timer_type type, void* args);
687
699 osTimerStart (osTimerId timer_id, uint32_t millisec);
700
712 osTimerStop (osTimerId timer_id);
713
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) \
779extern const osMutexDef_t os_mutex_def_##name
780#else // define the object
781#define osMutexDef(name) \
782osMutex os_mutex_data_##name; \
783const 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
812 osMutexCreate (const osMutexDef_t* mutex_def);
813
828 osMutexWait (osMutexId mutex_id, uint32_t millisec);
829
842 osMutexRelease (osMutexId mutex_id);
843
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) \
871extern const osSemaphoreDef_t os_semaphore_def_##name
872#else // define the object
873#define osSemaphoreDef(name) \
874osSemaphore os_semaphore_data_##name; \
875const 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
903 osSemaphoreCreate (const osSemaphoreDef_t* semaphore_def, int32_t count);
904
914 int32_t
915 osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec);
916
929
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) \
961extern const osPoolDef_t os_pool_def_##name
962#else // define the object
963#define osPoolAllocatedDef(name, items, type) \
964struct { \
965 osPool data; \
966} os_pool_##name; \
967const 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) \
977struct { \
978 osPool data; \
979 struct { \
980 type pool[items]; \
981 } storage; \
982} os_pool_##name; \
983const 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*
1030
1038 void*
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) \
1071extern const osMessageQDef_t os_messageQ_def_##name
1072#else // define the object
1073#define osMessageQAllocatedDef(name, items, type) \
1074struct { \
1075 osMessageQ data; \
1076} os_messageQ_##name; \
1077const 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) \
1086struct { \
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; \
1094const 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
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) \
1182extern const osMailQDef_t os_mailQ_def_##name
1183#else // define the object
1184#define osMailQAllocatedDef(name, items, type) \
1185struct { \
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; \
1196const 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) \
1208struct { \
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; \
1219const 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_ */
osStatus osMutexRelease(osMutexId mutex_id)
Release the mutex.
osStatus osDelay(uint32_t millisec)
Time Delay.
#define osSemaphore(name)
Access a Semaphore definition.
Definition cmsis_os.h:890
osStatus osThreadSetPriority(osThreadId thread_id, osPriority priority)
Change thread priority.
#define osMutex(name)
Access a mutex.
Definition cmsis_os.h:800
osEvent osMailGet(osMailQId mail_id, uint32_t millisec)
Get a mail from a queue.
#define osTimer(name)
Access the timer.
Definition cmsis_os.h:673
struct os_timer_def osTimerDef_t
Timer definition structure contains timer parameters.
osTimerId osTimerCreate(const osTimerDef_t *timer_def, os_timer_type type, void *args)
Create a timer.
osStatus osTimerStart(osTimerId timer_id, uint32_t millisec)
Start the timer.
#define osMessageQ(name)
Access a Message Queue.
Definition cmsis_os.h:1120
osPoolId osPoolCreate(const osPoolDef_t *pool_def)
Create a memory pool.
osStatus osMailPut(osMailQId mail_id, void *mail)
Put a mail to 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.
osMutex * osMutexId
Mutex ID identifies the mutex (pointer to a mutex control block).
Definition cmsis_os.h:244
void(* os_pthread)(void const *argument)
Entry point of a thread.
Definition cmsis_os.h:192
int32_t osKernelRunning(void)
Check if the RTOS scheduler is started.
int32_t osSignalSet(osThreadId thread_id, int32_t signals)
Set signal flags.
osPriority osThreadGetPriority(osThreadId thread_id)
Get thread priority.
osStatus osPoolFree(osPoolId pool_id, void *block)
Free a memory block.
struct os_mail_queue_s os_mail_queue_t
osMessageQ * osMessageQId
Message ID identifies the message queue (pointer to a message queue control block).
Definition cmsis_os.h:262
osStatus osKernelInitialize(void)
Initialize the RTOS.
struct os_messageQ_def osMessageQDef_t
Definition structure for message queue.
osPool * osPoolId
Pool ID identifies the memory pool (pointer to a memory pool control block).
Definition cmsis_os.h:256
osStatus osTimerStop(osTimerId timer_id)
Stop the timer.
osMutexId osMutexCreate(const osMutexDef_t *mutex_def)
Create a mutex.
osStatus osMutexWait(osMutexId mutex_id, uint32_t millisec)
Wait for mutex.
#define osPool(name)
Access a Memory Pool definition.
Definition cmsis_os.h:1006
osEvent osMessageGet(osMessageQId queue_id, uint32_t millisec)
Get a message or Wait for a Message from a Queue.
osStatus osTimerDelete(osTimerId timer_id)
Delete the timer.
os_timer_attr_t osTimerAttr
Definition cmsis_os.h:206
void(* os_ptimer)(void const *argument)
Entry point of a timer call back function.
Definition cmsis_os.h:199
void * osMailAlloc(osMailQId mail_id, uint32_t millisec)
Allocate a memory block from a mail.
osPriority
Definition cmsis_os.h:137
@ osPriorityRealtime
priority: realtime (highest)
Definition cmsis_os.h:144
@ osPriorityAboveNormal
priority: above normal
Definition cmsis_os.h:142
@ osPriorityBelowNormal
priority: below normal
Definition cmsis_os.h:140
@ osPriorityNormal
priority: normal (default)
Definition cmsis_os.h:141
@ osPriorityIdle
priority: idle (lowest)
Definition cmsis_os.h:138
@ osPriorityLow
priority: low
Definition cmsis_os.h:139
@ osPriorityHigh
priority: high
Definition cmsis_os.h:143
@ osPriorityError
system cannot determine priority or thread has illegal priority
Definition cmsis_os.h:145
void * osMailCAlloc(osMailQId mail_id, uint32_t millisec)
Allocate and clear a memory block from a mail.
osEvent osWait(uint32_t millisec)
Wait for Signal, Message, Mail, or Timeout.
int32_t osSignalClear(osThreadId thread_id, int32_t signals)
Clear the specified Signal Flags of an active thread.
osTimer * osTimerId
Timer ID identifies the timer (pointer to a timer control block).
Definition cmsis_os.h:238
struct os_thread_def osThreadDef_t
Thread definition structure contains startup information of a thread.
osSemaphoreId osSemaphoreCreate(const osSemaphoreDef_t *semaphore_def, int32_t count)
Create a semaphore.
void * osPoolCAlloc(osPoolId pool_id)
Allocate and clear a memory block.
osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *args)
Create a thread.
void * osPoolAlloc(osPoolId pool_id)
Allocate a memory block.
os_mempool_attr_t osPoolAttr
Definition cmsis_os.h:215
osStatus osKernelStart(void)
osStatus osMailFree(osMailQId mail_id, void *mail)
Free a memory block from a mail.
osStatus osSemaphoreRelease(osSemaphoreId semaphore_id)
Release the semaphore.
osThreadId osThreadGetId(void)
Get the current thread.
struct os_mailQ_def osMailQDef_t
Definition structure for mail queue.
osMailQId osMailCreate(const osMailQDef_t *mail_def, osThreadId thread_id)
Create a mail queue.
osStatus osSemaphoreDelete(osSemaphoreId semaphore_id)
Delete the semaphore.
os_semaphore_attr_t osSemaphoreAttr
Definition cmsis_os.h:212
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a message to a queue.
osStatus osMutexDelete(osMutexId mutex_id)
Delete the mutex.
struct os_mutex_def osMutexDef_t
Mutex definition structure contains setup information for a mutex.
struct os_pool_def osPoolDef_t
Definition structure for memory block allocation.
int32_t osSemaphoreWait(osSemaphoreId semaphore_id, uint32_t millisec)
Wait until a Semaphore token becomes available.
struct os_semaphore_def osSemaphoreDef_t
Semaphore definition structure contains setup information for a semaphore.
uint32_t osKernelSysTick(void)
Get the system timer counter.
os_mqueue_attr_t osMessageQAttr
Definition cmsis_os.h:218
osSemaphore * osSemaphoreId
Semaphore ID identifies the semaphore (pointer to a semaphore control block).
Definition cmsis_os.h:250
#define osMailQ(name)
Access a mail queue definition.
Definition cmsis_os.h:1244
os_timer_type
Timer type value for the timer definition.
Definition cmsis_os.h:182
@ osTimerPeriodic
repeating timer
Definition cmsis_os.h:184
@ osTimerOnce
one-shot timer
Definition cmsis_os.h:183
os_thread_attr_t osThreadAttr
Definition cmsis_os.h:203
os_mutex_attr_t osMutexAttr
Definition cmsis_os.h:209
osStatus
Status code values returned by CMSIS-RTOS functions.
Definition cmsis_os.h:159
@ osEventMail
function completed; mail event occurred.
Definition cmsis_os.h:163
@ osErrorISR
not allowed in ISR context: the function cannot be called from interrupt service routines.
Definition cmsis_os.h:168
@ osErrorTimeoutResource
resource not available within given time: a specified resource was not available within the timeout p...
Definition cmsis_os.h:167
@ osErrorValue
value of a parameter is out of range.
Definition cmsis_os.h:172
@ osEventSignal
function completed; signal event occurred.
Definition cmsis_os.h:161
@ osErrorOS
unspecified RTOS error: run-time error but no other error message fits.
Definition cmsis_os.h:173
@ osEventTimeout
function completed; timeout occurred.
Definition cmsis_os.h:164
@ osErrorResource
resource not available: a specified resource was not available.
Definition cmsis_os.h:166
@ osOK
function completed; no error or event occurred.
Definition cmsis_os.h:160
@ osErrorPriority
system cannot determine priority or thread has illegal priority.
Definition cmsis_os.h:170
@ osErrorParameter
parameter error: a mandatory parameter was missing or specified an incorrect object.
Definition cmsis_os.h:165
@ os_status_reserved
prevent from enum down-size compiler optimization.
Definition cmsis_os.h:174
@ osEventMessage
function completed; message event occurred.
Definition cmsis_os.h:162
@ osErrorNoMemory
system is out of memory: it was impossible to allocate or reserve memory for the operation.
Definition cmsis_os.h:171
@ osErrorISRRecursive
function called multiple times from ISR with same object.
Definition cmsis_os.h:169
osStatus osThreadTerminate(osThreadId thread_id)
Terminate a thread.
#define osThread(name)
Access a Thread definition.
Definition cmsis_os.h:528
osStatus osThreadYield(void)
Yield control.
osMailQ * osMailQId
Mail ID identifies the mail queue (pointer to a mail queue control block).
Definition cmsis_os.h:268
osMessageQId osMessageCreate(const osMessageQDef_t *queue_def, osThreadId thread_id)
Create a message queue.
osThread * osThreadId
Thread ID identifies the thread (pointer to a thread control block).
Definition cmsis_os.h:232
@ os_thread_priority_error
Definition os-c-decls.h:295
@ os_thread_priority_below_normal
Definition os-c-decls.h:288
@ os_thread_priority_high
Definition os-c-decls.h:291
@ os_thread_priority_realtime
Definition os-c-decls.h:292
@ os_thread_priority_idle
Definition os-c-decls.h:285
@ os_thread_priority_normal
Definition os-c-decls.h:289
@ os_thread_priority_low
Definition os-c-decls.h:287
@ os_thread_priority_above_normal
Definition os-c-decls.h:290
@ os_timer_once
Definition os-c-decls.h:697
@ os_timer_periodic
Definition os-c-decls.h:698
Event structure contains detailed information about an event.
Definition cmsis_os.h:375
uint32_t v
message as 32-bit value
Definition cmsis_os.h:379
void * p
message or mail as void pointer
Definition cmsis_os.h:380
osStatus status
status code: event or error information
Definition cmsis_os.h:376
int32_t signals
signal flags
Definition cmsis_os.h:381
osMailQId mail_id
mail id obtained by osMailCreate
Definition cmsis_os.h:385
osMessageQId message_id
message id obtained by osMessageCreate
Definition cmsis_os.h:386
Definition structure for mail queue.
Definition cmsis_os.h:357
osMailQ * data
Definition cmsis_os.h:366
uint32_t items
number of elements in the queue
Definition cmsis_os.h:359
uint32_t queue_sz
Definition cmsis_os.h:365
void * queue
pointer to memory array for queue
Definition cmsis_os.h:364
uint32_t queue_item_sz
size of a queue item
Definition cmsis_os.h:361
uint32_t pool_sz
Definition cmsis_os.h:363
uint32_t pool_item_sz
size of a pool item
Definition cmsis_os.h:360
void * pool
pointer to memory array for pool
Definition cmsis_os.h:362
const char * name
Definition cmsis_os.h:358
os_mqueue_t queue
Definition cmsis_os.h:223
os_mempool_t pool
Definition cmsis_os.h:222
Memory pool attributes.
Memory pool object storage.
Definition structure for message queue.
Definition cmsis_os.h:343
void * queue
pointer to memory array for messages
Definition cmsis_os.h:347
osMessageQ * data
Definition cmsis_os.h:349
uint32_t items
number of elements in the queue
Definition cmsis_os.h:345
const char * name
Definition cmsis_os.h:344
uint32_t item_sz
size of an item
Definition cmsis_os.h:346
uint32_t queue_sz
Definition cmsis_os.h:348
Message queue attributes.
Message queue object storage.
Mutex attributes.
Definition os-c-decls.h:917
Mutex definition structure contains setup information for a mutex.
Definition cmsis_os.h:306
osMutex * data
Definition cmsis_os.h:308
const char * name
Definition cmsis_os.h:307
Mutex object storage.
Definition os-c-decls.h:967
Definition structure for memory block allocation.
Definition cmsis_os.h:329
osPool * data
Definition cmsis_os.h:335
const char * name
Definition cmsis_os.h:330
uint32_t pool_sz
Definition cmsis_os.h:334
uint32_t item_sz
size of an item
Definition cmsis_os.h:332
void * pool
pointer to memory for pool
Definition cmsis_os.h:333
uint32_t items
number of items (elements) in the pool
Definition cmsis_os.h:331
Semaphore attributes.
Semaphore definition structure contains setup information for a semaphore.
Definition cmsis_os.h:316
const char * name
Definition cmsis_os.h:317
osSemaphore * data
Definition cmsis_os.h:318
Semaphore object storage.
Thread attributes.
Definition os-c-decls.h:502
Thread definition structure contains startup information of a thread.
Definition cmsis_os.h:278
os_pthread pthread
start address of thread function
Definition cmsis_os.h:280
uint64_t * stack
Definition cmsis_os.h:285
const char * name
Definition cmsis_os.h:279
osPriority tpriority
initial thread priority
Definition cmsis_os.h:281
uint32_t stacksize
stack size requirements in bytes; 0 is default stack size
Definition cmsis_os.h:283
osThread * data
Definition cmsis_os.h:284
uint32_t instances
maximum number of instances of that thread function
Definition cmsis_os.h:282
Thread object storage.
Definition os-c-decls.h:572
Timer attributes.
Definition os-c-decls.h:752
Timer definition structure contains timer parameters.
Definition cmsis_os.h:295
const char * name
Definition cmsis_os.h:296
osTimer * data
Definition cmsis_os.h:298
os_ptimer ptimer
start address of a timer function
Definition cmsis_os.h:297
Timer object storage.
Definition os-c-decls.h:782