]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/include/task.h
Add trace macros into the event groups implementation.
[freertos] / FreeRTOS / Source / include / task.h
index 42a57e44bacd28c3f9310588b1a136daac26b484..288c783fe203d2b5c9809aafcb47f8aea2226821 100644 (file)
@@ -1,48 +1,38 @@
 /*\r
-    FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    All rights reserved\r
 \r
-    FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
-    http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
 \r
     ***************************************************************************\r
      *                                                                       *\r
-     *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
-     *    Complete, revised, and edited pdf reference manuals are also       *\r
-     *    available.                                                         *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that has become a de facto standard.             *\r
      *                                                                       *\r
-     *    Purchasing FreeRTOS documentation will not only help you, by       *\r
-     *    ensuring you get running as quickly as possible and with an        *\r
-     *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
-     *    the FreeRTOS project to continue with its mission of providing     *\r
-     *    professional grade, cross platform, de facto standard solutions    *\r
-     *    for microcontrollers - completely free of charge!                  *\r
+     *    Help yourself get started quickly and support the FreeRTOS         *\r
+     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
+     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
      *                                                                       *\r
-     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
-     *                                                                       *\r
-     *    Thank you for using FreeRTOS, and thank you for your support!      *\r
+     *    Thank you!                                                         *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-\r
     This file is part of the FreeRTOS distribution.\r
 \r
     FreeRTOS is free software; you can redistribute it and/or modify it under\r
     the terms of the GNU General Public License (version 2) as published by the\r
-    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
 \r
-    >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to\r
-    distribute a combined work that includes FreeRTOS without being obliged to\r
-    provide the source code for proprietary components outside of the FreeRTOS\r
-    kernel.\r
+    >>! NOTE: The modification to the GPL is included to allow you to distribute\r
+    >>! a combined work that includes FreeRTOS without being obliged to provide\r
+    >>! the source code for proprietary components outside of the FreeRTOS\r
+    >>! kernel.\r
 \r
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
-    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
-    details. You should have received a copy of the GNU General Public License\r
-    and the FreeRTOS license exception along with FreeRTOS; if not itcan be\r
-    viewed here: http://www.freertos.org/a00114.html and also obtained by\r
-    writing to Real Time Engineers Ltd., contact details for whom are available\r
-    on the FreeRTOS WEB site.\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available from the following\r
+    link: http://www.freertos.org/a00114.html\r
 \r
     1 tab == 4 spaces!\r
 \r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-\r
     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
     license and Real Time Engineers Ltd. contact details.\r
 \r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
-    including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
-    fully thread aware and reentrant UDP/IP stack.\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
 \r
     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
-    Integrity Systems, who sell the code with commercial support,\r
-    indemnification and middleware, under the OpenRTOS brand.\r
+    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and middleware.\r
 \r
-    http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
-    engineered and independently SIL3 certified version for use in safety and \r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
     mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
 */\r
 \r
 \r
-#ifndef TASK_H\r
-#define TASK_H\r
+#ifndef INC_TASK_H\r
+#define INC_TASK_H\r
 \r
 #ifndef INC_FREERTOS_H\r
        #error "include FreeRTOS.h must appear in source files before include task.h"\r
 #endif\r
 \r
-#include "portable.h"\r
 #include "list.h"\r
 \r
 #ifdef __cplusplus\r
