From 7eafef28c0d459b5cd874ae7f8fd975e253f6ba6 Mon Sep 17 00:00:00 2001 From: David Chalco Date: Tue, 21 Apr 2020 16:50:45 -0700 Subject: [PATCH] Add descriptive comment for portTIMER_CALLBACK_ATTRIBUTE and move to same line as decorated code --- event_groups.c | 6 ++---- timers.c | 11 ++++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/event_groups.c b/event_groups.c index 502652207..1567bf3e1 100644 --- a/event_groups.c +++ b/event_groups.c @@ -654,8 +654,7 @@ const List_t *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits ); /* For internal use only - execute a 'set bits' command that was pended from an interrupt. */ -portTIMER_CALLBACK_ATTRIBUTE -void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet ) +portTIMER_CALLBACK_ATTRIBUTE void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet ) { ( void ) xEventGroupSetBits( pvEventGroup, ( EventBits_t ) ulBitsToSet ); /*lint !e9079 Can't avoid cast to void* as a generic timer callback prototype. Callback casts back to original type so safe. */ } @@ -663,8 +662,7 @@ void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet /* For internal use only - execute a 'clear bits' command that was pended from an interrupt. */ -portTIMER_CALLBACK_ATTRIBUTE -void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear ) +portTIMER_CALLBACK_ATTRIBUTE void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear ) { ( void ) xEventGroupClearBits( pvEventGroup, ( EventBits_t ) ulBitsToClear ); /*lint !e9079 Can't avoid cast to void* as a generic timer callback prototype. Callback casts back to original type so safe. */ } diff --git a/timers.c b/timers.c index afc57a7cf..ee9c59b02 100644 --- a/timers.c +++ b/timers.c @@ -69,15 +69,17 @@ defining trmTIMER_SERVICE_TASK_NAME in FreeRTOSConfig.h. */ #define tmrSTATUS_IS_STATICALLY_ALLOCATED ( ( uint8_t ) 0x02 ) #define tmrSTATUS_IS_AUTORELOAD ( ( uint8_t ) 0x04 ) -/* The definition of the timers themselves. */ +/* The definition of the timers themselves. +portTIMER_CALLBACK_ATTRIBUTE can be used to apply an __attribute__ to timer callbacks and timer +callback function pointers. In some ports, this attribute enables the compiler to resolve function pointers in static analysis. +portTIMER_CALLBACK_ATTRIBUTE defaults as white space unless it is defined by the user. */ typedef struct tmrTimerControl /* The old naming convention is used to prevent breaking kernel aware debuggers. */ { const char *pcTimerName; /*<< Text name. This is not used by the kernel, it is included simply to make debugging easier. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ ListItem_t xTimerListItem; /*<< Standard linked list item as used by all kernel features for event management. */ TickType_t xTimerPeriodInTicks;/*<< How quickly and often the timer expires. */ void *pvTimerID; /*<< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */ - portTIMER_CALLBACK_ATTRIBUTE - TimerCallbackFunction_t pxCallbackFunction; /*<< The function that will be called when the timer expires. */ + portTIMER_CALLBACK_ATTRIBUTE TimerCallbackFunction_t pxCallbackFunction; /*<< The function that will be called when the timer expires. */ #if( configUSE_TRACE_FACILITY == 1 ) UBaseType_t uxTimerNumber; /*<< An ID assigned by trace tools such as FreeRTOS+Trace */ #endif @@ -102,8 +104,7 @@ typedef struct tmrTimerParameters typedef struct tmrCallbackParameters { - portTIMER_CALLBACK_ATTRIBUTE - PendedFunction_t pxCallbackFunction; /* << The callback function to execute. */ + portTIMER_CALLBACK_ATTRIBUTE PendedFunction_t pxCallbackFunction; /* << The callback function to execute. */ void *pvParameter1; /* << The value that will be used as the callback functions first parameter. */ uint32_t ulParameter2; /* << The value that will be used as the callback functions second parameter. */ } CallbackParameters_t;