Merge branch 'refactor/freertos_format_addition_headers' into 'master'

refactor(freertos): Uncrustify IDF additions header/sources

See merge request espressif/esp-idf!25612
This commit is contained in:
Darian
2023-08-31 09:50:24 +08:00
8 changed files with 836 additions and 585 deletions

View File

@@ -103,7 +103,7 @@ list(APPEND srcs
if(kernel_impl STREQUAL "FreeRTOS-Kernel") if(kernel_impl STREQUAL "FreeRTOS-Kernel")
list(APPEND srcs list(APPEND srcs
"esp_additions/freertos_v8_compat.c") "esp_additions/freertos_compatibility.c")
endif() endif()
if(arch STREQUAL "linux") if(arch STREQUAL "linux")

View File

@@ -0,0 +1,37 @@
/*
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* FreeRTOS has changed some functions in to macros (and vice-versa) over multiple
* releases. This is not a breaking API change for source code, but may cause issues
* for pre-compiled libraries that call these removed APIs.
*
* This file maintains these legacy APIs until the next ESP-IDF major release.
*
* Todo: Clean up for ESP-IDF v6.0 (IDF-8144)
*/
#include "FreeRTOS.h"
#include "queue.h"
#include "semphr.h"
BaseType_t xQueueGenericReceive( QueueHandle_t xQueue,
void * const pvBuffer,
TickType_t xTicksToWait,
const BaseType_t xPeek )
{
if( xPeek == pdTRUE )
{
return xQueuePeek( xQueue, pvBuffer, xTicksToWait );
}
if( pvBuffer == NULL )
{
return xQueueSemaphoreTake( xQueue, xTicksToWait );
}
return xQueueReceive( xQueue, pvBuffer, xTicksToWait );
}

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -8,6 +8,9 @@
#include "sdkconfig.h" #include "sdkconfig.h"
#include "freertos/idf_additions.h" #include "freertos/idf_additions.h"
#if CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT
#include "freertos/task_snapshot.h"
#endif /* CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT */
#include "esp_private/freertos_idf_additions_priv.h" #include "esp_private/freertos_idf_additions_priv.h"
/** /**
@@ -18,396 +21,166 @@
* additional API. * additional API.
*/ */
/* ------------------------------------------------- Static asserts ---------------------------------------------------- /* ------------------------------------------------- Static Asserts ------------------------------------------------- */
*
* ------------------------------------------------------------------------------------------------------------------ */
/** /**
* Both StaticTask_t and TCB_t structures are provided by FreeRTOS sources. * Both StaticTask_t and TCB_t structures are provided by FreeRTOS sources.
* This is just an additional check of the consistency of these structures. * This is just an additional check of the consistency of these structures.
*/ */
_Static_assert( offsetof( StaticTask_t, pxDummy6 ) == offsetof( TCB_t, pxStack ) );
_Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfStack ) );
#if CONFIG_FREERTOS_SMP
_Static_assert( tskNO_AFFINITY == CONFIG_FREERTOS_NO_AFFINITY, "CONFIG_FREERTOS_NO_AFFINITY must be the same as tskNO_AFFINITY" );
#endif /* CONFIG_FREERTOS_SMP */
_Static_assert(offsetof( StaticTask_t, pxDummy6 ) == offsetof( TCB_t, pxStack )); /* -------------------------------------------------- Task Creation ------------------------------------------------- */
_Static_assert(offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfStack ));
/* ----------------------------------------------------- Newlib --------------------------------------------------------
*
* ------------------------------------------------------------------------------------------------------------------ */
#if ( configUSE_NEWLIB_REENTRANT == 1 )
/**
* @brief Get reentrancy structure of the current task
*
* - This funciton is required by newlib (when __DYNAMIC_REENT__ is enabled)
* - It will return a pointer to the current task's reent struct
* - If FreeRTOS is not running, it will return the global reent struct
*
* @return Pointer to a the (current taks's)/(globa) reent struct
*/
struct _reent *__getreent(void)
{
// No lock needed because if this changes, we won't be running anymore.
TCB_t *pxCurTask = xTaskGetCurrentTaskHandle();
struct _reent *ret;
if (pxCurTask == NULL) {
// No task running. Return global struct.
ret = _GLOBAL_REENT;
} else {
// We have a task; return its reentrant struct.
ret = &pxCurTask->xNewLib_reent;
}
return ret;
}
#endif // configUSE_NEWLIB_REENTRANT == 1
/* -------------------------------------------------- Task Snapshot ----------------------------------------------------
*
* ------------------------------------------------------------------------------------------------------------------ */
#include "freertos/task_snapshot.h"
/**
* @brief List of all task lists in FreeRTOS
*
* @note There are currently differing number of task list between SMP FreeRTOS and ESP-IDF FreeRTOS
*/
static List_t *non_ready_task_lists[] = {
#ifdef CONFIG_FREERTOS_SMP
&xPendingReadyList,
#else
&xPendingReadyList[0],
#ifndef CONFIG_FREERTOS_UNICORE
&xPendingReadyList[1],
#endif // CONFIG_FREERTOS_UNICORE
#endif //CONFIG_FREERTOS_SMP
&xDelayedTaskList1,
&xDelayedTaskList2,
#if( INCLUDE_vTaskDelete == 1 )
&xTasksWaitingTermination,
#endif
#if( INCLUDE_vTaskSuspend == 1 )
&xSuspendedTaskList,
#endif
};
/**
* @brief Get the next task list to traverse
*
* - Given a particular task list, this function returns the next task to traverse.
* - The task lists are returned in the following precedence
* - Ready lists (highest to lowers priority)
* - Pending ready list(s)
* - Delayed list 1
* - Delayed list 2
* - Waiting termination list
* - Suspended list
*
* @param pxCurTaskList Previously traversed task list (or NULL if obtaining the first task list)
* @return List_t* The next task list to traverse (or NULL of all task lists have been traversed)
*/
static List_t *pxGetNextTaskList(List_t *pxCurTaskList)
{
List_t *pxNextTaskList = NULL;
// No Current List. Start from the highest priority ready task list
if (pxCurTaskList == NULL)
{
pxNextTaskList = &pxReadyTasksLists[configMAX_PRIORITIES - 1];
}
// Current list is one of the ready task lists. Find the current priority, and return the next lower priority ready task list
else if (pxCurTaskList >= &pxReadyTasksLists[0] && pxCurTaskList <= &pxReadyTasksLists[configMAX_PRIORITIES - 1] )
{
// Find the current priority
int cur_priority;
for (cur_priority = configMAX_PRIORITIES - 1; cur_priority >= 0; cur_priority--) {
if (pxCurTaskList == &pxReadyTasksLists[cur_priority]) {
break;
}
}
// Return the ready task list at (cur_priority - 1), or the pending ready task list
if (cur_priority > 0)
{
pxNextTaskList = &pxReadyTasksLists[cur_priority - 1];
}
// We've reached the end of the Ready Task Lists. We get the next list from the non-ready task lists
else if (cur_priority == 0)
{
pxNextTaskList = non_ready_task_lists[0];
}
else
{
abort(); // This should never occur
}
}
// Current list is one of the non-ready task lists. Fetch the next non-ready task list
if (pxNextTaskList == NULL) {
int cur_list_idx;
const int num_non_ready_task_lists = (sizeof(non_ready_task_lists) / sizeof(List_t *));
// Note: - 1 so that if the current list is the last on non_ready_task_lists[], the next list will return NULL
for (cur_list_idx = 0; cur_list_idx < num_non_ready_task_lists - 1; cur_list_idx++) {
if (pxCurTaskList == non_ready_task_lists[cur_list_idx]) {
pxNextTaskList = non_ready_task_lists[cur_list_idx + 1];
break;
}
}
}
return pxNextTaskList;
}
TaskHandle_t pxTaskGetNext( TaskHandle_t pxTask )
{
TCB_t *pxTCB = (TCB_t *)pxTask;
// Check current task is valid
if (pxTCB != NULL && !portVALID_TCB_MEM(pxTCB)) {
return NULL;
}
List_t *pxCurTaskList;
const ListItem_t *pxCurListItem;
if (pxTCB == NULL) {
// Starting traversal for the first time
pxCurTaskList = pxGetNextTaskList(NULL);
pxCurListItem = listGET_END_MARKER(pxCurTaskList);
} else {
// Continuing traversal
pxCurTaskList = listLIST_ITEM_CONTAINER(&pxTCB->xStateListItem);
pxCurListItem = &pxTCB->xStateListItem;
}
ListItem_t *pxNextListItem = NULL;
if (pxCurListItem->pxNext == listGET_END_MARKER(pxCurTaskList)) {
List_t *pxNextTaskList = pxGetNextTaskList(pxCurTaskList);
while (pxNextTaskList != NULL) {
if (!listLIST_IS_EMPTY(pxNextTaskList)) {
// Get the first item in the next task list
pxNextListItem = listGET_HEAD_ENTRY(pxNextTaskList);
break;
}
// Task list is empty. Get the next task list
pxNextTaskList = pxGetNextTaskList(pxNextTaskList);
}
} else {
//There are still more items in the current task list. Get the next item
pxNextListItem = listGET_NEXT(pxCurListItem);
}
TCB_t *pxNextTCB;
if (pxNextListItem == NULL) {
pxNextTCB = NULL;
} else {
pxNextTCB = (TCB_t *)listGET_LIST_ITEM_OWNER(pxNextListItem);
}
return pxNextTCB;
}
BaseType_t vTaskGetSnapshot( TaskHandle_t pxTask, TaskSnapshot_t *pxTaskSnapshot )
{
if (portVALID_TCB_MEM(pxTask) == false || pxTaskSnapshot == NULL) {
return pdFALSE;
}
TCB_t *pxTCB = (TCB_t *)pxTask;
pxTaskSnapshot->pxTCB = pxTCB;
pxTaskSnapshot->pxTopOfStack = (StackType_t *)pxTCB->pxTopOfStack;
pxTaskSnapshot->pxEndOfStack = (StackType_t *)pxTCB->pxEndOfStack;
return pdTRUE;
}
UBaseType_t uxTaskGetSnapshotAll( TaskSnapshot_t * const pxTaskSnapshotArray, const UBaseType_t uxArrayLength, UBaseType_t * const pxTCBSize )
{
UBaseType_t uxArrayNumFilled = 0;
//Traverse all of the tasks lists
List_t *pxCurTaskList = pxGetNextTaskList(NULL); //Get the first task list
while (pxCurTaskList != NULL && uxArrayNumFilled < uxArrayLength) {
if (!listLIST_IS_EMPTY(pxCurTaskList)) {
const ListItem_t *pxCurListItem;
//Walk each task on the current task list
pxCurListItem = listGET_HEAD_ENTRY(pxCurTaskList);
while (pxCurListItem != listGET_END_MARKER(pxCurTaskList)) {
TCB_t *pxTCB = (TCB_t *)listGET_LIST_ITEM_OWNER(pxCurListItem);
vTaskGetSnapshot((TaskHandle_t)pxTCB, &pxTaskSnapshotArray[uxArrayNumFilled]);
uxArrayNumFilled++;
if (!(uxArrayNumFilled < uxArrayLength)) {
break;
}
pxCurListItem = listGET_NEXT(pxCurListItem);
}
}
//Get the next task list
pxCurTaskList = pxGetNextTaskList(pxCurTaskList);
}
*pxTCBSize = sizeof(TCB_t);
return uxArrayNumFilled;
}
/* ----------------------------------------------------- OpenOCD -------------------------------------------------------
*
* ------------------------------------------------------------------------------------------------------------------ */
#if CONFIG_FREERTOS_DEBUG_OCDAWARE
/**
* Debug param indexes. DO NOT change the order. OpenOCD uses the same indexes
* Entries in FreeRTOS_openocd_params must match the order of these indexes
*/
enum {
ESP_FREERTOS_DEBUG_TABLE_SIZE = 0,
ESP_FREERTOS_DEBUG_TABLE_VERSION,
ESP_FREERTOS_DEBUG_KERNEL_VER_MAJOR,
ESP_FREERTOS_DEBUG_KERNEL_VER_MINOR,
ESP_FREERTOS_DEBUG_KERNEL_VER_BUILD,
ESP_FREERTOS_DEBUG_UX_TOP_USED_PIORITY,
ESP_FREERTOS_DEBUG_PX_TOP_OF_STACK,
ESP_FREERTOS_DEBUG_PC_TASK_NAME,
/* New entries must be inserted here */
ESP_FREERTOS_DEBUG_TABLE_END,
};
const DRAM_ATTR uint8_t FreeRTOS_openocd_params[ESP_FREERTOS_DEBUG_TABLE_END] = {
ESP_FREERTOS_DEBUG_TABLE_END, /* table size */
1, /* table version */
tskKERNEL_VERSION_MAJOR,
tskKERNEL_VERSION_MINOR,
tskKERNEL_VERSION_BUILD,
configMAX_PRIORITIES - 1, /* uxTopUsedPriority */
offsetof(TCB_t, pxTopOfStack), /* thread_stack_offset; */
offsetof(TCB_t, pcTaskName), /* thread_name_offset; */
};
#endif // CONFIG_FREERTOS_DEBUG_OCDAWARE
/* -------------------------------------------- FreeRTOS IDF API Additions ---------------------------------------------
* FreeRTOS related API that were added by IDF
* ------------------------------------------------------------------------------------------------------------------ */
#if CONFIG_FREERTOS_SMP #if CONFIG_FREERTOS_SMP
_Static_assert(tskNO_AFFINITY == CONFIG_FREERTOS_NO_AFFINITY, "CONFIG_FREERTOS_NO_AFFINITY must be the same as tskNO_AFFINITY");
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 )
{ {
BaseType_t ret; BaseType_t ret;
#if ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) #if ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) )
{ {
// Convert xCoreID into an affinity mask /* Convert xCoreID into an affinity mask */
UBaseType_t uxCoreAffinityMask; UBaseType_t uxCoreAffinityMask;
if (xCoreID == tskNO_AFFINITY) {
if( xCoreID == tskNO_AFFINITY )
{
uxCoreAffinityMask = tskNO_AFFINITY; uxCoreAffinityMask = tskNO_AFFINITY;
} else {
uxCoreAffinityMask = (1 << xCoreID);
} }
ret = xTaskCreateAffinitySet(pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, uxCoreAffinityMask, pxCreatedTask); else
{
uxCoreAffinityMask = ( 1 << xCoreID );
}
ret = xTaskCreateAffinitySet( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, uxCoreAffinityMask, pxCreatedTask );
} }
#else /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */ #else /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */
{ {
ret = xTaskCreate(pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask); ret = xTaskCreate( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask );
} }
#endif /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */ #endif /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */
return ret; return ret;
} }
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) #endif /* CONFIG_FREERTOS_SMP */
TaskHandle_t xTaskCreateStaticPinnedToCore( TaskFunction_t pxTaskCode, /*----------------------------------------------------------*/
#if ( CONFIG_FREERTOS_SMP && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
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 )
{ {
TaskHandle_t ret; TaskHandle_t ret;
#if ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) #if ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) )
{ {
// Convert xCoreID into an affinity mask /* Convert xCoreID into an affinity mask */
UBaseType_t uxCoreAffinityMask; UBaseType_t uxCoreAffinityMask;
if (xCoreID == tskNO_AFFINITY) {
if( xCoreID == tskNO_AFFINITY )
{
uxCoreAffinityMask = tskNO_AFFINITY; uxCoreAffinityMask = tskNO_AFFINITY;
} else {
uxCoreAffinityMask = (1 << xCoreID);
} }
ret = xTaskCreateStaticAffinitySet(pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, uxCoreAffinityMask); else
{
uxCoreAffinityMask = ( 1 << xCoreID );
}
ret = xTaskCreateStaticAffinitySet( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, uxCoreAffinityMask );
} }
#else /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */ #else /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */
{ {
ret = xTaskCreateStatic(pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer); ret = xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer );
} }
#endif /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */ #endif /* ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUM_CORES > 1 ) ) */
return ret; return ret;
} }
#endif /* configSUPPORT_STATIC_ALLOCATION */
TaskHandle_t xTaskGetCurrentTaskHandleForCPU( BaseType_t xCoreID ) #endif /* CONFIG_FREERTOS_SMP && ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
{ /*----------------------------------------------------------*/
/* ------------------------------------------------- Task Utilities ------------------------------------------------- */
#if CONFIG_FREERTOS_SMP
TaskHandle_t xTaskGetCurrentTaskHandleForCPU( BaseType_t xCoreID )
{
TaskHandle_t xTaskHandleTemp; TaskHandle_t xTaskHandleTemp;
assert(xCoreID >= 0 && xCoreID < configNUM_CORES);
assert( xCoreID >= 0 && xCoreID < configNUM_CORES );
taskENTER_CRITICAL(); taskENTER_CRITICAL();
xTaskHandleTemp = (TaskHandle_t) pxCurrentTCBs[xCoreID]; xTaskHandleTemp = ( TaskHandle_t ) pxCurrentTCBs[ xCoreID ];
taskEXIT_CRITICAL(); taskEXIT_CRITICAL();
return xTaskHandleTemp; return xTaskHandleTemp;
} }
TaskHandle_t xTaskGetIdleTaskHandleForCPU( BaseType_t xCoreID ) #endif /* CONFIG_FREERTOS_SMP */
{ /*----------------------------------------------------------*/
assert(xCoreID >= 0 && xCoreID < configNUM_CORES);
return (TaskHandle_t) xIdleTaskHandle[xCoreID];
}
BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) #if CONFIG_FREERTOS_SMP
{
TaskHandle_t xTaskGetIdleTaskHandleForCPU( BaseType_t xCoreID )
{
assert( xCoreID >= 0 && xCoreID < configNUM_CORES );
return ( TaskHandle_t ) xIdleTaskHandle[ xCoreID ];
}
#endif /* CONFIG_FREERTOS_SMP */
/*----------------------------------------------------------*/
#if CONFIG_FREERTOS_SMP
BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
{
taskENTER_CRITICAL(); taskENTER_CRITICAL();
UBaseType_t uxCoreAffinityMask; UBaseType_t uxCoreAffinityMask;
#if ( configUSE_CORE_AFFINITY == 1 && configNUM_CORES > 1 ) #if ( configUSE_CORE_AFFINITY == 1 && configNUM_CORES > 1 )
TCB_t *pxTCB = prvGetTCBFromHandle( xTask ); TCB_t * pxTCB = prvGetTCBFromHandle( xTask );
uxCoreAffinityMask = pxTCB->uxCoreAffinityMask; uxCoreAffinityMask = pxTCB->uxCoreAffinityMask;
#else #else
uxCoreAffinityMask = tskNO_AFFINITY; uxCoreAffinityMask = tskNO_AFFINITY;
#endif #endif
taskEXIT_CRITICAL(); taskEXIT_CRITICAL();
BaseType_t ret; BaseType_t ret;
// If the task is not pinned to a particular core, treat it as tskNO_AFFINITY
if (uxCoreAffinityMask & (uxCoreAffinityMask - 1)) { // If more than one bit set /* If the task is not pinned to a particular core, treat it as tskNO_AFFINITY */
if( uxCoreAffinityMask & ( uxCoreAffinityMask - 1 ) ) /* If more than one bit set */
{
ret = tskNO_AFFINITY; ret = tskNO_AFFINITY;
} else { }
int index_plus_one = __builtin_ffs(uxCoreAffinityMask); else
assert(index_plus_one >= 1); {
int index_plus_one = __builtin_ffs( uxCoreAffinityMask );
assert( index_plus_one >= 1 );
ret = index_plus_one - 1; ret = index_plus_one - 1;
} }
return ret; return ret;
}
#if ( CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS )
void vTaskSetThreadLocalStoragePointerAndDelCallback( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue, TlsDeleteCallbackFunction_t pvDelCallback)
{
// Verify that the offsets of pvThreadLocalStoragePointers and pvDummy15 match.
// pvDummy15 is part of the StaticTask_t struct and is used to access the TLSPs
// while deletion.
_Static_assert(offsetof( StaticTask_t, pvDummy15 ) == offsetof( TCB_t, pvThreadLocalStoragePointers ), "Offset of pvDummy15 must match the offset of pvThreadLocalStoragePointers");
//Set the local storage pointer first
vTaskSetThreadLocalStoragePointer( xTaskToSet, xIndex, pvValue );
//Set the deletion callback at an offset of configNUM_THREAD_LOCAL_STORAGE_POINTERS/2
vTaskSetThreadLocalStoragePointer( xTaskToSet, ( xIndex + ( configNUM_THREAD_LOCAL_STORAGE_POINTERS / 2 ) ), pvDelCallback );
} }
#endif // CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS
#endif // CONFIG_FREERTOS_SMP #endif /* CONFIG_FREERTOS_SMP */
/*----------------------------------------------------------*/
#if ( INCLUDE_vTaskPrioritySet == 1 ) #if ( INCLUDE_vTaskPrioritySet == 1 )
void prvTaskPriorityRaise( prvTaskSavedPriority_t * pxSavedPriority, UBaseType_t uxNewPriority ) void prvTaskPriorityRaise( prvTaskSavedPriority_t * pxSavedPriority,
{ UBaseType_t uxNewPriority )
{
TCB_t * pxTCB; TCB_t * pxTCB;
UBaseType_t uxPriorityUsedOnEntry; UBaseType_t uxPriorityUsedOnEntry;
@@ -419,11 +192,11 @@ void prvTaskPriorityRaise( prvTaskSavedPriority_t * pxSavedPriority, UBaseType_t
uxNewPriority = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) 1U; uxNewPriority = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) 1U;
} }
#if CONFIG_FREERTOS_SMP #if CONFIG_FREERTOS_SMP
taskENTER_CRITICAL(); taskENTER_CRITICAL();
#else #else
taskENTER_CRITICAL( &xKernelLock ); taskENTER_CRITICAL( &xKernelLock );
#endif #endif
{ {
pxTCB = prvGetTCBFromHandle( NULL ); pxTCB = prvGetTCBFromHandle( NULL );
@@ -471,6 +244,7 @@ void prvTaskPriorityRaise( prvTaskSavedPriority_t * pxSavedPriority, UBaseType_t
* reset macro can be called directly. */ * reset macro can be called directly. */
portRESET_READY_PRIORITY( uxPriorityUsedOnEntry, uxTopReadyPriority ); portRESET_READY_PRIORITY( uxPriorityUsedOnEntry, uxTopReadyPriority );
} }
prvAddTaskToReadyList( pxTCB ); prvAddTaskToReadyList( pxTCB );
} }
} }
@@ -479,33 +253,39 @@ void prvTaskPriorityRaise( prvTaskSavedPriority_t * pxSavedPriority, UBaseType_t
#else /* if ( configUSE_MUTEXES == 1 ) */ #else /* if ( configUSE_MUTEXES == 1 ) */
{ {
pxSavedPriority->uxPriority = pxTCB->uxPriority; pxSavedPriority->uxPriority = pxTCB->uxPriority;
if ( uxNewPriority > pxTCB->uxPriority)
if( uxNewPriority > pxTCB->uxPriority )
{ {
vTaskPrioritySet( NULL, uxNewPriority ); vTaskPrioritySet( NULL, uxNewPriority );
} }
} }
#endif /* if ( configUSE_MUTEXES == 1 ) */
}
#if CONFIG_FREERTOS_SMP
taskEXIT_CRITICAL();
#else
taskEXIT_CRITICAL( &xKernelLock );
#endif #endif
} }
#if CONFIG_FREERTOS_SMP
taskEXIT_CRITICAL();
#else
taskEXIT_CRITICAL( &xKernelLock );
#endif
}
void prvTaskPriorityRestore( prvTaskSavedPriority_t * pxSavedPriority ) #endif /* INCLUDE_vTaskPrioritySet == 1 */
{ /*----------------------------------------------------------*/
#if ( INCLUDE_vTaskPrioritySet == 1 )
void prvTaskPriorityRestore( prvTaskSavedPriority_t * pxSavedPriority )
{
TCB_t * pxTCB; TCB_t * pxTCB;
UBaseType_t uxNewPriority; UBaseType_t uxNewPriority;
UBaseType_t uxPriorityUsedOnEntry; UBaseType_t uxPriorityUsedOnEntry;
UBaseType_t uxBasePriorityUsedOnEntry; UBaseType_t uxBasePriorityUsedOnEntry;
BaseType_t xYieldRequired = pdFALSE; BaseType_t xYieldRequired = pdFALSE;
#if CONFIG_FREERTOS_SMP #if CONFIG_FREERTOS_SMP
taskENTER_CRITICAL(); taskENTER_CRITICAL();
#else #else
taskENTER_CRITICAL( &xKernelLock ); taskENTER_CRITICAL( &xKernelLock );
#endif #endif
{ {
pxTCB = prvGetTCBFromHandle( NULL ); pxTCB = prvGetTCBFromHandle( NULL );
@@ -547,6 +327,7 @@ void prvTaskPriorityRestore( prvTaskSavedPriority_t * pxSavedPriority )
* inherited priority. */ * inherited priority. */
pxTCB->uxPriority = pxSavedPriority->uxPriority; pxTCB->uxPriority = pxSavedPriority->uxPriority;
} }
uxNewPriority = pxTCB->uxPriority; uxNewPriority = pxTCB->uxPriority;
if( uxNewPriority < uxPriorityUsedOnEntry ) if( uxNewPriority < uxPriorityUsedOnEntry )
@@ -580,6 +361,7 @@ void prvTaskPriorityRestore( prvTaskSavedPriority_t * pxSavedPriority )
* reset macro can be called directly. */ * reset macro can be called directly. */
portRESET_READY_PRIORITY( uxPriorityUsedOnEntry, uxTopReadyPriority ); portRESET_READY_PRIORITY( uxPriorityUsedOnEntry, uxTopReadyPriority );
} }
prvAddTaskToReadyList( pxTCB ); prvAddTaskToReadyList( pxTCB );
} }
@@ -594,13 +376,334 @@ void prvTaskPriorityRestore( prvTaskSavedPriority_t * pxSavedPriority )
{ {
vTaskPrioritySet( NULL, pxSavedPriority->uxPriority ); vTaskPrioritySet( NULL, pxSavedPriority->uxPriority );
} }
#endif /* if ( configUSE_MUTEXES == 1 ) */
}
#if CONFIG_FREERTOS_SMP
taskEXIT_CRITICAL();
#else
taskEXIT_CRITICAL( &xKernelLock );
#endif #endif
} }
#if CONFIG_FREERTOS_SMP
taskEXIT_CRITICAL();
#else
taskEXIT_CRITICAL( &xKernelLock );
#endif
}
#endif // ( INCLUDE_vTaskPrioritySet == 1 ) #endif /* ( INCLUDE_vTaskPrioritySet == 1 ) */
/*----------------------------------------------------------*/
/* --------------------------------------------- TLSP Deletion Callbacks -------------------------------------------- */
#if ( CONFIG_FREERTOS_SMP && CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS )
void vTaskSetThreadLocalStoragePointerAndDelCallback( TaskHandle_t xTaskToSet,
BaseType_t xIndex,
void * pvValue,
TlsDeleteCallbackFunction_t pvDelCallback )
{
/* Verify that the offsets of pvThreadLocalStoragePointers and pvDummy15 match. */
/* pvDummy15 is part of the StaticTask_t struct and is used to access the TLSPs */
/* while deletion. */
_Static_assert( offsetof( StaticTask_t, pvDummy15 ) == offsetof( TCB_t, pvThreadLocalStoragePointers ), "Offset of pvDummy15 must match the offset of pvThreadLocalStoragePointers" );
/*Set the local storage pointer first */
vTaskSetThreadLocalStoragePointer( xTaskToSet, xIndex, pvValue );
/*Set the deletion callback at an offset of configNUM_THREAD_LOCAL_STORAGE_POINTERS/2 */
vTaskSetThreadLocalStoragePointer( xTaskToSet, ( xIndex + ( configNUM_THREAD_LOCAL_STORAGE_POINTERS / 2 ) ), pvDelCallback );
}
#endif /* CONFIG_FREERTOS_SMP && CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS */
/*----------------------------------------------------------*/
/* ----------------------------------------------------- Newlib ----------------------------------------------------- */
#if ( configUSE_NEWLIB_REENTRANT == 1 )
/**
* @brief Get reentrancy structure of the current task
*
* - This funciton is required by newlib (when __DYNAMIC_REENT__ is enabled)
* - It will return a pointer to the current task's reent struct
* - If FreeRTOS is not running, it will return the global reent struct
*
* @return Pointer to a the (current taks's)/(globa) reent struct
*/
struct _reent * __getreent( void )
{
/* No lock needed because if this changes, we won't be running anymore. */
TCB_t * pxCurTask = xTaskGetCurrentTaskHandle();
struct _reent * ret;
if( pxCurTask == NULL )
{
/* No task running. Return global struct. */
ret = _GLOBAL_REENT;
}
else
{
/* We have a task; return its reentrant struct. */
ret = &pxCurTask->xNewLib_reent;
}
return ret;
}
#endif /* configUSE_NEWLIB_REENTRANT == 1 */
/* -------------------------------------------------- Task Snapshot ------------------------------------------------- */
/**
* @brief List of all task lists in FreeRTOS
*
* @note There are currently differing number of task list between SMP FreeRTOS and ESP-IDF FreeRTOS
*/
static List_t * non_ready_task_lists[] = {
#ifdef CONFIG_FREERTOS_SMP
&xPendingReadyList,
#else /* CONFIG_FREERTOS_SMP */
&xPendingReadyList[ 0 ],
#ifndef CONFIG_FREERTOS_UNICORE
&xPendingReadyList[ 1 ],
#endif /* CONFIG_FREERTOS_UNICORE */
#endif /* CONFIG_FREERTOS_SMP */
&xDelayedTaskList1,
&xDelayedTaskList2,
#if ( INCLUDE_vTaskDelete == 1 )
&xTasksWaitingTermination,
#endif
#if ( INCLUDE_vTaskSuspend == 1 )
&xSuspendedTaskList,
#endif
};
/*----------------------------------------------------------*/
/**
* @brief Get the next task list to traverse
*
* - Given a particular task list, this function returns the next task to traverse.
* - The task lists are returned in the following precedence
* - Ready lists (highest to lowers priority)
* - Pending ready list(s)
* - Delayed list 1
* - Delayed list 2
* - Waiting termination list
* - Suspended list
*
* @param pxCurTaskList Previously traversed task list (or NULL if obtaining the first task list)
* @return List_t* The next task list to traverse (or NULL of all task lists have been traversed)
*/
static List_t * pxGetNextTaskList( List_t * pxCurTaskList )
{
List_t * pxNextTaskList = NULL;
/* No Current List. Start from the highest priority ready task list */
if( pxCurTaskList == NULL )
{
pxNextTaskList = &pxReadyTasksLists[ configMAX_PRIORITIES - 1 ];
}
/* Current list is one of the ready task lists. Find the current priority, and return the next lower priority ready task list */
else if( ( pxCurTaskList >= &pxReadyTasksLists[ 0 ] ) && ( pxCurTaskList <= &pxReadyTasksLists[ configMAX_PRIORITIES - 1 ] ) )
{
/* Find the current priority */
int cur_priority;
for( cur_priority = configMAX_PRIORITIES - 1; cur_priority >= 0; cur_priority-- )
{
if( pxCurTaskList == &pxReadyTasksLists[ cur_priority ] )
{
break;
}
}
/* Return the ready task list at (cur_priority - 1), or the pending ready task list */
if( cur_priority > 0 )
{
pxNextTaskList = &pxReadyTasksLists[ cur_priority - 1 ];
}
/* We've reached the end of the Ready Task Lists. We get the next list from the non-ready task lists */
else if( cur_priority == 0 )
{
pxNextTaskList = non_ready_task_lists[ 0 ];
}
else
{
abort(); /* This should never occur */
}
}
/* Current list is one of the non-ready task lists. Fetch the next non-ready task list */
if( pxNextTaskList == NULL )
{
int cur_list_idx;
const int num_non_ready_task_lists = ( sizeof( non_ready_task_lists ) / sizeof( List_t * ) );
/* Note: - 1 so that if the current list is the last on non_ready_task_lists[], the next list will return NULL */
for( cur_list_idx = 0; cur_list_idx < num_non_ready_task_lists - 1; cur_list_idx++ )
{
if( pxCurTaskList == non_ready_task_lists[ cur_list_idx ] )
{
pxNextTaskList = non_ready_task_lists[ cur_list_idx + 1 ];
break;
}
}
}
return pxNextTaskList;
}
/*----------------------------------------------------------*/
TaskHandle_t pxTaskGetNext( TaskHandle_t pxTask )
{
TCB_t * pxTCB = ( TCB_t * ) pxTask;
/* Check current task is valid */
if( ( pxTCB != NULL ) && !portVALID_TCB_MEM( pxTCB ) )
{
return NULL;
}
List_t * pxCurTaskList;
const ListItem_t * pxCurListItem;
if( pxTCB == NULL )
{
/* Starting traversal for the first time */
pxCurTaskList = pxGetNextTaskList( NULL );
pxCurListItem = listGET_END_MARKER( pxCurTaskList );
}
else
{
/* Continuing traversal */
pxCurTaskList = listLIST_ITEM_CONTAINER( &pxTCB->xStateListItem );
pxCurListItem = &pxTCB->xStateListItem;
}
ListItem_t * pxNextListItem = NULL;
if( pxCurListItem->pxNext == listGET_END_MARKER( pxCurTaskList ) )
{
List_t * pxNextTaskList = pxGetNextTaskList( pxCurTaskList );
while( pxNextTaskList != NULL )
{
if( !listLIST_IS_EMPTY( pxNextTaskList ) )
{
/* Get the first item in the next task list */
pxNextListItem = listGET_HEAD_ENTRY( pxNextTaskList );
break;
}
/* Task list is empty. Get the next task list */
pxNextTaskList = pxGetNextTaskList( pxNextTaskList );
}
}
else
{
/*There are still more items in the current task list. Get the next item */
pxNextListItem = listGET_NEXT( pxCurListItem );
}
TCB_t * pxNextTCB;
if( pxNextListItem == NULL )
{
pxNextTCB = NULL;
}
else
{
pxNextTCB = ( TCB_t * ) listGET_LIST_ITEM_OWNER( pxNextListItem );
}
return pxNextTCB;
}
/*----------------------------------------------------------*/
BaseType_t vTaskGetSnapshot( TaskHandle_t pxTask,
TaskSnapshot_t * pxTaskSnapshot )
{
if( ( portVALID_TCB_MEM( pxTask ) == false ) || ( pxTaskSnapshot == NULL ) )
{
return pdFALSE;
}
TCB_t * pxTCB = ( TCB_t * ) pxTask;
pxTaskSnapshot->pxTCB = pxTCB;
pxTaskSnapshot->pxTopOfStack = ( StackType_t * ) pxTCB->pxTopOfStack;
pxTaskSnapshot->pxEndOfStack = ( StackType_t * ) pxTCB->pxEndOfStack;
return pdTRUE;
}
/*----------------------------------------------------------*/
UBaseType_t uxTaskGetSnapshotAll( TaskSnapshot_t * const pxTaskSnapshotArray,
const UBaseType_t uxArrayLength,
UBaseType_t * const pxTCBSize )
{
UBaseType_t uxArrayNumFilled = 0;
/*Traverse all of the tasks lists */
List_t * pxCurTaskList = pxGetNextTaskList( NULL ); /*Get the first task list */
while( pxCurTaskList != NULL && uxArrayNumFilled < uxArrayLength )
{
if( !listLIST_IS_EMPTY( pxCurTaskList ) )
{
const ListItem_t * pxCurListItem;
/*Walk each task on the current task list */
pxCurListItem = listGET_HEAD_ENTRY( pxCurTaskList );
while( pxCurListItem != listGET_END_MARKER( pxCurTaskList ) )
{
TCB_t * pxTCB = ( TCB_t * ) listGET_LIST_ITEM_OWNER( pxCurListItem );
vTaskGetSnapshot( ( TaskHandle_t ) pxTCB, &pxTaskSnapshotArray[ uxArrayNumFilled ] );
uxArrayNumFilled++;
if( !( uxArrayNumFilled < uxArrayLength ) )
{
break;
}
pxCurListItem = listGET_NEXT( pxCurListItem );
}
}
/*Get the next task list */
pxCurTaskList = pxGetNextTaskList( pxCurTaskList );
}
*pxTCBSize = sizeof( TCB_t );
return uxArrayNumFilled;
}
/*----------------------------------------------------------*/
/* ----------------------------------------------------- OpenOCD ---------------------------------------------------- */
#if CONFIG_FREERTOS_DEBUG_OCDAWARE
/**
* Debug param indexes. DO NOT change the order. OpenOCD uses the same indexes
* Entries in FreeRTOS_openocd_params must match the order of these indexes
*/
enum
{
ESP_FREERTOS_DEBUG_TABLE_SIZE = 0,
ESP_FREERTOS_DEBUG_TABLE_VERSION,
ESP_FREERTOS_DEBUG_KERNEL_VER_MAJOR,
ESP_FREERTOS_DEBUG_KERNEL_VER_MINOR,
ESP_FREERTOS_DEBUG_KERNEL_VER_BUILD,
ESP_FREERTOS_DEBUG_UX_TOP_USED_PIORITY,
ESP_FREERTOS_DEBUG_PX_TOP_OF_STACK,
ESP_FREERTOS_DEBUG_PC_TASK_NAME,
/* New entries must be inserted here */
ESP_FREERTOS_DEBUG_TABLE_END,
};
const DRAM_ATTR uint8_t FreeRTOS_openocd_params[ ESP_FREERTOS_DEBUG_TABLE_END ] = {
ESP_FREERTOS_DEBUG_TABLE_END, /* table size */
1, /* table version */
tskKERNEL_VERSION_MAJOR,
tskKERNEL_VERSION_MINOR,
tskKERNEL_VERSION_BUILD,
configMAX_PRIORITIES - 1, /* uxTopUsedPriority */
offsetof( TCB_t, pxTopOfStack ), /* thread_stack_offset; */
offsetof( TCB_t, pcTaskName ), /* thread_name_offset; */
};
#endif /* CONFIG_FREERTOS_DEBUG_OCDAWARE */
/*----------------------------------------------------------*/

