From 9726b301d8fc85b111bd515d10e8690bc3c3ef85 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Fri, 1 Apr 2011 18:45:44 +0000 Subject: [PATCH] Added some trace macros into the timers.c file. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1337 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Source/include/FreeRTOS.h | 20 ++++++++++++++++++++ Source/timers.c | 14 ++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Source/include/FreeRTOS.h b/Source/include/FreeRTOS.h index b19fbaeba..cbaf57b48 100644 --- a/Source/include/FreeRTOS.h +++ b/Source/include/FreeRTOS.h @@ -408,6 +408,26 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * ); #define traceTASK_INCREMENT_TICK( xTickCount ) #endif +#ifndef traceTIMER_CREATE + #define traceTIMER_CREATE( pxNewTimer ) +#endif + +#ifndef traceTIMER_CREATE_FAILED + #define traceTIMER_CREATE_FAILED() +#endif + +#ifndef traceTIMER_COMMAND_SEND + #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn ) +#endif + +#ifndef traceTIMER_EXPIRED + #define traceTIMER_EXPIRED( pxTimer ) +#endif + +#ifndef traceTIMER_COMMAND_RECEIVED + #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue ) +#endif + #ifndef configGENERATE_RUN_TIME_STATS #define configGENERATE_RUN_TIME_STATS 0 #endif diff --git a/Source/timers.c b/Source/timers.c index fc0a70984..62c8c318a 100644 --- a/Source/timers.c +++ b/Source/timers.c @@ -180,6 +180,7 @@ portBASE_TYPE xReturn = pdFAIL; xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", configTIMER_TASK_STACK_DEPTH, NULL, configTIMER_TASK_PRIORITY, NULL); } + configASSERT( xReturn ); return xReturn; } /*-----------------------------------------------------------*/ @@ -203,8 +204,6 @@ xTIMER *pxNewTimer; created/initialised. */ prvCheckForValidListAndQueue(); - configASSERT( ( xTimerPeriodInTicks > 0 ) ); - /* Initialise the timer structure members using the function parameters. */ pxNewTimer->pcTimerName = pcTimerName; pxNewTimer->xTimerPeriodInTicks = xTimerPeriodInTicks; @@ -212,6 +211,12 @@ xTIMER *pxNewTimer; pxNewTimer->pvTimerID = pvTimerID; pxNewTimer->pxCallbackFunction = pxCallbackFunction; vListInitialiseItem( &( pxNewTimer->xTimerListItem ) ); + + traceTIMER_CREATE( pxNewTimer ); + } + else + { + traceTIMER_CREATE_FAILED(); } } @@ -248,6 +253,8 @@ xTIMER_MESSAGE xMessage; { xReturn = xQueueSendToBackFromISR( xTimerQueue, &xMessage, pxHigherPriorityTaskWoken ); } + + traceTIMER_COMMAND_SEND( xTimer, xCommandID, xOptionalValue, xReturn ); } return xReturn; @@ -263,6 +270,7 @@ portBASE_TYPE xResult; been performed to ensure the list is not empty. */ pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList ); vListRemove( &( pxTimer->xTimerListItem ) ); + traceTIMER_EXPIRED( pxTimer ); /* If the timer is an auto reload timer then calculate the next expiry time and re-insert the timer in the list of active timers. */ @@ -479,6 +487,8 @@ portTickType xTimeNow; } } + traceTIMER_COMMAND_RECEIVED( pxTimer, xMessage.xMessageID, xMessage.xMessageValue ); + switch( xMessage.xMessageID ) { case tmrCOMMAND_START : -- 2.39.5