@@ -91,7 +81,7 @@ extern "C" {
  * MACROS AND DEFINITIONS\r
  *----------------------------------------------------------*/\r
 \r
-#define tskKERNEL_VERSION_NUMBER "V7.4.0"\r
+#define tskKERNEL_VERSION_NUMBER "V7.6.0"\r
 \r
 /**\r
  * task. h\r
@@ -100,11 +90,21 @@ extern "C" {
  * returns (via a pointer parameter) an xTaskHandle variable that can then\r
  * be used as a parameter to vTaskDelete to delete the task.\r
  *\r
- * \page xTaskHandle xTaskHandle\r
+ * \defgroup xTaskHandle xTaskHandle\r
  * \ingroup Tasks\r
  */\r
 typedef void * xTaskHandle;\r
 \r
+/* Task states returned by eTaskGetState. */\r
+typedef enum\r
+{\r
+       eRunning = 0,   /* A task is querying the state of itself, so must be running. */\r
+       eReady,                 /* The task being queried is in a read or pending ready list. */\r
+       eBlocked,               /* The task being queried is in the Blocked state. */\r
+       eSuspended,             /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */\r
+       eDeleted                /* The task being queried has been deleted, but its TCB has not yet been freed. */\r
+} eTaskState;\r
+\r
 /*\r
  * Used internally only.\r
  */\r
@@ -127,7 +127,7 @@ typedef struct xMEMORY_REGION
 /*\r
  * Parameters required to create an MPU protected task.\r
  */\r
-typedef struct xTASK_PARAMTERS\r
+typedef struct xTASK_PARAMETERS\r
 {\r
        pdTASK_CODE pvTaskCode;\r
        const signed char * const pcName;\r
@@ -138,15 +138,19 @@ typedef struct xTASK_PARAMTERS
        xMemoryRegion xRegions[ portNUM_CONFIGURABLE_REGIONS ];\r
 } xTaskParameters;\r
 \r
-/* Task states returned by eTaskGetState. */\r
-typedef enum\r
+/* Used with the uxTaskGetSystemState() function to return the state of each task\r
+in the system. */\r
+typedef struct xTASK_STATUS\r
 {\r
-       eRunning = 0,   /* A task is querying the state of itself, so must be running. */\r
-       eReady,                 /* The task being queried is in a read or pending ready list. */\r
-       eBlocked,               /* The task being queried is in the Blocked state. */\r
-       eSuspended,             /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */\r
-       eDeleted                /* The task being queried has been deleted, but its TCB has not yet been freed. */\r
-} eTaskState;\r
+       xTaskHandle xHandle;                                            /* The handle of the task to which the rest of the information in the structure relates. */\r
+       const signed char *pcTaskName;                          /* A pointer to the task's name.  This value will be invalid if the task was deleted since the structure was populated! */\r
+       unsigned portBASE_TYPE xTaskNumber;                     /* A number unique to the task. */\r
+       eTaskState eCurrentState;                                       /* The state in which the task existed when the structure was populated. */\r
+       unsigned portBASE_TYPE uxCurrentPriority;       /* The priority at which the task was running (may be inherited) when the structure was populated. */\r
+       unsigned portBASE_TYPE uxBasePriority;          /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex.  Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */\r
+       unsigned long ulRunTimeCounter;                         /* The total run time allocated to the task so far, as defined by the run time stats clock.  See http://www.freertos.org/rtos-run-time-stats.html.  Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */\r
+       unsigned short usStackHighWaterMark;            /* The minimum amount of stack space that has remained for the task since the task was created.  The closer this value is to zero the closer the task has come to overflowing its stack. */\r
+} xTaskStatusType;\r
 \r
 /* Possible return values for eTaskConfirmSleepModeStatus(). */\r
 typedef enum\r
@@ -157,7 +161,7 @@ typedef enum
 } eSleepModeStatus;\r
 \r
 \r
-/*\r
+/**\r
  * Defines the priority used by the idle task.  This must not be modified.\r
  *\r
  * \ingroup TaskUtils\r
@@ -169,7 +173,7 @@ typedef enum
  *\r
  * Macro for forcing a context switch.\r
  *\r
- * \page taskYIELD taskYIELD\r
+ * \defgroup taskYIELD taskYIELD\r
  * \ingroup SchedulerControl\r
  */\r
 #define taskYIELD()                                    portYIELD()\r
@@ -183,7 +187,7 @@ typedef enum
  * NOTE: This may alter the stack (depending on the portable implementation)\r
  * so must be used with care!\r
  *\r
- * \page taskENTER_CRITICAL taskENTER_CRITICAL\r
+ * \defgroup taskENTER_CRITICAL taskENTER_CRITICAL\r
  * \ingroup SchedulerControl\r
  */\r
 #define taskENTER_CRITICAL()           portENTER_CRITICAL()\r
@@ -197,7 +201,7 @@ typedef enum
  * NOTE: This may alter the stack (depending on the portable implementation)\r
  * so must be used with care!\r
  *\r
- * \page taskEXIT_CRITICAL taskEXIT_CRITICAL\r
+ * \defgroup taskEXIT_CRITICAL taskEXIT_CRITICAL\r
  * \ingroup SchedulerControl\r
  */\r
 #define taskEXIT_CRITICAL()                    portEXIT_CRITICAL()\r
@@ -207,7 +211,7 @@ typedef enum
  *\r
  * Macro to disable all maskable interrupts.\r
  *\r
- * \page taskDISABLE_INTERRUPTS taskDISABLE_INTERRUPTS\r
+ * \defgroup taskDISABLE_INTERRUPTS taskDISABLE_INTERRUPTS\r
  * \ingroup SchedulerControl\r
  */\r
 #define taskDISABLE_INTERRUPTS()       portDISABLE_INTERRUPTS()\r
@@ -217,15 +221,18 @@ typedef enum
  *\r
  * Macro to enable microcontroller interrupts.\r
  *\r
- * \page taskENABLE_INTERRUPTS taskENABLE_INTERRUPTS\r
+ * \defgroup taskENABLE_INTERRUPTS taskENABLE_INTERRUPTS\r
  * \ingroup SchedulerControl\r
  */\r
 #define taskENABLE_INTERRUPTS()                portENABLE_INTERRUPTS()\r
 \r
