CMSIS-RTOS2: rtx_os.h File Reference

| 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
Data Structures | Macros | Functions | Variables
rtx_os.h File Reference

## Data Structures
struct | osRtxThread_t
| Thread Control Block. More...
struct | osRtxTimerFinfo_t
| Timer Function Information. More...
struct | osRtxTimer_t
| Timer Control Block. More...
struct | osRtxEventFlags_t
| Event Flags Control Block. More...
struct | osRtxMutex_t
| Mutex Control Block. More...
struct | osRtxSemaphore_t
| Semaphore Control Block. More...
struct | osRtxMpInfo_t
| Memory Pool Information. More...
struct | osRtxMemoryPool_t
| Memory Pool Control Block. More...
struct | osRtxMessage_t
| Message Control Block. More...
struct | osRtxMessageQueue_t
| Message Queue Control Block. More...
struct | osRtxObject_t
| Generic Object Control Block. More...
struct | osRtxInfo_t
| OS Runtime Information structure. More...
struct | osRtxConfig_t
| OS Configuration structure. More...
struct | osRtxInfo_t.kernel
struct | osRtxInfo_t.thread
struct | osRtxInfo_t.thread.run
| < Thread Info More...
struct | osRtxInfo_t.thread.robin
struct | osRtxInfo_t.timer
struct | osRtxInfo_t.isr_queue
struct | osRtxInfo_t.post_process
struct | osRtxInfo_t.mem
struct | osRtxInfo_t.mpi
struct | osRtxConfig_t.isr_queue
struct | osRtxConfig_t.mem
struct | osRtxConfig_t.mpi

## Macros
#define | osRtxVersionAPI 20010001
| Kernel Information. More...
#define | osRtxVersionKernel 50020001
| Kernel version (5.2.1) More...
#define | osRtxKernelId "RTX V5.2.1"
| Kernel identification string. More...
#define | osRtxIdInvalid 0x00U
| Object Identifier definitions. More...
#define | osRtxIdThread 0x01U
#define | osRtxIdTimer 0x02U
#define | osRtxIdEventFlags 0x03U
#define | osRtxIdMutex 0x04U
#define | osRtxIdSemaphore 0x05U
#define | osRtxIdMemoryPool 0x06U
#define | osRtxIdMessage 0x07U
#define | osRtxIdMessageQueue 0x08U
#define | osRtxObjectInactive 0x00U
| Object State definitions (except for Threads and Timers) More...
#define | osRtxObjectActive 0x01U
#define | osRtxFlagSystemObject 0x01U
| Object Flags definitions. More...
#define | osRtxFlagSystemMemory 0x02U
#define | osRtxKernelInactive ((uint8_t)osKernelInactive)
| Kernel State definitions. More...
#define | osRtxKernelReady ((uint8_t)osKernelReady)
#define | osRtxKernelRunning ((uint8_t)osKernelRunning)
#define | osRtxKernelLocked ((uint8_t)osKernelLocked)
#define | osRtxKernelSuspended ((uint8_t)osKernelSuspended)
#define | osRtxThreadStateMask 0x0FU
| Thread State definitions (extending osThreadState) More...
#define | osRtxThreadInactive ((uint8_t)osThreadInactive)
#define | osRtxThreadReady ((uint8_t)osThreadReady)
#define | osRtxThreadRunning ((uint8_t)osThreadRunning)
#define | osRtxThreadBlocked ((uint8_t)osThreadBlocked)
#define | osRtxThreadTerminated ((uint8_t)osThreadTerminated)
#define | osRtxThreadWaitingDelay (osRtxThreadBlocked | 0x10U)
#define | osRtxThreadWaitingJoin (osRtxThreadBlocked | 0x20U)
#define | osRtxThreadWaitingThreadFlags (osRtxThreadBlocked | 0x30U)
#define | osRtxThreadWaitingEventFlags (osRtxThreadBlocked | 0x40U)
#define | osRtxThreadWaitingMutex (osRtxThreadBlocked | 0x50U)
#define | osRtxThreadWaitingSemaphore (osRtxThreadBlocked | 0x60U)
#define | osRtxThreadWaitingMemoryPool (osRtxThreadBlocked | 0x70U)
#define | osRtxThreadWaitingMessageGet (osRtxThreadBlocked | 0x80U)
#define | osRtxThreadWaitingMessagePut (osRtxThreadBlocked | 0x90U)
#define | osRtxThreadFlagDefStack 0x10U
| Thread Flags definitions. More...
#define | osRtxStackMagicWord 0xE25A2EA5U
| Stack Marker definitions. More...
#define | osRtxStackFillPattern 0xCCCCCCCCU
| Stack Fill Pattern. More...
#define | osRtxTimerInactive 0x00U
| Timer State definitions. More...
#define | osRtxTimerStopped 0x01U
| Timer Stopped. More...
#define | osRtxTimerRunning 0x02U
| Timer Running. More...
#define | osRtxTimerPeriodic ((uint8_t)osTimerPeriodic)
| Timer Type definitions. More...
#define | osRtxThreadFlagsLimit 31U
| Object Limits definitions. More...
#define | osRtxEventFlagsLimit 31U
| number of Event Flags available per object More...
#define | osRtxMutexLockLimit 255U
| maximum number of recursive mutex locks More...
#define | osRtxSemaphoreTokenLimit 65535U
| maximum number of tokens per semaphore More...
#define | osRtxThreadCbSize sizeof(osRtxThread_t)
| Control Block sizes. More...
#define | osRtxTimerCbSize sizeof(osRtxTimer_t)
#define | osRtxEventFlagsCbSize sizeof(osRtxEventFlags_t)
#define | osRtxMutexCbSize sizeof(osRtxMutex_t)
#define | osRtxSemaphoreCbSize sizeof(osRtxSemaphore_t)
#define | osRtxMemoryPoolCbSize sizeof(osRtxMemoryPool_t)
#define | osRtxMessageQueueCbSize sizeof(osRtxMessageQueue_t)
#define | osRtxMemoryPoolMemSize(block_count, block_size) (4*(block_count)*(((block_size)+3)/4))
| Memory size in bytes for Memory Pool storage. More...
#define | osRtxMessageQueueMemSize(msg_count, msg_size) (4*(msg_count)*(3+(((msg_size)+3)/4)))
| Memory size in bytes for Message Queue storage. More...
#define | osRtxErrorStackUnderflow 1U
| OS Error Codes. More...
#define | osRtxErrorISRQueueOverflow 2U
#define | osRtxErrorTimerQueueOverflow 3U
#define | osRtxErrorClibSpace 4U
#define | osRtxErrorClibMutex 5U
#define | osRtxConfigPrivilegedMode (1UL<<0)
| OS Configuration flags. More...
#define | osRtxConfigStackCheck (1UL<<1)
| Stack overrun checking. More...
#define | osRtxConfigStackWatermark (1UL<<2)
| Stack usage Watermark. More...

