eric2013 发表于 2022-10-19 01:43:06

RTX5的osRtxConfig定义

整理出来,方便在网页上整理查阅

static/image/hrline/4.gif

/// OS Configuration structure
typedef struct {
uint32_t                           flags;   ///< OS Configuration Flags
uint32_t                         tick_freq;   ///< Kernel Tick Frequency
uint32_t                     robin_timeout;   ///< Round Robin Timeout Tick
struct {                                    ///< ISR Post Processing Queue
    void                              **data;   ///< Queue Data
    uint16_t                           max;   ///< Maximum Items
    uint16_t                         padding;
} isr_queue;
struct {                                    ///< Memory Pools (Variable Block Size)
    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;
struct {                                    ///< Memory Pools (Fixed Block Size)
    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;
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;

static/image/hrline/4.gif
const osRtxConfig_t osRtxConfig \
__USED \
__attribute__((section(".rodata"))) =
{
//lint -e{835} "Zero argument to operator"
0U   // Flags
#if (OS_PRIVILEGE_MODE != 0)
| osRtxConfigPrivilegedMode
#endif
#if (OS_STACK_CHECK != 0)
| osRtxConfigStackCheck
#endif
#if (OS_STACK_WATERMARK != 0)
| osRtxConfigStackWatermark
#endif
,
(uint32_t)OS_TICK_FREQ,
#if (OS_ROBIN_ENABLE != 0)
(uint32_t)OS_ROBIN_TIMEOUT,
#else
0U,
#endif
{ &os_isr_queue, (uint16_t)(sizeof(os_isr_queue)/sizeof(void *)), 0U },
{
    // Memory Pools (Variable Block Size)
#if ((OS_THREAD_OBJ_MEM != 0) && (OS_THREAD_USER_STACK_SIZE != 0))
    &os_thread_stack, sizeof(os_thread_stack),
#else
    NULL, 0U,
#endif
#if ((OS_MEMPOOL_OBJ_MEM != 0) && (OS_MEMPOOL_DATA_SIZE != 0))
    &os_mp_data, sizeof(os_mp_data),
#else
    NULL, 0U,
#endif
#if ((OS_MSGQUEUE_OBJ_MEM != 0) && (OS_MSGQUEUE_DATA_SIZE != 0))
    &os_mq_data, sizeof(os_mq_data),
#else
    NULL, 0U,
#endif
#if (OS_DYNAMIC_MEM_SIZE != 0)
    &os_mem, (uint32_t)OS_DYNAMIC_MEM_SIZE,
#else
    NULL, 0U
#endif
},
{
    // Memory Pools (Fixed Block Size)
#if (OS_THREAD_OBJ_MEM != 0)
#if (OS_THREAD_DEF_STACK_NUM != 0)
    &os_mpi_def_stack,
#else
    NULL,
#endif
    &os_mpi_thread,
#else
    NULL,
    NULL,
#endif
#if (OS_TIMER_OBJ_MEM != 0)
    &os_mpi_timer,
#else
    NULL,
#endif
#if (OS_EVFLAGS_OBJ_MEM != 0)
    &os_mpi_ef,
#else
    NULL,
#endif
#if (OS_MUTEX_OBJ_MEM != 0)
    &os_mpi_mutex,
#else
    NULL,
#endif
#if (OS_SEMAPHORE_OBJ_MEM != 0)
    &os_mpi_semaphore,
#else
    NULL,
#endif
#if (OS_MEMPOOL_OBJ_MEM != 0)
    &os_mpi_mp,
#else
    NULL,
#endif
#if (OS_MSGQUEUE_OBJ_MEM != 0)
    &os_mpi_mq,
#else
    NULL,
#endif
},
(uint32_t)OS_STACK_SIZE,
&os_idle_thread_attr,
#if ((OS_TIMER_THREAD_STACK_SIZE != 0) && (OS_TIMER_CB_QUEUE != 0))
&os_timer_thread_attr,
osRtxTimerThread,
osRtxTimerSetup,
&os_timer_mq_attr,
(uint32_t)OS_TIMER_CB_QUEUE
#else
NULL,
NULL,
NULL,
NULL,
0U
#endif
};

页: [1]
查看完整版本: RTX5的osRtxConfig定义