]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/include/task.h
Added xTaskAbortDelayFromISR() and ulTaskNotifyValueClear() API functions.
[freertos] / FreeRTOS / Source / include / task.h
index ee74210683d1ee347413372844b1d0d37c9dc7d1..40e1e533ddf8a7ff3e7be2ac3a0dcb8bfa35d4a5 100644 (file)
@@ -1,66 +1,29 @@
 /*\r
-    FreeRTOS V7.5.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
-\r
-    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
-\r
-    ***************************************************************************\r
-     *                                                                       *\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
-     *    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
-     *    Thank you!                                                         *\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
-\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.  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
-     *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?"                                     *\r
-     *                                                                       *\r
-     *    http://www.FreeRTOS.org/FAQHelp.html                               *\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, 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 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
-    mission critical applications that require provable dependability.\r
-\r
-    1 tab == 4 spaces!\r
-*/\r
+ * FreeRTOS Kernel V10.2.1\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\r
+ */\r
 \r
 \r
 #ifndef INC_TASK_H\r
@@ -80,19 +43,37 @@ extern "C" {
  * MACROS AND DEFINITIONS\r
  *----------------------------------------------------------*/\r
 \r
-#define tskKERNEL_VERSION_NUMBER "V7.5.0"\r
+#define tskKERNEL_VERSION_NUMBER "V10.2.1"\r
+#define tskKERNEL_VERSION_MAJOR 10\r
+#define tskKERNEL_VERSION_MINOR 2\r
+#define tskKERNEL_VERSION_BUILD 1\r
+\r
+/* MPU region parameters passed in ulParameters\r
+ * of MemoryRegion_t struct. */\r
+#define tskMPU_REGION_READ_ONLY                        ( 1UL << 0UL )\r
+#define tskMPU_REGION_READ_WRITE               ( 1UL << 1UL )\r
+#define tskMPU_REGION_EXECUTE_NEVER            ( 1UL << 2UL )\r
+#define tskMPU_REGION_NORMAL_MEMORY            ( 1UL << 3UL )\r
+#define tskMPU_REGION_DEVICE_MEMORY            ( 1UL << 4UL )\r
 \r
 /**\r
  * task. h\r
  *\r
  * Type by which tasks are referenced.  For example, a call to xTaskCreate\r
- * returns (via a pointer parameter) an xTaskHandle variable that can then\r
+ * returns (via a pointer parameter) an TaskHandle_t variable that can then\r
  * be used as a parameter to vTaskDelete to delete the task.\r
  *\r
- * \defgroup xTaskHandle xTaskHandle\r
+ * \defgroup TaskHandle_t TaskHandle_t\r
  * \ingroup Tasks\r
  */\r
-typedef void * xTaskHandle;\r
+struct tskTaskControlBlock; /* The old naming convention is used to prevent breaking kernel aware debuggers. */\r
+typedef struct tskTaskControlBlock* TaskHandle_t;\r
+\r
+/*\r
+ * Defines the prototype to which the application task hook function must\r
+ * conform.\r
+ */\r
+typedef BaseType_t (*TaskHookFunction_t)( void * );\r
 \r
 /* Task states returned by eTaskGetState. */\r
 typedef enum\r
@@ -101,17 +82,28 @@ typedef enum
        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
+       eDeleted,               /* The task being queried has been deleted, but its TCB has not yet been freed. */\r
+       eInvalid                /* Used as an 'invalid state' value. */\r
 } eTaskState;\r
 \r
+/* Actions that can be performed when vTaskNotify() is called. */\r
+typedef enum\r
+{\r
+       eNoAction = 0,                          /* Notify the task without updating its notify value. */\r
+       eSetBits,                                       /* Set bits in the task's notification value. */\r
+       eIncrement,                                     /* Increment the task's notification value. */\r
+       eSetValueWithOverwrite,         /* Set the task's notification value to a specific value even if the previous value has not yet been read by the task. */\r
+       eSetValueWithoutOverwrite       /* Set the task's notification value if the previous value has been read by the task. */\r
+} eNotifyAction;\r
+\r
 /*\r
  * Used internally only.\r
  */\r
 typedef struct xTIME_OUT\r
 {\r
-       portBASE_TYPE xOverflowCount;\r
-       portTickType  xTimeOnEntering;\r
-} xTimeOutType;\r
+       BaseType_t xOverflowCount;\r
+       TickType_t xTimeOnEntering;\r
+} TimeOut_t;\r
 \r
 /*\r
  * Defines the memory ranges allocated to the task when an MPU is used.\r
@@ -119,37 +111,41 @@ typedef struct xTIME_OUT
 typedef struct xMEMORY_REGION\r
 {\r
        void *pvBaseAddress;\r
-       unsigned long ulLengthInBytes;\r
-       unsigned long ulParameters;\r
-} xMemoryRegion;\r
+       uint32_t ulLengthInBytes;\r
+       uint32_t ulParameters;\r
+} MemoryRegion_t;\r
 \r
 /*\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
-       unsigned short usStackDepth;\r
+       TaskFunction_t pvTaskCode;\r
+       const char * const pcName;      /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+       configSTACK_DEPTH_TYPE usStackDepth;\r
        void *pvParameters;\r
-       unsigned portBASE_TYPE uxPriority;\r
-       portSTACK_TYPE *puxStackBuffer;\r
-       xMemoryRegion xRegions[ portNUM_CONFIGURABLE_REGIONS ];\r
-} xTaskParameters;\r
-\r
-/* Used with the xTaskGetSystemState() function to return the state of each task\r
+       UBaseType_t uxPriority;\r
+       StackType_t *puxStackBuffer;\r
+       MemoryRegion_t xRegions[ portNUM_CONFIGURABLE_REGIONS ];\r
+       #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )\r
+               StaticTask_t * const pxTaskBuffer;\r
+       #endif\r
+} TaskParameters_t;\r
+\r
+/* Used with the uxTaskGetSystemState() function to return the state of each task\r
 in the system. */\r
 typedef struct xTASK_STATUS\r
 {\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 valid 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 is 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
+       TaskHandle_t xHandle;                   /* The handle of the task to which the rest of the information in the structure relates. */\r
+       const char *pcTaskName;                 /* A pointer to the task's name.  This value will be invalid if the task was deleted since the structure was populated! */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+       UBaseType_t xTaskNumber;                /* A number unique to the task. */\r
+       eTaskState eCurrentState;               /* The state in which the task existed when the structure was populated. */\r
+       UBaseType_t uxCurrentPriority;  /* The priority at which the task was running (may be inherited) when the structure was populated. */\r
+       UBaseType_t 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
+       uint32_t 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
+       StackType_t *pxStackBase;               /* Points to the lowest address of the task's stack area. */\r
+       configSTACK_DEPTH_TYPE 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
+} TaskStatus_t;\r
 \r
 /* Possible return values for eTaskConfirmSleepModeStatus(). */\r
 typedef enum\r
@@ -159,13 +155,12 @@ typedef enum
        eNoTasksWaitingTimeout  /* No tasks are waiting for a timeout so it is safe to enter a sleep mode that can only be exited by an external interrupt. */\r
 } eSleepModeStatus;\r
 \r
-\r
-/*\r
+/**\r
  * Defines the priority used by the idle task.  This must not be modified.\r
  *\r
  * \ingroup TaskUtils\r
  */\r
-#define tskIDLE_PRIORITY                       ( ( unsigned portBASE_TYPE ) 0U )\r
+#define tskIDLE_PRIORITY                       ( ( UBaseType_t ) 0U )\r
 \r
 /**\r
  * task. h\r
@@ -190,6 +185,7 @@ typedef enum
  * \ingroup SchedulerControl\r
  */\r
 #define taskENTER_CRITICAL()           portENTER_CRITICAL()\r
+#define taskENTER_CRITICAL_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()\r
 \r
 /**\r
  * task. h\r
@@ -204,7 +200,7 @@ typedef enum
  * \ingroup SchedulerControl\r
  */\r
 #define taskEXIT_CRITICAL()                    portEXIT_CRITICAL()\r
-\r
+#define taskEXIT_CRITICAL_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( x )\r
 /**\r
  * task. h\r
  *\r
@@ -225,10 +221,13 @@ typedef enum
  */\r
 #define taskENABLE_INTERRUPTS()                portENABLE_INTERRUPTS()\r
 \r
