timers.h
Go to the documentation of this file.
1 /*
2  * FreeRTOS Kernel V10.0.0
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software. If you wish to use our Amazon
14  * FreeRTOS name, please do so in a fair use way that does not cause confusion.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  * http://www.FreeRTOS.org
24  * http://aws.amazon.com/freertos
25  *
26  * 1 tab == 4 spaces!
27  */
28 
29 
30 #ifndef TIMERS_H
31 #define TIMERS_H
32 
33 #ifndef INC_FREERTOS_H
34  #error "include FreeRTOS.h must appear in source files before include timers.h"
35 #endif
36 
37 /*lint -save -e537 This headers are only multiply included if the application code
38 happens to also be including task.h. */
39 #include "task.h"
40 /*lint -restore */
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /*-----------------------------------------------------------
47  * MACROS AND DEFINITIONS
48  *----------------------------------------------------------*/
49 
50 /* IDs for commands that can be sent/received on the timer queue. These are to
51 be used solely through the macros that make up the public software timer API,
52 as defined below. The commands that are sent from interrupts must use the
53 highest numbers as tmrFIRST_FROM_ISR_COMMAND is used to determine if the task
54 or interrupt version of the queue send function should be used. */
55 #define tmrCOMMAND_EXECUTE_CALLBACK_FROM_ISR ( ( BaseType_t ) -2 )
56 #define tmrCOMMAND_EXECUTE_CALLBACK ( ( BaseType_t ) -1 )
57 #define tmrCOMMAND_START_DONT_TRACE ( ( BaseType_t ) 0 )
58 #define tmrCOMMAND_START ( ( BaseType_t ) 1 )
59 #define tmrCOMMAND_RESET ( ( BaseType_t ) 2 )
60 #define tmrCOMMAND_STOP ( ( BaseType_t ) 3 )
61 #define tmrCOMMAND_CHANGE_PERIOD ( ( BaseType_t ) 4 )
62 #define tmrCOMMAND_DELETE ( ( BaseType_t ) 5 )
63 
64 #define tmrFIRST_FROM_ISR_COMMAND ( ( BaseType_t ) 6 )
65 #define tmrCOMMAND_START_FROM_ISR ( ( BaseType_t ) 6 )
66 #define tmrCOMMAND_RESET_FROM_ISR ( ( BaseType_t ) 7 )
67 #define tmrCOMMAND_STOP_FROM_ISR ( ( BaseType_t ) 8 )
68 #define tmrCOMMAND_CHANGE_PERIOD_FROM_ISR ( ( BaseType_t ) 9 )
69 
70 
77 typedef void * TimerHandle_t;
78 
79 /*
80  * Defines the prototype to which timer callback functions must conform.
81  */
82 typedef void (*TimerCallbackFunction_t)( TimerHandle_t xTimer );
83 
84 /*
85  * Defines the prototype to which functions used with the
86  * xTimerPendFunctionCallFromISR() function must conform.
87  */
88 typedef void (*PendedFunction_t)( void *, uint32_t );
89 
227 #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
228  TimerHandle_t xTimerCreate( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
229  const TickType_t xTimerPeriodInTicks,
230  const UBaseType_t uxAutoReload,
231  void * const pvTimerID,
232  TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION;
233 #endif
234 
357 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
358  TimerHandle_t xTimerCreateStatic( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
359  const TickType_t xTimerPeriodInTicks,
360  const UBaseType_t uxAutoReload,
361  void * const pvTimerID,
362  TimerCallbackFunction_t pxCallbackFunction,
363  StaticTimer_t *pxTimerBuffer ) PRIVILEGED_FUNCTION;
364 #endif /* configSUPPORT_STATIC_ALLOCATION */
365 
386 void *pvTimerGetTimerID( const TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
387 
407 void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID ) PRIVILEGED_FUNCTION;
408 
444 BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
445 
453 
504 #define xTimerStart( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCount() ), NULL, ( xTicksToWait ) )
505 
546 #define xTimerStop( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP, 0U, NULL, ( xTicksToWait ) )
547 
626  #define xTimerChangePeriod( xTimer, xNewPeriod, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD, ( xNewPeriod ), NULL, ( xTicksToWait ) )
627 
664 #define xTimerDelete( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_DELETE, 0U, NULL, ( xTicksToWait ) )
665 
788 #define xTimerReset( xTimer, xTicksToWait ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_RESET, ( xTaskGetTickCount() ), NULL, ( xTicksToWait ) )
789 
874 #define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START_FROM_ISR, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )
875 
937 #define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP_FROM_ISR, 0, ( pxHigherPriorityTaskWoken ), 0U )
938 
1010 #define xTimerChangePeriodFromISR( xTimer, xNewPeriod, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD_FROM_ISR, ( xNewPeriod ), ( pxHigherPriorityTaskWoken ), 0U )
1011 
1096 #define xTimerResetFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_RESET_FROM_ISR, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )
1097 
1098 
1187 BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
1188 
1221 BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
1222 
1232 const char * pcTimerGetName( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
1233 
1243 TickType_t xTimerGetPeriod( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
1244 
1258 TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
1259 
1260 /*
1261  * Functions beyond this part are not part of the public API and are intended
1262  * for use by the kernel only.
1263  */
1265 BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
1266 
1267 #if( configUSE_TRACE_FACILITY == 1 )
1268  void vTimerSetTimerNumber( TimerHandle_t xTimer, UBaseType_t uxTimerNumber ) PRIVILEGED_FUNCTION;
1269  UBaseType_t uxTimerGetTimerNumber( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
1270 #endif
1271 
1272 #ifdef __cplusplus
1273 }
1274 #endif
1275 #endif /* TIMERS_H */
1276 
1277 
1278 
BaseType_t xTimerPendFunctionCallFromISR(PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken) PRIVILEGED_FUNCTION
TaskHandle_t xTimerGetTimerDaemonTaskHandle(void) PRIVILEGED_FUNCTION
void(* PendedFunction_t)(void *, uint32_t)
Definition: timers.h:88
BaseType_t xTimerCreateTimerTask(TaskHandle_t *) PRIVILEGED_FUNCTION
BaseType_t xTimerGenericCommand(TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t *const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait) PRIVILEGED_FUNCTION
unsigned long UBaseType_t
Definition: portmacro.h:58
uint32_t TickType_t
Definition: portmacro.h:64
void * pvTimerGetTimerID(const TimerHandle_t xTimer) PRIVILEGED_FUNCTION
void(* TimerCallbackFunction_t)(TimerHandle_t xTimer)
Definition: timers.h:82
BaseType_t xTimerPendFunctionCall(PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait) PRIVILEGED_FUNCTION
long BaseType_t
Definition: portmacro.h:57
void * TaskHandle_t
Definition: task.h:62
TickType_t xTimerGetPeriod(TimerHandle_t xTimer) PRIVILEGED_FUNCTION
const char * pcTimerGetName(TimerHandle_t xTimer) PRIVILEGED_FUNCTION
#define PRIVILEGED_FUNCTION
Definition: mpu_wrappers.h:174
void vTimerSetTimerID(TimerHandle_t xTimer, void *pvNewID) PRIVILEGED_FUNCTION
TickType_t xTimerGetExpiryTime(TimerHandle_t xTimer) PRIVILEGED_FUNCTION
BaseType_t xTimerIsTimerActive(TimerHandle_t xTimer) PRIVILEGED_FUNCTION
void * TimerHandle_t
Definition: timers.h:77


inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:05