Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MISRA C 2012 Rule 10.3 errors #860

Merged
merged 10 commits into from
Nov 28, 2023
24 changes: 12 additions & 12 deletions include/event_groups.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@
* item value. It is important they don't clash with the
* taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x0100U
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x0200U
#define eventWAIT_FOR_ALL_BITS 0x0400U
#define eventEVENT_BITS_CONTROL_BYTES 0xff00U
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint16_t ) 0x0100U )
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint16_t ) 0x0200U )
#define eventWAIT_FOR_ALL_BITS ( ( uint16_t ) 0x0400U )
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint16_t ) 0xff00U )
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x01000000UL
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x02000000UL
#define eventWAIT_FOR_ALL_BITS 0x04000000UL
#define eventEVENT_BITS_CONTROL_BYTES 0xff000000UL
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint32_t ) 0x01000000UL )
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint32_t ) 0x02000000UL )
#define eventWAIT_FOR_ALL_BITS ( ( uint32_t ) 0x04000000UL )
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint32_t ) 0xff000000UL )
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x0100000000000000ULL
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x0200000000000000ULL
#define eventWAIT_FOR_ALL_BITS 0x0400000000000000ULL
#define eventEVENT_BITS_CONTROL_BYTES 0xff00000000000000ULL
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint64_t ) 0x0100000000000000ULL )
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint64_t ) 0x0200000000000000ULL )
#define eventWAIT_FOR_ALL_BITS ( ( uint64_t ) 0x0400000000000000ULL )
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint64_t ) 0xff00000000000000ULL )
#endif /* if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS ) */

/* *INDENT-OFF* */
Expand Down
16 changes: 8 additions & 8 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@
* responsibility of whichever module is using the value to ensure it gets set back
* to its original value when it is released. */
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
#define taskEVENT_LIST_ITEM_VALUE_IN_USE 0x8000U
#define taskEVENT_LIST_ITEM_VALUE_IN_USE ( ( uint16_t ) 0x8000U )
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
#define taskEVENT_LIST_ITEM_VALUE_IN_USE 0x80000000UL
#define taskEVENT_LIST_ITEM_VALUE_IN_USE ( ( uint32_t ) 0x80000000UL )
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
#define taskEVENT_LIST_ITEM_VALUE_IN_USE 0x8000000000000000ULL
#define taskEVENT_LIST_ITEM_VALUE_IN_USE ( ( uint64_t ) 0x8000000000000000ULL )
#endif

/* Indicates that the task is not actively running on any core. */
Expand Down Expand Up @@ -2871,7 +2871,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,

/* Only reset the event list item value if the value is not
* being used for anything else. */
if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == 0UL )
if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0UL ) )
{
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) uxNewPriority ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
}
Expand Down Expand Up @@ -6559,7 +6559,7 @@ static void prvResetNextTaskUnblockTime( void )
/* Adjust the mutex holder state to account for its new
* priority. Only reset the event list item value if the value is
* not being used for anything else. */
if( ( listGET_LIST_ITEM_VALUE( &( pxMutexHolderTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == 0UL )
if( ( listGET_LIST_ITEM_VALUE( &( pxMutexHolderTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0UL ) )
{
listSET_LIST_ITEM_VALUE( &( pxMutexHolderTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxCurrentTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
}
Expand Down Expand Up @@ -6788,7 +6788,7 @@ static void prvResetNextTaskUnblockTime( void )

/* Only reset the event list item value if the value is not
* being used for anything else. */
if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == 0UL )
if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0UL ) )
{
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) uxPriorityToUse ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
}
Expand Down Expand Up @@ -7390,7 +7390,7 @@ static void prvResetNextTaskUnblockTime( void )
uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, &ulTotalTime );

/* For percentage calculations. */
ulTotalTime /= 100UL;
ulTotalTime /= ( ( configRUN_TIME_COUNTER_TYPE ) 100UL );

/* Avoid divide by zero errors. */
if( ulTotalTime > 0UL )
Expand Down Expand Up @@ -7642,7 +7642,7 @@ TickType_t uxTaskResetEventItemValue( void )
{
if( xClearCountOnExit != pdFALSE )
{
pxCurrentTCB->ulNotifiedValue[ uxIndexToWaitOn ] = 0UL;
pxCurrentTCB->ulNotifiedValue[ uxIndexToWaitOn ] = ( uint32_t ) 0UL;
chinglee-iot marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@
}
#else
{
xTimerQueue = xQueueCreate( ( UBaseType_t ) configTIMER_QUEUE_LENGTH, sizeof( DaemonTaskMessage_t ) );
xTimerQueue = xQueueCreate( ( UBaseType_t ) configTIMER_QUEUE_LENGTH, ( UBaseType_t ) sizeof( DaemonTaskMessage_t ) );
}
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */

Expand Down
Loading