-/* Definitions returned by xTaskGetSchedulerState(). */\r
-#define taskSCHEDULER_NOT_STARTED      ( ( portBASE_TYPE ) 0 )\r
-#define taskSCHEDULER_RUNNING          ( ( portBASE_TYPE ) 1 )\r
-#define taskSCHEDULER_SUSPENDED                ( ( portBASE_TYPE ) 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                ( ( BaseType_t ) 0 )\r
+#define taskSCHEDULER_NOT_STARTED      ( ( BaseType_t ) 1 )\r
+#define taskSCHEDULER_RUNNING          ( ( BaseType_t ) 2 )\r
+\r
 \r
 /*-----------------------------------------------------------\r
  * TASK CREATION API\r
@@ -237,17 +236,30 @@ typedef enum
 /**\r
  * task. h\r
  *<pre>\r
portBASE_TYPE xTaskCreate(\r
-                                                         pdTASK_CODE pvTaskCode,\r
BaseType_t xTaskCreate(\r
+                                                         TaskFunction_t pvTaskCode,\r
                                                          const char * const pcName,\r
-                                                         unsigned short usStackDepth,\r
+                                                         configSTACK_DEPTH_TYPE usStackDepth,\r
                                                          void *pvParameters,\r
-                                                         unsigned portBASE_TYPE uxPriority,\r
-                                                         xTaskHandle *pvCreatedTask\r
+                                                         UBaseType_t uxPriority,\r
+                                                         TaskHandle_t *pvCreatedTask\r
                                                  );</pre>\r
  *\r
  * Create a new task and add it to the list of tasks that are ready to run.\r
  *\r
+ * Internally, within the FreeRTOS implementation, tasks use two blocks of\r
+ * memory.  The first block is used to hold the task's data structures.  The\r
+ * second block is used by the task as its stack.  If a task is created using\r
+ * xTaskCreate() then both blocks of memory are automatically dynamically\r
+ * allocated inside the xTaskCreate() function.  (see\r
+ * http://www.freertos.org/a00111.html).  If a task is created using\r
+ * xTaskCreateStatic() then the application writer must provide the required\r
+ * memory.  xTaskCreateStatic() therefore allows a task to be created without\r
+ * using any dynamic memory allocation.\r
+ *\r
+ * See xTaskCreateStatic() for a version that does not use any dynamic memory\r
+ * allocation.\r
+ *\r
  * xTaskCreate() can only be used to create a task that has unrestricted\r
  * access to the entire microcontroller memory map.  Systems that include MPU\r
  * support can alternatively create an MPU constrained task using\r
@@ -257,7 +269,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
@@ -278,7 +290,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
@@ -294,28 +306,158 @@ typedef enum
  // Function that creates a task.\r
  void vOtherFunction( void )\r
  {\r
- static unsigned char ucParameterToPass;\r
xTaskHandle xHandle;\r
+ static uint8_t ucParameterToPass;\r
TaskHandle_t 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
  * \ingroup Tasks\r
  */\r
-#define xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask ) xTaskGenericCreate( ( pvTaskCode ), ( pcName ), ( usStackDepth ), ( pvParameters ), ( uxPriority ), ( pxCreatedTask ), ( NULL ), ( NULL ) )\r
+#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )\r
+       BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,\r
+                                                       const char * const pcName,      /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+                                                       const configSTACK_DEPTH_TYPE usStackDepth,\r
+                                                       void * const pvParameters,\r
+                                                       UBaseType_t uxPriority,\r
+                                                       TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;\r
+#endif\r
+\r
+/**\r
+ * task. h\r
+ *<pre>\r
+ TaskHandle_t xTaskCreateStatic( TaskFunction_t pvTaskCode,\r
+                                                                const char * const pcName,\r
+                                                                uint32_t ulStackDepth,\r
+                                                                void *pvParameters,\r
+                                                                UBaseType_t uxPriority,\r
+                                                                StackType_t *pxStackBuffer,\r
+                                                                StaticTask_t *pxTaskBuffer );</pre>\r
+ *\r
+ * Create a new task and add it to the list of tasks that are ready to run.\r
+ *\r
+ * Internally, within the FreeRTOS implementation, tasks use two blocks of\r
+ * memory.  The first block is used to hold the task's data structures.  The\r
+ * second block is used by the task as its stack.  If a task is created using\r
+ * xTaskCreate() then both blocks of memory are automatically dynamically\r
+ * allocated inside the xTaskCreate() function.  (see\r
+ * http://www.freertos.org/a00111.html).  If a task is created using\r
+ * xTaskCreateStatic() then the application writer must provide the required\r
+ * memory.  xTaskCreateStatic() therefore allows a task to be created without\r
+ * using any dynamic memory allocation.\r
+ *\r
+ * @param pvTaskCode Pointer to the task entry function.  Tasks\r
+ * 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.  The maximum length of the string is defined by\r
+ * configMAX_TASK_NAME_LEN in FreeRTOSConfig.h.\r
+ *\r
+ * @param ulStackDepth The size of the task stack specified as the number of\r
+ * variables the stack can hold - not the number of bytes.  For example, if\r
+ * the stack is 32-bits wide and ulStackDepth is defined as 100 then 400 bytes\r
+ * will be allocated for stack storage.\r
+ *\r
+ * @param pvParameters Pointer that will be used as the parameter for the task\r
+ * being created.\r
+ *\r
+ * @param uxPriority The priority at which the task will run.\r
+ *\r
+ * @param pxStackBuffer Must point to a StackType_t array that has at least\r
+ * ulStackDepth indexes - the array will then be used as the task's stack,\r
+ * removing the need for the stack to be allocated dynamically.\r
+ *\r
+ * @param pxTaskBuffer Must point to a variable of type StaticTask_t, which will\r
+ * then be used to hold the task's data structures, removing the need for the\r
+ * memory to be allocated dynamically.\r
+ *\r
+ * @return If neither pxStackBuffer or pxTaskBuffer are NULL, then the task will\r
+ * be created and a handle to the created task is returned.  If either\r
+ * pxStackBuffer or pxTaskBuffer are NULL then the task will not be created and\r
+ * NULL is returned.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+\r
+    // Dimensions the buffer that the task being created will use as its stack.\r
+    // NOTE:  This is the number of words the stack will hold, not the number of\r
+    // bytes.  For example, if each stack item is 32-bits, and this is set to 100,\r
+    // then 400 bytes (100 * 32-bits) will be allocated.\r
+    #define STACK_SIZE 200\r
+\r
+    // Structure that will hold the TCB of the task being created.\r
+    StaticTask_t xTaskBuffer;\r
+\r
+    // Buffer that the task being created will use as its stack.  Note this is\r
+    // an array of StackType_t variables.  The size of StackType_t is dependent on\r
+    // the RTOS port.\r
+    StackType_t xStack[ STACK_SIZE ];\r
+\r
+    // Function that implements the task being created.\r
+    void vTaskCode( void * pvParameters )\r
+    {\r
+        // The parameter value is expected to be 1 as 1 is passed in the\r
+        // pvParameters value in the call to xTaskCreateStatic().\r
+        configASSERT( ( uint32_t ) pvParameters == 1UL );\r
+\r
+        for( ;; )\r
+        {\r
+            // Task code goes here.\r
+        }\r
+    }\r
+\r
+    // Function that creates a task.\r
+    void vOtherFunction( void )\r
+    {\r
+        TaskHandle_t xHandle = NULL;\r
+\r
+        // Create the task without using any dynamic memory allocation.\r
+        xHandle = xTaskCreateStatic(\r
+                      vTaskCode,       // Function that implements the task.\r
+                      "NAME",          // Text name for the task.\r
+                      STACK_SIZE,      // Stack size in words, not bytes.\r
+                      ( void * ) 1,    // Parameter passed into the task.\r
+                      tskIDLE_PRIORITY,// Priority at which the task is created.\r
+                      xStack,          // Array to use as the task's stack.\r
+                      &xTaskBuffer );  // Variable to hold the task's data structure.\r
+\r
+        // puxStackBuffer and pxTaskBuffer were not NULL, so the task will have\r
+        // been created, and xHandle will be the task's handle.  Use the handle\r
+        // to suspend the task.\r
+        vTaskSuspend( xHandle );\r
+    }\r
+   </pre>\r
+ * \defgroup xTaskCreateStatic xTaskCreateStatic\r
+ * \ingroup Tasks\r
+ */\r
+#if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+       TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,\r
+                                                                       const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+                                                                       const uint32_t ulStackDepth,\r
+                                                                       void * const pvParameters,\r
+                                                                       UBaseType_t uxPriority,\r
+                                                                       StackType_t * const puxStackBuffer,\r
+                                                                       StaticTask_t * const pxTaskBuffer ) PRIVILEGED_FUNCTION;\r
+#endif /* configSUPPORT_STATIC_ALLOCATION */\r
 \r
 /**\r
  * task. h\r
  *<pre>\r
- portBASE_TYPE xTaskCreateRestricted( xTaskParameters *pxTaskDefinition, xTaskHandle *pxCreatedTask );</pre>\r
+ BaseType_t xTaskCreateRestricted( TaskParameters_t *pxTaskDefinition, TaskHandle_t *pxCreatedTask );</pre>\r
+ *\r
+ * Only available when configSUPPORT_DYNAMIC_ALLOCATION is set to 1.\r
  *\r
  * xTaskCreateRestricted() should only be used in systems that include an MPU\r
  * implementation.\r
@@ -324,6 +466,9 @@ typedef enum
  * The function parameters define the memory regions and associated access\r
  * permissions allocated to the task.\r
  *\r
+ * See xTaskCreateRestrictedStatic() for a version that does not use any\r
+ * dynamic memory allocation.\r
+ *\r
  * @param pxTaskDefinition Pointer to a structure that contains a member\r
  * for each of the normal xTaskCreate() parameters (see the xTaskCreate() API\r
  * documentation) plus an optional stack buffer and the memory region\r
@@ -333,12 +478,12 @@ 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
-// Create an xTaskParameters structure that defines the task to be created.\r
-static const xTaskParameters xCheckTaskParameters =\r
+// Create an TaskParameters_t structure that defines the task to be created.\r
+static const TaskParameters_t xCheckTaskParameters =\r
 {\r
        vATask,         // pvTaskCode - the function that implements the task.\r
        "ATask",        // pcName - just a text name for the task to assist debugging.\r
@@ -353,15 +498,15 @@ static const xTaskParameters xCheckTaskParameters =
        // for full information.\r
        {\r
                // Base address                                 Length  Parameters\r
-        { cReadWriteArray,                             32,             portMPU_REGION_READ_WRITE },\r
-        { cReadOnlyArray,                              32,             portMPU_REGION_READ_ONLY },\r
-        { cPrivilegedOnlyAccessArray,  128,    portMPU_REGION_PRIVILEGED_READ_WRITE }\r
+               { cReadWriteArray,                              32,             portMPU_REGION_READ_WRITE },\r
+               { cReadOnlyArray,                               32,             portMPU_REGION_READ_ONLY },\r
+               { cPrivilegedOnlyAccessArray,   128,    portMPU_REGION_PRIVILEGED_READ_WRITE }\r
        }\r
 };\r
 \r
 int main( void )\r
 {\r
-xTaskHandle xHandle;\r
+TaskHandle_t xHandle;\r
 \r
        // Create a task from the const structure defined above.  The task handle\r
        // is requested (the second parameter is not NULL) but in this case just for\r
@@ -372,19 +517,109 @@ 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
  * \defgroup xTaskCreateRestricted xTaskCreateRestricted\r
  * \ingroup Tasks\r
  */\r
