上篇讲述了list.c关于链表操作的源码阅读,此片文章将开始阅读task.c
task.h相关结构体
/* 由eTaskGetState返回的任务状态 */
typedef enum
{
eRunning = 0, /* 一个任务查询自己的状态,必定是运行状态 */
eReady, /* 被查询的任务处于Ready状态 */
eBlocked, /* 被查询的任务处于被阻塞的状态 */
eSuspended, /* 被查询的任务处于被挂起的状态 */
eDeleted /* 被查询的任务已经被删除了,但是他的TCB还没有被释放 */
} eTaskState;
/* 当调用vTaskNotify()函数是会有什么动作发生 */
typedef enum
{
eNoAction = 0, /* 不通过更新任务的 notify value 而通知任务 */
eSetBits, /* 设置任务的 notification value对应的bit */
eIncrement, /* 增加 notification value. */
eSetValueWithOverwrite, /* 直接覆盖任务的notification value. */
eSetValueWithoutOverwrite /* 当任务读取完notification value后再设置notification value. */
} eNotifyAction;
/* Used with the uxTaskGetSystemState() function to return the state of each task
in the system. */
typedef struct xTASK_STATUS
{
TaskHandle_t xHandle; /* The handle of the task to which the rest of the information in the structure relates. */
const char *pcTaskName; /* A pointer to the task's name. This value will be invalid if the task was deleted since the structure was populated! */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
UBaseType_t xTaskNumber; /* A number unique to the task. */
eTaskState eCurrentState; /* The state in which the task existed when the structure was populated. */
UBaseType_t uxCurrentPriority; /* The priority at which the task was running (may be inherited) when the structure was populated. */
UBaseType_t uxBasePriority; /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */
uint32_t ulRunTimeCounter; /* The total run time allocated to the task so far, as defined by the run time stats clock. See http://www.freertos.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */
uint16_t usStackHighWaterMark; /* The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */
} TaskStatus_t;
/* Possible return values for eTaskConfirmSleepModeStatus(). */
typedef enum
{
eAbortSleep = 0, /* A task has been made ready or a context switch pended since portSUPPORESS_TICKS_AND_SLEEP() was called - abort entering a sleep mode. */
eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
eNoTasksWaitingTimeout /* No tasks are waiting for a timeout so it is safe to enter a sleep mode that can only be exited by an external interrupt. */
} eSleepMo