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
- if( pxQueue->uxMessagesWaiting < pxQueue->uxLength )\r
+ portSET_INTERRUPT_MASK_FROM_ISR();\r
{\r
- traceQUEUE_SEND_FROM_ISR( pxQueue );\r
-\r
- prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );\r
-\r
- /* If the queue is locked we do not alter the event list. This will\r
- be done when the queue is unlocked later. */\r
- if( pxQueue->xTxLock == queueUNLOCKED )\r
+ if( pxQueue->uxMessagesWaiting < pxQueue->uxLength )\r
{\r
- if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) )\r
+ traceQUEUE_SEND_FROM_ISR( pxQueue );\r
+ \r
+ prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );\r
+ \r
+ /* If the queue is locked we do not alter the event list. This will\r
+ be done when the queue is unlocked later. */\r
+ if( pxQueue->xTxLock == queueUNLOCKED )\r
{\r
- if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )\r
+ if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) )\r
{\r
- /* The task waiting has a higher priority so record that a\r
- context switch is required. */\r
- *pxHigherPriorityTaskWoken = pdTRUE;\r
+ if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )\r
+ {\r
+ /* The task waiting has a higher priority so record that a\r
+ context switch is required. */\r
+ *pxHigherPriorityTaskWoken = pdTRUE;\r
+ }\r
}\r
}\r
+ else\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->xTxLock );\r
+ }\r
+ \r
+ xReturn = pdPASS;\r
}\r
else\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->xTxLock );\r
+ traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue );\r
+ xReturn = errQUEUE_FULL;\r
}\r
-\r
- xReturn = pdPASS;\r
- }\r
- else\r
- {\r
- traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue );\r
- xReturn = errQUEUE_FULL;\r
}\r
+ portCLEAR_INTERRUPT_MASK_FROM_ISR();\r
\r
return xReturn;\r
}\r
{\r
signed portBASE_TYPE xReturn;\r
\r
- /* We cannot block from an ISR, so check there is data available. */\r
- if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 )\r
+ portSET_INTERRUPT_MASK_FROM_ISR();\r
{\r
- traceQUEUE_RECEIVE_FROM_ISR( pxQueue );\r
-\r
- prvCopyDataFromQueue( pxQueue, pvBuffer );\r
- --( pxQueue->uxMessagesWaiting );\r
-\r
- /* If the queue is locked we will not modify the event list. Instead\r
- we update the lock count so the task that unlocks the queue will know\r
- that an ISR has removed data while the queue was locked. */\r
- if( pxQueue->xRxLock == queueUNLOCKED )\r
+ /* We cannot block from an ISR, so check there is data available. */\r
+ if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 )\r
{\r
- if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) )\r
+ traceQUEUE_RECEIVE_FROM_ISR( pxQueue );\r
+ \r
+ prvCopyDataFromQueue( pxQueue, pvBuffer );\r
+ --( pxQueue->uxMessagesWaiting );\r
+ \r
+ /* If the queue is locked we will not modify the event list. Instead\r
+ we update the lock count so the task that unlocks the queue will know\r
+ that an ISR has removed data while the queue was locked. */\r
+ if( pxQueue->xRxLock == queueUNLOCKED )\r
{\r
- if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )\r
+ if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) )\r
{\r
- /* The task waiting has a higher priority than us so\r
- force a context switch. */\r
- *pxTaskWoken = pdTRUE;\r
+ if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )\r
+ {\r
+ /* The task waiting has a higher priority than us so\r
+ force a context switch. */\r
+ *pxTaskWoken = pdTRUE;\r
+ }\r
}\r
}\r
+ else\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->xRxLock );\r
+ }\r
+ \r
+ xReturn = pdPASS;\r
}\r
else\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->xRxLock );\r
+ xReturn = pdFAIL;\r
+ traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue );\r
}\r
-\r
- xReturn = pdPASS;\r
- }\r
- else\r
- {\r
- xReturn = pdFAIL;\r
- traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue );\r
}\r
+ portCLEAR_INTERRUPT_MASK_FROM_ISR();\r
\r
return xReturn;\r
}\r