ZestCode
 
Loading...
Searching...
No Matches
tcb.h
1#pragma once
2
3#include "rtos/FreeRTOS.h"
4#include "rtos/list.h"
5
6/*
7 * Task control block. A task control block (TCB) is allocated for each task,
8 * and stores task state information, including a pointer to the task's context
9 * (the task's run time environment, including register values)
10 */
11typedef struct tskTaskControlBlock
12{
13 volatile task_stack_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. */
14
15
16 list_item_t xStateListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
17 list_item_t xEventListItem; /*< Used to reference a task from an event list. */
18 uint32_t uxPriority; /*< The priority of the task. 0 is the lowest priority. */
19 task_stack_t *pxStack; /*< Points to the start of the stack. */
20 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. */
21
22 #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
23 task_stack_t *pxEndOfStack; /*< Points to the highest valid address for the stack. */
24 #endif
25
26 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
27 uint32_t uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */
28 #endif
29
30 #if ( configUSE_TRACE_FACILITY == 1 )
31 uint32_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. */
32 uint32_t uxTaskNumber; /*< Stores a number specifically for use by third party trace code. */
33 #endif
34
35 #if ( configUSE_MUTEXES == 1 )
36 uint32_t uxBasePriority; /*< The priority last assigned to the task - used by the priority inheritance mechanism. */
37 uint32_t uxMutexesHeld;
38 #endif
39
40 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
41 TaskHookFunction_t pxTaskTag;
42 #endif
43
44 #if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
45 void *pvThreadLocalStoragePointers[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
46 #endif
47
48 #if( configGENERATE_RUN_TIME_STATS == 1 )
49 uint32_t ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */
50 #endif
51
52 #if ( configUSE_NEWLIB_REENTRANT == 1 )
53 /* Allocate a Newlib reent structure that is specific to this task.
54 Note Newlib support has been included by popular demand, but is not
55 used by the FreeRTOS maintainers themselves. FreeRTOS is not
56 responsible for resulting newlib operation. User must be familiar with
57 newlib and must provide system-wide implementations of the necessary
58 stubs. Be warned that (at the time of writing) the current newlib design
59 implements a system-wide malloc() that must be provided with locks. */
60 struct _reent xNewLib_reent;
61 #endif
62
63 #if( configUSE_TASK_NOTIFICATIONS == 1 )
64 volatile uint32_t ulNotifiedValue;
65 volatile uint8_t ucNotifyState;
66 #endif
67
68 /* See the comments above the definition of
69 tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE. */
70 #if( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 ) /*lint !e731 Macro has been consolidated for readability reasons. */
71 uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the task is a statically allocated to ensure no attempt is made to free the memory. */
72 #endif
73
74 #if( INCLUDE_xTaskAbortDelay == 1 )
75 uint8_t ucDelayAborted;
76 #endif
77
78} tskTCB;
79
80/* The old tskTCB name is maintained above then typedefed to the new TCB_t name
81below to enable the use of older kernel aware debuggers. */
82typedef tskTCB TCB_t;
83
84/*lint -save -e956 A manual analysis and inspection has been used to determine
85which static variables must be declared volatile. */
86
87extern TCB_t * volatile pxCurrentTCB;
Definition tcb.h:12