\r
#if ( INCLUDE_vTaskDelete == 1 )\r
\r
- PRIVILEGED_DATA static volatile xList xTasksWaitingTermination; /*< Tasks that have been deleted - but the their memory not yet freed. */\r
- PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxTasksDeleted = ( unsigned portBASE_TYPE ) 0;\r
+ PRIVILEGED_DATA static xList xTasksWaitingTermination; /*< Tasks that have been deleted - but the their memory not yet freed. */\r
+ PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxTasksDeleted = ( unsigned portBASE_TYPE ) 0U;\r
\r
#endif\r
\r
#endif\r
\r
/* File private variables. --------------------------------*/\r
-PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxCurrentNumberOfTasks = ( unsigned portBASE_TYPE ) 0;\r
-PRIVILEGED_DATA static volatile portTickType xTickCount = ( portTickType ) 0;\r
+PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxCurrentNumberOfTasks = ( unsigned portBASE_TYPE ) 0U;\r
+PRIVILEGED_DATA static volatile portTickType xTickCount = ( portTickType ) 0U;\r
PRIVILEGED_DATA static unsigned portBASE_TYPE uxTopUsedPriority = tskIDLE_PRIORITY;\r
PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxTopReadyPriority = tskIDLE_PRIORITY;\r
PRIVILEGED_DATA static volatile signed portBASE_TYPE xSchedulerRunning = pdFALSE;\r
PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxSchedulerSuspended = ( unsigned portBASE_TYPE ) pdFALSE;\r
-PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxMissedTicks = ( unsigned portBASE_TYPE ) 0;\r
+PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxMissedTicks = ( unsigned portBASE_TYPE ) 0U;\r
PRIVILEGED_DATA static volatile portBASE_TYPE xMissedYield = ( portBASE_TYPE ) pdFALSE;\r
PRIVILEGED_DATA static volatile portBASE_TYPE xNumOfOverflows = ( portBASE_TYPE ) 0;\r
-PRIVILEGED_DATA static unsigned portBASE_TYPE uxTaskNumber = ( unsigned portBASE_TYPE ) 0;\r
+PRIVILEGED_DATA static unsigned portBASE_TYPE uxTaskNumber = ( unsigned portBASE_TYPE ) 0U;\r
PRIVILEGED_DATA static portTickType xNextTaskUnblockTime = ( portTickType ) portMAX_DELAY;\r
\r
#if ( configGENERATE_RUN_TIME_STATS == 1 )\r
\r
#define vWriteTraceToBuffer() \\r
{ \\r
- if( xTracing ) \\r
+ if( xTracing != pdFALSE ) \\r
{ \\r
if( uxPreviousTask != pxCurrentTCB->uxTCBNumber ) \\r
{ \\r
vListRemove( &( pxTCB->xGenericListItem ) ); \\r
\\r
/* Is the task waiting on an event also? */ \\r
- if( pxTCB->xEventListItem.pvContainer ) \\r
+ if( pxTCB->xEventListItem.pvContainer != NULL ) \\r
{ \\r
vListRemove( &( pxTCB->xEventListItem ) ); \\r
} \\r
* This does not free memory allocated by the task itself (i.e. memory\r
* allocated by calls to pvPortMalloc from within the tasks application code).\r
*/\r
-#if ( ( INCLUDE_vTaskDelete == 1 ) || ( INCLUDE_vTaskCleanUpResources == 1 ) )\r
+#if ( INCLUDE_vTaskDelete == 1 )\r
\r
static void prvDeleteTCB( tskTCB *pxTCB ) PRIVILEGED_FUNCTION;\r
\r
#if( portUSING_MPU_WRAPPERS == 1 )\r
/* Should the task be created in privileged mode? */\r
portBASE_TYPE xRunPrivileged;\r
- if( ( uxPriority & portPRIVILEGE_BIT ) != 0x00 )\r
+ if( ( uxPriority & portPRIVILEGE_BIT ) != 0U )\r
{\r
xRunPrivileged = pdTRUE;\r
}\r
vListRemove( &( pxTCB->xGenericListItem ) );\r
\r
/* Is the task waiting on an event also? */\r
- if( pxTCB->xEventListItem.pvContainer )\r
+ if( pxTCB->xEventListItem.pvContainer != NULL )\r
{\r
vListRemove( &( pxTCB->xEventListItem ) );\r
}\r
portBASE_TYPE xAlreadyYielded, xShouldDelay = pdFALSE;\r
\r
configASSERT( pxPreviousWakeTime );\r
- configASSERT( ( xTimeIncrement > 0 ) );\r
+ configASSERT( ( xTimeIncrement > 0U ) );\r
\r
vTaskSuspendAll();\r
{\r
\r
/* Force a reschedule if xTaskResumeAll has not already done so, we may\r
have put ourselves to sleep. */\r
- if( !xAlreadyYielded )\r
+ if( xAlreadyYielded == pdFALSE )\r
{\r
portYIELD_WITHIN_API();\r
}\r
signed portBASE_TYPE xAlreadyYielded = pdFALSE;\r
\r
/* A delay time of zero just forces a reschedule. */\r
- if( xTicksToDelay > ( portTickType ) 0 )\r
+ if( xTicksToDelay > ( portTickType ) 0U )\r
{\r
vTaskSuspendAll();\r
{\r
\r
/* Force a reschedule if xTaskResumeAll has not already done so, we may\r
have put ourselves to sleep. */\r
- if( !xAlreadyYielded )\r
+ if( xAlreadyYielded == pdFALSE )\r
{\r
portYIELD_WITHIN_API();\r
}\r
vListRemove( &( pxTCB->xGenericListItem ) );\r
\r
/* Is the task waiting on an event also? */\r
- if( pxTCB->xEventListItem.pvContainer )\r
+ if( pxTCB->xEventListItem.pvContainer != NULL )\r
{\r
vListRemove( &( pxTCB->xEventListItem ) );\r
}\r
portDISABLE_INTERRUPTS();\r
\r
xSchedulerRunning = pdTRUE;\r
- xTickCount = ( portTickType ) 0;\r
+ xTickCount = ( portTickType ) 0U;\r
\r
/* If configGENERATE_RUN_TIME_STATS is defined then the following\r
macro must be defined to configure the timer/counter used to generate\r
\r
/* Setting up the timer tick is hardware specific and thus in the\r
portable interface. */\r
- if( xPortStartScheduler() )\r
+ if( xPortStartScheduler() != pdFALSE )\r
{\r
/* Should not reach here as if the scheduler is running the\r
function will not return. */\r
\r
if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )\r
{\r
- if( uxCurrentNumberOfTasks > ( unsigned portBASE_TYPE ) 0 )\r
+ if( uxCurrentNumberOfTasks > ( unsigned portBASE_TYPE ) 0U )\r
{\r
portBASE_TYPE xYieldRequired = pdFALSE;\r
\r
/* If any ticks occurred while the scheduler was suspended then\r
they should be processed now. This ensures the tick count does not\r
slip, and that any delayed tasks are resumed at the correct time. */\r
- if( uxMissedTicks > ( unsigned portBASE_TYPE ) 0 )\r
+ if( uxMissedTicks > ( unsigned portBASE_TYPE ) 0U )\r
{\r
- while( uxMissedTicks > ( unsigned portBASE_TYPE ) 0 )\r
+ while( uxMissedTicks > ( unsigned portBASE_TYPE ) 0U )\r
{\r
vTaskIncrementTick();\r
--uxMissedTicks;\r
{\r
if( listLIST_IS_EMPTY( &xTasksWaitingTermination ) == pdFALSE )\r
{\r
- prvListTaskWithinSingleList( pcWriteBuffer, ( xList * ) &xTasksWaitingTermination, tskDELETED_CHAR );\r
+ prvListTaskWithinSingleList( pcWriteBuffer, &xTasksWaitingTermination, tskDELETED_CHAR );\r
}\r
}\r
#endif\r
{\r
if( listLIST_IS_EMPTY( &xSuspendedTaskList ) == pdFALSE )\r
{\r
- prvListTaskWithinSingleList( pcWriteBuffer, ( xList * ) &xSuspendedTaskList, tskSUSPENDED_CHAR );\r
+ prvListTaskWithinSingleList( pcWriteBuffer, &xSuspendedTaskList, tskSUSPENDED_CHAR );\r
}\r
}\r
#endif\r
{\r
if( listLIST_IS_EMPTY( &xTasksWaitingTermination ) == pdFALSE )\r
{\r
- prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, ( xList * ) &xTasksWaitingTermination, ulTotalRunTime );\r
+ prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, &xTasksWaitingTermination, ulTotalRunTime );\r
}\r
}\r
#endif\r
{\r
if( listLIST_IS_EMPTY( &xSuspendedTaskList ) == pdFALSE )\r
{\r
- prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, ( xList * ) &xSuspendedTaskList, ulTotalRunTime );\r
+ prvGenerateRunTimeStatsForTasksInList( pcWriteBuffer, &xSuspendedTaskList, ulTotalRunTime );\r
}\r
}\r
#endif\r
* documented in task.h\r
*----------------------------------------------------------*/\r
\r
-\r
void vTaskIncrementTick( void )\r
{\r
tskTCB * pxTCB;\r
if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )\r
{\r
++xTickCount;\r
- if( xTickCount == ( portTickType ) 0 )\r
+ if( xTickCount == ( portTickType ) 0U )\r
{\r
xList *pxTemp;\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-#if ( ( INCLUDE_vTaskCleanUpResources == 1 ) && ( INCLUDE_vTaskSuspend == 1 ) )\r
-\r
- void vTaskCleanUpResources( void )\r
- {\r
- unsigned short usQueue;\r
- volatile tskTCB *pxTCB;\r
-\r
- usQueue = ( unsigned short ) uxTopUsedPriority + ( unsigned short ) 1;\r
-\r
- /* Remove any TCB's from the ready queues. */\r
- do\r
- {\r
- usQueue--;\r
-\r
- while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ usQueue ] ) ) == pdFALSE )\r
- {\r
- listGET_OWNER_OF_NEXT_ENTRY( pxTCB, &( pxReadyTasksLists[ usQueue ] ) );\r
- vListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) );\r
-\r
- prvDeleteTCB( ( tskTCB * ) pxTCB );\r
- }\r
- }while( usQueue > ( unsigned short ) tskIDLE_PRIORITY );\r
-\r
- /* Remove any TCB's from the delayed queue. */\r
- while( listLIST_IS_EMPTY( &xDelayedTaskList1 ) == pdFALSE )\r
- {\r
- listGET_OWNER_OF_NEXT_ENTRY( pxTCB, &xDelayedTaskList1 );\r
- vListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) );\r
-\r
- prvDeleteTCB( ( tskTCB * ) pxTCB );\r
- }\r
-\r
- /* Remove any TCB's from the overflow delayed queue. */\r
- while( listLIST_IS_EMPTY( &xDelayedTaskList2 ) == pdFALSE )\r
- {\r
- listGET_OWNER_OF_NEXT_ENTRY( pxTCB, &xDelayedTaskList2 );\r
- vListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) );\r
-\r
- prvDeleteTCB( ( tskTCB * ) pxTCB );\r
- }\r
-\r
- while( listLIST_IS_EMPTY( &xSuspendedTaskList ) == pdFALSE )\r
- {\r
- listGET_OWNER_OF_NEXT_ENTRY( pxTCB, &xSuspendedTaskList );\r
- vListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) );\r
-\r
- prvDeleteTCB( ( tskTCB * ) pxTCB );\r
- }\r
- }\r
-\r
-#endif\r
-/*-----------------------------------------------------------*/\r
-\r
#if ( configUSE_APPLICATION_TASK_TAG == 1 )\r
\r
void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction )\r
\r
#if ( portCRITICAL_NESTING_IN_TCB == 1 )\r
{\r
- pxTCB->uxCriticalNesting = ( unsigned portBASE_TYPE ) 0;\r
+ pxTCB->uxCriticalNesting = ( unsigned portBASE_TYPE ) 0U;\r
}\r
#endif\r
\r
\r
/* ucTasksDeleted is used to prevent vTaskSuspendAll() being called\r
too often in the idle task. */\r
- if( uxTasksDeleted > ( unsigned portBASE_TYPE ) 0 )\r
+ if( uxTasksDeleted > ( unsigned portBASE_TYPE ) 0U )\r
{\r
vTaskSuspendAll();\r
xListIsEmpty = listLIST_IS_EMPTY( &xTasksWaitingTermination );\r
else\r
{\r
/* Just to help debugging. */\r
- memset( pxNewTCB->pxStack, tskSTACK_FILL_BYTE, usStackDepth * sizeof( portSTACK_TYPE ) );\r
+ memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( portSTACK_TYPE ) );\r
}\r
}\r
\r
if( ulTotalRunTime > 0UL )\r
{\r
/* Has the task run at all? */\r
- if( pxNextTCB->ulRunTimeCounter == 0 )\r
+ if( pxNextTCB->ulRunTimeCounter == 0UL )\r
{\r
/* The task has used no CPU time at all. */\r
sprintf( pcStatsString, ( char * ) "%s\t\t0\t\t0%%\r\n", pxNextTCB->pcTaskName );\r
\r
static unsigned short usTaskCheckFreeStackSpace( const unsigned char * pucStackByte )\r
{\r
- register unsigned short usCount = 0;\r
+ register unsigned short usCount = 0U;\r
\r
while( *pucStackByte == tskSTACK_FILL_BYTE )\r
{\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
-#if ( ( INCLUDE_vTaskDelete == 1 ) || ( INCLUDE_vTaskCleanUpResources == 1 ) )\r
+#if ( INCLUDE_vTaskDelete == 1 )\r
\r
static void prvDeleteTCB( tskTCB *pxTCB )\r
{\r
\r
/* If the task being modified is in the ready state it will need to\r
be moved in to a new list. */\r
- if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) )\r
+ if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )\r
{\r
vListRemove( &( pxTCB->xGenericListItem ) );\r
\r
{\r
if( xSchedulerRunning != pdFALSE )\r
{\r
- if( pxCurrentTCB->uxCriticalNesting > 0 )\r
+ if( pxCurrentTCB->uxCriticalNesting > 0U )\r
{\r
( pxCurrentTCB->uxCriticalNesting )--;\r
\r
- if( pxCurrentTCB->uxCriticalNesting == 0 )\r
+ if( pxCurrentTCB->uxCriticalNesting == 0U )\r
{\r
portENABLE_INTERRUPTS();\r
}\r