-#define xTaskCreateRestricted( x, pxCreatedTask ) xTaskGenericCreate( ((x)->pvTaskCode), ((x)->pcName), ((x)->usStackDepth), ((x)->pvParameters), ((x)->uxPriority), (pxCreatedTask), ((x)->puxStackBuffer), ((x)->xRegions) )\r
+#if( portUSING_MPU_WRAPPERS == 1 )\r
+       BaseType_t xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask ) PRIVILEGED_FUNCTION;\r
+#endif\r
 \r
 /**\r
  * task. h\r
  *<pre>\r
- void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxRegions );</pre>\r
+ BaseType_t xTaskCreateRestrictedStatic( TaskParameters_t *pxTaskDefinition, TaskHandle_t *pxCreatedTask );</pre>\r
+ *\r
+ * Only available when configSUPPORT_STATIC_ALLOCATION is set to 1.\r
+ *\r
+ * xTaskCreateRestrictedStatic() should only be used in systems that include an\r
+ * MPU implementation.\r
+ *\r
+ * Internally, within the FreeRTOS implementation, tasks use two blocks of\r
+ * memory.  The first block is used to hold the task's data structures.  The\r
+ * second block is used by the task as its stack.  If a task is created using\r
+ * xTaskCreateRestricted() then the stack is provided by the application writer,\r
+ * and the memory used to hold the task's data structure is automatically\r
+ * dynamically allocated inside the xTaskCreateRestricted() function.  If a task\r
+ * is created using xTaskCreateRestrictedStatic() then the application writer\r
+ * must provide the memory used to hold the task's data structures too.\r
+ * xTaskCreateRestrictedStatic() therefore allows a memory protected task to be\r
+ * created without using any dynamic memory allocation.\r
+ *\r
+ * @param pxTaskDefinition Pointer to a structure that contains a member\r
+ * for each of the normal xTaskCreate() parameters (see the xTaskCreate() API\r
+ * documentation) plus an optional stack buffer and the memory region\r
+ * definitions.  If configSUPPORT_STATIC_ALLOCATION is set to 1 the structure\r
+ * contains an additional member, which is used to point to a variable of type\r
+ * StaticTask_t - which is then used to hold the task's data structure.\r
+ *\r
+ * @param pxCreatedTask Used to pass back a handle by which the created task\r
+ * 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 projdefs.h\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+// Create an TaskParameters_t structure that defines the task to be created.\r
+// The StaticTask_t variable is only included in the structure when\r
+// configSUPPORT_STATIC_ALLOCATION is set to 1.  The PRIVILEGED_DATA macro can\r
+// be used to force the variable into the RTOS kernel's privileged data area.\r
+static PRIVILEGED_DATA StaticTask_t xTaskBuffer;\r
+static const TaskParameters_t xCheckTaskParameters =\r
+{\r
+       vATask,         // pvTaskCode - the function that implements the task.\r
+       "ATask",        // pcName - just a text name for the task to assist debugging.\r
+       100,            // usStackDepth - the stack size DEFINED IN WORDS.\r
+       NULL,           // pvParameters - passed into the task function as the function parameters.\r
+       ( 1UL | portPRIVILEGE_BIT ),// uxPriority - task priority, set the portPRIVILEGE_BIT if the task should run in a privileged state.\r
+       cStackBuffer,// puxStackBuffer - the buffer to be used as the task stack.\r
+\r
+       // xRegions - Allocate up to three separate memory regions for access by\r
+       // the task, with appropriate access permissions.  Different processors have\r
+       // different memory alignment requirements - refer to the FreeRTOS documentation\r
+       // for full information.\r
+       {\r
+               // Base address                                 Length  Parameters\r
+               { cReadWriteArray,                              32,             portMPU_REGION_READ_WRITE },\r
+               { cReadOnlyArray,                               32,             portMPU_REGION_READ_ONLY },\r
+               { cPrivilegedOnlyAccessArray,   128,    portMPU_REGION_PRIVILEGED_READ_WRITE }\r
+       }\r
+\r
+       &xTaskBuffer; // Holds the task's data structure.\r
+};\r
+\r
+int main( void )\r
+{\r
+TaskHandle_t xHandle;\r
+\r
+       // Create a task from the const structure defined above.  The task handle\r
+       // is requested (the second parameter is not NULL) but in this case just for\r
+       // demonstration purposes as its not actually used.\r
+       xTaskCreateRestricted( &xRegTest1Parameters, &xHandle );\r
+\r
+       // Start the scheduler.\r
+       vTaskStartScheduler();\r
+\r
+       // Will only get here if there was insufficient memory to create the idle\r
+       // and/or timer task.\r
+       for( ;; );\r
+}\r
+   </pre>\r
+ * \defgroup xTaskCreateRestrictedStatic xTaskCreateRestrictedStatic\r
+ * \ingroup Tasks\r
+ */\r
+#if( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )\r
+       BaseType_t xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask ) PRIVILEGED_FUNCTION;\r
+#endif\r
+\r
+/**\r
+ * task. h\r
+ *<pre>\r
+ void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions );</pre>\r
  *\r
  * Memory regions are assigned to a restricted task when the task is created by\r
  * a call to xTaskCreateRestricted().  These regions can be redefined using\r
@@ -392,16 +627,16 @@ xTaskHandle xHandle;
  *\r
  * @param xTask The handle of the task being updated.\r
  *\r
- * @param xRegions A pointer to an xMemoryRegion structure that contains the\r
+ * @param xRegions A pointer to an MemoryRegion_t structure that contains the\r
  * new memory region definitions.\r
  *\r
  * Example usage:\r
    <pre>\r
-// Define an array of xMemoryRegion structures that configures an MPU region\r
+// Define an array of MemoryRegion_t structures that configures an MPU region\r
 // allowing read/write access for 1024 bytes starting at the beginning of the\r
 // ucOneKByte array.  The other two of the maximum 3 definable regions are\r
 // unused so set to zero.\r
-static const xMemoryRegion xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =\r
+static const MemoryRegion_t xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =\r
 {\r
        // Base address         Length          Parameters\r
        { ucOneKByte,           1024,           portMPU_REGION_READ_WRITE },\r
@@ -427,16 +662,16 @@ void vATask( void *pvParameters )
  * \defgroup xTaskCreateRestricted xTaskCreateRestricted\r
  * \ingroup Tasks\r
  */\r
-void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxRegions ) PRIVILEGED_FUNCTION;\r
+void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <pre>void vTaskDelete( xTaskHandle xTask );</pre>\r
+ * <pre>void vTaskDelete( TaskHandle_t xTask );</pre>\r
  *\r
  * 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
@@ -456,7 +691,7 @@ void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxR
    <pre>\r
  void vOtherFunction( void )\r
  {\r
xTaskHandle xHandle;\r
TaskHandle_t xHandle;\r
 \r
         // Create the task, storing the handle.\r
         xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );\r
@@ -468,7 +703,7 @@ void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxR
  * \defgroup vTaskDelete vTaskDelete\r
  * \ingroup Tasks\r
  */\r
