]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/include/task.h
First pass at updating from MISRA 2004 to MISRA 2012:
[freertos] / FreeRTOS / Source / include / task.h
index 5c0011cc9f11621c5c4429943c6deb26c24125c5..7d0bf1fc5ab58bed5c372f6865490777828e7da7 100644 (file)
@@ -1,97 +1,29 @@
 /*\r
-    FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
-    All rights reserved\r
-\r
-    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\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     !<<\r
-    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
-    >>!   obliged to provide the source code for proprietary components     !<<\r
-    >>!   outside of the FreeRTOS 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 on 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?".  Have you defined configASSERT()?  *\r
-     *                                                                       *\r
-     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
-     *                                                                       *\r
-    ***************************************************************************\r
-\r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    FreeRTOS provides completely free yet professionally developed,    *\r
-     *    robust, strictly quality controlled, supported, and cross          *\r
-     *    platform software that is more than just the market leader, it     *\r
-     *    is the industry's de facto standard.                               *\r
-     *                                                                       *\r
-     *    Help yourself get started quickly while simultaneously helping     *\r
-     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
-     *    tutorial book, reference manual, or both:                          *\r
-     *    http://www.FreeRTOS.org/Documentation                              *\r
-     *                                                                       *\r
-    ***************************************************************************\r
-\r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *   Investing in training allows your team to be as productive as       *\r
-     *   possible as early as possible, lowering your overall development    *\r
-     *   cost, and enabling you to bring a more robust product to market     *\r
-     *   earlier than would otherwise be possible.  Richard Barry is both    *\r
-     *   the architect and key author of FreeRTOS, and so also the world's   *\r
-     *   leading authority on what is the world's most popular real time     *\r
-     *   kernel for deeply embedded MCU designs.  Obtaining your training    *\r
-     *   from Richard ensures your team will gain directly from his in-depth *\r
-     *   product knowledge and years of usage experience.  Contact Real Time *\r
-     *   Engineers Ltd to enquire about the FreeRTOS Masterclass, presented  *\r
-     *   by Richard Barry:  http://www.FreeRTOS.org/contact\r
-     *                                                                       *\r
-    ***************************************************************************\r
-\r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    You are receiving this top quality software for free.  Please play *\r
-     *    fair and reciprocate by reporting any suspected issues and         *\r
-     *    participating in the community forum:                              *\r
-     *    http://www.FreeRTOS.org/support                                    *\r
-     *                                                                       *\r
-     *    Thank you!                                                         *\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.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
-    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
-\r
-    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
-    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
-    licenses offer ticketed support, indemnification and commercial 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.0.1\r
+ * Copyright (C) 2017 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
@@ -111,10 +43,10 @@ extern "C" {
  * MACROS AND DEFINITIONS\r
  *----------------------------------------------------------*/\r
 \r
-#define tskKERNEL_VERSION_NUMBER "V8.2.0rc1"\r
-#define tskKERNEL_VERSION_MAJOR 8\r
-#define tskKERNEL_VERSION_MINOR 2\r
-#define tskKERNEL_VERSION_BUILD 0\r
+#define tskKERNEL_VERSION_NUMBER "V10.0.1"\r
+#define tskKERNEL_VERSION_MAJOR 10\r
+#define tskKERNEL_VERSION_MINOR 0\r
+#define tskKERNEL_VERSION_BUILD 1\r
 \r
 /**\r
  * task. h\r
@@ -126,7 +58,8 @@ extern "C" {
  * \defgroup TaskHandle_t TaskHandle_t\r
  * \ingroup Tasks\r
  */\r
-typedef void * TaskHandle_t;\r
+struct xTaskControlBlock;\r
+typedef struct xTaskControlBlock* TaskHandle_t;\r
 \r
 /*\r
  * Defines the prototype to which the application task hook function must\r
@@ -141,13 +74,14 @@ 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,                                      /* Notify the task without updating its notify value. */\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
@@ -185,6 +119,9 @@ typedef struct xTASK_PARAMETERS
        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
@@ -198,7 +135,8 @@ typedef struct xTASK_STATUS
        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
-       uint16_t 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
+       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
@@ -209,7 +147,6 @@ 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
  * Defines the priority used by the idle task.  This must not be modified.\r
  *\r
