FreeRTOS的列表

发布时间 2023-04-28 10:05:09作者: kehuadong
PRIVILEGED_DATA static List_t pxReadyTasksLists[ configMAX_PRIORITIES ]; /**< Prioritised ready tasks. */
PRIVILEGED_DATA static List_t xDelayedTaskList1;                         /**< Delayed tasks. */
PRIVILEGED_DATA static List_t xDelayedTaskList2;                         /**< Delayed tasks (two lists are used - one for delays that have overflowed the current tick count. */
PRIVILEGED_DATA static List_t * volatile pxDelayedTaskList;              /**< Points to the delayed task list currently being used. */
PRIVILEGED_DATA static List_t * volatile pxOverflowDelayedTaskList;      /**< Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count. */
PRIVILEGED_DATA static List_t xPendingReadyList; 


// pxReadyTasksLists 是按优先级区分的就绪任务列表数组, 存储StateItem, 代表可以切入的任务

// xDelayedTaskList1和xDelayedTaskList2, 代表挂起的任务列表,存储StateItem需要当前时间达到任务的唤醒时间

// pxDelayedTaskList和pxOverflowDelayedTaskList指针指向上面两个列表, 当前时间越界时,调换对上面两个列表的指向

// PendingReadyList 代表需要就绪,但是还没就绪的任务列表, 存储EventItem, 
// 通常是等待队列事件的任务唤醒后需要变为就绪状态,但是当前调度器被暂停了
// 例如xQueueGenericSend的时候,队列中肯定有数据了, 
// 就会xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) 让在等待读取队列数据的任务唤醒,
// 但是此时uxSchedulerSuspended != ( UBaseType_t ) pdFALSE, 
// 就需要listINSERT_END( &( xPendingReadyList ), &( pxUnblockedTCB->xEventListItem ) );