µ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 File Reference
#include <cmsis-plus/rtos/os-c-decls.h>
#include <stdint.h>
#include <stddef.h>

Go to the source code of this file.

Classes

struct  os_mail_queue_s
 
struct  os_mailQ_def
 Definition structure for mail queue. More...
 
struct  os_messageQ_def
 Definition structure for message queue. More...
 
struct  os_mutex_def
 Mutex definition structure contains setup information for a mutex. More...
 
struct  os_pool_def
 Definition structure for memory block allocation. More...
 
struct  os_semaphore_def
 Semaphore definition structure contains setup information for a semaphore. More...
 
struct  os_thread_def
 Thread definition structure contains startup information of a thread. More...
 
struct  os_timer_def
 Timer definition structure contains timer parameters. More...
 
struct  osEvent
 Event structure contains detailed information about an event. More...
 

Macros

#define osCMSIS   0x00010002
 API version (main [31:16] .sub [15:0])
 
#define osCMSIS_KERNEL   0x00010000
 RTOS identification and version (main [31:16] .sub [15:0])
 
#define osFeature_MailQ   1
 Mail Queues: 1=available, 0=not available.
 
#define osFeature_MainThread   0
 main thread 1=main can be thread, 0=not available
 
#define osFeature_MessageQ   1
 Message Queues: 1=available, 0=not available.
 
#define osFeature_Pool   1
 Memory Pools: 1=available, 0=not available.
 
#define osFeature_Semaphore   30
 maximum count for osSemaphoreCreate function
 
#define osFeature_Signals   8
 maximum number of Signal Flags available per thread
 
#define osFeature_SysTick   1
 osKernelSysTick functions: 1=available, 0=not available
 
#define osFeature_Wait   1
 osWait function: 1=available, 0=not available
 
#define osKernelSystemId   "µOS++"
 RTOS identification string.
 
#define osKernelSysTickFrequency   (OS_INTEGER_SYSTICK_FREQUENCY_HZ)
 The RTOS kernel system timer frequency.
 
#define osKernelSysTickMicroSec(microsec)   (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000)
 Convert a microseconds value to ticks.
 
#define osMailQ(name)   &os_mailQ_def_##name
 Access a mail queue definition.
 
#define osMailQAllocatedDef(name, items, type)
 Create a mail queue definition.
 
#define osMailQDef(name, items, type)   osMailQAllocatedDef(name, items, type)
 
#define osMailQStaticDef(name, items, type)
 
#define osMessageQ(name)   &os_messageQ_def_##name
 Access a Message Queue.
 
#define osMessageQAllocatedDef(name, items, type)
 Create a Message Queue Definition.
 
#define osMessageQDef(name, items, type)   osMessageQAllocatedDef(name, items, type)
 
#define osMessageQStaticDef(name, items, type)
 
#define osMutex(name)   &os_mutex_def_##name
 Access a mutex.
 
#define osMutexDef(name)
 Define a mutex.
 
#define osPool(name)   &os_pool_def_##name
 Access a Memory Pool definition.
 
#define osPoolAllocatedDef(name, items, type)
 Define a Memory Pool.
 
#define osPoolDef(name, items, type)   osPoolAllocatedDef(name, items, type)
 
#define osPoolStaticDef(name, items, type)
 
#define osSemaphore(name)   &os_semaphore_def_##name
 Access a Semaphore definition.
 
#define osSemaphoreDef(name)
 Define a Semaphore object.
 
#define osThread(name)   &os_thread_def_##name
 Access a Thread definition.
 
#define osThreadAllocatedDef(name, priority, instances, stacksz)
 Create a Thread Definition.
 
#define osThreadDef(name, priority, instances, stacksz)   osThreadAllocatedDef(name, priority, instances, stacksz)
 
#define osThreadStaticDef(name, priority, instances, stacksz)
 
#define osTimer(name)   &os_timer_def_##name
 Access the timer.
 
#define osTimerDef(name, function)
 Define timer.
 
#define osWaitForever   0xFFFFFFFF
 Timeout value.
 

Typedefs

typedef struct os_mail_queue_s os_mail_queue_t
 
typedef void(* os_pthread) (void const *argument)
 Entry point of a thread.
 
typedef void(* os_ptimer) (void const *argument)
 Entry point of a timer call back function.
 
typedef os_mail_queue_t osMailQ
 
typedef struct os_mailQ_def osMailQDef_t
 Definition structure for mail queue.
 
typedef osMailQosMailQId
 Mail ID identifies the mail queue (pointer to a mail queue control block).
 
typedef os_mqueue_t osMessageQ
 
typedef os_mqueue_attr_t osMessageQAttr
 
typedef struct os_messageQ_def osMessageQDef_t
 Definition structure for message queue.
 
typedef osMessageQosMessageQId
 Message ID identifies the message queue (pointer to a message queue control block).
 
typedef os_mutex_t osMutex
 
typedef os_mutex_attr_t osMutexAttr
 
typedef struct os_mutex_def osMutexDef_t
 Mutex definition structure contains setup information for a mutex.
 
typedef osMutexosMutexId
 Mutex ID identifies the mutex (pointer to a mutex control block).
 
typedef os_mempool_t osPool
 
typedef os_mempool_attr_t osPoolAttr
 
typedef struct os_pool_def osPoolDef_t
 Definition structure for memory block allocation.
 
typedef osPoolosPoolId
 Pool ID identifies the memory pool (pointer to a memory pool control block).
 
typedef os_semaphore_t osSemaphore
 
typedef os_semaphore_attr_t osSemaphoreAttr
 
typedef struct os_semaphore_def osSemaphoreDef_t
 Semaphore definition structure contains setup information for a semaphore.
 
typedef osSemaphoreosSemaphoreId
 Semaphore ID identifies the semaphore (pointer to a semaphore control block).
 
typedef os_thread_t osThread
 
typedef os_thread_attr_t osThreadAttr
 
typedef struct os_thread_def osThreadDef_t
 Thread definition structure contains startup information of a thread.
 
typedef osThreadosThreadId
 Thread ID identifies the thread (pointer to a thread control block).
 
typedef os_timer_t osTimer
 
typedef os_timer_attr_t osTimerAttr
 
typedef struct os_timer_def osTimerDef_t
 Timer definition structure contains timer parameters.
 
typedef osTimerosTimerId
 Timer ID identifies the timer (pointer to a timer control block).
 

Enumerations

enum  os_timer_type {
  osTimerOnce = os_timer_once ,
  osTimerPeriodic = os_timer_periodic
}
 Timer type value for the timer definition. More...
 
enum  osPriority {
  osPriorityIdle = os_thread_priority_idle ,
  osPriorityLow = os_thread_priority_low ,
  osPriorityBelowNormal = os_thread_priority_below_normal ,
  osPriorityNormal = os_thread_priority_normal ,
  osPriorityAboveNormal = os_thread_priority_above_normal ,
  osPriorityHigh = os_thread_priority_high ,
  osPriorityRealtime = os_thread_priority_realtime ,
  osPriorityError = os_thread_priority_error
}
 
