mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 21:41:59 -04:00
Added INCLUDE_xQueueGetMutexHolder macro.
Removed the "-rc1" that was accidentally left on the version number of some Win32 port files. Changed the behaviour of xQueueGenericReset() so queues can be reset when tasks are blocked on them.
This commit is contained in:
parent
38d09c99eb
commit
26dbc85c7c
|
@ -149,6 +149,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xQueueGetMutexHolder
|
||||||
|
#define INCLUDE_xQueueGetMutexHolder 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef INCLUDE_pcTaskGetTaskName
|
#ifndef INCLUDE_pcTaskGetTaskName
|
||||||
#define INCLUDE_pcTaskGetTaskName 0
|
#define INCLUDE_pcTaskGetTaskName 0
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.1.1-rc1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
FreeRTOS V7.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.1.1-rc1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
FreeRTOS V7.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
|
@ -278,26 +278,9 @@ static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer )
|
||||||
|
|
||||||
portBASE_TYPE xQueueGenericReset( xQueueHandle pxQueue, portBASE_TYPE xNewQueue )
|
portBASE_TYPE xQueueGenericReset( xQueueHandle pxQueue, portBASE_TYPE xNewQueue )
|
||||||
{
|
{
|
||||||
portBASE_TYPE xReturn = pdPASS;
|
|
||||||
|
|
||||||
configASSERT( pxQueue );
|
configASSERT( pxQueue );
|
||||||
|
|
||||||
/* If the queue being reset has already been used (has not just been
|
taskENTER_CRITICAL();
|
||||||
created), then only reset the queue if its event lists are empty. */
|
|
||||||
if( xNewQueue != pdTRUE )
|
|
||||||
{
|
|
||||||
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
|
|
||||||
{
|
|
||||||
xReturn = pdFAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
|
|
||||||
{
|
|
||||||
xReturn = pdFAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( xReturn == pdPASS )
|
|
||||||
{
|
{
|
||||||
pxQueue->pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize );
|
pxQueue->pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize );
|
||||||
pxQueue->uxMessagesWaiting = ( unsigned portBASE_TYPE ) 0U;
|
pxQueue->uxMessagesWaiting = ( unsigned portBASE_TYPE ) 0U;
|
||||||
|
@ -306,12 +289,33 @@ portBASE_TYPE xReturn = pdPASS;
|
||||||
pxQueue->xRxLock = queueUNLOCKED;
|
pxQueue->xRxLock = queueUNLOCKED;
|
||||||
pxQueue->xTxLock = queueUNLOCKED;
|
pxQueue->xTxLock = queueUNLOCKED;
|
||||||
|
|
||||||
/* Ensure the event queues start with the correct state. */
|
if( xNewQueue == pdFALSE )
|
||||||
|
{
|
||||||
|
/* If there are tasks blocked waiting to read from the queue, then
|
||||||
|
the tasks will remain blocked as after this function exits the queue
|
||||||
|
will still be empty. If there are tasks blocked waiting to write to
|
||||||
|
the queue, then one should be unblocked as after this function exits
|
||||||
|
it will be possible to write to it. */
|
||||||
|
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
|
||||||
|
{
|
||||||
|
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) == pdTRUE )
|
||||||
|
{
|
||||||
|
portYIELD_WITHIN_API();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Ensure the event queues start in the correct state. */
|
||||||
vListInitialise( &( pxQueue->xTasksWaitingToSend ) );
|
vListInitialise( &( pxQueue->xTasksWaitingToSend ) );
|
||||||
vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );
|
vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
return xReturn;
|
/* A value is returned for calling semantic consistency with previous
|
||||||
|
versions. */
|
||||||
|
return pdPASS;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -425,7 +429,7 @@ xQueueHandle xReturn = NULL;
|
||||||
#endif /* configUSE_MUTEXES */
|
#endif /* configUSE_MUTEXES */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( configUSE_MUTEXES == 1 )
|
#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xQueueGetMutexHolder == 1 ) )
|
||||||
|
|
||||||
void* xQueueGetMutexHolder( xQueueHandle xSemaphore )
|
void* xQueueGetMutexHolder( xQueueHandle xSemaphore )
|
||||||
{
|
{
|
||||||
|
@ -1024,7 +1028,6 @@ signed char *pcOriginalReadPosition;
|
||||||
portYIELD_WITHIN_API();
|
portYIELD_WITHIN_API();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
taskEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
Loading…
Reference in a new issue