From c5d9bfac71b629985cac710308e72ddf548a81f8 Mon Sep 17 00:00:00 2001 From: rtel Date: Fri, 28 Mar 2014 14:41:15 +0000 Subject: [PATCH] Add the pcTimerGetTimerName() API function. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2232 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- FreeRTOS/Demo/Common/Minimal/TimerDemo.c | 2 ++ FreeRTOS/Demo/Common/Minimal/death.c | 13 ------------- FreeRTOS/Source/include/timers.h | 11 +++++++++++ FreeRTOS/Source/timers.c | 8 ++++++++ 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/FreeRTOS/Demo/Common/Minimal/TimerDemo.c b/FreeRTOS/Demo/Common/Minimal/TimerDemo.c index fc0d1639e..d14fc0785 100644 --- a/FreeRTOS/Demo/Common/Minimal/TimerDemo.c +++ b/FreeRTOS/Demo/Common/Minimal/TimerDemo.c @@ -291,6 +291,8 @@ unsigned portBASE_TYPE xTimer; ( void * ) xTimer, /* An identifier for the timer as all the auto reload timers use the same callback. */ prvAutoReloadTimerCallback ); /* The callback to be called when the timer expires. */ + configASSERT( strcmp( pcTimerGetTimerName( xAutoReloadTimers[ xTimer ] ), "FR Timer" ) == 0 ); + if( xAutoReloadTimers[ xTimer ] == NULL ) { xTestStatus = pdFAIL; diff --git a/FreeRTOS/Demo/Common/Minimal/death.c b/FreeRTOS/Demo/Common/Minimal/death.c index c93519fa6..f127e04c7 100644 --- a/FreeRTOS/Demo/Common/Minimal/death.c +++ b/FreeRTOS/Demo/Common/Minimal/death.c @@ -82,19 +82,6 @@ *
*/ -/* -Changes from V3.0.0 - + CreationCount sizes changed from unsigned portBASE_TYPE to - unsigned short to minimize the risk of overflowing. - - + Reset of usLastCreationCount added - -Changes from V3.1.0 - + Changed the dummy calculation to use variables of type long, rather than - float. This allows the file to be used with ports that do not support - floating point. - -*/ #include diff --git a/FreeRTOS/Source/include/timers.h b/FreeRTOS/Source/include/timers.h index 46d6eb160..5cd1f3503 100644 --- a/FreeRTOS/Source/include/timers.h +++ b/FreeRTOS/Source/include/timers.h @@ -1094,6 +1094,17 @@ BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend, void */ BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait ); +/** + * const char * const pcTimerGetTimerName( TimerHandle_t xTimer ); + * + * Returns the name that was asigned to a timer when the timer was created. + * + * @param xTimer The handle of the timer being queried. + * + * @return The name asigned to the timer specified by the xTimer parameter. + */ +const char * const pcTimerGetTimerName( TimerHandle_t xTimer ); + /* * Functions beyond this part are not part of the public API and are intended * for use by the kernel only. diff --git a/FreeRTOS/Source/timers.c b/FreeRTOS/Source/timers.c index 4ec998ff9..d7d429554 100644 --- a/FreeRTOS/Source/timers.c +++ b/FreeRTOS/Source/timers.c @@ -363,6 +363,14 @@ DaemonTaskMessage_t xMessage; #endif /*-----------------------------------------------------------*/ +const char * const pcTimerGetTimerName( TimerHandle_t xTimer ) +{ +Timer_t *pxTimer = ( Timer_t * ) xTimer; + + return pxTimer->pcTimerName; +} +/*-----------------------------------------------------------*/ + static void prvProcessExpiredTimer( const TickType_t xNextExpireTime, const TickType_t xTimeNow ) { BaseType_t xResult; -- 2.39.2