*flush TLB/ICahe/DCahe
*Interrupt disable
*clock set
*UART Hardware 2 Console Display set
*all enable && jump to RAM main() @0xc0000000
這邊也可參考類似的flow @Uboot .
Step2.
*OS start
*initial ready_lists 4 each threads, delayed_list,termination_wait_list,termination_wait_list
*set thread 2 thread table && priority/function set
* run thread && schedule detection (SCHED_TIME_EXPIRE||SCHED_THREAD_REQUEST)
//儲存CPU status && Disable Interrupt cpu_sr = save_cpu_sr(); //取得最高priority 的 thread Id top_prio = get_top_prio(); /* If the timer expires... */ if (sched_type == SCHED_TIME_EXPIRE) { /* Threads that are currently running will continue to run it * at the highest priority */ if (current_thread->prio < top_prio) { current_thread->time_quantum = TIME_QUANTUM; restore_cpu_sr(cpu_sr); return; } /* otherwise, threads in a ready state, then run the highest * priority one. */ //取得 ready_list的 first Node 2 entry list && change context switch mode pnode = delete_front_list(&ready_list[top_prio]); if (is_empty_list(&ready_list[top_prio])) prio_exist_flag[top_prio] = false; next_thread = entry_list(pnode, thread_struct, node); next_thread->state = RUNNING; next_thread->time_quantum = TIME_QUANTUM; /* Ready to change the status of the currently executing thread */ current_thread->state = READY; insert_back_list(&ready_list[current_thread->prio], ¤t_thread->node); prio_exist_flag[current_thread->prio] = true; total_csw_cnt++; /* actual context switching */ context_switch_in_interrupt(); }code ref: Jserv's 解析 CuRT 與嵌入式系統設計 放大參考here ps: 如有錯誤的地方歡迎指正,謝謝
沒有留言:
張貼留言