MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / vTaskGetInfo

Function vTaskGetInfo

tasks.c:4612–4704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4610#if ( configUSE_TRACE_FACILITY == 1 )
4611
4612 void vTaskGetInfo( TaskHandle_t xTask,
4613 TaskStatus_t * pxTaskStatus,
4614 BaseType_t xGetFreeStackSpace,
4615 eTaskState eState )
4616 {
4617 TCB_t * pxTCB;
4618
4619 /* xTask is NULL then get the state of the calling task. */
4620 pxTCB = prvGetTCBFromHandle( xTask );
4621
4622 pxTaskStatus->xHandle = ( TaskHandle_t ) pxTCB;
4623 pxTaskStatus->pcTaskName = ( const char * ) &( pxTCB->pcTaskName[ 0 ] );
4624 pxTaskStatus->uxCurrentPriority = pxTCB->uxPriority;
4625 pxTaskStatus->pxStackBase = pxTCB->pxStack;
4626 pxTaskStatus->xTaskNumber = pxTCB->uxTCBNumber;
4627
4628 #if ( configUSE_MUTEXES == 1 )
4629 {
4630 pxTaskStatus->uxBasePriority = pxTCB->uxBasePriority;
4631 }
4632 #else
4633 {
4634 pxTaskStatus->uxBasePriority = 0;
4635 }
4636 #endif
4637
4638 #if ( configGENERATE_RUN_TIME_STATS == 1 )
4639 {
4640 pxTaskStatus->ulRunTimeCounter = pxTCB->ulRunTimeCounter;
4641 }
4642 #else
4643 {
4644 pxTaskStatus->ulRunTimeCounter = 0;
4645 }
4646 #endif
4647
4648 /* Obtaining the task state is a little fiddly, so is only done if the
4649 * value of eState passed into this function is eInvalid - otherwise the
4650 * state is just set to whatever is passed in. */
4651 if( eState != eInvalid )
4652 {
4653 if( taskTASK_IS_RUNNING( pxTCB->xTaskRunState ) )
4654 {
4655 pxTaskStatus->eCurrentState = eRunning;
4656 }
4657 else
4658 {
4659 pxTaskStatus->eCurrentState = eState;
4660
4661 #if ( INCLUDE_vTaskSuspend == 1 )
4662 {
4663 /* If the task is in the suspended list then there is a
4664 * chance it is actually just blocked indefinitely - so really
4665 * it should be reported as being in the Blocked state. */
4666 if( eState == eSuspended )
4667 {
4668 vTaskSuspendAll();
4669 {

Callers 2

MPU_vTaskGetInfoFunction · 0.85

Calls 4

vTaskSuspendAllFunction · 0.85
xTaskResumeAllFunction · 0.85
eTaskGetStateFunction · 0.85

Tested by

no test coverage detected