RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
System Initialization

函数

void rt_system_timer_init (void)
 
void rt_system_timer_thread_init (void)
 
void rt_application_init ()
 
void rt_system_heap_init (void *begin_addr, void *end_addr)
 

详细描述

System initialization procedure.

When RT-Thread operating system starts up, the basic operating system facility initialization routines must be invoked.

The suggested initialization sequence is:

User can put the low level hardware initialization in this function, such as DDR memory setting, pinmux setting, console device setting etc.

函数说明

◆ rt_system_timer_init()

void rt_system_timer_init ( void )

This function will initialize system timer

在文件 timer.c823 行定义.

824{
825#ifndef RT_USING_TIMER_ALL_SOFT
826 rt_size_t i;
827
828 for (i = 0; i < sizeof(_timer_list) / sizeof(_timer_list[0]); i++)
829 {
830 rt_list_init(_timer_list + i);
831 }
832
833 rt_spin_lock_init(&_htimer_lock);
834#endif
835}
void rt_spin_lock_init(struct rt_spinlock *lock)
Initialize a static spinlock object.
rt_inline void rt_list_init(rt_list_t *l)
initialize a list
rt_ubase_t rt_size_t

引用了 rt_list_init() , 以及 rt_spin_lock_init().

+ 函数调用图:

◆ rt_system_timer_thread_init()

void rt_system_timer_thread_init ( void )

This function will initialize system timer thread

在文件 timer.c842 行定义.

843{
844#ifdef RT_USING_TIMER_SOFT
845 int i;
846
847 for (i = 0;
848 i < sizeof(_soft_timer_list) / sizeof(_soft_timer_list[0]);
849 i++)
850 {
851 rt_list_init(_soft_timer_list + i);
852 }
853 rt_spin_lock_init(&_stimer_lock);
854 rt_sem_init(&_soft_timer_sem, "stimer", 0, RT_IPC_FLAG_PRIO);
855 rt_sem_control(&_soft_timer_sem, RT_IPC_CMD_SET_VLIMIT, (void*)1);
856 /* start software timer thread */
857 rt_thread_init(&_timer_thread,
858 "timer",
859 _timer_thread_entry,
860 RT_NULL,
861 &_timer_thread_stack[0],
862 sizeof(_timer_thread_stack),
863 RT_TIMER_THREAD_PRIO,
864 10);
865
866 /* startup */
867 rt_thread_startup(&_timer_thread);
868#endif /* RT_USING_TIMER_SOFT */
869}
#define RT_IPC_FLAG_PRIO
#define RT_IPC_CMD_SET_VLIMIT
rt_err_t rt_thread_startup(rt_thread_t thread)
This function will start a thread and put it to system ready queue.
rt_err_t rt_thread_init(struct rt_thread *thread, const char *name, void(*entry)(void *parameter), void *parameter, void *stack_start, rt_uint32_t stack_size, rt_uint8_t priority, rt_uint32_t tick)
This function will initialize a thread. It's used to initialize a static thread object.
rt_err_t rt_sem_init(rt_sem_t sem, const char *name, rt_uint32_t value, rt_uint8_t flag)
This function will initialize a static semaphore object.
定义 ipc.c:376
rt_err_t rt_sem_control(rt_sem_t sem, int cmd, void *arg)
This function will set some extra attributions of a semaphore object.
定义 ipc.c:759
#define RT_NULL

引用了 RT_IPC_CMD_SET_VLIMIT, RT_IPC_FLAG_PRIO, rt_list_init(), RT_NULL, rt_sem_control(), rt_sem_init(), rt_spin_lock_init(), rt_thread_init() , 以及 rt_thread_startup().

+ 函数调用图:

◆ rt_application_init()

void rt_application_init ( )

This function will initialize user application.

This function will be invoked when system initialization and system scheduler has not started. User can allocate memory, create thread, semaphore etc. However, user shall not suspend 'current' thread.

◆ rt_system_heap_init()

void rt_system_heap_init ( void * begin_addr,
void * end_addr )

This function will init system heap. User can override this API to complete other works, like heap sanitizer initialization.

参数
begin_addrthe beginning address of system page.
end_addrthe end address of system page.

在文件 kservice.c795 行定义.

796{
797 rt_system_heap_init_generic(begin_addr, end_addr);
798}
void rt_system_heap_init_generic(void *begin_addr, void *end_addr)
This function will do the generic system heap initialization.

引用了 rt_system_heap_init_generic().

+ 函数调用图: