/// Timer Function Information
typedef struct osRtxTimerFinfo_s {
osTimerFunc_t func; ///< Function Pointer
void *arg; ///< Function Argument
} osRtxTimerFinfo_t;
/// Timer Control Block
typedef struct osRtxTimer_s {
uint8_t id; ///< Object Identifier
uint8_t state; ///< Object State
uint8_t flags; ///< Object Flags
uint8_t attr; ///< Object Attributes
const char name; ///< Object Name
struct osRtxTimer_s prev; ///< Pointer to previous active Timer
struct osRtxTimer_s *next; ///< Pointer to next active Timer
uint32_t tick; ///< Timer current Tick
uint32_t load; ///< Timer Load value
osRtxTimerFinfo_t finfo; ///< Timer Function Info
} osRtxTimer_t;
/// Semaphore Control Block
typedef struct osRtxSemaphore_s {
uint8_t id; ///< Object Identifier
uint8_t reserved_state; ///< Object State (not used)
uint8_t flags; ///< Object Flags
uint8_t attr; ///< Object Attributes
const char name; ///< Object Name
osRtxThread_t thread_list; ///< Waiting Threads List
uint16_t tokens; ///< Current number of tokens
uint16_t max_tokens; ///< Maximum number of tokens
} osRtxSemaphore_t;
// ==== Memory Pool definitions ====
/// Memory Pool Information
typedef struct osRtxMpInfo_s {
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
} osRtxMpInfo_t;
/// Memory Pool Control Block
typedef struct osRtxMemoryPool_s {
uint8_t id; ///< Object Identifier
uint8_t reserved_state; ///< Object State (not used)
uint8_t flags; ///< Object Flags
uint8_t attr; ///< Object Attributes
const char name; ///< Object Name
osRtxThread_t thread_list; ///< Waiting Threads List
osRtxMpInfo_t mp_info; ///< Memory Pool Info
} osRtxMemoryPool_t;
// ==== Message Queue definitions ====
/// Message Control Block
typedef struct osRtxMessage_s {
uint8_t id; ///< Object Identifier
uint8_t reserved_state; ///< Object State (not used)
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
} osRtxMessage_t;
/// Message Queue Control Block
typedef struct osRtxMessageQueue_s {
uint8_t id; ///< Object Identifier
uint8_t reserved_state; ///< Object State (not used)
uint8_t flags; ///< Object Flags
uint8_t attr; ///< Object Attributes
const char name; ///< Object Name
osRtxThread_t thread_list; ///< Waiting Threads List
osRtxMpInfo_t mp_info; ///< Memory Pool Info
uint32_t msg_size; ///< Message Size
uint32_t msg_count; ///< Number of queued Messages
osRtxMessage_t msg_first; ///< Pointer to first Message
osRtxMessage_t msg_last; ///< Pointer to last Message
} osRtxMessageQueue_t;
Please add a tag to all struct definition like:
/// Thread Control Block typedef struct osRtxThread_s { uint8_t id; ///< Object Identifier uint8_t state; ///< Object State uint8_t flags; ///< Object Flags uint8_t attr; ///< Object Attributes const char name; ///< Object Name struct osRtxThread_s thread_next; ///< Link pointer to next Thread in Object list struct osRtxThread_s thread_prev; ///< Link pointer to previous Thread in Object list struct osRtxThread_s delay_next; ///< Link pointer to next Thread in Delay list struct osRtxThread_s delay_prev; ///< Link pointer to previous Thread in Delay list struct osRtxThread_s thread_join; ///< Thread waiting to Join uint32_t delay; ///< Delay Time/Round Robin Time Tick int8_t priority; ///< Thread Priority int8_t priority_base; ///< Base Priority uint8_t stack_frame; ///< Stack Frame (EXC_RETURN[7..0]) uint8_t flags_options; ///< Thread/Event Flags Options uint32_t wait_flags; ///< Waiting Thread/Event Flags uint32_t thread_flags; ///< Thread Flags struct osRtxMutex_s mutex_list; ///< Link pointer to list of owned Mutexes void stack_mem; ///< Stack Memory uint32_t stack_size; ///< Stack Size uint32_t sp; ///< Current Stack Pointer uint32_t thread_addr; ///< Thread entry address uint32_t tz_memory; ///< TrustZone Memory Identifier uint8_t zone; ///< Thread Zone uint8_t reserved[3]; struct osRtxThread_s *wdog_next; ///< Link pointer to next Thread in Watchdog list uint32_t wdog_tick; ///< Watchdog tick counter } osRtxThread_t;
// ==== Timer definitions ====
/// Timer State definitions
define osRtxTimerInactive 0x00U ///< Timer Inactive
define osRtxTimerStopped 0x01U ///< Timer Stopped
define osRtxTimerRunning 0x02U ///< Timer Running
/// Timer attribute definitions
define osRtxTimerPeriodic 0x01U ///< Timer Periodic mode
/// Timer Function Information typedef struct osRtxTimerFinfo_s { osTimerFunc_t func; ///< Function Pointer void *arg; ///< Function Argument } osRtxTimerFinfo_t;
/// Timer Control Block typedef struct osRtxTimer_s { uint8_t id; ///< Object Identifier uint8_t state; ///< Object State uint8_t flags; ///< Object Flags uint8_t attr; ///< Object Attributes const char name; ///< Object Name struct osRtxTimer_s prev; ///< Pointer to previous active Timer struct osRtxTimer_s *next; ///< Pointer to next active Timer uint32_t tick; ///< Timer current Tick uint32_t load; ///< Timer Load value osRtxTimerFinfo_t finfo; ///< Timer Function Info } osRtxTimer_t;
// ==== Event Flags definitions ====
/// Event Flags Control Block typedef struct osRtxEventFlags_s { uint8_t id; ///< Object Identifier uint8_t reserved_state; ///< Object State (not used) uint8_t flags; ///< Object Flags uint8_t attr; ///< Object Attributes const char name; ///< Object Name osRtxThread_t thread_list; ///< Waiting Threads List uint32_t event_flags; ///< Event Flags } osRtxEventFlags_t;
// ==== Mutex definitions ====
/// Mutex Control Block typedef struct osRtxMutex_s { uint8_t id; ///< Object Identifier uint8_t reserved_state; ///< Object State (not used) uint8_t flags; ///< Object Flags uint8_t attr; ///< Object Attributes const char name; ///< Object Name osRtxThread_t thread_list; ///< Waiting Threads List osRtxThread_t owner_thread; ///< Owner Thread struct osRtxMutex_s owner_prev; ///< Pointer to previous owned Mutex struct osRtxMutex_s *owner_next; ///< Pointer to next owned Mutex uint8_t lock; ///< Lock counter uint8_t padding[3]; } osRtxMutex_t;
// ==== Semaphore definitions ====
/// Semaphore Control Block typedef struct osRtxSemaphore_s { uint8_t id; ///< Object Identifier uint8_t reserved_state; ///< Object State (not used) uint8_t flags; ///< Object Flags uint8_t attr; ///< Object Attributes const char name; ///< Object Name osRtxThread_t thread_list; ///< Waiting Threads List uint16_t tokens; ///< Current number of tokens uint16_t max_tokens; ///< Maximum number of tokens } osRtxSemaphore_t;
// ==== Memory Pool definitions ====
/// Memory Pool Information typedef struct osRtxMpInfo_s { 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 } osRtxMpInfo_t;
/// Memory Pool Control Block typedef struct osRtxMemoryPool_s { uint8_t id; ///< Object Identifier uint8_t reserved_state; ///< Object State (not used) uint8_t flags; ///< Object Flags uint8_t attr; ///< Object Attributes const char name; ///< Object Name osRtxThread_t thread_list; ///< Waiting Threads List osRtxMpInfo_t mp_info; ///< Memory Pool Info } osRtxMemoryPool_t;
// ==== Message Queue definitions ====
/// Message Control Block typedef struct osRtxMessage_s { uint8_t id; ///< Object Identifier uint8_t reserved_state; ///< Object State (not used) 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 } osRtxMessage_t;
/// Message Queue Control Block typedef struct osRtxMessageQueue_s { uint8_t id; ///< Object Identifier uint8_t reserved_state; ///< Object State (not used) uint8_t flags; ///< Object Flags uint8_t attr; ///< Object Attributes const char name; ///< Object Name osRtxThread_t thread_list; ///< Waiting Threads List osRtxMpInfo_t mp_info; ///< Memory Pool Info uint32_t msg_size; ///< Message Size uint32_t msg_count; ///< Number of queued Messages osRtxMessage_t msg_first; ///< Pointer to first Message osRtxMessage_t msg_last; ///< Pointer to last Message } osRtxMessageQueue_t;
// ==== Generic Object definitions ====
/// Generic Object Control Block typedef struct osRtxObject_s { uint8_t id; ///< Object Identifier uint8_t state; ///< Object State uint8_t flags; ///< Object Flags uint8_t attr; ///< Object Attributes const char name; ///< Object Name osRtxThread_t thread_list; ///< Threads List } osRtxObject_t;
// ==== OS Runtime Information definitions ====
/// OS Runtime Information structure typedef struct osRtxInfo_s { const char os_id; ///< OS Identification uint32_t version; ///< OS Version struct osRtxInfoKernel_s { uint8_t state; ///< State volatile uint8_t blocked; ///< Blocked uint8_t pendSV; ///< Pending SV uint8_t protect; ///< Protect options uint32_t tick; ///< Tick counter } kernel; ///< Kernel Info int32_t tick_irqn; ///< Tick Timer IRQ Number struct osRtxInfoThread_s { struct osRtxInfoRun_s { osRtxThread_t curr; ///< Current running Thread osRtxThread_t next; ///< Next Thread to Run } run; ///< Thread Run Info 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 osRtxThread_t wdog_list; ///< Watchdog List struct osRtxInfoRobin_s { osRtxThread_t thread; ///< Round Robin Thread uint32_t timeout; ///< Round Robin Timeout } robin; ///< Thread Round Robin Info } thread; ///< Thread Info struct osRtxInfoTimer_s { osRtxTimer_t list; ///< Active Timer List osRtxThread_t thread; ///< Timer Thread osRtxMessageQueue_t mq; ///< Timer Message Queue void (*tick)(void); ///< Timer Tick Function } timer; ///< Timer Info struct osRtxInfoIsrQueue_s { uint16_t max; ///< Maximum Items uint16_t cnt; ///< Item Count uint16_t in; ///< Incoming Item Index uint16_t out; ///< Outgoing Item Index void data; ///< Queue Data } isr_queue; ///< ISR Post Processing Queue struct osRtxInfoPostProcess_s { void (thread)(osRtxThread_t); ///< Thread Post Processing function void (event_flags)(osRtxEventFlags_t); ///< Event Flags Post Processing function void (semaphore)(osRtxSemaphore_t); ///< Semaphore Post Processing function void (memory_pool)(osRtxMemoryPool_t); ///< Memory Pool Post Processing function void (message)(osRtxMessage_t); ///< Message Post Processing function } post_process; ///< ISR Post Processing functions struct osRtxInfoMem_s { void stack; ///< Stack Memory void mp_data; ///< Memory Pool Data Memory void mq_data; ///< Message Queue Data Memory void common; ///< Common Memory } mem; ///< Memory Pools (Variable Block Size) struct osRtxInfoMpi_s* { osRtxMpInfo_t stack; ///< 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 } mpi; ///< Memory Pools (Fixed Block Size) } osRtxInfo_t;
typedef struct osRtxConfig_s { uint32_t flags; ///< OS Configuration Flags uint32_t tick_freq; ///< Kernel Tick Frequency uint32_t robin_timeout; ///< Round Robin Timeout Tick struct osRtxConfigIsrQueue_s { void data; ///< Queue Data uint16_t max; ///< Maximum Items uint16_t padding; ///< Padding } isr_queue; ///< ISR Post Processing Queue struct osRtxConfigMem_s { void stack_addr; ///< 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 } mem; ///< Memory Pools (Variable Block Size) struct osRtxConfigMpi_s* { osRtxMpInfo_t stack; ///< 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 } mpi; ///< Memory Pools (Fixed Block Size) 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 void (timer_thread)(void ); ///< Timer Thread Function int32_t (timer_setup)(void); ///< Timer Setup Function const osMessageQueueAttr_t *timer_mq_attr; ///< Timer Message Queue Attributes uint32_t timer_mq_mcnt; ///< Timer Message Queue maximum Messages } osRtxConfig_t;
This helps to identifiy the object in a debugger like uVision Watch Windows or to see the connection to the object in PcLint output.