freertos: Uncrustify idf_additions.h

This commit is contained in:
Darian Leung
2023-04-06 23:09:18 +08:00
parent 3d2e674326
commit b042ed0495

View File

@@ -7,11 +7,13 @@
#pragma once #pragma once
/* /*
This file contains exposes the function prototypes of ESP-IDF specific API additions to the FreeRTOS kernel. These API * This file contains the function prototypes of ESP-IDF specific API additions
additions are not part of Vanilla (i.e., upstream) FreeRTOS and include things such as.... * to the FreeRTOS kernel. These API additions are not part of Vanilla (i.e.,
- Various helper functions * upstream) FreeRTOS and include things such as....
- API for ESP-IDF feature additions to FreeRTOS (such as TSLP deletion call backs) * - Various helper functions
*/ * - API for ESP-IDF feature additions to FreeRTOS (such as TSLP deletion
* call backs)
*/
#include "sdkconfig.h" #include "sdkconfig.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
@@ -21,39 +23,43 @@ additions are not part of Vanilla (i.e., upstream) FreeRTOS and include things s
extern "C" { extern "C" {
#endif #endif
/* --------------------------------------------------- SMP Related ----------------------------------------------------- /* -----------------------------------------------------------------------------
* - SMP related API additions to FreeRTOS * SMP related API additions to FreeRTOS
* *
* Todo: Move IDF FreeRTOS SMP related additions to this header as well (see IDF-7201) * Todo: Move IDF FreeRTOS SMP related additions to this header as well (see
* ------------------------------------------------------------------------------------------------------------------ */ * IDF-7201)
* -------------------------------------------------------------------------- */
#if CONFIG_FREERTOS_SMP || __DOXYGEN__ #if CONFIG_FREERTOS_SMP || __DOXYGEN__
/** /**
* @brief Create a new task that is pinned to a particular core * @brief Create a new task that is pinned to a particular core
* *
* Helper function to create a task that is pinned to a particular core, or has no affinity. In other wrods, the created * Helper function to create a task that is pinned to a particular core, or has
* task will have an affinity mask of: * no affinity. In other wrods, the created task will have an affinity mask of:
* - (1 << xCoreID) if it is pinned to a particular core * - (1 << xCoreID) if it is pinned to a particular core
* - Set to tskNO_AFFINITY if it has no affinity * - Set to tskNO_AFFINITY if it has no affinity
* *
* @param pxTaskCode Pointer to the task entry function. * @param pxTaskCode Pointer to the task entry function.
* @param pcName A descriptive name for the task. * @param pcName A descriptive name for the task.
* @param usStackDepth The size of the task stack. * @param usStackDepth The size of the task stack.
* @param pvParameters Pointer that will be used as the parameter for the task being created. * @param pvParameters Pointer that will be used as the parameter for the task
* being created.
* @param uxPriority The priority at which the task should run. * @param uxPriority The priority at which the task should run.
* @param pxCreatedTask Used to pass back a handle by which the created task can be referenced. * @param pxCreatedTask Used to pass back a handle by which the created task can
* @param xCoreID The core to which the task is pinned to, or tskNO_AFFINITY if the task has no core affinity * be referenced.
* @return pdPASS if the task was successfully created and added to a ready list, otherwise an error code defined in the * @param xCoreID The core to which the task is pinned to, or tskNO_AFFINITY if
* file projdefs.h * the task has no core affinity
* @return pdPASS if the task was successfully created and added to a ready
* list, otherwise an error code defined in the file projdefs.h
*/ */
BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pxTaskCode, BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pxTaskCode,
const char * const pcName, const char * const pcName,
const uint32_t usStackDepth, const uint32_t usStackDepth,
void * const pvParameters, void * const pvParameters,
UBaseType_t uxPriority, UBaseType_t uxPriority,
TaskHandle_t * const pxCreatedTask, TaskHandle_t * const pxCreatedTask,
const BaseType_t xCoreID); const BaseType_t xCoreID );
/** /**
@@ -64,106 +70,115 @@ BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pxTaskCode,
* @param pxTaskCode Pointer to the task entry function. * @param pxTaskCode Pointer to the task entry function.
* @param pcName A descriptive name for the task. * @param pcName A descriptive name for the task.
* @param ulStackDepth The size of the task stack. * @param ulStackDepth The size of the task stack.
* @param pvParameters Pointer that will be used as the parameter for the task being created. * @param pvParameters Pointer that will be used as the parameter for the task
* being created.
* @param uxPriority The priority at which the task should run. * @param uxPriority The priority at which the task should run.
* @param puxStackBuffer Must point to a StackType_t array that has at least ulStackDepth indexes * @param puxStackBuffer Must point to a StackType_t array that has at least
* @param pxTaskBuffer Must point to a variable of type StaticTask_t, which will then be used to hold the task's data structures, * ulStackDepth indexes
* @param xCoreID The core to which the task is pinned to, or tskNO_AFFINITY if the task has no core affinity * @param pxTaskBuffer Must point to a variable of type StaticTask_t, which will
* then be used to hold the task's data structures,
* @param xCoreID The core to which the task is pinned to, or tskNO_AFFINITY if
* the task has no core affinity
* @return The task handle if the task was created, NULL otherwise. * @return The task handle if the task was created, NULL otherwise.
*/ */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
TaskHandle_t xTaskCreateStaticPinnedToCore( TaskFunction_t pxTaskCode, TaskHandle_t xTaskCreateStaticPinnedToCore( TaskFunction_t pxTaskCode,
const char * const pcName, const char * const pcName,
const uint32_t ulStackDepth, const uint32_t ulStackDepth,
void * const pvParameters, void * const pvParameters,
UBaseType_t uxPriority, UBaseType_t uxPriority,
StackType_t * const puxStackBuffer, StackType_t * const puxStackBuffer,
StaticTask_t * const pxTaskBuffer, StaticTask_t * const pxTaskBuffer,
const BaseType_t xCoreID ); const BaseType_t xCoreID );
#endif /* configSUPPORT_STATIC_ALLOCATION */ #endif /* configSUPPORT_STATIC_ALLOCATION */
/** /**
* @brief Get the handle of the task running on a certain core * @brief Get the handle of the task running on a certain core
* *
* Because of the nature of SMP processing, there is no guarantee that this value will still be valid on return and * Because of the nature of SMP processing, there is no guarantee that this
* should only be used for debugging purposes. * value will still be valid on return and should only be used for debugging
* purposes.
* *
* [refactor-todo] Mark this function as deprecated, call xTaskGetCurrentTaskHandleCPU() instead * [refactor-todo] Mark this function as deprecated, call
* xTaskGetCurrentTaskHandleCPU() instead
* *
* @param xCoreID The core to query * @param xCoreID The core to query
* @return Handle of the current task running on the queried core * @return Handle of the current task running on the queried core
*/ */
TaskHandle_t xTaskGetCurrentTaskHandleForCPU( BaseType_t xCoreID ); TaskHandle_t xTaskGetCurrentTaskHandleForCPU( BaseType_t xCoreID );
/** /**
* @brief Get the handle of idle task for the given CPU. * @brief Get the handle of idle task for the given CPU.
* *
* [refactor-todo] Mark this function as deprecated, call xTaskGetIdleTaskHandle() instead * [refactor-todo] Mark this function as deprecated, call
* xTaskGetIdleTaskHandle() instead
* *
* @param xCoreID The core to query * @param xCoreID The core to query
* @return Handle of the idle task for the queried core * @return Handle of the idle task for the queried core
*/ */
TaskHandle_t xTaskGetIdleTaskHandleForCPU( BaseType_t xCoreID ); TaskHandle_t xTaskGetIdleTaskHandleForCPU( BaseType_t xCoreID );
/** /**
* @brief Get the current core affintiy of a particular task * @brief Get the current core affintiy of a particular task
* *
* Helper function to get the core affinity of a particular task. If the task is pinned to a particular core, the core * Helper function to get the core affinity of a particular task. If the task is
* ID is returned. If the task is not pinned to a particular core, tskNO_AFFINITY is returned. * pinned to a particular core, the core ID is returned. If the task is not
* pinned to a particular core, tskNO_AFFINITY is returned.
* *
* [refactor-todo] Mark this function as deprecated, call vTaskCoreAffinityGet() instead * [refactor-todo] Mark this function as deprecated, call vTaskCoreAffinityGet()
* instead
* *
* @param xTask The task to query * @param xTask The task to query
* @return The tasks coreID or tskNO_AFFINITY * @return The tasks coreID or tskNO_AFFINITY
*/ */
BaseType_t xTaskGetAffinity( TaskHandle_t xTask ); BaseType_t xTaskGetAffinity( TaskHandle_t xTask );
#endif // CONFIG_FREERTOS_SMP || __DOXYGEN__ #endif // CONFIG_FREERTOS_SMP || __DOXYGEN__
/* --------------------------------------------- TLSP Deletion Callbacks ----------------------------------------------- /* -----------------------------------------------------------------------------
* - API additions for the TLSP deletion callback feature * TLSP Deletion Callback related API additions
* *
* Todo: Move IDF FreeRTOS TLSP deletion callback additions to this header as well (see IDF-7201) * Todo: Move IDF FreeRTOS TLSP Deletion Callback related additions to this
* ------------------------------------------------------------------------------------------------------------------ */ * header as well (see IDF-7201)
* -------------------------------------------------------------------------- */
#if CONFIG_FREERTOS_SMP || __DOXYGEN__ #if CONFIG_FREERTOS_SMP || __DOXYGEN__
#if ( CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS ) #if ( CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS )
/** /**
* Prototype of local storage pointer deletion callback. * Prototype of local storage pointer deletion callback.
*/ */
typedef void (*TlsDeleteCallbackFunction_t)( int, void * ); typedef void (* TlsDeleteCallbackFunction_t)( int,
void * );
/** /**
* Set local storage pointer and deletion callback. * Set local storage pointer and deletion callback.
* *
* Each task contains an array of pointers that is dimensioned by the * Each task contains an array of pointers that is dimensioned by the
* configNUM_THREAD_LOCAL_STORAGE_POINTERS setting in FreeRTOSConfig.h. * configNUM_THREAD_LOCAL_STORAGE_POINTERS setting in FreeRTOSConfig.h. The
* The kernel does not use the pointers itself, so the application writer * kernel does not use the pointers itself, so the application writer can use
* can use the pointers for any purpose they wish. * the pointers for any purpose they wish.
* *
* Local storage pointers set for a task can reference dynamically * Local storage pointers set for a task can reference dynamically allocated
* allocated resources. This function is similar to * resources. This function is similar to vTaskSetThreadLocalStoragePointer, but
* vTaskSetThreadLocalStoragePointer, but provides a way to release * provides a way to release these resources when the task gets deleted. For
* these resources when the task gets deleted. For each pointer, * each pointer, a callback function can be set. This function will be called
* a callback function can be set. This function will be called * when task is deleted, with the local storage pointer index and value as
* when task is deleted, with the local storage pointer index * arguments.
* and value as arguments. *
* * @param xTaskToSet Task to set thread local storage pointer for
* @param xTaskToSet Task to set thread local storage pointer for * @param xIndex The index of the pointer to set, from 0 to
* @param xIndex The index of the pointer to set, from 0 to * configNUM_THREAD_LOCAL_STORAGE_POINTERS - 1.
* configNUM_THREAD_LOCAL_STORAGE_POINTERS - 1. * @param pvValue Pointer value to set.
* @param pvValue Pointer value to set. * @param pvDelCallback Function to call to dispose of the local storage
* @param pvDelCallback Function to call to dispose of the local * pointer when the task is deleted.
* storage pointer when the task is deleted. */
*/ void vTaskSetThreadLocalStoragePointerAndDelCallback( TaskHandle_t xTaskToSet,
void vTaskSetThreadLocalStoragePointerAndDelCallback( BaseType_t xIndex,
TaskHandle_t xTaskToSet, void * pvValue,
BaseType_t xIndex, TlsDeleteCallbackFunction_t pvDelCallback );
void *pvValue, #endif // CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS
TlsDeleteCallbackFunction_t pvDelCallback);
#endif // CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS
#endif // CONFIG_FREERTOS_SMP || __DOXYGEN__ #endif // CONFIG_FREERTOS_SMP || __DOXYGEN__