Skip to content

Commit c02a347

Browse files
chinglee-iotUbuntu
andauthored
Use suffix "U" for unsigned constant (#1041)
* Fix the constant suffix to U * Fix more unsigned contant suffix --------- Co-authored-by: Ubuntu <[email protected]>
1 parent fdf4695 commit c02a347

File tree

5 files changed

+47
-47
lines changed

5 files changed

+47
-47
lines changed

include/event_groups.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@
4040
* item value. It is important they don't clash with the
4141
* taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */
4242
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
43-
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint16_t ) 0x0100 )
44-
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint16_t ) 0x0200 )
45-
#define eventWAIT_FOR_ALL_BITS ( ( uint16_t ) 0x0400 )
46-
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint16_t ) 0xff00 )
43+
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint16_t ) 0x0100U )
44+
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint16_t ) 0x0200U )
45+
#define eventWAIT_FOR_ALL_BITS ( ( uint16_t ) 0x0400U )
46+
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint16_t ) 0xff00U )
4747
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
48-
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint32_t ) 0x01000000 )
49-
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint32_t ) 0x02000000 )
50-
#define eventWAIT_FOR_ALL_BITS ( ( uint32_t ) 0x04000000 )
51-
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint32_t ) 0xff000000 )
48+
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint32_t ) 0x01000000U )
49+
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint32_t ) 0x02000000U )
50+
#define eventWAIT_FOR_ALL_BITS ( ( uint32_t ) 0x04000000U )
51+
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint32_t ) 0xff000000U )
5252
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
53-
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint64_t ) 0x0100000000000000 )
54-
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint64_t ) 0x0200000000000000 )
55-
#define eventWAIT_FOR_ALL_BITS ( ( uint64_t ) 0x0400000000000000 )
56-
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint64_t ) 0xff00000000000000 )
53+
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint64_t ) 0x0100000000000000U )
54+
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint64_t ) 0x0200000000000000U )
55+
#define eventWAIT_FOR_ALL_BITS ( ( uint64_t ) 0x0400000000000000U )
56+
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint64_t ) 0xff00000000000000U )
5757
#endif /* if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS ) */
5858

5959
/* *INDENT-OFF* */