View File

@@ -1,25 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "FreeRTOS.h"
#include "queue.h"
#include "semphr.h"
/* This API is kept for backward ABI compatibility with prebuilt libraries against FreeRTOS v8/v9 in ESP-IDF */
BaseType_t xQueueGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, const BaseType_t xPeek )
{
if ( xPeek == pdTRUE )
{
return xQueuePeek( xQueue, pvBuffer, xTicksToWait );
}
if ( pvBuffer == NULL )
{
return xQueueSemaphoreTake( xQueue, xTicksToWait );
}
return xQueueReceive( xQueue, pvBuffer, xTicksToWait );
}

View File

@@ -4,6 +4,11 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
/*
* This file contains the implementation for some the functions in
* idf_additions.h
*/
#include "sdkconfig.h" #include "sdkconfig.h"
#include <stdint.h> #include <stdint.h>
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
@@ -17,19 +22,12 @@
#include "freertos/idf_additions.h" #include "freertos/idf_additions.h"
#include "esp_heap_caps.h" #include "esp_heap_caps.h"
/* /* -------------------------------------------- Creation With Memory Caps ------------------------------------------- */
* This file contains the implementation for some the functions in
* idf_additions.h
*/
/* -----------------------------------------------------------------------------
* Creation With Memory Caps
* -------------------------------------------------------------------------- */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/* ---------------------------------- Tasks --------------------------------- */ /* ---------------------------------- Tasks --------------------------------- */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
BaseType_t xTaskCreatePinnedToCoreWithCaps( TaskFunction_t pvTaskCode, BaseType_t xTaskCreatePinnedToCoreWithCaps( TaskFunction_t pvTaskCode,
const char * const pcName, const char * const pcName,
const configSTACK_DEPTH_TYPE usStackDepth, const configSTACK_DEPTH_TYPE usStackDepth,
@@ -78,6 +76,11 @@ err:
return pdFAIL; return pdFAIL;
} }
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*----------------------------------------------------------*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
void vTaskDeleteWithCaps( TaskHandle_t xTaskToDelete ) void vTaskDeleteWithCaps( TaskHandle_t xTaskToDelete )
{ {
BaseType_t xResult; BaseType_t xResult;
@@ -95,8 +98,13 @@ err:
vPortFree( pxTaskBuffer ); vPortFree( pxTaskBuffer );
} }
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*----------------------------------------------------------*/
/* ---------------------------------- Queue --------------------------------- */ /* ---------------------------------- Queue --------------------------------- */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
QueueHandle_t xQueueCreateWithCaps( UBaseType_t uxQueueLength, QueueHandle_t xQueueCreateWithCaps( UBaseType_t uxQueueLength,
UBaseType_t uxItemSize, UBaseType_t uxItemSize,
UBaseType_t uxMemoryCaps ) UBaseType_t uxMemoryCaps )
@@ -138,6 +146,11 @@ err:
return NULL; return NULL;
} }
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*----------------------------------------------------------*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
void vQueueDeleteWithCaps( QueueHandle_t xQueue ) void vQueueDeleteWithCaps( QueueHandle_t xQueue )
{ {
BaseType_t xResult; BaseType_t xResult;
@@ -156,8 +169,13 @@ err:
heap_caps_free( pucQueueStorageBuffer ); heap_caps_free( pucQueueStorageBuffer );
} }
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*----------------------------------------------------------*/
/* -------------------------------- Semaphore ------------------------------- */ /* -------------------------------- Semaphore ------------------------------- */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
SemaphoreHandle_t xSemaphoreCreateGenericWithCaps( UBaseType_t uxMaxCount, SemaphoreHandle_t xSemaphoreCreateGenericWithCaps( UBaseType_t uxMaxCount,
UBaseType_t uxInitialCount, UBaseType_t uxInitialCount,
const uint8_t ucQueueType, const uint8_t ucQueueType,
@@ -200,6 +218,11 @@ err:
return xSemaphore; return xSemaphore;
} }
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*----------------------------------------------------------*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
void vSemaphoreDeleteWithCaps( SemaphoreHandle_t xSemaphore ) void vSemaphoreDeleteWithCaps( SemaphoreHandle_t xSemaphore )
{ {
BaseType_t xResult; BaseType_t xResult;
@@ -217,8 +240,13 @@ err:
heap_caps_free( pxSemaphoreBuffer ); heap_caps_free( pxSemaphoreBuffer );
} }
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*----------------------------------------------------------*/
/* ------------------------- Stream & Message Buffers ----------------------- */ /* ------------------------- Stream & Message Buffers ----------------------- */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
StreamBufferHandle_t xStreamBufferGenericCreateWithCaps( size_t xBufferSizeBytes, StreamBufferHandle_t xStreamBufferGenericCreateWithCaps( size_t xBufferSizeBytes,
size_t xTriggerLevelBytes, size_t xTriggerLevelBytes,
BaseType_t xIsMessageBuffer, BaseType_t xIsMessageBuffer,
@@ -261,6 +289,11 @@ err:
return NULL; return NULL;
} }
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*----------------------------------------------------------*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
void vStreamBufferGenericDeleteWithCaps( StreamBufferHandle_t xStreamBuffer, void vStreamBufferGenericDeleteWithCaps( StreamBufferHandle_t xStreamBuffer,
BaseType_t xIsMessageBuffer ) BaseType_t xIsMessageBuffer )
{ {
@@ -296,8 +329,13 @@ err:
heap_caps_free( pucStreamBufferStorageArea ); heap_caps_free( pucStreamBufferStorageArea );
} }
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*----------------------------------------------------------*/
/* ------------------------------ Event Groups ------------------------------ */ /* ------------------------------ Event Groups ------------------------------ */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
EventGroupHandle_t xEventGroupCreateWithCaps( UBaseType_t uxMemoryCaps ) EventGroupHandle_t xEventGroupCreateWithCaps( UBaseType_t uxMemoryCaps )
{ {
EventGroupHandle_t xEventGroup; EventGroupHandle_t xEventGroup;
@@ -322,6 +360,11 @@ err:
return xEventGroup; return xEventGroup;
} }
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*----------------------------------------------------------*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
void vEventGroupDeleteWithCaps( EventGroupHandle_t xEventGroup ) void vEventGroupDeleteWithCaps( EventGroupHandle_t xEventGroup )
{ {
BaseType_t xResult; BaseType_t xResult;
@@ -340,3 +383,4 @@ err:
} }
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */ #endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*----------------------------------------------------------*/