-/* Definitions returned by xTaskGetSchedulerState(). */\r
-#define taskSCHEDULER_NOT_STARTED      0\r
-#define taskSCHEDULER_RUNNING          1\r
-#define taskSCHEDULER_SUSPENDED                2\r
+/* Definitions returned by xTaskGetSchedulerState().  taskSCHEDULER_SUSPENDED is\r
+0 to generate more optimal code when configASSERT() is defined as the constant\r
+is used in assert() statements. */\r
+#define taskSCHEDULER_SUSPENDED                ( ( portBASE_TYPE ) 0 )\r
+#define taskSCHEDULER_NOT_STARTED      ( ( portBASE_TYPE ) 1 )\r
+#define taskSCHEDULER_RUNNING          ( ( portBASE_TYPE ) 2 )\r
+\r
 \r
 /*-----------------------------------------------------------\r
  * TASK CREATION API\r
@@ -236,7 +243,7 @@ typedef enum
  *<pre>\r
  portBASE_TYPE xTaskCreate(\r
                                                          pdTASK_CODE pvTaskCode,\r
-                                                         const char * const pcName,\r
+                                                         const signed char * const pcName,\r
                                                          unsigned short usStackDepth,\r
                                                          void *pvParameters,\r
                                                          unsigned portBASE_TYPE uxPriority,\r
@@ -254,7 +261,7 @@ typedef enum
  * must be implemented to never return (i.e. continuous loop).\r
  *\r
  * @param pcName A descriptive name for the task.  This is mainly used to\r
- * facilitate debugging.  Max length defined by tskMAX_TASK_NAME_LEN - default\r
+ * facilitate debugging.  Max length defined by configMAX_TASK_NAME_LEN - default\r
  * is 16.\r
  *\r
  * @param usStackDepth The size of the task stack specified as the number of\r
@@ -275,7 +282,7 @@ typedef enum
  * can be referenced.\r
  *\r
  * @return pdPASS if the task was successfully created and added to a ready\r
- * list, otherwise an error code defined in the file errors. h\r
+ * list, otherwise an error code defined in the file projdefs.h\r
  *\r
  * Example usage:\r
    <pre>\r
@@ -292,16 +299,20 @@ typedef enum
  void vOtherFunction( void )\r
  {\r
  static unsigned char ucParameterToPass;\r
- xTaskHandle xHandle;\r
+ xTaskHandle xHandle = NULL;\r
 \r
         // Create the task, storing the handle.  Note that the passed parameter ucParameterToPass\r
         // must exist for the lifetime of the task, so in this case is declared static.  If it was just an\r
         // an automatic stack variable it might no longer exist, or at least have been corrupted, by the time\r
         // the new task attempts to access it.\r
         xTaskCreate( vTaskCode, "NAME", STACK_SIZE, &ucParameterToPass, tskIDLE_PRIORITY, &xHandle );\r
+     configASSERT( xHandle );\r
 \r
         // Use the handle to delete the task.\r
-        vTaskDelete( xHandle );\r
+     if( xHandle != NULL )\r
+     {\r
+            vTaskDelete( xHandle );\r
+     }\r
  }\r
    </pre>\r
  * \defgroup xTaskCreate xTaskCreate\r
@@ -330,7 +341,7 @@ typedef enum
  * can be referenced.\r
  *\r
  * @return pdPASS if the task was successfully created and added to a ready\r
- * list, otherwise an error code defined in the file errors. h\r
+ * list, otherwise an error code defined in the file projdefs.h\r
  *\r
  * Example usage:\r
    <pre>\r
@@ -369,7 +380,7 @@ xTaskHandle xHandle;
        vTaskStartScheduler();\r
 \r
        // Will only get here if there was insufficient memory to create the idle\r
-       // task.\r
+       // and/or timer task.\r
        for( ;; );\r
 }\r
    </pre>\r
@@ -433,7 +444,7 @@ void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxR
  * INCLUDE_vTaskDelete must be defined as 1 for this function to be available.\r
  * See the configuration section for more information.\r
  *\r
- * Remove a task from the RTOS real time kernels management.  The task being\r
+ * Remove a task from the RTOS real time kernel's management.  The task being\r
  * deleted will be removed from all ready, blocked, suspended and event lists.\r
  *\r
  * NOTE:  The idle task is responsible for freeing the kernel allocated\r
@@ -473,7 +484,7 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;
 \r
 /**\r
  * task. h\r
- * <pre>void vTaskDelay( portTickType xTicksToDelay );</pre>\r
+ * <pre>void vTaskDelay( const portTickType xTicksToDelay );</pre>\r
  *\r
  * Delay a task for a given number of ticks.  The actual time that the\r
  * task remains blocked depends on the tick rate.  The constant\r
@@ -488,7 +499,7 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;
  * the time at which vTaskDelay() is called.  For example, specifying a block\r
  * period of 100 ticks will cause the task to unblock 100 ticks after\r
  * vTaskDelay() is called.  vTaskDelay() does not therefore provide a good method\r
- * of controlling the frequency of a cyclical task as the path taken through the\r
+ * of controlling the frequency of a periodic task as the path taken through the\r
  * code, as well as other task and interrupt activity, will effect the frequency\r
  * at which vTaskDelay() gets called and therefore the time at which the task\r
  * next executes.  See vTaskDelayUntil() for an alternative API function designed\r
@@ -501,8 +512,6 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;
  *\r
  * Example usage:\r
 \r
- void vTaskFunction( void * pvParameters )\r
- {\r
  void vTaskFunction( void * pvParameters )\r
  {\r
  // Block for 500ms.\r
@@ -519,16 +528,16 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;
  * \defgroup vTaskDelay vTaskDelay\r
  * \ingroup TaskCtrl\r
  */\r