## Functions
uint32_t | osRtxErrorNotify (uint32_t code, void *object_id)
| OS Error Callback function. More...
void | osRtxIdleThread (void *argument)
| OS Idle Thread. More...
void | SVC_Handler (void)
| OS Exception handlers. More...
void | PendSV_Handler (void)
void | SysTick_Handler (void)

## Variables
osRtxInfo_t | osRtxInfo
| OS Runtime Information. More...
const osRtxConfig_t | osRtxConfig
| OS Configuration. More...

## Data Structure Documentation

struct osRtxMpInfo_t

Data Fields
uint32_t | max_blocks | Maximum number of Blocks.
uint32_t | used_blocks | Number of used Blocks.
uint32_t | block_size | Block Size.
void * | block_base | Block Memory Base Address.
void * | block_lim | Block Memory Limit Address.
void * | block_free | First free Block Address.

struct osRtxMessage_t

Data Fields
uint8_t | id | Object Identifier.
uint8_t | state | Object State.
uint8_t | flags | Object Flags.
uint8_t | priority | Message Priority.
struct osRtxMessage_s * | prev | Pointer to previous Message.
struct osRtxMessage_s * | next | Pointer to next Message.

struct osRtxObject_t

Data Fields
uint8_t | id | Object Identifier.
uint8_t | state | Object State.
uint8_t | flags | Object Flags.
uint8_t | reserved |
const char * | name | Object Name.
osRtxThread_t * | thread_list | Threads List.

struct osRtxInfo_t

