static void prvDemonstratePendingFunctionCall( void );\r
\r
/*\r
- * The function that is pended by prvDemonstratePendingFunctionCall().\r
- */\r
+* The function that is pended by prvDemonstratePendingFunctionCall().\r
+*/\r
static void prvPendedFunction( void *pvParameter1, uint32_t ulParameter2 );\r
\r
+/*\r
+ * prvDemonstrateTimerQueryFunctions() is called from the idle task hook\r
+ * function to demonstrate the use of functions that query information about a\r
+ * software timer. prvTestTimerCallback() is the callback function for the\r
+ * timer being queried.\r
+ */\r
+static void prvDemonstrateTimerQueryFunctions( void );\r
+static void prvTestTimerCallback( TimerHandle_t xTimer );\r
+\r
/*\r
* A task to demonstrate the use of the xQueueSpacesAvailable() function.\r
*/\r
demonstrated by any of the standard demo tasks. */\r
prvDemonstratePendingFunctionCall();\r
\r
+ /* Demonstrate the use of functions that query information about a software\r
+ timer. */\r
+ prvDemonstrateTimerQueryFunctions();\r
+\r
+\r
/* If xMutexToDelete has not already been deleted, then delete it now.\r
This is done purely to demonstrate the use of, and test, the\r
vSemaphoreDelete() macro. Care must be taken not to delete a semaphore\r
again, before it is deleted - checking its name is as expected before\r
and after the assertion into the registry and its removal from the\r
registry. */\r
- configASSERT( pcQueueGetQueueName( xMutexToDelete ) == NULL );\r
+ configASSERT( pcQueueGetName( xMutexToDelete ) == NULL );\r
vQueueAddToRegistry( xMutexToDelete, "Test_Mutex" );\r
- configASSERT( strcmp( pcQueueGetQueueName( xMutexToDelete ), "Test_Mutex" ) == 0 );\r
+ configASSERT( strcmp( pcQueueGetName( xMutexToDelete ), "Test_Mutex" ) == 0 );\r
vQueueUnregisterQueue( xMutexToDelete );\r
- configASSERT( pcQueueGetQueueName( xMutexToDelete ) == NULL );\r
+ configASSERT( pcQueueGetName( xMutexToDelete ) == NULL );\r
\r
vSemaphoreDelete( xMutexToDelete );\r
xMutexToDelete = NULL;\r
}\r
/*-----------------------------------------------------------*/\r
\r
+static void prvTestTimerCallback( TimerHandle_t xTimer )\r
+{\r
+ /* This is the callback function for the timer accessed by\r
+ prvDemonstrateTimerQueryFunctions(). The callback does not do anything. */\r
+ ( void ) xTimer;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvDemonstrateTimerQueryFunctions( void )\r
+{\r
+static TimerHandle_t xTimer = NULL;\r
+const char *pcTimerName = "TestTimer";\r
+volatile TickType_t xExpiryTime;\r
+const TickType_t xDontBlock = 0;\r
+\r
+ if( xTimer == NULL )\r
+ {\r
+ xTimer = xTimerCreate( pcTimerName, portMAX_DELAY, pdTRUE, NULL, prvTestTimerCallback );\r
+\r
+ if( xTimer != NULL )\r
+ {\r
+ /* Called from the idle task so a block time must not be\r
+ specified. */\r
+ xTimerStart( xTimer, xDontBlock );\r
+ }\r
+ }\r
+\r
+ if( xTimer != NULL )\r
+ {\r
+ /* Demonstrate querying a timer's name. */\r
+ configASSERT( strcmp( pcTimerGetName( xTimer ), pcTimerName ) == 0 );\r
+\r
+ /* Demonstrate querying a timer's period. */\r
+ configASSERT( xTimerGetPeriod( xTimer ) == portMAX_DELAY );\r
+\r
+ /* Demonstrate querying a timer's next expiry time, although nothing is\r
+ done with the returned value. Note if the expiry time is less than the\r
+ maximum tick count then the expiry time has overflowed from the current\r
+ time. In this case the expiry time was set to portMAX_DELAY, so it is\r
+ expected to be less than the current time until the current time has\r
+ itself overflowed. */\r
+ xExpiryTime = xTimerGetExpiryTime( xTimer );\r
+ ( void ) xExpiryTime;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
static void prvDemonstratePendingFunctionCall( void )\r
{\r
static uint32_t ulParameter1 = 1000UL, ulParameter2 = 0UL;\r
}\r
\r
/* Check the timer task handle was returned correctly. */\r
- pcTaskName = pcTaskGetTaskName( xTimerTaskHandle );\r
+ pcTaskName = pcTaskGetName( xTimerTaskHandle );\r
if( strcmp( pcTaskName, "Tmr Svc" ) != 0 )\r
{\r
pcStatusMessage = "Error: Returned timer task handle was incorrect";\r