mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 09:38:32 -04:00
Update SMP get idle task memory for static allocation (#784)
* Add static idle task memory support for SMP * Rename vApplicationMinimalIdleTask to vApplicationPassiveIdleTask * Rename the macro configUSE_MINIMAL_IDLE_HOOK to configUSE_PASSIVE_IDLE_HOOK * Update xTaskGetIdleTaskHandle for SMP * Add more check in xTaskGetIdleTaskHandle * Support configKERNEL_PROVIDED_STATIC_MEMORY for SMP --------- Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
This commit is contained in:
parent
92a4d175e6
commit
4bfb9b2d70
3 changed files with 241 additions and 198 deletions
|
@ -1930,6 +1930,8 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL
|
|||
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
|
||||
#if ( configNUMBER_OF_CORES == 1 )
|
||||
|
||||
/**
|
||||
* task.h
|
||||
* @code{c}
|
||||
|
@ -1943,10 +1945,41 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL
|
|||
* @param ppxIdleTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task
|
||||
* @param pulIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
|
||||
*/
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize ); /*lint !e526 Symbol not defined as it is an application callback. */
|
||||
#endif
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize ); /*lint !e526 Symbol not defined as it is an application callback. */
|
||||
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
|
||||
|
||||
/**
|
||||
* task.h
|
||||
* @code{c}
|
||||
* void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize, BaseType_t xCoreID )
|
||||
* @endcode
|
||||
*
|
||||
* This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Idle Tasks TCB. This function is required when
|
||||
* configSUPPORT_STATIC_ALLOCATION is set. For more information see this URI: https://www.FreeRTOS.org/a00110.html#configSUPPORT_STATIC_ALLOCATION
|
||||
*
|
||||
* In the FreeRTOS SMP, there are a total of configNUMBER_OF_CORES idle tasks:
|
||||
* 1. 1 Active idle task which does all the housekeeping.
|
||||
* 2. ( configNUMBER_OF_CORES - 1 ) Passive idle tasks which do nothing.
|
||||
* These idle tasks are created to ensure that each core has an idle task to run when
|
||||
* no other task is available to run.
|
||||
*
|
||||
* The function vApplicationGetIdleTaskMemory is called with xCoreID 0 to get the
|
||||
* memory for Active idle task. It is called with xCoreID 1, 2 ... ( configNUMBER_OF_CORES - 1 )
|
||||
* to get memory for passive idle tasks.
|
||||
*
|
||||
* @param ppxIdleTaskTCBBuffer A handle to a statically allocated TCB buffer
|
||||
* @param ppxIdleTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task
|
||||
* @param pulIdleTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
|
||||
* @param xCoreId The core index of the idle task buffer
|
||||
*/
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize, /*lint !e526 Symbol not defined as it is an application callback. */
|
||||
BaseType_t xCoreID );
|
||||
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
|
||||
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
|
||||
|
||||
/**
|
||||
* task.h
|
||||
|
@ -1970,8 +2003,22 @@ BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask,
|
|||
*
|
||||
* Simply returns the handle of the idle task. It is not valid to call
|
||||
* xTaskGetIdleTaskHandle() before the scheduler has been started.
|
||||
*
|
||||
* In the FreeRTOS SMP, there are a total of configNUMBER_OF_CORES idle tasks:
|
||||
* 1. 1 Active idle task which does all the housekeeping.
|
||||
* 2. ( configNUMBER_OF_CORES - 1 ) Passive idle tasks which do nothing.
|
||||
* These idle tasks are created to ensure that each core has an idle task to run when
|
||||
* no other task is available to run.
|
||||
*
|
||||
* Set xCoreID to 0 to get the Active idle task handle. Set xCoreID to
|
||||
* 1,2 ... ( configNUMBER_OF_CORES - 1 ) to get the Passive idle task
|
||||
* handles.
|
||||
*/
|
||||
TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;
|
||||
#if ( configNUMBER_OF_CORES == 1 )
|
||||
TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;
|
||||
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
|
||||
TaskHandle_t xTaskGetIdleTaskHandle( BaseType_t xCoreID ) PRIVILEGED_FUNCTION;
|
||||
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
|
||||
|
||||
/**
|
||||
* configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue