| CMSIS-RTOS2 Real-Time Operating System API |

Loading...
Searching...
No Matches
Content
CMSIS-RTOS2 API

C interface of CMSIS-RTOS2 API defined in cmsis_os2.h. More...

## Content
| Kernel Information and Control
| Provides version/system information and starts/controls the RTOS Kernel.
| Thread Management
| Define, create, and control thread functions.
| Thread Flags
| Synchronize threads using flags.
| Event Flags
| Synchronize threads using event flags.
| Generic Wait Functions
| Wait for a certain period of time.
| Timer Management
| Create and control timer and timer callback functions.
| Mutex Management
| Synchronize resource access using Mutual Exclusion (Mutex).
| Semaphores
| Access shared resources simultaneously from different threads.
| Memory Pool
| Manage thread-safe fixed-size blocks of dynamic memory.
| Message Queue
| Exchange messages between threads in a FIFO-like operation.
| Generic Definitions
| Constants and enumerations used by many CMSIS-RTOS2 functions.

## Description

C interface of CMSIS-RTOS2 API defined in cmsis_os2.h.

The CMSIS-RTOS2 is a generic API layer that interfaces to an RTOS kernel.

The complete API interface is defined in the cmsis_os2.h API header file. For generic overview refer to Using CMSIS-RTOS2 Interface.

This chapter provides details for individual API items.

# CMSIS-RTOS2 Function Reference

- 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.
  - osKernelDestroyClass : Destroy objects for specified safety classes.
  - osKernelProtect : Protect the RTOS Kernel scheduler access.
  - osFaultResume : Resume normal operation when exiting exception faults.
- 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.
  - osThreadGetClass : Get safety class of a thread.
  - osThreadGetZone : Get MPU protected zone of a thread.
  - osThreadFeedWatchdog : Feed watchdog of the current running thread.
  - osThreadProtectPrivileged : Protect creation of privileged threads.
  - osThreadResumeClass : Resume execution of threads for specified safety classes.
  - osThreadSuspendClass : Suspend execution of threads for specified safety classes.
  - osThreadTerminateZone : Terminate execution of threads assigned to a specified MPU protected zone.
  - osWatchdogAlarm_Handler : Handler for expired thread watchdogs.
  - osZoneSetup_Callback : Setup MPU protected zone (called when zone changes).
- 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 Message Queue.
  - 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.

The following CMSIS-RTOS C API v2 functions can be called from threads and Interrupt Service Routines (ISR):

- osKernelGetInfo, osKernelGetState, osKernelGetTickCount, osKernelGetTickFreq, osKernelGetSysTimerCount, osKernelGetSysTimerFreq
- osThreadGetName, osThreadGetId, osThreadFlagsSet
- osTimerGetName
- osEventFlagsGetName, osEventFlagsSet, osEventFlagsClear, osEventFlagsGet, osEventFlagsWait
- osMutexGetName
- osSemaphoreGetName, osSemaphoreAcquire, osSemaphoreRelease, osSemaphoreGetCount
- osMemoryPoolGetName, osMemoryPoolAlloc, osMemoryPoolFree, osMemoryPoolGetCapacity, osMemoryPoolGetBlockSize, osMemoryPoolGetCount, osMemoryPoolGetSpace
- osMessageQueueGetName, osMessageQueuePut, osMessageQueueGet, osMessageQueueGetCapacity, osMessageQueueGetMsgSize, osMessageQueueGetCount, osMessageQueueGetSpace