Skip to content

Commit 7eafef2

Browse files
committed
Add descriptive comment for portTIMER_CALLBACK_ATTRIBUTE and move to same line as decorated code
1 parent 5291168 commit 7eafef2

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

event_groups.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,17 +654,15 @@ const List_t *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits );
654654

655655
/* For internal use only - execute a 'set bits' command that was pended from
656656
an interrupt. */
657-
portTIMER_CALLBACK_ATTRIBUTE
658-
void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet )
657+
portTIMER_CALLBACK_ATTRIBUTE void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet )
659658
{
660659
( 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. */
661660
}
662661
/*-----------------------------------------------------------*/
663662

664663
/* For internal use only - execute a 'clear bits' command that was pended from
665664
an interrupt. */
666-
portTIMER_CALLBACK_ATTRIBUTE
667-
void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear )
665+
portTIMER_CALLBACK_ATTRIBUTE void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear )
668666
{
669667
( 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. */
670668
}

timers.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,17 @@ defining trmTIMER_SERVICE_TASK_NAME in FreeRTOSConfig.h. */
6969
#define tmrSTATUS_IS_STATICALLY_ALLOCATED ( ( uint8_t ) 0x02 )
7070
#define tmrSTATUS_IS_AUTORELOAD ( ( uint8_t ) 0x04 )
7171

72-
/* The definition of the timers themselves. */
72+
/* The definition of the timers themselves.
73+
portTIMER_CALLBACK_ATTRIBUTE can be used to apply an __attribute__ to timer callbacks and timer
74+
callback function pointers. In some ports, this attribute enables the compiler to resolve function pointers in static analysis.
75+
portTIMER_CALLBACK_ATTRIBUTE defaults as white space unless it is defined by the user. */
7376
typedef struct tmrTimerControl /* The old naming convention is used to prevent breaking kernel aware debuggers. */
7477
{
7578
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. */
7679
ListItem_t xTimerListItem; /*<< Standard linked list item as used by all kernel features for event management. */
7780
TickType_t xTimerPeriodInTicks;/*<< How quickly and often the timer expires. */
7881
void *pvTimerID; /*<< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */
79-
portTIMER_CALLBACK_ATTRIBUTE
80-
TimerCallbackFunction_t pxCallbackFunction; /*<< The function that will be called when the timer expires. */
82+
portTIMER_CALLBACK_ATTRIBUTE TimerCallbackFunction_t pxCallbackFunction; /*<< The function that will be called when the timer expires. */
8183
#if( configUSE_TRACE_FACILITY == 1 )
8284
UBaseType_t uxTimerNumber; /*<< An ID assigned by trace tools such as FreeRTOS+Trace */
8385
#endif
@@ -102,8 +104,7 @@ typedef struct tmrTimerParameters
102104

103105
typedef struct tmrCallbackParameters
104106
{
105-
portTIMER_CALLBACK_ATTRIBUTE
106-
PendedFunction_t pxCallbackFunction; /* << The callback function to execute. */
107+
portTIMER_CALLBACK_ATTRIBUTE PendedFunction_t pxCallbackFunction; /* << The callback function to execute. */
107108
void *pvParameter1; /* << The value that will be used as the callback functions first parameter. */
108109
uint32_t ulParameter2; /* << The value that will be used as the callback functions second parameter. */
109110
} CallbackParameters_t;

0 commit comments

Comments
 (0)