87#pragma GCC diagnostic push
89#pragma clang diagnostic ignored "-Wpadded"
90#elif defined(__GNUC__)
91#if !defined(__cplusplus)
92#pragma GCC diagnostic ignored "-Wc++-compat"
94#pragma GCC diagnostic ignored "-Wpadded"
98#define osCMSIS 0x00010002
101#define osCMSIS_KERNEL 0x00010000
104#define osKernelSystemId "µOS++"
107#define osFeature_MainThread 0
108#define osFeature_Pool 1
109#define osFeature_MailQ 1
110#define osFeature_MessageQ 1
111#define osFeature_Signals 8
112#define osFeature_Semaphore 30
113#define osFeature_Wait 1
114#define osFeature_SysTick 1
147#define osWaitForever 0xFFFFFFFF
265#pragma GCC diagnostic push
266#if defined(__clang__)
267#pragma clang diagnostic ignored "-Wpadded"
268#elif defined(__GNUC__)
269#pragma GCC diagnostic ignored "-Wpadded"
287#pragma GCC diagnostic pop
320#pragma GCC diagnostic push
321#if defined(__clang__)
322#pragma clang diagnostic ignored "-Wpadded"
323#elif defined(__GNUC__)
324#pragma GCC diagnostic ignored "-Wpadded"
393#pragma GCC diagnostic pop
425#if (defined (osFeature_SysTick) && (osFeature_SysTick != 0))
447#define osKernelSysTickFrequency (OS_INTEGER_SYSTICK_FREQUENCY_HZ)
460#define osKernelSysTickMicroSec(microsec) (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000)
481#if defined (osObjectsExternal)
482#define osThreadDef(name, priority, instances, stacksz) \
483extern const osThreadDef_t os_thread_def_##name
485#define osThreadAllocatedDef(name, priority, instances, stacksz) \
487 osThread data[instances]; \
489const osThreadDef_t os_thread_def_##name = \
492 (os_pthread)(name), \
496 &os_thread_##name.data[0], \
499#define osThreadStaticDef(name, priority, instances, stacksz) \
501 uint64_t stack[(instances)*((stacksz+sizeof(uint64_t)-1)/sizeof(uint64_t))]; \
502 osThread data[instances]; \
504const osThreadDef_t os_thread_def_##name = \
507 (os_pthread)(name), \
511 &os_thread_##name.data[0], \
512 &os_thread_##name.stack[0] \
514#if defined(osObjectsStatic)
515#define osThreadDef(name, priority, instances, stacksz) osThreadStaticDef(name, priority, instances, stacksz)
517#define osThreadDef(name, priority, instances, stacksz) osThreadAllocatedDef(name, priority, instances, stacksz)
531#define osThread(name) \
619#if (defined (osFeature_Wait) && (osFeature_Wait != 0))
650#if defined (osObjectsExternal)
651#define osTimerDef(name, function) \
652extern const osTimerDef_t os_timer_def_##name
654#define osTimerDef(name, function) \
658const osTimerDef_t os_timer_def_##name = \
661 (os_ptimer)(function), \
662 &os_timer_##name.data \
676#define osTimer(name) \
780#if defined (osObjectsExternal)
781#define osMutexDef(name) \
782extern const osMutexDef_t os_mutex_def_##name
784#define osMutexDef(name) \
785osMutex os_mutex_data_##name; \
786const osMutexDef_t os_mutex_def_##name = \
789 &os_mutex_data_##name \
803#define osMutex(name) \
863#if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0))
872#if defined (osObjectsExternal)
873#define osSemaphoreDef(name) \
874extern const osSemaphoreDef_t os_semaphore_def_##name
876#define osSemaphoreDef(name) \
877osSemaphore os_semaphore_data_##name; \
878const osSemaphoreDef_t os_semaphore_def_##name = \
881 &os_semaphore_data_##name \
893#define osSemaphore(name) \
894&os_semaphore_def_##name
951#if (defined (osFeature_Pool) && (osFeature_Pool != 0))
962#if defined (osObjectsExternal)
963#define osPoolDef(name, no, type) \
964extern const osPoolDef_t os_pool_def_##name
966#define osPoolAllocatedDef(name, items, type) \
970const osPoolDef_t os_pool_def_##name = \
977 &os_pool_##name.data \
979#define osPoolStaticDef(name, items, type) \
986const osPoolDef_t os_pool_def_##name = \
991 &os_pool_##name.storage, \
992 sizeof(os_pool_##name.storage), \
993 &os_pool_##name.data \
995#if defined(osObjectsStatic)
996#define osPoolDef(name, items, type) osPoolStaticDef(name, items, type)
998#define osPoolDef(name, items, type) osPoolAllocatedDef(name, items, type)
1009#define osPool(name) \
1061#if (defined (osFeature_MessageQ) && (osFeature_MessageQ != 0))
1072#if defined (osObjectsExternal)
1073#define osMessageQDef(name, queue_sz, type) \
1074extern const osMessageQDef_t os_messageQ_def_##name
1076#define osMessageQAllocatedDef(name, items, type) \
1079} os_messageQ_##name; \
1080const osMessageQDef_t os_messageQ_def_##name = { \
1086 &os_messageQ_##name.data \
1088#define osMessageQStaticDef(name, items, type) \
1092 void* queue[items]; \
1093 os_mqueue_index_t links[2 * items]; \
1094 os_mqueue_prio_t prios[items]; \
1096} os_messageQ_##name; \
1097const osMessageQDef_t os_messageQ_def_##name = { \
1101 &os_messageQ_##name.storage, \
1102 sizeof(os_messageQ_##name.storage), \
1103 &os_messageQ_##name.data \
1106#if defined(osObjectsStatic)
1107#define osMessageQDef(name, items, type) osMessageQStaticDef(name, items, type)
1109#define osMessageQDef(name, items, type) osMessageQAllocatedDef(name, items, type)
1123#define osMessageQ(name) \
1124&os_messageQ_def_##name
1173#if (defined (osFeature_MailQ) && (osFeature_MailQ != 0))
1183#if defined (osObjectsExternal)
1184#define osMailQDef(name, queue_sz, type) \
1185extern const osMailQDef_t os_mailQ_def_##name
1187#define osMailQAllocatedDef(name, items, type) \
1194 void* queue[items]; \
1195 os_mqueue_index_t links[2 * items]; \
1196 os_mqueue_prio_t prios[items]; \
1199const osMailQDef_t os_mailQ_def_##name = { \
1208 &os_mailQ_##name.data \
1210#define osMailQStaticDef(name, items, type) \
1217 void* queue[items]; \
1218 os_mqueue_index_t links[2 * items]; \
1219 os_mqueue_prio_t prios[items]; \
1222const osMailQDef_t os_mailQ_def_##name = { \
1227 &os_mailQ_##name.pool_storage, \
1228 sizeof(os_mailQ_##name.pool_storage), \
1229 &os_mailQ_##name.queue_storage, \
1230 sizeof(os_mailQ_##name.queue_storage), \
1231 &os_mailQ_##name.data \
1233#if defined(osObjectsStatic)
1234#define osMailQDef(name, items, type) osMailQStaticDef(name, items, type)
1236#define osMailQDef(name, items, type) osMailQAllocatedDef(name, items, type)
1247#define osMailQ(name) \
1335#pragma GCC diagnostic pop
osStatus osMutexRelease(osMutexId mutex_id)
Release the mutex.
osStatus osDelay(uint32_t millisec)
Time Delay.
#define osSemaphore(name)
Access a Semaphore definition.
osStatus osThreadSetPriority(osThreadId thread_id, osPriority priority)
Change thread priority.
#define osMutex(name)
Access a mutex.
osEvent osMailGet(osMailQId mail_id, uint32_t millisec)
Get a mail from a queue.
#define osTimer(name)
Access the timer.
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.
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).
void(* os_pthread)(void const *argument)
Entry point of a thread.
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).
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).
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.
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
void(* os_ptimer)(void const *argument)
Entry point of a timer call back function.
void * osMailAlloc(osMailQId mail_id, uint32_t millisec)
Allocate a memory block from a mail.
@ osPriorityRealtime
priority: realtime (highest)
@ osPriorityAboveNormal
priority: above normal
@ osPriorityBelowNormal
priority: below normal
@ osPriorityNormal
priority: normal (default)
@ osPriorityIdle
priority: idle (lowest)
@ osPriorityLow
priority: low
@ osPriorityHigh
priority: high
@ osPriorityError
system cannot determine priority or thread has illegal priority
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).
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
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
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
osSemaphore * osSemaphoreId
Semaphore ID identifies the semaphore (pointer to a semaphore control block).
#define osMailQ(name)
Access a mail queue definition.
os_timer_type
Timer type value for the timer definition.
@ osTimerPeriodic
repeating timer
@ osTimerOnce
one-shot timer
os_thread_attr_t osThreadAttr
os_mutex_attr_t osMutexAttr
osStatus
Status code values returned by CMSIS-RTOS functions.
@ osEventMail
function completed; mail event occurred.
@ osErrorISR
not allowed in ISR context: the function cannot be called from interrupt service routines.
@ osErrorTimeoutResource
resource not available within given time: a specified resource was not available within the timeout p...
@ osErrorValue
value of a parameter is out of range.
@ osEventSignal
function completed; signal event occurred.
@ osErrorOS
unspecified RTOS error: run-time error but no other error message fits.
@ osEventTimeout
function completed; timeout occurred.
@ osErrorResource
resource not available: a specified resource was not available.
@ osOK
function completed; no error or event occurred.
@ osErrorPriority
system cannot determine priority or thread has illegal priority.
@ osErrorParameter
parameter error: a mandatory parameter was missing or specified an incorrect object.
@ os_status_reserved
prevent from enum down-size compiler optimization.
@ osEventMessage
function completed; message event occurred.
@ osErrorNoMemory
system is out of memory: it was impossible to allocate or reserve memory for the operation.
@ osErrorISRRecursive
function called multiple times from ISR with same object.
osStatus osThreadTerminate(osThreadId thread_id)
Terminate a thread.
#define osThread(name)
Access a Thread definition.
osStatus osThreadYield(void)
Yield control.
osMailQ * osMailQId
Mail ID identifies the mail queue (pointer to a mail queue control block).
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).
@ os_thread_priority_error
@ os_thread_priority_below_normal
@ os_thread_priority_high
@ os_thread_priority_realtime
@ os_thread_priority_idle
@ os_thread_priority_normal
@ os_thread_priority_above_normal
Event structure contains detailed information about an event.
uint32_t v
message as 32-bit value
void * p
message or mail as void pointer
osStatus status
status code: event or error information
int32_t signals
signal flags
osMailQId mail_id
mail id obtained by osMailCreate
osMessageQId message_id
message id obtained by osMessageCreate
Definition structure for mail queue.
uint32_t items
number of elements in the queue
void * queue
pointer to memory array for queue
uint32_t queue_item_sz
size of a queue item
uint32_t pool_item_sz
size of a pool item
void * pool
pointer to memory array for pool
Memory pool object storage.
Definition structure for message queue.
void * queue
pointer to memory array for messages
uint32_t items
number of elements in the queue
uint32_t item_sz
size of an item
Message queue attributes.
Message queue object storage.
Mutex definition structure contains setup information for a mutex.
Definition structure for memory block allocation.
uint32_t item_sz
size of an item
void * pool
pointer to memory for pool
uint32_t items
number of items (elements) in the pool
Semaphore definition structure contains setup information for a semaphore.
Semaphore object storage.
Thread definition structure contains startup information of a thread.
os_pthread pthread
start address of thread function
osPriority tpriority
initial thread priority
uint32_t stacksize
stack size requirements in bytes; 0 is default stack size
uint32_t instances
maximum number of instances of that thread function
Timer definition structure contains timer parameters.
os_ptimer ptimer
start address of a timer function