]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/queue.c
Update version number to V8.0.0 (without the release candidate number).
[freertos] / FreeRTOS / Source / queue.c
index 8a9b1cfdf28b2d1694fa3dd4f2b9fdd438240148..b571297254f92c1168bfead0d071cdcf8bcfa7c1 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
@@ -86,7 +86,7 @@ privileged Vs unprivileged linkage and placement. */
 #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */\r
 \r
 \r
-/* Constants used with the cRxLock and xTxLock structure members. */\r
+/* Constants used with the xRxLock and xTxLock structure members. */\r
 #define queueUNLOCKED                                  ( ( BaseType_t ) -1 )\r
 #define queueLOCKED_UNMODIFIED                 ( ( BaseType_t ) 0 )\r
 \r
@@ -167,7 +167,7 @@ typedef struct QueueDefinition
        more user friendly. */\r
        typedef struct QUEUE_REGISTRY_ITEM\r
        {\r
-               char *pcQueueName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+               const char *pcQueueName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
                QueueHandle_t xHandle;\r
        } QueueRegistryItem_t;\r
 \r
@@ -512,7 +512,7 @@ QueueHandle_t xReturn = NULL;
 \r
 #if ( configUSE_RECURSIVE_MUTEXES == 1 )\r
 \r
-       BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xBlockTime )\r
+       BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWait )\r
        {\r
        BaseType_t xReturn;\r
        Queue_t * const pxMutex = ( Queue_t * ) xMutex;\r
@@ -531,7 +531,7 @@ QueueHandle_t xReturn = NULL;
                }\r
                else\r
                {\r
-                       xReturn = xQueueGenericReceive( pxMutex, NULL, xBlockTime, pdFALSE );\r
+                       xReturn = xQueueGenericReceive( pxMutex, NULL, xTicksToWait, pdFALSE );\r
 \r
                        /* pdPASS will only be returned if we successfully obtained the mutex,\r
                        we may have blocked to reach here. */\r
@@ -1038,11 +1038,11 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
        link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
        portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
 \r
-       /* Similar to xQueueGenericSend, except we don't block if there is no room\r
-       in the queue.  Also we don't directly wake a task that was blocked on a\r
-       queue read, instead we return a flag to say whether a context switch is\r
-       required or not (i.e. has a task with a higher priority than us been woken\r
-       by this post). */\r
+       /* Similar to xQueueGenericSend, except without blocking if there is no room\r
+       in the queue.  Also don't directly wake a task that was blocked on a queue\r
+       read, instead return a flag to say whether a context switch is required or \r
+       not (i.e. has a task with a higher priority than us been woken by this \r
+       post). */\r
        uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
        {\r
                if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )\r
@@ -1051,7 +1051,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
 \r
                        prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );\r
 \r
-                       /* If the queue is locked we do not alter the event list.  This will\r
+                       /* The event list is not altered if the queue is locked.  This will\r
                        be done when the queue is unlocked later. */\r
                        if( pxQueue->xTxLock == queueUNLOCKED )\r
                        {\r
@@ -2143,7 +2143,7 @@ BaseType_t xReturn;
 \r
 #if ( configQUEUE_REGISTRY_SIZE > 0 )\r
 \r
-       void vQueueAddToRegistry( QueueHandle_t xQueue, char *pcQueueName ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+       void vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcQueueName ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
        {\r
        UBaseType_t ux;\r
 \r
@@ -2156,6 +2156,8 @@ BaseType_t xReturn;
                                /* Store the information on this queue. */\r
                                xQueueRegistry[ ux ].pcQueueName = pcQueueName;\r
                                xQueueRegistry[ ux ].xHandle = xQueue;\r
+\r
+                               traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName );\r
                                break;\r
                        }\r
                        else\r
@@ -2251,26 +2253,26 @@ BaseType_t xReturn;
        {\r
        BaseType_t xReturn;\r
 \r
-               if( ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL )\r
-               {\r
-                       /* Cannot add a queue/semaphore to more than one queue set. */\r
-                       xReturn = pdFAIL;\r
-               }\r
-               else if( ( ( Queue_t * ) xQueueOrSemaphore )->uxMessagesWaiting != ( UBaseType_t ) 0 )\r
-               {\r
-                       /* Cannot add a queue/semaphore to a queue set if there are already\r
-                       items in the queue/semaphore. */\r
-                       xReturn = pdFAIL;\r
-               }\r
-               else\r
+               taskENTER_CRITICAL();\r
                {\r
-                       taskENTER_CRITICAL();\r
+                       if( ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL )\r
+                       {\r
+                               /* Cannot add a queue/semaphore to more than one queue set. */\r
+                               xReturn = pdFAIL;\r
+                       }\r
+                       else if( ( ( Queue_t * ) xQueueOrSemaphore )->uxMessagesWaiting != ( UBaseType_t ) 0 )\r
+                       {\r
+                               /* Cannot add a queue/semaphore to a queue set if there are already\r
+                               items in the queue/semaphore. */\r
+                               xReturn = pdFAIL;\r
+                       }\r
+                       else\r
                        {\r
                                ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer = xQueueSet;\r
+                               xReturn = pdPASS;\r
                        }\r
-                       taskEXIT_CRITICAL();\r
-                       xReturn = pdPASS;\r
                }\r
+               taskEXIT_CRITICAL();\r
 \r
                return xReturn;\r
        }\r
@@ -2316,11 +2318,11 @@ BaseType_t xReturn;
 \r
 #if ( configUSE_QUEUE_SETS == 1 )\r
 \r
-       QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TickType_t const xBlockTimeTicks )\r
+       QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TickType_t const xTicksToWait )\r
        {\r
        QueueSetMemberHandle_t xReturn = NULL;\r
 \r
-               ( void ) xQueueGenericReceive( ( QueueHandle_t ) xQueueSet, &xReturn, xBlockTimeTicks, pdFALSE ); /*lint !e961 Casting from one typedef to another is not redundant. */\r
+               ( void ) xQueueGenericReceive( ( QueueHandle_t ) xQueueSet, &xReturn, xTicksToWait, pdFALSE ); /*lint !e961 Casting from one typedef to another is not redundant. */\r
                return xReturn;\r
        }\r
 \r
@@ -2347,6 +2349,8 @@ BaseType_t xReturn;
        Queue_t *pxQueueSetContainer = pxQueue->pxQueueSetContainer;\r
        BaseType_t xReturn = pdFALSE;\r
 \r
+               /* This function must be called form a critical section. */\r
+       \r
                configASSERT( pxQueueSetContainer );\r
                configASSERT( pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength );\r
 \r