@@ -240,6 +177,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
@@ -254,7 +192,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
@@ -293,7 +231,7 @@ is used in assert() statements. */
  BaseType_t xTaskCreate(\r
                                                          TaskFunction_t pvTaskCode,\r
                                                          const char * const pcName,\r
-                                                         uint16_t usStackDepth,\r
+                                                         configSTACK_DEPTH_TYPE usStackDepth,\r
                                                          void *pvParameters,\r
                                                          UBaseType_t uxPriority,\r
                                                          TaskHandle_t *pvCreatedTask\r
@@ -301,6 +239,19 @@ is used in assert() statements. */
  *\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
@@ -367,13 +318,139 @@ is used in assert() statements. */
  * \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 pdPASS is returned.  If either pxStackBuffer or pxTaskBuffer\r
+ * are NULL then the task will not be created and\r
+ * errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY 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
  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
  *\r
@@ -381,6 +458,9 @@ is used in assert() statements. */
  * 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
@@ -436,7 +516,97 @@ TaskHandle_t xHandle;
  * \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
+ 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
@@ -640,7 +810,32 @@ void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xT
 \r
 /**\r
  * task. h\r
- * <pre>UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask );</pre>\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>UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask );</pre>\r
  *\r
  * INCLUDE_uxTaskPriorityGet must be defined as 1 for this function to be available.\r
  * See the configuration section for more information.\r
@@ -683,15 +878,15 @@ void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xT
  * \defgroup uxTaskPriorityGet uxTaskPriorityGet\r
  * \ingroup TaskCtrl\r
  */\r
-UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
- * <pre>UBaseType_t uxTaskPriorityGetFromISR( TaskHandle_t 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( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+UBaseType_t uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * task. h\r
@@ -711,6 +906,62 @@ UBaseType_t uxTaskPriorityGetFromISR( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
  */\r
 eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
 \r
+/**\r
+ * task. h\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
@@ -1123,17 +1374,32 @@ UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;
 \r
 /**\r
  * task. h\r
- * <PRE>char *pcTaskGetTaskName( TaskHandle_t 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
  * xTaskToQuery.  A task can query its own name by either passing in its own\r
- * handle, or by setting xTaskToQuery to NULL.  INCLUDE_pcTaskGetTaskName must be\r
- * set to 1 in FreeRTOSConfig.h for pcTaskGetTaskName() to be available.\r
+ * handle, or by setting xTaskToQuery to NULL.\r
  *\r
- * \defgroup pcTaskGetTaskName pcTaskGetTaskName\r
+ * \defgroup pcTaskGetName pcTaskGetName\r
  * \ingroup TaskUtils\r
  */\r
-char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\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 pcTaskGetHandle pcTaskGetHandle\r
+ * \ingroup TaskUtils\r
+ */\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
@@ -1184,6 +1450,18 @@ constant. */
        #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>BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );</pre>\r
@@ -1204,7 +1482,7 @@ BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t 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
-TaskHandle_t xTaskGetIdleTaskHandle( void );\r
+TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for\r
@@ -1303,7 +1581,7 @@ TaskHandle_t xTaskGetIdleTaskHandle( void );
        }\r
        </pre>\r
  */\r
-UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const 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
@@ -1410,8 +1688,8 @@ void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e9
  * task. h\r
  * <PRE>BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction );</PRE>\r
  *\r
- * configUSE_TASK_NOTIFICATIONS must be defined as 1 for this function to be\r
- * available.\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
@@ -1433,14 +1711,11 @@ void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e9
  * (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 xTaskNotifyTake() to [optionally] block\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 of when\r
- * it is best to use a task notification to send an event to a task compared to\r
- * when it is best to use an intermediary object (such as a queue, semaphore,\r
- * mutex or event group) to send an event to a task.\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
@@ -1453,30 +1728,34 @@ void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e9
  * @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
+ * 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
- *     eIncrement -\r
- *     The task's notification value is incremented.  ulValue is not used and\r
- *     xTaskNotify() always returns pdPASS in this case.\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
- *     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
+ * 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
- *     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
+ * 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
- *     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
+ *  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
@@ -1484,14 +1763,16 @@ void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e9
  * \defgroup xTaskNotify xTaskNotify\r
  * \ingroup TaskNotifications\r
  */\r
-BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction );\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 defined as 1 for this function to be\r
- * available.\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
@@ -1516,14 +1797,11 @@ BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAct
  * (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 xTaskNotifyTake() to [optionally] block\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 of when\r
- * it is best to use a task notification to send an event to a task compared to\r
- * when it is best to use an intermediary object (such as a queue, semaphore,\r
- * mutex or event group) to send an event to a task.\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
@@ -1536,30 +1814,30 @@ BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAct
  * @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
+ * 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
+ * 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
+ * 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
+ * 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
+ * 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
@@ -1576,14 +1854,16 @@ BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAct
  * \defgroup xTaskNotify xTaskNotify\r
  * \ingroup TaskNotifications\r
  */\r
-BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken );\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, BaseType_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait );</pre>\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 defined as 1 for this function to be\r
- * available.\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
@@ -1605,14 +1885,11 @@ BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNo
  * (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 xTaskNotifyTake() to [optionally] block\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 of when\r
- * it is best to use a task notification to send an event to a task compared to\r
- * when it is best to use an intermediary object (such as a queue, semaphore,\r
- * mutex or event group) to send an event to a task.\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
@@ -1654,14 +1931,14 @@ BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNo
  * \defgroup xTaskNotifyWait xTaskNotifyWait\r
  * \ingroup TaskNotifications\r
  */\r
-BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, BaseType_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait );\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 xTaskHandle, BaseType_t *pxHigherPriorityTaskWoken );\r
+ * <PRE>BaseType_t xTaskNotifyGive( TaskHandle_t xTaskToNotify );</PRE>\r
  *\r
