/*\r
- FreeRTOS V9.0.0rc1 - Copyright (C) 2016 Real Time Engineers Ltd.\r
+ FreeRTOS V9.0.0rc2 - Copyright (C) 2016 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
{\r
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )\r
{\r
+ const int8_t cTxLock = pxQueue->cTxLock;\r
+\r
traceQUEUE_SEND_FROM_ISR( pxQueue );\r
\r
/* Semaphores use xQueueGiveFromISR(), so pxQueue will not be a\r
\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->cTxLock == queueUNLOCKED )\r
+ if( cTxLock == queueUNLOCKED )\r
{\r
#if ( configUSE_QUEUE_SETS == 1 )\r
{\r
{\r
/* Increment the lock count so the task that unlocks the queue\r
knows that data was posted while it was locked. */\r
- ++( pxQueue->cTxLock );\r
+ pxQueue->cTxLock = cTxLock + 1;\r
}\r
\r
xReturn = pdPASS;\r
\r
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
{\r
+ const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;\r
+\r
/* When the queue is used to implement a semaphore no data is ever\r
moved through the queue but it is still valid to see if the queue 'has\r
space'. */\r
- if( pxQueue->uxMessagesWaiting < pxQueue->uxLength )\r
+ if( uxMessagesWaiting < pxQueue->uxLength )\r
{\r
+ const int8_t cTxLock = pxQueue->cTxLock;\r
+\r
traceQUEUE_SEND_FROM_ISR( pxQueue );\r
\r
/* A task can only have an inherited priority if it is a mutex\r
can be assumed there is no mutex holder and no need to determine if\r
priority disinheritance is needed. Simply increase the count of\r
messages (semaphores) available. */\r
- ++( pxQueue->uxMessagesWaiting );\r
+ pxQueue->uxMessagesWaiting = uxMessagesWaiting + 1;\r
\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->cTxLock == queueUNLOCKED )\r
+ if( cTxLock == queueUNLOCKED )\r
{\r
#if ( configUSE_QUEUE_SETS == 1 )\r
{\r
{\r
/* Increment the lock count so the task that unlocks the queue\r
knows that data was posted while it was locked. */\r
- ++( pxQueue->cTxLock );\r
+ pxQueue->cTxLock = cTxLock + 1;\r
}\r
\r
xReturn = pdPASS;\r
{\r
taskENTER_CRITICAL();\r
{\r
+ const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;\r
+\r
/* Is there data in the queue now? To be running the calling task\r
must be the highest priority task wanting to access the queue. */\r
- if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )\r
+ if( uxMessagesWaiting > ( UBaseType_t ) 0 )\r
{\r
/* Remember the read position in case the queue is only being\r
peeked. */\r
traceQUEUE_RECEIVE( pxQueue );\r
\r
/* Actually removing data, not just peeking. */\r
- --( pxQueue->uxMessagesWaiting );\r
+ pxQueue->uxMessagesWaiting = uxMessagesWaiting - 1;\r
\r
#if ( configUSE_MUTEXES == 1 )\r
{\r
\r
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
{\r
+ const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;\r
+\r
/* Cannot block in an ISR, so check there is data available. */\r
- if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )\r
+ if( uxMessagesWaiting > ( UBaseType_t ) 0 )\r
{\r
+ const int8_t cRxLock = pxQueue->cRxLock;\r
+\r
traceQUEUE_RECEIVE_FROM_ISR( pxQueue );\r
\r
prvCopyDataFromQueue( pxQueue, pvBuffer );\r
- --( pxQueue->uxMessagesWaiting );\r
+ pxQueue->uxMessagesWaiting = uxMessagesWaiting - 1;\r
\r
/* If the queue is locked the event list will not be modified.\r
Instead update the lock count so the task that unlocks the queue\r
will know that an ISR has removed data while the queue was\r
locked. */\r
- if( pxQueue->cRxLock == queueUNLOCKED )\r
+ if( cRxLock == queueUNLOCKED )\r
{\r
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )\r
{\r
{\r
/* Increment the lock count so the task that unlocks the queue\r
knows that data was removed while it was locked. */\r
- ++( pxQueue->cRxLock );\r
+ pxQueue->cRxLock = cRxLock + 1;\r
}\r
\r
xReturn = pdPASS;\r
static BaseType_t prvCopyDataToQueue( Queue_t * const pxQueue, const void *pvItemToQueue, const BaseType_t xPosition )\r
{\r
BaseType_t xReturn = pdFALSE;\r
+UBaseType_t uxMessagesWaiting;\r
+\r
+ /* This function is called from a critical section. */\r
+\r
+ uxMessagesWaiting = pxQueue->uxMessagesWaiting;\r
\r
if( pxQueue->uxItemSize == ( UBaseType_t ) 0 )\r
{\r
\r
if( xPosition == queueOVERWRITE )\r
{\r
- if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )\r
+ if( uxMessagesWaiting > ( UBaseType_t ) 0 )\r
{\r
/* An item is not being added but overwritten, so subtract\r
one from the recorded number of items in the queue so when\r
one is added again below the number of recorded items remains\r
correct. */\r
- --( pxQueue->uxMessagesWaiting );\r
+ --uxMessagesWaiting;\r
}\r
else\r
{\r
}\r
}\r
\r
- ++( pxQueue->uxMessagesWaiting );\r
+ pxQueue->uxMessagesWaiting = uxMessagesWaiting + 1;\r
\r
return xReturn;\r
}\r
updated. */\r
taskENTER_CRITICAL();\r
{\r
+ int8_t cTxLock = pxQueue->cTxLock;\r
+\r
/* See if data was added to the queue while it was locked. */\r
- while( pxQueue->cTxLock > queueLOCKED_UNMODIFIED )\r
+ while( cTxLock > queueLOCKED_UNMODIFIED )\r
{\r
/* Data was posted while the queue was locked. Are any tasks\r
blocked waiting for data to become available? */\r
}\r
#endif /* configUSE_QUEUE_SETS */\r
\r
- --( pxQueue->cTxLock );\r
+ --cTxLock;\r
}\r
\r
pxQueue->cTxLock = queueUNLOCKED;\r
/* Do the same for the Rx lock. */\r
taskENTER_CRITICAL();\r
{\r
- while( pxQueue->cRxLock > queueLOCKED_UNMODIFIED )\r
+ int8_t cRxLock = pxQueue->cRxLock;\r
+\r
+ while( cRxLock > queueLOCKED_UNMODIFIED )\r
{\r
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )\r
{\r
mtCOVERAGE_TEST_MARKER();\r
}\r
\r
- --( pxQueue->cRxLock );\r
+ --cRxLock;\r
}\r
else\r
{\r
\r
#if ( configQUEUE_REGISTRY_SIZE > 0 )\r
\r
- const char *pcQueueGetQueueName( QueueHandle_t xQueue ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+ const char *pcQueueGetName( QueueHandle_t xQueue ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
{\r
UBaseType_t ux;\r
const char *pcReturn = NULL; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
\r
if( pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength )\r
{\r
+ const int8_t cTxLock = pxQueueSetContainer->cTxLock;\r
+\r
traceQUEUE_SEND( pxQueueSetContainer );\r
\r
/* The data copied is the handle of the queue that contains data. */\r
xReturn = prvCopyDataToQueue( pxQueueSetContainer, &pxQueue, xCopyPosition );\r
\r
- if( pxQueueSetContainer->cTxLock == queueUNLOCKED )\r
+ if( cTxLock == queueUNLOCKED )\r
{\r
if( listLIST_IS_EMPTY( &( pxQueueSetContainer->xTasksWaitingToReceive ) ) == pdFALSE )\r
{\r
}\r
else\r
{\r
- ( pxQueueSetContainer->cTxLock )++;\r
+ pxQueueSetContainer->cTxLock = cTxLock + 1;\r
}\r
}\r
else\r