?????????????????????????????
???????????? ???????[ 2012/10/8 9:58:38 ] ????????
???????????????????????????????????????????????????????????????β??????????????????????????????????????ó???????????????????????????У????????????????????????????????????????????????????????????????????????????????????????????????????
void raw_sched() { RAW_SR_ALLOC(); /*if it is in interrupt or system is locked?? just return*/ if (raw_int_nesting || raw_sched_lock) { return; } RAW_CRITICAL_ENTER(); get_ready_task(&raw_ready_queue); /*if highest task is currently task?? then no need to do switch and just return*/ if (high_ready_obj == raw_task_active) { RAW_CRITICAL_EXIT(); return; } CONTEXT_SWITCH(); RAW_CRITICAL_EXIT(); } |
??????????????????????????????????get_ready_task??????????????????????????????????????????????????????????
void get_ready_task(RAW_RUN_QUEUE *rq) { LIST *node ; RAW_S32 highest_pri = rq->highest_priority; /*Highest task must be the first element on the list*/ node = rq->task_ready_list[highest_pri].next; high_ready_obj = list_entry(node?? RAW_TASK_OBJ?? task_list); } |
??????????????????????????????????????????????????棬?????????bitmap?????????????????????????????????λ??1???????0???????????£???????????????????????????????????????????????????е?????????????????????????????е????
void add_ready_list(RAW_RUN_QUEUE *rq?? RAW_TASK_OBJ *task_ptr) { /*if task priority is equal current task priority then add to the end*/ if (task_ptr->priority == raw_task_active->priority) { add_ready_list_end(rq?? task_ptr); } /*if not add to the list front*/ else { add_ready_list_head(rq?? task_ptr); } } void remove_ready_list(RAW_RUN_QUEUE *rq?? RAW_TASK_OBJ *task_ptr) { RAW_S32 i; RAW_S32 priority = task_ptr->priority; list_delete(&task_ptr->task_list); /*if the ready list is not empty?? we do not need to update the highest priority*/ if (!is_list_empty(&rq->task_ready_list[priority]) ) { return; } bit_clear(rq->task_bit_map?? priority); /*If task priority not equal to the highest priority?? then we do not need to update the highest priority*/ if (priority != rq->highest_priority) { return; } i = bit_search_first_one(rq->task_bit_map?? priority?? CONFIG_RAW_PRIO_MAX - priority); /*Update the next highest priority task*/ if (i >= 0) { rq->highest_priority = priority + i; } else { #if (CONFIG_RAW_ASSERT > 0) RAW_ASSERT(0); #endif } } |
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11