Add Trace Hook Macros to all API calls (#786)

This pull-request adds out-of-the-box support for different tracing
tools. New trace hook macros have been added for all public API
functions, one for each function entry and one for each exit. There are
no functional changes, as the macros are by default empty.

For more information see following forum post:
https://forums.freertos.org/t/add-tracing-functionality-for-all-api-calls/18007.
This commit is contained in:
Sebastian Brosch 2023-09-20 12:17:42 +02:00 committed by GitHub
parent 15e0364968
commit 83861f5b1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 2357 additions and 3 deletions

201
queue.c
View file

@ -303,6 +303,8 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
BaseType_t xReturn = pdPASS;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueGenericReset( xQueue, xNewQueue );
configASSERT( pxQueue );
if( ( pxQueue != NULL ) &&
@ -360,6 +362,8 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
/* A value is returned for calling semantic consistency with previous
* versions. */
traceRETURN_xQueueGenericReset( xReturn );
return xReturn;
}
/*-----------------------------------------------------------*/
@ -374,6 +378,8 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
{
Queue_t * pxNewQueue = NULL;
traceENTER_xQueueGenericCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxStaticQueue, ucQueueType );
/* The StaticQueue_t structure and the queue storage area must be
* supplied. */
configASSERT( pxStaticQueue );
@ -421,6 +427,8 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
mtCOVERAGE_TEST_MARKER();
}
traceRETURN_xQueueGenericCreateStatic( pxNewQueue );
return pxNewQueue;
}
@ -436,6 +444,8 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueGenericGetStaticBuffers( xQueue, ppucQueueStorage, ppxStaticQueue );
configASSERT( pxQueue );
configASSERT( ppxStaticQueue );
@ -470,6 +480,8 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
}
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
traceRETURN_xQueueGenericGetStaticBuffers( xReturn );
return xReturn;
}
@ -486,6 +498,8 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
size_t xQueueSizeInBytes;
uint8_t * pucQueueStorage;
traceENTER_xQueueGenericCreate( uxQueueLength, uxItemSize, ucQueueType );
if( ( uxQueueLength > ( UBaseType_t ) 0 ) &&
/* Check for multiplication overflow. */
( ( SIZE_MAX / uxQueueLength ) >= uxItemSize ) &&
@ -538,6 +552,8 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
mtCOVERAGE_TEST_MARKER();
}
traceRETURN_xQueueGenericCreate( pxNewQueue );
return pxNewQueue;
}
@ -627,9 +643,13 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
QueueHandle_t xNewQueue;
const UBaseType_t uxMutexLength = ( UBaseType_t ) 1, uxMutexSize = ( UBaseType_t ) 0;
traceENTER_xQueueCreateMutex( ucQueueType );
xNewQueue = xQueueGenericCreate( uxMutexLength, uxMutexSize, ucQueueType );
prvInitialiseMutex( ( Queue_t * ) xNewQueue );
traceRETURN_xQueueCreateMutex( xNewQueue );
return xNewQueue;
}
@ -644,6 +664,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
QueueHandle_t xNewQueue;
const UBaseType_t uxMutexLength = ( UBaseType_t ) 1, uxMutexSize = ( UBaseType_t ) 0;
traceENTER_xQueueCreateMutexStatic( ucQueueType, pxStaticQueue );
/* Prevent compiler warnings about unused parameters if
* configUSE_TRACE_FACILITY does not equal 1. */
( void ) ucQueueType;
@ -651,6 +673,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
xNewQueue = xQueueGenericCreateStatic( uxMutexLength, uxMutexSize, NULL, pxStaticQueue, ucQueueType );
prvInitialiseMutex( ( Queue_t * ) xNewQueue );
traceRETURN_xQueueCreateMutexStatic( xNewQueue );
return xNewQueue;
}
@ -664,6 +688,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
TaskHandle_t pxReturn;
Queue_t * const pxSemaphore = ( Queue_t * ) xSemaphore;
traceENTER_xQueueGetMutexHolder( xSemaphore );
configASSERT( xSemaphore );
/* This function is called by xSemaphoreGetMutexHolder(), and should not
@ -684,6 +710,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
}
taskEXIT_CRITICAL();
traceRETURN_xQueueGetMutexHolder( pxReturn );
return pxReturn;
} /*lint !e818 xSemaphore cannot be a pointer to const because it is a typedef. */
@ -696,6 +724,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
{
TaskHandle_t pxReturn;
traceENTER_xQueueGetMutexHolderFromISR( xSemaphore );
configASSERT( xSemaphore );
/* Mutexes cannot be used in interrupt service routines, so the mutex
@ -710,6 +740,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
pxReturn = NULL;
}
traceRETURN_xQueueGetMutexHolderFromISR( pxReturn );
return pxReturn;
} /*lint !e818 xSemaphore cannot be a pointer to const because it is a typedef. */
@ -723,6 +755,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
BaseType_t xReturn;
Queue_t * const pxMutex = ( Queue_t * ) xMutex;
traceENTER_xQueueGiveMutexRecursive( xMutex );
configASSERT( pxMutex );
/* If this is the task that holds the mutex then xMutexHolder will not
@ -765,6 +799,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex );
}
traceRETURN_xQueueGiveMutexRecursive( xReturn );
return xReturn;
}
@ -779,6 +815,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
BaseType_t xReturn;
Queue_t * const pxMutex = ( Queue_t * ) xMutex;
traceENTER_xQueueTakeMutexRecursive( xMutex, xTicksToWait );
configASSERT( pxMutex );
/* Comments regarding mutual exclusion as per those within
@ -808,6 +846,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
}
}
traceRETURN_xQueueTakeMutexRecursive( xReturn );
return xReturn;
}
@ -822,6 +862,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
{
QueueHandle_t xHandle = NULL;
traceENTER_xQueueCreateCountingSemaphoreStatic( uxMaxCount, uxInitialCount, pxStaticQueue );
if( ( uxMaxCount != 0 ) &&
( uxInitialCount <= uxMaxCount ) )
{
@ -844,6 +886,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
mtCOVERAGE_TEST_MARKER();
}
traceRETURN_xQueueCreateCountingSemaphoreStatic( xHandle );
return xHandle;
}
@ -857,6 +901,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
{
QueueHandle_t xHandle = NULL;
traceENTER_xQueueCreateCountingSemaphore( uxMaxCount, uxInitialCount );
if( ( uxMaxCount != 0 ) &&
( uxInitialCount <= uxMaxCount ) )
{
@ -879,6 +925,8 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
mtCOVERAGE_TEST_MARKER();
}
traceRETURN_xQueueCreateCountingSemaphore( xHandle );
return xHandle;
}
@ -894,6 +942,8 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
TimeOut_t xTimeOut;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, xCopyPosition );
configASSERT( pxQueue );
configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) );
@ -1015,6 +1065,9 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
#endif /* configUSE_QUEUE_SETS */
taskEXIT_CRITICAL();
traceRETURN_xQueueGenericSend( pdPASS );
return pdPASS;
}
else
@ -1028,6 +1081,8 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
/* Return to the original privilege level before exiting
* the function. */
traceQUEUE_SEND_FAILED( pxQueue );
traceRETURN_xQueueGenericSend( errQUEUE_FULL );
return errQUEUE_FULL;
}
else if( xEntryTimeSet == pdFALSE )
@ -1099,6 +1154,8 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
( void ) xTaskResumeAll();
traceQUEUE_SEND_FAILED( pxQueue );
traceRETURN_xQueueGenericSend( errQUEUE_FULL );
return errQUEUE_FULL;
}
} /*lint -restore */
@ -1114,6 +1171,8 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
UBaseType_t uxSavedInterruptStatus;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueGenericSendFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken, xCopyPosition );
configASSERT( pxQueue );
configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) );
@ -1266,6 +1325,8 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
}
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus );
traceRETURN_xQueueGenericSendFromISR( xReturn );
return xReturn;
}
/*-----------------------------------------------------------*/
@ -1277,6 +1338,8 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
UBaseType_t uxSavedInterruptStatus;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueGiveFromISR( xQueue, pxHigherPriorityTaskWoken );
/* Similar to xQueueGenericSendFromISR() but used with semaphores where the
* item size is 0. Don't directly wake a task that was blocked on a queue
* read, instead return a flag to say whether a context switch is required or
@ -1432,6 +1495,8 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
}
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus );
traceRETURN_xQueueGiveFromISR( xReturn );
return xReturn;
}
/*-----------------------------------------------------------*/
@ -1444,6 +1509,8 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
TimeOut_t xTimeOut;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueReceive( xQueue, pvBuffer, xTicksToWait );
/* Check the pointer is not NULL. */
configASSERT( ( pxQueue ) );
@ -1496,6 +1563,9 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
}
taskEXIT_CRITICAL();
traceRETURN_xQueueReceive( pdPASS );
return pdPASS;
}
else
@ -1505,7 +1575,10 @@ 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();
traceQUEUE_RECEIVE_FAILED( pxQueue );
traceRETURN_xQueueReceive( errQUEUE_EMPTY );
return errQUEUE_EMPTY;
}
else if( xEntryTimeSet == pdFALSE )
@ -1576,6 +1649,8 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue,
if( prvIsQueueEmpty( pxQueue ) != pdFALSE )
{
traceQUEUE_RECEIVE_FAILED( pxQueue );
traceRETURN_xQueueReceive( errQUEUE_EMPTY );
return errQUEUE_EMPTY;
}
else
@ -1598,6 +1673,8 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
BaseType_t xInheritanceOccurred = pdFALSE;
#endif
traceENTER_xQueueSemaphoreTake( xQueue, xTicksToWait );
/* Check the queue pointer is not NULL. */
configASSERT( ( pxQueue ) );
@ -1667,6 +1744,9 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
}
taskEXIT_CRITICAL();
traceRETURN_xQueueSemaphoreTake( pdPASS );
return pdPASS;
}
else
@ -1676,7 +1756,10 @@ 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();
traceQUEUE_RECEIVE_FAILED( pxQueue );
traceRETURN_xQueueSemaphoreTake( errQUEUE_EMPTY );
return errQUEUE_EMPTY;
}
else if( xEntryTimeSet == pdFALSE )
@ -1794,6 +1877,8 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
#endif /* configUSE_MUTEXES */
traceQUEUE_RECEIVE_FAILED( pxQueue );
traceRETURN_xQueueSemaphoreTake( errQUEUE_EMPTY );
return errQUEUE_EMPTY;
}
else
@ -1814,6 +1899,8 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
int8_t * pcOriginalReadPosition;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueuePeek( xQueue, pvBuffer, xTicksToWait );
/* Check the pointer is not NULL. */
configASSERT( ( pxQueue ) );
@ -1872,6 +1959,9 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
}
taskEXIT_CRITICAL();
traceRETURN_xQueuePeek( pdPASS );
return pdPASS;
}
else
@ -1881,7 +1971,10 @@ 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();
traceQUEUE_PEEK_FAILED( pxQueue );
traceRETURN_xQueuePeek( errQUEUE_EMPTY );
return errQUEUE_EMPTY;
}
else if( xEntryTimeSet == pdFALSE )
@ -1953,6 +2046,8 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
if( prvIsQueueEmpty( pxQueue ) != pdFALSE )
{
traceQUEUE_PEEK_FAILED( pxQueue );
traceRETURN_xQueuePeek( errQUEUE_EMPTY );
return errQUEUE_EMPTY;
}
else
@ -1972,6 +2067,8 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
UBaseType_t uxSavedInterruptStatus;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueReceiveFromISR( xQueue, pvBuffer, pxHigherPriorityTaskWoken );
configASSERT( pxQueue );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
@ -2053,6 +2150,8 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
}
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus );
traceRETURN_xQueueReceiveFromISR( xReturn );
return xReturn;
}
/*-----------------------------------------------------------*/
@ -2065,6 +2164,8 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
int8_t * pcOriginalReadPosition;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueuePeekFromISR( xQueue, pvBuffer );
configASSERT( pxQueue );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
configASSERT( pxQueue->uxItemSize != 0 ); /* Can't peek a semaphore. */
@ -2108,6 +2209,8 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
}
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus );
traceRETURN_xQueuePeekFromISR( xReturn );
return xReturn;
}
/*-----------------------------------------------------------*/
@ -2116,6 +2219,8 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue )
{
UBaseType_t uxReturn;
traceENTER_uxQueueMessagesWaiting( xQueue );
configASSERT( xQueue );
taskENTER_CRITICAL();
@ -2124,6 +2229,8 @@ UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue )
}
taskEXIT_CRITICAL();
traceRETURN_uxQueueMessagesWaiting( uxReturn );
return uxReturn;
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
/*-----------------------------------------------------------*/
@ -2133,6 +2240,8 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue )
UBaseType_t uxReturn;
Queue_t * const pxQueue = xQueue;
traceENTER_uxQueueSpacesAvailable( xQueue );
configASSERT( pxQueue );
taskENTER_CRITICAL();
@ -2141,6 +2250,8 @@ UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue )
}
taskEXIT_CRITICAL();
traceRETURN_uxQueueSpacesAvailable( uxReturn );
return uxReturn;
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
/*-----------------------------------------------------------*/
@ -2150,9 +2261,13 @@ UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue )
UBaseType_t uxReturn;
Queue_t * const pxQueue = xQueue;
traceENTER_uxQueueMessagesWaitingFromISR( xQueue );
configASSERT( pxQueue );
uxReturn = pxQueue->uxMessagesWaiting;
traceRETURN_uxQueueMessagesWaitingFromISR( uxReturn );
return uxReturn;
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
/*-----------------------------------------------------------*/
@ -2161,6 +2276,8 @@ void vQueueDelete( QueueHandle_t xQueue )
{
Queue_t * const pxQueue = xQueue;
traceENTER_vQueueDelete( xQueue );
configASSERT( pxQueue );
traceQUEUE_DELETE( pxQueue );
@ -2196,6 +2313,8 @@ void vQueueDelete( QueueHandle_t xQueue )
( void ) pxQueue;
}
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
traceRETURN_vQueueDelete();
}
/*-----------------------------------------------------------*/
@ -2203,6 +2322,10 @@ void vQueueDelete( QueueHandle_t xQueue )
UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue )
{
traceENTER_uxQueueGetQueueNumber( xQueue );
traceRETURN_uxQueueGetQueueNumber( ( ( Queue_t * ) xQueue )->uxQueueNumber );
return ( ( Queue_t * ) xQueue )->uxQueueNumber;
}
@ -2214,7 +2337,11 @@ void vQueueDelete( QueueHandle_t xQueue )
void vQueueSetQueueNumber( QueueHandle_t xQueue,
UBaseType_t uxQueueNumber )
{
traceENTER_vQueueSetQueueNumber( xQueue, uxQueueNumber );
( ( Queue_t * ) xQueue )->uxQueueNumber = uxQueueNumber;
traceRETURN_vQueueSetQueueNumber();
}
#endif /* configUSE_TRACE_FACILITY */
@ -2224,6 +2351,10 @@ void vQueueDelete( QueueHandle_t xQueue )
uint8_t ucQueueGetQueueType( QueueHandle_t xQueue )
{
traceENTER_ucQueueGetQueueType( xQueue );
traceRETURN_ucQueueGetQueueType( ( ( Queue_t * ) xQueue )->ucQueueType );
return ( ( Queue_t * ) xQueue )->ucQueueType;
}
@ -2232,12 +2363,20 @@ void vQueueDelete( QueueHandle_t xQueue )
UBaseType_t uxQueueGetQueueItemSize( QueueHandle_t xQueue ) /* PRIVILEGED_FUNCTION */
{
traceENTER_uxQueueGetQueueItemSize( xQueue );
traceRETURN_uxQueueGetQueueItemSize( ( ( Queue_t * ) xQueue )->uxItemSize );
return ( ( Queue_t * ) xQueue )->uxItemSize;
}
/*-----------------------------------------------------------*/
UBaseType_t uxQueueGetQueueLength( QueueHandle_t xQueue ) /* PRIVILEGED_FUNCTION */
{
traceENTER_uxQueueGetQueueLength( xQueue );
traceRETURN_uxQueueGetQueueLength( ( ( Queue_t * ) xQueue )->uxLength );
return ( ( Queue_t * ) xQueue )->uxLength;
}
/*-----------------------------------------------------------*/
@ -2519,6 +2658,8 @@ BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue )
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueIsQueueEmptyFromISR( xQueue );
configASSERT( pxQueue );
if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 )
@ -2530,6 +2671,8 @@ BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue )
xReturn = pdFALSE;
}
traceRETURN_xQueueIsQueueEmptyFromISR( xReturn );
return xReturn;
} /*lint !e818 xQueue could not be pointer to const because it is a typedef. */
/*-----------------------------------------------------------*/
@ -2560,6 +2703,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueIsQueueFullFromISR( xQueue );
configASSERT( pxQueue );
if( pxQueue->uxMessagesWaiting == pxQueue->uxLength )
@ -2571,6 +2716,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
xReturn = pdFALSE;
}
traceRETURN_xQueueIsQueueFullFromISR( xReturn );
return xReturn;
} /*lint !e818 xQueue could not be pointer to const because it is a typedef. */
/*-----------------------------------------------------------*/
@ -2584,6 +2731,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueCRSend( xQueue, pvItemToQueue, xTicksToWait );
/* If the queue is already full we may have to block. A critical section
* is required to prevent an interrupt removing something from the queue
* between the check to see if the queue is full and blocking on the queue. */
@ -2648,6 +2797,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
}
portENABLE_INTERRUPTS();
traceRETURN_xQueueCRSend( xReturn );
return xReturn;
}
@ -2663,6 +2814,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueCRReceive( xQueue, pvBuffer, xTicksToWait );
/* If the queue is already empty we may have to block. A critical section
* is required to prevent an interrupt adding something to the queue
* between the check to see if the queue is empty and blocking on the queue. */
@ -2742,6 +2895,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
}
portENABLE_INTERRUPTS();
traceRETURN_xQueueCRReceive( xReturn );
return xReturn;
}
@ -2756,6 +2911,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
{
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueCRSendFromISR( xQueue, pvItemToQueue, xCoRoutinePreviouslyWoken );
/* Cannot block within an ISR so if there is no space on the queue then
* exit without doing anything. */
if( pxQueue->uxMessagesWaiting < pxQueue->uxLength )
@ -2792,6 +2949,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
mtCOVERAGE_TEST_MARKER();
}
traceRETURN_xQueueCRSendFromISR( xCoRoutinePreviouslyWoken );
return xCoRoutinePreviouslyWoken;
}
@ -2807,6 +2966,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueCRReceiveFromISR( xQueue, pvBuffer, pxCoRoutineWoken );
/* We cannot block from an ISR, so check there is data available. If
* not then just leave without doing anything. */
if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )
@ -2856,6 +3017,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
xReturn = pdFAIL;
}
traceRETURN_xQueueCRReceiveFromISR( xReturn );
return xReturn;
}
@ -2870,6 +3033,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
UBaseType_t ux;
QueueRegistryItem_t * pxEntryToWrite = NULL;
traceENTER_vQueueAddToRegistry( xQueue, pcQueueName );
configASSERT( xQueue );
if( pcQueueName != NULL )
@ -2904,6 +3069,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName );
}
traceRETURN_vQueueAddToRegistry();
}
#endif /* configQUEUE_REGISTRY_SIZE */
@ -2916,6 +3083,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
UBaseType_t ux;
const char * pcReturn = NULL; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
traceENTER_pcQueueGetName( xQueue );
configASSERT( xQueue );
/* Note there is nothing here to protect against another task adding or
@ -2934,6 +3103,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
}
}
traceRETURN_pcQueueGetName( pcReturn );
return pcReturn;
} /*lint !e818 xQueue cannot be a pointer to const because it is a typedef. */
@ -2946,6 +3117,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
{
UBaseType_t ux;
traceENTER_vQueueUnregisterQueue( xQueue );
configASSERT( xQueue );
/* See if the handle of the queue being unregistered in actually in the
@ -2968,6 +3141,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
mtCOVERAGE_TEST_MARKER();
}
}
traceRETURN_vQueueUnregisterQueue();
} /*lint !e818 xQueue could not be pointer to const because it is a typedef. */
#endif /* configQUEUE_REGISTRY_SIZE */
@ -2981,6 +3156,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
{
Queue_t * const pxQueue = xQueue;
traceENTER_vQueueWaitForMessageRestricted( xQueue, xTicksToWait, xWaitIndefinitely );
/* This function should not be called by application code hence the
* 'Restricted' in its name. It is not part of the public API. It is
* designed for use by kernel code, and has special calling requirements.
@ -3008,6 +3185,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
}
prvUnlockQueue( pxQueue );
traceRETURN_vQueueWaitForMessageRestricted();
}
#endif /* configUSE_TIMERS */
@ -3019,8 +3198,12 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
{
QueueSetHandle_t pxQueue;
traceENTER_xQueueCreateSet( uxEventQueueLength );
pxQueue = xQueueGenericCreate( uxEventQueueLength, ( UBaseType_t ) sizeof( Queue_t * ), queueQUEUE_TYPE_SET );
traceRETURN_xQueueCreateSet( pxQueue );
return pxQueue;
}
@ -3034,6 +3217,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
{
BaseType_t xReturn;
traceENTER_xQueueAddToSet( xQueueOrSemaphore, xQueueSet );
taskENTER_CRITICAL();
{
if( ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL )
@ -3055,6 +3240,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
}
taskEXIT_CRITICAL();
traceRETURN_xQueueAddToSet( xReturn );
return xReturn;
}
@ -3069,6 +3256,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
BaseType_t xReturn;
Queue_t * const pxQueueOrSemaphore = ( Queue_t * ) xQueueOrSemaphore;
traceENTER_xQueueRemoveFromSet( xQueueOrSemaphore, xQueueSet );
if( pxQueueOrSemaphore->pxQueueSetContainer != xQueueSet )
{
/* The queue was not a member of the set. */
@ -3092,6 +3281,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
xReturn = pdPASS;
}
traceRETURN_xQueueRemoveFromSet( xReturn );
return xReturn;
} /*lint !e818 xQueueSet could not be declared as pointing to const as it is a typedef. */
@ -3105,7 +3296,12 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
{
QueueSetMemberHandle_t xReturn = NULL;
traceENTER_xQueueSelectFromSet( xQueueSet, xTicksToWait );
( void ) xQueueReceive( ( QueueHandle_t ) xQueueSet, &xReturn, xTicksToWait ); /*lint !e961 Casting from one typedef to another is not redundant. */
traceRETURN_xQueueSelectFromSet( xReturn );
return xReturn;
}
@ -3118,7 +3314,12 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
{
QueueSetMemberHandle_t xReturn = NULL;
traceENTER_xQueueSelectFromSetFromISR( xQueueSet );
( void ) xQueueReceiveFromISR( ( QueueHandle_t ) xQueueSet, &xReturn, NULL ); /*lint !e961 Casting from one typedef to another is not redundant. */
traceRETURN_xQueueSelectFromSetFromISR( xReturn );
return xReturn;
}