include/queue.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
302302
* char ucData[ 20 ];
303303
* } xMessage;
304304
*
305-
* uint32_t ulVar = 10UL;
305+
* uint32_t ulVar = 10U;
306306
*
307307
* void vATask( void *pvParameters )
308308
* {
@@ -385,7 +385,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
385385
* char ucData[ 20 ];
386386
* } xMessage;
387387
*
388-
* uint32_t ulVar = 10UL;
388+
* uint32_t ulVar = 10U;
389389
*
390390
* void vATask( void *pvParameters )
391391
* {
@@ -470,7 +470,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
470470
* char ucData[ 20 ];
471471
* } xMessage;
472472
*
473-
* uint32_t ulVar = 10UL;
473+
* uint32_t ulVar = 10U;
474474
*
475475
* void vATask( void *pvParameters )
476476
* {
@@ -643,7 +643,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
643643
* char ucData[ 20 ];
644644
* } xMessage;
645645
*
646-
* uint32_t ulVar = 10UL;
646+
* uint32_t ulVar = 10U;
647647
*
648648
* void vATask( void *pvParameters )
649649
* {

include/task.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@
6060

6161
/* MPU region parameters passed in ulParameters
6262
* of MemoryRegion_t struct. */
63-
#define tskMPU_REGION_READ_ONLY ( 1UL << 0UL )
64-
#define tskMPU_REGION_READ_WRITE ( 1UL << 1UL )
65-
#define tskMPU_REGION_EXECUTE_NEVER ( 1UL << 2UL )
66-
#define tskMPU_REGION_NORMAL_MEMORY ( 1UL << 3UL )
67-
#define tskMPU_REGION_DEVICE_MEMORY ( 1UL << 4UL )
63+
#define tskMPU_REGION_READ_ONLY ( 1U << 0U )
64+
#define tskMPU_REGION_READ_WRITE ( 1U << 1U )
65+
#define tskMPU_REGION_EXECUTE_NEVER ( 1U << 2U )
66+
#define tskMPU_REGION_NORMAL_MEMORY ( 1U << 3U )
67+
#define tskMPU_REGION_DEVICE_MEMORY ( 1U << 4U )
6868

6969
/* MPU region permissions stored in MPU settings to
7070
* authorize access requests. */
71-
#define tskMPU_READ_PERMISSION ( 1UL << 0UL )
72-
#define tskMPU_WRITE_PERMISSION ( 1UL << 1UL )
71+
#define tskMPU_READ_PERMISSION ( 1U << 0U )
72+
#define tskMPU_WRITE_PERMISSION ( 1U << 1U )
7373

7474
/* The direct to task notification feature used to have only a single notification
7575
* per task. Now there is an array of notifications per task that is dimensioned by
@@ -473,7 +473,7 @@ typedef enum
473473
* {
474474
* // The parameter value is expected to be 1 as 1 is passed in the
475475
* // pvParameters value in the call to xTaskCreateStatic().
476-
* configASSERT( ( uint32_t ) pvParameters == 1UL );
476+
* configASSERT( ( uint32_t ) pvParameters == 1U );
477477
*
478478
* for( ;; )
479479
* {
@@ -564,7 +564,7 @@ typedef enum
564564
* "ATask", // pcName - just a text name for the task to assist debugging.
565565
* 100, // uxStackDepth - the stack size DEFINED IN WORDS.
566566
* NULL, // pvParameters - passed into the task function as the function parameters.
567-
* ( 1UL | portPRIVILEGE_BIT ),// uxPriority - task priority, set the portPRIVILEGE_BIT if the task should run in a privileged state.
567+
* ( 1U | portPRIVILEGE_BIT ),// uxPriority - task priority, set the portPRIVILEGE_BIT if the task should run in a privileged state.
568568
* cStackBuffer,// puxStackBuffer - the buffer to be used as the task stack.
569569
*
570570
* // xRegions - Allocate up to three separate memory regions for access by
@@ -658,7 +658,7 @@ typedef enum
658658
* "ATask", // pcName - just a text name for the task to assist debugging.
659659
* 100, // uxStackDepth - the stack size DEFINED IN WORDS.
660660
* NULL, // pvParameters - passed into the task function as the function parameters.
661-
* ( 1UL | portPRIVILEGE_BIT ),// uxPriority - task priority, set the portPRIVILEGE_BIT if the task should run in a privileged state.
661+
* ( 1U | portPRIVILEGE_BIT ),// uxPriority - task priority, set the portPRIVILEGE_BIT if the task should run in a privileged state.
662662
* cStackBuffer,// puxStackBuffer - the buffer to be used as the task stack.
663663
*
664664
* // xRegions - Allocate up to three separate memory regions for access by
@@ -2139,7 +2139,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION;
21392139
* uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, &ulTotalRunTime );
21402140
*
21412141
* // For percentage calculations.
2142-
* ulTotalRunTime /= 100UL;
2142+
* ulTotalRunTime /= 100U;
21432143
*
21442144
* // Avoid divide by zero errors.
21452145
* if( ulTotalRunTime > 0 )
@@ -2153,7 +2153,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION;
21532153
* // ulTotalRunTimeDiv100 has already been divided by 100.
21542154
* ulStatsAsPercentage = pxTaskStatusArray[ x ].ulRunTimeCounter / ulTotalRunTime;
21552155
*
2156-
* if( ulStatsAsPercentage > 0UL )
2156+
* if( ulStatsAsPercentage > 0U )
21572157
* {
21582158
* sprintf( pcWriteBuffer, "%s\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
21592159
* }
@@ -2863,7 +2863,7 @@ BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify,
28632863
* will be cleared in the calling task's notification value before the task
28642864
* checks to see if any notifications are pending, and optionally blocks if no
28652865
* notifications are pending. Setting ulBitsToClearOnEntry to ULONG_MAX (if
2866-
* limits.h is included) or 0xffffffffUL (if limits.h is not included) will have
2866+
* limits.h is included) or 0xffffffffU (if limits.h is not included) will have
28672867
* the effect of resetting the task's notification value to 0. Setting
28682868
* ulBitsToClearOnEntry to 0 will leave the task's notification value unchanged.
28692869
*

portable/template/portmacro.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ typedef unsigned char UBaseType_t;
3434

3535
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
3636
typedef uint16_t TickType_t;
37-
#define portMAX_DELAY ( TickType_t ) 0xffff
37+
#define portMAX_DELAY ( TickType_t ) 0xffffU
3838
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
3939
typedef uint32_t TickType_t;
40-
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
40+
#define portMAX_DELAY ( TickType_t ) 0xffffffffU
4141
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
4242
typedef uint64_t TickType_t;
43-
#define portMAX_DELAY ( TickType_t ) 0xffffffffffffffff
43+
#define portMAX_DELAY ( TickType_t ) 0xffffffffffffffffU
4444
#else
4545
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
4646
#endif

tasks.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,11 @@
291291
* responsibility of whichever module is using the value to ensure it gets set back
292292
* to its original value when it is released. */
293293
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
294-
#define taskEVENT_LIST_ITEM_VALUE_IN_USE ( ( uint16_t ) 0x8000 )
294+
#define taskEVENT_LIST_ITEM_VALUE_IN_USE ( ( uint16_t ) 0x8000U )
295295
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
296-
#define taskEVENT_LIST_ITEM_VALUE_IN_USE ( ( uint32_t ) 0x80000000 )
296+
#define taskEVENT_LIST_ITEM_VALUE_IN_USE ( ( uint32_t ) 0x80000000U )
297297
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
298-
#define taskEVENT_LIST_ITEM_VALUE_IN_USE ( ( uint64_t ) 0x8000000000000000 )
298+
#define taskEVENT_LIST_ITEM_VALUE_IN_USE ( ( uint64_t ) 0x8000000000000000U )
299299
#endif
300300

301301
/* Indicates that the task is not actively running on any core. */
@@ -314,7 +314,7 @@
314314
#endif
315315

316316
/* Indicates that the task is an Idle task. */
317-
#define taskATTRIBUTE_IS_IDLE ( UBaseType_t ) ( 1UL << 0UL )
317+
#define taskATTRIBUTE_IS_IDLE ( UBaseType_t ) ( 1U << 0U )
318318

319319
#if ( ( configNUMBER_OF_CORES > 1 ) && ( portCRITICAL_NESTING_IN_TCB == 1 ) )
320320
#define portGET_CRITICAL_NESTING_COUNT() ( pxCurrentTCBs[ portGET_CORE_ID() ]->uxCriticalNesting )
@@ -1835,7 +1835,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
18351835
pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );
18361836