-void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;\r
+void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION;\r
 \r
 /*-----------------------------------------------------------\r
  * TASK CONTROL API\r
@@ -476,11 +711,11 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION;
 \r
 /**\r
  * task. h\r
- * <pre>void vTaskDelay( portTickType xTicksToDelay );</pre>\r
+ * <pre>void vTaskDelay( const TickType_t 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
- * portTICK_RATE_MS can be used to calculate real time from the tick\r
+ * portTICK_PERIOD_MS can be used to calculate real time from the tick\r
  * rate - with the resolution of one tick period.\r
  *\r
  * INCLUDE_vTaskDelay must be defined as 1 for this function to be available.\r
@@ -491,7 +726,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
@@ -504,12 +739,10 @@ 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
- const portTickType xDelay = 500 / portTICK_RATE_MS;\r
+ const TickType_t xDelay = 500 / portTICK_PERIOD_MS;\r
 \r
         for( ;; )\r
         {\r
@@ -522,16 +755,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 TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <pre>void vTaskDelayUntil( portTickType *pxPreviousWakeTime, portTickType xTimeIncrement );</pre>\r
+ * <pre>void vTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t 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
@@ -546,7 +779,7 @@ void vTaskDelay( portTickType xTicksToDelay ) PRIVILEGED_FUNCTION;
  * is called, vTaskDelayUntil () specifies the absolute (exact) time at which it wishes to\r
  * unblock.\r
  *\r
- * The constant portTICK_RATE_MS can be used to calculate real time from the tick\r
+ * The constant portTICK_PERIOD_MS can be used to calculate real time from the tick\r
  * rate - with the resolution of one tick period.\r
  *\r
  * @param pxPreviousWakeTime Pointer to a variable that holds the time at which the\r
@@ -564,8 +797,8 @@ void vTaskDelay( portTickType xTicksToDelay ) PRIVILEGED_FUNCTION;
  // Perform an action every 10 ticks.\r
  void vTaskFunction( void * pvParameters )\r
  {\r
portTickType xLastWakeTime;\r
- const portTickType xFrequency = 10;\r
TickType_t xLastWakeTime;\r
+ const TickType_t xFrequency = 10;\r
 \r
         // Initialise the xLastWakeTime variable with the current time.\r
         xLastWakeTime = xTaskGetTickCount ();\r
@@ -581,13 +814,71 @@ 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( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>BaseType_t xTaskAbortDelay( TaskHandle_t xTask );</pre>\r
+ *\r
+ * INCLUDE_xTaskAbortDelay must be defined as 1 in FreeRTOSConfig.h for this\r
+ * function to be available.\r
+ *\r
+ * A task will enter the Blocked state when it is waiting for an event.  The\r
+ * event it is waiting for can be a temporal event (waiting for a time), such\r
+ * as when vTaskDelay() is called, or an event on an object, such as when\r
+ * xQueueReceive() or ulTaskNotifyTake() is called.  If the handle of a task\r
+ * that is in the Blocked state is used in a call to xTaskAbortDelay() then the\r
+ * task will leave the Blocked state, and return from whichever function call\r
+ * placed the task into the Blocked state.\r
+ *\r
+ * @param xTask The handle of the task to remove from the Blocked state.\r
+ *\r
+ * @return If the task referenced by xTask was not in the Blocked state then\r
+ * pdFAIL is returned.  Otherwise pdPASS is returned.\r
+ *\r
+ * \defgroup xTaskAbortDelay xTaskAbortDelay\r
+ * \ingroup TaskCtrl\r
+ */\r
+BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+* task. h\r
+* <pre>BaseType_t xTaskAbortDelayFromISR( TaskHandle_t xTask, BaseType_t * const pxHigherPriorityTaskWoken )</pre>\r
+*\r
+* INCLUDE_xTaskAbortDelay must be defined as 1 in FreeRTOSConfig.h for this\r
+* function to be available.\r
+*\r
+* A version of xTaskAbortDelay() that can be used from an interrupt service routine.\r
+*\r
+* A task will enter the Blocked state when it is waiting for an event.  The\r
+* event it is waiting for can be a temporal event (waiting for a time), such\r
+* as when vTaskDelay() is called, or an event on an object, such as when\r
+* xQueueReceive() or ulTaskNotifyTake() is called.  If the handle of a task\r
+* that is in the Blocked state is used in a call to xTaskAbortDelay() then the\r
+* task will leave the Blocked state, and return from whichever function call\r
+* placed the task into the Blocked state.\r
+*\r
+* @param xTask The handle of the task to remove from the Blocked state.\r
+*\r
+* @param pxHigherPriorityTaskWoken xTaskAbortDelayFromISR() will set\r
+* *pxHigherPriorityTaskWoken to pdTRUE if a task was removed from the Blocked state,\r
+* and the task that was removed from the Blocked state has a priority higher than the\r
+* currently running task.  If xTaskAbortDelayFromISR() sets this value to pdTRUE then\r
+* a context switch should be requested before the interrupt is exited.\r
+*\r
+* @return If the task referenced by xTask was not in the Blocked state then\r
+* pdFAIL is returned.  Otherwise pdPASS is returned.\r
+*\r
+* \defgroup xTaskAbortDelay xTaskAbortDelayFromISR\r
+* \ingroup TaskCtrl\r
+*/\r
+BaseType_t xTaskAbortDelayFromISR( TaskHandle_t xTask, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <pre>unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask );</pre>\r
+ * <pre>UBaseType_t uxTaskPriorityGet( const TaskHandle_t 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
@@ -601,7 +892,7 @@ void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTim
    <pre>\r
  void vAFunction( void )\r
  {\r
xTaskHandle xHandle;\r
TaskHandle_t xHandle;\r
 \r
         // Create a task, storing the handle.\r
         xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );\r
@@ -628,11 +919,19 @@ void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTim
  * \defgroup uxTaskPriorityGet uxTaskPriorityGet\r
  * \ingroup TaskCtrl\r
  */\r
-unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask ) PRIVILEGED_FUNCTION;\r
+UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <pre>eTaskState eTaskGetState( xTaskHandle xTask );</pre>\r
+ * <pre>UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask );</pre>\r
+ *\r
+ * A version of uxTaskPriorityGet() that can be used from an ISR.\r
+ */\r
+UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>eTaskState eTaskGetState( TaskHandle_t xTask );</pre>\r
  *\r
  * INCLUDE_eTaskGetState must be defined as 1 for this function to be available.\r
  * See the configuration section for more information.\r
@@ -646,11 +945,67 @@ unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask ) PRIVILEGED_FUNCTIO
  * state of the task might change between the function being called, and the\r
  * functions return value being tested by the calling task.\r
  */\r
-eTaskState eTaskGetState( xTaskHandle xTask ) PRIVILEGED_FUNCTION;\r
+eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <pre>void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority );</pre>\r
+ * <pre>void vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState );</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
+ * Populates a TaskStatus_t structure with information about a task.\r
+ *\r
+ * @param xTask Handle of the task being queried.  If xTask is NULL then\r
+ * information will be returned about the calling task.\r
+ *\r
+ * @param pxTaskStatus A pointer to the TaskStatus_t structure that will be\r
+ * filled with information about the task referenced by the handle passed using\r
+ * the xTask parameter.\r
+ *\r
+ * @xGetFreeStackSpace The TaskStatus_t structure contains a member to report\r
+ * the stack high water mark of the task being queried.  Calculating the stack\r
+ * high water mark takes a relatively long time, and can make the system\r
+ * temporarily unresponsive - so the xGetFreeStackSpace parameter is provided to\r
+ * allow the high water mark checking to be skipped.  The high watermark value\r
+ * will only be written to the TaskStatus_t structure if xGetFreeStackSpace is\r
+ * not set to pdFALSE;\r
+ *\r
+ * @param eState The TaskStatus_t structure contains a member to report the\r
+ * state of the task being queried.  Obtaining the task state is not as fast as\r
+ * a simple assignment - so the eState parameter is provided to allow the state\r
+ * information to be omitted from the TaskStatus_t structure.  To obtain state\r
+ * information then set eState to eInvalid - otherwise the value passed in\r
+ * eState will be reported as the task state in the TaskStatus_t structure.\r
+ *\r
+ * Example usage:\r
+   <pre>\r
+ void vAFunction( void )\r
+ {\r
+ TaskHandle_t xHandle;\r
+ TaskStatus_t xTaskDetails;\r
+\r
+    // Obtain the handle of a task from its name.\r
+    xHandle = xTaskGetHandle( "Task_Name" );\r
+\r
+    // Check the handle is not NULL.\r
+    configASSERT( xHandle );\r
+\r
+    // Use the handle to obtain further information about the task.\r
+    vTaskGetInfo( xHandle,\r
+                  &xTaskDetails,\r
+                  pdTRUE, // Include the high water mark in xTaskDetails.\r
+                  eInvalid ); // Include the task state in xTaskDetails.\r
+ }\r
+   </pre>\r
+ * \defgroup vTaskGetInfo vTaskGetInfo\r
+ * \ingroup TaskCtrl\r
+ */\r
+void vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <pre>void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority );</pre>\r
  *\r
  * INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be available.\r
  * See the configuration section for more information.\r
@@ -669,7 +1024,7 @@ eTaskState eTaskGetState( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
    <pre>\r
  void vAFunction( void )\r
  {\r
xTaskHandle xHandle;\r
TaskHandle_t xHandle;\r
 \r
         // Create a task, storing the handle.\r
         xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );\r
@@ -688,11 +1043,11 @@ eTaskState eTaskGetState( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
  * \defgroup vTaskPrioritySet vTaskPrioritySet\r
  * \ingroup TaskCtrl\r
  */\r
-void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority ) PRIVILEGED_FUNCTION;\r
+void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <pre>void vTaskSuspend( xTaskHandle xTaskToSuspend );</pre>\r
+ * <pre>void vTaskSuspend( TaskHandle_t xTaskToSuspend );</pre>\r
  *\r
  * INCLUDE_vTaskSuspend must be defined as 1 for this function to be available.\r
  * See the configuration section for more information.\r
@@ -711,7 +1066,7 @@ void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority )
    <pre>\r
  void vAFunction( void )\r
  {\r
xTaskHandle xHandle;\r
TaskHandle_t xHandle;\r
 \r
         // Create a task, storing the handle.\r
         xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );\r
@@ -739,18 +1094,18 @@ void vTaskPrioritySet( xTaskHandle xTask, unsigned portBASE_TYPE uxNewPriority )
  * \defgroup vTaskSuspend vTaskSuspend\r
  * \ingroup TaskCtrl\r
  */\r
-void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION;\r
+void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <pre>void vTaskResume( xTaskHandle xTaskToResume );</pre>\r
+ * <pre>void vTaskResume( TaskHandle_t xTaskToResume );</pre>\r
  *\r
  * INCLUDE_vTaskSuspend must be defined as 1 for this function to be available.\r
  * See the configuration section for more information.\r
  *\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
@@ -760,7 +1115,7 @@ void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION;
    <pre>\r
  void vAFunction( void )\r
  {\r
xTaskHandle xHandle;\r
TaskHandle_t xHandle;\r
 \r
         // Create a task, storing the handle.\r
         xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );\r
@@ -782,33 +1137,42 @@ 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
  * \ingroup TaskCtrl\r
  */\r
