refactor(freertos/idf): Move compatibility functions

This function moves ulTaskNotifyTake()/xTaskNotifyWait() from IDF FreeRTOS
`tasks.c` to `freertos_compatibility.c`. These functions were kept for
pre-compiled library compatibilty. Move them reduces the kernel source code
difference when compared to upstream FreeRTOS.
This commit is contained in:
Darian Leung 2023-08-28 23:45:46 +08:00
parent 0db40f9e6c
commit 5de6a9aff6
5 changed files with 49 additions and 39 deletions

View File

@ -99,13 +99,9 @@ endif()
# Add ESP-additions source files
list(APPEND srcs
"esp_additions/freertos_compatibility.c"
"esp_additions/idf_additions.c")
if(kernel_impl STREQUAL "FreeRTOS-Kernel")
list(APPEND srcs
"esp_additions/freertos_compatibility.c")
endif()
if(arch STREQUAL "linux")
# Check if we need to address the FreeRTOS EINTR coexistence with linux system calls if we're building without
# lwIP, we need to use linux system select which will receive EINTR event on every FreeRTOS interrupt, we

View File

@ -1530,15 +1530,6 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
/*-----------------------------------------------------------*/
#if ( INCLUDE_xTaskDelayUntil == 1 )
#ifdef ESP_PLATFORM
/* backward binary compatibility - remove later */
#undef vTaskDelayUntil
void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
const TickType_t xTimeIncrement )
{
xTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement );
}
#endif // ESP_PLATFORM
BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
const TickType_t xTimeIncrement )
@ -5633,16 +5624,6 @@ TickType_t uxTaskResetEventItemValue( void )
#if ( configUSE_TASK_NOTIFICATIONS == 1 )
#ifdef ESP_PLATFORM /* IDF-3851 */
/* included here for backward binary compatibility */
#undef ulTaskNotifyTake
uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit,
TickType_t xTicksToWait )
{
return ulTaskGenericNotifyTake( tskDEFAULT_INDEX_TO_NOTIFY, xClearCountOnExit, xTicksToWait );
}
#endif // ESP-PLATFORM
uint32_t ulTaskGenericNotifyTake( UBaseType_t uxIndexToWait,
BaseType_t xClearCountOnExit,
TickType_t xTicksToWait )
@ -5715,18 +5696,6 @@ TickType_t uxTaskResetEventItemValue( void )
#if ( configUSE_TASK_NOTIFICATIONS == 1 )
#ifdef ESP_PLATFORM /* IDF-3851 */
/* included for backward compatibility */
#undef xTaskNotifyWait
BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry,
uint32_t ulBitsToClearOnExit,
uint32_t * pulNotificationValue,
TickType_t xTicksToWait )
{
return xTaskGenericNotifyWait( tskDEFAULT_INDEX_TO_NOTIFY, ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait );
}
#endif // ESP-PLATFORM
BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWait,
uint32_t ulBitsToClearOnEntry,
uint32_t ulBitsToClearOnExit,

View File

@ -35,3 +35,45 @@ BaseType_t xQueueGenericReceive( QueueHandle_t xQueue,
return xQueueReceive( xQueue, pvBuffer, xTicksToWait );
}
/*
* vTaskDelayUntil() was deprecated into a macro and replaced by xTaskDelayUntil().
* This is added for pre-compiled libraries that depend on ulTaskNotifyTake()
* being a function.
*
* Todo: Remove this in v6.0 (IDF-3851)
*/
#undef vTaskDelayUntil
void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
const TickType_t xTimeIncrement )
{
xTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement );
}
/*
* ulTaskNotifyTake() was turned into a macro. This is added for pre-compiled
* libraries that depend on ulTaskNotifyTake() being a function.
*
* Todo: Remove this in v6.0 (IDF-3851)
*/
#undef ulTaskNotifyTake
uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit,
TickType_t xTicksToWait )
{
return ulTaskGenericNotifyTake( tskDEFAULT_INDEX_TO_NOTIFY, xClearCountOnExit, xTicksToWait );
}
/*
* xTaskNotifyWait() was turned into a macro. This is added for pre-compiled
* libraries that depend on xTaskNotifyWait() being a function.
*
* Todo: Remove this in v6.0 (IDF-3851)
*/
#undef xTaskNotifyWait
BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry,
uint32_t ulBitsToClearOnExit,
uint32_t * pulNotificationValue,
TickType_t xTicksToWait )
{
return xTaskGenericNotifyWait( tskDEFAULT_INDEX_TO_NOTIFY, ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait );
}

View File

@ -114,7 +114,6 @@ entries:
tasks:prvInitialiseNewTask (default)
tasks:prvAddNewTaskToReadyList (default)
tasks:vTaskDelete (default)
tasks:vTaskDelayUntil (default)
tasks:xTaskDelayUntil (default)
tasks:vTaskDelay (default)
tasks:eTaskGetState (default)
@ -169,9 +168,7 @@ entries:
tasks:vTaskGetRunTimeStats (default)
tasks:uxTaskResetEventItemValue (default)
tasks:pvTaskIncrementMutexHeldCount (default)
tasks:ulTaskNotifyTake (default)
tasks:ulTaskGenericNotifyTake (default)
tasks:xTaskNotifyWait (default)
tasks:xTaskGenericNotifyWait (default)
tasks:xTaskGenericNotify (default)
tasks:xTaskGenericNotifyStateClear (default)

View File

@ -42,6 +42,12 @@ entries:
tasks:pxTaskGetNext (default)
tasks:uxTaskGetSnapshotAll (default)
# ------------------------------------------------------------------------------------------------------------------
# freertos_compatibility.c
# Placement Rules: Functions always in flash as they are never called from an ISR
# ------------------------------------------------------------------------------------------------------------------
freertos_compatibility (default)
# ------------------------------------------------------------------------------------------------------------------
# idf_additions.c
# Placement Rules: Functions always in flash as they are never called from an ISR