Skip to content

Commit 4394741

Browse files
event-groups: Fix multiple definitions (#1307)
This commit does the following: * Remove xEventGroupClearBitsFromISR and xEventGroupSetBitsFromISR functions direct mapping to xTimerPendFunctionCallFromISR in case the trace facility is feature not set. This should match the current implementation in which the application calling xEventGroupClearBitsFromISR without defining the trace macros (i.e. traceENTER_xEventGroupClearBitsFromISR is a blank function in this case) will end up calling xTimerPendFunctionCallFromISR function directly. This enhances the readability of the code by not guarding the xEventGroup<Set/Clear>BitsFromISR functions' declaration and definition based on the trace facility macro (i.e. configUSE_TRACE_FACILITY). * Refactor the guarding macros for MPU_xEventGroupClearBitsFromISR and MPU_xEventGroupSetBitsFromISR functions to match the change above. The current implementation leads to redefinition warnings as `event_groups.h`redefines xEventGroupClearBitsFromISR and xEventGroupSetBitsFromISR based on `configUSE_TRACE_FACILITY' after they have been defined based on configUSE_MPU_WRAPPERS_V1 in `mpu_wrappers.h`. The implemented changes should resolve these warnings. Signed-off-by: Ahmed Ismail <[email protected]>
1 parent c91ee8d commit 4394741

File tree

4 files changed

+20
-23
lines changed

4 files changed

+20
-23
lines changed

event_groups.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@
501501
}
502502
/*-----------------------------------------------------------*/
503503

504-
#if ( ( configUSE_TRACE_FACILITY == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
504+
#if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
505505

506506
BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup,
507507
const EventBits_t uxBitsToClear )
@@ -518,7 +518,7 @@
518518
return xReturn;
519519
}
520520

521-
#endif /* if ( ( configUSE_TRACE_FACILITY == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
521+
#endif /* if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
522522
/*-----------------------------------------------------------*/
523523

524524
EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup )
@@ -812,7 +812,7 @@
812812
}
813813
/*-----------------------------------------------------------*/
814814

815-
#if ( ( configUSE_TRACE_FACILITY == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
815+
#if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
816816

817817
BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup,
818818
const EventBits_t uxBitsToSet,
@@ -830,7 +830,7 @@
830830
return xReturn;
831831
}
832832

833-
#endif /* if ( ( configUSE_TRACE_FACILITY == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
833+
#endif /* if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
834834
/*-----------------------------------------------------------*/
835835

836836
#if ( configUSE_TRACE_FACILITY == 1 )

include/event_groups.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,10 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
452452
* \defgroup xEventGroupClearBitsFromISR xEventGroupClearBitsFromISR
453453
* \ingroup EventGroup
454454
*/
455-
#if ( configUSE_TRACE_FACILITY == 1 )
455+
#if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
456456
BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup,
457457
const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION;
458-
#else
459-
#define xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear ) \
460-
xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) ( xEventGroup ), ( uint32_t ) ( uxBitsToClear ), NULL )
461-
#endif
458+
#endif /* if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
462459

463460
/**
464461
* event_groups.h
@@ -607,14 +604,11 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
607604
* \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR
608605
* \ingroup EventGroup
609606
*/
610-
#if ( configUSE_TRACE_FACILITY == 1 )
607+
#if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
611608
BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup,
612609
const EventBits_t uxBitsToSet,
613610
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
614-
#else
615-
#define xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) \
616-
xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) ( xEventGroup ), ( uint32_t ) ( uxBitsToSet ), ( pxHigherPriorityTaskWoken ) )
617-
#endif
611+
#endif /* if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
618612

619613
/**
620614
* event_groups.h

include/mpu_prototypes.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,16 @@ EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup,
409409

410410
BaseType_t MPU_xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup,
411411
StaticEventGroup_t ** ppxEventGroupBuffer ) PRIVILEGED_FUNCTION;
412-
BaseType_t MPU_xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup,
413-
const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION;
414-
BaseType_t MPU_xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup,
415-
const EventBits_t uxBitsToSet,
416-
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
417412
EventBits_t MPU_xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
418413

414+
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
415+
BaseType_t MPU_xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup,
416+
const EventBits_t uxBitsToClear ) FREERTOS_SYSTEM_CALL;
417+
BaseType_t MPU_xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup,
418+
const EventBits_t uxBitsToSet,
419+
BaseType_t * pxHigherPriorityTaskWoken ) FREERTOS_SYSTEM_CALL;
420+
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
421+
419422
/* MPU versions of message/stream_buffer.h API functions. */
420423
size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
421424
const void * pvTxData,

portable/Common/mpu_wrappers_v2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4282,7 +4282,7 @@
42824282
#endif /* #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_EVENT_GROUPS == 1 ) ) */
42834283
/*-----------------------------------------------------------*/
42844284

4285-
#if ( ( configUSE_EVENT_GROUPS == 1 ) && ( configUSE_TRACE_FACILITY == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
4285+
#if ( ( configUSE_EVENT_GROUPS == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
42864286

42874287
BaseType_t MPU_xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup,
42884288
const EventBits_t uxBitsToClear ) /* PRIVILEGED_FUNCTION */
@@ -4306,10 +4306,10 @@
43064306
return xReturn;
43074307
}
43084308

4309-
#endif /* #if ( ( configUSE_EVENT_GROUPS == 1 ) && ( configUSE_TRACE_FACILITY == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
4309+
#endif /* #if ( ( configUSE_EVENT_GROUPS == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
43104310
/*-----------------------------------------------------------*/
43114311

4312-
#if ( ( configUSE_EVENT_GROUPS == 1 ) && ( configUSE_TRACE_FACILITY == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
4312+
#if ( ( configUSE_EVENT_GROUPS == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
43134313

43144314
BaseType_t MPU_xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup,
43154315
const EventBits_t uxBitsToSet,
@@ -4334,7 +4334,7 @@
43344334
return xReturn;
43354335
}
43364336

4337-
#endif /* #if ( ( configUSE_EVENT_GROUPS == 1 ) && ( configUSE_TRACE_FACILITY == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
4337+
#endif /* #if ( ( configUSE_EVENT_GROUPS == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
43384338
/*-----------------------------------------------------------*/
43394339

43404340
#if ( configUSE_EVENT_GROUPS == 1 )

0 commit comments

Comments
 (0)