import
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#include "os.h"
|
||||
#include "os_port.h"
|
||||
#include "os_rdy_list.h"
|
||||
#include "os_systick.h"
|
||||
#include "os_sched.h"
|
||||
#include "os_yield_list.h"
|
||||
#include "os_idle.h"
|
||||
#include "os_timewheel.h"
|
||||
#include "os_isr.h"
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
|
||||
void os_init(void){
|
||||
g_os_systick_ticks = 0;
|
||||
g_os_port_switch_from_sp = 0;
|
||||
g_os_port_switch_to_sp = 0;
|
||||
g_os_port_context_switch_flag = OS_FALSE;
|
||||
g_os_isr_nesting_cnt = 0;
|
||||
os_priority_init();
|
||||
os_rdy_list_init();
|
||||
os_yield_list_init();
|
||||
os_timewheel_init();
|
||||
os_sched_init();
|
||||
os_port_init();
|
||||
os_idle_init();
|
||||
}
|
||||
|
||||
void os_startup(void){
|
||||
os_critical_enter();
|
||||
os_priority_t priority = os_priority_get_highest();
|
||||
os_rdy_list_t* p_rdy_list = os_rdy_list_get(priority);
|
||||
os_list_node_t* p_node = p_rdy_list->head.next;
|
||||
os_task_t* p_next_task = os_list_member_of(p_node, os_task_t, node);
|
||||
os_rdy_list_remove((os_task_t*)p_next_task);
|
||||
os_critical_leave();
|
||||
|
||||
os_port_startup();
|
||||
|
||||
os_port_context_switch(0, &p_next_task->stack.sp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user