| CMSIS-RTOS2 Real-Time Operating System API |

Loading...
Searching...
No Matches
Content | Macros | Enumerations
Generic Definitions
CMSIS-RTOS2 API

Constants and enumerations used by many CMSIS-RTOS2 functions. More...

## Content
| Flags Functions Error Codes
| Constants used by Thread Flags and Event Flags to return error codes.

## Macros
#define | osWaitForever 0xFFFFFFFFU
| Wait forever timeout value.
#define | osFlagsWaitAny 0x00000000U
| Wait for any flag (default).
#define | osFlagsWaitAll 0x00000001U
| Wait for all flags.
#define | osFlagsNoClear 0x00000002U
| Do not clear flags which have been specified to wait for.
#define | osSafetyClass(n)
| Safety class value in attribute bit field format.
#define | osSafetyWithSameClass 0x00000001U
| Objects with same safety class.
#define | osSafetyWithLowerClass 0x00000002U
| Objects with lower safety class.

## Enumerations
enum | osStatus_t { osOK = 0 , osError = -1 , osErrorTimeout = -2 , osErrorResource = -3 , osErrorParameter = -4 , osErrorNoMemory = -5 , osErrorISR = -6 , osErrorSafetyClass = -7 , osStatusReserved = 0x7FFFFFFF }
| Status code values returned by CMSIS-RTOS functions. More...

## Description

Constants and enumerations used by many CMSIS-RTOS2 functions.

The following constants and enumerations are used by many CMSIS-RTOS2 function calls.

## Macro Definition Documentation

## ◆ osWaitForever

#define osWaitForever 0xFFFFFFFFU

Wait forever timeout value.

A special Timeout Values that informs the RTOS to wait infinite until a resource becomes available. It applies to the following functions:

- osDelay : Wait for Timeout (Time Delay).
- osThreadFlagsWait : Wait for one or more Thread Flags of the current running thread to become signaled.
- osEventFlagsWait : Wait for one or more Event Flags to become signaled.
- osMutexAcquire : Acquire a Mutex or timeout if it is locked.
- osSemaphoreAcquire : Acquire a Semaphore token or timeout if no tokens are available.
- osMemoryPoolAlloc : Allocate a memory block from a Memory Pool.
- osMessageQueuePut : Put a Message into a Queue or timeout if Queue is full.
- osMessageQueueGet : Get a Message from a Queue or timeout if Queue is empty.

## ◆ osFlagsWaitAny

#define osFlagsWaitAny 0x00000000U

Wait for any flag (default).

Reference:

- osEventFlagsWait
- osThreadFlagsWait

## ◆ osFlagsWaitAll

#define osFlagsWaitAll 0x00000001U

Wait for all flags.

Reference:

- osEventFlagsWait
- osThreadFlagsWait

## ◆ osFlagsNoClear

#define osFlagsNoClear 0x00000002U

Do not clear flags which have been specified to wait for.

Reference:

- osEventFlagsWait
- osThreadFlagsWait

## ◆ osSafetyClass

#define osSafetyClass | ( |  | n | ) |

Safety class value in attribute bit field format.

Safety class.

Parameters

  n | safety class value.

The preprocessor macro osSafetyClass constructs attribute bitmask with safety class bits set to n.

Code Example:

/* Event Flags object attributes */
const osEventFlagsAttr_t ef_attr = {
.name = "EventFlags1", // human readable object name
.attr_bits = osSafetyClass(2U) // assign object to safety class 2
};

## ◆ osSafetyWithSameClass

#define osSafetyWithSameClass 0x00000001U

Objects with same safety class.

Definition for RTOS objects with the same safety class. Can be used as mode argument in the following functions:

- osThreadSuspendClass : Suspend execution of threads for specified safety classes.
- osThreadResumeClass : Resume execution of threads for specified safety classes.
- osKernelDestroyClass : Destroy objects for specified safety classes.

## ◆ osSafetyWithLowerClass

#define osSafetyWithLowerClass 0x00000002U

Objects with lower safety class.

Definition for RTOS objects with lower safety class. Can be used as mode argument in the following functions:

- osThreadSuspendClass : Suspend execution of threads for specified safety classes.
- osThreadResumeClass : Resume execution of threads for specified safety classes.
- osKernelDestroyClass : Destroy objects for specified safety classes.

## Enumeration Type Documentation

## ◆ osStatus_t

enum osStatus_t

Status code values returned by CMSIS-RTOS functions.

The osStatus_t enumeration defines the event status and error codes that are returned by many CMSIS-RTOS2 functions.

Enumerator
osOK | Operation completed successfully.
osError | Unspecified RTOS error: run-time error but no other error message fits.
osErrorTimeout | Operation not completed within the timeout period.
osErrorResource | Resource not available.
osErrorParameter | Parameter error.
osErrorNoMemory | System is out of memory: it was impossible to allocate or reserve memory for the operation.
osErrorISR | Not allowed in ISR context: the function cannot be called from interrupt service routines.
osErrorSafetyClass | Operation denied because of safety class violation.
osStatusReserved | Prevents enum down-size compiler optimization.