iLLD_TC27xC  1.0
IfxGtm_Tom.h
Go to the documentation of this file.
1 /**
2  * \file IfxGtm_Tom.h
3  * \brief GTM basic functionality
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_Tom TOM Interface Drivers
25  * \ingroup IfxLld_Gtm
26  *
27  * \defgroup IfxLld_Gtm_Std_Tom TOM Basic Functionality
28  * \ingroup IfxLld_Gtm_Std
29  * \defgroup IfxLld_Gtm_Std_Tom_Enumerations TOM Enumerations
30  * \ingroup IfxLld_Gtm_Std_Tom
31  * \defgroup IfxLld_Gtm_Std_Tom_Channel_Functions TOM Channel Functions
32  * \ingroup IfxLld_Gtm_Std_Tom
33  * \defgroup IfxLld_Gtm_Std_Tom_TGC_Functions TOM TGC Functions
34  * \ingroup IfxLld_Gtm_Std_Tom
35  */
36 
37 #ifndef IFXGTM_TOM_H
38 #define IFXGTM_TOM_H 1
39 
40 /******************************************************************************/
41 /*----------------------------------Includes----------------------------------*/
42 /******************************************************************************/
43 
44 #include "_Impl/IfxGtm_cfg.h"
45 #include "IfxGtm.h"
46 #include "IfxGtm_Tbu.h"
47 #include "Src/Std/IfxSrc.h"
48 
49 /******************************************************************************/
50 /*--------------------------------Enumerations--------------------------------*/
51 /******************************************************************************/
52 
53 /** \addtogroup IfxLld_Gtm_Std_Tom_Enumerations
54  * \{ */
55 /** \brief Clock source for the TOM channels
56  */
57 typedef enum
58 {
59  IfxGtm_Tom_Ch_ClkSrc_cmuFxclk0 = 0, /**< \brief div 1 */
60  IfxGtm_Tom_Ch_ClkSrc_cmuFxclk1 = 1, /**< \brief div 16 */
61  IfxGtm_Tom_Ch_ClkSrc_cmuFxclk2 = 2, /**< \brief div 256 */
62  IfxGtm_Tom_Ch_ClkSrc_cmuFxclk3 = 3, /**< \brief div 4096 */
63  IfxGtm_Tom_Ch_ClkSrc_cmuFxclk4 = 4, /**< \brief div 32768 */
64  IfxGtm_Tom_Ch_ClkSrc_noClock = 5 /**< \brief no clock */
66 
67 /** \brief Reset source for channel counter CN0
68  */
69 typedef enum
70 {
71  IfxGtm_Tom_Ch_OutputTrigger_forward = 0, /**< \brief Forward the trigger from the previous channel */
72  IfxGtm_Tom_Ch_OutputTrigger_generate = 1 /**< \brief Generate the trigger from the current channel */
74 
75 /** \brief Reset event for channel counter CN0
76  */
77 typedef enum
78 {
82 
83 /** \} */
84 
85 /** \addtogroup IfxLld_Gtm_Std_Tom_Channel_Functions
86  * \{ */
87 
88 /******************************************************************************/
89 /*-------------------------Global Function Prototypes-------------------------*/
90 /******************************************************************************/
91 
92 /** \brief Clears the channel One notification
93  * \param tom Pointer to the TOM object
94  * \param channel Channel index
95  * \return None
96  */
97 IFX_EXTERN void IfxGtm_Tom_Ch_clearOneNotification(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel);
98 
99 /** \brief Clears the channel Zero notification
100  * \param tom Pointer to the TOM object
101  * \param channel Channel index
102  * \return None
103  */
104 IFX_EXTERN void IfxGtm_Tom_Ch_clearZeroNotification(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel);
105 
106 /** \brief Returns the TOM channel input clock frequency in Hz
107  * \param gtm Pointer to GTM module
108  * \param tom Pointer to the TOM object
109  * \param channel Channel index
110  * \return TOM channel input clock frequency in Hz
111  */
112 IFX_EXTERN float32 IfxGtm_Tom_Ch_getClockFrequency(Ifx_GTM *gtm, Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel);
113 
114 /** \brief Returns the channel clock source
115  * \param tom Pointer to the TOM object
116  * \param channel Channel index
117  * \return The clock source
118  */
120 
121 /** \brief Gets the TOM output level
122  * \param tom Pointer to the TOM object
123  * \param channel Channel index
124  * \return TRUE the output is high, FALSE the output is low
125  */
126 IFX_EXTERN boolean IfxGtm_Tom_Ch_getOutputLevel(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel);
127 
128 /** \brief Returns a pointer to the TOM channel SRC
129  * \param gtm Pointer to GTM module
130  * \param tom Specifies the tom object
131  * \param channel Channel index
132  * \return Pointer to the TOM channel SRC
133  */
134 IFX_EXTERN volatile Ifx_SRC_SRCR *IfxGtm_Tom_Ch_getSrcPointer(Ifx_GTM *gtm, IfxGtm_Tom tom, IfxGtm_Tom_Ch channel);
135 
136 /** \brief Returns the TGC pointer
137  * \param tom Pointer to the TOM object
138  * \param tgcIndex TGC index
139  * \return TOM TGC object pointer
140  */
141 IFX_EXTERN Ifx_GTM_TOM_TGC *IfxGtm_Tom_Ch_getTgcPointer(Ifx_GTM_TOM *tom, uint32 tgcIndex);
142 
143 /** \brief Returns the Timer pointer
144  * \param tom Pointer to the TOM object
145  * \param channel Channel index
146  * \return Timer pointer
147  */
148 IFX_EXTERN volatile uint32 *IfxGtm_Tom_Ch_getTimerPointer(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel);
149 
150 /** \brief Returns the status of channel One notification
151  * \param tom Pointer to the TOM object
152  * \param channel Channel index
153  * \return Status of channel One notification
154  */
155 IFX_EXTERN boolean IfxGtm_Tom_Ch_isOneNotification(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel);
156 
157 /** \brief Returns the status of channel Zero notification
158  * \param tom Pointer to the TOM object
159  * \param channel Channel index
160  * \return Status of channel Zero notification
161  */
162 IFX_EXTERN boolean IfxGtm_Tom_Ch_isZeroNotification(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel);
163 
164 /** \brief Raises the interrupt for Compare 1
165  * \param tom Pointer to the TOM object
166  * \param channel Channel index
167  * \return None
168  */
169 IFX_EXTERN void IfxGtm_Tom_Ch_raiseInterruptOne(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel);
170 
171 /** \brief Raises the interrupt for Compare 0
172  * \param tom Pointer to the TOM object
173  * \param channel Channel index
174  * \return None
175  */
176 IFX_EXTERN void IfxGtm_Tom_Ch_raiseInterruptZero(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel);
177 
178 /** \brief Sets the channel clock source
179  * \param tom Pointer to the TOM object
180  * \param channel Channel index
181  * \param clock Channel clock source
182  * \return None
183  */
184 IFX_EXTERN void IfxGtm_Tom_Ch_setClockSource(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, IfxGtm_Tom_Ch_ClkSrc clock);
185 
186 /** \brief Sets the compare 0 and 1 values
187  * \param tom Pointer to the TOM object
188  * \param channel Channel index
189  * \param compareZero Compare zero value
190  * \param compareOne Compare one value
191  * \return None
192  */
193 IFX_EXTERN void IfxGtm_Tom_Ch_setCompare(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, uint32 compareZero, uint32 compareOne);
194 
195 /** \brief Sets the compare 1 value
196  * \param tom Pointer to the TOM object
197  * \param channel Channel index
198  * \param compareOne Compare one value
199  * \return None
200  */
201 IFX_EXTERN void IfxGtm_Tom_Ch_setCompareOne(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, uint32 compareOne);
202 
203 /** \brief Sets the compare 1 shadow value
204  * \param tom Pointer to the TOM object
205  * \param channel Channel index
206  * \param shadowOne Compare one shadow value
207  * \return None
208  */
209 IFX_EXTERN void IfxGtm_Tom_Ch_setCompareOneShadow(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, uint32 shadowOne);
210 
211 /** \brief Sets the compare 0 and 1 shadow values
212  * \param tom Pointer to the TOM object
213  * \param channel Channel index
214  * \param shadowZero Compare zero shadow value
215  * \param shadowOne Compare one shadow value
216  * \return None
217  */
218 IFX_EXTERN void IfxGtm_Tom_Ch_setCompareShadow(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, uint32 shadowZero, uint32 shadowOne);
219 
220 /** \brief Sets the compare 0 value
221  * \param tom Pointer to the TOM object
222  * \param channel Channel index
223  * \param compareZero Compare zero value
224  * \return None
225  */
226 IFX_EXTERN void IfxGtm_Tom_Ch_setCompareZero(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, uint32 compareZero);
227 
228 /** \brief Sets the compare 0 shadow value
229  * \param tom Pointer to the TOM object
230  * \param channel Channel index
231  * \param shadowZero Compare zero shadow value
232  * \return None
233  */
234 IFX_EXTERN void IfxGtm_Tom_Ch_setCompareZeroShadow(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, uint32 shadowZero);
235 
236 /** \brief Sets the counter value
237  * \param tom Pointer to the TOM object
238  * \param channel Channel index
239  * \param value Counter value
240  * \return None
241  */
242 IFX_EXTERN void IfxGtm_Tom_Ch_setCounterValue(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, uint32 value);
243 
244 /** \brief Enable/disable the gated counter mode (channel 0 to 7 only)
245  * \param tom Pointer to the TOM object
246  * \param channel Channel index
247  * \param enabled If TRUE, the feature is enabled, else disabled
248  * \return None
249  */
250 IFX_EXTERN void IfxGtm_Tom_Ch_setGatedCounter(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, boolean enabled);
251 
252 /** \brief Sets the channel notification
253  * \param tom Pointer to the TOM object
254  * \param channel Channel index
255  * \param mode Interrupt mode
256  * \param interruptOnCompareZero If TRUE, an interrupt is generated on compare 0, else no interrupt is generated
257  * \param interruptOnCompareOne If TRUE, an interrupt is generated on compare 1, else no interrupt is generated
258  * \return None
259  */
260 IFX_EXTERN void IfxGtm_Tom_Ch_setNotification(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, IfxGtm_IrqMode mode, boolean interruptOnCompareZero, boolean interruptOnCompareOne);
261 
262 /** \brief Enable/disable the one shot mode
263  * \param tom Pointer to the TOM object
264  * \param channel Channel index
265  * \param enabled If TRUE, the feature is enabled, else disabled
266  * \return None
267  */
268 IFX_EXTERN void IfxGtm_Tom_Ch_setOneShotMode(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, boolean enabled);
269 
270 /** \brief Enable/disable the PCM mode (channel 15 only)
271  * \param tom Pointer to the TOM object
272  * \param channel Channel index
273  * \param enabled If TRUE, the feature is enabled, else disabled
274  * \return None
275  */
276 IFX_EXTERN void IfxGtm_Tom_Ch_setPcm(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, boolean enabled);
277 
278 /** \brief Sets the channel clock source either from local or from previous channel
279  * \param tom Pointer to the TOM object
280  * \param channel Channel index
281  * \param event Channel reset event
282  * \return None
283  */
285 
286 /** \brief Sets the signal level
287  * \param tom Pointer to the TOM object
288  * \param channel Channel index
289  * \param activeState Signal level active state. In case the channel is reset, the output is set to not active. The signal is active between 0 and the leading edge (CM1) and inactive between the leading edge and the trailing edge (CM0).
290  * \return None
291  */
292 IFX_EXTERN void IfxGtm_Tom_Ch_setSignalLevel(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, Ifx_ActiveState activeState);
293 
294 /** \brief Enable/disable the SPE mode (channel 0 to 7 only)
295  * \param tom Pointer to the TOM object
296  * \param channel Channel index
297  * \param enabled If TRUE, the feature is enabled, else disabled
298  * \return None
299  */
300 IFX_EXTERN void IfxGtm_Tom_Ch_setSpe(Ifx_GTM_TOM *tom, IfxGtm_Tom_Ch channel, boolean enabled);
301 
302 /** \brief Sets the channel trigger output
303  * \param tom Pointer to the TOM object
304  * \param channel Channel index
305  * \param trigger Channel trigger output mode
306  * \return None
307  */
309 
310 /** \} */
311 
312 /** \addtogroup IfxLld_Gtm_Std_Tom_TGC_Functions
313  * \{ */
314 
315 /******************************************************************************/
316 /*-------------------------Global Function Prototypes-------------------------*/
317 /******************************************************************************/
318 
319 /** \brief Enable/disable one or more channels (ENDIS)
320  * \param tgc Pointer to the TGC object
321  * \param enableMask Mask for the channel feature enable (bit 0: Channel 0, bit 1: channel 1, ...)
322  * \param disableMask Mask for the channel feature disable (bit 0: Channel 0, bit 1: channel 1, ...)
323  * \param immediate If TRUE, the action is done immediately else, the action is done on TGC trigger (CTRL_TRIG)
324  * \return None
325  */
326 IFX_EXTERN void IfxGtm_Tom_Tgc_enableChannels(Ifx_GTM_TOM_TGC *tgc, uint16 enableMask, uint16 disableMask, boolean immediate);
327 
328 /** \brief Enable/disable one or more channels output (OUTEN)
329  * \param tgc Pointer to the TGC object
330  * \param enableMask Mask for the channel feature enable (bit 0: Channel 0, bit 1: channel 1, ...)
331  * \param disableMask Mask for the channel feature disable (bit 0: Channel 0, bit 1: channel 1, ...)
332  * \param immediate If TRUE, the action is done immediately else, the action is done on TGC trigger (CTRL_TRIG)
333  * \return None
334  */
335 IFX_EXTERN void IfxGtm_Tom_Tgc_enableChannelsOutput(Ifx_GTM_TOM_TGC *tgc, uint16 enableMask, uint16 disableMask, boolean immediate);
336 
337 /** \brief Enable/disable the TGC channels trigger
338  * \param tgc Pointer to the TGC object
339  * \param enableMask Mask for the channel feature enable (bit 0: Channel 0, bit 1: channel 1, ...)
340  * \param disableMask Mask for the channel feature disable (bit 0: Channel 0, bit 1: channel 1, ...)
341  * \return None
342  */
344 
345 /** \brief Enable/disable one or more channels for update (UPEN)
346  * \param tgc Pointer to the TGC object
347  * \param enableMask Mask for the channel feature enable (bit 0: Channel 0, bit 1: channel 1, ...)
348  * \param disableMask Mask for the channel feature disable (bit 0: Channel 0, bit 1: channel 1, ...)
349  * \return None
350  */
352 
353 /** \brief Enable/disable the time base trigger
354  * \param tgc Pointer to the TGC object
355  * \param enabled If TRUE, the trigger is enabled else disabled
356  * \return None
357  */
359 
360 /** \brief Reset one or more channels
361  * \param tgc Pointer to the TGC object
362  * \param resetMask Mask for the channel reset (bit 0: Channel 0, bit 1: channel 1, ...)
363  * \return None
364  */
366 
367 /** \brief Enable/disable one or more channels for the force update feature (FUPD)
368  * \param tgc Pointer to the TGC object
369  * \param enableMask Mask for the channel feature enable (bit 0: Channel 0, bit 1: channel 1, ...)
370  * \param disableMask Mask for the channel feature disable (bit 0: Channel 0, bit 1: channel 1, ...)
371  * \param resetEnableMask Mask for the enabled channels counter reset on force update (bit 0: Channel 0, bit 1: channel 1, ...) Channel 0, bit 1: channel 1, ...)
372  * \param resetDisableMask Mask for the disabled channels with no counter reset on force update (bit 0: Channel 0, bit 1: channel 1, ...)
373  * \return None
374  */
375 IFX_EXTERN void IfxGtm_Tom_Tgc_setChannelsForceUpdate(Ifx_GTM_TOM_TGC *tgc, uint16 enableMask, uint16 disableMask, uint16 resetEnableMask, uint16 resetDisableMask);
376 
377 /** \brief Sets the trigger time base and time base value
378  * \param tgc Pointer to the TGC object
379  * \param base Time base used for comparison
380  * \param value Compare value that raise the trigger
381  * \return None
382  */
384 
385 /** \brief Raise the trigger for the channel enable/disable settings, output enable settings, and force update event (CTRL_TRIG)
386  * \param tgc Pointer to the TGC object
387  * \return None
388  */
390 
391 /** \} */
392 
393 #endif /* IFXGTM_TOM_H */