-void vTaskDelay( portTickType xTicksToDelay ) PRIVILEGED_FUNCTION;\r
+void vTaskDelay( const portTickType xTicksToDelay ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <pre>void vTaskDelayUntil( portTickType *pxPreviousWakeTime, portTickType xTimeIncrement );</pre>\r
+ * <pre>void vTaskDelayUntil( portTickType *pxPreviousWakeTime, const portTickType xTimeIncrement );</pre>\r
  *\r
  * INCLUDE_vTaskDelayUntil must be defined as 1 for this function to be available.\r
  * See the configuration section for more information.\r
  *\r
- * Delay a task until a specified time.  This function can be used by cyclical\r
+ * Delay a task until a specified time.  This function can be used by periodic\r
  * tasks to ensure a constant execution frequency.\r
  *\r
  * This function differs from vTaskDelay () in one important aspect:  vTaskDelay () will\r
@@ -578,13 +587,13 @@ void vTaskDelay( portTickType xTicksToDelay ) PRIVILEGED_FUNCTION;
  * \defgroup vTaskDelayUntil vTaskDelayUntil\r
  * \ingroup TaskCtrl\r
  */\r
-void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement ) PRIVILEGED_FUNCTION;\r
+void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickType xTimeIncrement ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
  * <pre>unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask );</pre>\r
  *\r
- * INCLUDE_xTaskPriorityGet must be defined as 1 for this function to be available.\r
+ * INCLUDE_uxTaskPriorityGet must be defined as 1 for this function to be available.\r
  * See the configuration section for more information.\r
  *\r
  * Obtain the priority of any task.\r
@@ -747,7 +756,7 @@ void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION;
  *\r
  * Resumes a suspended task.\r
  *\r
- * A task that has been suspended by one of more calls to vTaskSuspend ()\r
+ * A task that has been suspended by one or more calls to vTaskSuspend ()\r
  * will be made available for running again by a single call to\r
  * vTaskResume ().\r
  *\r
@@ -779,7 +788,7 @@ void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION;
         vTaskResume( xHandle );\r
 \r
         // The created task will once again get microcontroller processing\r
-        // time in accordance with it priority within the system.\r
+        // time in accordance with its priority within the system.\r
  }\r
    </pre>\r
  * \defgroup vTaskResume vTaskResume\r
@@ -796,12 +805,21 @@ void vTaskResume( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTION;
  *\r
  * An implementation of vTaskResume() that can be called from within an ISR.\r
  *\r
- * A task that has been suspended by one of more calls to vTaskSuspend ()\r
+ * A task that has been suspended by one or more calls to vTaskSuspend ()\r
  * will be made available for running again by a single call to\r
  * xTaskResumeFromISR ().\r
  *\r
+ * xTaskResumeFromISR() should not be used to synchronise a task with an\r
+ * interrupt if there is a chance that the interrupt could arrive prior to the\r
+ * task being suspended - as this can lead to interrupts being missed. Use of a\r
+ * semaphore as a synchronisation mechanism would avoid this eventuality.\r
+ *\r
  * @param xTaskToResume Handle to the task being readied.\r
  *\r
+ * @return pdTRUE if resuming the task should result in a context switch,\r
+ * otherwise pdFALSE. This is used by the ISR to determine if a context switch\r
+ * may be required following the ISR.\r
+ *\r
  * \defgroup vTaskResumeFromISR vTaskResumeFromISR\r
  * \ingroup TaskCtrl\r
  */\r
@@ -816,12 +834,7 @@ portBASE_TYPE xTaskResumeFromISR( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTIO
  * <pre>void vTaskStartScheduler( void );</pre>\r
  *\r
  * Starts the real time kernel tick processing.  After calling the kernel\r
- * has control over which tasks are executed and when.  This function\r
- * does not return until an executing task calls vTaskEndScheduler ().\r
- *\r
- * At least one task should be created via a call to xTaskCreate ()\r
- * before calling vTaskStartScheduler ().  The idle task is created\r
- * automatically when the first application task is created.\r
+ * has control over which tasks are executed and when.\r
  *\r
  * See the demo application file main.c for an example of creating\r
  * tasks and starting the kernel.\r
@@ -849,6 +862,9 @@ void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION;
  * task. h\r
  * <pre>void vTaskEndScheduler( void );</pre>\r
  *\r
+ * NOTE:  At the time of writing only the x86 real mode port, which runs on a PC\r
+ * in place of DOS, implements this function.\r
+ *\r
  * Stops the real time kernel tick.  All created tasks will be automatically\r
  * deleted and multitasking (either preemptive or cooperative) will\r
  * stop.  Execution then resumes from the point where vTaskStartScheduler ()\r
@@ -902,8 +918,8 @@ void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION;
  * task. h\r
  * <pre>void vTaskSuspendAll( void );</pre>\r
  *\r
- * Suspends all real time kernel activity while keeping interrupts (including the\r
- * kernel tick) enabled.\r
+ * Suspends the scheduler without disabling interrupts.  Context switches will\r
+ * not occur while the scheduler is suspended.\r
  *\r
  * After calling vTaskSuspendAll () the calling task will continue to execute\r
  * without risk of being swapped out until a call to xTaskResumeAll () has been\r
@@ -953,9 +969,11 @@ void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION;
  * task. h\r
  * <pre>char xTaskResumeAll( void );</pre>\r
  *\r
- * Resumes real time kernel activity following a call to vTaskSuspendAll ().\r
- * After a call to vTaskSuspendAll () the kernel will take control of which\r
- * task is executing at any time.\r
+ * Resumes scheduler activity after it was suspended by a call to\r
+ * vTaskSuspendAll().\r
+ *\r
+ * xTaskResumeAll() only resumes the scheduler.  It does not unsuspend tasks\r
+ * that were previously suspended by a call to vTaskSuspend().\r
  *\r
  * @return If resuming the scheduler caused a context switch then pdTRUE is\r
  *               returned, otherwise pdFALSE is returned.\r
@@ -1003,14 +1021,14 @@ signed portBASE_TYPE xTaskResumeAll( void ) PRIVILEGED_FUNCTION;
 \r
 /**\r
  * task. h\r
- * <pre>signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask );</pre>\r
+ * <pre>signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask );</pre>\r
  *\r
  * Utility task that simply returns pdTRUE if the task referenced by xTask is\r
  * currently in the Suspended state, or pdFALSE if the task referenced by xTask\r
  * is in any other state.\r
  *\r
  */\r
-signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) PRIVILEGED_FUNCTION;\r
+signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask ) PRIVILEGED_FUNCTION;\r
 \r
 /*-----------------------------------------------------------\r
  * TASK UTILITIES\r
@@ -1022,7 +1040,7 @@ signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) PRIVILEGED_FUNCTI
  *\r
  * @return The count of ticks since vTaskStartScheduler was called.\r
  *\r
- * \page xTaskGetTickCount xTaskGetTickCount\r
+ * \defgroup xTaskGetTickCount xTaskGetTickCount\r
  * \ingroup TaskUtils\r
  */\r
 portTickType xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;\r
