]> git.sur5r.net Git - freertos/blobdiff - Source/queue.c
Tidy up the RL78 port layer.
[freertos] / Source / queue.c
index 8eaaae4ac77165628b28b5a256555b5e43d1547d..c2197b7c2e1188331db814ea94716cc6143d4a5c 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.0.0 - Copyright (C) 2011 Real Time Engineers Ltd.\r
+    FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.\r
        \r
 \r
        FreeRTOS supports many tools and architectures. V7.0.0 is sponsored by:\r
@@ -67,7 +67,10 @@ task.h is included from an application file. */
 \r
 #include "FreeRTOS.h"\r
 #include "task.h"\r
-#include "croutine.h"\r
+\r
+#if ( configUSE_CO_ROUTINES == 1 )\r
+       #include "croutine.h"\r
+#endif\r
 \r
 #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE\r
 \r
@@ -93,9 +96,9 @@ task.h is included from an application file. */
 \r
 /* Semaphores do not actually store or copy data, so have an items size of\r
 zero. */\r
-#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( 0 )\r
-#define queueDONT_BLOCK                                         ( ( portTickType ) 0 )\r
-#define queueMUTEX_GIVE_BLOCK_TIME              ( ( portTickType ) 0 )\r
+#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( ( unsigned portBASE_TYPE ) 0 )\r
+#define queueDONT_BLOCK                                         ( ( portTickType ) 0U )\r
+#define queueMUTEX_GIVE_BLOCK_TIME              ( ( portTickType ) 0U )\r
 \r
 /*\r
  * Definition of the queue used by the scheduler.\r
@@ -539,7 +542,7 @@ xTimeOutType xTimeOut;
                /* Update the timeout state to see if it has expired yet. */\r
                if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE )\r
                {\r
-                       if( prvIsQueueFull( pxQueue ) )\r
+                       if( prvIsQueueFull( pxQueue ) != pdFALSE )\r
                        {\r
                                traceBLOCKING_ON_QUEUE_SEND( pxQueue );\r
                                vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait );\r
@@ -556,7 +559,7 @@ xTimeOutType xTimeOut;
                                task is already in a ready list before it yields - in which\r
                                case the yield will not cause a context switch unless there\r
                                is also a higher priority task in the pending ready list. */\r
-                               if( !xTaskResumeAll() )\r
+                               if( xTaskResumeAll() == pdFALSE )\r
                                {\r
                                        portYIELD_WITHIN_API();\r
                                }\r
@@ -639,7 +642,7 @@ xTimeOutType xTimeOut;
                        {\r
                                if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE )\r
                                {\r
-                                       if( prvIsQueueFull( pxQueue ) )\r
+                                       if( prvIsQueueFull( pxQueue ) != pdFALSE )\r
                                        {\r
                                                traceBLOCKING_ON_QUEUE_SEND( pxQueue );\r
                                                vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait );\r
@@ -755,7 +758,7 @@ xTimeOutType xTimeOut;
                        {\r
                                if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE )\r
                                {\r
-                                       if( prvIsQueueEmpty( pxQueue ) )\r
+                                       if( prvIsQueueEmpty( pxQueue ) != pdFALSE )\r
                                        {\r
                                                traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue );\r
 \r
@@ -954,7 +957,7 @@ signed char *pcOriginalReadPosition;
                /* Update the timeout state to see if it has expired yet. */\r
                if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE )\r
                {\r
-                       if( prvIsQueueEmpty( pxQueue ) )\r
+                       if( prvIsQueueEmpty( pxQueue ) != pdFALSE )\r
                        {\r
                                traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue );\r
 \r
@@ -973,7 +976,7 @@ signed char *pcOriginalReadPosition;
 \r
                                vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );\r
                                prvUnlockQueue( pxQueue );\r
-                               if( !xTaskResumeAll() )\r
+                               if( xTaskResumeAll() == pdFALSE )\r
                                {\r
                                        portYIELD_WITHIN_API();\r
                                }\r
@@ -1260,7 +1263,7 @@ signed portBASE_TYPE xReturn;
        between the check to see if the queue is full and blocking on the queue. */\r
        portDISABLE_INTERRUPTS();\r
        {\r
-               if( prvIsQueueFull( pxQueue ) )\r
+               if( prvIsQueueFull( pxQueue ) != pdFALSE )\r
                {\r
                        /* The queue is full - do we want to block or just leave without\r
                        posting? */\r
@@ -1404,7 +1407,7 @@ signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle pxQueue, const void *pvIt
 \r
                /* We only want to wake one co-routine per ISR, so check that a\r
                co-routine has not already been woken. */\r
-               if( !xCoRoutinePreviouslyWoken )\r
+               if( xCoRoutinePreviouslyWoken == pdFALSE )\r
                {\r
                        if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )\r
                        {\r
@@ -1439,7 +1442,7 @@ signed portBASE_TYPE xReturn;
                --( pxQueue->uxMessagesWaiting );\r
                memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->pcReadFrom, ( unsigned ) pxQueue->uxItemSize );\r
 \r
-               if( !( *pxCoRoutineWoken ) )\r
+               if( ( *pxCoRoutineWoken ) == pdFALSE )\r
                {\r
                        if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )\r
                        {\r
@@ -1470,7 +1473,7 @@ signed portBASE_TYPE xReturn;
 \r
                /* See if there is an empty space in the registry.  A NULL name denotes\r
                a free slot. */\r
-               for( ux = ( unsigned portBASE_TYPE ) 0U; ux < configQUEUE_REGISTRY_SIZE; ux++ )\r
+               for( ux = ( unsigned portBASE_TYPE ) 0U; ux < ( unsigned portBASE_TYPE ) configQUEUE_REGISTRY_SIZE; ux++ )\r
                {\r
                        if( xQueueRegistry[ ux ].pcQueueName == NULL )\r
                        {\r
@@ -1493,7 +1496,7 @@ signed portBASE_TYPE xReturn;
 \r
                /* See if the handle of the queue being unregistered in actually in the\r
                registry. */\r
-               for( ux = ( unsigned portBASE_TYPE ) 0U; ux < configQUEUE_REGISTRY_SIZE; ux++ )\r
+               for( ux = ( unsigned portBASE_TYPE ) 0U; ux < ( unsigned portBASE_TYPE ) configQUEUE_REGISTRY_SIZE; ux++ )\r
                {\r
                        if( xQueueRegistry[ ux ].xHandle == xQueue )\r
                        {\r