mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-23 23:11:58 -04:00
Add in the pcTaskGetTaskName(), xTaskGetIdleTaskHandle() and xTimerGetTimerTaskHandle() API functions.
This commit is contained in:
parent
a2a309c263
commit
fc99c14905
|
@ -138,6 +138,14 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
#error Missing definition: configUSE_16_BIT_TICKS should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
#error Missing definition: configUSE_16_BIT_TICKS should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTaskGetIdleTaskHandle
|
||||||
|
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTimerGetTimerTaskHandle
|
||||||
|
#define INCLUDE_xTimerGetTimerTaskHandle 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef configUSE_APPLICATION_TASK_TAG
|
#ifndef configUSE_APPLICATION_TASK_TAG
|
||||||
#define configUSE_APPLICATION_TASK_TAG 0
|
#define configUSE_APPLICATION_TASK_TAG 0
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1005,6 +1005,19 @@ portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;
|
||||||
*/
|
*/
|
||||||
unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;
|
unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* task. h
|
||||||
|
* <PRE>signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );</PRE>
|
||||||
|
*
|
||||||
|
* @return The text (human readable) name of the task referenced by the handle
|
||||||
|
* xTaskToQueury. A task can query its own name by either passing in its own
|
||||||
|
* handle, or by setting xTaskToQuery to NULL.
|
||||||
|
*
|
||||||
|
* \page pcTaskGetTaskName pcTaskGetTaskName
|
||||||
|
* \ingroup TaskUtils
|
||||||
|
*/
|
||||||
|
signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* task. h
|
* task. h
|
||||||
* <PRE>void vTaskList( char *pcWriteBuffer );</PRE>
|
* <PRE>void vTaskList( char *pcWriteBuffer );</PRE>
|
||||||
|
@ -1157,6 +1170,14 @@ constant. */
|
||||||
*/
|
*/
|
||||||
portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) PRIVILEGED_FUNCTION;
|
portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xTaskGetIdleTaskHandle() is only available if
|
||||||
|
* INCLUDE_xTaskGetIdleTaskHandle is set to 1 in FreeRTOSConfig.h.
|
||||||
|
*
|
||||||
|
* Simply returns the handle of the idle task. It is not valid to call
|
||||||
|
* xTaskGetIdleTaskHandle() before the scheduler has been started.
|
||||||
|
*/
|
||||||
|
xTaskHandle xTaskGetIdleTaskHandle( void );
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES
|
* SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES
|
||||||
|
|
|
@ -283,6 +283,15 @@ void *pvTimerGetTimerID( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;
|
||||||
*/
|
*/
|
||||||
portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;
|
portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xTimerGetTimerTaskHandle() is only available if
|
||||||
|
* INCLUDE_xTimerGetTimerTaskHandle is set to 1 in FreeRTOSConfig.h.
|
||||||
|
*
|
||||||
|
* Simply returns the handle of the timer service/daemon task. It it not valid
|
||||||
|
* to call xTimerGetTimerTaskHandle() before the scheduler has been started.
|
||||||
|
*/
|
||||||
|
xTaskHandle xTimerGetTimerTaskHandle( void );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* portBASE_TYPE xTimerStart( xTimerHandle xTimer, portTickType xBlockTime );
|
* portBASE_TYPE xTimerStart( xTimerHandle xTimer, portTickType xBlockTime );
|
||||||
*
|
*
|
||||||
|
|
|
@ -157,6 +157,12 @@ PRIVILEGED_DATA static xList xPendingReadyList; /*< Tasks that have been r
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
|
||||||
|
|
||||||
|
PRIVILEGED_DATA static xTaskHandle xIdleTaskHandle = NULL;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* File private variables. --------------------------------*/
|
/* File private variables. --------------------------------*/
|
||||||
PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxCurrentNumberOfTasks = ( unsigned portBASE_TYPE ) 0;
|
PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxCurrentNumberOfTasks = ( unsigned portBASE_TYPE ) 0;
|
||||||
PRIVILEGED_DATA static volatile portTickType xTickCount = ( portTickType ) 0;
|
PRIVILEGED_DATA static volatile portTickType xTickCount = ( portTickType ) 0;
|
||||||
|
@ -1090,7 +1096,18 @@ void vTaskStartScheduler( void )
|
||||||
portBASE_TYPE xReturn;
|
portBASE_TYPE xReturn;
|
||||||
|
|
||||||
/* Add the idle task at the lowest priority. */
|
/* Add the idle task at the lowest priority. */
|
||||||
xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), ( xTaskHandle * ) NULL );
|
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
|
||||||
|
{
|
||||||
|
/* Create the idle task, storing its handle in xIdleTaskHandle so it can
|
||||||
|
be returned by the xTaskGetIdleTaskHandle() function. */
|
||||||
|
xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
/* Create the idle task without storing its handle. */
|
||||||
|
xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), NULL );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ( configUSE_TIMERS == 1 )
|
#if ( configUSE_TIMERS == 1 )
|
||||||
{
|
{
|
||||||
|
@ -1281,6 +1298,17 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery )
|
||||||
|
{
|
||||||
|
tskTCB *pxTCB;
|
||||||
|
|
||||||
|
/* If null is passed in here then the name of the calling task is being queried. */
|
||||||
|
pxTCB = prvGetTCBFromHandle( xTaskToQuery );
|
||||||
|
configASSERT( pxTCB );
|
||||||
|
return &( pxTCB->pcTaskName[ 0 ] );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||||
|
|
||||||
void vTaskList( signed char *pcWriteBuffer )
|
void vTaskList( signed char *pcWriteBuffer )
|
||||||
|
@ -1455,8 +1483,19 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
/*----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
|
||||||
|
|
||||||
|
xTaskHandle xTaskGetIdleTaskHandle( void )
|
||||||
|
{
|
||||||
|
/* If xTaskGetIdleTaskHandle() is called before the scheduler has been
|
||||||
|
started, then xIdleTaskHandle will be NULL. */
|
||||||
|
configASSERT( ( xIdleTaskHandle != NULL ) );
|
||||||
|
return xIdleTaskHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES
|
* SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES
|
||||||
|
|
|
@ -110,6 +110,12 @@ PRIVILEGED_DATA static xList *pxOverflowTimerList;
|
||||||
/* A queue that is used to send commands to the timer service task. */
|
/* A queue that is used to send commands to the timer service task. */
|
||||||
PRIVILEGED_DATA static xQueueHandle xTimerQueue = NULL;
|
PRIVILEGED_DATA static xQueueHandle xTimerQueue = NULL;
|
||||||
|
|
||||||
|
#if ( INCLUDE_xTimerGetTimerTaskHandle == 1 )
|
||||||
|
|
||||||
|
PRIVILEGED_DATA static xTaskHandle xTimerTaskHandle = NULL;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -183,7 +189,18 @@ portBASE_TYPE xReturn = pdFAIL;
|
||||||
|
|
||||||
if( xTimerQueue != NULL )
|
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 );
|
configASSERT( xReturn );
|
||||||
|
@ -267,6 +284,19 @@ xTIMER_MESSAGE xMessage;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#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 )
|
static void prvProcessExpiredTimer( portTickType xNextExpireTime, portTickType xTimeNow )
|
||||||
{
|
{
|
||||||
xTIMER *pxTimer;
|
xTIMER *pxTimer;
|
||||||
|
|
Loading…
Reference in a new issue