@@ -1038,7 +1056,7 @@ portTickType xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;
  * microcontroller being used or interrupt nesting is either not supported or\r
  * not being used.\r
  *\r
- * \page xTaskGetTickCount xTaskGetTickCount\r
+ * \defgroup xTaskGetTickCountFromISR xTaskGetTickCountFromISR\r
  * \ingroup TaskUtils\r
  */\r
 portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;\r
@@ -1052,7 +1070,7 @@ portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;
  * has been deleted but not yet freed by the idle task will also be\r
  * included in the count.\r
  *\r
- * \page uxTaskGetNumberOfTasks uxTaskGetNumberOfTasks\r
+ * \defgroup uxTaskGetNumberOfTasks uxTaskGetNumberOfTasks\r
  * \ingroup TaskUtils\r
  */\r
 unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;\r
@@ -1062,73 +1080,15 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;
  * <PRE>signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );</PRE>\r
  *\r
  * @return The text (human readable) name of the task referenced by the handle\r
- * xTaskToQueury.  A task can query its own name by either passing in its own\r
+ * xTaskToQuery.  A task can query its own name by either passing in its own\r
  * handle, or by setting xTaskToQuery to NULL.  INCLUDE_pcTaskGetTaskName must be\r
  * set to 1 in FreeRTOSConfig.h for pcTaskGetTaskName() to be available.\r
  *\r
- * \page pcTaskGetTaskName pcTaskGetTaskName\r
+ * \defgroup pcTaskGetTaskName pcTaskGetTaskName\r
  * \ingroup TaskUtils\r
  */\r
 signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );\r
 \r
