101-FreeRTOS202212 - 任务控制块结构体定义

/* Task control block. A task control block (TCB) is allocated for each task, and stores task state information, including a pointer to the task's context (the task's run time environment, including register values) */
/*任务控制块。为每个任务分配一个任务控制块(TCB),并存储任务状态信息,包括指向任务上下文(任务的运行时环境,包括寄存器值)的指针*/
typedef struct tskTaskControlBlock /* The old naming convention is used to prevent breaking kernel aware debuggers. */
/*旧的命名约定用于防止破坏内核感知调试器*/
{
volatile StackType_t * pxTopOfStack; /*< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE TCB STRUCT. */
/*<指向任务堆栈上最后一个项目的位置。这必须是TCB结构的第一个成员*/
#if ( portUSING_MPU_WRAPPERS == 1 )
xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
/*<MPU设置被定义为端口层的一部分。这必须是TCB结构的第二个成员*/
#endif
ListItem_t xStateListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
/*<引用任务的状态列表项的列表表示该任务的状态(就绪、阻止、挂起)*/
ListItem_t xEventListItem; /*< Used to reference a task from an event list. */
/*<用于引用事件列表中的任务*/
UBaseType_t uxPriority; /*< The priority of the task. 0 is the lowest priority. */
/*<任务的优先级。0是最低优先级*/
StackType_t * pxStack; /*< Points to the start of the stack. */
/*<指向堆栈的开头*/
char pcTaskName[ configMAX_TASK_NAME_LEN ]; /*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
/*<创建时为任务指定的描述性名称。仅便于调试。*/ /*e971不合格的字符类型只允许用于字符串和单个字符*/
#if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
StackType_t * pxEndOfStack; /*< Points to the highest valid address for the stack. */
/*<指向堆栈的最高有效地址*/
#endif
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
UBaseType_t uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */
/*<为在端口层中不保持自身计数的端口保留临界区嵌套深度*/
#endif
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxTCBNumber; /*< Stores a number that increments each time a TCB is created. It allows debuggers to determine when a task has been deleted and then recreated. */
/*<存储每次创建TCB时递增的数字。它允许调试器确定何时删除任务,然后重新创建任务*/
UBaseType_t uxTaskNumber; /*< Stores a number specifically for use by third party trace code. */
/*<存储专门供第三方跟踪代码使用的数字*/
#endif
#if ( configUSE_MUTEXES == 1 )
UBaseType_t uxBasePriority; /*< The priority last assigned to the task ‐ used by the priority inheritance mechanism. */
/*<上次分配给任务的优先级‐由优先级继承机制使用*/
UBaseType_t uxMutexesHeld;
#endif
#if ( configUSE_APPLICATION_TASK_TAG == 1 )
TaskHookFunction_t pxTaskTag;
#endif
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
void * pvThreadLocalStoragePointers[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#endif
#if ( configGENERATE_RUN_TIME_STATS == 1 )
configRUN_TIME_COUNTER_TYPE ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */
/*<存储任务在“正在运行”状态下花费的时间*/
#endif
#if ( ( configUSE_NEWLIB_REENTRANT == 1 ) || ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) )
configTLS_BLOCK_TYPE xTLSBlock; /*< Memory block used as Thread Local Storage (TLS) Block for the task. */
/*<用作任务的线程本地存储(TLS)块的内存块*/
#endif
#if ( configUSE_TASK_NOTIFICATIONS == 1 )
volatile uint32_t ulNotifiedValue[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
volatile uint8_t ucNotifyState[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
#endif
/* See the comments in FreeRTOS.h with the definition of tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE. */
/*请参阅FreeRTOS.h中关于tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE定义的注释*/
#if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 ) /*lint !e731 !e9029 Macro has been consolidated for readability reasons. */
/*!e731!e9029宏由于可读性的原因而被合并*/
uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the task is a statically allocated to ensure no attempt is made to free the memory. */
/*<如果任务是静态分配的,则设置为pdTRUE,以确保不会尝试释放内存*/
#endif
#if ( INCLUDE_xTaskAbortDelay == 1 )
uint8_t ucDelayAborted;
#endif
#if ( configUSE_POSIX_ERRNO == 1 )
int iTaskErrno;
#endif
} tskTCB;
/* The old tskTCB name is maintained above then typedefed to the new TCB_t name below to enable the use of older kernel aware debuggers. */
/*旧的tskTCB名称保留在上面,然后将其类型转换为下面的新TCB_t名称,以启用旧的内核感知调试器*/
typedef tskTCB TCB_t;

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值