Loading...
Searching...
No Matches
task_control_block.h
1#pragma once
2
3#include <FreeRTOS.h>
4#include <task.h>
5
6typedef struct {
7 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. */
8
9 #if ( portUSING_MPU_WRAPPERS == 1 )
10 xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
11 #endif
12
13 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 ). */
14 ListItem_t xEventListItem; /*< Used to reference a task from an event list. */
15 UBaseType_t uxPriority; /*< The priority of the task. 0 is the lowest priority. */
16 StackType_t * pxStack; /*< Points to the start of the stack. */
17 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. */
18
19 #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
20 StackType_t * pxEndOfStack; /*< Points to the highest valid address for the stack. */
21 #endif
22
23 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
24 UBaseType_t uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */
25 #endif
26
27 #if ( configUSE_TRACE_FACILITY == 1 )
28 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. */
29 UBaseType_t uxTaskNumber; /*< Stores a number specifically for use by third party trace code. */
30 #endif
31
32 #if ( configUSE_MUTEXES == 1 )
33 UBaseType_t uxBasePriority; /*< The priority last assigned to the task - used by the priority inheritance mechanism. */
34 UBaseType_t uxMutexesHeld;
35 #endif
36
37 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
38 TaskHookFunction_t pxTaskTag;
39 #endif
40
41 #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
42 void * pvThreadLocalStoragePointers[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
43 #endif
44
45 #if ( configGENERATE_RUN_TIME_STATS == 1 )
46 configRUN_TIME_COUNTER_TYPE ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */
47 #endif
48
49 #if ( configUSE_NEWLIB_REENTRANT == 1 )
50
51 /* Allocate a Newlib reent structure that is specific to this task.
52 * Note Newlib support has been included by popular demand, but is not
53 * used by the FreeRTOS maintainers themselves. FreeRTOS is not
54 * responsible for resulting newlib operation. User must be familiar with
55 * newlib and must provide system-wide implementations of the necessary
56 * stubs. Be warned that (at the time of writing) the current newlib design
57 * implements a system-wide malloc() that must be provided with locks.
58 *
59 * See the third party link http://www.nadler.com/embedded/newlibAndFreeRTOS.html
60 * for additional information. */
61 struct _reent xNewLib_reent;
62 #endif
63
64 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
65 volatile uint32_t ulNotifiedValue[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
66 volatile uint8_t ucNotifyState[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
67 #endif
68
69 /* See the comments in FreeRTOS.h with the definition of
70 * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE. */
71 #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 ) /*lint !e731 !e9029 Macro has been consolidated for readability reasons. */
72 uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the task is a statically allocated to ensure no attempt is made to free the memory. */
73 #endif
74
75 #if ( INCLUDE_xTaskAbortDelay == 1 )
76 uint8_t ucDelayAborted;
77 #endif
78
79 #if ( configUSE_POSIX_ERRNO == 1 )
80 int iTaskErrno;
81 #endif
Definition task_control_block.h:6