Data Fields
const char * | os_id | OS Identification.
uint32_t | version | OS Version.
struct osRtxInfo_t | kernel |
int32_t | tick_irqn | Tick Timer IRQ Number.
struct osRtxInfo_t | thread |
struct osRtxInfo_t | timer |
struct osRtxInfo_t | isr_queue |
struct osRtxInfo_t | post_process |
struct osRtxInfo_t | mem |
struct osRtxInfo_t | mpi |

struct osRtxConfig_t

Data Fields
uint32_t | flags | OS Configuration Flags.
uint32_t | tick_freq | Kernel Tick Frequency.
uint32_t | robin_timeout | Round Robin Timeout Tick.
struct osRtxConfig_t | isr_queue |
struct osRtxConfig_t | mem |
struct osRtxConfig_t | mpi |
uint32_t | thread_stack_size | Default Thread Stack Size.
const osThreadAttr_t * | idle_thread_attr | Idle Thread Attributes.
const osThreadAttr_t * | timer_thread_attr | Timer Thread Attributes.
const osMessageQueueAttr_t * | timer_mq_attr | Timer Message Queue Attributes.
uint32_t | timer_mq_mcnt | Timer Message Queue maximum Messages.

struct osRtxInfo_t.kernel

Data Fields
uint8_t | state | < Kernel Info State
volatile uint8_t | blocked | Blocked.
uint8_t | pendSV | Pending SV.
uint8_t | reserved |
uint32_t | tick | Tick counter.

struct osRtxInfo_t.thread

Data Fields
thread | run | < Thread Info
volatile osRtxObject_t | ready | Ready List Object.
osRtxThread_t * | idle | Idle Thread.
osRtxThread_t * | delay_list | Delay List.
osRtxThread_t * | wait_list | Wait List (no Timeout)
osRtxThread_t * | terminate_list | Terminate Thread List.
thread | robin |

struct osRtxInfo_t.thread.run

Data Fields
osRtxThread_t * | curr | < Thread Run Info Current running Thread
osRtxThread_t * | next | Next Thread to Run.

struct osRtxInfo_t.thread.robin

Data Fields
osRtxThread_t * | thread | < Thread Round Robin Info Round Robin Thread
uint32_t | tick | Round Robin Time Tick.
uint32_t | timeout | Round Robin Timeout.

struct osRtxInfo_t.isr_queue

Data Fields
uint16_t | max | < ISR Post Processing Queue Maximum Items
uint16_t | cnt | Item Count.
uint16_t | in | Incoming Item Index.
uint16_t | out | Outgoing Item Index.
void ** | data | Queue Data.

struct osRtxInfo_t.mem

Data Fields
void * | stack | < Memory Pools (Variable Block Size) Stack Memory
void * | mp_data | Memory Pool Data Memory.
void * | mq_data | Message Queue Data Memory.
void * | common | Common Memory.

struct osRtxInfo_t.mpi

Data Fields
osRtxMpInfo_t * | stack | < Memory Pools (Fixed Block Size) Stack for Threads
osRtxMpInfo_t * | thread | Thread Control Blocks.
osRtxMpInfo_t * | timer | Timer Control Blocks.
osRtxMpInfo_t * | event_flags | Event Flags Control Blocks.
osRtxMpInfo_t * | mutex | Mutex Control Blocks.
osRtxMpInfo_t * | semaphore | Semaphore Control Blocks.
osRtxMpInfo_t * | memory_pool | Memory Pool Control Blocks.
osRtxMpInfo_t * | message_queue | Message Queue Control Blocks.

struct osRtxConfig_t.isr_queue

Data Fields
void ** | data | < ISR Post Processing Queue Queue Data
uint16_t | max | Maximum Items.
uint16_t | padding |

struct osRtxConfig_t.mem

Data Fields
void * | stack_addr | < Memory Pools (Variable Block Size) Stack Memory Address
uint32_t | stack_size | Stack Memory Size.
void * | mp_data_addr | Memory Pool Memory Address.
uint32_t | mp_data_size | Memory Pool Memory Size.
void * | mq_data_addr | Message Queue Data Memory Address.
uint32_t | mq_data_size | Message Queue Data Memory Size.
void * | common_addr | Common Memory Address.
uint32_t | common_size | Common Memory Size.

struct osRtxConfig_t.mpi

