summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-04-12 09:45:02 +0000
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-04-12 09:45:02 +0000
commite8188ffbf76e1550c63aa274aab35a0fb19f83f6 (patch)
tree3107f06000b50f147b0a83b4f3df55968cd5777e /Source
parentf33fcf8d007012537dd7f6ec327f3512d3671fc8 (diff)
downloadfreertos-e8188ffbf76e1550c63aa274aab35a0fb19f83f6.tar.gz
freertos-e8188ffbf76e1550c63aa274aab35a0fb19f83f6.tar.bz2
freertos-e8188ffbf76e1550c63aa274aab35a0fb19f83f6.tar.xz
Change the semantics of the xQueueGenericSendFromISR() function.
git-svn-id: https://freertos.svn.sourceforge.net/svnroot/freertos/trunk@300 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
Diffstat (limited to 'Source')
-rw-r--r--Source/queue.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/Source/queue.c b/Source/queue.c
index d043f95e..28961d2d 100644
--- a/Source/queue.c
+++ b/Source/queue.c
@@ -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 );
unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle pxQueue );
void vQueueDelete( xQueueHandle xQueue );
-signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE xTaskPreviouslyWoken, portBASE_TYPE xCopyPosition );
+signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition );
signed portBASE_TYPE xQueueGenericReceive( xQueueHandle pxQueue, const void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking );
signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle pxQueue, const void * const pvBuffer, signed portBASE_TYPE *pxTaskWoken );
xQueueHandle xQueueCreateMutex( void );
@@ -799,8 +799,10 @@ xTimeOutType xTimeOut;
#endif /* configUSE_ALTERNATIVE_API */
/*-----------------------------------------------------------*/
-signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE xTaskPreviouslyWoken, portBASE_TYPE xCopyPosition )
+signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition )
{
+signed portBASE_TYPE xReturn;
+
/* Similar to xQueueGenericSend, except we don't block if there is no room
in the queue. Also we don't directly wake a task that was blocked on a
queue read, instead we return a flag to say whether a context switch is
@@ -816,18 +818,13 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void
be done when the queue is unlocked later. */
if( pxQueue->xTxLock == queueUNLOCKED )
{
- /* We only want to wake one task per ISR, so check that a task has
- not already been woken. */
- if( !xTaskPreviouslyWoken )
+ if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) )
{
- if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) )
+ if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
- if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
- {
- /* The task waiting has a higher priority so record that a
- context switch is required. */
- return pdTRUE;
- }
+ /* The task waiting has a higher priority so record that a
+ context switch is required. */
+ *pxHigherPriorityTaskWoken = pdTRUE;
}
}
}
@@ -837,13 +834,16 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void
knows that data was posted while it was locked. */
++( pxQueue->xTxLock );
}
+
+ xReturn = pdPASS;
}
else
{
traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue );
+ xReturn = errQUEUE_FULL;
}
- return xTaskPreviouslyWoken;
+ return xReturn;
}
/*-----------------------------------------------------------*/
@@ -1017,18 +1017,13 @@ signed portBASE_TYPE xReturn;
that an ISR has removed data while the queue was locked. */
if( pxQueue->xRxLock == queueUNLOCKED )
{
- /* We only want to wake one task per ISR, so check that a task has
- not already been woken. */
- if( !( *pxTaskWoken ) )
+ if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) )
{
- if( !listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) )
+ if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
{
- if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
- {
- /* The task waiting has a higher priority than us so
- force a context switch. */
- *pxTaskWoken = pdTRUE;
- }
+ /* The task waiting has a higher priority than us so
+ force a context switch. */
+ *pxTaskWoken = pdTRUE;
}
}
}