CMSIS-RTOS2  Version 2.1.3
Real-Time Operating System: API and RTX Reference Implementation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

RTX5 macros. More...

Macros

#define osRtxThreadCbSize   sizeof(osRtxThread_t)
 Thread Control Block size. More...
 
#define osRtxTimerCbSize   sizeof(osRtxTimer_t)
 Timer Control Block size. More...
 
#define osRtxEventFlagsCbSize   sizeof(osRtxEventFlags_t)
 Event Flags Control Block size. More...
 
#define osRtxMutexCbSize   sizeof(osRtxMutex_t)
 Mutex Control Block size. More...
 
#define osRtxSemaphoreCbSize   sizeof(osRtxSemaphore_t)
 Semaphore Control Block size. More...
 
#define osRtxMemoryPoolCbSize   sizeof(osRtxMemoryPool_t)
 Memory Pool Control Block size. More...
 
#define osRtxMessageQueueCbSize   sizeof(osRtxMessageQueue_t)
 Message Queue Control Block size. More...
 
#define osRtxMemoryPoolMemSize(block_count, block_size)   (4*(block_count)*(((block_size)+3)/4))
 Memory Pool Memory size. More...
 
#define osRtxMessageQueueMemSize(msg_count, msg_size)   (4*(msg_count)*(3+(((msg_size)+3)/4)))
 Message Queue Memory size. More...
 
#define osRtxErrorStackUnderflow   1U
 Stack overflow, i.e. stack pointer below its lower memory limit for descending stacks. More...
 
#define osRtxErrorISRQueueOverflow   2U
 ISR Queue overflow detected when inserting object. More...
 
#define osRtxErrorTimerQueueOverflow   3U
 User Timer Callback Queue overflow detected for timer. More...
 
#define osRtxErrorClibSpace   4U
 Standard C/C++ library libspace not available. More...
 
#define osRtxErrorClibMutex   5U
 Standard C/C++ library mutex initialization failed. More...
 

Description

Macro Definition Documentation

#define osRtxThreadCbSize   sizeof(osRtxThread_t)

This macro exposes the minimum amount of memory needed for an RTX5 Thread Control Block, see osThreadAttr_t::cb_mem and osThreadAttr_t::cb_size.

Example:

// Used-defined memory for thread control block
static uint32_t thread_cb[osRtxThreadCbSize/4U];
#define osRtxTimerCbSize   sizeof(osRtxTimer_t)

This macro exposes the minimum amount of memory needed for an RTX5 Timer Control Block, see osTimerAttr_t::cb_mem and osTimerAttr_t::cb_size.

Example:

// Used-defined memory for timer control block
static uint32_t timer_cb[osRtxTimerCbSize/4U];
#define osRtxEventFlagsCbSize   sizeof(osRtxEventFlags_t)

This macro exposes the minimum amount of memory needed for an RTX5 Event Flags Control Block, see osEventFlagsAttr_t::cb_mem and osEventFlagsAttr_t::cb_size.

Example:

// Used-defined memory for event flags control block
static uint32_t evflags_cb[osRtxEventFlagsCbSize/4U];
#define osRtxMutexCbSize   sizeof(osRtxMutex_t)

This macro exposes the minimum amount of memory needed for an RTX5 Mutex Control Block, see osMutexAttr_t::cb_mem and osMutexAttr_t::cb_size.

Example:

// Used-defined memory for mutex control block
static uint32_t mutex_cb[osRtxMutexCbSize/4U];
#define osRtxSemaphoreCbSize   sizeof(osRtxSemaphore_t)

This macro exposes the minimum amount of memory needed for an RTX5 Semaphore Control Block, see osSemaphoreAttr_t::cb_mem and osSemaphoreAttr_t::cb_size.

Example:

// Used-defined memory for semaphore control block
static uint32_t sema_cb[osRtxSemaphoreCbSize/4U];
#define osRtxMemoryPoolCbSize   sizeof(osRtxMemoryPool_t)

This macro exposes the minimum amount of memory needed for an RTX5 Memory Pool Control Block, see osMemoryPoolAttr_t::cb_mem and osMemoryPoolAttr_t::cb_size.

Example:

// Used-defined memory for memory pool control block
static uint32_t mempool_cb[osRtxMemoryPoolCbSize/4U];
#define osRtxMessageQueueCbSize   sizeof(osRtxMessageQueue_t)

This macro exposes the minimum amount of memory needed for an RTX5 Message Queue Control Block, see osMessageQueueAttr_t::cb_mem and osMessageQueueAttr_t::cb_size.

Example:

// Used-defined memory for message queue control block
static uint32_t msgqueue_cb[osRtxMessageQueueCbSize/4U];
#define osRtxMemoryPoolMemSize (   block_count,
  block_size 
)    (4*(block_count)*(((block_size)+3)/4))

Memory size in bytes for Memory Pool storage.

This macro exposes the minimum amount of memory needed for an RTX5 Memory Pool Memory, see osMemoryPoolAttr_t::mp_mem and osMemoryPoolAttr_t::mp_size.

Example:

// Maximum number of objects
#define OBJ_COUNT 8U
// Object type
typedef struct {
uint32_t value1;
uint8_t value2;
} object_t;
// Used-defined memory for memory pool memory
static uint32_t mempool_mem[osRtxMemoryPoolMemSize(OBJ_COUNT, sizeof(object_t))/4U];
Parameters
block_countmaximum number of memory blocks in memory pool.
block_sizememory block size in bytes.
#define osRtxMessageQueueMemSize (   msg_count,
  msg_size 
)    (4*(msg_count)*(3+(((msg_size)+3)/4)))

Memory size in bytes for Message Queue storage.

This macro exposes the minimum amount of memory needed for an RTX5 Message Queue Memory, see osMessageQueueAttr_t::mq_mem and osMessageQueueAttr_t::mq_size.

Example:

// Maximum number of messages
#define MSG_COUNT 16U
// Message data type
typedef struct {
uint32_t value1;
uint8_t value2;
} msg_item_t;
// Used-defined memory for message queue
static uint32_t mq_mem[osRtxMessageQueueMemSize(MSG_COUNT, sizeof(msg_item_t))/4U];
Parameters
msg_countmaximum number of messages in queue.
msg_sizemaximum message size in bytes.
#define osRtxErrorStackUnderflow   1U

This error identifier is used with osRtxErrorNotify when RTX5 detects a thread stack overflow. The object_id announced along this error can be used to identify the affected thread.

Stack Usage Watermark used together with larger stack sizes can help to figure out actual memory requirements for threads.

Attention
Whenever this error identifier is signaled memory corruption has already happened.
#define osRtxErrorISRQueueOverflow   2U

This error identifier is used with osRtxErrorNotify when RTX5 detects an overflow of the interrupt post processing message queue. The object_id can be used to identify the affected object.

Attention
Whenever this error identifier is signaled the system state is already inconsistent.
#define osRtxErrorTimerQueueOverflow   3U

This error identifier is used with osRtxErrorNotify when RTX5 detects an overflow of the timer callback queue. The object_id can be used to identify the affected timer.

Attention
Whenever this error identifier is signaled a timer callback is already lost.
#define osRtxErrorClibSpace   4U

Standard C/C++ library libspace not available: increase OS_THREAD_LIBSPACE_NUM.

This error identifier is used with osRtxErrorNotify when RTX5 detects usage of libspace but not enough memory was reserved using OS_THREAD_LIBSPACE_NUM.

#define osRtxErrorClibMutex   5U

This error identifier is used with osRtxErrorNotify when RTX5 fails to create mutexes needed to lock global C/C++ library resources.