-void vTaskResume( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTION;\r
+void vTaskResume( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <pre>void xTaskResumeFromISR( xTaskHandle xTaskToResume );</pre>\r
+ * <pre>void xTaskResumeFromISR( TaskHandle_t xTaskToResume );</pre>\r
  *\r
  * INCLUDE_xTaskResumeFromISR must be defined as 1 for this function to be\r
  * available.  See the configuration section for more information.\r
  *\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
-portBASE_TYPE xTaskResumeFromISR( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTION;\r
+BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;\r
 \r
 /*-----------------------------------------------------------\r
  * SCHEDULER CONTROL\r
@@ -819,12 +1183,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
@@ -852,6 +1211,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
@@ -905,8 +1267,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
@@ -954,11 +1316,13 @@ void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION;
 \r
 /**\r
  * task. h\r
- * <pre>char xTaskResumeAll( void );</pre>\r
+ * <pre>BaseType_t xTaskResumeAll( void );</pre>\r
+ *\r
+ * Resumes scheduler activity after it was suspended by a call to\r
+ * vTaskSuspendAll().\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
+ * 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
@@ -1002,18 +1366,7 @@ void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION;
  * \defgroup xTaskResumeAll xTaskResumeAll\r
  * \ingroup SchedulerControl\r
  */\r
-signed portBASE_TYPE xTaskResumeAll( void ) PRIVILEGED_FUNCTION;\r
-\r
-/**\r
- * task. h\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
+BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION;\r
 \r
 /*-----------------------------------------------------------\r
  * TASK UTILITIES\r
@@ -1021,34 +1374,34 @@ signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) PRIVILEGED_FUNCTI
 \r
 /**\r
  * task. h\r
- * <PRE>portTickType xTaskGetTickCount( void );</PRE>\r
+ * <PRE>TickType_t xTaskGetTickCount( void );</PRE>\r
  *\r
  * @return The count of ticks since vTaskStartScheduler was called.\r
  *\r
  * \defgroup xTaskGetTickCount xTaskGetTickCount\r
  * \ingroup TaskUtils\r
  */\r
-portTickType xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;\r
+TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <PRE>portTickType xTaskGetTickCountFromISR( void );</PRE>\r
+ * <PRE>TickType_t xTaskGetTickCountFromISR( void );</PRE>\r
  *\r
  * @return The count of ticks since vTaskStartScheduler was called.\r
  *\r
  * This is a version of xTaskGetTickCount() that is safe to be called from an\r
- * ISR - provided that portTickType is the natural word size of the\r
+ * ISR - provided that TickType_t is the natural word size of the\r
  * microcontroller being used or interrupt nesting is either not supported or\r
  * not being used.\r
  *\r
- * \defgroup xTaskGetTickCount xTaskGetTickCount\r
+ * \defgroup xTaskGetTickCountFromISR xTaskGetTickCountFromISR\r
  * \ingroup TaskUtils\r
  */\r
-portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;\r
+TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <PRE>unsigned short uxTaskGetNumberOfTasks( void );</PRE>\r
+ * <PRE>uint16_t uxTaskGetNumberOfTasks( void );</PRE>\r
  *\r
  * @return The number of tasks that the real time kernel is currently managing.\r
  * This includes all ready, blocked and suspended tasks.  A task that\r
@@ -1058,25 +1411,40 @@ portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;
  * \defgroup uxTaskGetNumberOfTasks uxTaskGetNumberOfTasks\r
  * \ingroup TaskUtils\r
  */\r
-unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;\r
+UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <PRE>signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );</PRE>\r
+ * <PRE>char *pcTaskGetName( TaskHandle_t 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
- * handle, or by setting xTaskToQuery to NULL.  INCLUDE_pcTaskGetTaskName must be\r
- * set to 1 in FreeRTOSConfig.h for pcTaskGetTaskName() to be available.\r
+ * xTaskToQuery.  A task can query its own name by either passing in its own\r
+ * handle, or by setting xTaskToQuery to NULL.\r
+ *\r
+ * \defgroup pcTaskGetName pcTaskGetName\r
+ * \ingroup TaskUtils\r
+ */\r
+char *pcTaskGetName( 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>TaskHandle_t xTaskGetHandle( const char *pcNameToQuery );</PRE>\r
+ *\r
+ * NOTE:  This function takes a relatively long time to complete and should be\r
+ * used sparingly.\r
+ *\r
+ * @return The handle of the task that has the human readable name pcNameToQuery.\r
+ * NULL is returned if no matching name is found.  INCLUDE_xTaskGetHandle\r
+ * must be set to 1 in FreeRTOSConfig.h for pcTaskGetHandle() to be available.\r
  *\r
- * \defgroup pcTaskGetTaskName pcTaskGetTaskName\r
+ * \defgroup pcTaskGetHandle pcTaskGetHandle\r
  * \ingroup TaskUtils\r
  */\r
-signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );\r
+TaskHandle_t xTaskGetHandle( const char *pcNameToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
 \r
 /**\r
  * task.h\r
- * <PRE>unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask );</PRE>\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
@@ -1086,16 +1454,50 @@ signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );
  * 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
+ * uxTaskGetStackHighWaterMark() and uxTaskGetStackHighWaterMark2() are the\r
+ * same except for their return type.  Using configSTACK_DEPTH_TYPE allows the\r
+ * user to determine the return type.  It gets around the problem of the value\r
+ * overflowing on 8-bit types without breaking backward compatibility for\r
+ * applications that expect an 8-bit return type.\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 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
+UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
 \r
-/* When using trace macros it is sometimes necessary to include tasks.h before\r
-FreeRTOS.h.  When this is done pdTASK_HOOK_CODE will not yet have been defined,\r
+/**\r
+ * task.h\r
+ * <PRE>configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask );</PRE>\r
+ *\r
+ * INCLUDE_uxTaskGetStackHighWaterMark2 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
+ * uxTaskGetStackHighWaterMark() and uxTaskGetStackHighWaterMark2() are the\r
+ * same except for their return type.  Using configSTACK_DEPTH_TYPE allows the\r
+ * user to determine the return type.  It gets around the problem of the value\r
+ * overflowing on 8-bit types without breaking backward compatibility for\r
+ * applications that expect an 8-bit return type.\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
+configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( 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
@@ -1104,35 +1506,59 @@ constant. */
        #if configUSE_APPLICATION_TASK_TAG == 1\r
                /**\r
                 * task.h\r
-                * <pre>void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );</pre>\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( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction ) PRIVILEGED_FUNCTION;\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.  Do not\r
+                * call from an interrupt service routine - call\r
+                * xTaskGetApplicationTaskTagFromISR() instead.\r
+                */\r
+               TaskHookFunction_t xTaskGetApplicationTaskTag( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
 \r
                /**\r
                 * task.h\r
-                * <pre>void xTaskGetApplicationTaskTag( xTaskHandle xTask );</pre>\r
+                * <pre>void xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask );</pre>\r
                 *\r
-                * Returns the pxHookFunction value assigned to the task xTask.\r
+                * Returns the pxHookFunction value assigned to the task xTask.  Can\r
+                * be called from an interrupt service routine.\r
                 */\r
-               pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( xTaskHandle xTask ) PRIVILEGED_FUNCTION;\r
+               TaskHookFunction_t xTaskGetApplicationTaskTagFromISR( 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 ) PRIVILEGED_FUNCTION;\r
+       void *pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex ) PRIVILEGED_FUNCTION;\r
+\r
+#endif\r
+\r
 /**\r
  * task.h\r
- * <pre>portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );</pre>\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.\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
+BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * xTaskGetIdleTaskHandle() is only available if\r
@@ -1141,67 +1567,68 @@ portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter
  * Simply returns the handle of the idle task.  It is not valid to call\r
  * xTaskGetIdleTaskHandle() before the scheduler has been started.\r
  */\r
-xTaskHandle xTaskGetIdleTaskHandle( void );\r
+TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
- * configUSE_TRACE_FACILITY must bet defined as 1 in FreeRTOSConfig.h for\r
- * xTaskGetSystemState() to be available.\r
+ * configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for\r
+ * uxTaskGetSystemState() to be available.\r
  *\r
- * xTaskGetSystemState() populates an xTaskStatusType structure for each task in\r
- * the system.  xTaskStatusType structures contain, among other things, members\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 xTaskStatusType structure\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 xTaskStatusType structures.\r
- * The array contain at least one xTaskStatusType structure for each task that\r
- * is under the control of the RTOS.  The number of tasks under the control of\r
- * the RTOS can be determined using the uxTaskGetNumberOfTasks() API function.\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 xTaskStatusType structures contained in the array, not by the\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 xTaskGetSystemState() to the\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
- * xTaskGetSystemState().  This should equal the number returned by the\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 xTaskGetSystemState().\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
+       void vTaskGetRunTimeStats( char *pcWriteBuffer )\r
        {\r
-       xTaskStatusType *pxTaskStatusArray;\r
-       volatile unsigned portBASE_TYPE uxArraySize, x;\r
-       unsigned long ulTotalRunTime, ulStatsAsPercentage;\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 = uxCurrentNumberOfTasks;\r
+               uxArraySize = uxTaskGetNumberOfTasks();\r
 \r
-               // Allocate a xTaskStatusType structure for each task.  An array could be\r
+               // Allocate a TaskStatus_t structure for each task.  An array could be\r
                // allocated statically at compile time.\r
-               pxTaskStatusArray = pvPortMalloc( uxCurrentNumberOfTasks * sizeof( xTaskStatusType ) );\r
+               pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( TaskStatus_t ) );\r
 \r
                if( pxTaskStatusArray != NULL )\r
                {\r
                        // Generate raw status information about each task.\r
-                       uxArraySize = xTaskGetSystemState( pxTaskStatusArray, uxArraySize, &ulTotalRunTime );\r
+                       uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, &ulTotalRunTime );\r
 \r
                        // For percentage calculations.\r
                        ulTotalRunTime /= 100UL;\r
@@ -1220,13 +1647,13 @@ xTaskHandle xTaskGetIdleTaskHandle( void );
 \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
+                                               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( ( char * ) pcWriteBuffer, ( char * ) "%s\t\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );\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
@@ -1239,7 +1666,7 @@ xTaskHandle xTaskGetIdleTaskHandle( void );
        }\r
        </pre>\r
  */\r
-unsigned portBASE_TYPE xTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime );\r
+UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
@@ -1263,8 +1690,8 @@ unsigned portBASE_TYPE xTaskGetSystemState( xTaskStatusType *pxTaskStatusArray,
  * 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 xTaskGetSystemState(), then formats part of the\r
- * xTaskGetSystemState() output into a human readable table that displays task\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
@@ -1274,19 +1701,19 @@ unsigned portBASE_TYPE xTaskGetSystemState( xTaskStatusType *pxTaskStatusArray,
  * 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 xTaskGetSystemState()\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
+ * 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
+void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
 \r
 /**\r
  * task. h\r
@@ -1295,7 +1722,7 @@ void vTaskList( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;
  * 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
+ * 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
@@ -1316,8 +1743,8 @@ void vTaskList( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;
  * 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 xTaskGetSystemState(), then formats part of the\r
- * xTaskGetSystemState() output into a human readable table that displays the\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
@@ -1328,19 +1755,599 @@ void vTaskList( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;
  * 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 xTaskGetSystemState() directly\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
+ * 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
+void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+\r
+/**\r
+* task. h\r
+* <PRE>uint32_t ulTaskGetIdleRunTimeCounter( void );</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
+* 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
+* While uxTaskGetSystemState() and vTaskGetRunTimeStats() writes the total\r
+* execution time of each task into a buffer, ulTaskGetIdleRunTimeCounter()\r
+* returns the total execution time of just the idle task.\r
+*\r
+* @return The total run time of the idle task.  This is the amount of time the\r
+* idle task has actually been executing.  The unit of time is dependent on the\r
+* frequency configured using the portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and\r
+* portGET_RUN_TIME_COUNTER_VALUE() macros.\r
+*\r
+* \defgroup ulTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter\r
+* \ingroup TaskUtils\r
+*/\r
+uint32_t ulTaskGetIdleRunTimeCounter( void ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction );</PRE>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this\r
+ * function to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * A notification sent to a task will remain pending until it is cleared by the\r
+ * task calling xTaskNotifyWait() or ulTaskNotifyTake().  If the task was\r
+ * already in the Blocked state to wait for a notification when the notification\r
+ * arrives then the task will automatically be removed from the Blocked state\r
+ * (unblocked) and the notification cleared.\r
+ *\r
+ * A task can use xTaskNotifyWait() to [optionally] block to wait for a\r
+ * notification to be pending, or ulTaskNotifyTake() to [optionally] block\r
+ * to wait for its notification value to have a non-zero value.  The task does\r
+ * not consume any CPU time while it is in the Blocked state.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @param ulValue Data that can be sent with the notification.  How the data is\r
+ * used depends on the value of the eAction parameter.\r
+ *\r
+ * @param eAction Specifies how the notification updates the task's notification\r
+ * value, if at all.  Valid values for eAction are as follows:\r
+ *\r
+ * eSetBits -\r
+ * The task's notification value is bitwise ORed with ulValue.  xTaskNofify()\r
+ * always returns pdPASS in this case.\r
+ *\r
+ * eIncrement -\r
+ * The task's notification value is incremented.  ulValue is not used and\r
+ * xTaskNotify() always returns pdPASS in this case.\r
+ *\r
+ * eSetValueWithOverwrite -\r
+ * The task's notification value is set to the value of ulValue, even if the\r
+ * task being notified had not yet processed the previous notification (the\r
+ * task already had a notification pending).  xTaskNotify() always returns\r
+ * pdPASS in this case.\r
+ *\r
+ * eSetValueWithoutOverwrite -\r
+ * If the task being notified did not already have a notification pending then\r
+ * the task's notification value is set to ulValue and xTaskNotify() will\r
+ * return pdPASS.  If the task being notified already had a notification\r
+ * pending then no action is performed and pdFAIL is returned.\r
+ *\r
+ * eNoAction -\r
+ * The task receives a notification without its notification value being\r
+ * updated.  ulValue is not used and xTaskNotify() always returns pdPASS in\r
+ * this case.\r
+ *\r
+ *  pulPreviousNotificationValue -\r
+ *  Can be used to pass out the subject task's notification value before any\r
+ *  bits are modified by the notify function.\r
+ *\r
+ * @return Dependent on the value of eAction.  See the description of the\r
+ * eAction parameter.\r
+ *\r
+ * \defgroup xTaskNotify xTaskNotify\r
+ * \ingroup TaskNotifications\r
+ */\r
+BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue ) PRIVILEGED_FUNCTION;\r
+#define xTaskNotify( xTaskToNotify, ulValue, eAction ) xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL )\r
+#define xTaskNotifyAndQuery( xTaskToNotify, ulValue, eAction, pulPreviousNotifyValue ) xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotifyValue ) )\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken );</PRE>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this\r
+ * function to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * A version of xTaskNotify() that can be used from an interrupt service routine\r
+ * (ISR).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * A notification sent to a task will remain pending until it is cleared by the\r
+ * task calling xTaskNotifyWait() or ulTaskNotifyTake().  If the task was\r
+ * already in the Blocked state to wait for a notification when the notification\r
+ * arrives then the task will automatically be removed from the Blocked state\r
+ * (unblocked) and the notification cleared.\r
+ *\r
+ * A task can use xTaskNotifyWait() to [optionally] block to wait for a\r
+ * notification to be pending, or ulTaskNotifyTake() to [optionally] block\r
+ * to wait for its notification value to have a non-zero value.  The task does\r
+ * not consume any CPU time while it is in the Blocked state.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @param ulValue Data that can be sent with the notification.  How the data is\r
+ * used depends on the value of the eAction parameter.\r
+ *\r
+ * @param eAction Specifies how the notification updates the task's notification\r
+ * value, if at all.  Valid values for eAction are as follows:\r
+ *\r
+ * eSetBits -\r
+ * The task's notification value is bitwise ORed with ulValue.  xTaskNofify()\r
+ * always returns pdPASS in this case.\r
+ *\r
+ * eIncrement -\r
+ * The task's notification value is incremented.  ulValue is not used and\r
+ * xTaskNotify() always returns pdPASS in this case.\r
+ *\r
+ * eSetValueWithOverwrite -\r
+ * The task's notification value is set to the value of ulValue, even if the\r
+ * task being notified had not yet processed the previous notification (the\r
+ * task already had a notification pending).  xTaskNotify() always returns\r
+ * pdPASS in this case.\r
+ *\r
+ * eSetValueWithoutOverwrite -\r
+ * If the task being notified did not already have a notification pending then\r
+ * the task's notification value is set to ulValue and xTaskNotify() will\r
+ * return pdPASS.  If the task being notified already had a notification\r
+ * pending then no action is performed and pdFAIL is returned.\r
+ *\r
+ * eNoAction -\r
+ * The task receives a notification without its notification value being\r
+ * updated.  ulValue is not used and xTaskNotify() always returns pdPASS in\r
+ * this case.\r
+ *\r
+ * @param pxHigherPriorityTaskWoken  xTaskNotifyFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending the notification caused the\r
+ * task to which the notification was sent to leave the Blocked state, and the\r
+ * unblocked task has a priority higher than the currently running task.  If\r
+ * xTaskNotifyFromISR() sets this value to pdTRUE then a context switch should\r
+ * be requested before the interrupt is exited.  How a context switch is\r
+ * requested from an ISR is dependent on the port - see the documentation page\r
+ * for the port in use.\r
+ *\r
+ * @return Dependent on the value of eAction.  See the description of the\r
+ * eAction parameter.\r
+ *\r
+ * \defgroup xTaskNotify xTaskNotify\r
+ * \ingroup TaskNotifications\r
+ */\r
+BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
+#define xTaskNotifyFromISR( xTaskToNotify, ulValue, eAction, pxHigherPriorityTaskWoken ) xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL, ( pxHigherPriorityTaskWoken ) )\r
+#define xTaskNotifyAndQueryFromISR( xTaskToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken ) xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotificationValue ), ( pxHigherPriorityTaskWoken ) )\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait );</pre>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this\r
+ * function to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * A notification sent to a task will remain pending until it is cleared by the\r
+ * task calling xTaskNotifyWait() or ulTaskNotifyTake().  If the task was\r
+ * already in the Blocked state to wait for a notification when the notification\r
+ * arrives then the task will automatically be removed from the Blocked state\r
+ * (unblocked) and the notification cleared.\r
+ *\r
+ * A task can use xTaskNotifyWait() to [optionally] block to wait for a\r
+ * notification to be pending, or ulTaskNotifyTake() to [optionally] block\r
+ * to wait for its notification value to have a non-zero value.  The task does\r
+ * not consume any CPU time while it is in the Blocked state.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.\r
+ *\r
+ * @param ulBitsToClearOnEntry Bits that are set in ulBitsToClearOnEntry value\r
+ * will be cleared in the calling task's notification value before the task\r
+ * checks to see if any notifications are pending, and optionally blocks if no\r
+ * notifications are pending.  Setting ulBitsToClearOnEntry to ULONG_MAX (if\r
+ * limits.h is included) or 0xffffffffUL (if limits.h is not included) will have\r
+ * the effect of resetting the task's notification value to 0.  Setting\r
+ * ulBitsToClearOnEntry to 0 will leave the task's notification value unchanged.\r
+ *\r
+ * @param ulBitsToClearOnExit If a notification is pending or received before\r
+ * the calling task exits the xTaskNotifyWait() function then the task's\r
+ * notification value (see the xTaskNotify() API function) is passed out using\r
+ * the pulNotificationValue parameter.  Then any bits that are set in\r
+ * ulBitsToClearOnExit will be cleared in the task's notification value (note\r
+ * *pulNotificationValue is set before any bits are cleared).  Setting\r
+ * ulBitsToClearOnExit to ULONG_MAX (if limits.h is included) or 0xffffffffUL\r
+ * (if limits.h is not included) will have the effect of resetting the task's\r
+ * notification value to 0 before the function exits.  Setting\r
+ * ulBitsToClearOnExit to 0 will leave the task's notification value unchanged\r
+ * when the function exits (in which case the value passed out in\r
+ * pulNotificationValue will match the task's notification value).\r
+ *\r
+ * @param pulNotificationValue Used to pass the task's notification value out\r
+ * of the function.  Note the value passed out will not be effected by the\r
+ * clearing of any bits caused by ulBitsToClearOnExit being non-zero.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time that the task should wait in\r
+ * the Blocked state for a notification to be received, should a notification\r
+ * not already be pending when xTaskNotifyWait() was called.  The task\r
+ * will not consume any processing time while it is in the Blocked state.  This\r
+ * is specified in kernel ticks, the macro pdMS_TO_TICSK( value_in_ms ) can be\r
+ * used to convert a time specified in milliseconds to a time specified in\r
+ * ticks.\r
+ *\r
+ * @return If a notification was received (including notifications that were\r
+ * already pending when xTaskNotifyWait was called) then pdPASS is\r
+ * returned.  Otherwise pdFAIL is returned.\r
+ *\r
+ * \defgroup xTaskNotifyWait xTaskNotifyWait\r
+ * \ingroup TaskNotifications\r
+ */\r
+BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotifyGive( TaskHandle_t xTaskToNotify );</PRE>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this macro\r
+ * to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * xTaskNotifyGive() is a helper macro intended for use when task notifications\r
+ * are used as light weight and faster binary or counting semaphore equivalents.\r
+ * Actual FreeRTOS semaphores are given using the xSemaphoreGive() API function,\r
+ * the equivalent action that instead uses a task notification is\r
+ * xTaskNotifyGive().\r
+ *\r
+ * When task notifications are being used as a binary or counting semaphore\r
+ * equivalent then the task being notified should wait for the notification\r
+ * using the ulTaskNotificationTake() API function rather than the\r
+ * xTaskNotifyWait() API function.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for more details.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @return xTaskNotifyGive() is a macro that calls xTaskNotify() with the\r
+ * eAction parameter set to eIncrement - so pdPASS is always returned.\r
+ *\r
+ * \defgroup xTaskNotifyGive xTaskNotifyGive\r
+ * \ingroup TaskNotifications\r
+ */\r
+#define xTaskNotifyGive( xTaskToNotify ) xTaskGenericNotify( ( xTaskToNotify ), ( 0 ), eIncrement, NULL )\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>void vTaskNotifyGiveFromISR( TaskHandle_t xTaskHandle, BaseType_t *pxHigherPriorityTaskWoken );\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this macro\r
+ * to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * A version of xTaskNotifyGive() that can be called from an interrupt service\r
+ * routine (ISR).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * vTaskNotifyGiveFromISR() is intended for use when task notifications are\r
+ * used as light weight and faster binary or counting semaphore equivalents.\r
+ * Actual FreeRTOS semaphores are given from an ISR using the\r
+ * xSemaphoreGiveFromISR() API function, the equivalent action that instead uses\r
+ * a task notification is vTaskNotifyGiveFromISR().\r
+ *\r
+ * When task notifications are being used as a binary or counting semaphore\r
+ * equivalent then the task being notified should wait for the notification\r
+ * using the ulTaskNotificationTake() API function rather than the\r
+ * xTaskNotifyWait() API function.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for more details.\r
+ *\r
+ * @param xTaskToNotify The handle of the task being notified.  The handle to a\r
+ * task can be returned from the xTaskCreate() API function used to create the\r
+ * task, and the handle of the currently running task can be obtained by calling\r
+ * xTaskGetCurrentTaskHandle().\r
+ *\r
+ * @param pxHigherPriorityTaskWoken  vTaskNotifyGiveFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending the notification caused the\r
+ * task to which the notification was sent to leave the Blocked state, and the\r
+ * unblocked task has a priority higher than the currently running task.  If\r
+ * vTaskNotifyGiveFromISR() sets this value to pdTRUE then a context switch\r
+ * should be requested before the interrupt is exited.  How a context switch is\r
+ * requested from an ISR is dependent on the port - see the documentation page\r
+ * for the port in use.\r
+ *\r
+ * \defgroup xTaskNotifyWait xTaskNotifyWait\r
+ * \ingroup TaskNotifications\r
+ */\r
+void vTaskNotifyGiveFromISR( TaskHandle_t xTaskToNotify, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait );</pre>\r
+ *\r
+ * configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this\r
+ * function to be available.\r
+ *\r
+ * When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private\r
+ * "notification value", which is a 32-bit unsigned integer (uint32_t).\r
+ *\r
+ * Events can be sent to a task using an intermediary object.  Examples of such\r
+ * objects are queues, semaphores, mutexes and event groups.  Task notifications\r
+ * are a method of sending an event directly to a task without the need for such\r
+ * an intermediary object.\r
+ *\r
+ * A notification sent to a task can optionally perform an action, such as\r
+ * update, overwrite or increment the task's notification value.  In that way\r
+ * task notifications can be used to send data to a task, or be used as light\r
+ * weight and fast binary or counting semaphores.\r
+ *\r
+ * ulTaskNotifyTake() is intended for use when a task notification is used as a\r
+ * faster and lighter weight binary or counting semaphore alternative.  Actual\r
+ * FreeRTOS semaphores are taken using the xSemaphoreTake() API function, the\r
+ * equivalent action that instead uses a task notification is\r
+ * ulTaskNotifyTake().\r
+ *\r
+ * When a task is using its notification value as a binary or counting semaphore\r
+ * other tasks should send notifications to it using the xTaskNotifyGive()\r
+ * macro, or xTaskNotify() function with the eAction parameter set to\r
+ * eIncrement.\r
+ *\r
+ * ulTaskNotifyTake() can either clear the task's notification value to\r
+ * zero on exit, in which case the notification value acts like a binary\r
+ * semaphore, or decrement the task's notification value on exit, in which case\r
+ * the notification value acts like a counting semaphore.\r
+ *\r
+ * A task can use ulTaskNotifyTake() to [optionally] block to wait for a\r
+ * the task's notification value to be non-zero.  The task does not consume any\r
+ * CPU time while it is in the Blocked state.\r
+ *\r
+ * Where as xTaskNotifyWait() will return when a notification is pending,\r
+ * ulTaskNotifyTake() will return when the task's notification value is\r
+ * not zero.\r
+ *\r
+ * See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.\r
+ *\r
+ * @param xClearCountOnExit if xClearCountOnExit is pdFALSE then the task's\r
+ * notification value is decremented when the function exits.  In this way the\r
+ * notification value acts like a counting semaphore.  If xClearCountOnExit is\r
+ * not pdFALSE then the task's notification value is cleared to zero when the\r
+ * function exits.  In this way the notification value acts like a binary\r
+ * semaphore.\r
+ *\r
+ * @param xTicksToWait The maximum amount of time that the task should wait in\r
+ * the Blocked state for the task's notification value to be greater than zero,\r
+ * should the count not already be greater than zero when\r
+ * ulTaskNotifyTake() was called.  The task will not consume any processing\r
+ * time while it is in the Blocked state.  This is specified in kernel ticks,\r
+ * the macro pdMS_TO_TICSK( value_in_ms ) can be used to convert a time\r
+ * specified in milliseconds to a time specified in ticks.\r
+ *\r
+ * @return The task's notification count before it is either cleared to zero or\r
+ * decremented (see the xClearCountOnExit parameter).\r
+ *\r
+ * \defgroup ulTaskNotifyTake ulTaskNotifyTake\r
+ * \ingroup TaskNotifications\r
+ */\r
+uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task. h\r
+ * <PRE>BaseType_t xTaskNotifyStateClear( TaskHandle_t xTask );</pre>\r
+ *\r
+ * If the notification state of the task referenced by the handle xTask is\r
+ * eNotified, then set the task's notification state to eNotWaitingNotification.\r
+ * The task's notification value is not altered.  Set xTask to NULL to clear the\r
+ * notification state of the calling task.\r
+ *\r
+ * @return pdTRUE if the task's notification state was set to\r
+ * eNotWaitingNotification, otherwise pdFALSE.\r
+ * \defgroup xTaskNotifyStateClear xTaskNotifyStateClear\r
+ * \ingroup TaskNotifications\r
+ */\r
+BaseType_t xTaskNotifyStateClear( TaskHandle_t xTask );\r
+\r
+/**\r
+* task. h\r
+* <PRE>uint32_t ulTaskNotifyValueClear( TaskHandle_t xTask, uint32_t ulBitsToClear );</pre>\r
+*\r
+* Clears the bits specified by the ulBitsToClear bit mask in the notification\r
+* value of the task referenced by xTask.\r
+*\r
+* Set ulBitsToClear to to 0xffffffff (UINT_MAX on 32-bit architectures) to clear\r
+* the notification value to 0.  Set ulBitsToClear to 0 to query the task's\r
+* notification value without clearing any bits.\r
+*\r
+* @return The value of the target task's notification value before the bits\r
+* specified by ulBitsToClear were cleared.\r
+* \defgroup ulTaskNotifyValueClear ulTaskNotifyValueClear\r
+* \ingroup TaskNotifications\r
+*/\r
+uint32_t ulTaskNotifyValueClear( TaskHandle_t xTask, uint32_t ulBitsToClear ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task.h\r
+ * <pre>void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut )</pre>\r
+ *\r
+ * Capture the current time for future use with xTaskCheckForTimeOut().\r
+ *\r
+ * @param pxTimeOut Pointer to a timeout object into which the current time\r
+ * is to be captured.  The captured time includes the tick count and the number\r
+ * of times the tick count has overflowed since the system first booted.\r
+ * \defgroup vTaskSetTimeOutState vTaskSetTimeOutState\r
+ * \ingroup TaskCtrl\r
+ */\r
+void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+ * task.h\r
+ * <pre>BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait );</pre>\r
+ *\r
+ * Determines if pxTicksToWait ticks has passed since a time was captured\r
+ * using a call to vTaskSetTimeOutState().  The captured time includes the tick\r
+ * count and the number of times the tick count has overflowed.\r
+ *\r
+ * @param pxTimeOut The time status as captured previously using\r
+ * vTaskSetTimeOutState. If the timeout has not yet occurred, it is updated\r
+ * to reflect the current time status.\r
+ * @param pxTicksToWait The number of ticks to check for timeout i.e. if\r
+ * pxTicksToWait ticks have passed since pxTimeOut was last updated (either by\r
+ * vTaskSetTimeOutState() or xTaskCheckForTimeOut()), the timeout has occurred.\r
+ * If the timeout has not occurred, pxTIcksToWait is updated to reflect the\r
+ * number of remaining ticks.\r
+ *\r
+ * @return If timeout has occurred, pdTRUE is returned. Otherwise pdFALSE is\r
+ * returned and pxTicksToWait is updated to reflect the number of remaining\r
+ * ticks.\r
+ *\r
+ * @see https://www.freertos.org/xTaskCheckForTimeOut.html\r
+ *\r
+ * Example Usage:\r
+ * <pre>\r
+       // Driver library function used to receive uxWantedBytes from an Rx buffer\r
+       // that is filled by a UART interrupt. If there are not enough bytes in the\r
+       // Rx buffer then the task enters the Blocked state until it is notified that\r
+       // more data has been placed into the buffer. If there is still not enough\r
+       // data then the task re-enters the Blocked state, and xTaskCheckForTimeOut()\r
+       // is used to re-calculate the Block time to ensure the total amount of time\r
+       // spent in the Blocked state does not exceed MAX_TIME_TO_WAIT. This\r
+       // continues until either the buffer contains at least uxWantedBytes bytes,\r
+       // or the total amount of time spent in the Blocked state reaches\r
+       // MAX_TIME_TO_WAIT – at which point the task reads however many bytes are\r
+       // available up to a maximum of uxWantedBytes.\r
+\r
+       size_t xUART_Receive( uint8_t *pucBuffer, size_t uxWantedBytes )\r
+       {\r
+       size_t uxReceived = 0;\r
+       TickType_t xTicksToWait = MAX_TIME_TO_WAIT;\r
+       TimeOut_t xTimeOut;\r
+\r
+               // Initialize xTimeOut.  This records the time at which this function\r
+               // was entered.\r
+               vTaskSetTimeOutState( &xTimeOut );\r
+\r
+               // Loop until the buffer contains the wanted number of bytes, or a\r
+               // timeout occurs.\r
+               while( UART_bytes_in_rx_buffer( pxUARTInstance ) < uxWantedBytes )\r
+               {\r
+                       // The buffer didn't contain enough data so this task is going to\r
+                       // enter the Blocked state. Adjusting xTicksToWait to account for\r
+                       // any time that has been spent in the Blocked state within this\r
+                       // function so far to ensure the total amount of time spent in the\r
+                       // Blocked state does not exceed MAX_TIME_TO_WAIT.\r
+                       if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) != pdFALSE )\r
+                       {\r
+                               //Timed out before the wanted number of bytes were available,\r
+                               // exit the loop.\r
+                               break;\r
+                       }\r
+\r
+                       // Wait for a maximum of xTicksToWait ticks to be notified that the\r
+                       // receive interrupt has placed more data into the buffer.\r
+                       ulTaskNotifyTake( pdTRUE, xTicksToWait );\r
+               }\r
+\r
+               // Attempt to read uxWantedBytes from the receive buffer into pucBuffer.\r
+               // The actual number of bytes read (which might be less than\r
+               // uxWantedBytes) is returned.\r
+               uxReceived = UART_read_from_receive_buffer( pxUARTInstance,\r
+                                                                                                       pucBuffer,\r
+                                                                                                       uxWantedBytes );\r
+\r
+               return uxReceived;\r
+       }\r
+ </pre>\r
+ * \defgroup xTaskCheckForTimeOut xTaskCheckForTimeOut\r
+ * \ingroup TaskCtrl\r
+ */\r
+BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ) PRIVILEGED_FUNCTION;\r
 \r
 /*-----------------------------------------------------------\r
  * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES\r
@@ -1361,7 +2368,7 @@ void vTaskGetRunTimeStats( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;
  *   + Time slicing is in use and there is a task of equal priority to the\r
  *     currently running task.\r
  */\r
