diff options
author | chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> | 2023-11-28 14:21:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-28 14:21:03 +0300 |
commit | 1813a4551e4edbba215b6f1cb3c484c41d369f96 (patch) | |
tree | cdd5d5dde9853bb162e8e64074e9f092ad56dc42 /tasks.c | |
parent | ce88adea2a043dca6104e4fd80b920166cade8c8 (diff) |
Fix MISRA 2012 rule 10.4 violations (#852)
Fix MISRA 2012 rule 10.4 violations
Diffstat (limited to 'tasks.c')
-rw-r--r-- | tasks.c | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -962,7 +962,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; #if ( configRUN_MULTIPLE_PRIORITIES == 0 ) /* Verify that the calling core always yields to higher priority tasks. */ - if( ( ( pxCurrentTCBs[ portGET_CORE_ID() ]->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) == 0 ) && + if( ( ( pxCurrentTCBs[ portGET_CORE_ID() ]->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) == 0U ) && ( pxTCB->uxPriority > pxCurrentTCBs[ portGET_CORE_ID() ]->uxPriority ) ) { configASSERT( ( xYieldPendings[ portGET_CORE_ID() ] == pdTRUE ) || @@ -1044,7 +1044,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; * idle tasks, not user tasks at the idle priority. */ if( uxCurrentPriority < uxTopReadyPriority ) { - if( ( pxTCB->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) == 0 ) + if( ( pxTCB->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) == 0U ) { continue; } @@ -1136,7 +1136,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; for( x = ( BaseType_t ) 0; x < ( BaseType_t ) configNUMBER_OF_CORES; x++ ) { - if( ( pxCurrentTCBs[ x ]->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0 ) + if( ( pxCurrentTCBs[ x ]->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0U ) { prvYieldCore( x ); } @@ -1854,7 +1854,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, /* Ensure the name string is terminated in the case that the string length * was greater or equal to configMAX_TASK_NAME_LEN. */ - pxNewTCB->pcTaskName[ configMAX_TASK_NAME_LEN - 1 ] = '\0'; + pxNewTCB->pcTaskName[ configMAX_TASK_NAME_LEN - 1U ] = '\0'; } else { @@ -2165,7 +2165,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, * large to hold the generated string. Return the * number of characters actually written without * counting the terminating NULL character. */ - uxCharsWritten = n - 1; + uxCharsWritten = n - 1U; } else { @@ -3873,7 +3873,7 @@ void vTaskSuspendAll( void ) { xReturn = 0; } - else if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > 1 ) + else if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > 1U ) { /* There are other idle priority tasks in the ready state. If * time slicing is used then the very next tick interrupt must be @@ -4813,7 +4813,7 @@ BaseType_t xTaskIncrementTick( void ) { #if ( configNUMBER_OF_CORES == 1 ) { - if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB->uxPriority ] ) ) > ( UBaseType_t ) 1 ) + if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB->uxPriority ] ) ) > 1U ) { xSwitchRequired = pdTRUE; } @@ -4828,7 +4828,7 @@ BaseType_t xTaskIncrementTick( void ) for( xCoreID = 0; xCoreID < ( ( BaseType_t ) configNUMBER_OF_CORES ); xCoreID++ ) { - if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCBs[ xCoreID ]->uxPriority ] ) ) > 1 ) + if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCBs[ xCoreID ]->uxPriority ] ) ) > 1U ) { xYieldRequiredForCore[ xCoreID ] = pdTRUE; } @@ -5807,7 +5807,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) * valid. */ xExpectedIdleTime = prvGetExpectedIdleTime(); - if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP ) + if( xExpectedIdleTime >= ( TickType_t ) configEXPECTED_IDLE_TIME_BEFORE_SLEEP ) { vTaskSuspendAll(); { @@ -5822,7 +5822,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) * portSUPPRESS_TICKS_AND_SLEEP() to be called. */ configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( xExpectedIdleTime ); - if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP ) + if( xExpectedIdleTime >= ( TickType_t ) configEXPECTED_IDLE_TIME_BEFORE_SLEEP ) { traceLOW_POWER_IDLE_BEGIN(); portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ); @@ -5874,7 +5874,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) /* This function must be called from a critical section. */ - if( listCURRENT_LIST_LENGTH( &xPendingReadyList ) != 0 ) + if( listCURRENT_LIST_LENGTH( &xPendingReadyList ) != 0U ) { /* A task was made ready while the scheduler was suspended. */ eReturn = eAbortSleep; @@ -5884,7 +5884,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) /* A yield was pended while the scheduler was suspended. */ eReturn = eAbortSleep; } - else if( xPendedTicks != 0 ) + else if( xPendedTicks != 0U ) { /* A tick interrupt has already occurred but was held pending * because the scheduler is suspended. */ @@ -6898,7 +6898,7 @@ static void prvResetNextTaskUnblockTime( void ) * interrupt. Only assert if the critical nesting count is 1 to * protect against recursive calls if the assert function also uses a * critical section. */ - if( pxCurrentTCB->uxCriticalNesting == 1 ) + if( pxCurrentTCB->uxCriticalNesting == 1U ) { portASSERT_IF_IN_ISR(); } @@ -7269,13 +7269,13 @@ static void prvResetNextTaskUnblockTime( void ) * can be printed in tabular form more easily. */ pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName ); /* Do not count the terminating null character. */ - uxConsumedBufferLength = uxConsumedBufferLength + ( configMAX_TASK_NAME_LEN - 1 ); + uxConsumedBufferLength = uxConsumedBufferLength + ( configMAX_TASK_NAME_LEN - 1U ); /* Is there space left in the buffer? -1 is done because snprintf * writes a terminating null character. So we are essentially * checking if the buffer has space to write at least one non-null * character. */ - if( uxConsumedBufferLength < ( uxBufferLength - 1 ) ) + if( uxConsumedBufferLength < ( uxBufferLength - 1U ) ) { /* Write the rest of the string. */ #if ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) @@ -7411,13 +7411,13 @@ static void prvResetNextTaskUnblockTime( void ) * easily. */ pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName ); /* Do not count the terminating null character. */ - uxConsumedBufferLength = uxConsumedBufferLength + ( configMAX_TASK_NAME_LEN - 1 ); + uxConsumedBufferLength = uxConsumedBufferLength + ( configMAX_TASK_NAME_LEN - 1U ); /* Is there space left in the buffer? -1 is done because snprintf * writes a terminating null character. So we are essentially * checking if the buffer has space to write at least one non-null * character. */ - if( uxConsumedBufferLength < ( uxBufferLength - 1 ) ) + if( uxConsumedBufferLength < ( uxBufferLength - 1U ) ) { if( ulStatsAsPercentage > 0UL ) { |