- * configUSE_TASK_NOTIFICATIONS must be defined as 1 for this macro to be\r
- * available.\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
@@ -1687,7 +1964,7 @@ BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, BaseType_t ulBitsToCl
  * 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
+ * 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
@@ -1700,14 +1977,14 @@ BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, BaseType_t ulBitsToCl
  * \defgroup xTaskNotifyGive xTaskNotifyGive\r
  * \ingroup TaskNotifications\r
  */\r
-#define xTaskNotifyGive( xTaskToNotify ) xTaskNotify( ( xTaskToNotify ), 0, eIncrement );\r
+#define xTaskNotifyGive( xTaskToNotify ) xTaskGenericNotify( ( xTaskToNotify ), ( 0 ), eIncrement, NULL )\r
 \r
 /**\r
  * task. h\r
- * <PRE>BaseType_t xTaskNotifyGiveFromISR( TaskHandle_t xTaskHandle, BaseType_t *pxHigherPriorityTaskWoken );\r
+ * <PRE>void vTaskNotifyGiveFromISR( TaskHandle_t xTaskHandle, BaseType_t *pxHigherPriorityTaskWoken );\r
  *\r
- * configUSE_TASK_NOTIFICATIONS must be defined as 1 for this macro to be\r
- * available.\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
@@ -1725,47 +2002,44 @@ BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, BaseType_t ulBitsToCl
  * 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
- * xTaskNotifyGiveFromISR() is a helper macro intended for use when task\r
- * notifications are used as light weight and faster binary or counting\r
- * semaphore equivalents.  Actual FreeRTOS semaphores are given from an ISR\r
- * using the xSemaphoreGiveFromISR() API function, the equivalent action that\r
- * instead uses a task notification is xTaskNotifyGiveFromISR().\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
+ * 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  xTaskNotifyGiveFromISR() will set\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
- * xTaskNotifyGiveFromISR() sets this value to pdTRUE then a context switch\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
- * @return xTaskNotifyGiveFromISR() is a macro that calls xTaskNotifyFromISR()\r
- * with the eAction parameter set to eIncrement - so pdPASS is always returned.\r
- *\r
  * \defgroup xTaskNotifyWait xTaskNotifyWait\r
  * \ingroup TaskNotifications\r
  */\r
-BaseType_t xTaskNotifyGiveFromISR( TaskHandle_t xTaskToNotify, BaseType_t *pxHigherPriorityTaskWoken );\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 defined as 1 for this function to be\r
- * available.\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
@@ -1784,30 +2058,27 @@ BaseType_t xTaskNotifyGiveFromISR( TaskHandle_t xTaskToNotify, BaseType_t *pxHig
  * 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
- * xTaskNotifyTake().\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
- * xTaskNotifyTake() can either clear the task's notification value to\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 xTaskNotifyTake() to [optionally] block to wait for a\r
- * the tasks notification value to be non-zero.  The task does not consume any\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
- * xTaskNotifyTake() will return when the task's notification value is\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 of when\r
- * it is best to use a task notification to send an event to a task compared to\r
- * when it is best to use an intermediary object (such as a queue, semaphore,\r
- * mutex or event group) to send an event to a task.\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
@@ -1819,7 +2090,7 @@ BaseType_t xTaskNotifyGiveFromISR( TaskHandle_t xTaskToNotify, BaseType_t *pxHig
  * @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
- * xTaskNotifyTake() was called.  The task will not consume any processing\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
@@ -1830,7 +2101,23 @@ BaseType_t xTaskNotifyGiveFromISR( TaskHandle_t xTaskToNotify, BaseType_t *pxHig
  * \defgroup ulTaskNotifyTake ulTaskNotifyTake\r
  * \ingroup TaskNotifications\r
  */\r
-uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait );\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
  * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES\r
@@ -1898,7 +2185,7 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, const TickType_t xIte
  * indefinitely, whereas vTaskPlaceOnEventList() does.\r
  *\r
  */\r
-void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, const TickType_t 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
@@ -1909,14 +2196,14 @@ void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, const TickType
  * 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()/xTaskRemoveFromUnorderedEventList() will be called\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
- * xTaskRemoveFromUnorderedEventList() is used when the event list is not\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
@@ -1925,7 +2212,7 @@ void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, const TickType
  * making the call, otherwise pdFALSE.\r
  */\r
 BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) PRIVILEGED_FUNCTION;\r
-BaseType_t xTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, const TickType_t xItemValue ) 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
@@ -1975,7 +2262,7 @@ BaseType_t xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION;
  * Raises the priority of the mutex holder to that of the calling task should\r
  * the mutex holder have a priority less than the calling task.\r
  */\r
-void vTaskPriorityInherit( TaskHandle_t 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
@@ -1984,10 +2271,14 @@ void vTaskPriorityInherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTIO
 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
-BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\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
@@ -2030,7 +2321,14 @@ eSleepModeStatus eTaskConfirmSleepModeStatus( void ) PRIVILEGED_FUNCTION;
  * 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
-void *pvTaskIncrementMutexHeldCount( void );\r
+void *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