CMSIS-RTOS2: Function Overview

| CMSIS-RTOS2 Version 2.1.1 Real-Time Operating System: API and RTX Reference Implementation

- Main Page
- Usage and Description
- Reference

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Function Overview

CMSIS-RTOS v2 provides multiple API interfaces:

- CMSIS-RTOS2 is the new C function API that supports dynamic object creation and ARMv8-M (ARM Cortex-M23 and Cortex-M33).
- CMSIS-RTOS C API v1 is a C function API that is backward compatible with CMSIS-RTOS v1.
- CMSIS-RTOS C++ API is a C++ class function API.

It is possible to intermix the different API variants in the same application and even in the same C/C++ source module. However, the functions of the C API Version 1 may be deprecated in future versions of CMSIS-RTOS.

# CMSIS-RTOS2

Overview of all CMSIS-RTOS C API v2 functions that are implemented in the cmsis_os2.h header file.

- Kernel Information and Control
  - osKernelGetInfo : Get RTOS Kernel Information.
  - osKernelGetState : Get the current RTOS Kernel state.
  - osKernelGetSysTimerCount : Get the RTOS kernel system timer count.
  - osKernelGetSysTimerFreq : Get the RTOS kernel system timer frequency.
  - osKernelInitialize : Initialize the RTOS Kernel.
  - osKernelLock : Lock the RTOS Kernel scheduler.
  - osKernelUnlock : Unlock the RTOS Kernel scheduler.
  - osKernelRestoreLock : Restore the RTOS Kernel scheduler lock state.
  - osKernelResume : Resume the RTOS Kernel scheduler.
  - osKernelStart : Start the RTOS Kernel scheduler.
  - osKernelSuspend : Suspend the RTOS Kernel scheduler.
  - osKernelGetTickCount : Get the RTOS kernel tick count.
  - osKernelGetTickFreq : Get the RTOS kernel tick frequency.
- Thread Management
  - osThreadDetach : Detach a thread (thread storage can be reclaimed when thread terminates).
  - osThreadEnumerate : Enumerate active threads.
  - osThreadExit : Terminate execution of current running thread.
  - osThreadGetCount : Get number of active threads.
  - osThreadGetId : Return the thread ID of the current running thread.
  - osThreadGetName : Get name of a thread.
  - osThreadGetPriority : Get current priority of a thread.
  - osThreadGetStackSize : Get stack size of a thread.
  - osThreadGetStackSpace : Get available stack space of a thread based on stack watermark recording during execution.
  - osThreadGetState : Get current thread state of a thread.
  - osThreadJoin : Wait for specified thread to terminate.
  - osThreadNew : Create a thread and add it to Active Threads.
  - osThreadResume : Resume execution of a thread.
  - osThreadSetPriority : Change priority of a thread.
  - osThreadSuspend : Suspend execution of a thread.
  - osThreadTerminate : Terminate execution of a thread.
  - osThreadYield : Pass control to next thread that is in state READY.
- Thread Flags
  - osThreadFlagsSet : Set the specified Thread Flags of a thread.
  - osThreadFlagsClear : Clear the specified Thread Flags of current running thread.
  - osThreadFlagsGet : Get the current Thread Flags of current running thread.
  - osThreadFlagsWait : Wait for one or more Thread Flags of the current running thread to become signaled.
- Event Flags
  - osEventFlagsGetName : Get name of an Event Flags object.
  - osEventFlagsNew : Create and Initialize an Event Flags object.
  - osEventFlagsDelete : Delete an Event Flags object.
  - osEventFlagsSet : Set the specified Event Flags.
  - osEventFlagsClear : Clear the specified Event Flags.
  - osEventFlagsGet : Get the current Event Flags.
  - osEventFlagsWait : Wait for one or more Event Flags to become signaled.
- Generic Wait Functions
  - osDelay : Wait for Timeout (Time Delay).
  - osDelayUntil : Wait until specified time.
- Timer Management
  - osTimerDelete : Delete a timer.
  - osTimerGetName : Get name of a timer.
  - osTimerIsRunning : Check if a timer is running.
  - osTimerNew : Create and Initialize a timer.
  - osTimerStart : Start or restart a timer.
  - osTimerStop : Stop a timer.
