]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/include/timers.h
commit 9f316c246baafa15c542a5aea81a94f26e3d6507
[freertos] / FreeRTOS / Source / include / timers.h
index 4fc54cb4bf3c6a4c90dda3338bdce6bdb33c2d94..205ad62fcb4afddab6afe3ac0fe7559b61a8d0dc 100644 (file)
@@ -1,71 +1,29 @@
 /*\r
-    FreeRTOS V9.0.0rc2 - Copyright (C) 2016 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
-    ***************************************************************************\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
-    ***************************************************************************\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
-    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
-    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/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
-    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.3.0\r
+ * Copyright (C) 2020 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 TIMERS_H\r
        #error "include FreeRTOS.h must appear in source files before include timers.h"\r
 #endif\r
 \r
-/*lint -e537 This headers are only multiply included if the application code\r
+/*lint -save -e537 This headers are only multiply included if the application code\r
 happens to also be including task.h. */\r
 #include "task.h"\r
-/*lint +e537 */\r
+/*lint -restore */\r
 \r
 #ifdef __cplusplus\r
 extern "C" {\r
@@ -115,7 +73,8 @@ or interrupt version of the queue send function should be used. */
  * reference the subject timer in calls to other software timer API functions\r
  * (for example, xTimerStart(), xTimerReset(), etc.).\r
  */\r
-typedef void * TimerHandle_t;\r
+struct tmrTimerControl; /* The old naming convention is used to prevent breaking kernel aware debuggers. */\r
+typedef struct tmrTimerControl * TimerHandle_t;\r
 \r
 /*\r
  * Defines the prototype to which timer callback functions must conform.\r
@@ -162,7 +121,7 @@ typedef void (*PendedFunction_t)( void *, uint32_t );
  * after 100 ticks, then xTimerPeriodInTicks should be set to 100.\r
  * Alternatively, if the timer must expire after 500ms, then xPeriod can be set\r
  * to ( 500 / portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than or\r
- * equal to 1000.\r
+ * equal to 1000.  Time timer period must be greater than 0.\r
  *\r
  * @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will\r
  * expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter.\r
@@ -179,9 +138,9 @@ typedef void (*PendedFunction_t)( void *, uint32_t );
  * which is    "void vCallbackFunction( TimerHandle_t xTimer );".\r
  *\r
  * @return If the timer is successfully created then a handle to the newly\r
- * created timer is returned.  If the timer cannot be created (because either\r
- * there is insufficient FreeRTOS heap remaining to allocate the timer\r
- * structures, or the timer period was set to 0) then NULL is returned.\r
+ * created timer is returned.  If the timer cannot be created because there is\r
+ * insufficient FreeRTOS heap remaining to allocate the timer\r
+ * structures then NULL is returned.\r
  *\r
  * Example usage:\r
  * @verbatim\r
@@ -258,7 +217,7 @@ typedef void (*PendedFunction_t)( void *, uint32_t );
  *\r
  *     // Starting the scheduler will start the timers running as they have already\r
  *     // been set into the active state.\r
- *     xTaskStartScheduler();\r
+ *     vTaskStartScheduler();\r
  *\r
  *     // Should not reach here.\r
  *     for( ;; );\r
@@ -266,11 +225,11 @@ typedef void (*PendedFunction_t)( void *, uint32_t );
  * @endverbatim\r
  */\r
 #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )\r
-       TimerHandle_t xTimerCreate(     const char * const pcTimerName,\r
+       TimerHandle_t xTimerCreate(     const char * const pcTimerName,                 /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
                                                                const TickType_t xTimerPeriodInTicks,\r
                                                                const UBaseType_t uxAutoReload,\r
                                                                void * const pvTimerID,\r
-                                                               TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+                                                               TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION;\r
 #endif\r
 \r
 /**\r
@@ -308,7 +267,7 @@ typedef void (*PendedFunction_t)( void *, uint32_t );
  * after 100 ticks, then xTimerPeriodInTicks should be set to 100.\r
  * Alternatively, if the timer must expire after 500ms, then xPeriod can be set\r
  * to ( 500 / portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than or\r
- * equal to 1000.\r
+ * equal to 1000.  The timer period must be greater than 0.\r
  *\r
  * @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will\r
  * expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter.\r
@@ -388,7 +347,7 @@ typedef void (*PendedFunction_t)( void *, uint32_t );
  *\r
  *     // Starting the scheduler will start the timers running as they have already\r
  *     // been set into the active state.\r
- *     xTaskStartScheduler();\r
+ *     vTaskStartScheduler();\r
  *\r
  *     // Should not reach here.\r
  *     for( ;; );\r
@@ -396,12 +355,12 @@ typedef void (*PendedFunction_t)( void *, uint32_t );
  * @endverbatim\r
  */\r
 #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
-       TimerHandle_t xTimerCreateStatic(       const char * const pcTimerName,\r
+       TimerHandle_t xTimerCreateStatic(       const char * const pcTimerName,                 /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
                                                                                const TickType_t xTimerPeriodInTicks,\r
                                                                                const UBaseType_t uxAutoReload,\r
                                                                                void * const pvTimerID,\r
                                                                                TimerCallbackFunction_t pxCallbackFunction,\r
-                                                                               StaticTimer_t *pxTimerBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+                                                                               StaticTimer_t *pxTimerBuffer ) PRIVILEGED_FUNCTION;\r
 #endif /* configSUPPORT_STATIC_ALLOCATION */\r
 \r
 /**\r
@@ -819,7 +778,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
  *\r
  *     // Starting the scheduler will start the timer running as it has already\r
  *     // been set into the active state.\r
- *     xTaskStartScheduler();\r
+ *     vTaskStartScheduler();\r
  *\r
  *     // Should not reach here.\r
  *     for( ;; );\r
@@ -1272,6 +1231,37 @@ BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvPar
  */\r
 const char * pcTimerGetName( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
 \r
+/**\r
+ * void vTimerSetReloadMode( TimerHandle_t xTimer, const UBaseType_t uxAutoReload );\r
+ *\r
+ * Updates a timer to be either an auto-reload timer, in which case the timer\r
+ * automatically resets itself each time it expires, or a one-shot timer, in\r
+ * which case the timer will only expire once unless it is manually restarted.\r
+ *\r
+ * @param xTimer The handle of the timer being updated.\r
+ *\r
+ * @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will\r
+ * expire repeatedly with a frequency set by the timer's period (see the\r
+ * xTimerPeriodInTicks parameter of the xTimerCreate() API function).  If\r
+ * uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and\r
+ * enter the dormant state after it expires.\r
+ */\r
+void vTimerSetReloadMode( TimerHandle_t xTimer, const UBaseType_t uxAutoReload ) PRIVILEGED_FUNCTION;\r
+\r
+/**\r
+* UBaseType_t uxTimerGetReloadMode( TimerHandle_t xTimer );\r
+*\r
+* Queries a timer to determine if it is an auto-reload timer, in which case the timer\r
+* automatically resets itself each time it expires, or a one-shot timer, in\r
+* which case the timer will only expire once unless it is manually restarted.\r
+*\r
+* @param xTimer The handle of the timer being queried.\r
+*\r
+* @return If the timer is an auto-reload timer then pdTRUE is returned, otherwise\r
+* pdFALSE is returned.\r
+*/\r
+UBaseType_t uxTimerGetReloadMode( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;\r
+\r
 /**\r
  * TickType_t xTimerGetPeriod( TimerHandle_t xTimer );\r
  *\r
@@ -1305,6 +1295,11 @@ TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
 BaseType_t xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;\r
 BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
 \r
+#if( configUSE_TRACE_FACILITY == 1 )\r
+       void vTimerSetTimerNumber( TimerHandle_t xTimer, UBaseType_t uxTimerNumber ) PRIVILEGED_FUNCTION;\r
+       UBaseType_t uxTimerGetTimerNumber( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;\r
+#endif\r
+\r
 #ifdef __cplusplus\r
 }\r
 #endif\r