iLLD_TC29x  1.0
Timer.h
Go to the documentation of this file.
1 /**
2  * \file Timer.h
3  * \brief Timer interface
4  *
5  * \version iLLD_1_0_0_11_0
6  * \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
7  *
8  *
9  * IMPORTANT NOTICE
10  *
11  *
12  * Infineon Technologies AG (Infineon) is supplying this file for use
13  * exclusively with Infineon's microcontroller products. This file can be freely
14  * distributed within development tools that are supporting such microcontroller
15  * products.
16  *
17  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
18  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
20  * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
21  * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
22  *
23  * \defgroup library_srvsw_if_timer Timer interface
24  * \ingroup library_srvsw_if
25  *
26  */
27 
28 #ifndef TIMER_H_
29 #define TIMER_H_ 1
30 
31 #include "Cpu/Std/Ifx_Types.h"
32 
33 typedef struct Timer_s Timer;
34 typedef void (*Timer_Start)(Timer *handle);
35 typedef void (*Timer_Stop)(Timer *handle);
36 typedef void (*Timer_SynchronousStart)(Timer *handle);
37 typedef void (*Timer_SynchronousStop)(Timer *handle);
38 typedef void (*Timer_CountOneStep)(Timer *handle);
39 typedef void (*Timer_StartSingleShotMode)(Timer *handle);
40 
41 typedef struct
42 {
50 
51 /** \brief Structure of the Timer interface */
52 struct Timer_s
53 {
54  float32 t12Frequency; /**< \brief Actual timer12 frequency */
55  Ifx_TimerValue t12Period; /**< \brief Actual timer 12 period */
56  float32 t13Frequency; /**< \brief Actual timer13 frequency */
57  Ifx_TimerValue t13Period; /**< \brief Actual timer 13 period */
58 #if IFX_CFG_USE_STANDARD_INTERFACE
59  Timer_Functions functions; /**< \brief timer functions */
60 #endif
61 };
62 
63 /** \brief Configuration structure of the Timer interface */
64 typedef struct
65 {
66  float32 t12Frequency; /**< \brief Specify expected T12 PWM frequency in Hertz */
67  Ifx_TimerValue t12Period; /**< \brief Specify expected T12 PWM period in ticks. */
68  float32 t13Frequency; /**< \brief Specify expected T13 PWM frequency in Hertz */
69  Ifx_TimerValue t13Period; /**< \brief Specify expected T13 PWM period in ticks. */
70  Ifx_TimerValue waitingTime; /**< \brief Specify the expected ticks before timer starts (TWAIT) */
71  Ifx_TimerValue activeCount; /**< \brief Specify active PWM period (TCOUNT) */
72 } Timer_Config;
73 
74 #if IFX_CFG_USE_STANDARD_INTERFACE
75 IFX_INLINE void Timer_start(Timer *handle) {handle->functions.start(handle); }
76 IFX_INLINE void Timer_stop(Timer *handle) {handle->functions.stop(handle); }
77 IFX_INLINE void Timer_synchronousStart(Timer *handle) {handle->functions.synchronousStart(handle); }
78 IFX_INLINE void Timer_synchronousStop(Timer *handle) {handle->functions.synchronousStop(handle); }
79 IFX_INLINE void Timer_countOneStep(Timer *handle) {handle->functions.countOneStep(handle); }
80 IFX_INLINE void Timer_startSingleShotMode(Timer *handle) {handle->functions.startSingleShotMode(handle); }
81 #endif
82 
83 #endif /* TIMER_H_ */