CMSIS-RTOS RTX: Function Overview

| CMSIS-RTOS RTX Version 4.80 CMSIS-RTOS RTX: Real-Time Operating System for Cortex-M processor-based devices

- Main Page
- Usage and Description
- Reference

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

The following list provides a brief overview of all CMSIS-RTOS functions that are implemented in CMSIS-RTOS RTX.

- Kernel Information and Control
  - osKernelInitialize : Initialize the RTOS kernel.
  - osKernelStart : Start the RTOS kernel.
  - osKernelRunning : Query if the RTOS kernel is running.
  - osKernelSysTick : Get RTOS kernel system timer counter.

- Thread Management
  - osThreadCreate : Start execution of a thread function.
  - osThreadTerminate : Stop execution of a thread function.
  - osThreadYield : Pass execution to next ready thread function.
  - osThreadGetId : Get the thread identifier to reference this thread.
  - osThreadSetPriority : Change the execution priority of a thread function.
  - osThreadGetPriority : Obtain the current execution priority of a thread function.

- Generic Wait Function
  - osDelay : Wait for a specified time.

- Timer Management
  - osTimerCreate : Define attributes of the timer callback function.
  - osTimerStart : Start or restart the timer with a time value.
  - osTimerStop : Stop the timer.
  - osTimerDelete : Delete a timer.

- Signal Management
  - osSignalSet : Set signal flags of a thread.
  - osSignalClear : Reset signal flags of a thread.
  - osSignalWait : Suspend execution until specific signal flags are set.

- Mutex Management
  - osMutexCreate : Define and initialize a mutex.
  - osMutexWait : Obtain a mutex or Wait until it becomes available.
  - osMutexRelease : Release a mutex.
  - osMutexDelete : Delete a mutex.

- Semaphore Management
  - osSemaphoreCreate : Define and initialize a semaphore.
  - osSemaphoreWait : Obtain a semaphore token or Wait until it becomes available.
  - osSemaphoreRelease : Release a semaphore token.
  - osSemaphoreDelete : Delete a semaphore.

- Memory Pool Management
  - osPoolCreate : Define and initialize a fix-size memory pool.
  - osPoolAlloc : Allocate a memory block.
  - osPoolCAlloc : Allocate a memory block and zero-set this block.
  - osPoolFree : Return a memory block to the memory pool.

- Message Queue Management
  - osMessageCreate : Define and initialize a message queue.
  - osMessagePut : Put a message into a message queue.
  - osMessageGet : Get a message or suspend thread execution until message arrives.

- Mail Queue Management
  - osMailCreate : Define and initialize a mail queue with fix-size memory blocks.
  - osMailAlloc : Allocate a memory block.
  - osMailCAlloc : Allocate a memory block and zero-set this block.
  - osMailPut : Put a memory block into a mail queue.
  - osMailGet : Get a mail or suspend thread execution until mail arrives.
  - osMailFree : Return a memory block to the mail queue.

- RTX Global Functions
  - os_idle_demon : System thread running when no other thread is ready to run.
  - os_suspend : Suspend the RTX task scheduler.
  - os_resume : Resume the RTX task scheduler.
  - os_tick_init : Initialize an alternative hardware timer as RTX kernel timer.
  - os_tick_val : Get alternative hardware timer's current value.
  - os_tick_ovf : Get alternative hardware timer's overflow flag.
  - os_tick_irqack : Acknowledge alternative hardware timer interrupt.
  - os_error : Called when a runtime error is detected.

# Timout Value

The timeout value specifies the number of timer ticks until a timeout or time delay elapses. The value is an upper bound and 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 timeout value can be one timer tick less than the specified timeout value.

Timer Values

Note
  The actual granularity depends also on the RTX Kernel Tick Timer Configuration.
  The underlying RTX uses 16-bit timeout values. Therefore the timeout value has a valid range from 1 .. 65534 ticks.

# Calls from Interrupt Service Routines

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

- osKernelRunning
- osSignalSet
- osSemaphoreRelease
- osPoolAlloc, osPoolCAlloc, osPoolFree
- osMessagePut, osMessageGet
- osMailAlloc, osMailCAlloc, osMailGet, osMailPut, osMailFree

Functions that cannot be called from an ISR are verifying the interrupt status and return, in case they are called from an ISR context, the status code osErrorISR. In some implementations, this condition might be caught using the HARD FAULT vector.

Some CMSIS-RTOS implementations support CMSIS-RTOS function calls from multiple ISRs at the same time. If this is impossible, the CMSIS-RTOS rejects calls by nested ISR functions with the status code osErrorISRRecursive.