Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FreeRTOS/FreeRTOS-Kernel.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Brosch <9060129+Techcore123@users.noreply.github.com>2023-09-20 13:17:42 +0300
committerGitHub <noreply@github.com>2023-09-20 13:17:42 +0300
commit83861f5b1def1e4a3e1ea75562446f06e5b4359e (patch)
tree2f030beb72c7712a4e4425e37373a4ff46ad0742 /timers.c
parent15e0364968aff9c6c3cc7b4893e8ec0311047ce2 (diff)
Add Trace Hook Macros to all API calls (#786)
This pull-request adds out-of-the-box support for different tracing tools. New trace hook macros have been added for all public API functions, one for each function entry and one for each exit. There are no functional changes, as the macros are by default empty. For more information see following forum post: https://forums.freertos.org/t/add-tracing-functionality-for-all-api-calls/18007.
Diffstat (limited to 'timers.c')
-rw-r--r--timers.c89
1 files changed, 88 insertions, 1 deletions
diff --git a/timers.c b/timers.c
index abe39e12c..0d7a0c0fe 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 */