iLLD_TC27xC  1.0
IfxGtm_Atom_Timer.h
Go to the documentation of this file.
1 /**
2  * \file IfxGtm_Atom_Timer.h
3  * \brief _ATOM TIMER details
4  * \ingroup IfxLld_Gtm
5  *
6  * \version iLLD_0_1_0_10
7  * \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
8  *
9  *
10  * IMPORTANT NOTICE
11  *
12  *
13  * Infineon Technologies AG (Infineon) is supplying this file for use
14  * exclusively with Infineon's microcontroller products. This file can be freely
15  * distributed within development tools that are supporting such microcontroller
16  * products.
17  *
18  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21  * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
22  * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23  *
24  * \defgroup IfxLld_Gtm_Atom_Timer_Usage How to use the GTM ATOM Timer Driver
25  * \ingroup IfxLld_Gtm_Atom_Timer
26  *
27  * This driver implements the timer functionalities as defined by \ref library_srvsw_stdif_timer.
28  * The user is free to use either the driver specific APIs below or to used the \ref library_srvsw_stdif_timer "standard interface APIs".
29  *
30  * \section Specific Specific implementation
31  * Implementation is similar to \ref IfxLld_Gtm_Tom_Timer.
32  *
33  * \todo Add documentation
34  *
35  * For a detailed configuration of the microcontroller, see \ref IfxGtm_Atom_Timer_init().
36  *
37  * \section Example Usage example
38  * Initialisation:
39  * \code
40  * IfxGtm_Atom_Timer_Config driverConfig;
41  * IfxGtm_Atom_Timer driverData;
42  * IfxStdIf_Timer timer;
43  * IfxGtm_Atom_Timer_initConfig(&driverConfig, &MODULE_GTM);
44  * IfxGtm_Atom_Timer_init (&driverData, &driverConfig);
45  * boolean IfxGtm_Atom_Timer_stdIfTimerInit(&timer, &driverData);
46  * \endcode
47  *
48  * During run-time, \ref library_srvsw_stdif_timer "the interface functions" should be used:
49  * \code
50  * IfxStdIf_Timer_run(timer);
51  * IfxStdIf_Timer_disableUpdate(timer);
52  * IfxStdIf_Timer_setPeriod(timer, period);
53  * IfxStdIf_Timer_applyUpdate(timer);
54  * \endcode
55  *
56  *
57  *
58  * \defgroup IfxLld_Gtm_Atom_Timer ATOM Timer Interface Driver
59  * \ingroup IfxLld_Gtm_Atom
60  * \defgroup IfxLld_Gtm_Atom_Timer_Timer_StdIf_Functions Timer StdIf Functions
61  * \ingroup IfxLld_Gtm_Atom_Timer
62  * \defgroup IfxLld_Gtm_Atom_Timer_Timer_Functions Timer Functions
63  * \ingroup IfxLld_Gtm_Atom_Timer
64  * \defgroup IfxLld_Gtm_Atom_Timer_Data_Structures Data Structures
65  * \ingroup IfxLld_Gtm_Atom_Timer
66  */
67 
68 #ifndef IFXGTM_ATOM_TIMER_H
69 #define IFXGTM_ATOM_TIMER_H 1
70 
71 /******************************************************************************/
72 /*----------------------------------Includes----------------------------------*/
73 /******************************************************************************/
74 
75 #include "_PinMap/IfxGtm_PinMap.h"
76 #include "Gtm/Std/IfxGtm_Atom.h"
77 #include "Gtm/Std/IfxGtm_Cmu.h"
78 #include "StdIf/IfxStdIf_Timer.h"
79 
80 /******************************************************************************/
81 /*-----------------------------Data Structures--------------------------------*/
82 /******************************************************************************/
83 
84 /** \addtogroup IfxLld_Gtm_Atom_Timer_Data_Structures
85  * \{ */
86 /** \brief Structure for the timer base
87  */
88 typedef struct
89 {
90  Ifx_TimerValue period; /**< \brief Timer period in ticks (cached value) */
91  boolean triggerEnabled; /**< \brief If TRUE, the trigger functionality is Initialised */
92  float32 clockFreq; /**< \brief Timer input clock frequency (cached value) */
93  IfxStdIf_Timer_CountDir countDir; /**< \brief Timer counting mode */
95 
96 /** \} */
97 
98 /** \addtogroup IfxLld_Gtm_Atom_Timer_Data_Structures
99  * \{ */
100 /** \brief TOM Timer interface Handle
101  */
102 typedef struct
103 {
104  IfxGtm_Atom_Timer_Base base; /**< \brief Timer base structure */
105  Ifx_GTM *gtm; /**< \brief Pointer to GTM module */
106  Ifx_GTM_ATOM *atom; /**< \brief Pointer to the ATOM object */
107  Ifx_GTM_ATOM_AGC *agc; /**< \brief Pointer to the AGC object */
108  IfxGtm_Atom atomIndex; /**< \brief Enum for ATOM objects */
109  IfxGtm_Atom_Ch timerChannel; /**< \brief ATOM channel used for the timer */
110  IfxGtm_Atom_Ch triggerChannel; /**< \brief ATOM channel used for the trigger, can be identical to the timer channel */
111  uint16 channelsMask; /**< \brief Mask for channels to be modified together */
113 
114 /** \brief Configuration structure for TOM Timer
115  */
116 typedef struct
117 {
118  IfxStdIf_Timer_Config base; /**< \brief Standard interface timer configuration */
119  Ifx_GTM *gtm; /**< \brief Pointer to GTM module */
120  IfxGtm_Atom atom; /**< \brief Pointer to the ATOM object */
121  IfxGtm_Atom_Ch timerChannel; /**< \brief ATOM channel used for the timer */
122  IfxGtm_Atom_ToutMap *triggerOut; /**< \brief ATOM channel used for the trigger output, can be identical to the timer channe */
123  IfxGtm_Cmu_Clk clock; /**< \brief Timer input clock */
125 
126 /** \} */
127 
128 /** \addtogroup IfxLld_Gtm_Atom_Timer_Timer_StdIf_Functions
129  * \{ */
130 
131 /******************************************************************************/
132 /*-------------------------Global Function Prototypes-------------------------*/
133 /******************************************************************************/
134 
135 /** \brief Returns the timer event
136  * \param driver ATOM Timer interface Handle
137  * \return Timer event
138  */
140 
141 /** \brief Returns the trigger event
142  * \param driver ATOM Timer interface Handle
143  * \return Trigger event
144  */
146 
147 /** \brief Enables the transfer of the shadow registers
148  * \param driver ATOM Timer interface Handle
149  * \return None
150  */
152 
153 /** \brief Disables the upadte
154  * \param driver ATOM Timer interface Handle
155  * \return None
156  */
158 
159 /** \brief Returns the frequency
160  * \param driver ATOM Timer interface Handle
161  * \return Frequency
162  */
164 
165 /** \brief Returns the Input frequncy
166  * \param driver ATOM Timer interface Handle
167  * \return Frequency
168  */
170 
171 /** \brief Returns the period of the timer
172  * \param driver ATOM Timer interface Handle
173  * \return Period
174  */
176 
177 /** \brief Returns the resolution
178  * \param driver ATOM Timer interface Handle
179  * \return Resolution
180  */
182 
183 /** \brief Runs the timer
184  * \param driver ATOM Timer interface Handle
185  * \return None
186  */
188 
189 /** \brief Sets the frequency
190  * \param driver ATOM Timer interface Handle
191  * \param frequency Frequency
192  * \return TRUE on success else FALSE
193  */
195 
196 /** \brief Sets the period for the timer
197  * \param driver ATOM Timer interface Handle
198  * \param period Period value
199  * \return TRUE on success else FALSE
200  */
202 
203 /** \brief Sets the single shot mode of the timer
204  * \param driver ATOM Timer interface Handle
205  * \param enabled If TRUE, sets the single shot mode
206  * \return None
207  */
208 IFX_EXTERN void IfxGtm_Atom_Timer_setSingleMode(IfxGtm_Atom_Timer *driver, boolean enabled);
209 
210 /** \brief Sets the trigger
211  * \param driver ATOM Timer interface Handle
212  * \param triggerPoint Trigger point value
213  * \return None
214  */
216 
217 /** \brief Initializes the standard interface timer
218  * \param stdif Standard interface object, will be initialized by the function
219  * \param driver Device driver object used by the standard interface. must be initialised separately
220  * \return TRUE on success else FALSE
221  */
223 
224 /** \brief Stops the timer
225  * \param driver ATOM Timer interface Handle
226  * \return None
227  */
229 
230 /** \brief Updates the input frequency
231  * \param driver ATOM Timer interface Handle
232  * \return None
233  */
235 
236 /** \} */
237 
238 /** \addtogroup IfxLld_Gtm_Atom_Timer_Timer_Functions
239  * \{ */
240 
241 /******************************************************************************/
242 /*-------------------------Global Function Prototypes-------------------------*/
243 /******************************************************************************/
244 
245 /** \brief Add a channel to the channel mask
246  * Channels present in the mask are started, stopped, updated at the same time as the timer:
247  * IfxGtm_Atom_Timer_applyUpdate, IfxGtm_Atom_Timer_disableUpdate, IfxGtm_Atom_Timer_stop, IfxGtm_Atom_Timer_run
248  * \param driver ATOM Timer interface Handle
249  * \param mask Mask value
250  * \return None
251  */
253 
254 /** \brief Returns the pointer to timer channel
255  * \param driver ATOM Timer interface Handle
256  * \return Pointer
257  */
259 
260 /** \brief Initialises the timer object
261  * \param driver ATOM Timer interface Handle
262  * \param config Configuration structure for ATOM Timer
263  * \return TRUE on success else FALSE
264  */
266 
267 /** \brief Initializes the configuration structure to default
268  * \param config Configuration structure for ATOM Timer
269  * \param gtm Pointer to GTM module
270  * \return None
271  */
273 
274 /** \} */
275 
276 #endif /* IFXGTM_ATOM_TIMER_H */