-portBASE_TYPE xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;\r
+BaseType_t xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS AN\r
@@ -1376,15 +2383,26 @@ portBASE_TYPE xTaskIncrementTick( 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
+ * portTICK_PERIOD_MS can be used to convert kernel ticks into a real time\r
  * period.\r
  */\r
-void vTaskPlaceOnEventList( xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
+void vTaskPlaceOnEventList( List_t * const pxEventList, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
+void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, const TickType_t xItemValue, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS AN\r
@@ -1396,10 +2414,8 @@ void vTaskPlaceOnEventList( xList * const pxEventList, portTickType xTicksToWait
  * 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( xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
+void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS AN\r
@@ -1410,13 +2426,23 @@ void vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xT
  * 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()/vTaskRemoveFromUnorderedEventList() 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
+ * vTaskRemoveFromUnorderedEventList() 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
+BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) PRIVILEGED_FUNCTION;\r
+void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, const TickType_t xItemValue ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS ONLY\r
@@ -1426,23 +2452,18 @@ signed portBASE_TYPE xTaskRemoveFromEventList( const xList * const pxEventList )
  * Sets the pointer to the current TCB to the TCB of the highest priority task\r
  * that is ready to run.\r
  */\r
-void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION;\r
+portDONT_DISCARD void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
- * Return the handle of the calling task.\r
+ * THESE FUNCTIONS MUST NOT BE USED FROM APPLICATION CODE.  THEY ARE USED BY\r
+ * THE EVENT BITS MODULE.\r
  */\r
-xTaskHandle xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION;\r
+TickType_t uxTaskResetEventItemValue( void ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
- * Capture the current time status for future reference.\r
- */\r
-void vTaskSetTimeOutState( xTimeOutType * const pxTimeOut ) PRIVILEGED_FUNCTION;\r
-\r
-/*\r
- * Compare the time status now with that previously captured to see if the\r
- * timeout has expired.\r
+ * Return the handle of the calling task.\r
  */\r
-portBASE_TYPE xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType * const pxTicksToWait ) PRIVILEGED_FUNCTION;\r
+TaskHandle_t xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * Shortcut used by the queue implementation to prevent unnecessary call to\r
@@ -1454,47 +2475,66 @@ void vTaskMissedYield( void ) PRIVILEGED_FUNCTION;
  * Returns the scheduler state as taskSCHEDULER_RUNNING,\r
  * taskSCHEDULER_NOT_STARTED or taskSCHEDULER_SUSPENDED.\r
  */\r
-portBASE_TYPE xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION;\r
+BaseType_t xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * 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
+BaseType_t xTaskPriorityInherit( TaskHandle_t 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
+BaseType_t xTaskPriorityDisinherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
- * Generic version of the task creation function which is in turn called by the\r
- * xTaskCreate() and xTaskCreateRestricted() macros.\r
+ * If a higher priority task attempting to obtain a mutex caused a lower\r
+ * priority task to inherit the higher priority task's priority - but the higher\r
+ * priority task then timed out without obtaining the mutex, then the lower\r
+ * priority task will disinherit the priority again - but only down as far as\r
+ * the highest priority task that is still waiting for the mutex (if there were\r
+ * more than one task waiting for the mutex).\r
  */\r
-signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions ) PRIVILEGED_FUNCTION;\r
+void vTaskPriorityDisinheritAfterTimeout( TaskHandle_t const pxMutexHolder, UBaseType_t uxHighestPriorityWaitingTask ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * Get the uxTCBNumber assigned to the task referenced by the xTask parameter.\r
  */\r
-unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );\r
+UBaseType_t uxTaskGetTaskNumber( TaskHandle_t 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( TaskHandle_t xTask, const UBaseType_t 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( const TickType_t xTicksToJump ) PRIVILEGED_FUNCTION;\r
+\r
+/* Correct the tick count value after the application code has held\r
+interrupts disabled for an extended period.  xTicksToCatchUp is the number\r
+of tick interrupts that have been missed due to interrupts being disabled.\r
+Its value is not computed automatically, so must be computed by the\r
+application writer.\r
+\r
+This function is similar to vTaskStepTick(), however, unlike\r
+vTaskStepTick(), xTaskCatchUpTicks() may move the tick count forward past a\r
+time at which a task should be removed from the blocked state.  That means\r
+tasks may have to be removed from the blocked state as the tick count is\r
+moved. */\r
+BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
+ * Only available 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
@@ -1507,7 +2547,20 @@ 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
+/*\r
+ * For internal use only.  Increment the mutex held count when a mutex is\r
+ * taken and return the handle of the task that has taken the mutex.\r
+ */\r
+TaskHandle_t pvTaskIncrementMutexHeldCount( void ) PRIVILEGED_FUNCTION;\r
+\r
+/*\r
+ * For internal use only.  Same as vTaskSetTimeOutState(), but without a critial\r
+ * section.\r
+ */\r
+void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION;\r
+\r
 \r
 #ifdef __cplusplus\r
 }\r