18371837
/* Check the alignment of the calculated top of stack is correct. */
1838-
configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
1838+
configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0U ) );
18391839

18401840
#if ( configRECORD_STACK_HIGH_ADDRESS == 1 )
18411841
{
@@ -1851,7 +1851,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
18511851
pxTopOfStack = ( StackType_t * ) ( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) + portBYTE_ALIGNMENT_MASK ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );
18521852

18531853
/* Check the alignment of the calculated top of stack is correct. */
1854-
configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
1854+
configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0U ) );
18551855

18561856
/* The other extreme of the stack space is required if stack checking is
18571857
* performed. */
@@ -2891,7 +2891,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
28912891

28922892
/* Only reset the event list item value if the value is not
28932893
* being used for anything else. */
2894-
if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0UL ) )
2894+
if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0U ) )
28952895
{
28962896
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) uxNewPriority ) );
28972897
}
@@ -6596,7 +6596,7 @@ static void prvResetNextTaskUnblockTime( void )
65966596
/* Adjust the mutex holder state to account for its new
65976597
* priority. Only reset the event list item value if the value is
65986598
* not being used for anything else. */
6599-
if( ( listGET_LIST_ITEM_VALUE( &( pxMutexHolderTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0UL ) )
6599+
if( ( listGET_LIST_ITEM_VALUE( &( pxMutexHolderTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0U ) )
66006600
{
66016601
listSET_LIST_ITEM_VALUE( &( pxMutexHolderTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxCurrentTCB->uxPriority );
66026602
}
@@ -6825,7 +6825,7 @@ static void prvResetNextTaskUnblockTime( void )
68256825

68266826
/* Only reset the event list item value if the value is not
68276827
* being used for anything else. */
6828-
if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0UL ) )
6828+
if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0U ) )
68296829
{
68306830
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) uxPriorityToUse );
68316831
}
@@ -7440,10 +7440,10 @@ static void prvResetNextTaskUnblockTime( void )
74407440
uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, &ulTotalTime );
74417441

74427442
/* For percentage calculations. */
7443-
ulTotalTime /= ( ( configRUN_TIME_COUNTER_TYPE ) 100UL );
7443+
ulTotalTime /= ( ( configRUN_TIME_COUNTER_TYPE ) 100U );
74447444

74457445
/* Avoid divide by zero errors. */
7446-
if( ulTotalTime > 0UL )
7446+
if( ulTotalTime > 0U )
74477447
{
74487448
/* Create a human readable table from the binary data. */
74497449
for( x = 0; x < uxArraySize; x++ )
@@ -7469,7 +7469,7 @@ static void prvResetNextTaskUnblockTime( void )
74697469
* character. */
74707470
if( uxConsumedBufferLength < ( uxBufferLength - 1U ) )
74717471
{
7472-
if( ulStatsAsPercentage > 0UL )
7472+
if( ulStatsAsPercentage > 0U )
74737473
{
74747474
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
74757475
{
@@ -7633,7 +7633,7 @@ TickType_t uxTaskResetEventItemValue( void )
76337633
taskENTER_CRITICAL();
76347634
{
76357635
/* Only block if the notification count is not already non-zero. */
7636-
if( pxCurrentTCB->ulNotifiedValue[ uxIndexToWaitOn ] == 0UL )
7636+
if( pxCurrentTCB->ulNotifiedValue[ uxIndexToWaitOn ] == 0U )
76377637
{
76387638
/* Mark this task as waiting for a notification. */
76397639
pxCurrentTCB->ucNotifyState[ uxIndexToWaitOn ] = taskWAITING_NOTIFICATION;
@@ -7684,11 +7684,11 @@ TickType_t uxTaskResetEventItemValue( void )
76847684
traceTASK_NOTIFY_TAKE( uxIndexToWaitOn );
76857685
ulReturn = pxCurrentTCB->ulNotifiedValue[ uxIndexToWaitOn ];
76867686

7687-
if( ulReturn != 0UL )
7687+
if( ulReturn != 0U )
76887688
{
76897689
if( xClearCountOnExit != pdFALSE )
76907690
{
7691-
pxCurrentTCB->ulNotifiedValue[ uxIndexToWaitOn ] = ( uint32_t ) 0UL;
7691+
pxCurrentTCB->ulNotifiedValue[ uxIndexToWaitOn ] = ( uint32_t ) 0U;
76927692
}
76937693
else
76947694
{

0 commit comments

Comments
 (0)