Add in the pcTaskGetTaskName(), xTaskGetIdleTaskHandle() and xTimerGetTimerTaskHandle() API functions.
diff --git a/Source/timers.c b/Source/timers.c
index 7e5ef22..2d3f3ba 100644
--- a/Source/timers.c
+++ b/Source/timers.c
@@ -110,6 +110,12 @@
/* A queue that is used to send commands to the timer service task. */
PRIVILEGED_DATA static xQueueHandle xTimerQueue = NULL;
+#if ( INCLUDE_xTimerGetTimerTaskHandle == 1 )
+
+ PRIVILEGED_DATA static xTaskHandle xTimerTaskHandle = NULL;
+
+#endif
+
/*-----------------------------------------------------------*/
/*
@@ -183,7 +189,18 @@
if( xTimerQueue != NULL )
{
- xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY, NULL);
+ #if ( INCLUDE_xTimerGetTimerTaskHandle == 1 )
+ {
+ /* Create the timer task, storing its handle in xTimerTaskHandle so
+ it can be returned by the xTimerGetTimerTaskHandle() function. */
+ xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY, &xTimerTaskHandle );
+ }
+ #else
+ {
+ /* Create the timer task without storing its handle. */
+ xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY, NULL);
+ }
+ #endif
}
configASSERT( xReturn );
@@ -267,6 +284,19 @@
}
/*-----------------------------------------------------------*/
+#if ( INCLUDE_xTimerGetTimerTaskHandle == 1 )
+
+ xTaskHandle xTimerGetTimerTaskHandle( void )
+ {
+ /* If xTimerGetTimerTaskHandle() is called before the scheduler has been
+ started, then xTimerTaskHandle will be NULL. */
+ configASSERT( ( xTimerTaskHandle != NULL ) );
+ return xTimerTaskHandle;
+ }
+
+#endif
+/*-----------------------------------------------------------*/
+
static void prvProcessExpiredTimer( portTickType xNextExpireTime, portTickType xTimeNow )
{
xTIMER *pxTimer;