mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-19 02:41:14 +00:00
freertos: Reduce ESP specific code
This commit is contained in:
@@ -40,6 +40,18 @@
|
||||
#include "croutine.h"
|
||||
#endif
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#define taskCRITICAL_MUX &((Queue_t *)pxQueue)->mux
|
||||
#undef taskENTER_CRITICAL
|
||||
#undef taskEXIT_CRITICAL
|
||||
#undef taskENTER_CRITICAL_ISR
|
||||
#undef taskEXIT_CRITICAL_ISR
|
||||
#define taskENTER_CRITICAL( ) portENTER_CRITICAL( taskCRITICAL_MUX )
|
||||
#define taskEXIT_CRITICAL( ) portEXIT_CRITICAL( taskCRITICAL_MUX )
|
||||
#define taskENTER_CRITICAL_ISR( ) portENTER_CRITICAL_ISR( taskCRITICAL_MUX )
|
||||
#define taskEXIT_CRITICAL_ISR( ) portEXIT_CRITICAL_ISR( taskCRITICAL_MUX )
|
||||
#endif
|
||||
|
||||
/* Lint e9021, e961 and e750 are suppressed as a MISRA exception justified
|
||||
* because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined
|
||||
* for the header files above, but not in this file, in order to generate the
|
||||
@@ -252,7 +264,7 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
|
||||
* accessing the queue event lists.
|
||||
*/
|
||||
#define prvLockQueue( pxQueue ) \
|
||||
taskENTER_CRITICAL( &pxQueue->mux ); \
|
||||
taskENTER_CRITICAL(); \
|
||||
{ \
|
||||
if( ( pxQueue )->cRxLock == queueUNLOCKED ) \
|
||||
{ \
|
||||
@@ -263,7 +275,7 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
|
||||
( pxQueue )->cTxLock = queueLOCKED_UNMODIFIED; \
|
||||
} \
|
||||
} \
|
||||
taskEXIT_CRITICAL( &pxQueue->mux )
|
||||
taskEXIT_CRITICAL()
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
|
||||
@@ -278,7 +290,7 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
|
||||
vPortCPUInitializeMutex(&pxQueue->mux);
|
||||
}
|
||||
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
pxQueue->u.xQueue.pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize ); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */
|
||||
pxQueue->uxMessagesWaiting = ( UBaseType_t ) 0U;
|
||||
@@ -317,7 +329,7 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
|
||||
vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQueue->mux);
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
/* A value is returned for calling semantic consistency with previous
|
||||
* versions. */
|
||||
@@ -585,7 +597,10 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
|
||||
* calling task is the mutex holder, but not a good way of determining the
|
||||
* identity of the mutex holder, as the holder may change between the
|
||||
* following critical section exiting and the function returning. */
|
||||
taskENTER_CRITICAL( &pxSemaphore->mux );
|
||||
#ifdef ESP_PLATFORM
|
||||
Queue_t * const pxQueue = (Queue_t *)pxSemaphore;
|
||||
#endif
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
if( pxSemaphore->uxQueueType == queueQUEUE_IS_MUTEX )
|
||||
{
|
||||
@@ -596,7 +611,7 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
|
||||
pxReturn = NULL;
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxSemaphore->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return pxReturn;
|
||||
} /*lint !e818 xSemaphore cannot be a pointer to const because it is a typedef. */
|
||||
@@ -816,7 +831,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
|
||||
* interest of execution time efficiency. */
|
||||
for( ; ; )
|
||||
{
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
/* Is there room on the queue now? The running task must be the
|
||||
* highest priority task wanting to access the queue. If the head item
|
||||
@@ -922,7 +937,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
|
||||
}
|
||||
#endif /* configUSE_QUEUE_SETS */
|
||||
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
return pdPASS;
|
||||
}
|
||||
else
|
||||
@@ -931,7 +946,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
|
||||
{
|
||||
/* The queue was full and no block time is specified (or
|
||||
* the block time has expired) so leave now. */
|
||||
taskEXIT_CRITICAL( &pxQueue->mux);
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
/* Return to the original privilege level before exiting
|
||||
* the function. */
|
||||
@@ -952,12 +967,12 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
|
||||
}
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQueue->mux);
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
/* Interrupts and other tasks can send to and receive from the queue
|
||||
* now the critical section has been exited. */
|
||||
|
||||
taskENTER_CRITICAL( &pxQueue->mux);
|
||||
taskENTER_CRITICAL();
|
||||
prvLockQueue( pxQueue );
|
||||
|
||||
/* Update the timeout state to see if it has expired yet. */
|
||||
@@ -980,7 +995,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
|
||||
* task is already in the ready list before it yields - in which
|
||||
* case the yield will not cause a context switch unless there
|
||||
* is also a higher priority task in the pending ready list. */
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
portYIELD_WITHIN_API();
|
||||
|
||||
}
|
||||
@@ -988,14 +1003,14 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
|
||||
{
|
||||
/* Try again. */
|
||||
prvUnlockQueue( pxQueue );
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The timeout has expired. */
|
||||
prvUnlockQueue( pxQueue );
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
traceQUEUE_SEND_FAILED( pxQueue );
|
||||
return errQUEUE_FULL;
|
||||
@@ -1040,7 +1055,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
|
||||
* post). */
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
taskENTER_CRITICAL_ISR(&pxQueue->mux);
|
||||
taskENTER_CRITICAL_ISR();
|
||||
|
||||
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
|
||||
{
|
||||
@@ -1154,7 +1169,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
|
||||
xReturn = errQUEUE_FULL;
|
||||
}
|
||||
|
||||
taskEXIT_CRITICAL_ISR( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL_ISR();
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
|
||||
@@ -1204,7 +1219,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
|
||||
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
taskENTER_CRITICAL_ISR(&pxQueue->mux);
|
||||
taskENTER_CRITICAL_ISR();
|
||||
|
||||
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
|
||||
|
||||
@@ -1323,7 +1338,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
|
||||
traceQUEUE_GIVE_FROM_ISR_FAILED( pxQueue );
|
||||
xReturn = errQUEUE_FULL;
|
||||
}
|
||||
taskEXIT_CRITICAL_ISR(&pxQueue->mux);
|
||||
taskEXIT_CRITICAL_ISR();
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
|
||||
@@ -1358,7 +1373,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
|
||||
* interest of execution time efficiency. */
|
||||
for( ; ; )
|
||||
{
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
|
||||
|
||||
@@ -1390,7 +1405,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
|
||||
taskEXIT_CRITICAL( &pxQueue->mux);
|
||||
taskEXIT_CRITICAL();
|
||||
return pdPASS;
|
||||
}
|
||||
else
|
||||
@@ -1399,7 +1414,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
|
||||
{
|
||||
/* The queue was empty and no block time is specified (or
|
||||
* the block time has expired) so leave now. */
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
traceQUEUE_RECEIVE_FAILED( pxQueue );
|
||||
return errQUEUE_EMPTY;
|
||||
}
|
||||
@@ -1417,12 +1432,12 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
|
||||
}
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
/* Interrupts and other tasks can send to and receive from the queue
|
||||
* now the critical section has been exited. */
|
||||
|
||||
taskENTER_CRITICAL( &pxQueue->mux);
|
||||
taskENTER_CRITICAL();
|
||||
prvLockQueue( pxQueue );
|
||||
|
||||
/* Update the timeout state to see if it has expired yet. */
|
||||
@@ -1435,7 +1450,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
|
||||
traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue );
|
||||
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
|
||||
prvUnlockQueue( pxQueue );
|
||||
taskEXIT_CRITICAL( &pxQueue->mux);
|
||||
taskEXIT_CRITICAL();
|
||||
portYIELD_WITHIN_API();
|
||||
}
|
||||
else
|
||||
@@ -1443,7 +1458,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
|
||||
/* The queue contains data again. Loop back to try and read the
|
||||
* data. */
|
||||
prvUnlockQueue( pxQueue );
|
||||
taskEXIT_CRITICAL( &pxQueue->mux);
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1451,7 +1466,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
|
||||
/* Timed out. If there is no data in the queue exit, otherwise loop
|
||||
* back and attempt to read the data. */
|
||||
prvUnlockQueue( pxQueue );
|
||||
taskEXIT_CRITICAL( &pxQueue->mux);
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
if( prvIsQueueEmpty( pxQueue ) != pdFALSE )
|
||||
{
|
||||
@@ -1497,7 +1512,7 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
|
||||
* of execution time efficiency. */
|
||||
for( ; ; )
|
||||
{
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
/* Semaphores are queues with an item size of 0, and where the
|
||||
* number of messages in the queue is the semaphore's count value. */
|
||||
@@ -1546,7 +1561,7 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
return pdPASS;
|
||||
}
|
||||
else
|
||||
@@ -1564,7 +1579,7 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
|
||||
|
||||
/* The semaphore count was 0 and no block time is specified
|
||||
* (or the block time has expired) so exit now. */
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
traceQUEUE_RECEIVE_FAILED( pxQueue );
|
||||
return errQUEUE_EMPTY;
|
||||
}
|
||||
@@ -1582,12 +1597,12 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
|
||||
}
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
/* Interrupts and other tasks can give to and take from the semaphore
|
||||
* now the critical section has been exited. */
|
||||
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
prvLockQueue( pxQueue );
|
||||
|
||||
/* Update the timeout state to see if it has expired yet. */
|
||||
@@ -1605,11 +1620,11 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
|
||||
{
|
||||
if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )
|
||||
{
|
||||
taskENTER_CRITICAL( &pxQueue->mux);
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
xInheritanceOccurred = xTaskPriorityInherit( pxQueue->u.xSemaphore.xMutexHolder );
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQueue->mux);
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1620,7 +1635,7 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
|
||||
|
||||
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
|
||||
prvUnlockQueue( pxQueue );
|
||||
taskEXIT_CRITICAL( &pxQueue->mux);
|
||||
taskEXIT_CRITICAL();
|
||||
portYIELD_WITHIN_API();
|
||||
}
|
||||
else
|
||||
@@ -1628,14 +1643,14 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
|
||||
/* There was no timeout and the semaphore count was not 0, so
|
||||
* attempt to take the semaphore again. */
|
||||
prvUnlockQueue( pxQueue );
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Timed out. */
|
||||
prvUnlockQueue( pxQueue );
|
||||
taskEXIT_CRITICAL( &pxQueue->mux);
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
/* If the semaphore count is 0 exit now as the timeout has
|
||||
* expired. Otherwise return to attempt to take the semaphore that is
|
||||
@@ -1650,7 +1665,7 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
|
||||
* test the mutex type again to check it is actually a mutex. */
|
||||
if( xInheritanceOccurred != pdFALSE )
|
||||
{
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
UBaseType_t uxHighestWaitingPriority;
|
||||
|
||||
@@ -1662,7 +1677,7 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
|
||||
uxHighestWaitingPriority = prvGetDisinheritPriorityAfterTimeout( pxQueue );
|
||||
vTaskPriorityDisinheritAfterTimeout( pxQueue->u.xSemaphore.xMutexHolder, uxHighestWaitingPriority );
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
}
|
||||
#endif /* configUSE_MUTEXES */
|
||||
@@ -1707,7 +1722,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
|
||||
* interest of execution time efficiency. */
|
||||
for( ; ; )
|
||||
{
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
|
||||
|
||||
@@ -1745,7 +1760,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
return pdPASS;
|
||||
}
|
||||
else
|
||||
@@ -1754,7 +1769,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
|
||||
{
|
||||
/* The queue was empty and no block time is specified (or
|
||||
* the block time has expired) so leave now. */
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
traceQUEUE_PEEK_FAILED( pxQueue );
|
||||
return errQUEUE_EMPTY;
|
||||
}
|
||||
@@ -1773,12 +1788,12 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
|
||||
}
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
/* Interrupts and other tasks can send to and receive from the queue
|
||||
* now the critical section has been exited. */
|
||||
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
prvLockQueue( pxQueue );
|
||||
|
||||
/* Update the timeout state to see if it has expired yet. */
|
||||
@@ -1791,7 +1806,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
|
||||
traceBLOCKING_ON_QUEUE_PEEK( pxQueue );
|
||||
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
|
||||
prvUnlockQueue( pxQueue );
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
portYIELD_WITHIN_API();
|
||||
}
|
||||
else
|
||||
@@ -1799,7 +1814,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
|
||||
/* There is data in the queue now, so don't enter the blocked
|
||||
* state, instead return to try and obtain the data. */
|
||||
prvUnlockQueue( pxQueue );
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1807,7 +1822,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
|
||||
/* The timeout has expired. If there is still no data in the queue
|
||||
* exit, otherwise go back and try to read the data again. */
|
||||
prvUnlockQueue( pxQueue );
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
if( prvIsQueueEmpty( pxQueue ) != pdFALSE )
|
||||
{
|
||||
@@ -1852,7 +1867,7 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
|
||||
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
taskENTER_CRITICAL_ISR(&pxQueue->mux);
|
||||
taskENTER_CRITICAL_ISR();
|
||||
|
||||
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
|
||||
|
||||
@@ -1911,7 +1926,7 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
|
||||
xReturn = pdFAIL;
|
||||
traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue );
|
||||
}
|
||||
taskEXIT_CRITICAL_ISR(&pxQueue->mux);
|
||||
taskEXIT_CRITICAL_ISR();
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
|
||||
@@ -1948,7 +1963,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
|
||||
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
|
||||
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
taskENTER_CRITICAL_ISR(&pxQueue->mux);
|
||||
taskENTER_CRITICAL_ISR();
|
||||
{
|
||||
/* Cannot block in an ISR, so check there is data available. */
|
||||
if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )
|
||||
@@ -1969,7 +1984,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
|
||||
traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue );
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL_ISR(&pxQueue->mux);
|
||||
taskEXIT_CRITICAL_ISR();
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
|
||||
return xReturn;
|
||||
@@ -1983,11 +1998,11 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue )
|
||||
|
||||
configASSERT( xQueue );
|
||||
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
uxReturn = ( ( Queue_t * ) xQueue )->uxMessagesWaiting;
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return uxReturn;
|
||||
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
|
||||
@@ -2000,11 +2015,11 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue )
|
||||
|
||||
configASSERT( pxQueue );
|
||||
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
uxReturn = pxQueue->uxLength - pxQueue->uxMessagesWaiting;
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return uxReturn;
|
||||
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
|
||||
@@ -2234,7 +2249,7 @@ static void prvUnlockQueue( Queue_t * const pxQueue )
|
||||
* removed from the queue while the queue was locked. When a queue is
|
||||
* locked items can be added or removed, but the event lists cannot be
|
||||
* updated. */
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
int8_t cTxLock = pxQueue->cTxLock;
|
||||
|
||||
@@ -2312,10 +2327,10 @@ static void prvUnlockQueue( Queue_t * const pxQueue )
|
||||
|
||||
pxQueue->cTxLock = queueUNLOCKED;
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
/* Do the same for the Rx lock. */
|
||||
taskENTER_CRITICAL( &pxQueue->mux );
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
int8_t cRxLock = pxQueue->cRxLock;
|
||||
|
||||
@@ -2342,15 +2357,14 @@ static void prvUnlockQueue( Queue_t * const pxQueue )
|
||||
|
||||
pxQueue->cRxLock = queueUNLOCKED;
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQueue->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvIsQueueEmpty( const Queue_t * pxQueue )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
Queue_t * pxQ = (Queue_t *)pxQueue;
|
||||
taskENTER_CRITICAL( &pxQ->mux );
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 )
|
||||
{
|
||||
@@ -2361,7 +2375,7 @@ static BaseType_t prvIsQueueEmpty( const Queue_t * pxQueue )
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL( &pxQ->mux );
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
@@ -2872,8 +2886,11 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
|
||||
QueueSetHandle_t xQueueSet )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
#ifdef ESP_PLATFORM
|
||||
Queue_t * pxQueue = (Queue_t * )xQueueOrSemaphore;
|
||||
#endif
|
||||
|
||||
taskENTER_CRITICAL(&(((Queue_t * )xQueueOrSemaphore)->mux));
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
if( ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL )
|
||||
{
|
||||
@@ -2892,7 +2909,7 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL(&(((Queue_t * )xQueueOrSemaphore)->mux));
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
@@ -2922,12 +2939,15 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
|
||||
}
|
||||
else
|
||||
{
|
||||
taskENTER_CRITICAL(&(pxQueueOrSemaphore->mux));
|
||||
#ifdef ESP_PLATFORM
|
||||
Queue_t* pxQueue = (Queue_t*)pxQueueOrSemaphore;
|
||||
#endif
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
/* The queue is no longer contained in the set. */
|
||||
pxQueueOrSemaphore->pxQueueSetContainer = NULL;
|
||||
}
|
||||
taskEXIT_CRITICAL(&(pxQueueOrSemaphore->mux));
|
||||
taskEXIT_CRITICAL();
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user