]> git.sur5r.net Git - freertos/commitdiff
Change the semantics of the xQueueGenericSendFromISR() function.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 12 Apr 2008 09:45:02 +0000 (09:45 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 12 Apr 2008 09:45:02 +0000 (09:45 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@300 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/queue.c

index d043f95ecc2b48e2c0bbecd53cd2d9c70b737f77..28961d2dd1dfffd0e4c85e993c8b08be8d728f1d 100644 (file)
@@ -118,7 +118,7 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
 signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );\r
 unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle pxQueue );\r
 void vQueueDelete( xQueueHandle xQueue );\r
-signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE xTaskPreviouslyWoken, portBASE_TYPE xCopyPosition );\r
+signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition );\r
 signed portBASE_TYPE xQueueGenericReceive( xQueueHandle pxQueue, const void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking );\r
 signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle pxQueue, const void * const pvBuffer, signed portBASE_TYPE *pxTaskWoken );\r
 xQueueHandle xQueueCreateMutex( void );\r
@@ -799,8 +799,10 @@ xTimeOutType xTimeOut;
 #endif /* configUSE_ALTERNATIVE_API */\r
 /*-----------------------------------------------------------*/\r
 \r
-signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE xTaskPreviouslyWoken, portBASE_TYPE xCopyPosition )\r
+signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition )\r
 {\r
+signed portBASE_TYPE xReturn;\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
@@ -816,18 +818,13 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void
                be done when the queue is unlocked later. */\r
                if( pxQueue->xTxLock == queueUNLOCKED )\r
                {\r
-                       /* We only want to wake one task per ISR, so check that a task has\r
-                       not already been woken. */\r
-                       if( !xTaskPreviouslyWoken )             \r
+                       if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) )\r
                        {\r
-                               if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) )\r
+                               if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )\r
                                {\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
-                                               return pdTRUE;\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
@@ -837,13 +834,16 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void
                        knows that data was posted while it was locked. */\r
                        ++( pxQueue->xTxLock );\r
                }\r
+\r
+               xReturn = pdPASS;\r
        }\r
        else\r
        {\r
                traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue );\r
+               xReturn = errQUEUE_FULL;\r
        }\r
 \r
-       return xTaskPreviouslyWoken;\r
+       return xReturn;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -1017,18 +1017,13 @@ signed portBASE_TYPE xReturn;
                that an ISR has removed data while the queue was locked. */\r
                if( pxQueue->xRxLock == queueUNLOCKED )\r
                {\r
-                       /* We only want to wake one task per ISR, so check that a task has\r
-                       not already been woken. */\r
-                       if( !( *pxTaskWoken ) )\r
+                       if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) )\r
                        {\r
-                               if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) )\r
+                               if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )\r
                                {\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
+                                       /* The task waiting has a higher priority than us so\r
+                                       force a context switch. */\r
+                                       *pxTaskWoken = pdTRUE;\r
                                }\r
                        }\r
                }\r