enum  osStatus {
  osOK = 0 ,
  osEventSignal = 0x08 ,
  osEventMessage = 0x10 ,
  osEventMail = 0x20 ,
  osEventTimeout = 0x40 ,
  osErrorParameter = 0x80 ,
  osErrorResource = 0x81 ,
  osErrorTimeoutResource = 0xC1 ,
  osErrorISR = 0x82 ,
  osErrorISRRecursive = 0x83 ,
  osErrorPriority = 0x84 ,
  osErrorNoMemory = 0x85 ,
  osErrorValue = 0x86 ,
  osErrorOS = 0xFF ,
  os_status_reserved = 0x7FFFFFFF
}
 Status code values returned by CMSIS-RTOS functions. More...
 

Functions

osStatus osDelay (uint32_t millisec)
 Time Delay.
 
osStatus osKernelInitialize (void)
 Initialize the RTOS.
 
int32_t osKernelRunning (void)
 Check if the RTOS scheduler is started.
 
osStatus osKernelStart (void)
 
uint32_t osKernelSysTick (void)
 Get the system timer counter.
 
void * osMailAlloc (osMailQId mail_id, uint32_t millisec)
 Allocate a memory block from a mail.
 
void * osMailCAlloc (osMailQId mail_id, uint32_t millisec)
 Allocate and clear a memory block from a mail.
 
osMailQId osMailCreate (const osMailQDef_t *mail_def, osThreadId thread_id)
 Create a mail queue.
 
osStatus osMailFree (osMailQId mail_id, void *mail)
 Free a memory block from a mail.
 
osEvent osMailGet (osMailQId mail_id, uint32_t millisec)
 Get a mail from a queue.
 
osStatus osMailPut (osMailQId mail_id, void *mail)
 Put a mail to a queue.
 
osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id)
 Create a message queue.
 
osEvent osMessageGet (osMessageQId queue_id, uint32_t millisec)
 Get a message or Wait for a Message from a Queue.
 
osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t millisec)
 Put a message to a queue.
 
osMutexId osMutexCreate (const osMutexDef_t *mutex_def)
 Create a mutex.
 
osStatus osMutexDelete (osMutexId mutex_id)
 Delete the mutex.
 
osStatus osMutexRelease (osMutexId mutex_id)
 Release the mutex.
 
osStatus osMutexWait (osMutexId mutex_id, uint32_t millisec)
 Wait for mutex.
 
void * osPoolAlloc (osPoolId pool_id)
 Allocate a memory block.
 
void * osPoolCAlloc (osPoolId pool_id)
 Allocate and clear a memory block.
 
osPoolId osPoolCreate (const osPoolDef_t *pool_def)
 Create a memory pool.
 
osStatus osPoolFree (osPoolId pool_id, void *block)
 Free a memory block.
 
osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count)
 Create a semaphore.
 
osStatus osSemaphoreDelete (osSemaphoreId semaphore_id)
 Delete the semaphore.
 
osStatus osSemaphoreRelease (osSemaphoreId semaphore_id)
 Release the semaphore.
 
int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec)
 Wait until a Semaphore token becomes available.
 
int32_t osSignalClear (osThreadId thread_id, int32_t signals)
 Clear the specified Signal Flags of an active thread.
 
int32_t osSignalSet (osThreadId thread_id, int32_t signals)
 Set signal flags.
 
osEvent osSignalWait (int32_t signals, uint32_t millisec)
 Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
 
osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *args)
 Create a thread.
 
osThreadId osThreadGetId (void)
 Get the current thread.
 
osPriority osThreadGetPriority (osThreadId thread_id)
 Get thread priority.
 
osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority)
 Change thread priority.
 
osStatus osThreadTerminate (osThreadId thread_id)
 Terminate a thread.
 
osStatus osThreadYield (void)
 Yield control.
 
osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *args)
 Create a timer.
 
osStatus osTimerDelete (osTimerId timer_id)
 Delete the timer.
 
osStatus osTimerStart (osTimerId timer_id, uint32_t millisec)
 Start the timer.
 
osStatus osTimerStop (osTimerId timer_id)
 Stop the timer.
 
osEvent osWait (uint32_t millisec)
 Wait for Signal, Message, Mail, or Timeout.
 

Macro Definition Documentation

◆ osCMSIS

#define osCMSIS   0x00010002

API version (main [31:16] .sub [15:0])

Note
MUST REMAIN UNCHANGED: osCMSIS identifies the CMSIS-RTOS API version.

Definition at line 103 of file cmsis_os.h.

◆ osCMSIS_KERNEL

#define osCMSIS_KERNEL   0x00010000

RTOS identification and version (main [31:16] .sub [15:0])

Note
CAN BE CHANGED: osCMSIS_KERNEL identifies the underlying RTOS kernel and version number.

Definition at line 106 of file cmsis_os.h.

◆ osFeature_MailQ

#define osFeature_MailQ   1

Mail Queues: 1=available, 0=not available.

Definition at line 114 of file cmsis_os.h.

◆ osFeature_MainThread

#define osFeature_MainThread   0

main thread 1=main can be thread, 0=not available

Note
MUST REMAIN UNCHANGED: osFeature_xxx shall be consistent in every CMSIS-RTOS.

Definition at line 112 of file cmsis_os.h.

◆ osFeature_MessageQ

#define osFeature_MessageQ   1

Message Queues: 1=available, 0=not available.

Definition at line 115 of file cmsis_os.h.

◆ osFeature_Pool

#define osFeature_Pool   1

Memory Pools: 1=available, 0=not available.

Definition at line 113 of file cmsis_os.h.

◆ osFeature_Semaphore

#define osFeature_Semaphore   30

maximum count for osSemaphoreCreate function

Definition at line 117 of file cmsis_os.h.

◆ osFeature_Signals

#define osFeature_Signals   8

maximum number of Signal Flags available per thread

Definition at line 116 of file cmsis_os.h.

◆ osFeature_SysTick

#define osFeature_SysTick   1

osKernelSysTick functions: 1=available, 0=not available

Definition at line 119 of file cmsis_os.h.

◆ osFeature_Wait

#define osFeature_Wait   1

osWait function: 1=available, 0=not available

Definition at line 118 of file cmsis_os.h.

◆ osKernelSystemId

#define osKernelSystemId   "µOS++"

RTOS identification string.

Note
MUST REMAIN UNCHANGED: osKernelSystemId shall be consistent in every CMSIS-RTOS.

Definition at line 109 of file cmsis_os.h.

◆ osKernelSysTickFrequency

#define osKernelSysTickFrequency   (OS_INTEGER_SYSTICK_FREQUENCY_HZ)

The RTOS kernel system timer frequency.

Specifies the frequency of the Kernel SysTick timer in Hz. The value is typically use to scale a time value and is for example used in osKernelSysTickMicroSec.

Note
Reflects the system timer setting and is typically defined in a configuration file.

Definition at line 444 of file cmsis_os.h.

