2021-09-20 02:07:03 -04:00
|
|
|
/*
|
2023-08-28 07:17:24 -04:00
|
|
|
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
2021-09-20 02:07:03 -04:00
|
|
|
*
|
|
|
|
* 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"
|
|
|
|
|
2023-09-21 05:17:49 -04:00
|
|
|
/*
|
|
|
|
* This header contains private API used by various ESP-IDF debugging features (e.g., esp_gdbstub).
|
|
|
|
*/
|
|
|
|
|
2023-08-28 06:23:50 -04:00
|
|
|
/* *INDENT-OFF* */
|
2021-08-03 22:56:37 -04:00
|
|
|
#ifdef __cplusplus
|
2023-08-28 06:23:50 -04:00
|
|
|
extern "C" {
|
2021-08-03 22:56:37 -04:00
|
|
|
#endif
|
2023-08-28 06:23:50 -04:00
|
|
|
/* *INDENT-ON* */
|
2021-08-03 22:56:37 -04:00
|
|
|
|
2023-09-21 06:07:13 -04:00
|
|
|
/* -------------------------------------------------- Task Snapshot ------------------------------------------------- */
|
|
|
|
|
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
|
|
|
|
{
|
2023-08-28 06:23:50 -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.
|
|
|
|
*
|
|
|
|
* @note This function should only be called when FreeRTOS is no longer running (e.g., during a panic) as this function
|
2023-03-13 11:09:18 -04:00
|
|
|
* does not acquire any locks.
|
2022-03-24 01:45:19 -04:00
|
|
|
* @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.
|
|
|
|
*
|
|
|
|
* @note This function should only be called when FreeRTOS is no longer running (e.g., during a panic) as this function
|
2023-03-13 11:09:18 -04:00
|
|
|
* does not acquire any locks.
|
2022-03-24 01:45:19 -04:00
|
|
|
* @param[in] pxTask Task's handle
|
|
|
|
* @param[out] pxTaskSnapshot Snapshot of the task
|
2022-05-09 06:17:13 -04:00
|
|
|
* @return pdTRUE if operation was successful else pdFALSE
|
2021-08-03 22:56:37 -04:00
|
|
|
*/
|
2023-08-28 06:23:50 -04:00
|
|
|
BaseType_t vTaskGetSnapshot( TaskHandle_t pxTask,
|
|
|
|
TaskSnapshot_t * pxTaskSnapshot );
|
2021-08-03 22:56:37 -04:00
|
|
|
|
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
|
|
|
|
*
|
|
|
|
* @note This function should only be called when FreeRTOS is no longer running (e.g., during a panic) as this function
|
2023-03-13 11:09:18 -04:00
|
|
|
* does not acquire any locks.
|
2022-03-24 01:45:19 -04:00
|
|
|
* @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
|
|
|
|
*/
|
2023-08-28 06:23:50 -04:00
|
|
|
UBaseType_t uxTaskGetSnapshotAll( TaskSnapshot_t * const pxTaskSnapshotArray,
|
|
|
|
const UBaseType_t uxArrayLength,
|
|
|
|
UBaseType_t * const pxTCBSize );
|
2022-03-24 01:45:19 -04:00
|
|
|
|
2023-09-21 06:07:13 -04:00
|
|
|
/* ----------------------------------------------------- Misc ----------------------------------------------------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get a void pointer to the current TCB of a particular core
|
|
|
|
*
|
|
|
|
* @note This function provides no guarantee that the return TCB will still be the current task (or that the task still
|
|
|
|
* exists) when it returns. It is the caller's responsibility to ensure that the task does not get scheduled or deleted.
|
|
|
|
* @param xCoreID The core to query
|
|
|
|
* @return Void pointer to current TCB
|
|
|
|
*/
|
|
|
|
void * pvTaskGetCurrentTCBForCore( BaseType_t xCoreID );
|
|
|
|
|
2023-08-28 06:23:50 -04:00
|
|
|
/* *INDENT-OFF* */
|
2021-08-03 22:56:37 -04:00
|
|
|
#ifdef __cplusplus
|
2023-08-28 06:23:50 -04:00
|
|
|
}
|
2021-08-03 22:56:37 -04:00
|
|
|
#endif
|
2023-08-28 06:23:50 -04:00
|
|
|
/* *INDENT-ON* */
|