-/*\r
- * Task control block. A task control block (TCB) is allocated for each task,\r
- * and stores task state information, including a pointer to the task's context\r
- * (the task's run time environment, including register values)\r
- */\r
-typedef struct tskTaskControlBlock\r
-{\r
- 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. */\r
-\r
- #if ( portUSING_MPU_WRAPPERS == 1 )\r
- xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */\r
- #endif\r
-\r
- 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 ). */\r
- ListItem_t xEventListItem; /*< Used to reference a task from an event list. */\r
- UBaseType_t uxPriority; /*< The priority of the task. 0 is the lowest priority. */\r
- StackType_t *pxStack; /*< Points to the start of the stack. */\r
- 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. */\r
-\r
- #if ( portSTACK_GROWTH > 0 )\r
- StackType_t *pxEndOfStack; /*< Points to the end of the stack on architectures where the stack grows up from low memory. */\r
- #endif\r
-\r
- #if ( portCRITICAL_NESTING_IN_TCB == 1 )\r
- UBaseType_t uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */\r
- #endif\r
-\r
- #if ( configUSE_TRACE_FACILITY == 1 )\r
- 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. */\r
- UBaseType_t uxTaskNumber; /*< Stores a number specifically for use by third party trace code. */\r
- #endif\r
-\r
- #if ( configUSE_MUTEXES == 1 )\r
- UBaseType_t uxBasePriority; /*< The priority last assigned to the task - used by the priority inheritance mechanism. */\r
- UBaseType_t uxMutexesHeld;\r
- #endif\r
-\r
- #if ( configUSE_APPLICATION_TASK_TAG == 1 )\r
- TaskHookFunction_t pxTaskTag;\r
- #endif\r
-\r
- #if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )\r
- void *pvThreadLocalStoragePointers[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];\r
- #endif\r
-\r
- #if( configGENERATE_RUN_TIME_STATS == 1 )\r
- uint32_t ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */\r
- #endif\r
-\r
- #if ( configUSE_NEWLIB_REENTRANT == 1 )\r
- /* Allocate a Newlib reent structure that is specific to this task.\r
- Note Newlib support has been included by popular demand, but is not\r
- used by the FreeRTOS maintainers themselves. FreeRTOS is not\r
- responsible for resulting newlib operation. User must be familiar with\r
- newlib and must provide system-wide implementations of the necessary\r
- stubs. Be warned that (at the time of writing) the current newlib design\r
- implements a system-wide malloc() that must be provided with locks. */\r
- struct _reent xNewLib_reent;\r
- #endif\r
-\r
- #if( configUSE_TASK_NOTIFICATIONS == 1 )\r
- volatile uint32_t ulNotifiedValue;\r
- volatile uint8_t ucNotifyState;\r
- #endif\r
-\r
- #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
- uint8_t ucStaticAllocationFlags; /* Set to pdTRUE if the stack is a statically allocated array, and pdFALSE if the stack is dynamically allocated. */\r
- #endif\r
-\r
- #if( INCLUDE_xTaskAbortDelay == 1 )\r
- uint8_t ucDelayAborted;\r
- #endif\r
-\r
-} tskTCB;\r
-\r
-/* The old tskTCB name is maintained above then typedefed to the new TCB_t name\r
-below to enable the use of older kernel aware debuggers. */\r
-typedef tskTCB TCB_t;\r
-\r
-/*\r
- * Some kernel aware debuggers require the data the debugger needs access to be\r
- * global, rather than file scope.\r
- */\r
-#ifdef portREMOVE_STATIC_QUALIFIER\r
- #define static\r
-#endif\r
-\r
-/*lint -e956 A manual analysis and inspection has been used to determine which\r
-static variables must be declared volatile. */\r
-\r
-PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB = NULL;\r
-\r
-/* Lists for ready and blocked tasks. --------------------*/\r
-PRIVILEGED_DATA static List_t pxReadyTasksLists[ configMAX_PRIORITIES ];/*< Prioritised ready tasks. */\r
-PRIVILEGED_DATA static List_t xDelayedTaskList1; /*< Delayed tasks. */\r
-PRIVILEGED_DATA static List_t xDelayedTaskList2; /*< Delayed tasks (two lists are used - one for delays that have overflowed the current tick count. */\r
-PRIVILEGED_DATA static List_t * volatile pxDelayedTaskList; /*< Points to the delayed task list currently being used. */\r
-PRIVILEGED_DATA static List_t * volatile pxOverflowDelayedTaskList; /*< Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count. */\r
-PRIVILEGED_DATA static List_t xPendingReadyList; /*< Tasks that have been readied while the scheduler was suspended. They will be moved to the ready list when the scheduler is resumed. */\r
-\r
-#if ( INCLUDE_vTaskDelete == 1 )\r
-\r
- PRIVILEGED_DATA static List_t xTasksWaitingTermination; /*< Tasks that have been deleted - but their memory not yet freed. */\r
- PRIVILEGED_DATA static volatile UBaseType_t uxDeletedTasksWaitingCleanUp = ( UBaseType_t ) 0U;\r
-\r
-#endif\r
-\r
-#if ( INCLUDE_vTaskSuspend == 1 )\r
-\r
- PRIVILEGED_DATA static List_t xSuspendedTaskList; /*< Tasks that are currently suspended. */\r
-\r
-#endif\r
-\r
-/* Other file private variables. --------------------------------*/\r
-PRIVILEGED_DATA static volatile UBaseType_t uxCurrentNumberOfTasks = ( UBaseType_t ) 0U;\r
-PRIVILEGED_DATA static volatile TickType_t xTickCount = ( TickType_t ) 0U;\r
-PRIVILEGED_DATA static volatile UBaseType_t uxTopReadyPriority = tskIDLE_PRIORITY;\r
-PRIVILEGED_DATA static volatile BaseType_t xSchedulerRunning = pdFALSE;\r
-PRIVILEGED_DATA static volatile UBaseType_t uxPendedTicks = ( UBaseType_t ) 0U;\r
-PRIVILEGED_DATA static volatile BaseType_t xYieldPending = pdFALSE;\r
-PRIVILEGED_DATA static volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0;\r
-PRIVILEGED_DATA static UBaseType_t uxTaskNumber = ( UBaseType_t ) 0U;\r
-PRIVILEGED_DATA static volatile TickType_t xNextTaskUnblockTime = ( TickType_t ) 0U; /* Initialised to portMAX_DELAY before the scheduler starts. */\r
-PRIVILEGED_DATA static TaskHandle_t xIdleTaskHandle = NULL; /*< Holds the handle of the idle task. The idle task is created automatically when the scheduler is started. */\r
-\r
-/* Context switches are held pending while the scheduler is suspended. Also,\r
-interrupts must not manipulate the xStateListItem of a TCB, or any of the\r
-lists the xStateListItem can be referenced from, if the scheduler is suspended.\r
-If an interrupt needs to unblock a task while the scheduler is suspended then it\r
-moves the task's event list item into the xPendingReadyList, ready for the\r
-kernel to move the task from the pending ready list into the real ready list\r
-when the scheduler is unsuspended. The pending ready list itself can only be\r
-accessed from a critical section. */\r
-PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) pdFALSE;\r
-\r
-#if ( configGENERATE_RUN_TIME_STATS == 1 )\r
-\r
- PRIVILEGED_DATA static uint32_t ulTaskSwitchedInTime = 0UL; /*< Holds the value of a timer/counter the last time a task was switched in. */\r
- PRIVILEGED_DATA static uint32_t ulTotalRunTime = 0UL; /*< Holds the total amount of execution time as defined by the run time counter clock. */\r
-\r
-#endif\r
-\r
-/*lint +e956 */\r
-\r
-/* Debugging and trace facilities private variables and macros. ------------*/\r
-\r