diff --git a/croutine.c b/croutine.c index 8969dc89b71..f7d8ab95dd7 100644 --- a/croutine.c +++ b/croutine.c @@ -107,6 +107,8 @@ BaseType_t xReturn; CRCB_t * pxCoRoutine; + traceENTER_xCoRoutineCreate( pxCoRoutineCode, uxPriority, uxIndex ); + /* Allocate the memory that will store the co-routine control block. */ pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) ); @@ -156,6 +158,8 @@ xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY; } + traceRETURN_xCoRoutineCreate( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -165,6 +169,8 @@ { TickType_t xTimeToWake; + traceENTER_vCoRoutineAddToDelayedList( xTicksToDelay, pxEventList ); + /* Calculate the time to wake - this may overflow but this is * not a problem. */ xTimeToWake = xCoRoutineTickCount + xTicksToDelay; @@ -196,6 +202,8 @@ * function must be called with interrupts disabled. */ vListInsert( pxEventList, &( pxCurrentCoRoutine->xEventListItem ) ); } + + traceRETURN_vCoRoutineAddToDelayedList(); } /*-----------------------------------------------------------*/ @@ -283,6 +291,8 @@ void vCoRoutineSchedule( void ) { + traceENTER_vCoRoutineSchedule(); + /* Only run a co-routine after prvInitialiseCoRoutineLists() has been * called. prvInitialiseCoRoutineLists() is called automatically when a * co-routine is created. */ @@ -313,6 +323,8 @@ /* Call the co-routine. */ ( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex ); } + + traceRETURN_vCoRoutineSchedule(); } /*-----------------------------------------------------------*/ @@ -341,6 +353,8 @@ CRCB_t * pxUnblockedCRCB; BaseType_t xReturn; + traceENTER_xCoRoutineRemoveFromEventList( pxEventList ); + /* This function is called from within an interrupt. It can only access * event lists and the pending ready list. This function assumes that a * check has already been made to ensure pxEventList is not empty. */ @@ -357,6 +371,8 @@ xReturn = pdFALSE; } + traceRETURN_xCoRoutineRemoveFromEventList( xReturn ); + return xReturn; } diff --git a/event_groups.c b/event_groups.c index 24d818711a7..6b68c087a10 100644 --- a/event_groups.c +++ b/event_groups.c @@ -82,6 +82,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, { EventGroup_t * pxEventBits; + traceENTER_xEventGroupCreateStatic( pxEventGroupBuffer ); + /* A StaticEventGroup_t object must be provided. */ configASSERT( pxEventGroupBuffer ); @@ -122,6 +124,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, traceEVENT_GROUP_CREATE_FAILED(); } + traceRETURN_xEventGroupCreateStatic( pxEventBits ); + return pxEventBits; } @@ -134,6 +138,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, { EventGroup_t * pxEventBits; + traceENTER_xEventGroupCreate(); + /* Allocate the event group. Justification for MISRA deviation as * follows: pvPortMalloc() always ensures returned memory blocks are * aligned per the requirements of the MCU stack. In this case @@ -170,6 +176,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, traceEVENT_GROUP_CREATE_FAILED(); /*lint !e9063 Else branch only exists to allow tracing and does not generate code if trace macros are not defined. */ } + traceRETURN_xEventGroupCreate( pxEventBits ); + return pxEventBits; } @@ -186,6 +194,8 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, BaseType_t xAlreadyYielded; BaseType_t xTimeoutOccurred = pdFALSE; + traceENTER_xEventGroupSync( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTicksToWait ); + configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 ); configASSERT( uxBitsToWaitFor != 0 ); #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) @@ -303,6 +313,8 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, /* Prevent compiler warnings when trace macros are not used. */ ( void ) xTimeoutOccurred; + traceRETURN_xEventGroupSync( uxReturn ); + return uxReturn; } /*-----------------------------------------------------------*/ @@ -318,6 +330,8 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, BaseType_t xWaitConditionMet, xAlreadyYielded; BaseType_t xTimeoutOccurred = pdFALSE; + traceENTER_xEventGroupWaitBits( xEventGroup, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait ); + /* Check the user is not attempting to wait on the bits used by the kernel * itself, and that at least one bit is being requested. */ configASSERT( xEventGroup ); @@ -467,6 +481,8 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, /* Prevent compiler warnings when trace macros are not used. */ ( void ) xTimeoutOccurred; + traceRETURN_xEventGroupWaitBits( uxReturn ); + return uxReturn; } /*-----------------------------------------------------------*/ @@ -477,6 +493,8 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, EventGroup_t * pxEventBits = xEventGroup; EventBits_t uxReturn; + traceENTER_xEventGroupClearBits( xEventGroup, uxBitsToClear ); + /* Check the user is not attempting to clear the bits used by the kernel * itself. */ configASSERT( xEventGroup ); @@ -495,6 +513,8 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, } taskEXIT_CRITICAL(); + traceRETURN_xEventGroupClearBits( uxReturn ); + return uxReturn; } /*-----------------------------------------------------------*/ @@ -506,9 +526,13 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, { BaseType_t xReturn; + traceENTER_xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear ); + traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear ); xReturn = xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL ); /*lint !e9087 Can't avoid cast to void* as a generic callback function not specific to this use case. Callback casts back to original type so safe. */ + traceRETURN_xEventGroupClearBitsFromISR( xReturn ); + return xReturn; } @@ -521,12 +545,16 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) EventGroup_t const * const pxEventBits = xEventGroup; EventBits_t uxReturn; + traceENTER_xEventGroupGetBitsFromISR( xEventGroup ); + uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR(); { uxReturn = pxEventBits->uxEventBits; } taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus ); + traceRETURN_xEventGroupGetBitsFromISR( uxReturn ); + return uxReturn; } /*lint !e818 EventGroupHandle_t is a typedef used in other functions to so can't be pointer to const. */ /*-----------------------------------------------------------*/ @@ -542,6 +570,8 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, EventGroup_t * pxEventBits = xEventGroup; BaseType_t xMatchFound = pdFALSE; + traceENTER_xEventGroupSetBits( xEventGroup, uxBitsToSet ); + /* Check the user is not attempting to set the bits used by the kernel * itself. */ configASSERT( xEventGroup ); @@ -623,6 +653,8 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, } ( void ) xTaskResumeAll(); + traceRETURN_xEventGroupSetBits( pxEventBits->uxEventBits ); + return pxEventBits->uxEventBits; } /*-----------------------------------------------------------*/ @@ -632,6 +664,8 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) EventGroup_t * pxEventBits = xEventGroup; const List_t * pxTasksWaitingForBits; + traceENTER_vEventGroupDelete( xEventGroup ); + configASSERT( pxEventBits ); pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits ); @@ -670,6 +704,8 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) } } #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ + + traceRETURN_vEventGroupDelete(); } /*-----------------------------------------------------------*/ @@ -680,6 +716,8 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) BaseType_t xReturn; EventGroup_t * pxEventBits = xEventGroup; + traceENTER_xEventGroupGetStaticBuffer( xEventGroup, ppxEventGroupBuffer ); + configASSERT( pxEventBits ); configASSERT( ppxEventGroupBuffer ); @@ -704,6 +742,8 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) } #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ + traceRETURN_xEventGroupGetStaticBuffer( xReturn ); + return xReturn; } #endif /* configSUPPORT_STATIC_ALLOCATION */ @@ -714,7 +754,11 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) void vEventGroupSetBitsCallback( void * pvEventGroup, const uint32_t ulBitsToSet ) { + traceENTER_vEventGroupSetBitsCallback( pvEventGroup, ulBitsToSet ); + ( void ) xEventGroupSetBits( pvEventGroup, ( EventBits_t ) ulBitsToSet ); /*lint !e9079 Can't avoid cast to void* as a generic timer callback prototype. Callback casts back to original type so safe. */ + + traceRETURN_vEventGroupSetBitsCallback(); } /*-----------------------------------------------------------*/ @@ -723,7 +767,11 @@ void vEventGroupSetBitsCallback( void * pvEventGroup, void vEventGroupClearBitsCallback( void * pvEventGroup, const uint32_t ulBitsToClear ) { + traceENTER_vEventGroupClearBitsCallback( pvEventGroup, ulBitsToClear ); + ( void ) xEventGroupClearBits( pvEventGroup, ( EventBits_t ) ulBitsToClear ); /*lint !e9079 Can't avoid cast to void* as a generic timer callback prototype. Callback casts back to original type so safe. */ + + traceRETURN_vEventGroupClearBitsCallback(); } /*-----------------------------------------------------------*/ @@ -772,9 +820,13 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, { BaseType_t xReturn; + traceENTER_xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ); + traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet ); xReturn = xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken ); /*lint !e9087 Can't avoid cast to void* as a generic callback function not specific to this use case. Callback casts back to original type so safe. */ + traceRETURN_xEventGroupSetBitsFromISR( xReturn ); + return xReturn; } @@ -788,6 +840,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, UBaseType_t xReturn; EventGroup_t const * pxEventBits = ( EventGroup_t * ) xEventGroup; /*lint !e9087 !e9079 EventGroupHandle_t is a pointer to an EventGroup_t, but EventGroupHandle_t is kept opaque outside of this file for data hiding purposes. */ + traceENTER_uxEventGroupGetNumber( xEventGroup ); + if( xEventGroup == NULL ) { xReturn = 0; @@ -797,6 +851,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, xReturn = pxEventBits->uxEventGroupNumber; } + traceRETURN_uxEventGroupGetNumber( xReturn ); + return xReturn; } @@ -808,7 +864,11 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, void vEventGroupSetNumber( void * xEventGroup, UBaseType_t uxEventGroupNumber ) { + traceENTER_vEventGroupSetNumber( xEventGroup, uxEventGroupNumber ); + ( ( EventGroup_t * ) xEventGroup )->uxEventGroupNumber = uxEventGroupNumber; /*lint !e9087 !e9079 EventGroupHandle_t is a pointer to an EventGroup_t, but EventGroupHandle_t is kept opaque outside of this file for data hiding purposes. */ + + traceRETURN_vEventGroupSetNumber(); } #endif /* configUSE_TRACE_FACILITY */ diff --git a/include/FreeRTOS.h b/include/FreeRTOS.h index 33ce36bb9f8..44ebb063e50 100644 --- a/include/FreeRTOS.h +++ b/include/FreeRTOS.h @@ -978,6 +978,1542 @@ #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength ) #endif +#ifndef traceENTER_xEventGroupCreateStatic + #define traceENTER_xEventGroupCreateStatic( pxEventGroupBuffer ) +#endif + +#ifndef traceRETURN_xEventGroupCreateStatic + #define traceRETURN_xEventGroupCreateStatic( pxEventBits ) +#endif + +#ifndef traceENTER_xEventGroupCreate + #define traceENTER_xEventGroupCreate() +#endif + +#ifndef traceRETURN_xEventGroupCreate + #define traceRETURN_xEventGroupCreate( pxEventBits ) +#endif + +#ifndef traceENTER_xEventGroupSync + #define traceENTER_xEventGroupSync( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTicksToWait ) +#endif + +#ifndef traceRETURN_xEventGroupSync + #define traceRETURN_xEventGroupSync( uxReturn ) +#endif + +#ifndef traceENTER_xEventGroupWaitBits + #define traceENTER_xEventGroupWaitBits( xEventGroup, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait ) +#endif + +#ifndef traceRETURN_xEventGroupWaitBits + #define traceRETURN_xEventGroupWaitBits( uxReturn ) +#endif + +#ifndef traceENTER_xEventGroupClearBits + #define traceENTER_xEventGroupClearBits( xEventGroup, uxBitsToClear ) +#endif + +#ifndef traceRETURN_xEventGroupClearBits + #define traceRETURN_xEventGroupClearBits( uxReturn ) +#endif + +#ifndef traceENTER_xEventGroupClearBitsFromISR + #define traceENTER_xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear ) +#endif + +#ifndef traceRETURN_xEventGroupClearBitsFromISR + #define traceRETURN_xEventGroupClearBitsFromISR( xReturn ) +#endif + +#ifndef traceENTER_xEventGroupGetBitsFromISR + #define traceENTER_xEventGroupGetBitsFromISR( xEventGroup ) +#endif + +#ifndef traceRETURN_xEventGroupGetBitsFromISR + #define traceRETURN_xEventGroupGetBitsFromISR( uxReturn ) +#endif + +#ifndef traceENTER_xEventGroupSetBits + #define traceENTER_xEventGroupSetBits( xEventGroup, uxBitsToSet ) +#endif + +#ifndef traceRETURN_xEventGroupSetBits + #define traceRETURN_xEventGroupSetBits( uxEventBits ) +#endif + +#ifndef traceENTER_vEventGroupDelete + #define traceENTER_vEventGroupDelete( xEventGroup ) +#endif + +#ifndef traceRETURN_vEventGroupDelete + #define traceRETURN_vEventGroupDelete() +#endif + +#ifndef traceENTER_xEventGroupGetStaticBuffer + #define traceENTER_xEventGroupGetStaticBuffer( xEventGroup, ppxEventGroupBuffer ) +#endif + +#ifndef traceRETURN_xEventGroupGetStaticBuffer + #define traceRETURN_xEventGroupGetStaticBuffer( xReturn ) +#endif + +#ifndef traceENTER_vEventGroupSetBitsCallback + #define traceENTER_vEventGroupSetBitsCallback( pvEventGroup, ulBitsToSet ) +#endif + +#ifndef traceRETURN_vEventGroupSetBitsCallback + #define traceRETURN_vEventGroupSetBitsCallback() +#endif + +#ifndef traceENTER_vEventGroupClearBitsCallback + #define traceENTER_vEventGroupClearBitsCallback( pvEventGroup, ulBitsToClear ) +#endif + +#ifndef traceRETURN_vEventGroupClearBitsCallback + #define traceRETURN_vEventGroupClearBitsCallback() +#endif + +#ifndef traceENTER_xEventGroupSetBitsFromISR + #define traceENTER_xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) +#endif + +#ifndef traceRETURN_xEventGroupSetBitsFromISR + #define traceRETURN_xEventGroupSetBitsFromISR( xReturn ) +#endif + +#ifndef traceENTER_uxEventGroupGetNumber + #define traceENTER_uxEventGroupGetNumber( xEventGroup ) +#endif + +#ifndef traceRETURN_uxEventGroupGetNumber + #define traceRETURN_uxEventGroupGetNumber( xReturn ) +#endif + +#ifndef traceENTER_vEventGroupSetNumber + #define traceENTER_vEventGroupSetNumber( xEventGroup, uxEventGroupNumber ) +#endif + +#ifndef traceRETURN_vEventGroupSetNumber + #define traceRETURN_vEventGroupSetNumber() +#endif + +#ifndef traceENTER_xQueueGenericReset + #define traceENTER_xQueueGenericReset( xQueue, xNewQueue ) +#endif + +#ifndef traceRETURN_xQueueGenericReset + #define traceRETURN_xQueueGenericReset( xReturn ) +#endif + +#ifndef traceENTER_xQueueGenericCreateStatic + #define traceENTER_xQueueGenericCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxStaticQueue, ucQueueType ) +#endif + +#ifndef traceRETURN_xQueueGenericCreateStatic + #define traceRETURN_xQueueGenericCreateStatic( pxNewQueue ) +#endif + +#ifndef traceENTER_xQueueGenericGetStaticBuffers + #define traceENTER_xQueueGenericGetStaticBuffers( xQueue, ppucQueueStorage, ppxStaticQueue ) +#endif + +#ifndef traceRETURN_xQueueGenericGetStaticBuffers + #define traceRETURN_xQueueGenericGetStaticBuffers( xReturn ) +#endif + +#ifndef traceENTER_xQueueGenericCreate + #define traceENTER_xQueueGenericCreate( uxQueueLength, uxItemSize, ucQueueType ) +#endif + +#ifndef traceRETURN_xQueueGenericCreate + #define traceRETURN_xQueueGenericCreate( pxNewQueue ) +#endif + +#ifndef traceENTER_xQueueCreateMutex + #define traceENTER_xQueueCreateMutex( ucQueueType ) +#endif + +#ifndef traceRETURN_xQueueCreateMutex + #define traceRETURN_xQueueCreateMutex( xNewQueue ) +#endif + +#ifndef traceENTER_xQueueCreateMutexStatic + #define traceENTER_xQueueCreateMutexStatic( ucQueueType, pxStaticQueue ) +#endif + +#ifndef traceRETURN_xQueueCreateMutexStatic + #define traceRETURN_xQueueCreateMutexStatic( xNewQueue ) +#endif + +#ifndef traceENTER_xQueueGetMutexHolder + #define traceENTER_xQueueGetMutexHolder( xSemaphore ) +#endif + +#ifndef traceRETURN_xQueueGetMutexHolder + #define traceRETURN_xQueueGetMutexHolder( pxReturn ) +#endif + +#ifndef traceENTER_xQueueGetMutexHolderFromISR + #define traceENTER_xQueueGetMutexHolderFromISR( xSemaphore ) +#endif + +#ifndef traceRETURN_xQueueGetMutexHolderFromISR + #define traceRETURN_xQueueGetMutexHolderFromISR( pxReturn ) +#endif + +#ifndef traceENTER_xQueueGiveMutexRecursive + #define traceENTER_xQueueGiveMutexRecursive( xMutex ) +#endif + +#ifndef traceRETURN_xQueueGiveMutexRecursive + #define traceRETURN_xQueueGiveMutexRecursive( xReturn ) +#endif + +#ifndef traceENTER_xQueueTakeMutexRecursive + #define traceENTER_xQueueTakeMutexRecursive( xMutex, xTicksToWait ) +#endif + +#ifndef traceRETURN_xQueueTakeMutexRecursive + #define traceRETURN_xQueueTakeMutexRecursive( xReturn ) +#endif + +#ifndef traceENTER_xQueueCreateCountingSemaphoreStatic + #define traceENTER_xQueueCreateCountingSemaphoreStatic( uxMaxCount, uxInitialCount, pxStaticQueue ) +#endif + +#ifndef traceRETURN_xQueueCreateCountingSemaphoreStatic + #define traceRETURN_xQueueCreateCountingSemaphoreStatic( xHandle ) +#endif + +#ifndef traceENTER_xQueueCreateCountingSemaphore + #define traceENTER_xQueueCreateCountingSemaphore( uxMaxCount, uxInitialCount ) +#endif + +#ifndef traceRETURN_xQueueCreateCountingSemaphore + #define traceRETURN_xQueueCreateCountingSemaphore( xHandle ) +#endif + +#ifndef traceENTER_xQueueGenericSend + #define traceENTER_xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, xCopyPosition ) +#endif + +#ifndef traceRETURN_xQueueGenericSend + #define traceRETURN_xQueueGenericSend( xReturn ) +#endif + +#ifndef traceENTER_xQueueGenericSendFromISR + #define traceENTER_xQueueGenericSendFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken, xCopyPosition ) +#endif + +#ifndef traceRETURN_xQueueGenericSendFromISR + #define traceRETURN_xQueueGenericSendFromISR( xReturn ) +#endif + +#ifndef traceENTER_xQueueGiveFromISR + #define traceENTER_xQueueGiveFromISR( xQueue, pxHigherPriorityTaskWoken ) +#endif + +#ifndef traceRETURN_xQueueGiveFromISR + #define traceRETURN_xQueueGiveFromISR( xReturn ) +#endif + +#ifndef traceENTER_xQueueReceive + #define traceENTER_xQueueReceive( xQueue, pvBuffer, xTicksToWait ) +#endif + +#ifndef traceRETURN_xQueueReceive + #define traceRETURN_xQueueReceive( xReturn ) +#endif + +#ifndef traceENTER_xQueueSemaphoreTake + #define traceENTER_xQueueSemaphoreTake( xQueue, xTicksToWait ) +#endif + +#ifndef traceRETURN_xQueueSemaphoreTake + #define traceRETURN_xQueueSemaphoreTake( xReturn ) +#endif + +#ifndef traceENTER_xQueuePeek + #define traceENTER_xQueuePeek( xQueue, pvBuffer, xTicksToWait ) +#endif + +#ifndef traceRETURN_xQueuePeek + #define traceRETURN_xQueuePeek( xReturn ) +#endif + +#ifndef traceENTER_xQueueReceiveFromISR + #define traceENTER_xQueueReceiveFromISR( xQueue, pvBuffer, pxHigherPriorityTaskWoken ) +#endif + +#ifndef traceRETURN_xQueueReceiveFromISR + #define traceRETURN_xQueueReceiveFromISR( xReturn ) +#endif + +#ifndef traceENTER_xQueuePeekFromISR + #define traceENTER_xQueuePeekFromISR( xQueue, pvBuffer ) +#endif + +#ifndef traceRETURN_xQueuePeekFromISR + #define traceRETURN_xQueuePeekFromISR( xReturn ) +#endif + +#ifndef traceENTER_uxQueueMessagesWaiting + #define traceENTER_uxQueueMessagesWaiting( xQueue ) +#endif + +#ifndef traceRETURN_uxQueueMessagesWaiting + #define traceRETURN_uxQueueMessagesWaiting( uxReturn ) +#endif + +#ifndef traceENTER_uxQueueSpacesAvailable + #define traceENTER_uxQueueSpacesAvailable( xQueue ) +#endif + +#ifndef traceRETURN_uxQueueSpacesAvailable + #define traceRETURN_uxQueueSpacesAvailable( uxReturn ) +#endif + +#ifndef traceENTER_uxQueueMessagesWaitingFromISR + #define traceENTER_uxQueueMessagesWaitingFromISR( xQueue ) +#endif + +#ifndef traceRETURN_uxQueueMessagesWaitingFromISR + #define traceRETURN_uxQueueMessagesWaitingFromISR( uxReturn ) +#endif + +#ifndef traceENTER_vQueueDelete + #define traceENTER_vQueueDelete( xQueue ) +#endif + +#ifndef traceRETURN_vQueueDelete + #define traceRETURN_vQueueDelete() +#endif + +#ifndef traceENTER_uxQueueGetQueueNumber + #define traceENTER_uxQueueGetQueueNumber( xQueue ) +#endif + +#ifndef traceRETURN_uxQueueGetQueueNumber + #define traceRETURN_uxQueueGetQueueNumber( uxQueueNumber ) +#endif + +#ifndef traceENTER_vQueueSetQueueNumber + #define traceENTER_vQueueSetQueueNumber( xQueue, uxQueueNumber ) +#endif + +#ifndef traceRETURN_vQueueSetQueueNumber + #define traceRETURN_vQueueSetQueueNumber() +#endif + +#ifndef traceENTER_ucQueueGetQueueType + #define traceENTER_ucQueueGetQueueType( xQueue ) +#endif + +#ifndef traceRETURN_ucQueueGetQueueType + #define traceRETURN_ucQueueGetQueueType( ucQueueType ) +#endif + +#ifndef traceENTER_uxQueueGetQueueItemSize + #define traceENTER_uxQueueGetQueueItemSize( xQueue ) +#endif + +#ifndef traceRETURN_uxQueueGetQueueItemSize + #define traceRETURN_uxQueueGetQueueItemSize( uxItemSize ) +#endif + +#ifndef traceENTER_uxQueueGetQueueLength + #define traceENTER_uxQueueGetQueueLength( xQueue ) +#endif + +#ifndef traceRETURN_uxQueueGetQueueLength + #define traceRETURN_uxQueueGetQueueLength( uxLength ) +#endif + +#ifndef traceENTER_xQueueIsQueueEmptyFromISR + #define traceENTER_xQueueIsQueueEmptyFromISR( xQueue ) +#endif + +#ifndef traceRETURN_xQueueIsQueueEmptyFromISR + #define traceRETURN_xQueueIsQueueEmptyFromISR( xReturn ) +#endif + +#ifndef traceENTER_xQueueIsQueueFullFromISR + #define traceENTER_xQueueIsQueueFullFromISR( xQueue ) +#endif + +#ifndef traceRETURN_xQueueIsQueueFullFromISR + #define traceRETURN_xQueueIsQueueFullFromISR( xReturn ) +#endif + +#ifndef traceENTER_xQueueCRSend + #define traceENTER_xQueueCRSend( xQueue, pvItemToQueue, xTicksToWait ) +#endif + +#ifndef traceRETURN_xQueueCRSend + #define traceRETURN_xQueueCRSend( xReturn ) +#endif + +#ifndef traceENTER_xQueueCRReceive + #define traceENTER_xQueueCRReceive( xQueue, pvBuffer, xTicksToWait ) +#endif + +#ifndef traceRETURN_xQueueCRReceive + #define traceRETURN_xQueueCRReceive( xReturn ) +#endif + +#ifndef traceENTER_xQueueCRSendFromISR + #define traceENTER_xQueueCRSendFromISR( xQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) +#endif + +#ifndef traceRETURN_xQueueCRSendFromISR + #define traceRETURN_xQueueCRSendFromISR( xCoRoutinePreviouslyWoken ) +#endif + +#ifndef traceENTER_xQueueCRReceiveFromISR + #define traceENTER_xQueueCRReceiveFromISR( xQueue, pvBuffer, pxCoRoutineWoken ) +#endif + +#ifndef traceRETURN_xQueueCRReceiveFromISR + #define traceRETURN_xQueueCRReceiveFromISR( xReturn ) +#endif + +#ifndef traceENTER_vQueueAddToRegistry + #define traceENTER_vQueueAddToRegistry( xQueue, pcQueueName ) +#endif + +#ifndef traceRETURN_vQueueAddToRegistry + #define traceRETURN_vQueueAddToRegistry() +#endif + +#ifndef traceENTER_pcQueueGetName + #define traceENTER_pcQueueGetName( xQueue ) +#endif + +#ifndef traceRETURN_pcQueueGetName + #define traceRETURN_pcQueueGetName( pcReturn ) +#endif + +#ifndef traceENTER_vQueueUnregisterQueue + #define traceENTER_vQueueUnregisterQueue( xQueue ) +#endif + +#ifndef traceRETURN_vQueueUnregisterQueue + #define traceRETURN_vQueueUnregisterQueue() +#endif + +#ifndef traceENTER_vQueueWaitForMessageRestricted + #define traceENTER_vQueueWaitForMessageRestricted( xQueue, xTicksToWait, xWaitIndefinitely ) +#endif + +#ifndef traceRETURN_vQueueWaitForMessageRestricted + #define traceRETURN_vQueueWaitForMessageRestricted() +#endif + +#ifndef traceENTER_xQueueCreateSet + #define traceENTER_xQueueCreateSet( uxEventQueueLength ) +#endif + +#ifndef traceRETURN_xQueueCreateSet + #define traceRETURN_xQueueCreateSet( pxQueue ) +#endif + +#ifndef traceENTER_xQueueAddToSet + #define traceENTER_xQueueAddToSet( xQueueOrSemaphore, xQueueSet ) +#endif + +#ifndef traceRETURN_xQueueAddToSet + #define traceRETURN_xQueueAddToSet( xReturn ) +#endif + +#ifndef traceENTER_xQueueRemoveFromSet + #define traceENTER_xQueueRemoveFromSet( xQueueOrSemaphore, xQueueSet ) +#endif + +#ifndef traceRETURN_xQueueRemoveFromSet + #define traceRETURN_xQueueRemoveFromSet( xReturn ) +#endif + +#ifndef traceENTER_xQueueSelectFromSet + #define traceENTER_xQueueSelectFromSet( xQueueSet, xTicksToWait ) +#endif + +#ifndef traceRETURN_xQueueSelectFromSet + #define traceRETURN_xQueueSelectFromSet( xReturn ) +#endif + +#ifndef traceENTER_xQueueSelectFromSetFromISR + #define traceENTER_xQueueSelectFromSetFromISR( xQueueSet ) +#endif + +#ifndef traceRETURN_xQueueSelectFromSetFromISR + #define traceRETURN_xQueueSelectFromSetFromISR( xReturn ) +#endif + +#ifndef traceENTER_xTimerCreateTimerTask + #define traceENTER_xTimerCreateTimerTask() +#endif + +#ifndef traceRETURN_xTimerCreateTimerTask + #define traceRETURN_xTimerCreateTimerTask( xReturn ) +#endif + +#ifndef traceENTER_xTimerCreate + #define traceENTER_xTimerCreate( pcTimerName, xTimerPeriodInTicks, xAutoReload, pvTimerID, pxCallbackFunction ) +#endif + +#ifndef traceRETURN_xTimerCreate + #define traceRETURN_xTimerCreate( pxNewTimer ) +#endif + +#ifndef traceENTER_xTimerCreateStatic + #define traceENTER_xTimerCreateStatic( pcTimerName, xTimerPeriodInTicks, xAutoReload, pvTimerID, pxCallbackFunction, pxTimerBuffer ) +#endif + +#ifndef traceRETURN_xTimerCreateStatic + #define traceRETURN_xTimerCreateStatic( pxNewTimer ) +#endif + +#ifndef traceENTER_xTimerGenericCommandFromTask + #define traceENTER_xTimerGenericCommandFromTask( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ) +#endif + +#ifndef traceRETURN_xTimerGenericCommandFromTask + #define traceRETURN_xTimerGenericCommandFromTask( xReturn ) +#endif + +#ifndef traceENTER_xTimerGenericCommandFromISR + #define traceENTER_xTimerGenericCommandFromISR( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ) +#endif + +#ifndef traceRETURN_xTimerGenericCommandFromISR + #define traceRETURN_xTimerGenericCommandFromISR( xReturn ) +#endif + +#ifndef traceENTER_xTimerGetTimerDaemonTaskHandle + #define traceENTER_xTimerGetTimerDaemonTaskHandle() +#endif + +#ifndef traceRETURN_xTimerGetTimerDaemonTaskHandle + #define traceRETURN_xTimerGetTimerDaemonTaskHandle( xTimerTaskHandle ) +#endif + +#ifndef traceENTER_xTimerGetPeriod + #define traceENTER_xTimerGetPeriod( xTimer ) +#endif + +#ifndef traceRETURN_xTimerGetPeriod + #define traceRETURN_xTimerGetPeriod( xTimerPeriodInTicks ) +#endif + +#ifndef traceENTER_vTimerSetReloadMode + #define traceENTER_vTimerSetReloadMode( xTimer, xAutoReload ) +#endif + +#ifndef traceRETURN_vTimerSetReloadMode + #define traceRETURN_vTimerSetReloadMode() +#endif + +#ifndef traceENTER_xTimerGetReloadMode + #define traceENTER_xTimerGetReloadMode( xTimer ) +#endif + +#ifndef traceRETURN_xTimerGetReloadMode + #define traceRETURN_xTimerGetReloadMode( xReturn ) +#endif + +#ifndef traceENTER_uxTimerGetReloadMode + #define traceENTER_uxTimerGetReloadMode( xTimer ) +#endif + +#ifndef traceRETURN_uxTimerGetReloadMode + #define traceRETURN_uxTimerGetReloadMode( uxReturn ) +#endif + +#ifndef traceENTER_xTimerGetExpiryTime + #define traceENTER_xTimerGetExpiryTime( xTimer ) +#endif + +#ifndef traceRETURN_xTimerGetExpiryTime + #define traceRETURN_xTimerGetExpiryTime( xReturn ) +#endif + +#ifndef traceENTER_xTimerGetStaticBuffer + #define traceENTER_xTimerGetStaticBuffer( xTimer, ppxTimerBuffer ) +#endif + +#ifndef traceRETURN_xTimerGetStaticBuffer + #define traceRETURN_xTimerGetStaticBuffer( xReturn ) +#endif + +#ifndef traceENTER_pcTimerGetName + #define traceENTER_pcTimerGetName( xTimer ) +#endif + +#ifndef traceRETURN_pcTimerGetName + #define traceRETURN_pcTimerGetName( pcTimerName ) +#endif + +#ifndef traceENTER_xTimerIsTimerActive + #define traceENTER_xTimerIsTimerActive( xTimer ) +#endif + +#ifndef traceRETURN_xTimerIsTimerActive + #define traceRETURN_xTimerIsTimerActive( xReturn ) +#endif + +#ifndef traceENTER_pvTimerGetTimerID + #define traceENTER_pvTimerGetTimerID( xTimer ) +#endif + +#ifndef traceRETURN_pvTimerGetTimerID + #define traceRETURN_pvTimerGetTimerID( pvReturn ) +#endif + +#ifndef traceENTER_vTimerSetTimerID + #define traceENTER_vTimerSetTimerID( xTimer, pvNewID ) +#endif + +#ifndef traceRETURN_vTimerSetTimerID + #define traceRETURN_vTimerSetTimerID() +#endif + +#ifndef traceENTER_xTimerPendFunctionCallFromISR + #define traceENTER_xTimerPendFunctionCallFromISR( xFunctionToPend, pvParameter1, ulParameter2, pxHigherPriorityTaskWoken ) +#endif + +#ifndef traceRETURN_xTimerPendFunctionCallFromISR + #define traceRETURN_xTimerPendFunctionCallFromISR( xReturn ) +#endif + +#ifndef traceENTER_xTimerPendFunctionCall + #define traceENTER_xTimerPendFunctionCall( xFunctionToPend, pvParameter1, ulParameter2, xTicksToWait ) +#endif + +#ifndef traceRETURN_xTimerPendFunctionCall + #define traceRETURN_xTimerPendFunctionCall( xReturn ) +#endif + +#ifndef traceENTER_uxTimerGetTimerNumber + #define traceENTER_uxTimerGetTimerNumber( xTimer ) +#endif + +#ifndef traceRETURN_uxTimerGetTimerNumber + #define traceRETURN_uxTimerGetTimerNumber( uxTimerNumber ) +#endif + +#ifndef traceENTER_vTimerSetTimerNumber + #define traceENTER_vTimerSetTimerNumber( xTimer, uxTimerNumber ) +#endif + +#ifndef traceRETURN_vTimerSetTimerNumber + #define traceRETURN_vTimerSetTimerNumber() +#endif + +#ifndef traceENTER_xTaskCreateStatic + #define traceENTER_xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer ) +#endif + +#ifndef traceRETURN_xTaskCreateStatic + #define traceRETURN_xTaskCreateStatic( xReturn ) +#endif + +#ifndef traceENTER_xTaskCreateRestrictedStatic + #define traceENTER_xTaskCreateRestrictedStatic( pxTaskDefinition, pxCreatedTask ) +#endif + +#ifndef traceRETURN_xTaskCreateRestrictedStatic + #define traceRETURN_xTaskCreateRestrictedStatic( xReturn ) +#endif + +#ifndef traceENTER_xTaskCreateRestricted + #define traceENTER_xTaskCreateRestricted( pxTaskDefinition, pxCreatedTask ) +#endif + +#ifndef traceRETURN_xTaskCreateRestricted + #define traceRETURN_xTaskCreateRestricted( xReturn ) +#endif + +#ifndef traceENTER_xTaskCreate + #define traceENTER_xTaskCreate( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask ) +#endif + +#ifndef traceRETURN_xTaskCreate + #define traceRETURN_xTaskCreate( xReturn ) +#endif + +#ifndef traceENTER_vTaskDelete + #define traceENTER_vTaskDelete( xTaskToDelete ) +#endif + +#ifndef traceRETURN_vTaskDelete + #define traceRETURN_vTaskDelete() +#endif + +#ifndef traceENTER_xTaskDelayUntil + #define traceENTER_xTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ) +#endif + +#ifndef traceRETURN_xTaskDelayUntil + #define traceRETURN_xTaskDelayUntil( xShouldDelay ) +#endif + +#ifndef traceENTER_vTaskDelay + #define traceENTER_vTaskDelay( xTicksToDelay ) +#endif + +#ifndef traceRETURN_vTaskDelay + #define traceRETURN_vTaskDelay() +#endif + +#ifndef traceENTER_eTaskGetState + #define traceENTER_eTaskGetState( xTask ) +#endif + +#ifndef traceRETURN_eTaskGetState + #define traceRETURN_eTaskGetState( eReturn ) +#endif + +#ifndef traceENTER_uxTaskPriorityGet + #define traceENTER_uxTaskPriorityGet( xTask ) +#endif + +#ifndef traceRETURN_uxTaskPriorityGet + #define traceRETURN_uxTaskPriorityGet( uxReturn ) +#endif + +#ifndef traceENTER_uxTaskPriorityGetFromISR + #define traceENTER_uxTaskPriorityGetFromISR( xTask ) +#endif + +#ifndef traceRETURN_uxTaskPriorityGetFromISR + #define traceRETURN_uxTaskPriorityGetFromISR( uxReturn ) +#endif + +#ifndef traceENTER_vTaskPrioritySet + #define traceENTER_vTaskPrioritySet( xTask, uxNewPriority ) +#endif + +#ifndef traceRETURN_vTaskPrioritySet + #define traceRETURN_vTaskPrioritySet() +#endif + +#ifndef traceENTER_vTaskCoreAffinitySet + #define traceENTER_vTaskCoreAffinitySet( xTask, uxCoreAffinityMask ) +#endif + +#ifndef traceRETURN_vTaskCoreAffinitySet + #define traceRETURN_vTaskCoreAffinitySet() +#endif + +#ifndef traceENTER_vTaskCoreAffinityGet + #define traceENTER_vTaskCoreAffinityGet( xTask ) +#endif + +#ifndef traceRETURN_vTaskCoreAffinityGet + #define traceRETURN_vTaskCoreAffinityGet( uxCoreAffinityMask ) +#endif + +#ifndef traceENTER_vTaskPreemptionDisable + #define traceENTER_vTaskPreemptionDisable( xTask ) +#endif + +#ifndef traceRETURN_vTaskPreemptionDisable + #define traceRETURN_vTaskPreemptionDisable() +#endif + +#ifndef traceENTER_vTaskPreemptionEnable + #define traceENTER_vTaskPreemptionEnable( xTask ) +#endif + +#ifndef traceRETURN_vTaskPreemptionEnable + #define traceRETURN_vTaskPreemptionEnable() +#endif + +#ifndef traceENTER_vTaskSuspend + #define traceENTER_vTaskSuspend( xTaskToSuspend ) +#endif + +#ifndef traceRETURN_vTaskSuspend + #define traceRETURN_vTaskSuspend() +#endif + +#ifndef traceENTER_vTaskResume + #define traceENTER_vTaskResume( xTaskToResume ) +#endif + +#ifndef traceRETURN_vTaskResume + #define traceRETURN_vTaskResume() +#endif + +#ifndef traceENTER_xTaskResumeFromISR + #define traceENTER_xTaskResumeFromISR( xTaskToResume ) +#endif + +#ifndef traceRETURN_xTaskResumeFromISR + #define traceRETURN_xTaskResumeFromISR( xYieldRequired ) +#endif + +#ifndef traceENTER_vTaskStartScheduler + #define traceENTER_vTaskStartScheduler() +#endif + +#ifndef traceRETURN_vTaskStartScheduler + #define traceRETURN_vTaskStartScheduler() +#endif + +#ifndef traceENTER_vTaskEndScheduler + #define traceENTER_vTaskEndScheduler() +#endif + +#ifndef traceRETURN_vTaskEndScheduler + #define traceRETURN_vTaskEndScheduler() +#endif + +#ifndef traceENTER_vTaskSuspendAll + #define traceENTER_vTaskSuspendAll() +#endif + +#ifndef traceRETURN_vTaskSuspendAll + #define traceRETURN_vTaskSuspendAll() +#endif + +#ifndef traceENTER_xTaskResumeAll + #define traceENTER_xTaskResumeAll() +#endif + +#ifndef traceRETURN_xTaskResumeAll + #define traceRETURN_xTaskResumeAll( xAlreadyYielded ) +#endif + +#ifndef traceENTER_xTaskGetTickCount + #define traceENTER_xTaskGetTickCount() +#endif + +#ifndef traceRETURN_xTaskGetTickCount + #define traceRETURN_xTaskGetTickCount( xTicks ) +#endif + +#ifndef traceENTER_xTaskGetTickCountFromISR + #define traceENTER_xTaskGetTickCountFromISR() +#endif + +#ifndef traceRETURN_xTaskGetTickCountFromISR + #define traceRETURN_xTaskGetTickCountFromISR( xReturn ) +#endif + +#ifndef traceENTER_uxTaskGetNumberOfTasks + #define traceENTER_uxTaskGetNumberOfTasks() +#endif + +#ifndef traceRETURN_uxTaskGetNumberOfTasks + #define traceRETURN_uxTaskGetNumberOfTasks( uxCurrentNumberOfTasks ) +#endif + +#ifndef traceENTER_pcTaskGetName + #define traceENTER_pcTaskGetName( xTaskToQuery ) +#endif + +#ifndef traceRETURN_pcTaskGetName + #define traceRETURN_pcTaskGetName( pcTaskName ) +#endif + +#ifndef traceENTER_xTaskGetHandle + #define traceENTER_xTaskGetHandle( pcNameToQuery ) +#endif + +#ifndef traceRETURN_xTaskGetHandle + #define traceRETURN_xTaskGetHandle( pxTCB ) +#endif + +#ifndef traceENTER_xTaskGetStaticBuffers + #define traceENTER_xTaskGetStaticBuffers( xTask, ppuxStackBuffer, ppxTaskBuffer ) +#endif + +#ifndef traceRETURN_xTaskGetStaticBuffers + #define traceRETURN_xTaskGetStaticBuffers( xReturn ) +#endif + +#ifndef traceENTER_uxTaskGetSystemState + #define traceENTER_uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, pulTotalRunTime ) +#endif + +#ifndef traceRETURN_uxTaskGetSystemState + #define traceRETURN_uxTaskGetSystemState( uxTask ) +#endif + +#ifndef traceENTER_xTaskGetIdleTaskHandle + #define traceENTER_xTaskGetIdleTaskHandle() +#endif + +#ifndef traceRETURN_xTaskGetIdleTaskHandle + #define traceRETURN_xTaskGetIdleTaskHandle( xIdleTaskHandle ) +#endif + +#ifndef traceENTER_vTaskStepTick + #define traceENTER_vTaskStepTick( xTicksToJump ) +#endif + +#ifndef traceRETURN_vTaskStepTick + #define traceRETURN_vTaskStepTick() +#endif + +#ifndef traceENTER_xTaskCatchUpTicks + #define traceENTER_xTaskCatchUpTicks( xTicksToCatchUp ) +#endif + +#ifndef traceRETURN_xTaskCatchUpTicks + #define traceRETURN_xTaskCatchUpTicks( xYieldOccurred ) +#endif + +#ifndef traceENTER_xTaskAbortDelay + #define traceENTER_xTaskAbortDelay( xTask ) +#endif + +#ifndef traceRETURN_xTaskAbortDelay + #define traceRETURN_xTaskAbortDelay( xReturn ) +#endif + +#ifndef traceENTER_xTaskIncrementTick + #define traceENTER_xTaskIncrementTick() +#endif + +#ifndef traceRETURN_xTaskIncrementTick + #define traceRETURN_xTaskIncrementTick( xSwitchRequired ) +#endif + +#ifndef traceENTER_vTaskSetApplicationTaskTag + #define traceENTER_vTaskSetApplicationTaskTag( xTask, pxHookFunction ) +#endif + +#ifndef traceRETURN_vTaskSetApplicationTaskTag + #define traceRETURN_vTaskSetApplicationTaskTag() +#endif + +#ifndef traceENTER_xTaskGetApplicationTaskTag + #define traceENTER_xTaskGetApplicationTaskTag( xTask ) +#endif + +#ifndef traceRETURN_xTaskGetApplicationTaskTag + #define traceRETURN_xTaskGetApplicationTaskTag( xReturn ) +#endif + +#ifndef traceENTER_xTaskGetApplicationTaskTagFromISR + #define traceENTER_xTaskGetApplicationTaskTagFromISR( xTask ) +#endif + +#ifndef traceRETURN_xTaskGetApplicationTaskTagFromISR + #define traceRETURN_xTaskGetApplicationTaskTagFromISR( xReturn ) +#endif + +#ifndef traceENTER_xTaskCallApplicationTaskHook + #define traceENTER_xTaskCallApplicationTaskHook( xTask, pvParameter ) +#endif + +#ifndef traceRETURN_xTaskCallApplicationTaskHook + #define traceRETURN_xTaskCallApplicationTaskHook( xReturn ) +#endif + +#ifndef traceENTER_vTaskSwitchContext + #define traceENTER_vTaskSwitchContext() +#endif + +#ifndef traceRETURN_vTaskSwitchContext + #define traceRETURN_vTaskSwitchContext() +#endif + +#ifndef traceENTER_vTaskPlaceOnEventList + #define traceENTER_vTaskPlaceOnEventList( pxEventList, xTicksToWait ) +#endif + +#ifndef traceRETURN_vTaskPlaceOnEventList + #define traceRETURN_vTaskPlaceOnEventList() +#endif + +#ifndef traceENTER_vTaskPlaceOnUnorderedEventList + #define traceENTER_vTaskPlaceOnUnorderedEventList( pxEventList, xItemValue, xTicksToWait ) +#endif + +#ifndef traceRETURN_vTaskPlaceOnUnorderedEventList + #define traceRETURN_vTaskPlaceOnUnorderedEventList() +#endif + +#ifndef traceENTER_vTaskPlaceOnEventListRestricted + #define traceENTER_vTaskPlaceOnEventListRestricted( pxEventList, xTicksToWait, xWaitIndefinitely ) +#endif + +#ifndef traceRETURN_vTaskPlaceOnEventListRestricted + #define traceRETURN_vTaskPlaceOnEventListRestricted() +#endif + +#ifndef traceENTER_xTaskRemoveFromEventList + #define traceENTER_xTaskRemoveFromEventList( pxEventList ) +#endif + +#ifndef traceRETURN_xTaskRemoveFromEventList + #define traceRETURN_xTaskRemoveFromEventList( xReturn ) +#endif + +#ifndef traceENTER_vTaskRemoveFromUnorderedEventList + #define traceENTER_vTaskRemoveFromUnorderedEventList( pxEventListItem, xItemValue ) +#endif + +#ifndef traceRETURN_vTaskRemoveFromUnorderedEventList + #define traceRETURN_vTaskRemoveFromUnorderedEventList() +#endif + +#ifndef traceENTER_vTaskSetTimeOutState + #define traceENTER_vTaskSetTimeOutState( pxTimeOut ) +#endif + +#ifndef traceRETURN_vTaskSetTimeOutState + #define traceRETURN_vTaskSetTimeOutState() +#endif + +#ifndef traceENTER_vTaskInternalSetTimeOutState + #define traceENTER_vTaskInternalSetTimeOutState( pxTimeOut ) +#endif + +#ifndef traceRETURN_vTaskInternalSetTimeOutState + #define traceRETURN_vTaskInternalSetTimeOutState() +#endif + +#ifndef traceENTER_xTaskCheckForTimeOut + #define traceENTER_xTaskCheckForTimeOut( pxTimeOut, pxTicksToWait ) +#endif + +#ifndef traceRETURN_xTaskCheckForTimeOut + #define traceRETURN_xTaskCheckForTimeOut( xReturn ) +#endif + +#ifndef traceENTER_vTaskMissedYield + #define traceENTER_vTaskMissedYield() +#endif + +#ifndef traceRETURN_vTaskMissedYield + #define traceRETURN_vTaskMissedYield() +#endif + +#ifndef traceENTER_uxTaskGetTaskNumber + #define traceENTER_uxTaskGetTaskNumber( xTask ) +#endif + +#ifndef traceRETURN_uxTaskGetTaskNumber + #define traceRETURN_uxTaskGetTaskNumber( uxReturn ) +#endif + +#ifndef traceENTER_vTaskSetTaskNumber + #define traceENTER_vTaskSetTaskNumber( xTask, uxHandle ) +#endif + +#ifndef traceRETURN_vTaskSetTaskNumber + #define traceRETURN_vTaskSetTaskNumber() +#endif + +#ifndef traceENTER_eTaskConfirmSleepModeStatus + #define traceENTER_eTaskConfirmSleepModeStatus() +#endif + +#ifndef traceRETURN_eTaskConfirmSleepModeStatus + #define traceRETURN_eTaskConfirmSleepModeStatus( eReturn ) +#endif + +#ifndef traceENTER_vTaskSetThreadLocalStoragePointer + #define traceENTER_vTaskSetThreadLocalStoragePointer( xTaskToSet, xIndex, pvValue ) +#endif + +#ifndef traceRETURN_vTaskSetThreadLocalStoragePointer + #define traceRETURN_vTaskSetThreadLocalStoragePointer() +#endif + +#ifndef traceENTER_pvTaskGetThreadLocalStoragePointer + #define traceENTER_pvTaskGetThreadLocalStoragePointer( xTaskToQuery, xIndex ) +#endif + +#ifndef traceRETURN_pvTaskGetThreadLocalStoragePointer + #define traceRETURN_pvTaskGetThreadLocalStoragePointer( pvReturn ) +#endif + +#ifndef traceENTER_vTaskAllocateMPURegions + #define traceENTER_vTaskAllocateMPURegions( xTaskToModify, pxRegions ) +#endif + +#ifndef traceRETURN_vTaskAllocateMPURegions + #define traceRETURN_vTaskAllocateMPURegions() +#endif + +#ifndef traceENTER_vTaskGetInfo + #define traceENTER_vTaskGetInfo( xTask, pxTaskStatus, xGetFreeStackSpace, eState ) +#endif + +#ifndef traceRETURN_vTaskGetInfo + #define traceRETURN_vTaskGetInfo() +#endif + +#ifndef traceENTER_uxTaskGetStackHighWaterMark2 + #define traceENTER_uxTaskGetStackHighWaterMark2( xTask ) +#endif + +#ifndef traceRETURN_uxTaskGetStackHighWaterMark2 + #define traceRETURN_uxTaskGetStackHighWaterMark2( uxReturn ) +#endif + +#ifndef traceENTER_uxTaskGetStackHighWaterMark + #define traceENTER_uxTaskGetStackHighWaterMark( xTask ) +#endif + +#ifndef traceRETURN_uxTaskGetStackHighWaterMark + #define traceRETURN_uxTaskGetStackHighWaterMark( uxReturn ) +#endif + +#ifndef traceENTER_xTaskGetCurrentTaskHandle + #define traceENTER_xTaskGetCurrentTaskHandle() +#endif + +#ifndef traceRETURN_xTaskGetCurrentTaskHandle + #define traceRETURN_xTaskGetCurrentTaskHandle( xReturn ) +#endif + +#ifndef traceENTER_xTaskGetCurrentTaskHandleCPU + #define traceENTER_xTaskGetCurrentTaskHandleCPU( xCoreID ) +#endif + +#ifndef traceRETURN_xTaskGetCurrentTaskHandleCPU + #define traceRETURN_xTaskGetCurrentTaskHandleCPU( xReturn ) +#endif + +#ifndef traceENTER_xTaskGetSchedulerState + #define traceENTER_xTaskGetSchedulerState() +#endif + +#ifndef traceRETURN_xTaskGetSchedulerState + #define traceRETURN_xTaskGetSchedulerState( xReturn ) +#endif + +#ifndef traceENTER_xTaskPriorityInherit + #define traceENTER_xTaskPriorityInherit( pxMutexHolder ) +#endif + +#ifndef traceRETURN_xTaskPriorityInherit + #define traceRETURN_xTaskPriorityInherit( xReturn ) +#endif + +#ifndef traceENTER_xTaskPriorityDisinherit + #define traceENTER_xTaskPriorityDisinherit( pxMutexHolder ) +#endif + +#ifndef traceRETURN_xTaskPriorityDisinherit + #define traceRETURN_xTaskPriorityDisinherit( xReturn ) +#endif + +#ifndef traceENTER_vTaskPriorityDisinheritAfterTimeout + #define traceENTER_vTaskPriorityDisinheritAfterTimeout( pxMutexHolder, uxHighestPriorityWaitingTask ) +#endif + +#ifndef traceRETURN_vTaskPriorityDisinheritAfterTimeout + #define traceRETURN_vTaskPriorityDisinheritAfterTimeout() +#endif + +#ifndef traceENTER_vTaskYieldWithinAPI + #define traceENTER_vTaskYieldWithinAPI() +#endif + +#ifndef traceRETURN_vTaskYieldWithinAPI + #define traceRETURN_vTaskYieldWithinAPI() +#endif + +#ifndef traceENTER_vTaskEnterCritical + #define traceENTER_vTaskEnterCritical() +#endif + +#ifndef traceRETURN_vTaskEnterCritical + #define traceRETURN_vTaskEnterCritical() +#endif + +#ifndef traceENTER_vTaskEnterCriticalFromISR + #define traceENTER_vTaskEnterCriticalFromISR() +#endif + +#ifndef traceRETURN_vTaskEnterCriticalFromISR + #define traceRETURN_vTaskEnterCriticalFromISR( uxSavedInterruptStatus ) +#endif + +#ifndef traceENTER_vTaskExitCritical + #define traceENTER_vTaskExitCritical() +#endif + +#ifndef traceRETURN_vTaskExitCritical + #define traceRETURN_vTaskExitCritical() +#endif + +#ifndef traceENTER_vTaskExitCriticalFromISR + #define traceENTER_vTaskExitCriticalFromISR( uxSavedInterruptStatus ) +#endif + +#ifndef traceRETURN_vTaskExitCriticalFromISR + #define traceRETURN_vTaskExitCriticalFromISR() +#endif + +#ifndef traceENTER_vTaskList + #define traceENTER_vTaskList( pcWriteBuffer ) +#endif + +#ifndef traceRETURN_vTaskList + #define traceRETURN_vTaskList() +#endif + +#ifndef traceENTER_vTaskGetRunTimeStats + #define traceENTER_vTaskGetRunTimeStats( pcWriteBuffer ) +#endif + +#ifndef traceRETURN_vTaskGetRunTimeStats + #define traceRETURN_vTaskGetRunTimeStats() +#endif + +#ifndef traceENTER_uxTaskResetEventItemValue + #define traceENTER_uxTaskResetEventItemValue() +#endif + +#ifndef traceRETURN_uxTaskResetEventItemValue + #define traceRETURN_uxTaskResetEventItemValue( uxReturn ) +#endif + +#ifndef traceENTER_pvTaskIncrementMutexHeldCount + #define traceENTER_pvTaskIncrementMutexHeldCount() +#endif + +#ifndef traceRETURN_pvTaskIncrementMutexHeldCount + #define traceRETURN_pvTaskIncrementMutexHeldCount( pxTCB ) +#endif + +#ifndef traceENTER_ulTaskGenericNotifyTake + #define traceENTER_ulTaskGenericNotifyTake( uxIndexToWaitOn, xClearCountOnExit, xTicksToWait ) +#endif + +#ifndef traceRETURN_ulTaskGenericNotifyTake + #define traceRETURN_ulTaskGenericNotifyTake( ulReturn ) +#endif + +#ifndef traceENTER_xTaskGenericNotifyWait + #define traceENTER_xTaskGenericNotifyWait( uxIndexToWaitOn, ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait ) +#endif + +#ifndef traceRETURN_xTaskGenericNotifyWait + #define traceRETURN_xTaskGenericNotifyWait( xReturn ) +#endif + +#ifndef traceENTER_xTaskGenericNotify + #define traceENTER_xTaskGenericNotify( xTaskToNotify, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue ) +#endif + +#ifndef traceRETURN_xTaskGenericNotify + #define traceRETURN_xTaskGenericNotify( xReturn ) +#endif + +#ifndef traceENTER_xTaskGenericNotifyFromISR + #define traceENTER_xTaskGenericNotifyFromISR( xTaskToNotify, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken ) +#endif + +#ifndef traceRETURN_xTaskGenericNotifyFromISR + #define traceRETURN_xTaskGenericNotifyFromISR( xReturn ) +#endif + +#ifndef traceENTER_vTaskGenericNotifyGiveFromISR + #define traceENTER_vTaskGenericNotifyGiveFromISR( xTaskToNotify, uxIndexToNotify, pxHigherPriorityTaskWoken ) +#endif + +#ifndef traceRETURN_vTaskGenericNotifyGiveFromISR + #define traceRETURN_vTaskGenericNotifyGiveFromISR() +#endif + +#ifndef traceENTER_xTaskGenericNotifyStateClear + #define traceENTER_xTaskGenericNotifyStateClear( xTask, uxIndexToClear ) +#endif + +#ifndef traceRETURN_xTaskGenericNotifyStateClear + #define traceRETURN_xTaskGenericNotifyStateClear( xReturn ) +#endif + +#ifndef traceENTER_ulTaskGenericNotifyValueClear + #define traceENTER_ulTaskGenericNotifyValueClear( xTask, uxIndexToClear, ulBitsToClear ) +#endif + +#ifndef traceRETURN_ulTaskGenericNotifyValueClear + #define traceRETURN_ulTaskGenericNotifyValueClear( ulReturn ) +#endif + +#ifndef traceENTER_ulTaskGetRunTimeCounter + #define traceENTER_ulTaskGetRunTimeCounter( xTask ) +#endif + +#ifndef traceRETURN_ulTaskGetRunTimeCounter + #define traceRETURN_ulTaskGetRunTimeCounter( ulRunTimeCounter ) +#endif + +#ifndef traceENTER_ulTaskGetRunTimePercent + #define traceENTER_ulTaskGetRunTimePercent( xTask ) +#endif + +#ifndef traceRETURN_ulTaskGetRunTimePercent + #define traceRETURN_ulTaskGetRunTimePercent( ulReturn ) +#endif + +#ifndef traceENTER_ulTaskGetIdleRunTimeCounter + #define traceENTER_ulTaskGetIdleRunTimeCounter() +#endif + +#ifndef traceRETURN_ulTaskGetIdleRunTimeCounter + #define traceRETURN_ulTaskGetIdleRunTimeCounter( ulReturn ) +#endif + +#ifndef traceENTER_ulTaskGetIdleRunTimePercent + #define traceENTER_ulTaskGetIdleRunTimePercent() +#endif + +#ifndef traceRETURN_ulTaskGetIdleRunTimePercent + #define traceRETURN_ulTaskGetIdleRunTimePercent( ulReturn ) +#endif + +#ifndef traceENTER_xTaskGetMPUSettings + #define traceENTER_xTaskGetMPUSettings( xTask ) +#endif + +#ifndef traceRETURN_xTaskGetMPUSettings + #define traceRETURN_xTaskGetMPUSettings( xMPUSettings ) +#endif + +#ifndef traceENTER_xStreamBufferGenericCreate + #define traceENTER_xStreamBufferGenericCreate( xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer, pxSendCompletedCallback, pxReceiveCompletedCallback ) +#endif + +#ifndef traceRETURN_xStreamBufferGenericCreate + #define traceRETURN_xStreamBufferGenericCreate( pvAllocatedMemory ) +#endif + +#ifndef traceENTER_xStreamBufferGenericCreateStatic + #define traceENTER_xStreamBufferGenericCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer, pucStreamBufferStorageArea, pxStaticStreamBuffer, pxSendCompletedCallback, pxReceiveCompletedCallback ) +#endif + +#ifndef traceRETURN_xStreamBufferGenericCreateStatic + #define traceRETURN_xStreamBufferGenericCreateStatic( xReturn ) +#endif + +#ifndef traceENTER_xStreamBufferGetStaticBuffers + #define traceENTER_xStreamBufferGetStaticBuffers( xStreamBuffer, ppucStreamBufferStorageArea, ppxStaticStreamBuffer ) +#endif + +#ifndef traceRETURN_xStreamBufferGetStaticBuffers + #define traceRETURN_xStreamBufferGetStaticBuffers( xReturn ) +#endif + +#ifndef traceENTER_vStreamBufferDelete + #define traceENTER_vStreamBufferDelete( xStreamBuffer ) +#endif + +#ifndef traceRETURN_vStreamBufferDelete + #define traceRETURN_vStreamBufferDelete() +#endif + +#ifndef traceENTER_xStreamBufferReset + #define traceENTER_xStreamBufferReset( xStreamBuffer ) +#endif + +#ifndef traceRETURN_xStreamBufferReset + #define traceRETURN_xStreamBufferReset( xReturn ) +#endif + +#ifndef traceENTER_xStreamBufferSetTriggerLevel + #define traceENTER_xStreamBufferSetTriggerLevel( xStreamBuffer, xTriggerLevel ) +#endif + +#ifndef traceRETURN_xStreamBufferSetTriggerLevel + #define traceRETURN_xStreamBufferSetTriggerLevel( xReturn ) +#endif + +#ifndef traceENTER_xStreamBufferSpacesAvailable + #define traceENTER_xStreamBufferSpacesAvailable( xStreamBuffer ) +#endif + +#ifndef traceRETURN_xStreamBufferSpacesAvailable + #define traceRETURN_xStreamBufferSpacesAvailable( xSpace ) +#endif + +#ifndef traceENTER_xStreamBufferBytesAvailable + #define traceENTER_xStreamBufferBytesAvailable( xStreamBuffer ) +#endif + +#ifndef traceRETURN_xStreamBufferBytesAvailable + #define traceRETURN_xStreamBufferBytesAvailable( xReturn ) +#endif + +#ifndef traceENTER_xStreamBufferSend + #define traceENTER_xStreamBufferSend( xStreamBuffer, pvTxData, xDataLengthBytes, xTicksToWait ) +#endif + +#ifndef traceRETURN_xStreamBufferSend + #define traceRETURN_xStreamBufferSend( xReturn ) +#endif + +#ifndef traceENTER_xStreamBufferSendFromISR + #define traceENTER_xStreamBufferSendFromISR( xStreamBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken ) +#endif + +#ifndef traceRETURN_xStreamBufferSendFromISR + #define traceRETURN_xStreamBufferSendFromISR( xReturn ) +#endif + +#ifndef traceENTER_xStreamBufferReceive + #define traceENTER_xStreamBufferReceive( xStreamBuffer, pvRxData, xBufferLengthBytes, xTicksToWait ) +#endif + +#ifndef traceRETURN_xStreamBufferReceive + #define traceRETURN_xStreamBufferReceive( xReceivedLength ) +#endif + +#ifndef traceENTER_xStreamBufferNextMessageLengthBytes + #define traceENTER_xStreamBufferNextMessageLengthBytes( xStreamBuffer ) +#endif + +#ifndef traceRETURN_xStreamBufferNextMessageLengthBytes + #define traceRETURN_xStreamBufferNextMessageLengthBytes( xReturn ) +#endif + +#ifndef traceENTER_xStreamBufferReceiveFromISR + #define traceENTER_xStreamBufferReceiveFromISR( xStreamBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken ) +#endif + +#ifndef traceRETURN_xStreamBufferReceiveFromISR + #define traceRETURN_xStreamBufferReceiveFromISR( xReceivedLength ) +#endif + +#ifndef traceENTER_xStreamBufferIsEmpty + #define traceENTER_xStreamBufferIsEmpty( xStreamBuffer ) +#endif + +#ifndef traceRETURN_xStreamBufferIsEmpty + #define traceRETURN_xStreamBufferIsEmpty( xReturn ) +#endif + +#ifndef traceENTER_xStreamBufferIsFull + #define traceENTER_xStreamBufferIsFull( xStreamBuffer ) +#endif + +#ifndef traceRETURN_xStreamBufferIsFull + #define traceRETURN_xStreamBufferIsFull( xReturn ) +#endif + +#ifndef traceENTER_xStreamBufferSendCompletedFromISR + #define traceENTER_xStreamBufferSendCompletedFromISR( xStreamBuffer, pxHigherPriorityTaskWoken ) +#endif + +#ifndef traceRETURN_xStreamBufferSendCompletedFromISR + #define traceRETURN_xStreamBufferSendCompletedFromISR( xReturn ) +#endif + +#ifndef traceENTER_xStreamBufferReceiveCompletedFromISR + #define traceENTER_xStreamBufferReceiveCompletedFromISR( xStreamBuffer, pxHigherPriorityTaskWoken ) +#endif + +#ifndef traceRETURN_xStreamBufferReceiveCompletedFromISR + #define traceRETURN_xStreamBufferReceiveCompletedFromISR( xReturn ) +#endif + +#ifndef traceENTER_uxStreamBufferGetStreamBufferNumber + #define traceENTER_uxStreamBufferGetStreamBufferNumber( xStreamBuffer ) +#endif + +#ifndef traceRETURN_uxStreamBufferGetStreamBufferNumber + #define traceRETURN_uxStreamBufferGetStreamBufferNumber( uxStreamBufferNumber ) +#endif + +#ifndef traceENTER_vStreamBufferSetStreamBufferNumber + #define traceENTER_vStreamBufferSetStreamBufferNumber( xStreamBuffer, uxStreamBufferNumber ) +#endif + +#ifndef traceRETURN_vStreamBufferSetStreamBufferNumber + #define traceRETURN_vStreamBufferSetStreamBufferNumber() +#endif + +#ifndef traceENTER_ucStreamBufferGetStreamBufferType + #define traceENTER_ucStreamBufferGetStreamBufferType( xStreamBuffer ) +#endif + +#ifndef traceRETURN_ucStreamBufferGetStreamBufferType + #define traceRETURN_ucStreamBufferGetStreamBufferType( ucStreamBufferType ) +#endif + +#ifndef traceENTER_vListInitialise + #define traceENTER_vListInitialise( pxList ) +#endif + +#ifndef traceRETURN_vListInitialise + #define traceRETURN_vListInitialise() +#endif + +#ifndef traceENTER_vListInitialiseItem + #define traceENTER_vListInitialiseItem( pxItem ) +#endif + +#ifndef traceRETURN_vListInitialiseItem + #define traceRETURN_vListInitialiseItem() +#endif + +#ifndef traceENTER_vListInsertEnd + #define traceENTER_vListInsertEnd( pxList, pxNewListItem ) +#endif + +#ifndef traceRETURN_vListInsertEnd + #define traceRETURN_vListInsertEnd() +#endif + +#ifndef traceENTER_vListInsert + #define traceENTER_vListInsert( pxList, pxNewListItem ) +#endif + +#ifndef traceRETURN_vListInsert + #define traceRETURN_vListInsert() +#endif + +#ifndef traceENTER_uxListRemove + #define traceENTER_uxListRemove( pxItemToRemove ) +#endif + +#ifndef traceRETURN_uxListRemove + #define traceRETURN_uxListRemove( uxNumberOfItems ) +#endif + +#ifndef traceENTER_xCoRoutineCreate + #define traceENTER_xCoRoutineCreate( pxCoRoutineCode, uxPriority, uxIndex ) +#endif + +#ifndef traceRETURN_xCoRoutineCreate + #define traceRETURN_xCoRoutineCreate( xReturn ) +#endif + +#ifndef traceENTER_vCoRoutineAddToDelayedList + #define traceENTER_vCoRoutineAddToDelayedList( xTicksToDelay, pxEventList ) +#endif + +#ifndef traceRETURN_vCoRoutineAddToDelayedList + #define traceRETURN_vCoRoutineAddToDelayedList() +#endif + +#ifndef traceENTER_vCoRoutineSchedule + #define traceENTER_vCoRoutineSchedule() +#endif + +#ifndef traceRETURN_vCoRoutineSchedule + #define traceRETURN_vCoRoutineSchedule() +#endif + +#ifndef traceENTER_xCoRoutineRemoveFromEventList + #define traceENTER_xCoRoutineRemoveFromEventList( pxEventList ) +#endif + +#ifndef traceRETURN_xCoRoutineRemoveFromEventList + #define traceRETURN_xCoRoutineRemoveFromEventList( xReturn ) +#endif + #ifndef configGENERATE_RUN_TIME_STATS #define configGENERATE_RUN_TIME_STATS 0 #endif diff --git a/list.c b/list.c index 649c4c302a3..ab5bf5653a9 100644 --- a/list.c +++ b/list.c @@ -49,6 +49,8 @@ void vListInitialise( List_t * const pxList ) { + traceENTER_vListInitialise( pxList ); + /* The list structure contains a list item which is used to mark the * end of the list. To initialise the list the list end is inserted * as the only list entry. */ @@ -80,11 +82,15 @@ void vListInitialise( List_t * const pxList ) * configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ); listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ); + + traceRETURN_vListInitialise(); } /*-----------------------------------------------------------*/ void vListInitialiseItem( ListItem_t * const pxItem ) { + traceENTER_vListInitialiseItem( pxItem ); + /* Make sure the list item is not recorded as being on a list. */ pxItem->pxContainer = NULL; @@ -92,6 +98,8 @@ void vListInitialiseItem( ListItem_t * const pxItem ) * configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ); listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ); + + traceRETURN_vListInitialiseItem(); } /*-----------------------------------------------------------*/ @@ -100,6 +108,8 @@ void vListInsertEnd( List_t * const pxList, { ListItem_t * const pxIndex = pxList->pxIndex; + traceENTER_vListInsertEnd( pxList, pxNewListItem ); + /* Only effective when configASSERT() is also defined, these tests may catch * the list data structures being overwritten in memory. They will not catch * data errors caused by incorrect configuration or use of FreeRTOS. */ @@ -122,6 +132,8 @@ void vListInsertEnd( List_t * const pxList, pxNewListItem->pxContainer = pxList; ( pxList->uxNumberOfItems )++; + + traceRETURN_vListInsertEnd(); } /*-----------------------------------------------------------*/ @@ -131,6 +143,8 @@ void vListInsert( List_t * const pxList, ListItem_t * pxIterator; const TickType_t xValueOfInsertion = pxNewListItem->xItemValue; + traceENTER_vListInsert( pxList, pxNewListItem ); + /* Only effective when configASSERT() is also defined, these tests may catch * the list data structures being overwritten in memory. They will not catch * data errors caused by incorrect configuration or use of FreeRTOS. */ @@ -193,15 +207,21 @@ void vListInsert( List_t * const pxList, pxNewListItem->pxContainer = pxList; ( pxList->uxNumberOfItems )++; + + traceRETURN_vListInsert(); } /*-----------------------------------------------------------*/ UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) { -/* The list item knows which list it is in. Obtain the list from the list - * item. */ + /* The list item knows which list it is in. Obtain the list from the list + * item. */ List_t * const pxList = pxItemToRemove->pxContainer; + traceENTER_uxListRemove( pxItemToRemove ); + + + pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious; pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext; @@ -221,6 +241,8 @@ UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) pxItemToRemove->pxContainer = NULL; ( pxList->uxNumberOfItems )--; + traceRETURN_uxListRemove( pxList->uxNumberOfItems ); + return pxList->uxNumberOfItems; } /*-----------------------------------------------------------*/ diff --git a/queue.c b/queue.c index 9d300f861a4..91b9a0d6758 100644 --- a/queue.c +++ b/queue.c @@ -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; } diff --git a/stream_buffer.c b/stream_buffer.c index 7c91ec3168f..32aa8e4f2b3 100644 --- a/stream_buffer.c +++ b/stream_buffer.c @@ -326,6 +326,8 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer, void * pvAllocatedMemory; uint8_t ucFlags; + traceENTER_xStreamBufferGenericCreate( xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer, pxSendCompletedCallback, pxReceiveCompletedCallback ); + /* In case the stream buffer is going to be used as a message buffer * (that is, it will hold discrete messages with a little meta data that * says how big the next message is) check the buffer will be large enough @@ -387,6 +389,8 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer, traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ); } + traceRETURN_xStreamBufferGenericCreate( pvAllocatedMemory ); + return ( StreamBufferHandle_t ) pvAllocatedMemory; /*lint !e9087 !e826 Safe cast as allocated memory is aligned. */ } #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ @@ -406,6 +410,8 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer, StreamBufferHandle_t xReturn; uint8_t ucFlags; + traceENTER_xStreamBufferGenericCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer, pucStreamBufferStorageArea, pxStaticStreamBuffer, pxSendCompletedCallback, pxReceiveCompletedCallback ); + configASSERT( pucStreamBufferStorageArea ); configASSERT( pxStaticStreamBuffer ); configASSERT( xTriggerLevelBytes <= xBufferSizeBytes ); @@ -468,6 +474,8 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer, traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer ); } + traceRETURN_xStreamBufferGenericCreateStatic( xReturn ); + return xReturn; } #endif /* ( configSUPPORT_STATIC_ALLOCATION == 1 ) */ @@ -481,6 +489,8 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer, BaseType_t xReturn; StreamBuffer_t * const pxStreamBuffer = xStreamBuffer; + traceENTER_xStreamBufferGetStaticBuffers( xStreamBuffer, ppucStreamBufferStorageArea, ppxStaticStreamBuffer ); + configASSERT( pxStreamBuffer ); configASSERT( ppucStreamBufferStorageArea ); configASSERT( ppxStaticStreamBuffer ); @@ -496,6 +506,8 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer, xReturn = pdFALSE; } + traceRETURN_xStreamBufferGetStaticBuffers( xReturn ); + return xReturn; } #endif /* configSUPPORT_STATIC_ALLOCATION */ @@ -505,6 +517,8 @@ void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) { StreamBuffer_t * pxStreamBuffer = xStreamBuffer; + traceENTER_vStreamBufferDelete( xStreamBuffer ); + configASSERT( pxStreamBuffer ); traceSTREAM_BUFFER_DELETE( xStreamBuffer ); @@ -531,6 +545,8 @@ void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) * freed - just scrub the structure so future use will assert. */ ( void ) memset( pxStreamBuffer, 0x00, sizeof( StreamBuffer_t ) ); } + + traceRETURN_vStreamBufferDelete(); } /*-----------------------------------------------------------*/ @@ -544,6 +560,8 @@ BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) UBaseType_t uxStreamBufferNumber; #endif + traceENTER_xStreamBufferReset( xStreamBuffer ); + configASSERT( pxStreamBuffer ); #if ( configUSE_TRACE_FACILITY == 1 ) @@ -587,6 +605,8 @@ BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) } taskEXIT_CRITICAL(); + traceRETURN_xStreamBufferReset( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -597,6 +617,8 @@ BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, StreamBuffer_t * const pxStreamBuffer = xStreamBuffer; BaseType_t xReturn; + traceENTER_xStreamBufferSetTriggerLevel( xStreamBuffer, xTriggerLevel ); + configASSERT( pxStreamBuffer ); /* It is not valid for the trigger level to be 0. */ @@ -617,6 +639,8 @@ BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, xReturn = pdFALSE; } + traceRETURN_xStreamBufferSetTriggerLevel( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -627,6 +651,8 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) size_t xSpace; size_t xOriginalTail; + traceENTER_xStreamBufferSpacesAvailable( xStreamBuffer ); + configASSERT( pxStreamBuffer ); /* The code below reads xTail and then xHead. This is safe if the stream @@ -650,6 +676,8 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) mtCOVERAGE_TEST_MARKER(); } + traceRETURN_xStreamBufferSpacesAvailable( xSpace ); + return xSpace; } /*-----------------------------------------------------------*/ @@ -659,9 +687,14 @@ size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer; size_t xReturn; + traceENTER_xStreamBufferBytesAvailable( xStreamBuffer ); + configASSERT( pxStreamBuffer ); xReturn = prvBytesInBuffer( pxStreamBuffer ); + + traceRETURN_xStreamBufferBytesAvailable( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -677,6 +710,8 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, TimeOut_t xTimeOut; size_t xMaxReportedSpace = 0; + traceENTER_xStreamBufferSend( xStreamBuffer, pvTxData, xDataLengthBytes, xTicksToWait ); + configASSERT( pvTxData ); configASSERT( pxStreamBuffer ); @@ -793,6 +828,8 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer ); } + traceRETURN_xStreamBufferSend( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -806,6 +843,8 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer, size_t xReturn, xSpace; size_t xRequiredSpace = xDataLengthBytes; + traceENTER_xStreamBufferSendFromISR( xStreamBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken ); + configASSERT( pvTxData ); configASSERT( pxStreamBuffer ); @@ -843,6 +882,7 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer, } traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xReturn ); + traceRETURN_xStreamBufferSendFromISR( xReturn ); return xReturn; } @@ -906,6 +946,8 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, StreamBuffer_t * const pxStreamBuffer = xStreamBuffer; size_t xReceivedLength = 0, xBytesAvailable, xBytesToStoreMessageLength; + traceENTER_xStreamBufferReceive( xStreamBuffer, pvRxData, xBufferLengthBytes, xTicksToWait ); + configASSERT( pvRxData ); configASSERT( pxStreamBuffer ); @@ -998,6 +1040,8 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, mtCOVERAGE_TEST_MARKER(); } + traceRETURN_xStreamBufferReceive( xReceivedLength ); + return xReceivedLength; } /*-----------------------------------------------------------*/ @@ -1008,6 +1052,8 @@ size_t xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) size_t xReturn, xBytesAvailable; configMESSAGE_BUFFER_LENGTH_TYPE xTempReturn; + traceENTER_xStreamBufferNextMessageLengthBytes( xStreamBuffer ); + configASSERT( pxStreamBuffer ); /* Ensure the stream buffer is being used as a message buffer. */ @@ -1038,6 +1084,8 @@ size_t xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) xReturn = 0; } + traceRETURN_xStreamBufferNextMessageLengthBytes( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -1050,6 +1098,8 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, StreamBuffer_t * const pxStreamBuffer = xStreamBuffer; size_t xReceivedLength = 0, xBytesAvailable, xBytesToStoreMessageLength; + traceENTER_xStreamBufferReceiveFromISR( xStreamBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken ); + configASSERT( pvRxData ); configASSERT( pxStreamBuffer ); @@ -1094,6 +1144,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, } traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength ); + traceRETURN_xStreamBufferReceiveFromISR( xReceivedLength ); return xReceivedLength; } @@ -1157,6 +1208,8 @@ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) BaseType_t xReturn; size_t xTail; + traceENTER_xStreamBufferIsEmpty( xStreamBuffer ); + configASSERT( pxStreamBuffer ); /* True if no bytes are available. */ @@ -1171,6 +1224,8 @@ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) xReturn = pdFALSE; } + traceRETURN_xStreamBufferIsEmpty( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -1181,6 +1236,8 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) size_t xBytesToStoreMessageLength; const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer; + traceENTER_xStreamBufferIsFull( xStreamBuffer ); + configASSERT( pxStreamBuffer ); /* This generic version of the receive function is used by both message @@ -1206,6 +1263,8 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) xReturn = pdFALSE; } + traceRETURN_xStreamBufferIsFull( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -1217,6 +1276,8 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer BaseType_t xReturn; UBaseType_t uxSavedInterruptStatus; + traceENTER_xStreamBufferSendCompletedFromISR( xStreamBuffer, pxHigherPriorityTaskWoken ); + configASSERT( pxStreamBuffer ); uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR(); @@ -1237,6 +1298,8 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer } taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus ); + traceRETURN_xStreamBufferSendCompletedFromISR( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -1248,6 +1311,8 @@ BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuf BaseType_t xReturn; UBaseType_t uxSavedInterruptStatus; + traceENTER_xStreamBufferReceiveCompletedFromISR( xStreamBuffer, pxHigherPriorityTaskWoken ); + configASSERT( pxStreamBuffer ); uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR(); @@ -1268,6 +1333,8 @@ BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuf } taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus ); + traceRETURN_xStreamBufferReceiveCompletedFromISR( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -1426,6 +1493,10 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer, UBaseType_t uxStreamBufferGetStreamBufferNumber( StreamBufferHandle_t xStreamBuffer ) { + traceENTER_uxStreamBufferGetStreamBufferNumber( xStreamBuffer ); + + traceRETURN_uxStreamBufferGetStreamBufferNumber( xStreamBuffer->uxStreamBufferNumber ); + return xStreamBuffer->uxStreamBufferNumber; } @@ -1437,7 +1508,11 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer, void vStreamBufferSetStreamBufferNumber( StreamBufferHandle_t xStreamBuffer, UBaseType_t uxStreamBufferNumber ) { + traceENTER_vStreamBufferSetStreamBufferNumber( xStreamBuffer, uxStreamBufferNumber ); + xStreamBuffer->uxStreamBufferNumber = uxStreamBufferNumber; + + traceRETURN_vStreamBufferSetStreamBufferNumber(); } #endif /* configUSE_TRACE_FACILITY */ @@ -1447,6 +1522,10 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer, uint8_t ucStreamBufferGetStreamBufferType( StreamBufferHandle_t xStreamBuffer ) { + traceENTER_ucStreamBufferGetStreamBufferType( xStreamBuffer ); + + traceRETURN_ucStreamBufferGetStreamBufferType( ( uint8_t ) ( xStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) ); + return( ( uint8_t ) ( xStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) ); } diff --git a/tasks.c b/tasks.c index 99878a3a3cb..863535c89a1 100644 --- a/tasks.c +++ b/tasks.c @@ -1204,6 +1204,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; TCB_t * pxNewTCB; TaskHandle_t xReturn; + traceENTER_xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer ); + configASSERT( puxStackBuffer != NULL ); configASSERT( pxTaskBuffer != NULL ); @@ -1250,6 +1252,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; xReturn = NULL; } + traceRETURN_xTaskCreateStatic( xReturn ); + return xReturn; } @@ -1273,6 +1277,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; TCB_t * pxNewTCB; BaseType_t xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY; + traceENTER_xTaskCreateRestrictedStatic( pxTaskDefinition, pxCreatedTask ); + configASSERT( pxTaskDefinition->puxStackBuffer != NULL ); configASSERT( pxTaskDefinition->pxTaskBuffer != NULL ); @@ -1314,6 +1320,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; xReturn = pdPASS; } + traceRETURN_xTaskCreateRestrictedStatic( xReturn ); + return xReturn; } @@ -1337,6 +1345,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; TCB_t * pxNewTCB; BaseType_t xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY; + traceENTER_xTaskCreateRestricted( pxTaskDefinition, pxCreatedTask ); + configASSERT( pxTaskDefinition->puxStackBuffer ); if( pxTaskDefinition->puxStackBuffer != NULL ) @@ -1379,6 +1389,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; } } + traceRETURN_xTaskCreateRestricted( xReturn ); + return xReturn; } @@ -1410,6 +1422,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; TCB_t * pxNewTCB; BaseType_t xReturn; + traceENTER_xTaskCreate( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask ); + /* If the stack grows down then allocate the stack then the TCB so the stack * does not grow into the TCB. Likewise if the stack grows up then allocate * the TCB then the stack. */ @@ -1497,6 +1511,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY; } + traceRETURN_xTaskCreate( xReturn ); + return xReturn; } @@ -1904,6 +1920,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, { TCB_t * pxTCB; + traceENTER_vTaskDelete( xTaskToDelete ); + taskENTER_CRITICAL(); { /* If null is passed in here then it is the calling task that is @@ -2034,6 +2052,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, taskEXIT_CRITICAL(); } #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + + traceRETURN_vTaskDelete(); } #endif /* INCLUDE_vTaskDelete */ @@ -2047,6 +2067,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, TickType_t xTimeToWake; BaseType_t xAlreadyYielded, xShouldDelay = pdFALSE; + traceENTER_xTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ); + configASSERT( pxPreviousWakeTime ); configASSERT( ( xTimeIncrement > 0U ) ); @@ -2125,6 +2147,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, mtCOVERAGE_TEST_MARKER(); } + traceRETURN_xTaskDelayUntil( xShouldDelay ); + return xShouldDelay; } @@ -2137,6 +2161,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, { BaseType_t xAlreadyYielded = pdFALSE; + traceENTER_vTaskDelay( xTicksToDelay ); + /* A delay time of zero just forces a reschedule. */ if( xTicksToDelay > ( TickType_t ) 0U ) { @@ -2176,6 +2202,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, { mtCOVERAGE_TEST_MARKER(); } + + traceRETURN_vTaskDelay(); } #endif /* INCLUDE_vTaskDelay */ @@ -2192,6 +2220,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, List_t const * pxOverflowedDelayedList; const TCB_t * const pxTCB = xTask; + traceENTER_eTaskGetState( xTask ); + configASSERT( pxTCB ); #if ( configNUMBER_OF_CORES == 1 ) @@ -2303,6 +2333,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, } } + traceRETURN_eTaskGetState( eReturn ); + return eReturn; } /*lint !e818 xTask cannot be a pointer to const because it is a typedef. */ @@ -2316,6 +2348,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, TCB_t const * pxTCB; UBaseType_t uxReturn; + traceENTER_uxTaskPriorityGet( xTask ); + taskENTER_CRITICAL(); { /* If null is passed in here then it is the priority of the task @@ -2325,6 +2359,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, } taskEXIT_CRITICAL(); + traceRETURN_uxTaskPriorityGet( uxReturn ); + return uxReturn; } @@ -2339,6 +2375,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, UBaseType_t uxReturn; UBaseType_t uxSavedInterruptStatus; + traceENTER_uxTaskPriorityGetFromISR( xTask ); + /* RTOS ports that support interrupt nesting have the concept of a * maximum system call (or maximum API call) interrupt priority. * Interrupts that are above the maximum system call priority are keep @@ -2366,6 +2404,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, } taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus ); + traceRETURN_uxTaskPriorityGetFromISR( uxReturn ); + return uxReturn; } @@ -2381,6 +2421,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, UBaseType_t uxCurrentBasePriority, uxPriorityUsedOnEntry; BaseType_t xYieldRequired = pdFALSE; + traceENTER_vTaskPrioritySet( xTask, uxNewPriority ); + #if ( configNUMBER_OF_CORES > 1 ) BaseType_t xYieldForTask = pdFALSE; #endif @@ -2577,6 +2619,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, } } taskEXIT_CRITICAL(); + + traceRETURN_vTaskPrioritySet(); } #endif /* INCLUDE_vTaskPrioritySet */ @@ -2594,6 +2638,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, UBaseType_t uxPrevNotAllowedCores; #endif + traceENTER_vTaskCoreAffinitySet( xTask, uxCoreAffinityMask ); + taskENTER_CRITICAL(); { pxTCB = prvGetTCBFromHandle( xTask ); @@ -2639,6 +2685,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, } } taskEXIT_CRITICAL(); + + traceRETURN_vTaskCoreAffinitySet(); } #endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) */ /*-----------------------------------------------------------*/ @@ -2649,6 +2697,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const TCB_t * pxTCB; UBaseType_t uxCoreAffinityMask; + traceENTER_vTaskCoreAffinityGet( xTask ); + taskENTER_CRITICAL(); { pxTCB = prvGetTCBFromHandle( xTask ); @@ -2656,6 +2706,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, } taskEXIT_CRITICAL(); + traceRETURN_vTaskCoreAffinityGet( uxCoreAffinityMask ); + return uxCoreAffinityMask; } #endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) */ @@ -2668,6 +2720,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, { TCB_t * pxTCB; + traceENTER_vTaskPreemptionDisable( xTask ); + taskENTER_CRITICAL(); { pxTCB = prvGetTCBFromHandle( xTask ); @@ -2675,6 +2729,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, pxTCB->xPreemptionDisable = pdTRUE; } taskEXIT_CRITICAL(); + + traceRETURN_vTaskPreemptionDisable(); } #endif /* #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */ @@ -2687,6 +2743,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, TCB_t * pxTCB; BaseType_t xCoreID; + traceENTER_vTaskPreemptionEnable( xTask ); + taskENTER_CRITICAL(); { pxTCB = prvGetTCBFromHandle( xTask ); @@ -2703,6 +2761,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, } } taskEXIT_CRITICAL(); + + traceRETURN_vTaskPreemptionEnable(); } #endif /* #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 ) */ @@ -2718,6 +2778,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, BaseType_t xTaskRunningOnCore; #endif + traceENTER_vTaskSuspend( xTaskToSuspend ); + taskENTER_CRITICAL(); { /* If null is passed in here then it is the running task that is @@ -2867,6 +2929,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, taskEXIT_CRITICAL(); } #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + + traceRETURN_vTaskSuspend(); } #endif /* INCLUDE_vTaskSuspend */ @@ -2924,6 +2988,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, { TCB_t * const pxTCB = xTaskToResume; + traceENTER_vTaskResume( xTaskToResume ); + /* It does not make sense to resume the calling task. */ configASSERT( xTaskToResume ); @@ -2969,6 +3035,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, { mtCOVERAGE_TEST_MARKER(); } + + traceRETURN_vTaskResume(); } #endif /* INCLUDE_vTaskSuspend */ @@ -2983,6 +3051,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, TCB_t * const pxTCB = xTaskToResume; UBaseType_t uxSavedInterruptStatus; + traceENTER_xTaskResumeFromISR( xTaskToResume ); + configASSERT( xTaskToResume ); /* RTOS ports that support interrupt nesting have the concept of a @@ -3061,6 +3131,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, } taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus ); + traceRETURN_xTaskResumeFromISR( xYieldRequired ); + return xYieldRequired; } @@ -3244,6 +3316,8 @@ void vTaskStartScheduler( void ) { BaseType_t xReturn; + traceENTER_vTaskStartScheduler(); + #if ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 ) { /* Sanity check that the UBaseType_t must have greater than or equal to @@ -3333,22 +3407,30 @@ void vTaskStartScheduler( void ) /* OpenOCD makes use of uxTopUsedPriority for thread debugging. Prevent uxTopUsedPriority * from getting optimized out as it is no longer used by the kernel. */ ( void ) uxTopUsedPriority; + + traceRETURN_vTaskStartScheduler(); } /*-----------------------------------------------------------*/ void vTaskEndScheduler( void ) { + traceENTER_vTaskEndScheduler(); + /* Stop the scheduler interrupts and call the portable scheduler end * routine so the original ISRs can be restored if necessary. The port * layer must ensure interrupts enable bit is left in the correct state. */ portDISABLE_INTERRUPTS(); xSchedulerRunning = pdFALSE; vPortEndScheduler(); + + traceRETURN_vTaskEndScheduler(); } /*----------------------------------------------------------*/ void vTaskSuspendAll( void ) { + traceENTER_vTaskSuspendAll(); + #if ( configNUMBER_OF_CORES == 1 ) { /* A critical section is not required as the variable is of type @@ -3424,6 +3506,8 @@ void vTaskSuspendAll( void ) } } #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + + traceRETURN_vTaskSuspendAll(); } /*----------------------------------------------------------*/ @@ -3496,6 +3580,8 @@ BaseType_t xTaskResumeAll( void ) TCB_t * pxTCB = NULL; BaseType_t xAlreadyYielded = pdFALSE; + traceENTER_xTaskResumeAll(); + #if ( configNUMBER_OF_CORES > 1 ) if( xSchedulerRunning != pdFALSE ) #endif @@ -3630,6 +3716,8 @@ BaseType_t xTaskResumeAll( void ) taskEXIT_CRITICAL(); } + traceRETURN_xTaskResumeAll( xAlreadyYielded ); + return xAlreadyYielded; } /*-----------------------------------------------------------*/ @@ -3638,6 +3726,8 @@ TickType_t xTaskGetTickCount( void ) { TickType_t xTicks; + traceENTER_xTaskGetTickCount(); + /* Critical section required if running on a 16 bit processor. */ portTICK_TYPE_ENTER_CRITICAL(); { @@ -3645,6 +3735,8 @@ TickType_t xTaskGetTickCount( void ) } portTICK_TYPE_EXIT_CRITICAL(); + traceRETURN_xTaskGetTickCount( xTicks ); + return xTicks; } /*-----------------------------------------------------------*/ @@ -3654,6 +3746,8 @@ TickType_t xTaskGetTickCountFromISR( void ) TickType_t xReturn; UBaseType_t uxSavedInterruptStatus; + traceENTER_xTaskGetTickCountFromISR(); + /* RTOS ports that support interrupt nesting have the concept of a maximum * system call (or maximum API call) interrupt priority. Interrupts that are * above the maximum system call priority are kept permanently enabled, even @@ -3676,14 +3770,20 @@ TickType_t xTaskGetTickCountFromISR( void ) } portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); + traceRETURN_xTaskGetTickCountFromISR( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ UBaseType_t uxTaskGetNumberOfTasks( void ) { + traceENTER_uxTaskGetNumberOfTasks(); + /* A critical section is not required because the variables are of type * BaseType_t. */ + traceRETURN_uxTaskGetNumberOfTasks( uxCurrentNumberOfTasks ); + return uxCurrentNumberOfTasks; } /*-----------------------------------------------------------*/ @@ -3692,10 +3792,15 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char { TCB_t * pxTCB; + traceENTER_pcTaskGetName( xTaskToQuery ); + /* If null is passed in here then the name of the calling task is being * queried. */ pxTCB = prvGetTCBFromHandle( xTaskToQuery ); configASSERT( pxTCB ); + + traceRETURN_pcTaskGetName( &( pxTCB->pcTaskName[ 0 ] ) ); + return &( pxTCB->pcTaskName[ 0 ] ); } /*-----------------------------------------------------------*/ @@ -3844,6 +3949,8 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char UBaseType_t uxQueue = configMAX_PRIORITIES; TCB_t * pxTCB; + traceENTER_xTaskGetHandle( pcNameToQuery ); + /* Task names will be truncated to configMAX_TASK_NAME_LEN - 1 bytes. */ configASSERT( strlen( pcNameToQuery ) < configMAX_TASK_NAME_LEN ); @@ -3895,6 +4002,8 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char } ( void ) xTaskResumeAll(); + traceRETURN_xTaskGetHandle( pxTCB ); + return pxTCB; } @@ -3910,6 +4019,8 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char BaseType_t xReturn; TCB_t * pxTCB; + traceENTER_xTaskGetStaticBuffers( xTask, ppuxStackBuffer, ppxTaskBuffer ); + configASSERT( ppuxStackBuffer != NULL ); configASSERT( ppxTaskBuffer != NULL ); @@ -3942,6 +4053,8 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char } #endif /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 */ + traceRETURN_xTaskGetStaticBuffers( xReturn ); + return xReturn; } @@ -3956,6 +4069,8 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char { UBaseType_t uxTask = 0, uxQueue = configMAX_PRIORITIES; + traceENTER_uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, pulTotalRunTime ); + vTaskSuspendAll(); { /* Is there a space in the array for each task in the system? */ @@ -4017,6 +4132,8 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char } ( void ) xTaskResumeAll(); + traceRETURN_uxTaskGetSystemState( uxTask ); + return uxTask; } @@ -4029,9 +4146,14 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char * Consider to add another function to return the idle task handles. */ TaskHandle_t xTaskGetIdleTaskHandle( void ) { + traceENTER_xTaskGetIdleTaskHandle(); + /* If xTaskGetIdleTaskHandle() is called before the scheduler has been * started, then xIdleTaskHandles will be NULL. */ configASSERT( ( xIdleTaskHandles[ 0 ] != NULL ) ); + + traceRETURN_xTaskGetIdleTaskHandle( xIdleTaskHandles[ 0 ] ); + return xIdleTaskHandles[ 0 ]; } @@ -4046,6 +4168,8 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char void vTaskStepTick( TickType_t xTicksToJump ) { + traceENTER_vTaskStepTick( xTicksToJump ); + /* Correct the tick count value after a period during which the tick * was suppressed. Note this does *not* call the tick hook function for * each stepped tick. */ @@ -4073,7 +4197,9 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char } xTickCount += xTicksToJump; + traceINCREASE_TICK_COUNT( xTicksToJump ); + traceRETURN_vTaskStepTick(); } #endif /* configUSE_TICKLESS_IDLE */ @@ -4083,6 +4209,8 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) { BaseType_t xYieldOccurred; + traceENTER_xTaskCatchUpTicks( xTicksToCatchUp ); + /* Must not be called with the scheduler suspended as the implementation * relies on xPendedTicks being wound down to 0 in xTaskResumeAll(). */ configASSERT( uxSchedulerSuspended == ( UBaseType_t ) 0U ); @@ -4099,6 +4227,8 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) taskEXIT_CRITICAL(); xYieldOccurred = xTaskResumeAll(); + traceRETURN_xTaskCatchUpTicks( xYieldOccurred ); + return xYieldOccurred; } /*----------------------------------------------------------*/ @@ -4110,6 +4240,8 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) TCB_t * pxTCB = xTask; BaseType_t xReturn; + traceENTER_xTaskAbortDelay( xTask ); + configASSERT( pxTCB ); vTaskSuspendAll(); @@ -4189,6 +4321,8 @@ BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) } ( void ) xTaskResumeAll(); + traceRETURN_xTaskAbortDelay( xReturn ); + return xReturn; } @@ -4201,6 +4335,8 @@ BaseType_t xTaskIncrementTick( void ) TickType_t xItemValue; BaseType_t xSwitchRequired = pdFALSE; + traceENTER_xTaskIncrementTick(); + #if ( configUSE_PREEMPTION == 1 ) && ( configNUMBER_OF_CORES > 1 ) BaseType_t xYieldRequiredForCore[ configNUMBER_OF_CORES ] = { pdFALSE }; #endif /* #if ( configUSE_PREEMPTION == 1 ) && ( configNUMBER_OF_CORES > 1 ) */ @@ -4438,6 +4574,8 @@ BaseType_t xTaskIncrementTick( void ) #endif } + traceRETURN_xTaskIncrementTick( xSwitchRequired ); + return xSwitchRequired; } /*-----------------------------------------------------------*/ @@ -4449,6 +4587,8 @@ BaseType_t xTaskIncrementTick( void ) { TCB_t * xTCB; + traceENTER_vTaskSetApplicationTaskTag( xTask, pxHookFunction ); + /* If xTask is NULL then it is the task hook of the calling task that is * getting set. */ if( xTask == NULL ) @@ -4467,6 +4607,8 @@ BaseType_t xTaskIncrementTick( void ) xTCB->pxTaskTag = pxHookFunction; } taskEXIT_CRITICAL(); + + traceRETURN_vTaskSetApplicationTaskTag(); } #endif /* configUSE_APPLICATION_TASK_TAG */ @@ -4479,6 +4621,8 @@ BaseType_t xTaskIncrementTick( void ) TCB_t * pxTCB; TaskHookFunction_t xReturn; + traceENTER_xTaskGetApplicationTaskTag( xTask ); + /* If xTask is NULL then set the calling task's hook. */ pxTCB = prvGetTCBFromHandle( xTask ); @@ -4490,6 +4634,8 @@ BaseType_t xTaskIncrementTick( void ) } taskEXIT_CRITICAL(); + traceRETURN_xTaskGetApplicationTaskTag( xReturn ); + return xReturn; } @@ -4504,6 +4650,8 @@ BaseType_t xTaskIncrementTick( void ) TaskHookFunction_t xReturn; UBaseType_t uxSavedInterruptStatus; + traceENTER_xTaskGetApplicationTaskTagFromISR( xTask ); + /* If xTask is NULL then set the calling task's hook. */ pxTCB = prvGetTCBFromHandle( xTask ); @@ -4515,6 +4663,8 @@ BaseType_t xTaskIncrementTick( void ) } taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus ); + traceRETURN_xTaskGetApplicationTaskTagFromISR( xReturn ); + return xReturn; } @@ -4529,6 +4679,8 @@ BaseType_t xTaskIncrementTick( void ) TCB_t * xTCB; BaseType_t xReturn; + traceENTER_xTaskCallApplicationTaskHook( xTask, pvParameter ); + /* If xTask is NULL then we are calling our own task hook. */ if( xTask == NULL ) { @@ -4548,6 +4700,8 @@ BaseType_t xTaskIncrementTick( void ) xReturn = pdFAIL; } + traceRETURN_xTaskCallApplicationTaskHook( xReturn ); + return xReturn; } @@ -4557,6 +4711,8 @@ BaseType_t xTaskIncrementTick( void ) #if ( configNUMBER_OF_CORES == 1 ) void vTaskSwitchContext( void ) { + traceENTER_vTaskSwitchContext(); + if( uxSchedulerSuspended != ( UBaseType_t ) 0U ) { /* The scheduler is currently suspended - do not allow a context @@ -4626,10 +4782,14 @@ BaseType_t xTaskIncrementTick( void ) } #endif } + + traceRETURN_vTaskSwitchContext(); } #else /* if ( configNUMBER_OF_CORES == 1 ) */ void vTaskSwitchContext( BaseType_t xCoreID ) { + traceENTER_vTaskSwitchContext(); + /* Acquire both locks: * - The ISR lock protects the ready list from simultaneous access by * both other ISRs and tasks. @@ -4717,6 +4877,8 @@ BaseType_t xTaskIncrementTick( void ) } portRELEASE_ISR_LOCK(); portRELEASE_TASK_LOCK(); + + traceRETURN_vTaskSwitchContext(); } #endif /* if ( configNUMBER_OF_CORES > 1 ) */ /*-----------------------------------------------------------*/ @@ -4724,6 +4886,8 @@ BaseType_t xTaskIncrementTick( void ) void vTaskPlaceOnEventList( List_t * const pxEventList, const TickType_t xTicksToWait ) { + traceENTER_vTaskPlaceOnEventList( pxEventList, xTicksToWait ); + configASSERT( pxEventList ); /* THIS FUNCTION MUST BE CALLED WITH EITHER INTERRUPTS DISABLED OR THE @@ -4743,6 +4907,8 @@ void vTaskPlaceOnEventList( List_t * const pxEventList, vListInsert( pxEventList, &( pxCurrentTCB->xEventListItem ) ); prvAddCurrentTaskToDelayedList( xTicksToWait, pdTRUE ); + + traceRETURN_vTaskPlaceOnEventList(); } /*-----------------------------------------------------------*/ @@ -4750,6 +4916,8 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, const TickType_t xItemValue, const TickType_t xTicksToWait ) { + traceENTER_vTaskPlaceOnUnorderedEventList( pxEventList, xItemValue, xTicksToWait ); + configASSERT( pxEventList ); /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by @@ -4769,6 +4937,8 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, listINSERT_END( pxEventList, &( pxCurrentTCB->xEventListItem ) ); prvAddCurrentTaskToDelayedList( xTicksToWait, pdTRUE ); + + traceRETURN_vTaskPlaceOnUnorderedEventList(); } /*-----------------------------------------------------------*/ @@ -4778,6 +4948,8 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely ) { + traceENTER_vTaskPlaceOnEventListRestricted( pxEventList, xTicksToWait, xWaitIndefinitely ); + configASSERT( pxEventList ); /* This function should not be called by application code hence the @@ -4802,6 +4974,8 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, traceTASK_DELAY_UNTIL( ( xTickCount + xTicksToWait ) ); prvAddCurrentTaskToDelayedList( xTicksToWait, xWaitIndefinitely ); + + traceRETURN_vTaskPlaceOnEventListRestricted(); } #endif /* configUSE_TIMERS */ @@ -4812,6 +4986,8 @@ BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) TCB_t * pxUnblockedTCB; BaseType_t xReturn; + traceENTER_xTaskRemoveFromEventList( pxEventList ); + /* THIS FUNCTION MUST BE CALLED FROM A CRITICAL SECTION. It can also be * called from a critical section within an ISR. */ @@ -4890,6 +5066,7 @@ BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) } #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + traceRETURN_xTaskRemoveFromEventList( xReturn ); return xReturn; } /*-----------------------------------------------------------*/ @@ -4899,6 +5076,8 @@ void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, { TCB_t * pxUnblockedTCB; + traceENTER_vTaskRemoveFromUnorderedEventList( pxEventListItem, xItemValue ); + /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by * the event flags implementation. */ configASSERT( uxSchedulerSuspended != ( UBaseType_t ) 0U ); @@ -4956,11 +5135,15 @@ void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, #endif } #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ + + traceRETURN_vTaskRemoveFromUnorderedEventList(); } /*-----------------------------------------------------------*/ void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) { + traceENTER_vTaskSetTimeOutState( pxTimeOut ); + configASSERT( pxTimeOut ); taskENTER_CRITICAL(); { @@ -4968,14 +5151,20 @@ void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) pxTimeOut->xTimeOnEntering = xTickCount; } taskEXIT_CRITICAL(); + + traceRETURN_vTaskSetTimeOutState(); } /*-----------------------------------------------------------*/ void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) { + traceENTER_vTaskInternalSetTimeOutState( pxTimeOut ); + /* For internal use only as it does not use a critical section. */ pxTimeOut->xOverflowCount = xNumOfOverflows; pxTimeOut->xTimeOnEntering = xTickCount; + + traceRETURN_vTaskInternalSetTimeOutState(); } /*-----------------------------------------------------------*/ @@ -4984,6 +5173,8 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, { BaseType_t xReturn; + traceENTER_xTaskCheckForTimeOut( pxTimeOut, pxTicksToWait ); + configASSERT( pxTimeOut ); configASSERT( pxTicksToWait ); @@ -5040,14 +5231,20 @@ BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, } taskEXIT_CRITICAL(); + traceRETURN_xTaskCheckForTimeOut( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ void vTaskMissedYield( void ) { + traceENTER_vTaskMissedYield(); + /* Must be called from within a critical section. */ xYieldPendings[ portGET_CORE_ID() ] = pdTRUE; + + traceRETURN_vTaskMissedYield(); } /*-----------------------------------------------------------*/ @@ -5058,6 +5255,8 @@ void vTaskMissedYield( void ) UBaseType_t uxReturn; TCB_t const * pxTCB; + traceENTER_uxTaskGetTaskNumber( xTask ); + if( xTask != NULL ) { pxTCB = xTask; @@ -5068,6 +5267,8 @@ void vTaskMissedYield( void ) uxReturn = 0U; } + traceRETURN_uxTaskGetTaskNumber( uxReturn ); + return uxReturn; } @@ -5081,11 +5282,15 @@ void vTaskMissedYield( void ) { TCB_t * pxTCB; + traceENTER_vTaskSetTaskNumber( xTask, uxHandle ); + if( xTask != NULL ) { pxTCB = xTask; pxTCB->uxTaskNumber = uxHandle; } + + traceRETURN_vTaskSetTaskNumber(); } #endif /* configUSE_TRACE_FACILITY */ @@ -5320,6 +5525,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) const UBaseType_t uxNonApplicationTasks = 1; #endif /* INCLUDE_vTaskSuspend */ + traceENTER_eTaskConfirmSleepModeStatus(); + eSleepModeStatus eReturn = eStandardSleep; /* This function must be called from a critical section. */ @@ -5356,6 +5563,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) mtCOVERAGE_TEST_MARKER(); } + traceRETURN_eTaskConfirmSleepModeStatus( eReturn ); + return eReturn; } @@ -5370,6 +5579,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) { TCB_t * pxTCB; + traceENTER_vTaskSetThreadLocalStoragePointer( xTaskToSet, xIndex, pvValue ); + if( ( xIndex >= 0 ) && ( xIndex < ( BaseType_t ) configNUM_THREAD_LOCAL_STORAGE_POINTERS ) ) { @@ -5377,6 +5588,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) configASSERT( pxTCB != NULL ); pxTCB->pvThreadLocalStoragePointers[ xIndex ] = pvValue; } + + traceRETURN_vTaskSetThreadLocalStoragePointer(); } #endif /* configNUM_THREAD_LOCAL_STORAGE_POINTERS */ @@ -5390,6 +5603,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) void * pvReturn = NULL; TCB_t * pxTCB; + traceENTER_pvTaskGetThreadLocalStoragePointer( xTaskToQuery, xIndex ); + if( ( xIndex >= 0 ) && ( xIndex < ( BaseType_t ) configNUM_THREAD_LOCAL_STORAGE_POINTERS ) ) { @@ -5401,6 +5616,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) pvReturn = NULL; } + traceRETURN_pvTaskGetThreadLocalStoragePointer( pvReturn ); + return pvReturn; } @@ -5414,11 +5631,15 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) { TCB_t * pxTCB; + traceENTER_vTaskAllocateMPURegions( xTaskToModify, pxRegions ); + /* If null is passed in here then we are modifying the MPU settings of * the calling task. */ pxTCB = prvGetTCBFromHandle( xTaskToModify ); vPortStoreTaskMPUSettings( &( pxTCB->xMPUSettings ), pxRegions, NULL, 0 ); + + traceRETURN_vTaskAllocateMPURegions(); } #endif /* portUSING_MPU_WRAPPERS */ @@ -5535,6 +5756,8 @@ static void prvCheckTasksWaitingTermination( void ) { TCB_t * pxTCB; + traceENTER_vTaskGetInfo( xTask, pxTaskStatus, xGetFreeStackSpace, eState ); + /* xTask is NULL then get the state of the calling task. */ pxTCB = prvGetTCBFromHandle( xTask ); @@ -5642,6 +5865,8 @@ static void prvCheckTasksWaitingTermination( void ) { pxTaskStatus->usStackHighWaterMark = 0; } + + traceRETURN_vTaskGetInfo(); } #endif /* configUSE_TRACE_FACILITY */ @@ -5716,6 +5941,8 @@ static void prvCheckTasksWaitingTermination( void ) uint8_t * pucEndOfStack; configSTACK_DEPTH_TYPE uxReturn; + traceENTER_uxTaskGetStackHighWaterMark2( xTask ); + /* uxTaskGetStackHighWaterMark() and uxTaskGetStackHighWaterMark2() are * the same except for their return type. Using configSTACK_DEPTH_TYPE * allows the user to determine the return type. It gets around the @@ -5737,6 +5964,8 @@ static void prvCheckTasksWaitingTermination( void ) uxReturn = prvTaskCheckFreeStackSpace( pucEndOfStack ); + traceRETURN_uxTaskGetStackHighWaterMark2( uxReturn ); + return uxReturn; } @@ -5751,6 +5980,8 @@ static void prvCheckTasksWaitingTermination( void ) uint8_t * pucEndOfStack; UBaseType_t uxReturn; + traceENTER_uxTaskGetStackHighWaterMark( xTask ); + pxTCB = prvGetTCBFromHandle( xTask ); #if portSTACK_GROWTH < 0 @@ -5765,6 +5996,8 @@ static void prvCheckTasksWaitingTermination( void ) uxReturn = ( UBaseType_t ) prvTaskCheckFreeStackSpace( pucEndOfStack ); + traceRETURN_uxTaskGetStackHighWaterMark( uxReturn ); + return uxReturn; } @@ -5854,11 +6087,15 @@ static void prvResetNextTaskUnblockTime( void ) { TaskHandle_t xReturn; + traceENTER_xTaskGetCurrentTaskHandle(); + /* A critical section is not required as this is not called from * an interrupt and the current TCB will always be the same for any * individual execution thread. */ xReturn = pxCurrentTCB; + traceRETURN_xTaskGetCurrentTaskHandle( xReturn ); + return xReturn; } #else /* #if ( configNUMBER_OF_CORES == 1 ) */ @@ -5867,12 +6104,16 @@ static void prvResetNextTaskUnblockTime( void ) TaskHandle_t xReturn; UBaseType_t uxSavedInterruptStatus; + traceENTER_xTaskGetCurrentTaskHandle(); + uxSavedInterruptStatus = portSET_INTERRUPT_MASK(); { xReturn = pxCurrentTCBs[ portGET_CORE_ID() ]; } portCLEAR_INTERRUPT_MASK( uxSavedInterruptStatus ); + traceRETURN_xTaskGetCurrentTaskHandle( xReturn ); + return xReturn; } @@ -5880,11 +6121,15 @@ static void prvResetNextTaskUnblockTime( void ) { TaskHandle_t xReturn = NULL; + traceENTER_xTaskGetCurrentTaskHandleCPU( xCoreID ); + if( taskVALID_CORE_ID( xCoreID ) != pdFALSE ) { xReturn = pxCurrentTCBs[ xCoreID ]; } + traceRETURN_xTaskGetCurrentTaskHandleCPU( xReturn ); + return xReturn; } #endif /* #if ( configNUMBER_OF_CORES == 1 ) */ @@ -5898,6 +6143,8 @@ static void prvResetNextTaskUnblockTime( void ) { BaseType_t xReturn; + traceENTER_xTaskGetSchedulerState(); + if( xSchedulerRunning == pdFALSE ) { xReturn = taskSCHEDULER_NOT_STARTED; @@ -5922,6 +6169,8 @@ static void prvResetNextTaskUnblockTime( void ) #endif } + traceRETURN_xTaskGetSchedulerState( xReturn ); + return xReturn; } @@ -5935,6 +6184,8 @@ static void prvResetNextTaskUnblockTime( void ) TCB_t * const pxMutexHolderTCB = pxMutexHolder; BaseType_t xReturn = pdFALSE; + traceENTER_xTaskPriorityInherit( pxMutexHolder ); + /* If the mutex was given back by an interrupt while the queue was * locked then the mutex holder might now be NULL. _RB_ Is this still * needed as interrupts can no longer use mutexes? */ @@ -6022,6 +6273,8 @@ static void prvResetNextTaskUnblockTime( void ) mtCOVERAGE_TEST_MARKER(); } + traceRETURN_xTaskPriorityInherit( xReturn ); + return xReturn; } @@ -6035,6 +6288,8 @@ static void prvResetNextTaskUnblockTime( void ) TCB_t * const pxTCB = pxMutexHolder; BaseType_t xReturn = pdFALSE; + traceENTER_xTaskPriorityDisinherit( pxMutexHolder ); + if( pxMutexHolder != NULL ) { /* A task can only have an inherited priority if it holds the mutex. @@ -6112,6 +6367,8 @@ static void prvResetNextTaskUnblockTime( void ) mtCOVERAGE_TEST_MARKER(); } + traceRETURN_xTaskPriorityDisinherit( xReturn ); + return xReturn; } @@ -6127,6 +6384,8 @@ static void prvResetNextTaskUnblockTime( void ) UBaseType_t uxPriorityUsedOnEntry, uxPriorityToUse; const UBaseType_t uxOnlyOneMutexHeld = ( UBaseType_t ) 1; + traceENTER_vTaskPriorityDisinheritAfterTimeout( pxMutexHolder, uxHighestPriorityWaitingTask ); + if( pxMutexHolder != NULL ) { /* If pxMutexHolder is not NULL then the holder must hold at least @@ -6229,6 +6488,8 @@ static void prvResetNextTaskUnblockTime( void ) { mtCOVERAGE_TEST_MARKER(); } + + traceRETURN_vTaskPriorityDisinheritAfterTimeout(); } #endif /* configUSE_MUTEXES */ @@ -6242,6 +6503,8 @@ static void prvResetNextTaskUnblockTime( void ) */ void vTaskYieldWithinAPI( void ) { + traceENTER_vTaskYieldWithinAPI(); + if( portGET_CRITICAL_NESTING_COUNT() == 0U ) { portYIELD(); @@ -6250,6 +6513,8 @@ static void prvResetNextTaskUnblockTime( void ) { xYieldPendings[ portGET_CORE_ID() ] = pdTRUE; } + + traceRETURN_vTaskYieldWithinAPI(); } #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ @@ -6259,6 +6524,8 @@ static void prvResetNextTaskUnblockTime( void ) void vTaskEnterCritical( void ) { + traceENTER_vTaskEnterCritical(); + portDISABLE_INTERRUPTS(); if( xSchedulerRunning != pdFALSE ) @@ -6280,6 +6547,8 @@ static void prvResetNextTaskUnblockTime( void ) { mtCOVERAGE_TEST_MARKER(); } + + traceRETURN_vTaskEnterCritical(); } #endif /* #if ( ( portCRITICAL_NESTING_IN_TCB == 1 ) && ( configNUMBER_OF_CORES == 1 ) ) */ @@ -6289,6 +6558,8 @@ static void prvResetNextTaskUnblockTime( void ) void vTaskEnterCritical( void ) { + traceENTER_vTaskEnterCritical(); + portDISABLE_INTERRUPTS(); if( xSchedulerRunning != pdFALSE ) @@ -6325,6 +6596,8 @@ static void prvResetNextTaskUnblockTime( void ) { mtCOVERAGE_TEST_MARKER(); } + + traceRETURN_vTaskEnterCritical(); } #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ @@ -6337,6 +6610,8 @@ static void prvResetNextTaskUnblockTime( void ) { UBaseType_t uxSavedInterruptStatus = 0; + traceENTER_vTaskEnterCriticalFromISR(); + if( xSchedulerRunning != pdFALSE ) { uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); @@ -6353,6 +6628,8 @@ static void prvResetNextTaskUnblockTime( void ) mtCOVERAGE_TEST_MARKER(); } + traceRETURN_vTaskEnterCriticalFromISR( uxSavedInterruptStatus ); + return uxSavedInterruptStatus; } @@ -6363,6 +6640,8 @@ static void prvResetNextTaskUnblockTime( void ) void vTaskExitCritical( void ) { + traceENTER_vTaskExitCritical(); + if( xSchedulerRunning != pdFALSE ) { /* If pxCurrentTCB->uxCriticalNesting is zero then this function @@ -6395,6 +6674,8 @@ static void prvResetNextTaskUnblockTime( void ) { mtCOVERAGE_TEST_MARKER(); } + + traceRETURN_vTaskExitCritical(); } #endif /* #if ( ( portCRITICAL_NESTING_IN_TCB == 1 ) && ( configNUMBER_OF_CORES == 1 ) ) */ @@ -6404,6 +6685,8 @@ static void prvResetNextTaskUnblockTime( void ) void vTaskExitCritical( void ) { + traceENTER_vTaskExitCritical(); + if( xSchedulerRunning != pdFALSE ) { /* If critical nesting count is zero then this function @@ -6452,6 +6735,8 @@ static void prvResetNextTaskUnblockTime( void ) { mtCOVERAGE_TEST_MARKER(); } + + traceRETURN_vTaskExitCritical(); } #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ @@ -6461,6 +6746,8 @@ static void prvResetNextTaskUnblockTime( void ) void vTaskExitCriticalFromISR( UBaseType_t uxSavedInterruptStatus ) { + traceENTER_vTaskExitCriticalFromISR( uxSavedInterruptStatus ); + if( xSchedulerRunning != pdFALSE ) { /* If critical nesting count is zero then this function @@ -6490,6 +6777,8 @@ static void prvResetNextTaskUnblockTime( void ) { mtCOVERAGE_TEST_MARKER(); } + + traceRETURN_vTaskExitCriticalFromISR(); } #endif /* #if ( configNUMBER_OF_CORES > 1 ) */ @@ -6530,6 +6819,8 @@ static void prvResetNextTaskUnblockTime( void ) UBaseType_t uxArraySize, x; char cStatus; + traceENTER_vTaskList( pcWriteBuffer ); + /* * PLEASE NOTE: * @@ -6623,6 +6914,8 @@ static void prvResetNextTaskUnblockTime( void ) { mtCOVERAGE_TEST_MARKER(); } + + traceRETURN_vTaskList(); } #endif /* ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) ) */ @@ -6636,6 +6929,8 @@ static void prvResetNextTaskUnblockTime( void ) UBaseType_t uxArraySize, x; configRUN_TIME_COUNTER_TYPE ulTotalTime, ulStatsAsPercentage; + traceENTER_vTaskGetRunTimeStats( pcWriteBuffer ); + /* * PLEASE NOTE: * @@ -6744,6 +7039,8 @@ static void prvResetNextTaskUnblockTime( void ) { mtCOVERAGE_TEST_MARKER(); } + + traceRETURN_vTaskGetRunTimeStats(); } #endif /* ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) ) */ @@ -6753,12 +7050,16 @@ TickType_t uxTaskResetEventItemValue( void ) { TickType_t uxReturn; + traceENTER_uxTaskResetEventItemValue(); + uxReturn = listGET_LIST_ITEM_VALUE( &( pxCurrentTCB->xEventListItem ) ); /* Reset the event list item to its normal value - so it can be used with * queues and semaphores. */ listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xEventListItem ), ( ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxCurrentTCB->uxPriority ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ + traceRETURN_uxTaskResetEventItemValue( uxReturn ); + return uxReturn; } /*-----------------------------------------------------------*/ @@ -6769,6 +7070,8 @@ TickType_t uxTaskResetEventItemValue( void ) { TCB_t * pxTCB; + traceENTER_pvTaskIncrementMutexHeldCount(); + pxTCB = pxCurrentTCB; /* If xSemaphoreCreateMutex() is called before any tasks have been created @@ -6778,6 +7081,8 @@ TickType_t uxTaskResetEventItemValue( void ) ( pxTCB->uxMutexesHeld )++; } + traceRETURN_pvTaskIncrementMutexHeldCount( pxTCB ); + return pxTCB; } @@ -6792,6 +7097,8 @@ TickType_t uxTaskResetEventItemValue( void ) { uint32_t ulReturn; + traceENTER_ulTaskGenericNotifyTake( uxIndexToWaitOn, xClearCountOnExit, xTicksToWait ); + configASSERT( uxIndexToWaitOn < configTASK_NOTIFICATION_ARRAY_ENTRIES ); taskENTER_CRITICAL(); @@ -6858,6 +7165,8 @@ TickType_t uxTaskResetEventItemValue( void ) } taskEXIT_CRITICAL(); + traceRETURN_ulTaskGenericNotifyTake( ulReturn ); + return ulReturn; } @@ -6874,6 +7183,8 @@ TickType_t uxTaskResetEventItemValue( void ) { BaseType_t xReturn; + traceENTER_xTaskGenericNotifyWait( uxIndexToWaitOn, ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait ); + configASSERT( uxIndexToWaitOn < configTASK_NOTIFICATION_ARRAY_ENTRIES ); taskENTER_CRITICAL(); @@ -6952,6 +7263,8 @@ TickType_t uxTaskResetEventItemValue( void ) } taskEXIT_CRITICAL(); + traceRETURN_xTaskGenericNotifyWait( xReturn ); + return xReturn; } @@ -6970,6 +7283,8 @@ TickType_t uxTaskResetEventItemValue( void ) BaseType_t xReturn = pdPASS; uint8_t ucOriginalNotifyState; + traceENTER_xTaskGenericNotify( xTaskToNotify, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue ); + configASSERT( uxIndexToNotify < configTASK_NOTIFICATION_ARRAY_ENTRIES ); configASSERT( xTaskToNotify ); pxTCB = xTaskToNotify; @@ -7068,6 +7383,8 @@ TickType_t uxTaskResetEventItemValue( void ) } taskEXIT_CRITICAL(); + traceRETURN_xTaskGenericNotify( xReturn ); + return xReturn; } @@ -7088,6 +7405,8 @@ TickType_t uxTaskResetEventItemValue( void ) BaseType_t xReturn = pdPASS; UBaseType_t uxSavedInterruptStatus; + traceENTER_xTaskGenericNotifyFromISR( xTaskToNotify, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken ); + configASSERT( xTaskToNotify ); configASSERT( uxIndexToNotify < configTASK_NOTIFICATION_ARRAY_ENTRIES ); @@ -7227,6 +7546,8 @@ TickType_t uxTaskResetEventItemValue( void ) } taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus ); + traceRETURN_xTaskGenericNotifyFromISR( xReturn ); + return xReturn; } @@ -7243,6 +7564,8 @@ TickType_t uxTaskResetEventItemValue( void ) uint8_t ucOriginalNotifyState; UBaseType_t uxSavedInterruptStatus; + traceENTER_vTaskGenericNotifyGiveFromISR( xTaskToNotify, uxIndexToNotify, pxHigherPriorityTaskWoken ); + configASSERT( xTaskToNotify ); configASSERT( uxIndexToNotify < configTASK_NOTIFICATION_ARRAY_ENTRIES ); @@ -7337,6 +7660,8 @@ TickType_t uxTaskResetEventItemValue( void ) } } taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus ); + + traceRETURN_vTaskGenericNotifyGiveFromISR(); } #endif /* configUSE_TASK_NOTIFICATIONS */ @@ -7350,6 +7675,8 @@ TickType_t uxTaskResetEventItemValue( void ) TCB_t * pxTCB; BaseType_t xReturn; + traceENTER_xTaskGenericNotifyStateClear( xTask, uxIndexToClear ); + configASSERT( uxIndexToClear < configTASK_NOTIFICATION_ARRAY_ENTRIES ); /* If null is passed in here then it is the calling task that is having @@ -7370,6 +7697,8 @@ TickType_t uxTaskResetEventItemValue( void ) } taskEXIT_CRITICAL(); + traceRETURN_xTaskGenericNotifyStateClear( xReturn ); + return xReturn; } @@ -7385,6 +7714,8 @@ TickType_t uxTaskResetEventItemValue( void ) TCB_t * pxTCB; uint32_t ulReturn; + traceENTER_ulTaskGenericNotifyValueClear( xTask, uxIndexToClear, ulBitsToClear ); + configASSERT( uxIndexToClear < configTASK_NOTIFICATION_ARRAY_ENTRIES ); /* If null is passed in here then it is the calling task that is having @@ -7400,6 +7731,8 @@ TickType_t uxTaskResetEventItemValue( void ) } taskEXIT_CRITICAL(); + traceRETURN_ulTaskGenericNotifyValueClear( ulReturn ); + return ulReturn; } @@ -7412,8 +7745,12 @@ TickType_t uxTaskResetEventItemValue( void ) { TCB_t * pxTCB; + traceENTER_ulTaskGetRunTimeCounter( xTask ); + pxTCB = prvGetTCBFromHandle( xTask ); + traceRETURN_ulTaskGetRunTimeCounter( pxTCB->ulRunTimeCounter ); + return pxTCB->ulRunTimeCounter; } @@ -7427,6 +7764,8 @@ TickType_t uxTaskResetEventItemValue( void ) TCB_t * pxTCB; configRUN_TIME_COUNTER_TYPE ulTotalTime, ulReturn; + traceENTER_ulTaskGetRunTimePercent( xTask ); + ulTotalTime = ( configRUN_TIME_COUNTER_TYPE ) portGET_RUN_TIME_COUNTER_VALUE(); /* For percentage calculations. */ @@ -7443,6 +7782,8 @@ TickType_t uxTaskResetEventItemValue( void ) ulReturn = 0; } + traceRETURN_ulTaskGetRunTimePercent( ulReturn ); + return ulReturn; } @@ -7456,11 +7797,15 @@ TickType_t uxTaskResetEventItemValue( void ) configRUN_TIME_COUNTER_TYPE ulReturn = 0; BaseType_t i; + traceENTER_ulTaskGetIdleRunTimeCounter(); + for( i = 0; i < ( BaseType_t ) configNUMBER_OF_CORES; i++ ) { ulReturn += xIdleTaskHandles[ i ]->ulRunTimeCounter; } + traceRETURN_ulTaskGetIdleRunTimeCounter( ulReturn ); + return ulReturn; } @@ -7475,6 +7820,8 @@ TickType_t uxTaskResetEventItemValue( void ) configRUN_TIME_COUNTER_TYPE ulRunTimeCounter = 0; BaseType_t i; + traceENTER_ulTaskGetIdleRunTimePercent(); + ulTotalTime = portGET_RUN_TIME_COUNTER_VALUE() * configNUMBER_OF_CORES; /* For percentage calculations. */ @@ -7495,6 +7842,8 @@ TickType_t uxTaskResetEventItemValue( void ) ulReturn = 0; } + traceRETURN_ulTaskGetIdleRunTimePercent( ulReturn ); + return ulReturn; } @@ -7624,8 +7973,12 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait, { TCB_t * pxTCB; + traceENTER_xTaskGetMPUSettings( xTask ); + pxTCB = prvGetTCBFromHandle( xTask ); + traceRETURN_xTaskGetMPUSettings( &( pxTCB->xMPUSettings ) ); + return &( pxTCB->xMPUSettings ); } diff --git a/timers.c b/timers.c index abe39e12cb1..0d7a0c0fe22 100644 --- a/timers.c +++ b/timers.c @@ -235,6 +235,8 @@ { BaseType_t xReturn = pdFAIL; + traceENTER_xTimerCreateTimerTask(); + /* This function is called when the scheduler is started if * configUSE_TIMERS is set to 1. Check that the infrastructure used by the * timer service task has been created/initialised. If timers have already @@ -280,6 +282,9 @@ } configASSERT( xReturn ); + + traceRETURN_xTimerCreateTimerTask( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -294,6 +299,8 @@ { Timer_t * pxNewTimer; + traceENTER_xTimerCreate( pcTimerName, xTimerPeriodInTicks, xAutoReload, pvTimerID, pxCallbackFunction ); + pxNewTimer = ( Timer_t * ) pvPortMalloc( sizeof( Timer_t ) ); /*lint !e9087 !e9079 All values returned by pvPortMalloc() have at least the alignment required by the MCU's stack, and the first member of Timer_t is always a pointer to the timer's name. */ if( pxNewTimer != NULL ) @@ -305,6 +312,8 @@ prvInitialiseNewTimer( pcTimerName, xTimerPeriodInTicks, xAutoReload, pvTimerID, pxCallbackFunction, pxNewTimer ); } + traceRETURN_xTimerCreate( pxNewTimer ); + return pxNewTimer; } @@ -322,6 +331,8 @@ { Timer_t * pxNewTimer; + traceENTER_xTimerCreateStatic( pcTimerName, xTimerPeriodInTicks, xAutoReload, pvTimerID, pxCallbackFunction, pxTimerBuffer ); + #if ( configASSERT_DEFINED == 1 ) { /* Sanity check that the size of the structure used to declare a @@ -347,6 +358,8 @@ prvInitialiseNewTimer( pcTimerName, xTimerPeriodInTicks, xAutoReload, pvTimerID, pxCallbackFunction, pxNewTimer ); } + traceRETURN_xTimerCreateStatic( pxNewTimer ); + return pxNewTimer; } @@ -395,6 +408,8 @@ ( void ) pxHigherPriorityTaskWoken; + traceENTER_xTimerGenericCommandFromTask( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ); + configASSERT( xTimer ); /* Send a message to the timer service task to perform a particular action @@ -427,6 +442,8 @@ mtCOVERAGE_TEST_MARKER(); } + traceRETURN_xTimerGenericCommandFromTask( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -442,6 +459,8 @@ ( void ) xTicksToWait; + traceENTER_xTimerGenericCommandFromISR( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ); + configASSERT( xTimer ); /* Send a message to the timer service task to perform a particular action @@ -467,15 +486,22 @@ mtCOVERAGE_TEST_MARKER(); } + traceRETURN_xTimerGenericCommandFromISR( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) { + traceENTER_xTimerGetTimerDaemonTaskHandle(); + /* If xTimerGetTimerDaemonTaskHandle() is called before the scheduler has been * started, then xTimerTaskHandle will be NULL. */ configASSERT( ( xTimerTaskHandle != NULL ) ); + + traceRETURN_xTimerGetTimerDaemonTaskHandle( xTimerTaskHandle ); + return xTimerTaskHandle; } /*-----------------------------------------------------------*/ @@ -484,7 +510,12 @@ { Timer_t * pxTimer = xTimer; + traceENTER_xTimerGetPeriod( xTimer ); + configASSERT( xTimer ); + + traceRETURN_xTimerGetPeriod( pxTimer->xTimerPeriodInTicks ); + return pxTimer->xTimerPeriodInTicks; } /*-----------------------------------------------------------*/ @@ -494,6 +525,8 @@ { Timer_t * pxTimer = xTimer; + traceENTER_vTimerSetReloadMode( xTimer, xAutoReload ); + configASSERT( xTimer ); taskENTER_CRITICAL(); { @@ -507,6 +540,8 @@ } } taskEXIT_CRITICAL(); + + traceRETURN_vTimerSetReloadMode(); } /*-----------------------------------------------------------*/ @@ -515,6 +550,8 @@ Timer_t * pxTimer = xTimer; BaseType_t xReturn; + traceENTER_xTimerGetReloadMode( xTimer ); + configASSERT( xTimer ); taskENTER_CRITICAL(); { @@ -531,12 +568,22 @@ } taskEXIT_CRITICAL(); + traceRETURN_xTimerGetReloadMode( xReturn ); + return xReturn; } UBaseType_t uxTimerGetReloadMode( TimerHandle_t xTimer ) { - return ( UBaseType_t ) xTimerGetReloadMode( xTimer ); + UBaseType_t uxReturn; + + traceENTER_uxTimerGetReloadMode( xTimer ); + + uxReturn = ( UBaseType_t ) xTimerGetReloadMode( xTimer ); + + traceRETURN_uxTimerGetReloadMode( uxReturn ); + + return uxReturn; } /*-----------------------------------------------------------*/ @@ -545,8 +592,13 @@ Timer_t * pxTimer = xTimer; TickType_t xReturn; + traceENTER_xTimerGetExpiryTime( xTimer ); + configASSERT( xTimer ); xReturn = listGET_LIST_ITEM_VALUE( &( pxTimer->xTimerListItem ) ); + + traceRETURN_xTimerGetExpiryTime( xReturn ); + return xReturn; } /*-----------------------------------------------------------*/ @@ -558,6 +610,8 @@ BaseType_t xReturn; Timer_t * pxTimer = xTimer; + traceENTER_xTimerGetStaticBuffer( xTimer, ppxTimerBuffer ); + configASSERT( ppxTimerBuffer != NULL ); if( ( pxTimer->ucStatus & tmrSTATUS_IS_STATICALLY_ALLOCATED ) != 0 ) @@ -570,6 +624,8 @@ xReturn = pdFALSE; } + traceRETURN_xTimerGetStaticBuffer( xReturn ); + return xReturn; } #endif /* configSUPPORT_STATIC_ALLOCATION */ @@ -579,7 +635,12 @@ { Timer_t * pxTimer = xTimer; + traceENTER_pcTimerGetName( xTimer ); + configASSERT( xTimer ); + + traceRETURN_pcTimerGetName( pxTimer->pcTimerName ); + return pxTimer->pcTimerName; } /*-----------------------------------------------------------*/ @@ -1057,6 +1118,8 @@ BaseType_t xReturn; Timer_t * pxTimer = xTimer; + traceENTER_xTimerIsTimerActive( xTimer ); + configASSERT( xTimer ); /* Is the timer in the list of active timers? */ @@ -1073,6 +1136,8 @@ } taskEXIT_CRITICAL(); + traceRETURN_xTimerIsTimerActive( xReturn ); + return xReturn; } /*lint !e818 Can't be pointer to const due to the typedef. */ /*-----------------------------------------------------------*/ @@ -1082,6 +1147,8 @@ Timer_t * const pxTimer = xTimer; void * pvReturn; + traceENTER_pvTimerGetTimerID( xTimer ); + configASSERT( xTimer ); taskENTER_CRITICAL(); @@ -1090,6 +1157,8 @@ } taskEXIT_CRITICAL(); + traceRETURN_pvTimerGetTimerID( pvReturn ); + return pvReturn; } /*-----------------------------------------------------------*/ @@ -1099,6 +1168,8 @@ { Timer_t * const pxTimer = xTimer; + traceENTER_vTimerSetTimerID( xTimer, pvNewID ); + configASSERT( xTimer ); taskENTER_CRITICAL(); @@ -1106,6 +1177,8 @@ pxTimer->pvTimerID = pvNewID; } taskEXIT_CRITICAL(); + + traceRETURN_vTimerSetTimerID(); } /*-----------------------------------------------------------*/ @@ -1119,6 +1192,8 @@ DaemonTaskMessage_t xMessage; BaseType_t xReturn; + traceENTER_xTimerPendFunctionCallFromISR( xFunctionToPend, pvParameter1, ulParameter2, pxHigherPriorityTaskWoken ); + /* Complete the message with the function parameters and post it to the * daemon task. */ xMessage.xMessageID = tmrCOMMAND_EXECUTE_CALLBACK_FROM_ISR; @@ -1129,6 +1204,7 @@ xReturn = xQueueSendFromISR( xTimerQueue, &xMessage, pxHigherPriorityTaskWoken ); tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, xReturn ); + traceRETURN_xTimerPendFunctionCallFromISR( xReturn ); return xReturn; } @@ -1146,6 +1222,8 @@ DaemonTaskMessage_t xMessage; BaseType_t xReturn; + traceENTER_xTimerPendFunctionCall( xFunctionToPend, pvParameter1, ulParameter2, xTicksToWait ); + /* This function can only be called after a timer has been created or * after the scheduler has been started because, until then, the timer * queue does not exist. */ @@ -1161,6 +1239,7 @@ xReturn = xQueueSendToBack( xTimerQueue, &xMessage, xTicksToWait ); tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, xReturn ); + traceRETURN_xTimerPendFunctionCall( xReturn ); return xReturn; } @@ -1172,6 +1251,10 @@ UBaseType_t uxTimerGetTimerNumber( TimerHandle_t xTimer ) { + traceENTER_uxTimerGetTimerNumber( xTimer ); + + traceRETURN_uxTimerGetTimerNumber( ( ( Timer_t * ) xTimer )->uxTimerNumber ); + return ( ( Timer_t * ) xTimer )->uxTimerNumber; } @@ -1183,7 +1266,11 @@ void vTimerSetTimerNumber( TimerHandle_t xTimer, UBaseType_t uxTimerNumber ) { + traceENTER_vTimerSetTimerNumber( xTimer, uxTimerNumber ); + ( ( Timer_t * ) xTimer )->uxTimerNumber = uxTimerNumber; + + traceRETURN_vTimerSetTimerNumber(); } #endif /* configUSE_TRACE_FACILITY */