◆ osKernelSysTickMicroSec

#define osKernelSysTickMicroSec (   microsec)    (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000)

Convert a microseconds value to ticks.

Allows to scale a microsecond value to the frequency of the Kernel SysTick timer. This macro is typically used to check for short timeouts in polling loops.

Parameters
microsectime value in microseconds.
Returns
time value normalized to the osKernelSysTickFrequency.

Definition at line 457 of file cmsis_os.h.

◆ osMailQ

#define osMailQ (   name)    &os_mailQ_def_##name

Access a mail queue definition.

Parameters
namename of the queue.
Note
CAN BE CHANGED: The parameter to osMailQ shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 1244 of file cmsis_os.h.

◆ osMailQAllocatedDef

#define osMailQAllocatedDef (   name,
  items,
  type 
)
Value:
struct { \
osMailQ data; \
struct { \
type pool[items]; \
} pool_storage; \
struct { \
void* queue[items]; \
os_mqueue_index_t links[2 * items]; \
os_mqueue_prio_t prios[items]; \
} queue_storage; \
} os_mailQ_##name; \
const osMailQDef_t os_mailQ_def_##name = { \
#name, \
(items), \
sizeof (type), \
sizeof (void*), \
0, \
0, \
0, \
0, \
&os_mailQ_##name.data \
}
uint8_t os_mqueue_prio_t
Type of variables holding message queue priorities.
os_mqueue_size_t os_mqueue_index_t
Definition structure for mail queue.
Definition cmsis_os.h:357

Create a mail queue definition.

Parameters
namename of the queue.
itemsmaximum number of messages in queue.
typedata type of a single message element.
Note
CAN BE CHANGED: The parameter to osMailQDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 1184 of file cmsis_os.h.

◆ osMailQDef

#define osMailQDef (   name,
  items,
  type 
)    osMailQAllocatedDef(name, items, type)

Definition at line 1233 of file cmsis_os.h.

◆ osMailQStaticDef

#define osMailQStaticDef (   name,
  items,
  type 
)
Value:
struct { \
osMailQ data; \
struct { \
type pool[items]; \
} pool_storage; \
struct { \
void* queue[items]; \
os_mqueue_index_t links[2 * items]; \
os_mqueue_prio_t prios[items]; \
} queue_storage; \
} os_mailQ_##name; \
const osMailQDef_t os_mailQ_def_##name = { \
#name, \
(items), \
sizeof (type), \
sizeof (void*), \
&os_mailQ_##name.pool_storage, \
sizeof(os_mailQ_##name.pool_storage), \
&os_mailQ_##name.queue_storage, \
sizeof(os_mailQ_##name.queue_storage), \
&os_mailQ_##name.data \
}

Definition at line 1207 of file cmsis_os.h.

◆ osMessageQ

#define osMessageQ (   name)    &os_messageQ_def_##name

Access a Message Queue.

Parameters
namename of the queue.

Access to the message queue definition for the function osMessageCreate.

Note
CAN BE CHANGED: The parameter to osMessageQ shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 1120 of file cmsis_os.h.

◆ osMessageQAllocatedDef

#define osMessageQAllocatedDef (   name,
  items,
  type 
)
Value:
struct { \
osMessageQ data; \
} os_messageQ_##name; \
const osMessageQDef_t os_messageQ_def_##name = { \
#name, \
(items), \
sizeof (void*), \
0, \
0, \
&os_messageQ_##name.data \
}
Definition structure for message queue.
Definition cmsis_os.h:343
Message queue object storage.

Create a Message Queue Definition.

Parameters
namename of the queue.
itemsmaximum number of messages in the queue.
typedata type of a single message element (for debugger).
Note
CAN BE CHANGED: The parameter to osMessageQDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 1073 of file cmsis_os.h.

◆ osMessageQDef

#define osMessageQDef (   name,
  items,
  type 
)    osMessageQAllocatedDef(name, items, type)

Definition at line 1106 of file cmsis_os.h.

◆ osMessageQStaticDef

#define osMessageQStaticDef (   name,
  items,
  type 
)
Value:
struct { \
osMessageQ data; \
struct { \
void* queue[items]; \
os_mqueue_index_t links[2 * items]; \
os_mqueue_prio_t prios[items]; \
} storage; \
} os_messageQ_##name; \
const osMessageQDef_t os_messageQ_def_##name = { \
#name, \
(items), \
sizeof (void*), \
&os_messageQ_##name.storage, \
sizeof(os_messageQ_##name.storage), \
&os_messageQ_##name.data \
}

Definition at line 1085 of file cmsis_os.h.

◆ osMutex

#define osMutex (   name)    &os_mutex_def_##name

Access a mutex.

Parameters
namename of the mutex object.

Provides osMutexCreate access to the mutex object definition.

Note
CAN BE CHANGED: The parameter to osMutex shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 800 of file cmsis_os.h.

◆ osMutexDef

#define osMutexDef (   name)
Value:
osMutex os_mutex_data_##name; \
const osMutexDef_t os_mutex_def_##name = \
{ \
#name, \
&os_mutex_data_##name \
}
Mutex definition structure contains setup information for a mutex.
Definition cmsis_os.h:306
Mutex object storage.
Definition os-c-decls.h:967

Define a mutex.

Parameters
namename of the mutex object.

Define a mutex object that is referenced by osMutex.

Note
CAN BE CHANGED: The parameter to osMutexDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 781 of file cmsis_os.h.

◆ osPool

#define osPool (   name)    &os_pool_def_##name

Access a Memory Pool definition.

Parameters
namename of the memory pool.
Note
CAN BE CHANGED: The parameter to osPool shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 1006 of file cmsis_os.h.

◆ osPoolAllocatedDef

#define osPoolAllocatedDef (   name,
  items,
  type 
)
Value:
struct { \
osPool data; \
} os_pool_##name; \
const osPoolDef_t os_pool_def_##name = \
{ \
#name, \
(items), \
sizeof(type), \
0, \
0, \
&os_pool_##name.data \
}
Memory pool object storage.
Definition structure for memory block allocation.
Definition cmsis_os.h:329

Define a Memory Pool.

Parameters
namename of the memory pool.
itemsmaximum number of blocks (objects) in the memory pool.
typedata type of a single block (object).
Note
CAN BE CHANGED: The parameter to osPoolDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 963 of file cmsis_os.h.

◆ osPoolDef

#define osPoolDef (   name,
  items,
  type 
)    osPoolAllocatedDef(name, items, type)

Definition at line 995 of file cmsis_os.h.

◆ osPoolStaticDef

