From da0185fbf1215706af66d020a67edf912193979a Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Thu, 7 Dec 2023 19:08:51 +0800 Subject: Update the vApplicationGetPassiveIdleTaskMemory for SMP (#10) * Fix get idle task memory prototype * Fix alignment * Update for get passive idle task memory * Fix formating --- TI/CORTEX_A53_64-BIT_TI_AM64_SMP/port.c | 105 +++++++++++++++++++------------- 1 file changed, 61 insertions(+), 44 deletions(-) diff --git a/TI/CORTEX_A53_64-BIT_TI_AM64_SMP/port.c b/TI/CORTEX_A53_64-BIT_TI_AM64_SMP/port.c index 5a84b6e..29e06e9 100644 --- a/TI/CORTEX_A53_64-BIT_TI_AM64_SMP/port.c +++ b/TI/CORTEX_A53_64-BIT_TI_AM64_SMP/port.c @@ -277,55 +277,72 @@ void vApplicationStackOverflowHook( TaskHandle_t xTask, DebugP_assertNoLog(0); } -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; -/* configSUPPORT_STATIC_ALLOCATION is set to 1, so the application must provide an - * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is - * used by the Idle task. - */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, - StackType_t **ppxIdleTaskStackBuffer, - uint32_t *pulIdleTaskStackSize ) -{ - /* Pass out a pointer to the StaticTask_t structure in which the Idle task’s - * state will be stored. - */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task’s stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - * Note that, as the array is necessarily of type StackType_t, - * configMINIMAL_STACK_SIZE is specified in words, not bytes. +#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configKERNEL_PROVIDED_STATIC_MEMORY == 0 ) + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + /* configSUPPORT_STATIC_ALLOCATION is set to 1, so the application must provide an + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; -} + void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, + StackType_t **ppxIdleTaskStackBuffer, + uint32_t *pulIdleTaskStackSize ) + { + /* Pass out a pointer to the StaticTask_t structure in which the Idle task’s + * state will be stored. + */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task’s stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. + */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + } -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; -/* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the - * application must provide an implementation of vApplicationGetTimerTaskMemory() - * to provide the memory that is used by the Timer service task. - */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, - StackType_t **ppxTimerTaskStackBuffer, - uint32_t *pulTimerTaskStackSize ) -{ - /* Pass out a pointer to the StaticTask_t structure in which the Timer - * task’s state will be stored. - */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + #if ( configNUMBER_OF_CORES > 1 ) + static StaticTask_t xPassiveIdleTaskTCBs[ configNUMBER_OF_CORES - 1 ]; + static StackType_t uxPassiveIdleTaskStacks[ configNUMBER_OF_CORES - 1 ][ configMINIMAL_STACK_SIZE ]; + void vApplicationGetPassiveIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize, + BaseType_t xPassiveIdleTaskIndex ) + { + *ppxIdleTaskTCBBuffer = &( xPassiveIdleTaskTCBs[ xPassiveIdleTaskIndex ] ); + *ppxIdleTaskStackBuffer = &( uxPassiveIdleTaskStacks[ xPassiveIdleTaskIndex ][ 0 ] ); + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + } - /* Pass out the array that will be used as the Timer task’s stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; + #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - * Note that, as the array is necessarily of type StackType_t, - * configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + /* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; -} + void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, + StackType_t **ppxTimerTaskStackBuffer, + uint32_t *pulTimerTaskStackSize ) + { + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task’s state will be stored. + */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task’s stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. + */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + } +#endif /* This function is called when configUSE_IDLE_HOOK is 1 in FreeRTOSConfig.h */ void vApplicationIdleHook( void ) -- cgit v1.2.3