【FreeRTOS源码阅读】<2> task.c (1) 任务创建以及TCB、List的结构

上篇讲述了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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值