+char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+\r
+/**\r
+ * task.h\r
+ * <PRE>UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask );</PRE>\r
+ *\r
+ * INCLUDE_uxTaskGetStackHighWaterMark must be set to 1 in FreeRTOSConfig.h for\r
+ * this function to be available.\r
+ *\r
+ * Returns the high water mark of the stack associated with xTask. That is,\r
+ * the minimum free stack space there has been (in words, so on a 32 bit machine\r
+ * a value of 1 means 4 bytes) since the task started. The smaller the returned\r
+ * number the closer the task has come to overflowing its stack.\r
+ *\r
+ * @param xTask Handle of the task associated with the stack to be checked.\r
+ * Set xTask to NULL to check the stack of the calling task.\r
+ *\r
+ * @return The smallest amount of free stack space there has been (in words, so\r
+ * actual spaces on the stack rather than bytes) since the task referenced by\r
+ * xTask was created.\r
+ */\r
+UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+\r
+/* When using trace macros it is sometimes necessary to include task.h before\r
+FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined,\r
+so the following two prototypes will cause a compilation error. This can be\r
+fixed by simply guarding against the inclusion of these two prototypes unless\r
+they are explicitly required by the configUSE_APPLICATION_TASK_TAG configuration\r
+constant. */\r
+#ifdef configUSE_APPLICATION_TASK_TAG\r
+ #if configUSE_APPLICATION_TASK_TAG == 1\r
+ /**\r
+ * task.h\r
+ * <pre>void vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction );</pre>\r
+ *\r
+ * Sets pxHookFunction to be the task hook function used by the task xTask.\r
+ * Passing xTask as NULL has the effect of setting the calling tasks hook\r
+ * function.\r
+ */\r
+ void vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction ) PRIVILEGED_FUNCTION;\r
+\r
+ /**\r
+ * task.h\r
+ * <pre>void xTaskGetApplicationTaskTag( TaskHandle_t xTask );</pre>\r
+ *\r
+ * Returns the pxHookFunction value assigned to the task xTask.\r
+ */\r
+ TaskHookFunction_t xTaskGetApplicationTaskTag( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+ #endif /* configUSE_APPLICATION_TASK_TAG ==1 */\r
+#endif /* ifdef configUSE_APPLICATION_TASK_TAG */\r
+\r
+#if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )\r
+\r
+ /* Each task contains an array of pointers that is dimensioned by the\r
+ configNUM_THREAD_LOCAL_STORAGE_POINTERS setting in FreeRTOSConfig.h. The\r
+ kernel does not use the pointers itself, so the application writer can use\r
+ the pointers for any purpose they wish. The following two functions are\r
+ used to set and query a pointer respectively. */\r
+ void vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue );\r
+ void *pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex );\r
+\r
+#endif\r
+\r
+/**\r
+ * task.h\r
+ * <pre>BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );</pre>\r
+ *\r
+ * Calls the hook function associated with xTask. Passing xTask as NULL has\r
+ * the effect of calling the Running tasks (the calling task) hook function.\r
+ *\r
+ * pvParameter is passed to the hook function for the task to interpret as it\r
+ * wants. The return value is the value returned by the task hook function\r
+ * registered by the user.\r
+ */\r
+BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * xTaskGetIdleTaskHandle() is only available if\r
+ * INCLUDE_xTaskGetIdleTaskHandle is set to 1 in FreeRTOSConfig.h.\r
+ *\r
+ * Simply returns the handle of the idle task. It is not valid to call\r
+ * xTaskGetIdleTaskHandle() before the scheduler has been started.\r
+ */\r
+TaskHandle_t xTaskGetIdleTaskHandle( void );\r
+\r
+/**\r
+ * configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for\r
+ * uxTaskGetSystemState() to be available.\r
+ *\r
+ * uxTaskGetSystemState() populates an TaskStatus_t structure for each task in\r
+ * the system. TaskStatus_t structures contain, among other things, members\r
+ * for the task handle, task name, task priority, task state, and total amount\r
+ * of run time consumed by the task. See the TaskStatus_t structure\r
+ * definition in this file for the full member list.\r
+ *\r
+ * NOTE: This function is intended for debugging use only as its use results in\r
+ * the scheduler remaining suspended for an extended period.\r
+ *\r
+ * @param pxTaskStatusArray A pointer to an array of TaskStatus_t structures.\r
+ * The array must contain at least one TaskStatus_t structure for each task\r
+ * that is under the control of the RTOS. The number of tasks under the control\r
+ * of the RTOS can be determined using the uxTaskGetNumberOfTasks() API function.\r
+ *\r
+ * @param uxArraySize The size of the array pointed to by the pxTaskStatusArray\r
+ * parameter. The size is specified as the number of indexes in the array, or\r
+ * the number of TaskStatus_t structures contained in the array, not by the\r
+ * number of bytes in the array.\r
+ *\r
+ * @param pulTotalRunTime If configGENERATE_RUN_TIME_STATS is set to 1 in\r
+ * FreeRTOSConfig.h then *pulTotalRunTime is set by uxTaskGetSystemState() to the\r
+ * total run time (as defined by the run time stats clock, see\r
+ * http://www.freertos.org/rtos-run-time-stats.html) since the target booted.\r
+ * pulTotalRunTime can be set to NULL to omit the total run time information.\r
+ *\r
+ * @return The number of TaskStatus_t structures that were populated by\r
+ * uxTaskGetSystemState(). This should equal the number returned by the\r
+ * uxTaskGetNumberOfTasks() API function, but will be zero if the value passed\r
+ * in the uxArraySize parameter was too small.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ // This example demonstrates how a human readable table of run time stats\r
+ // information is generated from raw data provided by uxTaskGetSystemState().\r
+ // The human readable table is written to pcWriteBuffer\r
+ void vTaskGetRunTimeStats( char *pcWriteBuffer )\r
+ {\r
+ TaskStatus_t *pxTaskStatusArray;\r
+ volatile UBaseType_t uxArraySize, x;\r
+ uint32_t ulTotalRunTime, ulStatsAsPercentage;\r
+\r
+ // Make sure the write buffer does not contain a string.\r
+ *pcWriteBuffer = 0x00;\r
+\r
+ // Take a snapshot of the number of tasks in case it changes while this\r
+ // function is executing.\r
+ uxArraySize = uxTaskGetNumberOfTasks();\r
+\r
+ // Allocate a TaskStatus_t structure for each task. An array could be\r
+ // allocated statically at compile time.\r
+ pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( TaskStatus_t ) );\r
+\r
+ if( pxTaskStatusArray != NULL )\r
+ {\r
+ // Generate raw status information about each task.\r
+ uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, &ulTotalRunTime );\r
+\r
+ // For percentage calculations.\r
+ ulTotalRunTime /= 100UL;\r
+\r
+ // Avoid divide by zero errors.\r
+ if( ulTotalRunTime > 0 )\r
+ {\r
+ // For each populated position in the pxTaskStatusArray array,\r
+ // format the raw data as human readable ASCII data\r
+ for( x = 0; x < uxArraySize; x++ )\r
+ {\r
+ // What percentage of the total run time has the task used?\r
+ // This will always be rounded down to the nearest integer.\r
+ // ulTotalRunTimeDiv100 has already been divided by 100.\r
+ ulStatsAsPercentage = pxTaskStatusArray[ x ].ulRunTimeCounter / ulTotalRunTime;\r
+\r
+ if( ulStatsAsPercentage > 0UL )\r
+ {\r
+ sprintf( pcWriteBuffer, "%s\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );\r
+ }\r
+ else\r
+ {\r
+ // If the percentage is zero here then the task has\r
+ // consumed less than 1% of the total run time.\r
+ sprintf( pcWriteBuffer, "%s\t\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );\r
+ }\r
+\r
+ pcWriteBuffer += strlen( ( char * ) pcWriteBuffer );\r
+ }\r
+ }\r
+\r
+ // The array is no longer needed, free the memory it consumes.\r
+ vPortFree( pxTaskStatusArray );\r
+ }\r
+ }\r
+ </pre>\r
+ */\r
+UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime );\r