refactor(freertos/smp): Move vTaskStartSchedulerOtherCores() to API additions to headers

- Move vTaskStartSchedulerOtherCores()
    - implementation to freertos_tasks_c_additions.h
    - declaration to freertos_idf_additions_priv.h as API is private
- Rename vTaskStartSchedulerOtherCores() -> prvStartSchedulerOtherCores() to
indicate that the function is private.
This commit is contained in:
Darian Leung 2023-08-29 16:52:25 +08:00
parent 5227616e57
commit 6c66018d5b
5 changed files with 34 additions and 29 deletions

View File

@ -3306,23 +3306,6 @@ void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNC
*/
void vTaskYieldWithinAPI( void );
/* ------------------------------------------------ IDF Compatibility --------------------------------------------------
*
* ------------------------------------------------------------------------------------------------------------------ */
#ifdef ESP_PLATFORM
#if ( configNUM_CORES > 1 )
/*
Workaround for non-thread safe multi-core OS startup (see IDF-4524)
This function must be called with interrupts disabled on all cores other than
core 0 during startup.
*/
void vTaskStartSchedulerOtherCores( void );
#endif // configNUM_CORES > 1
#endif //ESP_PLATFORM
/* *INDENT-OFF* */
#ifdef __cplusplus
}

View File

@ -18,6 +18,7 @@
#include "xtensa/config/core.h"
#include "xtensa/config/core-isa.h"
#include "xtensa/xtruntime.h"
#include "esp_private/freertos_idf_additions_priv.h"
#include "esp_private/esp_int_wdt.h"
#include "esp_private/systimer.h"
#include "esp_private/periph_ctrl.h"
@ -328,7 +329,7 @@ BaseType_t xPortStartScheduler( void )
#if configNUM_CORES > 1
// Workaround for non-thread safe multi-core OS startup (see IDF-4524)
if (xPortGetCoreID() != 0) {
vTaskStartSchedulerOtherCores();
prvStartSchedulerOtherCores();
}
#endif // configNUM_CORES > 1

View File

@ -6506,14 +6506,3 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
#endif
#endif /* if ( configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H == 1 ) */
#if ( ( ESP_PLATFORM == 1 ) && ( configNUM_CORES > 1 ) )
/*
Workaround for non-thread safe multi-core OS startup (see IDF-4524)
*/
void vTaskStartSchedulerOtherCores( void )
{
/* This function is always called with interrupts disabled*/
xSchedulerRunning = pdTRUE;
}
#endif // ( ESP_PLATFORM == 1 ) && ( configNUM_CORES > 1

View File

@ -31,6 +31,22 @@ _Static_assert( offsetof( StaticTask_t, pxDummy8 ) == offsetof( TCB_t, pxEndOfSt
_Static_assert( tskNO_AFFINITY == CONFIG_FREERTOS_NO_AFFINITY, "CONFIG_FREERTOS_NO_AFFINITY must be the same as tskNO_AFFINITY" );
#endif /* CONFIG_FREERTOS_SMP */
/* ------------------------------------------------- Kernel Control ------------------------------------------------- */
#if ( CONFIG_FREERTOS_SMP && ( configNUM_CORES > 1 ) )
/*
* Workaround for non-thread safe multi-core OS startup (see IDF-4524)
*/
void prvStartSchedulerOtherCores( void )
{
/* This function is always called with interrupts disabled*/
xSchedulerRunning = pdTRUE;
}
#endif /* ( CONFIG_FREERTOS_SMP && ( configNUM_CORES > 1 ) ) */
/*----------------------------------------------------------*/
/* -------------------------------------------------- Task Creation ------------------------------------------------- */
#if CONFIG_FREERTOS_SMP

View File

@ -20,6 +20,22 @@
#endif
/* *INDENT-ON* */
/*------------------------------------------------------------------------------
* KERNEL CONTROL (PRIVATE)
*----------------------------------------------------------------------------*/
#if ( CONFIG_FREERTOS_SMP && ( configNUM_CORES > 1 ) )
/**
* @brief Workaround for non-thread safe multi-core OS startup (see IDF-4524)
*
* This function must be called with interrupts disabled on all cores other than
* core 0 during startup.
*/
void prvStartSchedulerOtherCores( void );
#endif /* ( CONFIG_FREERTOS_SMP && ( configNUM_CORES > 1 ) ) */
/*------------------------------------------------------------------------------
* TASK UTILITIES (PRIVATE)
*----------------------------------------------------------------------------*/