From dd68cb84a6a632842c142cab95d7d29e09294501 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Mon, 1 Aug 2011 08:00:17 +0000 Subject: [PATCH] A few updates for coding standard reasons. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1526 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Source/queue.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/Source/queue.c b/Source/queue.c index 2ae7c7030..c2197b7c2 100644 --- a/Source/queue.c +++ b/Source/queue.c @@ -67,7 +67,10 @@ task.h is included from an application file. */ #include "FreeRTOS.h" #include "task.h" -#include "croutine.h" + +#if ( configUSE_CO_ROUTINES == 1 ) + #include "croutine.h" +#endif #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE @@ -93,9 +96,9 @@ task.h is included from an application file. */ /* Semaphores do not actually store or copy data, so have an items size of zero. */ -#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( 0 ) -#define queueDONT_BLOCK ( ( portTickType ) 0 ) -#define queueMUTEX_GIVE_BLOCK_TIME ( ( portTickType ) 0 ) +#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( ( unsigned portBASE_TYPE ) 0 ) +#define queueDONT_BLOCK ( ( portTickType ) 0U ) +#define queueMUTEX_GIVE_BLOCK_TIME ( ( portTickType ) 0U ) /* * Definition of the queue used by the scheduler. @@ -539,7 +542,7 @@ xTimeOutType xTimeOut; /* Update the timeout state to see if it has expired yet. */ if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) { - if( prvIsQueueFull( pxQueue ) ) + if( prvIsQueueFull( pxQueue ) != pdFALSE ) { traceBLOCKING_ON_QUEUE_SEND( pxQueue ); vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait ); @@ -556,7 +559,7 @@ xTimeOutType xTimeOut; task is already in a ready list before it yields - in which case the yield will not cause a context switch unless there is also a higher priority task in the pending ready list. */ - if( !xTaskResumeAll() ) + if( xTaskResumeAll() == pdFALSE ) { portYIELD_WITHIN_API(); } @@ -639,7 +642,7 @@ xTimeOutType xTimeOut; { if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) { - if( prvIsQueueFull( pxQueue ) ) + if( prvIsQueueFull( pxQueue ) != pdFALSE ) { traceBLOCKING_ON_QUEUE_SEND( pxQueue ); vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait ); @@ -755,7 +758,7 @@ xTimeOutType xTimeOut; { if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) { - if( prvIsQueueEmpty( pxQueue ) ) + if( prvIsQueueEmpty( pxQueue ) != pdFALSE ) { traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ); @@ -954,7 +957,7 @@ signed char *pcOriginalReadPosition; /* Update the timeout state to see if it has expired yet. */ if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) { - if( prvIsQueueEmpty( pxQueue ) ) + if( prvIsQueueEmpty( pxQueue ) != pdFALSE ) { traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ); @@ -973,7 +976,7 @@ signed char *pcOriginalReadPosition; vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait ); prvUnlockQueue( pxQueue ); - if( !xTaskResumeAll() ) + if( xTaskResumeAll() == pdFALSE ) { portYIELD_WITHIN_API(); } @@ -1260,7 +1263,7 @@ signed portBASE_TYPE xReturn; between the check to see if the queue is full and blocking on the queue. */ portDISABLE_INTERRUPTS(); { - if( prvIsQueueFull( pxQueue ) ) + if( prvIsQueueFull( pxQueue ) != pdFALSE ) { /* The queue is full - do we want to block or just leave without posting? */ @@ -1404,7 +1407,7 @@ signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle pxQueue, const void *pvIt /* We only want to wake one co-routine per ISR, so check that a co-routine has not already been woken. */ - if( !xCoRoutinePreviouslyWoken ) + if( xCoRoutinePreviouslyWoken == pdFALSE ) { if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) { @@ -1439,7 +1442,7 @@ signed portBASE_TYPE xReturn; --( pxQueue->uxMessagesWaiting ); memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->pcReadFrom, ( unsigned ) pxQueue->uxItemSize ); - if( !( *pxCoRoutineWoken ) ) + if( ( *pxCoRoutineWoken ) == pdFALSE ) { if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) { @@ -1470,7 +1473,7 @@ signed portBASE_TYPE xReturn; /* See if there is an empty space in the registry. A NULL name denotes a free slot. */ - for( ux = ( unsigned portBASE_TYPE ) 0U; ux < configQUEUE_REGISTRY_SIZE; ux++ ) + for( ux = ( unsigned portBASE_TYPE ) 0U; ux < ( unsigned portBASE_TYPE ) configQUEUE_REGISTRY_SIZE; ux++ ) { if( xQueueRegistry[ ux ].pcQueueName == NULL ) { @@ -1493,7 +1496,7 @@ signed portBASE_TYPE xReturn; /* See if the handle of the queue being unregistered in actually in the registry. */ - for( ux = ( unsigned portBASE_TYPE ) 0U; ux < configQUEUE_REGISTRY_SIZE; ux++ ) + for( ux = ( unsigned portBASE_TYPE ) 0U; ux < ( unsigned portBASE_TYPE ) configQUEUE_REGISTRY_SIZE; ux++ ) { if( xQueueRegistry[ ux ].xHandle == xQueue ) { -- 2.39.5