#define osPoolStaticDef (   name,
  items,
  type 
)
Value:
struct { \
osPool data; \
struct { \
type pool[items]; \
} storage; \
} os_pool_##name; \
const osPoolDef_t os_pool_def_##name = \
{ \
#name, \
(items), \
sizeof(type), \
&os_pool_##name.storage, \
sizeof(os_pool_##name.storage), \
&os_pool_##name.data \
}

Definition at line 976 of file cmsis_os.h.

◆ osSemaphore

#define osSemaphore (   name)    &os_semaphore_def_##name

Access a Semaphore definition.

Parameters
namename of the semaphore object.
Note
CAN BE CHANGED: The parameter to osSemaphore shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 890 of file cmsis_os.h.

◆ osSemaphoreDef

#define osSemaphoreDef (   name)
Value:
osSemaphore os_semaphore_data_##name; \
const osSemaphoreDef_t os_semaphore_def_##name = \
{ \
#name, \
&os_semaphore_data_##name \
}
Semaphore definition structure contains setup information for a semaphore.
Definition cmsis_os.h:316
Semaphore object storage.

Define a Semaphore object.

Parameters
namename of the semaphore object.
Note
CAN BE CHANGED: The parameter to osSemaphoreDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 873 of file cmsis_os.h.

◆ osThread

#define osThread (   name)    &os_thread_def_##name

Access a Thread definition.

Parameters
namename of the thread definition object.

Access to the thread definition for the function osThreadCreate.

Note
CAN BE CHANGED: The parameter to osThread shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 528 of file cmsis_os.h.

◆ osThreadAllocatedDef

#define osThreadAllocatedDef (   name,
  priority,
  instances,
  stacksz 
)
Value:
struct { \
osThread data[instances]; \
} os_thread_##name; \
const osThreadDef_t os_thread_def_##name = \
{ \
#name, \
(os_pthread)(name), \
(priority), \
(instances), \
(stacksz), \
&os_thread_##name.data[0], \
0 \
}
Thread definition structure contains startup information of a thread.
Definition cmsis_os.h:278
Thread object storage.
Definition os-c-decls.h:572

Create a Thread Definition.

Parameters
namename of the thread function.
priorityinitial priority of the thread function.
instancesnumber of possible thread instances.
stackszstack size (in bytes) requirements for the thread function.

Define the attributes of a thread functions that can be created by the function osThreadCreate using osThread.

Note
CAN BE CHANGED: The parameters to osThreadDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 482 of file cmsis_os.h.

◆ osThreadDef

#define osThreadDef (   name,
  priority,
  instances,
  stacksz 
)    osThreadAllocatedDef(name, priority, instances, stacksz)

Definition at line 514 of file cmsis_os.h.

◆ osThreadStaticDef

#define osThreadStaticDef (   name,
  priority,
  instances,
  stacksz 
)
Value:
struct { \
uint64_t stack[(instances)*((stacksz+sizeof(uint64_t)-1)/sizeof(uint64_t))]; \
osThread data[instances]; \
} os_thread_##name; \
const osThreadDef_t os_thread_def_##name = \
{ \
#name, \
(os_pthread)(name), \
(priority), \
(instances), \
(stacksz), \
&os_thread_##name.data[0], \
&os_thread_##name.stack[0] \
}

Definition at line 496 of file cmsis_os.h.

◆ osTimer

#define osTimer (   name)    &os_timer_def_##name

Access the timer.

Parameters
namename of the timer object.

Provide access to the timer definition for the function osTimerCreate.

Note
CAN BE CHANGED: The parameter to osTimer shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 673 of file cmsis_os.h.

◆ osTimerDef

#define osTimerDef (   name,
  function 
)
Value:
struct { \
osTimer data; \
} os_timer_##name; \
const osTimerDef_t os_timer_def_##name = \
{ \
#name, \
(os_ptimer)(function), \
&os_timer_##name.data \
}
Timer definition structure contains timer parameters.
Definition cmsis_os.h:295
Timer object storage.
Definition os-c-decls.h:782

Define timer.

Parameters
namename of the timer object.
functionname of the timer call back function.

Define the attributes of a timer object.

Note
CAN BE CHANGED: The parameter to osTimerDef shall be consistent but the macro body is implementation specific in every CMSIS-RTOS.

Definition at line 651 of file cmsis_os.h.

◆ osWaitForever

#define osWaitForever   0xFFFFFFFF

Timeout value.

Note
The names MUST REMAIN UNCHANGED: osWaitForever shall be consistent in every CMSIS-RTOS. wait forever timeout value

Definition at line 152 of file cmsis_os.h.

Typedef Documentation

◆ os_mail_queue_t

◆ os_pthread

typedef void(* os_pthread) (void const *argument)

Entry point of a thread.

Note
MUST REMAIN UNCHANGED: os_pthread shall be consistent in every CMSIS-RTOS.

Definition at line 191 of file cmsis_os.h.

◆ os_ptimer

typedef void(* os_ptimer) (void const *argument)

Entry point of a timer call back function.

Note
MUST REMAIN UNCHANGED: os_ptimer shall be consistent in every CMSIS-RTOS.

Definition at line 198 of file cmsis_os.h.

◆ osMailQ

Definition at line 226 of file cmsis_os.h.

◆ osMailQDef_t

typedef struct os_mailQ_def osMailQDef_t

Definition structure for mail queue.

Note
CAN BE CHANGED: os_mailQ_def is implementation specific in every CMSIS-RTOS.

◆ osMailQId

typedef osMailQ* osMailQId

Mail ID identifies the mail queue (pointer to a mail queue control block).

Note
CAN BE CHANGED: os_mailQ_cb is implementation specific in every CMSIS-RTOS.

Definition at line 268 of file cmsis_os.h.

◆ osMessageQ

Definition at line 217 of file cmsis_os.h.

◆ osMessageQAttr

Definition at line 218 of file cmsis_os.h.

◆ osMessageQDef_t

Definition structure for message queue.

Note
CAN BE CHANGED: os_messageQ_def is implementation specific in every CMSIS-RTOS.

◆ osMessageQId

Message ID identifies the message queue (pointer to a message queue control block).

Note
CAN BE CHANGED: os_messageQ_cb is implementation specific in every CMSIS-RTOS.

Definition at line 262 of file cmsis_os.h.

◆ osMutex

Definition at line 208 of file cmsis_os.h.

◆ osMutexAttr

Definition at line 209 of file cmsis_os.h.

◆ osMutexDef_t

typedef struct os_mutex_def osMutexDef_t

Mutex definition structure contains setup information for a mutex.

Note
CAN BE CHANGED: os_mutex_def is implementation specific in every CMSIS-RTOS.

◆ osMutexId

typedef osMutex* osMutexId

Mutex ID identifies the mutex (pointer to a mutex control block).

Note
CAN BE CHANGED: os_mutex_cb is implementation specific in every CMSIS-RTOS.

Definition at line 244 of file cmsis_os.h.

◆ osPool

Definition at line 214 of file cmsis_os.h.

◆ osPoolAttr

Definition at line 215 of file cmsis_os.h.

◆ osPoolDef_t

typedef struct os_pool_def osPoolDef_t

Definition structure for memory block allocation.

Note
CAN BE CHANGED: os_pool_def is implementation specific in every CMSIS-RTOS.

◆ osPoolId

typedef osPool* osPoolId

Pool ID identifies the memory pool (pointer to a memory pool control block).

