]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/include/task.h
Minor updates relating to formatting and comments only.
[freertos] / FreeRTOS / Source / include / task.h
index 5c0011cc9f11621c5c4429943c6deb26c24125c5..3f1e8b87a44747c68cc6a28c46a83b6336dd1d77 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    FreeRTOS V8.2.0 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\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
+       ***************************************************************************\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
 \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
      *                                                                       *\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
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+       the FAQ page "My application does not run, what could be wrong?".  Have you\r
+       defined configASSERT()?\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
+       http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+       embedded software for free we request you assist our global community by\r
+       participating in the support forum.\r
 \r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
-    license and Real Time Engineers Ltd. contact details.\r
+       http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+       be as productive as possible as early as possible.  Now you can receive\r
+       FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+       Ltd, and the world's leading authority on the world's leading RTOS.\r
 \r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
@@ -82,7 +56,7 @@
     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
+    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
@@ -111,7 +85,7 @@ extern "C" {
  * MACROS AND DEFINITIONS\r
  *----------------------------------------------------------*/\r
 \r
-#define tskKERNEL_VERSION_NUMBER "V8.2.0rc1"\r
+#define tskKERNEL_VERSION_NUMBER "V8.2.0"\r
 #define tskKERNEL_VERSION_MAJOR 8\r
 #define tskKERNEL_VERSION_MINOR 2\r
 #define tskKERNEL_VERSION_BUILD 0\r
@@ -147,7 +121,7 @@ typedef enum
 /* 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
@@ -240,6 +214,7 @@ typedef enum
  * \ingroup SchedulerControl\r
  */\r
 #define taskENTER_CRITICAL()           portENTER_CRITICAL()\r
+#define taskENTER_CRITICAL_FROM_ISR( x ) portSET_INTERRUPT_MASK_FROM_ISR( x )\r
 \r
 /**\r
  * task. h\r
@@ -254,7 +229,7 @@ typedef enum
  * \ingroup SchedulerControl\r
  */\r
 #define taskEXIT_CRITICAL()                    portEXIT_CRITICAL()\r
-\r
+#define taskEXIT_CRITICAL_FROM_ISR() portCLEAR_INTERRUPT_MASK_FROM_ISR()\r
 /**\r
  * task. h\r
  *\r
@@ -1184,6 +1159,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 );\r
+       void *pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex );\r
+\r
+#endif\r
+\r
 /**\r
  * task.h\r
  * <pre>BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );</pre>\r
@@ -1410,8 +1397,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 +1420,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
@@ -1490,8 +1474,8 @@ BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAct
  * 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 +1500,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
@@ -1580,10 +1561,10 @@ BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNo
 \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 +1586,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 +1632,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 );\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 +1665,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
@@ -1704,10 +1682,10 @@ BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, BaseType_t ulBitsToCl
 \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 +1703,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 );\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 +1759,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 +1791,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