From 1865857eae91c24038cbdb5d33170fd700a582a9 Mon Sep 17 00:00:00 2001 From: Joseph Julicher Date: Tue, 18 Aug 2020 11:29:00 -0700 Subject: [PATCH] Moving the function prototypes to headers (#128) * Removing StackMacros.h * Moving 4 Function Prototypes out of the C files into the headers * Revert "Removing StackMacros.h" This reverts commit cdd8307817048c794d038588aa00833b0532401b. --- include/task.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ include/timers.h | 19 +++++++++++++++++++ tasks.c | 22 ---------------------- timers.c | 12 ------------ 4 files changed, 65 insertions(+), 34 deletions(-) diff --git a/include/task.h b/include/task.h index 7dd103202..e6f90677b 100644 --- a/include/task.h +++ b/include/task.h @@ -1541,6 +1541,52 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL #endif +#if ( configCHECK_FOR_STACK_OVERFLOW > 0 ) + + /** + * task.h + *
void vApplicationStackOverflowHook( TaskHandle_t xTask char *pcTaskName); 
+ * + * The application stack overflow hook is called when a stack overflow is detected for a task. + * + * Details on stack overflow detection can be found here: https://www.freertos.org/Stacks-and-stack-overflow-checking.html + * + * @param xTask the task that just exceeded its stack boundaries. + * @param pcTaskName A character string containing the name of the offending task. + */ + void vApplicationStackOverflowHook( TaskHandle_t xTask, + char * pcTaskName ); + +#endif + +#if ( configUSE_TICK_HOOK > 0 ) + /** + * task.h + *
void vApplicationTickHook( void ); 
+ * + * This hook function is called in the system tick handler after any OS work is completed. + */ + void vApplicationTickHook( void ); /*lint !e526 Symbol not defined as it is an application callback. */ + +#endif + +#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) + /** + * task.h + *
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) 
+ * + * This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Idle Task 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 + * + * @param ppxIdleTaskTCBBuffer A handle to a statically allocated TCB buffer + * @param ppxIdleTaskStackBuffer A handle to a statically allocated Stack buffer for thie 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 + /** * task.h *
BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );
diff --git a/include/timers.h b/include/timers.h index 834dc40b7..be90c9eec 100644 --- a/include/timers.h +++ b/include/timers.h @@ -1324,6 +1324,25 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, UBaseType_t uxTimerGetTimerNumber( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; #endif +#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) + + /** + * task.h + *
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) 
+ * + * This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Timer Task 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 + * + * @param ppxTimerTaskTCBBuffer A handle to a statically allocated TCB buffer + * @param ppxTimerTaskStackBuffer A handle to a statically allocated Stack buffer for thie idle task + * @param pulTimerTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer + */ + void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ); + +#endif + /* *INDENT-OFF* */ #ifdef __cplusplus } diff --git a/tasks.c b/tasks.c index 2029fbe31..7af040d27 100644 --- a/tasks.c +++ b/tasks.c @@ -402,28 +402,6 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t /*-----------------------------------------------------------*/ -/* Callback function prototypes. --------------------------*/ -#if ( configCHECK_FOR_STACK_OVERFLOW > 0 ) - - extern void vApplicationStackOverflowHook( TaskHandle_t xTask, - char * pcTaskName ); - -#endif - -#if ( configUSE_TICK_HOOK > 0 ) - - extern void vApplicationTickHook( void ); /*lint !e526 Symbol not defined as it is an application callback. */ - -#endif - -#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) - - extern void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, - StackType_t ** ppxIdleTaskStackBuffer, - uint32_t * pulIdleTaskStackSize ); /*lint !e526 Symbol not defined as it is an application callback. */ - -#endif - /* File private functions. --------------------------------*/ /** diff --git a/timers.c b/timers.c index b7bdb8783..8d3dcf102 100644 --- a/timers.c +++ b/timers.c @@ -144,18 +144,6 @@ /*-----------------------------------------------------------*/ - #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) - -/* If static allocation is supported then the application must provide the - * following callback function - which enables the application to optionally - * provide the memory that will be used by the timer task as the task's stack - * and TCB. */ - extern void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, - StackType_t ** ppxTimerTaskStackBuffer, - uint32_t * pulTimerTaskStackSize ); - - #endif - /* * Initialise the infrastructure used by the timer service task if it has not * been initialised already.