-/**\r
- * task. h\r
- * <PRE>void vTaskList( char *pcWriteBuffer );</PRE>\r
- *\r
- * configUSE_TRACE_FACILITY must be defined as 1 for this function to be\r
- * available.  See the configuration section for more information.\r
- *\r
- * NOTE: This function will disable interrupts for its duration.  It is\r
- * not intended for normal application runtime use but as a debug aid.\r
- *\r
- * Lists all the current tasks, along with their current state and stack\r
- * usage high water mark.\r
- *\r
- * Tasks are reported as blocked ('B'), ready ('R'), deleted ('D') or\r
- * suspended ('S').\r
- *\r
- * @param pcWriteBuffer A buffer into which the above mentioned details\r
- * will be written, in ascii form.  This buffer is assumed to be large\r
- * enough to contain the generated report.  Approximately 40 bytes per\r
- * task should be sufficient.\r
- *\r
- * \page vTaskList vTaskList\r
- * \ingroup TaskUtils\r
- */\r
-void vTaskList( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;\r
-\r
-/**\r
- * task. h\r
- * <PRE>void vTaskGetRunTimeStats( char *pcWriteBuffer );</PRE>\r
- *\r
- * configGENERATE_RUN_TIME_STATS must be defined as 1 for this function\r
- * to be available.  The application must also then provide definitions\r
- * for portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and\r
- * portGET_RUN_TIME_COUNTER_VALUE to configure a peripheral timer/counter\r
- * and return the timers current count value respectively.  The counter\r
- * should be at least 10 times the frequency of the tick count.\r
- *\r
- * NOTE: This function will disable interrupts for its duration.  It is\r
- * not intended for normal application runtime use but as a debug aid.\r
- *\r
- * Setting configGENERATE_RUN_TIME_STATS to 1 will result in a total\r
- * accumulated execution time being stored for each task.  The resolution\r
- * of the accumulated time value depends on the frequency of the timer\r
- * configured by the portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() macro.\r
- * Calling vTaskGetRunTimeStats() writes the total execution time of each\r
- * task into a buffer, both as an absolute count value and as a percentage\r
- * of the total system execution time.\r
- *\r
- * @param pcWriteBuffer A buffer into which the execution times will be\r
- * written, in ascii form.  This buffer is assumed to be large enough to\r
- * contain the generated report.  Approximately 40 bytes per task should\r
- * be sufficient.\r
- *\r
- * \page vTaskGetRunTimeStats vTaskGetRunTimeStats\r
- * \ingroup TaskUtils\r
- */\r
-void vTaskGetRunTimeStats( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;\r
-\r
 /**\r
  * task.h\r
  * <PRE>unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask );</PRE>\r
@@ -1144,12 +1104,13 @@ void vTaskGetRunTimeStats( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;
  * @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 bytes)\r
- * since the task referenced by xTask was created.\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
 unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask ) PRIVILEGED_FUNCTION;\r
 \r
-/* When using trace macros it is sometimes necessary to include tasks.h before\r
+/* When using trace macros it is sometimes necessary to include task.h before\r
 FreeRTOS.h.  When this is done pdTASK_HOOK_CODE 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
@@ -1179,13 +1140,14 @@ constant. */
 \r
 /**\r
  * task.h\r
- * <pre>portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );</pre>\r
+ * <pre>portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle 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.\r
+ * wants.  The return value is the value returned by the task hook function\r
+ * registered by the user.\r
  */\r
 portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) PRIVILEGED_FUNCTION;\r
 \r
@@ -1198,6 +1160,206 @@ portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter
  */\r
 xTaskHandle 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 xTaskStatusType structure for each task in\r
+ * the system.  xTaskStatusType 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 xTaskStatusType 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 xTaskStatusType structures.\r
+ * The array must contain at least one xTaskStatusType 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 xTaskStatusType 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 xTaskStatusType 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( signed char *pcWriteBuffer )\r
+       {\r
+       xTaskStatusType *pxTaskStatusArray;\r
+       volatile unsigned portBASE_TYPE uxArraySize, x;\r
+       unsigned long 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 xTaskStatusType structure for each task.  An array could be\r
+               // allocated statically at compile time.\r
+               pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( xTaskStatusType ) );\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( ( char * ) pcWriteBuffer, ( char * ) "%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( ( char * ) pcWriteBuffer, ( char * ) "%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
+unsigned portBASE_TYPE uxTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime );\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>void vTaskList( char *pcWriteBuffer );</PRE>\r
+ *\r
+ * configUSE_TRACE_FACILITY and configUSE_STATS_FORMATTING_FUNCTIONS must\r
+ * both be defined as 1 for this function to be available.  See the\r
+ * configuration section of the FreeRTOS.org website for more information.\r
+ *\r
+ * NOTE 1: This function will disable interrupts for its duration.  It is\r
+ * not intended for normal application runtime use but as a debug aid.\r
+ *\r
+ * Lists all the current tasks, along with their current state and stack\r
+ * usage high water mark.\r
+ *\r
+ * Tasks are reported as blocked ('B'), ready ('R'), deleted ('D') or\r
+ * suspended ('S').\r
+ *\r
+ * PLEASE NOTE:\r
+ *\r
+ * This function is provided for convenience only, and is used by many of the\r
+ * demo applications.  Do not consider it to be part of the scheduler.\r
+ *\r
+ * vTaskList() calls uxTaskGetSystemState(), then formats part of the\r
+ * uxTaskGetSystemState() output into a human readable table that displays task\r
+ * names, states and stack usage.\r
+ *\r
+ * vTaskList() has a dependency on the sprintf() C library function that might\r
+ * bloat the code size, use a lot of stack, and provide different results on\r
+ * different platforms.  An alternative, tiny, third party, and limited\r
+ * functionality implementation of sprintf() is provided in many of the\r
+ * FreeRTOS/Demo sub-directories in a file called printf-stdarg.c (note\r
+ * printf-stdarg.c does not provide a full snprintf() implementation!).\r
+ *\r
+ * It is recommended that production systems call uxTaskGetSystemState()\r
+ * directly to get access to raw stats data, rather than indirectly through a\r
+ * call to vTaskList().\r
+ *\r
+ * @param pcWriteBuffer A buffer into which the above mentioned details\r
+ * will be written, in ASCII form.  This buffer is assumed to be large\r
+ * enough to contain the generated report.  Approximately 40 bytes per\r
+ * task should be sufficient.\r
+ *\r
+ * \defgroup vTaskList vTaskList\r
+ * \ingroup TaskUtils\r
+ */\r
+void vTaskList( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>void vTaskGetRunTimeStats( char *pcWriteBuffer );</PRE>\r
+ *\r
+ * configGENERATE_RUN_TIME_STATS and configUSE_STATS_FORMATTING_FUNCTIONS\r
+ * must both be defined as 1 for this function to be available.  The application\r
+ * must also then provide definitions for\r
+ * portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and portGET_RUN_TIME_COUNTER_VALUE()\r
+ * to configure a peripheral timer/counter and return the timers current count\r
+ * value respectively.  The counter should be at least 10 times the frequency of\r
+ * the tick count.\r
+ *\r
+ * NOTE 1: This function will disable interrupts for its duration.  It is\r
+ * not intended for normal application runtime use but as a debug aid.\r
+ *\r
+ * Setting configGENERATE_RUN_TIME_STATS to 1 will result in a total\r
+ * accumulated execution time being stored for each task.  The resolution\r
+ * of the accumulated time value depends on the frequency of the timer\r
+ * configured by the portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() macro.\r
+ * Calling vTaskGetRunTimeStats() writes the total execution time of each\r
+ * task into a buffer, both as an absolute count value and as a percentage\r
+ * of the total system execution time.\r
+ *\r
+ * NOTE 2:\r
+ *\r
+ * This function is provided for convenience only, and is used by many of the\r
+ * demo applications.  Do not consider it to be part of the scheduler.\r
+ *\r
+ * vTaskGetRunTimeStats() calls uxTaskGetSystemState(), then formats part of the\r
+ * uxTaskGetSystemState() output into a human readable table that displays the\r
+ * amount of time each task has spent in the Running state in both absolute and\r
+ * percentage terms.\r
+ *\r
+ * vTaskGetRunTimeStats() has a dependency on the sprintf() C library function\r
+ * that might bloat the code size, use a lot of stack, and provide different\r
+ * results on different platforms.  An alternative, tiny, third party, and\r
+ * limited functionality implementation of sprintf() is provided in many of the\r
+ * FreeRTOS/Demo sub-directories in a file called printf-stdarg.c (note\r
+ * printf-stdarg.c does not provide a full snprintf() implementation!).\r
+ *\r
+ * It is recommended that production systems call uxTaskGetSystemState() directly\r
+ * to get access to raw stats data, rather than indirectly through a call to\r
+ * vTaskGetRunTimeStats().\r
+ *\r
+ * @param pcWriteBuffer A buffer into which the execution times will be\r
+ * written, in ASCII form.  This buffer is assumed to be large enough to\r
+ * contain the generated report.  Approximately 40 bytes per task should\r
+ * be sufficient.\r
+ *\r
+ * \defgroup vTaskGetRunTimeStats vTaskGetRunTimeStats\r
+ * \ingroup TaskUtils\r
+ */\r
+void vTaskGetRunTimeStats( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;\r
+\r
 /*-----------------------------------------------------------\r
  * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES\r
  *----------------------------------------------------------*/\r
@@ -1210,9 +1372,14 @@ xTaskHandle xTaskGetIdleTaskHandle( void );
  * Called from the real time kernel tick (either preemptive or cooperative),\r
  * this increments the tick count and checks if any tasks that are blocked\r
  * for a finite period required removing from a blocked list and placing on\r
- * a ready list.\r
+ * a ready list.  If a non-zero value is returned then a context switch is\r
+ * required because either:\r
+ *   + A task was removed from a blocked list because its timeout had expired,\r
+ *     or\r
+ *   + Time slicing is in use and there is a task of equal priority to the\r
+ *     currently running task.\r
  */\r
-void vTaskIncrementTick( void ) PRIVILEGED_FUNCTION;\r
+portBASE_TYPE xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS AN\r
@@ -1227,15 +1394,26 @@ void vTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
  * there be no higher priority tasks waiting on the same event) or\r
  * the delay period expires.\r
  *\r
+ * The 'unordered' version replaces the event list item value with the\r
+ * xItemValue value, and inserts the list item at the end of the list.\r
+ *\r
+ * The 'ordered' version uses the existing event list item value (which is the\r
+ * owning tasks priority) to insert the list item into the event list is task\r
+ * priority order.\r
+ *\r
  * @param pxEventList The list containing tasks that are blocked waiting\r
  * for the event to occur.\r
  *\r
+ * @param xItemValue The item value to use for the event list item when the\r
+ * event list is not ordered by task priority.\r
+ *\r
  * @param xTicksToWait The maximum amount of time that the task should wait\r
  * for the event to occur.  This is specified in kernel ticks,the constant\r
  * portTICK_RATE_MS can be used to convert kernel ticks into a real time\r
  * period.\r
  */\r
-void vTaskPlaceOnEventList( const xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
+void vTaskPlaceOnEventList( xList * const pxEventList, const portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
+void vTaskPlaceOnUnorderedEventList( xList * pxEventList, portTickType xItemValue, const portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS AN\r
@@ -1247,10 +1425,8 @@ void vTaskPlaceOnEventList( const xList * const pxEventList, portTickType xTicks
  * The difference being that this function does not permit tasks to block\r
  * indefinitely, whereas vTaskPlaceOnEventList() does.\r
  *\r
- * @return pdTRUE if the task being removed has a higher priority than the task\r
- * making the call, otherwise pdFALSE.\r
  */\r
-void vTaskPlaceOnEventListRestricted( const xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
+void vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS AN\r
@@ -1261,13 +1437,23 @@ void vTaskPlaceOnEventListRestricted( const xList * const pxEventList, portTickT
  * Removes a task from both the specified event list and the list of blocked\r
  * tasks, and places it on a ready queue.\r
  *\r
- * xTaskRemoveFromEventList () will be called if either an event occurs to\r
- * unblock a task, or the block timeout period expires.\r
+ * xTaskRemoveFromEventList()/xTaskRemoveFromUnorderedEventList() will be called\r
+ * if either an event occurs to unblock a task, or the block timeout period\r
+ * expires.\r
+ *\r
+ * xTaskRemoveFromEventList() is used when the event list is in task priority\r
+ * order.  It removes the list item from the head of the event list as that will\r
+ * have the highest priority owning task of all the tasks on the event list.\r
+ * xTaskRemoveFromUnorderedEventList() is used when the event list is not\r
+ * ordered and the event list items hold something other than the owning tasks\r
+ * priority.  In this case the event list item value is updated to the value\r
+ * passed in the xItemValue parameter.\r
  *\r
  * @return pdTRUE if the task being removed has a higher priority than the task\r
  * making the call, otherwise pdFALSE.\r
  */\r
 signed portBASE_TYPE xTaskRemoveFromEventList( const xList * const pxEventList ) PRIVILEGED_FUNCTION;\r
+signed portBASE_TYPE xTaskRemoveFromUnorderedEventList( xListItem * pxEventListItem, portTickType xItemValue ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS ONLY\r
@@ -1279,6 +1465,12 @@ signed portBASE_TYPE xTaskRemoveFromEventList( const xList * const pxEventList )
  */\r
 void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION;\r
 \r
+/*\r
+ * THESE FUNCTIONS MUST NOT BE USED FROM APPLICATION CODE.  THEY ARE USED BY\r
+ * THE EVENT BITS MODULE.\r
+ */\r
+portTickType uxTaskResetEventItemValue( void ) PRIVILEGED_FUNCTION;\r
+\r
 /*\r
  * Return the handle of the calling task.\r
  */\r
@@ -1311,13 +1503,13 @@ portBASE_TYPE xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION;
  * Raises the priority of the mutex holder to that of the calling task should\r
  * the mutex holder have a priority less than the calling task.\r
  */\r
-void vTaskPriorityInherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;\r
+void vTaskPriorityInherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * Set the priority of a task back to its proper priority in the case that it\r
  * inherited a higher priority while it was holding a semaphore.\r
  */\r
-void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;\r
+void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * Generic version of the task creation function which is in turn called by the\r
@@ -1328,24 +1520,26 @@ signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed ch
 /*\r
  * Get the uxTCBNumber assigned to the task referenced by the xTask parameter.\r
  */\r
-unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );\r
+unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
- * Set the uxTCBNumber of the task referenced by the xTask parameter to\r
- * ucHandle.\r
+ * Set the uxTaskNumber of the task referenced by the xTask parameter to\r
+ * uxHandle.\r
  */\r
-void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle );\r
+void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
+ * Only available when configUSE_TICKLESS_IDLE is set to 1.\r
  * If tickless mode is being used, or a low power mode is implemented, then\r
  * the tick interrupt will not execute during idle periods.  When this is the\r
  * case, the tick count value maintained by the scheduler needs to be kept up\r
- * to date with the actual execution time by being skipped forward by the by\r
- * a time equal to the idle period.\r
+ * to date with the actual execution time by being skipped forward by a time\r
+ * equal to the idle period.\r
  */\r
-void vTaskStepTick( portTickType xTicksToJump );\r
+void vTaskStepTick( portTickType xTicksToJump ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
+ * Only avilable when configUSE_TICKLESS_IDLE is set to 1.\r
  * Provided for use within portSUPPRESS_TICKS_AND_SLEEP() to allow the port\r
  * specific sleep function to determine if it is ok to proceed with the sleep,\r
  * and if it is ok to proceed, if it is ok to sleep indefinitely.\r
@@ -1358,12 +1552,12 @@ void vTaskStepTick( portTickType xTicksToJump );
  * critical section between the timer being stopped and the sleep mode being\r
  * entered to ensure it is ok to proceed into the sleep mode.\r
  */\r
-eSleepModeStatus eTaskConfirmSleepModeStatus( void );\r
+eSleepModeStatus eTaskConfirmSleepModeStatus( void ) PRIVILEGED_FUNCTION;\r
 \r
 #ifdef __cplusplus\r
 }\r
 #endif\r
-#endif /* TASK_H */\r
+#endif /* INC_TASK_H */\r
 \r
 \r
 \r