Note
CAN BE CHANGED: os_pool_cb is implementation specific in every CMSIS-RTOS.

Definition at line 256 of file cmsis_os.h.

◆ osSemaphore

Definition at line 211 of file cmsis_os.h.

◆ osSemaphoreAttr

Definition at line 212 of file cmsis_os.h.

◆ osSemaphoreDef_t

Semaphore definition structure contains setup information for a semaphore.

Note
CAN BE CHANGED: os_semaphore_def is implementation specific in every CMSIS-RTOS.

◆ osSemaphoreId

Semaphore ID identifies the semaphore (pointer to a semaphore control block).

Note
CAN BE CHANGED: os_semaphore_cb is implementation specific in every CMSIS-RTOS.

Definition at line 250 of file cmsis_os.h.

◆ osThread

Definition at line 202 of file cmsis_os.h.

◆ osThreadAttr

Definition at line 203 of file cmsis_os.h.

◆ osThreadDef_t

typedef struct os_thread_def osThreadDef_t

Thread definition structure contains startup information of a thread.

Note
CAN BE CHANGED: os_thread_def is implementation specific in every CMSIS-RTOS.

◆ osThreadId

typedef osThread* osThreadId

Thread ID identifies the thread (pointer to a thread control block).

Note
CAN BE CHANGED: os_thread_cb is implementation specific in every CMSIS-RTOS.

Definition at line 232 of file cmsis_os.h.

◆ osTimer

Definition at line 205 of file cmsis_os.h.

◆ osTimerAttr

Definition at line 206 of file cmsis_os.h.

◆ osTimerDef_t

typedef struct os_timer_def osTimerDef_t

Timer definition structure contains timer parameters.

Note
CAN BE CHANGED: os_timer_def is implementation specific in every CMSIS-RTOS.

◆ osTimerId

typedef osTimer* osTimerId

Timer ID identifies the timer (pointer to a timer control block).

Note
CAN BE CHANGED: os_timer_cb is implementation specific in every CMSIS-RTOS.

Definition at line 238 of file cmsis_os.h.

Enumeration Type Documentation

◆ os_timer_type

Timer type value for the timer definition.

Note
The names MUST REMAIN UNCHANGED: os_timer_type shall be consistent in every CMSIS-RTOS.
Enumerator
osTimerOnce 

one-shot timer

osTimerPeriodic 

repeating timer

Definition at line 181 of file cmsis_os.h.

◆ osPriority

enum osPriority

Priority used for thread control.

Note
The names MUST REMAIN UNCHANGED: osPriority shall be consistent in every CMSIS-RTOS.
Enumerator
osPriorityIdle 

priority: idle (lowest)

osPriorityLow 

priority: low

osPriorityBelowNormal 

priority: below normal

osPriorityNormal 

priority: normal (default)

osPriorityAboveNormal 

priority: above normal

osPriorityHigh 

priority: high

osPriorityRealtime 

priority: realtime (highest)

osPriorityError 

system cannot determine priority or thread has illegal priority

Definition at line 136 of file cmsis_os.h.

◆ osStatus

enum osStatus

Status code values returned by CMSIS-RTOS functions.

Note
The names MUST REMAIN UNCHANGED: osStatus shall be consistent in every CMSIS-RTOS.
Enumerator
osOK 

function completed; no error or event occurred.

osEventSignal 

function completed; signal event occurred.

osEventMessage 

function completed; message event occurred.

osEventMail 

function completed; mail event occurred.

osEventTimeout 

function completed; timeout occurred.

osErrorParameter 

parameter error: a mandatory parameter was missing or specified an incorrect object.

osErrorResource 

resource not available: a specified resource was not available.

osErrorTimeoutResource 

resource not available within given time: a specified resource was not available within the timeout period.

osErrorISR 

not allowed in ISR context: the function cannot be called from interrupt service routines.

osErrorISRRecursive 

function called multiple times from ISR with same object.

osErrorPriority 

system cannot determine priority or thread has illegal priority.

osErrorNoMemory 

system is out of memory: it was impossible to allocate or reserve memory for the operation.

osErrorValue 

value of a parameter is out of range.

osErrorOS 

unspecified RTOS error: run-time error but no other error message fits.

os_status_reserved 

prevent from enum down-size compiler optimization.

Definition at line 158 of file cmsis_os.h.

Function Documentation

◆ osDelay()

osStatus osDelay ( uint32_t  millisec)

Time Delay.

Parameters
[in]millisecTimeout value "time delay" value.
Return values
osEventTimeoutThe time delay is executed.
osErrorISRosDelay() cannot be called from interrupt service routines.

Wait for a specified time period in millisec.

The millisec value specifies the number of timer ticks and is therefore an upper bound. The exact time delay depends on the actual time elapsed since the last timer tick.

For a value of 1, the system waits until the next timer tick occurs. That means that the actual time delay may be up to one timer tick less.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3490 of file os-c-wrapper.cpp.

◆ osKernelInitialize()

osStatus osKernelInitialize ( void  )

Initialize the RTOS.

Return values
osOKThe RTOS kernel was initialised.
osErrorISRThe function cannot be invoked from Interrupt Service Routines.
Note
MUST REMAIN UNCHANGED: osKernelInitialize shall be consistent in every CMSIS-RTOS.

Initialise of the RTOS Kernel to allow peripheral setup and creation of other RTOS objects with the functions:

  • osThreadCreate : Create a thread function.
  • osTimerCreate : Define attributes of the timer callback function.
  • osMutexCreate : Define and initialise a mutex.
  • osSemaphoreCreate : Define and initialise a semaphore.
  • osPoolCreate : Define and initialise a fix-size memory pool.
  • osMessageCreate : Define and initialise a message queue.
  • osMailCreate : Define and initialise a mail queue with fix-size memory blocks.

The RTOS scheduler does not start thread switching until the function osKernelStart is called.

Note
In case that the RTOS Kernel starts thread execution with the function main the function osKernelInitialize stops thread switching. This allows you to setup the system to a defined state before thread switching is resumed with osKernelStart.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3178 of file os-c-wrapper.cpp.

◆ osKernelRunning()

int32_t osKernelRunning ( void  )

Check if the RTOS scheduler is started.

Return values
0The RTOS is not started.
1The RTOS is started.

Identifies if the RTOS scheduler is started. For systems with the option to start the main function as a thread this allows you to identify that the RTOS scheduler is already running.

Note
Can be invoked from Interrupt Service Routines.

Definition at line 3215 of file os-c-wrapper.cpp.

◆ osKernelStart()

osStatus osKernelStart ( void  )

Start the RTOS scheduler.

Return values
osOKThe RTOS scheduler has been successfully started.
osErrorISRThe function cannot be invoked from Interrupt Service Routines.
Note
MUST REMAIN UNCHANGED: osKernelStart shall be consistent in every CMSIS-RTOS.

Start the RTOS Kernel and begin thread switching.

Note
When the CMSIS-RTOS starts thread execution with the function main this function resumes thread switching. The main thread will continue executing after osKernelStart.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3200 of file os-c-wrapper.cpp.