View File

@@ -8,25 +8,29 @@
/* /*
* This file is like "idf_additions.h" but for private API (i.e., only meant to * This file is like "idf_additions.h" but for private API (i.e., only meant to
* be called by other internally by other * be called internally by other ESP-IDF components.
* ESP-IDF components.
*/ */
#include "sdkconfig.h" #include "sdkconfig.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* *INDENT-ON* */
/* ----------------------------------------------------------------------------- /*------------------------------------------------------------------------------
* Priority Raise/Restore * TASK UTILITIES (PRIVATE)
* - Special functions to forcefully raise and restore a task's priority *----------------------------------------------------------------------------*/
* - Used by cache_utils.c when disabling/enabling the cache
* -------------------------------------------------------------------------- */
#if ( INCLUDE_vTaskPrioritySet == 1 ) #if ( INCLUDE_vTaskPrioritySet == 1 )
/**
* @brief Structure to save a task's previous priority
*
* This structure is meant to be used with prvTaskPriorityRaise() and
* prvTaskPriorityRestore().
*/
typedef struct typedef struct
{ {
UBaseType_t uxPriority; UBaseType_t uxPriority;
@@ -35,13 +39,17 @@
#endif #endif
} prvTaskSavedPriority_t; } prvTaskSavedPriority_t;
#endif /* INCLUDE_vTaskPrioritySet == 1 */
#if ( INCLUDE_vTaskPrioritySet == 1 )
/** /**
* INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be * INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be
* available. See the configuration section for more information. * available. See the configuration section for more information.
* *
* Saves the current priority and current base priority of a task, then * Saves the current priority and current base priority of a task, then raises
* raises the task's current and base priority to uxNewPriority if * the task's current and base priority to uxNewPriority if uxNewPriority is of
* uxNewPriority is of a higher priority. * a higher priority.
* *
* Once a task's priority has been raised with this function, the priority * Once a task's priority has been raised with this function, the priority
* can be restored by calling prvTaskPriorityRestore() * can be restored by calling prvTaskPriorityRestore()
@@ -53,8 +61,8 @@
* forced immediately to a higher priority. * forced immediately to a higher priority.
* *
* For configUSE_MUTEXES == 0: A context switch will occur before the * For configUSE_MUTEXES == 0: A context switch will occur before the
* function returns if the priority being set is higher than the currently * function returns if the priority being set is higher than the priority of the
* executing task. * currently executing task.
* *
* @note This functions is private and should only be called internally * @note This functions is private and should only be called internally
* within various IDF components. Users should never call this function from * within various IDF components. Users should never call this function from
@@ -71,17 +79,20 @@
void prvTaskPriorityRaise( prvTaskSavedPriority_t * pxSavedPriority, void prvTaskPriorityRaise( prvTaskSavedPriority_t * pxSavedPriority,
UBaseType_t uxNewPriority ); UBaseType_t uxNewPriority );
#endif /* INCLUDE_vTaskPrioritySet == 1 */
#if ( INCLUDE_vTaskPrioritySet == 1 )
/** /**
* INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be * INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be
* available. * available. See the configuration section for more information.
* See the configuration section for more information.
* *
* Restore a task's priority that was previously raised by * Restore a task's priority that was previously raised by
* prvTaskPriorityRaise(). * prvTaskPriorityRaise().
* *
* For configUSE_MUTEXES == 0: A context switch will occur before the function * For configUSE_MUTEXES == 0: A context switch will occur before the function
* returns if the priority * returns if the priority being set is higher than the priority of the currently
* being set is higher than the currently executing task. * executing task.
* *
* @note This functions is private and should only be called internally within * @note This functions is private and should only be called internally within
* various IDF components. Users should never call this function from their * various IDF components. Users should never call this function from their
@@ -92,8 +103,10 @@
*/ */
void prvTaskPriorityRestore( prvTaskSavedPriority_t * pxSavedPriority ); void prvTaskPriorityRestore( prvTaskSavedPriority_t * pxSavedPriority );
#endif // ( INCLUDE_vTaskPrioritySet == 1) #endif /* INCLUDE_vTaskPrioritySet == 1 */
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */

