31 #include "cmsis_os2.h" 40 #define osRtxVersionAPI 20010003 41 #define osRtxVersionKernel 50050000
42 #define osRtxKernelId "RTX V5.5.0"
48 #define osRtxIdInvalid 0x00U 49 #define osRtxIdThread 0xF1U 50 #define osRtxIdTimer 0xF2U 51 #define osRtxIdEventFlags 0xF3U 52 #define osRtxIdMutex 0xF5U 53 #define osRtxIdSemaphore 0xF6U 54 #define osRtxIdMemoryPool 0xF7U 55 #define osRtxIdMessage 0xF9U 56 #define osRtxIdMessageQueue 0xFAU 59 #define osRtxFlagSystemObject 0x01U 60 #define osRtxFlagSystemMemory 0x02U 66 #define osRtxKernelInactive ((uint8_t)osKernelInactive) 67 #define osRtxKernelReady ((uint8_t)osKernelReady) 68 #define osRtxKernelRunning ((uint8_t)osKernelRunning) 69 #define osRtxKernelLocked ((uint8_t)osKernelLocked) 70 #define osRtxKernelSuspended ((uint8_t)osKernelSuspended) 76 #define osRtxThreadStateMask 0x0FU 78 #define osRtxThreadInactive ((uint8_t)osThreadInactive) 79 #define osRtxThreadReady ((uint8_t)osThreadReady) 80 #define osRtxThreadRunning ((uint8_t)osThreadRunning) 81 #define osRtxThreadBlocked ((uint8_t)osThreadBlocked) 82 #define osRtxThreadTerminated ((uint8_t)osThreadTerminated) 84 #define osRtxThreadWaitingDelay ((uint8_t)(osRtxThreadBlocked | 0x10U)) 85 #define osRtxThreadWaitingJoin ((uint8_t)(osRtxThreadBlocked | 0x20U)) 86 #define osRtxThreadWaitingThreadFlags ((uint8_t)(osRtxThreadBlocked | 0x30U)) 87 #define osRtxThreadWaitingEventFlags ((uint8_t)(osRtxThreadBlocked | 0x40U)) 88 #define osRtxThreadWaitingMutex ((uint8_t)(osRtxThreadBlocked | 0x50U)) 89 #define osRtxThreadWaitingSemaphore ((uint8_t)(osRtxThreadBlocked | 0x60U)) 90 #define osRtxThreadWaitingMemoryPool ((uint8_t)(osRtxThreadBlocked | 0x70U)) 91 #define osRtxThreadWaitingMessageGet ((uint8_t)(osRtxThreadBlocked | 0x80U)) 92 #define osRtxThreadWaitingMessagePut ((uint8_t)(osRtxThreadBlocked | 0x90U)) 95 #define osRtxThreadFlagDefStack 0x10U 98 #define osRtxStackMagicWord 0xE25A2EA5U 99 #define osRtxStackFillPattern 0xCCCCCCCCU
126 #ifdef RTX_TF_M_EXTENSION 135 #define osRtxTimerInactive 0x00U 136 #define osRtxTimerStopped 0x01U
137 #define osRtxTimerRunning 0x02U
140 #define osRtxTimerPeriodic ((uint8_t)osTimerPeriodic) 365 #define osRtxThreadFlagsLimit 31U 366 #define osRtxEventFlagsLimit 31U
367 #define osRtxMutexLockLimit 255U
368 #define osRtxSemaphoreTokenLimit 65535U
371 #define osRtxThreadCbSize sizeof(osRtxThread_t) 372 #define osRtxTimerCbSize sizeof(osRtxTimer_t) 373 #define osRtxEventFlagsCbSize sizeof(osRtxEventFlags_t) 374 #define osRtxMutexCbSize sizeof(osRtxMutex_t) 375 #define osRtxSemaphoreCbSize sizeof(osRtxSemaphore_t) 376 #define osRtxMemoryPoolCbSize sizeof(osRtxMemoryPool_t) 377 #define osRtxMessageQueueCbSize sizeof(osRtxMessageQueue_t) 382 #define osRtxMemoryPoolMemSize(block_count, block_size) \ 383 (4*(block_count)*(((block_size)+3)/4)) 388 #define osRtxMessageQueueMemSize(msg_count, msg_size) \ 389 (4*(msg_count)*(3+(((msg_size)+3)/4))) 395 #define osRtxErrorStackUnderflow 1U 396 #define osRtxErrorISRQueueOverflow 2U
397 #define osRtxErrorTimerQueueOverflow 3U
398 #define osRtxErrorClibSpace 4U
399 #define osRtxErrorClibMutex 5U
402 extern uint32_t osRtxErrorNotify (uint32_t code,
void *object_id);
405 extern void osRtxIdleThread (
void *argument);
408 extern void SVC_Handler (
void);
409 extern void PendSV_Handler (
void);
410 extern void SysTick_Handler (
void);
413 #ifdef RTX_TF_M_EXTENSION 414 extern uint32_t osRtxTzGetModuleId (
void);
421 #define osRtxConfigPrivilegedMode (1UL<<0) 422 #define osRtxConfigStackCheck (1UL<<1)
423 #define osRtxConfigStackWatermark (1UL<<2)
OS Runtime Object Memory Usage structure.
osRtxTimer_t * list
< Timer Info
uint32_t wait_flags
Waiting Thread/Event Flags.
osRtxMpInfo_t * stack
< Memory Pools (Fixed Block Size)
uint8_t flags
Object Flags.
Message Queue Control Block.
uint8_t reserved_state
Object State (not used)
OS Configuration structure.
uint8_t flags
Object Flags.
int8_t priority
Thread Priority.
osRtxMpInfo_t * thread
Thread Control Blocks.
Attributes structure for thread.
osRtxThread_t * idle
Idle Thread.
void * common
Common Memory.
Memory Pool Control Block.
const char * name
Object Name.
const osMessageQueueAttr_t * timer_mq_attr
Timer Message Queue Attributes.
uint8_t id
Object Identifier.
void ** data
< ISR Post Processing Queue
uint8_t stack_frame
Stack Frame (EXC_RETURN[7..0])
osRtxMpInfo_t * event_flags
Event Flags Control Blocks.
uint32_t version
OS Version.
uint32_t max_used
Maximum used.
const osThreadAttr_t * timer_thread_attr
Timer Thread Attributes.
uint8_t priority
Message Priority.
const char * name
Object Name.
void * mq_data
Message Queue Data Memory.
osRtxMessage_t * msg_last
Pointer to last Message.
Generic Object Control Block.
uint32_t timeout
Round Robin Timeout.
uint32_t tick_freq
Kernel Tick Frequency.
osTimerFunc_t func
Function Pointer.
void * stack_addr
< Memory Pools (Variable Block Size)
uint8_t flags_options
Thread/Event Flags Options.
struct osRtxThread_s * delay_next
Link pointer to next Thread in Delay list.
struct osRtxTimer_s * prev
Pointer to previous active Timer.
uint8_t flags
Object Flags.
uint32_t tick
Timer current Tick.
uint16_t max_tokens
Maximum number of tokens.
uint8_t reserved_state
Object State (not used)
uint16_t tokens
Current number of tokens.
uint32_t cnt_alloc
Counter for alloc.
osRtxThread_t * thread_list
Waiting Threads List.
osRtxMessage_t * msg_first
Pointer to first Message.
struct osRtxMutex_s * mutex_list
Link pointer to list of owned Mutexes.
uint32_t flags
OS Configuration Flags.
uint8_t id
Object Identifier.
uint8_t state
Object State.
osRtxThread_t * thread_list
Threads List.
uint32_t timer_mq_mcnt
Timer Message Queue maximum Messages.
void * block_base
Block Memory Base Address.
uint32_t thread_flags
Thread Flags.
osRtxMpInfo_t * timer
Timer Control Blocks.
Timer Function Information.
uint32_t mq_data_size
Message Queue Data Memory Size.
struct osRtxThread_s * delay_prev
Link pointer to previous Thread in Delay list.
void * block_free
First free Block Address.
Attributes structure for message queue.
uint8_t id
Object Identifier.
uint32_t stack_size
Stack Size.
osRtxMpInfo_t * thread
Thread Control Blocks.
void * mq_data_addr
Message Queue Data Memory Address.
uint32_t stack_size
Stack Memory Size.
struct osRtxThread_s * thread_prev
Link pointer to previous Thread in Object list.
osRtxMpInfo_t * timer
Timer Control Blocks.
osRtxThread_t * thread_list
Waiting Threads List.
osRtxThread_t * thread
< Thread Round Robin Info
const osThreadAttr_t * idle_thread_attr
Idle Thread Attributes.
uint16_t max
Maximum Items.
uint32_t cnt_free
Counter for free.
osRtxMpInfo_t * mutex
Mutex Control Blocks.
osRtxThread_t * thread_list
Waiting Threads List.
const char * name
Object Name.
uint16_t max
< ISR Post Processing Queue
uint16_t in
Incoming Item Index.
uint8_t reserved_state
Object State (not used)
osRtxThread_t * curr
< Thread Run Info
uint8_t id
Object Identifier.
osRtxMpInfo_t mp_info
Memory Pool Info.
struct osRtxMessage_s * next
Pointer to next Message.
osRtxMpInfo_t * stack
< Memory Pools (Fixed Block Size)
uint8_t flags
Object Flags.
uint32_t load
Timer Load value.
Event Flags Control Block.
uint8_t pendSV
Pending SV.
uint8_t id
Object Identifier.
void * stack
< Memory Pools (Variable Block Size)
osRtxMpInfo_t * semaphore
Semaphore Control Blocks.
void * block_lim
Block Memory Limit Address.
void * arg
Function Argument.
uint8_t flags
Object Flags.
void * mp_data_addr
Memory Pool Memory Address.
uint8_t state
< Kernel Info
const char * name
Object Name.
osRtxMpInfo_t * mutex
Mutex Control Blocks.
struct osRtxMutex_s * owner_prev
Pointer to previous owned Mutex.
uint8_t id
Object Identifier.
void * stack_mem
Stack Memory.
void * common_addr
Common Memory Address.
uint8_t flags
Object Flags.
osRtxMpInfo_t * message_queue
Message Queue Control Blocks.
osRtxThread_t * terminate_list
Terminate Thread List.
uint8_t reserved_state
Object State (not used)
struct osRtxThread_s * thread_next
Link pointer to next Thread in Object list.
uint32_t mp_data_size
Memory Pool Memory Size.
osRtxThread_t * wait_list
Wait List (no Timeout)
int8_t priority_base
Base Priority.
uint8_t attr
Object Attributes.
uint16_t out
Outgoing Item Index.
uint8_t id
Object Identifier.
osRtxThread_t * next
Next Thread to Run.
struct osRtxMutex_s * owner_next
Pointer to next owned Mutex.
const char * os_id
OS Identification.
uint8_t reserved_state
Object State (not used)
uint32_t delay
Delay Time.
uint8_t type
Timer Type (Periodic/One-shot)
uint32_t common_size
Common Memory Size.
struct osRtxMessage_s * prev
Pointer to previous Message.
const char * name
Object Name.
osRtxMpInfo_t * event_flags
Event Flags Control Blocks.
osRtxThread_t * delay_list
Delay List.
osRtxMpInfo_t mp_info
Memory Pool Info.
uint32_t robin_timeout
Round Robin Timeout Tick.
uint32_t thread_addr
Thread entry address.
uint8_t id
Object Identifier.
osRtxMpInfo_t * message_queue
Message Queue Control Blocks.
uint8_t flags
Object Flags.
osRtxThread_t * thread_list
Waiting Threads List.
osRtxObject_t ready
Ready List Object.
uint32_t tick
Tick counter.
const char * name
Object Name.
uint8_t lock
Lock counter.
struct osRtxThread_s * thread_join
Thread waiting to Join.
uint32_t max_blocks
Maximum number of Blocks.
int32_t tick_irqn
Tick Timer IRQ Number.
uint32_t block_size
Block Size.
osRtxMessageQueue_t * mq
Timer Message Queue.
osRtxThread_t * thread_list
Waiting Threads List.
uint32_t tz_memory
TrustZone Memory Identifier.
uint8_t state
Object State.
uint32_t used_blocks
Number of used Blocks.
uint32_t msg_count
Number of queued Messages.
uint8_t reserved_state
Object State (not used)
uint8_t attr
Object Attributes.
struct osRtxTimer_s * next
Pointer to next active Timer.
uint32_t event_flags
Event Flags.
uint32_t thread_stack_size
Default Thread Stack Size.
void * mp_data
Memory Pool Data Memory.
uint8_t id
Object Identifier.
uint8_t flags
Object Flags.
osRtxMpInfo_t * memory_pool
Memory Pool Control Blocks.
uint32_t msg_size
Message Size.
uint8_t flags
Object Flags.
const char * name
Object Name.
OS Runtime Information structure.
volatile uint8_t blocked
Blocked.
uint32_t sp
Current Stack Pointer.
osRtxThread_t * owner_thread
Owner Thread.
osRtxMpInfo_t * memory_pool
Memory Pool Control Blocks.
const char * name
Object Name.
uint8_t state
Object State.
osRtxMpInfo_t * semaphore
Semaphore Control Blocks.
osRtxTimerFinfo_t finfo
Timer Function Info.