2021-09-20 02:07:03 -04:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2021-08-03 22:56:37 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-03-24 01:45:19 -04:00
|
|
|
#include "sdkconfig.h"
|
2021-08-03 22:56:37 -04:00
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
#include "freertos/task.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2022-03-24 01:45:19 -04:00
|
|
|
#if CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT || defined __DOXYGEN__
|
2021-08-03 22:56:37 -04:00
|
|
|
/**
|
2022-03-24 01:45:19 -04:00
|
|
|
* @brief Task Snapshot structure
|
|
|
|
*
|
|
|
|
* - Used with the uxTaskGetSnapshotAll() function to save memory snapshot of each task in the system.
|
|
|
|
* - We need this structure because TCB_t is defined (hidden) in tasks.c.
|
2021-08-03 22:56:37 -04:00
|
|
|
*/
|
|
|
|
typedef struct xTASK_SNAPSHOT
|
|
|
|
{
|
2022-03-24 01:45:19 -04:00
|
|
|
void *pxTCB; /*!< Address of the task control block. */
|
|
|
|
StackType_t *pxTopOfStack; /*!< Points to the location of the last item placed on the tasks stack. */
|
|
|
|
StackType_t *pxEndOfStack; /*!< Points to the end of the stack. pxTopOfStack < pxEndOfStack, stack grows hi2lo
|
|
|
|
pxTopOfStack > pxEndOfStack, stack grows lo2hi*/
|
2021-08-03 22:56:37 -04:00
|
|
|
} TaskSnapshot_t;
|
|
|
|
|
2022-03-24 01:45:19 -04:00
|
|
|
/**
|
|
|
|
* @brief Iterate over all tasks in the system
|
|
|
|
*
|
|
|
|
* - This function can be used to iterate over every task in the system
|
|
|
|
* - The first call to this function must set pxTask to NULL
|
|
|
|
* - When all functions have been iterated, this function will return NULL.
|
|
|
|
* - This function is only available when CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT is set to 1.
|
|
|
|
*
|
|
|
|
* @note This function should only be called when FreeRTOS is no longer running (e.g., during a panic) as this function
|
|
|
|
* does not acquire any locks.
|
|
|
|
* @param pxTask Handle of the previous task (or NULL on the first call of this function)
|
|
|
|
* @return TaskHandle_t Handle of the next task (or NULL when all tasks have been iterated over)
|
2021-08-03 22:56:37 -04:00
|
|
|
*/
|
|
|
|
TaskHandle_t pxTaskGetNext( TaskHandle_t pxTask );
|
|
|
|
|
2022-03-24 01:45:19 -04:00
|
|
|
/**
|
|
|
|
* @brief Fill a TaskSnapshot_t structure for specified task.
|
|
|
|
*
|
|
|
|
* - This function is used by the panic handler to get the snapshot of a particular task.
|
|
|
|
* - This function is only available when CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT is set to 1.
|
|
|
|
*
|
|
|
|
* @note This function should only be called when FreeRTOS is no longer running (e.g., during a panic) as this function
|
|
|
|
* does not acquire any locks.
|
|
|
|
* @param[in] pxTask Task's handle
|
|
|
|
* @param[out] pxTaskSnapshot Snapshot of the task
|
2021-08-03 22:56:37 -04:00
|
|
|
*/
|
|
|
|
void vTaskGetSnapshot( TaskHandle_t pxTask, TaskSnapshot_t *pxTaskSnapshot );
|
|
|
|
|
2022-03-24 01:45:19 -04:00
|
|
|
/**
|
|
|
|
* @brief Fill an array of TaskSnapshot_t structures for every task in the system
|
|
|
|
*
|
|
|
|
* - This function is used by the panic handler to get a snapshot of all tasks in the system
|
|
|
|
* - This function is only available when CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT is set to 1.
|
|
|
|
*
|
|
|
|
* @note This function should only be called when FreeRTOS is no longer running (e.g., during a panic) as this function
|
|
|
|
* does not acquire any locks.
|
|
|
|
* @param[out] pxTaskSnapshotArray Array of TaskSnapshot_t structures filled by this function
|
|
|
|
* @param[in] uxArrayLength Length of the provided array
|
|
|
|
* @param[out] pxTCBSize Size of the a task's TCB structure
|
|
|
|
* @return UBaseType_t
|
|
|
|
*/
|
|
|
|
UBaseType_t uxTaskGetSnapshotAll( TaskSnapshot_t * const pxTaskSnapshotArray, const UBaseType_t uxArrayLength, UBaseType_t * const pxTCBSize );
|
|
|
|
|
|
|
|
#endif // CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT || defined __DOXYGEN__
|
|
|
|
|
2021-08-03 22:56:37 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|