◆ osKernelSysTick()

uint32_t osKernelSysTick ( void  )

Get the system timer counter.

Returns
The RTOS kernel system timer as a 32-bits value.
Note
MUST REMAIN UNCHANGED: osKernelSysTick shall be consistent in every CMSIS-RTOS.

◆ osMailAlloc()

void * osMailAlloc ( osMailQId  mail_id,
uint32_t  millisec 
)

Allocate a memory block from a mail.

Parameters
[in]mail_idmail queue ID obtained with osMailCreate.
[in]millisecTimeout value or 0 in case of no time-out.
Returns
pointer to memory block that can be filled with mail or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMailAlloc shall be consistent in every CMSIS-RTOS.

◆ osMailCAlloc()

void * osMailCAlloc ( osMailQId  mail_id,
uint32_t  millisec 
)

Allocate and clear a memory block from a mail.

Parameters
[in]mail_idmail queue ID obtained with osMailCreate.
[in]millisecTimeout value or 0 in case of no time-out.
Returns
pointer to memory block that can be filled with mail or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMailCAlloc shall be consistent in every CMSIS-RTOS.

◆ osMailCreate()

osMailQId osMailCreate ( const osMailQDef_t mail_def,
osThreadId  thread_id 
)

Create a mail queue.

Parameters
[in]mail_defreference to the mail queue definition obtain with osMailQ.
[in]thread_idthread ID (obtained by osThreadCreate or osThreadGetId) or NULL.
Returns
mail queue ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMailCreate shall be consistent in every CMSIS-RTOS.

◆ osMailFree()

osStatus osMailFree ( osMailQId  mail_id,
void *  mail 
)

Free a memory block from a mail.

Parameters
[in]mail_idmail queue ID obtained with osMailCreate.
[in]mailpointer to the memory block that was obtained with osMailGet.
Return values
osOKThe mail block is released.
osErrorValueMail block does not belong to the mail queue pool.
osErrorParameterThe value to the parameter queue_id is incorrect.
Note
MUST REMAIN UNCHANGED: osMailFree shall be consistent in every CMSIS-RTOS.

◆ osMailGet()

osEvent osMailGet ( osMailQId  mail_id,
uint32_t  millisec 
)

Get a mail from a queue.

Parameters
[in]mail_idmail queue ID obtained with osMailCreate.
[in]millisecTimeout value or 0 in case of no time-out.
Return values
osOKNo mail is available in the queue and no timeout was specified.
osEventTimeoutNo mail has arrived during the given timeout period.
osEventMailMail received, value.p contains the pointer to mail content.
osErrorParameterA parameter is invalid or outside of a permitted range.
Note
MUST REMAIN UNCHANGED: osMailGet shall be consistent in every CMSIS-RTOS.

◆ osMailPut()

osStatus osMailPut ( osMailQId  mail_id,
void *  mail 
)

Put a mail to a queue.

Parameters
[in]mail_idmail queue ID obtained with osMailCreate.
[in]mailmemory block previously allocated with osMailAlloc or osMailCAlloc.
Return values
osOKThe message is put into the queue.
osErrorValueMail was previously not allocated as memory slot.
osErrorParameterA parameter is invalid or outside of a permitted range.
Note
MUST REMAIN UNCHANGED: osMailPut shall be consistent in every CMSIS-RTOS.

◆ osMessageCreate()

osMessageQId osMessageCreate ( const osMessageQDef_t queue_def,
osThreadId  thread_id 
)

Create a message queue.

Parameters
[in]queue_defqueue definition referenced with osMessageQ.
[in]thread_idthread ID (obtained by osThreadCreate or osThreadGetId) or NULL.
Returns
message queue ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMessageCreate shall be consistent in every CMSIS-RTOS.

◆ osMessageGet()

osEvent osMessageGet ( osMessageQId  queue_id,
uint32_t  millisec 
)

Get a message or Wait for a Message from a Queue.

Parameters
[in]queue_idmessage queue ID obtained with osMessageCreate.
[in]millisecTimeout value or 0 in case of no time-out.
Return values
osOKNo message is available in the queue and no timeout was specified.
osEventTimeoutNo message has arrived during the given timeout period.
osEventMessageMessage received, value.p contains the pointer to message.
osErrorParameterA parameter is invalid or outside of a permitted range.
Note
MUST REMAIN UNCHANGED: osMessageGet shall be consistent in every CMSIS-RTOS.

◆ osMessagePut()

osStatus osMessagePut ( osMessageQId  queue_id,
uint32_t  info,
uint32_t  millisec 
)

Put a message to a queue.

Parameters
[in]queue_idmessage queue ID obtained with osMessageCreate.
[in]infomessage information.
[in]millisecTimeout value or 0 in case of no time-out.
Return values
osOKThe message is put into the queue.
osErrorResourceno memory in the queue was available.
osErrorTimeoutResourceno memory in the queue was available during the given time limit.
osErrorParametera parameter is invalid or outside of a permitted range. status code that indicates the execution status of the function.
Note
MUST REMAIN UNCHANGED: osMessagePut shall be consistent in every CMSIS-RTOS.

◆ osMutexCreate()

osMutexId osMutexCreate ( const osMutexDef_t mutex_def)

Create a mutex.

Parameters
[in]mutex_defmutex definition referenced with osMutex.
Returns
mutex ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osMutexCreate shall be consistent in every CMSIS-RTOS.

Create and initialise a mutex object instance.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3843 of file os-c-wrapper.cpp.

◆ osMutexDelete()

osStatus osMutexDelete ( osMutexId  mutex_id)

Delete the mutex.

Parameters
[in]mutex_idmutex ID obtained by osMutexCreate.
Return values
osOKThe mutex object has been deleted.
osErrorISRosMutexDelete cannot be called from interrupt service routines.
osErrorResourceAll tokens have already been released.
osErrorParameterThe parameter mutex_id is incorrect.
Note
MUST REMAIN UNCHANGED: osMutexDelete shall be consistent in every CMSIS-RTOS.

Delete a mutex object instance. The function releases internal memory obtained for mutex handling. After this call the mutex_id is no longer valid and cannot be used. The mutex may be created again using the function osMutexCreate.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3991 of file os-c-wrapper.cpp.

◆ osMutexRelease()

osStatus osMutexRelease ( osMutexId  mutex_id)

Release the mutex.

Parameters
[in]mutex_idmutex ID obtained by osMutexCreate.
Return values
osOKThe mutex has been correctly released.
osErrorResourceThe mutex was not obtained before.
osErrorParameterThe parameter mutex_id is incorrect.
osErrorISRosMutexRelease cannot be called from interrupt service routines.
Note
MUST REMAIN UNCHANGED: osMutexRelease shall be consistent in every CMSIS-RTOS.

Release a mutex that was obtained with osMutexWait. Other threads that currently wait for the same mutex will be now put into the state READY.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3952 of file os-c-wrapper.cpp.

◆ osMutexWait()