Data Fields
osRtxMpInfo_t * | stack | < Memory Pools (Fixed Block Size) Stack for Threads
osRtxMpInfo_t * | thread | Thread Control Blocks.
osRtxMpInfo_t * | timer | Timer Control Blocks.
osRtxMpInfo_t * | event_flags | Event Flags Control Blocks.
osRtxMpInfo_t * | mutex | Mutex Control Blocks.
osRtxMpInfo_t * | semaphore | Semaphore Control Blocks.
osRtxMpInfo_t * | memory_pool | Memory Pool Control Blocks.
osRtxMpInfo_t * | message_queue | Message Queue Control Blocks.

## Macro Definition Documentation

#define osRtxVersionAPI 20010001

API version (2.1.1)

#define osRtxVersionKernel 50020001

#define osRtxKernelId "RTX V5.2.1"

#define osRtxIdInvalid 0x00U

#define osRtxIdThread 0x01U

#define osRtxIdTimer 0x02U

#define osRtxIdEventFlags 0x03U

#define osRtxIdMutex 0x04U

#define osRtxIdSemaphore 0x05U

#define osRtxIdMemoryPool 0x06U

#define osRtxIdMessage 0x07U

#define osRtxIdMessageQueue 0x08U

#define osRtxObjectInactive 0x00U

#define osRtxObjectActive 0x01U

#define osRtxFlagSystemObject 0x01U

#define osRtxFlagSystemMemory 0x02U

#define osRtxKernelInactive ((uint8_t)osKernelInactive)

#define osRtxKernelReady ((uint8_t)osKernelReady)

#define osRtxKernelRunning ((uint8_t)osKernelRunning)

#define osRtxKernelLocked ((uint8_t)osKernelLocked)

#define osRtxKernelSuspended ((uint8_t)osKernelSuspended)

#define osRtxThreadStateMask 0x0FU

#define osRtxThreadInactive ((uint8_t)osThreadInactive)

#define osRtxThreadReady ((uint8_t)osThreadReady)

#define osRtxThreadRunning ((uint8_t)osThreadRunning)

#define osRtxThreadBlocked ((uint8_t)osThreadBlocked)

#define osRtxThreadTerminated ((uint8_t)osThreadTerminated)

#define osRtxThreadWaitingDelay (osRtxThreadBlocked | 0x10U)

#define osRtxThreadWaitingJoin (osRtxThreadBlocked | 0x20U)

#define osRtxThreadWaitingThreadFlags (osRtxThreadBlocked | 0x30U)

#define osRtxThreadWaitingEventFlags (osRtxThreadBlocked | 0x40U)

#define osRtxThreadWaitingMutex (osRtxThreadBlocked | 0x50U)

#define osRtxThreadWaitingSemaphore (osRtxThreadBlocked | 0x60U)

#define osRtxThreadWaitingMemoryPool (osRtxThreadBlocked | 0x70U)

#define osRtxThreadWaitingMessageGet (osRtxThreadBlocked | 0x80U)

#define osRtxThreadWaitingMessagePut (osRtxThreadBlocked | 0x90U)

#define osRtxThreadFlagDefStack 0x10U

Default Stack flag

#define osRtxStackMagicWord 0xE25A2EA5U

Stack Magic Word (Stack Base)

#define osRtxStackFillPattern 0xCCCCCCCCU

#define osRtxTimerInactive 0x00U

Timer Inactive

#define osRtxTimerStopped 0x01U

#define osRtxTimerRunning 0x02U

#define osRtxTimerPeriodic ((uint8_t)osTimerPeriodic)

#define osRtxThreadFlagsLimit 31U

number of Thread Flags available per thread

#define osRtxEventFlagsLimit 31U

#define osRtxMutexLockLimit 255U

#define osRtxSemaphoreTokenLimit 65535U

#define osRtxErrorStackUnderflow 1U

#define osRtxErrorISRQueueOverflow 2U

#define osRtxErrorTimerQueueOverflow 3U

#define osRtxErrorClibSpace 4U

#define osRtxErrorClibMutex 5U

#define osRtxConfigPrivilegedMode (1UL<<0)

Threads in Privileged mode

#define osRtxConfigStackCheck (1UL<<1)

#define osRtxConfigStackWatermark (1UL<<2)

## Function Documentation

void SVC_Handler | ( | void |  | ) |

void PendSV_Handler | ( | void |  | ) |

void SysTick_Handler | ( | void |  | ) |

## Variable Documentation

osRtxInfo_t osRtxInfo

const osRtxConfig_t osRtxConfig