* @brief Initialize thread's scheduling private data * * @param thread Pointer to the thread control block * @param tick Initial time slice value for the thread * @param priority Initial priority of the thread * * @details This function: * - Initializes the thread's list node * - Sets initial and current priority (must be < RT_THREAD_PRIORITY_MAX) * - Initializes priority masks (num
| 459 | * - Sets initial and remaining time slice ticks |
| 460 | */ |
| 461 | void rt_sched_thread_init_priv(struct rt_thread *thread, rt_uint32_t tick, rt_uint8_t priority) |
| 462 | { |
| 463 | rt_list_init(&RT_THREAD_LIST_NODE(thread)); |
| 464 | |
| 465 | /* priority init */ |
| 466 | RT_ASSERT(priority < RT_THREAD_PRIORITY_MAX); |
| 467 | RT_SCHED_PRIV(thread).init_priority = priority; |
| 468 | RT_SCHED_PRIV(thread).current_priority = priority; |
| 469 | |
| 470 | /* don't add to scheduler queue as init thread */ |
| 471 | RT_SCHED_PRIV(thread).number_mask = 0; |
| 472 | #if RT_THREAD_PRIORITY_MAX > 32 |
| 473 | RT_SCHED_PRIV(thread).number = 0; |
| 474 | RT_SCHED_PRIV(thread).high_mask = 0; |
| 475 | #endif /* RT_THREAD_PRIORITY_MAX > 32 */ |
| 476 | |
| 477 | /* tick init */ |
| 478 | RT_SCHED_PRIV(thread).init_tick = tick; |
| 479 | RT_SCHED_PRIV(thread).remaining_tick = tick; |
| 480 | } |
| 481 | |
| 482 | /** |
| 483 | * @brief This function will insert a thread to the system ready queue. The state of |
no test coverage detected