osStatus osMutexWait ( osMutexId  mutex_id,
uint32_t  millisec 
)

Wait for mutex.

Parameters
[in]mutex_idmutex ID obtained by osMutexCreate.
[in]millisecTimeout value or 0 in case of no time-out.
Return values
osOKThe mutex has been obtain.
osErrorTimeoutResourcethe mutex could not be obtained in the given time.
osErrorResourceThe mutex could not be obtained when no timeout was specified.
osErrorParameterThe parameter mutex_id is incorrect.
osErrorISRosMutexWait cannot be called from interrupt service routines.
Note
MUST REMAIN UNCHANGED: osMutexWait shall be consistent in every CMSIS-RTOS.

Wait until a mutex becomes available. If no other thread has obtained the mutex, the function instantly returns and blocks the mutex object.

The argument millisec specifies how long the system waits for a mutex. While the system waits the thread that is calling this function is put into the state WAITING. The millisec timeout can have the following values:

  • when millisec is 0, the function returns instantly.
  • when millisec is set to osWaitForever the function will wait for an infinite time until the mutex becomes available.
  • all other values specify a time in millisecond for a timeout.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3883 of file os-c-wrapper.cpp.

◆ osPoolAlloc()

void * osPoolAlloc ( osPoolId  pool_id)

Allocate a memory block.

Parameters
[in]pool_idmemory pool ID obtain referenced with osPoolCreate.
Returns
address of the allocated memory block or NULL in case of no memory available.
Note
MUST REMAIN UNCHANGED: osPoolAlloc shall be consistent in every CMSIS-RTOS.

◆ osPoolCAlloc()

void * osPoolCAlloc ( osPoolId  pool_id)

Allocate and clear a memory block.

Parameters
[in]pool_idmemory pool ID obtain referenced with osPoolCreate.
Returns
address of the allocated memory block or NULL in case of no memory available.
Note
MUST REMAIN UNCHANGED: osPoolCAlloc shall be consistent in every CMSIS-RTOS.

◆ osPoolCreate()

osPoolId osPoolCreate ( const osPoolDef_t pool_def)

Create a memory pool.

Parameters
[in]pool_defmemory pool definition referenced with osPool.
Returns
memory pool ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osPoolCreate shall be consistent in every CMSIS-RTOS.

◆ osPoolFree()

osStatus osPoolFree ( osPoolId  pool_id,
void *  block 
)

Free a memory block.

Parameters
[in]pool_idmemory pool ID obtain referenced with osPoolCreate.
[in]blockaddress of the allocated memory block that is returned to the memory pool.
Return values
osOKThe memory block is released.
osErrorValueThe block does not belong to the memory pool.
osErrorParameterA parameter is invalid or outside of a permitted range.
Note
MUST REMAIN UNCHANGED: osPoolFree shall be consistent in every CMSIS-RTOS.

◆ osSemaphoreCreate()

osSemaphoreId osSemaphoreCreate ( const osSemaphoreDef_t semaphore_def,
int32_t  count 
)

Create a semaphore.

Parameters
[in]semaphore_defsemaphore definition referenced with osSemaphore.
[in]countnumber of available resources.
Returns
semaphore ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osSemaphoreCreate shall be consistent in every CMSIS-RTOS.

◆ osSemaphoreDelete()

osStatus osSemaphoreDelete ( osSemaphoreId  semaphore_id)

Delete the semaphore.

Parameters
[in]semaphore_idsemaphore object referenced with osSemaphoreCreate.
Return values
osOKThe semaphore object has been deleted.
osErrorISRosSemaphoreDelete cannot be called from interrupt service routines.
osErrorResourceThe semaphore object could not be deleted.
osErrorParameterThe parameter semaphore_id is incorrect.
Note
MUST REMAIN UNCHANGED: osSemaphoreDelete shall be consistent in every CMSIS-RTOS.

◆ osSemaphoreRelease()

osStatus osSemaphoreRelease ( osSemaphoreId  semaphore_id)

Release the semaphore.

Parameters
[in]semaphore_idsemaphore object referenced with osSemaphoreCreate.
Return values
osOKThe semaphore has been released.
osErrorResourceAll tokens have already been released.
osErrorParameterThe parameter semaphore_id is incorrect.
Note
MUST REMAIN UNCHANGED: osSemaphoreRelease shall be consistent in every CMSIS-RTOS.

◆ osSemaphoreWait()

int32_t osSemaphoreWait ( osSemaphoreId  semaphore_id,
uint32_t  millisec 
)

Wait until a Semaphore token becomes available.

Parameters
[in]semaphore_idsemaphore object referenced with osSemaphoreCreate.
[in]millisecTimeout value or 0 in case of no time-out.
Returns
number of available tokens, or -1 in case of incorrect parameters.
Note
MUST REMAIN UNCHANGED: osSemaphoreWait shall be consistent in every CMSIS-RTOS.

◆ osSignalClear()

int32_t osSignalClear ( osThreadId  thread_id,
int32_t  signals 
)

Clear the specified Signal Flags of an active thread.

Parameters
[in]thread_idthread ID obtained by osThreadCreate or osThreadGetId.
[in]signalsspecifies the signal flags of the thread that shall be cleared.
Returns
previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters or call from ISR.
Note
MUST REMAIN UNCHANGED: osSignalClear shall be consistent in every CMSIS-RTOS.

Clear the signal flags of an active thread.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3717 of file os-c-wrapper.cpp.

◆ osSignalSet()

int32_t osSignalSet ( osThreadId  thread_id,
int32_t  signals 
)

Set signal flags.

Parameters
[in]thread_idthread ID obtained by osThreadCreate or osThreadGetId.
[in]signalsspecifies the signal flags of the thread that should be set.
Returns
previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
Note
MUST REMAIN UNCHANGED: osSignalSet shall be consistent in every CMSIS-RTOS.

Set the signal flags of an active thread.

Note
Can be invoked from Interrupt Service Routines.

Definition at line 3693 of file os-c-wrapper.cpp.

◆ osSignalWait()

osEvent osSignalWait ( int32_t  signals,
uint32_t  millisec 
)

Wait for one or more Signal Flags to become signaled for the current RUNNING thread.

Parameters
[in]signalswait until all specified signal flags set or 0 for any single signal flag.
[in]millisecTimeout value or 0 in case of no time-out.
Return values
osOKNo signal received when the timeout value millisec was 0.
osEventTimeoutSignal not occurred within timeout.
osEventSignalSignal occurred, value.signals contains the signal flags; these signal flags are cleared.
osErrorValueThe value signals is outside of the permitted range.
osErrorISRosSignalWait cannot be called from interrupt service routines.
Note
MUST REMAIN UNCHANGED: osSignalWait shall be consistent in every CMSIS-RTOS.

Suspend the execution of the current RUNNING thread until all specified signal flags with the parameter signals are set. When the parameter signals is 0 the current RUNNING thread is suspended until any signal is set. When these signal flags are already set, the function returns instantly. Otherwise the thread is put into the state WAITING. Signal flags that are reported as event are automatically cleared.