- Mutex Management
  - osMutexAcquire : Acquire a Mutex or timeout if it is locked.
  - osMutexDelete : Delete a Mutex object.
  - osMutexGetName : Get name of a Mutex object.
  - osMutexGetOwner : Get Thread which owns a Mutex object.
  - osMutexNew : Create and Initialize a Mutex object.
  - osMutexRelease : Release a Mutex that was acquired by osMutexAcquire.
- Semaphores
  - osSemaphoreAcquire : Acquire a Semaphore token or timeout if no tokens are available.
  - osSemaphoreDelete : Delete a Semaphore object.
  - osSemaphoreGetCount : Get current Semaphore token count.
  - osSemaphoreGetName : Get name of a Semaphore object.
  - osSemaphoreNew : Create and Initialize a Semaphore object.
  - osSemaphoreRelease : Release a Semaphore token up to the initial maximum count.
- Memory Pool
  - osMemoryPoolAlloc : Allocate a memory block from a Memory Pool.
  - osMemoryPoolDelete : Delete a Memory Pool object.
  - osMemoryPoolFree : Return an allocated memory block back to a Memory Pool.
  - osMemoryPoolGetBlockSize : Get memory block size in a Memory Pool.
  - osMemoryPoolGetCapacity : Get maximum number of memory blocks in a Memory Pool.
  - osMemoryPoolGetCount : Get number of memory blocks used in a Memory Pool.
  - osMemoryPoolGetName : Get name of a Memory Pool object.
  - osMemoryPoolGetSpace : Get number of memory blocks available in a Memory Pool.
  - osMemoryPoolNew : Create and Initialize a Memory Pool object.
- Message Queue
  - osMessageQueueDelete : Delete a Message Queue object.
  - osMessageQueueGet : Get a Message from a Queue or timeout if Queue is empty.
  - osMessageQueueGetCapacity : Get maximum number of messages in a Message Queue.
  - osMessageQueueGetCount : Get number of queued messages in a Message Queue.
  - osMessageQueueGetMsgSize : Get maximum message size in a Memory Pool.
  - osMessageQueueGetName : Get name of a Message Queue object.
  - osMessageQueueGetSpace : Get number of available slots for messages in a Message Queue.
  - osMessageQueueNew : Create and Initialize a Message Queue object.
  - osMessageQueuePut : Put a Message into a Queue or timeout if Queue is full.
  - osMessageQueueReset : Reset a Message Queue to initial empty state.
- OS Tick API
  - OS_Tick_Setup : Setup OS Tick.
  - OS_Tick_Enable : Enable OS Tick.
  - OS_Tick_Disable : Disable OS Tick.
  - OS_Tick_AcknowledgeIRQ : Acknowledge OS Tick IRQ.
  - OS_Tick_GetIRQn : Get OS Tick IRQ number.
  - OS_Tick_GetClock : Get OS Tick clock.
  - OS_Tick_GetInterval : Get OS Tick interval.
  - OS_Tick_GetCount : Get OS Tick count value.
  - OS_Tick_GetOverflow : Get OS Tick overflow status.
- RTX5 Specific API
  - osRtxErrorNotify : OS Error Callback function.
  - osRtxIdleThread : OS Idle Thread.

The following CMSIS-RTOS2 functions can be called from threads and Interrupt Service Routines (ISR):

- osKernelGetTickCount, osKernelGetTickFreq, osKernelGetSysTimerCount, osKernelGetSysTimerFreq
- osThreadFlagsSet
- osEventFlagsSet, osEventFlagsClear, osEventFlagsGet, osEventFlagsWait
- osSemaphoreAcquire, osSemaphoreRelease, osSemaphoreGetCount
- osMemoryPoolAlloc, osMemoryPoolFree, osMemoryPoolGetCapacity, osMemoryPoolGetBlockSize, osMemoryPoolGetCount, osMemoryPoolGetSpace
- osMessageQueuePut, osMessageQueueGet, osMessageQueueGetCapacity, osMessageQueueGetMsgSize, osMessageQueueGetCount, osMessageQueueGetSpace