View File

@@ -25,20 +25,20 @@
#include "freertos/event_groups.h" #include "freertos/event_groups.h"
#include "esp_heap_caps.h" #include "esp_heap_caps.h"
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* *INDENT-ON* */
/* ----------------------------------------------------------------------------- /* -------------------------------------------------- Task Creation ---------------------------------------------------
* SMP related API additions to FreeRTOS * Task Creation APIs added by ESP-IDF
* *
* Todo: Move IDF FreeRTOS SMP related additions to this header as well (see * Todo: Move IDF FreeRTOS SMP related additions to this header as well (see IDF-7201)
* IDF-7201) * Todo: Add these SMP related additions to docs once they are combined with IDF FreeRTOS.
* Todo: Add these SMP related additions to docs once they are combined with * ------------------------------------------------------------------------------------------------------------------ */
* IDF FreeRTOS.
* -------------------------------------------------------------------------- */
#if CONFIG_FREERTOS_SMP #if ( CONFIG_FREERTOS_SMP && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
/** /**
* @brief Create a new task that is pinned to a particular core * @brief Create a new task that is pinned to a particular core
@@ -69,6 +69,9 @@
TaskHandle_t * const pxCreatedTask, TaskHandle_t * const pxCreatedTask,
const BaseType_t xCoreID ); const BaseType_t xCoreID );
#endif /* ( CONFIG_FREERTOS_SMP && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) */
#if ( CONFIG_FREERTOS_SMP && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
/** /**
* @brief Create a new static task that is pinned to a particular core * @brief Create a new static task that is pinned to a particular core
@@ -89,7 +92,6 @@
* the task has no core affinity * 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 )
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,
@@ -98,7 +100,14 @@
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 /* ( CONFIG_FREERTOS_SMP && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) */
/* ------------------------------------------------- Task Utilities ----------------------------------------------------
* Todo: Move IDF FreeRTOS SMP related additions to this header as well (see IDF-7201)
* ------------------------------------------------------------------------------------------------------------------ */
#if CONFIG_FREERTOS_SMP
/** /**
* @brief Get the handle of the task running on a certain core * @brief Get the handle of the task running on a certain core
@@ -115,6 +124,10 @@
*/ */
TaskHandle_t xTaskGetCurrentTaskHandleForCPU( BaseType_t xCoreID ); TaskHandle_t xTaskGetCurrentTaskHandleForCPU( BaseType_t xCoreID );
#endif /* CONFIG_FREERTOS_SMP */
#if CONFIG_FREERTOS_SMP
/** /**
* @brief Get the handle of idle task for the given CPU. * @brief Get the handle of idle task for the given CPU.
* *
@@ -126,6 +139,10 @@
*/ */
TaskHandle_t xTaskGetIdleTaskHandleForCPU( BaseType_t xCoreID ); TaskHandle_t xTaskGetIdleTaskHandleForCPU( BaseType_t xCoreID );
#endif /* CONFIG_FREERTOS_SMP */
#if CONFIG_FREERTOS_SMP
/** /**
* @brief Get the current core affinity of a particular task * @brief Get the current core affinity of a particular task
* *
@@ -141,20 +158,16 @@
*/ */
BaseType_t xTaskGetAffinity( TaskHandle_t xTask ); BaseType_t xTaskGetAffinity( TaskHandle_t xTask );
#endif // CONFIG_FREERTOS_SMP #endif /* CONFIG_FREERTOS_SMP */
/* ----------------------------------------------------------------------------- /* --------------------------------------------- TLSP Deletion Callbacks -----------------------------------------------
* TLSP Deletion Callback related API additions * TLSP Deletion Callback API Additions
* *
* Todo: Move IDF FreeRTOS TLSP Deletion Callback related additions to this * Todo: Move IDF FreeRTOS TLSP Deletion Callback related additions to this header as well (see IDF-7201)
* header as well (see IDF-7201) * Todo: Add these SMP related additions to docs once they are combined with IDF FreeRTOS.
* Todo: Add these SMP related additions to docs once they are combined with * ------------------------------------------------------------------------------------------------------------------ */
* IDF FreeRTOS.
* -------------------------------------------------------------------------- */
#if CONFIG_FREERTOS_SMP #if ( CONFIG_FREERTOS_SMP && 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.
@@ -162,6 +175,11 @@
typedef void (* TlsDeleteCallbackFunction_t)( int, typedef void (* TlsDeleteCallbackFunction_t)( int,
void * ); void * );
#endif /* ( CONFIG_FREERTOS_SMP && CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS ) */
#if ( CONFIG_FREERTOS_SMP && CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS )
/** /**
* Set local storage pointer and deletion callback. * Set local storage pointer and deletion callback.
* *
@@ -188,21 +206,18 @@
BaseType_t xIndex, BaseType_t xIndex,
void * pvValue, void * pvValue,
TlsDeleteCallbackFunction_t pvDelCallback ); TlsDeleteCallbackFunction_t pvDelCallback );
#endif // CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS
#endif // CONFIG_FREERTOS_SMP #endif /* ( CONFIG_FREERTOS_SMP && CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS ) */
/* ----------------------------------------------------------------------------- /* -------------------------------------------- Creation With Memory Caps ----------------------------------------------
* Creation With Memory Caps * Helper functions to create various FreeRTOS objects (e.g., queues, semaphores) with specific memory capabilities
* * (e.g., MALLOC_CAP_INTERNAL).
* Helper functions to create various FreeRTOS objects (e.g., queues, * ------------------------------------------------------------------------------------------------------------------ */
* semaphores) with specific memory capabilities (e.g., MALLOC_CAP_INTERNAL).
* -------------------------------------------------------------------------- */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/* ---------------------------------- Tasks --------------------------------- */ /* ---------------------------------- Tasks --------------------------------- */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Creates a pinned task where its stack has specific memory capabilities * @brief Creates a pinned task where its stack has specific memory capabilities
* *
@@ -238,6 +253,10 @@
const BaseType_t xCoreID, const BaseType_t xCoreID,
UBaseType_t uxMemoryCaps ); UBaseType_t uxMemoryCaps );
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Creates a task where its stack has specific memory capabilities * @brief Creates a task where its stack has specific memory capabilities
* *
@@ -275,6 +294,10 @@
return xTaskCreatePinnedToCoreWithCaps( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask, tskNO_AFFINITY, uxMemoryCaps ); return xTaskCreatePinnedToCoreWithCaps( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask, tskNO_AFFINITY, uxMemoryCaps );
} }
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Deletes a task previously created using xTaskCreateWithCaps() or * @brief Deletes a task previously created using xTaskCreateWithCaps() or
* xTaskCreatePinnedToCoreWithCaps() * xTaskCreatePinnedToCoreWithCaps()
@@ -283,8 +306,12 @@
*/ */
void vTaskDeleteWithCaps( TaskHandle_t xTaskToDelete ); void vTaskDeleteWithCaps( TaskHandle_t xTaskToDelete );
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
/* ---------------------------------- Queue --------------------------------- */ /* ---------------------------------- Queue --------------------------------- */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Creates a queue with specific memory capabilities * @brief Creates a queue with specific memory capabilities
* *
@@ -304,6 +331,10 @@
UBaseType_t uxItemSize, UBaseType_t uxItemSize,
UBaseType_t uxMemoryCaps ); UBaseType_t uxMemoryCaps );
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Deletes a queue previously created using xQueueCreateWithCaps() * @brief Deletes a queue previously created using xQueueCreateWithCaps()
* *
@@ -311,15 +342,19 @@
*/ */
void vQueueDeleteWithCaps( QueueHandle_t xQueue ); void vQueueDeleteWithCaps( QueueHandle_t xQueue );
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
/* -------------------------------- Semaphore ------------------------------- */ /* -------------------------------- Semaphore ------------------------------- */
/** @cond */ /* Doxygen command to hide this from docs */ /** @cond */ /* Doxygen command to hide this from docs */
SemaphoreHandle_t xSemaphoreCreateGenericWithCaps( UBaseType_t uxMaxCount, SemaphoreHandle_t xSemaphoreCreateGenericWithCaps( UBaseType_t uxMaxCount,
UBaseType_t uxInitialCount, UBaseType_t uxInitialCount,
const uint8_t ucQueueType, const uint8_t ucQueueType,
UBaseType_t uxMemoryCaps ); UBaseType_t uxMemoryCaps );
/** @endcond */ /** @endcond */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Creates a binary semaphore with specific memory capabilities * @brief Creates a binary semaphore with specific memory capabilities
* *
@@ -338,6 +373,10 @@
return xSemaphoreCreateGenericWithCaps( 0, 0, queueQUEUE_TYPE_BINARY_SEMAPHORE, uxMemoryCaps ); return xSemaphoreCreateGenericWithCaps( 0, 0, queueQUEUE_TYPE_BINARY_SEMAPHORE, uxMemoryCaps );
} }
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Creates a counting semaphore with specific memory capabilities * @brief Creates a counting semaphore with specific memory capabilities
* *
@@ -361,6 +400,10 @@
return xSemaphoreCreateGenericWithCaps( uxMaxCount, uxInitialCount, queueQUEUE_TYPE_COUNTING_SEMAPHORE, uxMemoryCaps ); return xSemaphoreCreateGenericWithCaps( uxMaxCount, uxInitialCount, queueQUEUE_TYPE_COUNTING_SEMAPHORE, uxMemoryCaps );
} }
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Creates a mutex semaphore with specific memory capabilities * @brief Creates a mutex semaphore with specific memory capabilities
* *
@@ -379,6 +422,10 @@
return xSemaphoreCreateGenericWithCaps( 0, 0, queueQUEUE_TYPE_MUTEX, uxMemoryCaps ); return xSemaphoreCreateGenericWithCaps( 0, 0, queueQUEUE_TYPE_MUTEX, uxMemoryCaps );
} }
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Creates a recursive mutex with specific memory capabilities * @brief Creates a recursive mutex with specific memory capabilities
* *
@@ -397,6 +444,10 @@
return xSemaphoreCreateGenericWithCaps( 0, 0, queueQUEUE_TYPE_RECURSIVE_MUTEX, uxMemoryCaps ); return xSemaphoreCreateGenericWithCaps( 0, 0, queueQUEUE_TYPE_RECURSIVE_MUTEX, uxMemoryCaps );
} }
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Deletes a semaphore previously created using one of the * @brief Deletes a semaphore previously created using one of the
* xSemaphoreCreate...WithCaps() functions * xSemaphoreCreate...WithCaps() functions
@@ -405,18 +456,22 @@
*/ */
void vSemaphoreDeleteWithCaps( SemaphoreHandle_t xSemaphore ); void vSemaphoreDeleteWithCaps( SemaphoreHandle_t xSemaphore );
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
/* ------------------------ Stream & Message Buffers ------------------------ */ /* ------------------------ Stream & Message Buffers ------------------------ */
/** @cond */ /* Doxygen command to hide this from docs */ /** @cond */ /* Doxygen command to hide this from docs */
StreamBufferHandle_t xStreamBufferGenericCreateWithCaps( size_t xBufferSizeBytes, StreamBufferHandle_t xStreamBufferGenericCreateWithCaps( size_t xBufferSizeBytes,
size_t xTriggerLevelBytes, size_t xTriggerLevelBytes,
BaseType_t xIsMessageBuffer, BaseType_t xIsMessageBuffer,
UBaseType_t uxMemoryCaps ); UBaseType_t uxMemoryCaps );
void vStreamBufferGenericDeleteWithCaps( StreamBufferHandle_t xStreamBuffer, void vStreamBufferGenericDeleteWithCaps( StreamBufferHandle_t xStreamBuffer,
BaseType_t xIsMessageBuffer ); BaseType_t xIsMessageBuffer );
/** @endcond */ /** @endcond */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Creates a stream buffer with specific memory capabilities * @brief Creates a stream buffer with specific memory capabilities
* *
@@ -441,6 +496,10 @@
return xStreamBufferGenericCreateWithCaps( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE, uxMemoryCaps ); return xStreamBufferGenericCreateWithCaps( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE, uxMemoryCaps );
} }
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Deletes a stream buffer previously created using * @brief Deletes a stream buffer previously created using
* xStreamBufferCreateWithCaps() * xStreamBufferCreateWithCaps()
@@ -452,6 +511,10 @@
vStreamBufferGenericDeleteWithCaps( xStreamBuffer, pdFALSE ); vStreamBufferGenericDeleteWithCaps( xStreamBuffer, pdFALSE );
} }
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Creates a message buffer with specific memory capabilities * @brief Creates a message buffer with specific memory capabilities
* *
@@ -473,6 +536,10 @@
return ( MessageBufferHandle_t ) xStreamBufferGenericCreateWithCaps( xBufferSizeBytes, ( size_t ) 0, pdTRUE, uxMemoryCaps ); return ( MessageBufferHandle_t ) xStreamBufferGenericCreateWithCaps( xBufferSizeBytes, ( size_t ) 0, pdTRUE, uxMemoryCaps );
} }
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Deletes a stream buffer previously created using * @brief Deletes a stream buffer previously created using
* xMessageBufferCreateWithCaps() * xMessageBufferCreateWithCaps()
@@ -484,8 +551,12 @@
vStreamBufferGenericDeleteWithCaps( ( StreamBufferHandle_t ) xMessageBuffer, pdTRUE ); vStreamBufferGenericDeleteWithCaps( ( StreamBufferHandle_t ) xMessageBuffer, pdTRUE );
} }
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
/* ------------------------------ Event Groups ------------------------------ */ /* ------------------------------ Event Groups ------------------------------ */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Creates an event group with specific memory capabilities * @brief Creates an event group with specific memory capabilities
* *
@@ -501,6 +572,10 @@
*/ */
EventGroupHandle_t xEventGroupCreateWithCaps( UBaseType_t uxMemoryCaps ); EventGroupHandle_t xEventGroupCreateWithCaps( UBaseType_t uxMemoryCaps );
#endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
/** /**
* @brief Deletes an event group previously created using * @brief Deletes an event group previously created using
* xEventGroupCreateWithCaps() * xEventGroupCreateWithCaps()
@@ -509,8 +584,10 @@
*/ */
void vEventGroupDeleteWithCaps( EventGroupHandle_t xEventGroup ); void vEventGroupDeleteWithCaps( EventGroupHandle_t xEventGroup );
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */ #endif /* configSUPPORT_STATIC_ALLOCATION == 1 */
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */

View File

@@ -6,33 +6,35 @@ archive: libfreertos.a
entries: entries:
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# esp_additions/private_include/freertos_tasks_c_additions.h # esp_additions/private_include/freertos_tasks_c_additions.h
# Placement Rules (FreeRTOS API Additions):
# - Default: Place all functions in internal RAM.
# - CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH: Place functions in flash if they are never called from an ISR
# context (directly or indirectly).
# Placement Rules (Task Snapshot): # Placement Rules (Task Snapshot):
# - Default: Place all functions in internal RAM. # - Default: Place all functions in internal RAM.
# - CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH: Place functions in flash # - CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH: Place functions in flash
# - vTaskGetSnapshot is omitted on purpose as it is used to by the Task Watchdog (TWDT) interrupt handler, we want # - vTaskGetSnapshot is omitted on purpose as it is used to by the Task Watchdog (TWDT) interrupt handler, we want
# to always keep it in IRAM # to always keep it in IRAM
# Placement Rules (FreeRTOS API Additions):
# - Default: Place all functions in internal RAM.
# - CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH: Place functions in flash if they are never called from an ISR
# context (directly or indirectly).
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y:
# Task Creation
if FREERTOS_SMP = y:
tasks:xTaskCreatePinnedToCore (default)
tasks:xTaskCreateStaticPinnedToCore (default)
# Task Utilities
tasks:xTaskGetCurrentTaskHandleForCPU (default)
tasks:xTaskGetIdleTaskHandleForCPU (default)
tasks:xTaskGetAffinity (default)
tasks:prvTaskPriorityRaise (default)
tasks:prvTaskPriorityRestore (default)
# TLSP Deletion Callbacks
if FREERTOS_TLSP_DELETION_CALLBACKS = y:
tasks:vTaskSetThreadLocalStoragePointerAndDelCallback (default)
# Task Snapshot # Task Snapshot
if FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH = y: if FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH = y:
tasks:pxGetNextTaskList (default) tasks:pxGetNextTaskList (default)
tasks:pxTaskGetNext (default) tasks:pxTaskGetNext (default)
tasks:uxTaskGetSnapshotAll (default) tasks:uxTaskGetSnapshotAll (default)
# FreeRTOS API Additions
if FREERTOS_PLACE_FUNCTIONS_INTO_FLASH = y:
if FREERTOS_SMP = y:
tasks:xTaskCreatePinnedToCore (default)
tasks:xTaskCreateStaticPinnedToCore (default)
tasks:xTaskGetCurrentTaskHandleForCPU (default)
tasks:xTaskGetIdleTaskHandleForCPU (default)
tasks:xTaskGetAffinity (default)
if FREERTOS_TLSP_DELETION_CALLBACKS = y:
tasks:vTaskSetThreadLocalStoragePointerAndDelCallback (default)
tasks:prvTaskPriorityRaise (default)
tasks:prvTaskPriorityRestore (default)
# ------------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------------
# idf_additions.c # idf_additions.c