The argument millisec specifies how long the system waits for the specified signal flags. While the system waits the tread calling this function is put into the state WAITING. The timeout value can have the following values:

  • when millisec is 0, the function returns instantly.
  • when millisec is set to osWaitForever the function will wait an infinite time until a specified signal is set.
  • all other values specify a time in millisecond for a timeout.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3767 of file os-c-wrapper.cpp.

◆ osThreadCreate()

osThreadId osThreadCreate ( const osThreadDef_t thread_def,
void *  args 
)

Create a thread.

Parameters
[in]thread_defThread definition referenced with osThread.
[in]argsPointer that is passed to the thread function as start argument.
Returns
thread ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osThreadCreate shall be consistent in every CMSIS-RTOS.

Find a free slot in the array of thread definitions and initialise the thread.

Start the thread function by adding it to the Active Threads list and set it to state READY. The thread function receives the argument pointer as function argument when the function is started. When the priority of the created thread function is higher than the current RUNNING thread, the created thread function starts instantly and becomes the new RUNNING thread.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3262 of file os-c-wrapper.cpp.

◆ osThreadGetId()

osThreadId osThreadGetId ( void  )

Get the current thread.

Returns
thread ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osThreadGetId shall be consistent in every CMSIS-RTOS.

Get the thread ID of the current running thread.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3317 of file os-c-wrapper.cpp.

◆ osThreadGetPriority()

osPriority osThreadGetPriority ( osThreadId  thread_id)

Get thread priority.

Parameters
[in]thread_idthread ID obtained by osThreadCreate or osThreadGetId.
Returns
The current priority value of the thread, or osPriorityError if error.
Note
MUST REMAIN UNCHANGED: osThreadGetPriority shall be consistent in every CMSIS-RTOS.

Get the priority of an active thread. In case of a failure the value osPriorityError is returned.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3455 of file os-c-wrapper.cpp.

◆ osThreadSetPriority()

osStatus osThreadSetPriority ( osThreadId  thread_id,
osPriority  priority 
)

Change thread priority.

Parameters
[in]thread_idthread ID obtained by osThreadCreate or osThreadGetId.
[in]prioritynew priority value for the thread function.
Return values
osOKThe priority of the specified thread has been successfully changed.
osErrorParameterthread_id is incorrect.
osErrorValueincorrect priority value.
osErrorResourcethread_id refers to a thread that is not an active thread.
osErrorISRosThreadSetPriority cannot be called from interrupt service routines.
Note
MUST REMAIN UNCHANGED: osThreadSetPriority shall be consistent in every CMSIS-RTOS.

Change the priority of a running thread. There is no need for an extra yield after it, if the priorities require, there is an implicit reschedule.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3401 of file os-c-wrapper.cpp.

◆ osThreadTerminate()

osStatus osThreadTerminate ( osThreadId  thread_id)

Terminate a thread.

Parameters
[in]thread_idthread ID obtained by osThreadCreate or osThreadGetId.
Return values
osOKThe specified thread has been successfully terminated.
osErrorParameterthread_id is incorrect.
osErrorResourcethread_id refers to a thread that is not an active thread.
osErrorISRosThreadTerminate cannot be called from interrupt service routines.
Note
MUST REMAIN UNCHANGED: osThreadTerminate shall be consistent in every CMSIS-RTOS.

Remove the thread function from the active thread list. If the thread is currently RUNNING the execution will stop.

Note
In case that osThreadTerminate terminates the currently running task, the function never returns and other threads that are in the READY state are started.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3339 of file os-c-wrapper.cpp.

◆ osThreadYield()

osStatus osThreadYield ( void  )

Yield control.

Return values
osOKThe function has been correctly executed.
osErrorISRThe function cannot be called from interrupt service routines.
Note
MUST REMAIN UNCHANGED: osThreadYield shall be consistent in every CMSIS-RTOS.

Pass control to the next thread that is in state READY. If there is no other thread in the state READY, the current thread continues execution and no thread switching occurs.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3380 of file os-c-wrapper.cpp.

◆ osTimerCreate()

osTimerId osTimerCreate ( const osTimerDef_t timer_def,
os_timer_type  type,
void *  args 
)

Create a timer.

Parameters
[in]timer_defTimer object referenced with osTimer.
[in]typeosTimerOnce for one-shot or osTimerPeriodic for periodic behavior.
[in]argsArgument to the timer call back function.
Returns
timer ID for reference by other functions or NULL in case of error.
Note
MUST REMAIN UNCHANGED: osTimerCreate shall be consistent in every CMSIS-RTOS.

Create a one-shot or periodic timer and associate it with a callback function argument. The timer is initially stopped and must be started with osTimerStart().

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3575 of file os-c-wrapper.cpp.

◆ osTimerDelete()

osStatus osTimerDelete ( osTimerId  timer_id)

Delete the timer.

Parameters
[in]timer_idtimer ID obtained by osTimerCreate.
Return values
osOKThe specified timer has been deleted.
osErrorISRosTimerDelete cannot be called from interrupt service routines.
osErrorParametertimer_id is incorrect.
Note
MUST REMAIN UNCHANGED: osTimerDelete shall be consistent in every CMSIS-RTOS.

Delete the timer object that was created by osTimerCreate.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3667 of file os-c-wrapper.cpp.

◆ osTimerStart()

osStatus osTimerStart ( osTimerId  timer_id,
uint32_t  millisec 
)

Start the timer.

Parameters
[in]timer_idtimer ID obtained by osTimerCreate.
[in]millisecTimeout value "time delay" value of the timer.
Return values
osOKThe specified timer has been started or restarted.
osErrorISRosTimerStart cannot be called from interrupt service routines.
osErrorParametertimer_id is incorrect.
Note
MUST REMAIN UNCHANGED: osTimerStart shall be consistent in every CMSIS-RTOS.

Start or restart the timer.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3604 of file os-c-wrapper.cpp.

◆ osTimerStop()

osStatus osTimerStop ( osTimerId  timer_id)

Stop the timer.

Parameters
[in]timer_idtimer ID obtained by osTimerCreate.
Return values
osOKthe specified timer has been stopped.
osErrorISRosTimerStop cannot be called from interrupt service routines.
osErrorParametertimer_id is incorrect.
osErrorResourcethe timer is not started.
Note
MUST REMAIN UNCHANGED: osTimerStop shall be consistent in every CMSIS-RTOS.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3633 of file os-c-wrapper.cpp.

◆ osWait()

osEvent osWait ( uint32_t  millisec)

Wait for Signal, Message, Mail, or Timeout.

Parameters
[in]millisecTimeout value or 0 in case of no time-out.
Return values
osEventSignalA signal event occurred and is returned.
osEventMessageA message event occurred and is returned.
osEventMailA mail event occurred and is returned.
osEventTimeoutThe time delay is executed.
osErrorISRosWait() cannot be called from interrupt service routines.
Note
MUST REMAIN UNCHANGED: osWait shall be consistent in every CMSIS-RTOS.