freertos(IDF): Provide default value to configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS

This commit updates how configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS is defined
by default it to 0 if not defined elsewhere. Dependent code now check for
"configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1" instead.
This commit is contained in:
Darian Leung
2022-11-08 17:48:48 +08:00
parent fce4ee0b80
commit 915787249a
4 changed files with 18 additions and 12 deletions

View File

@@ -228,6 +228,10 @@
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
#endif #endif
#ifndef configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS
#define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS 0
#endif
#ifndef configUSE_RECURSIVE_MUTEXES #ifndef configUSE_RECURSIVE_MUTEXES
#define configUSE_RECURSIVE_MUTEXES 0 #define configUSE_RECURSIVE_MUTEXES 0
#endif #endif
@@ -1231,7 +1235,7 @@ typedef struct xSTATIC_TCB
#endif #endif
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ]; void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) #if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
void * pvDummyLocalStorageCallBack[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ]; void * pvDummyLocalStorageCallBack[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#endif #endif
#endif #endif

View File

@@ -2024,7 +2024,7 @@ uint8_t * pxTaskGetStackStart( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
void * pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, void * pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery,
BaseType_t xIndex ) PRIVILEGED_FUNCTION; BaseType_t xIndex ) PRIVILEGED_FUNCTION;
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) #if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
/** /**
* Prototype of local storage pointer deletion callback. * Prototype of local storage pointer deletion callback.

View File

@@ -340,7 +340,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
void * pvThreadLocalStoragePointers[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ]; void * pvThreadLocalStoragePointers[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) #if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
TlsDeleteCallbackFunction_t pvThreadLocalStoragePointersDelCallback[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ]; TlsDeleteCallbackFunction_t pvThreadLocalStoragePointersDelCallback[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#endif #endif
#endif #endif
@@ -539,7 +539,7 @@ static portTASK_FUNCTION_PROTO( prvIdleTask, pvParameters ) PRIVILEGED_FUNCTION;
/* Function to call the Thread Local Storage Pointer Deletion Callbacks. Will be /* Function to call the Thread Local Storage Pointer Deletion Callbacks. Will be
* called during task deletion before prvDeleteTCB is called. * called during task deletion before prvDeleteTCB is called.
*/ */
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
static void prvDeleteTLS( TCB_t * pxTCB ); static void prvDeleteTLS( TCB_t * pxTCB );
#endif #endif
@@ -1486,7 +1486,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
if( xFreeNow == pdTRUE ) if( xFreeNow == pdTRUE )
{ {
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
prvDeleteTLS( pxTCB ); prvDeleteTLS( pxTCB );
#endif #endif
@@ -4378,7 +4378,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) #if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
void vTaskSetThreadLocalStoragePointerAndDelCallback( TaskHandle_t xTaskToSet, void vTaskSetThreadLocalStoragePointerAndDelCallback( TaskHandle_t xTaskToSet,
BaseType_t xIndex, BaseType_t xIndex,
@@ -4405,7 +4405,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
} }
#else /* if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) */ #else /* if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 ) */
void vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, void vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet,
BaseType_t xIndex, BaseType_t xIndex,
void * pvValue ) void * pvValue )
@@ -4420,7 +4420,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
taskEXIT_CRITICAL( &xKernelLock ); taskEXIT_CRITICAL( &xKernelLock );
} }
} }
#endif /* configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS */ #endif /* configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 */
#endif /* configNUM_THREAD_LOCAL_STORAGE_POINTERS */ #endif /* configNUM_THREAD_LOCAL_STORAGE_POINTERS */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@@ -4557,7 +4557,7 @@ static void prvCheckTasksWaitingTermination( void )
if( pxTCB != NULL ) /*Call deletion callbacks and free TCB memory */ if( pxTCB != NULL ) /*Call deletion callbacks and free TCB memory */
{ {
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
prvDeleteTLS( pxTCB ); prvDeleteTLS( pxTCB );
#endif #endif
prvDeleteTCB( pxTCB ); prvDeleteTCB( pxTCB );
@@ -4892,7 +4892,7 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
#endif /* INCLUDE_vTaskDelete */ #endif /* INCLUDE_vTaskDelete */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 )
static void prvDeleteTLS( TCB_t * pxTCB ) static void prvDeleteTLS( TCB_t * pxTCB )
{ {
@@ -4907,7 +4907,7 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
} }
} }
#endif /* ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS ) */ #endif /* ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 ) && ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS == 1 ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View File

@@ -266,7 +266,9 @@ Note: Include trace macros here and not above as trace macros are dependent on s
// ---------------------- Features ------------------------- // ---------------------- Features -------------------------
#define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS #ifdef CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS
#define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS 1
#endif
#if CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER #if CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER
#define configCHECK_MUTEX_GIVEN_BY_OWNER 1 #define configCHECK_MUTEX_GIVEN_BY_OWNER 1