iLLD_TC27xC  1.0
IfxGtm_Atom.h
Go to the documentation of this file.
1 /**
2  * \file IfxGtm_Atom.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_Atom ATOM Interface Drivers
25  * \ingroup IfxLld_Gtm
26  *
27  * \defgroup IfxLld_Gtm_Std_Atom ATOM Basic Functionality
28  * \ingroup IfxLld_Gtm_Std
29  * \defgroup IfxLld_Gtm_Std_Atom_Enumerations ATOM Enumerations
30  * \ingroup IfxLld_Gtm_Std_Atom
31  * \defgroup IfxLld_Gtm_Std_Atom_Channel_Functions ATOM Channel Functions
32  * \ingroup IfxLld_Gtm_Std_Atom
33  * \defgroup IfxLld_Gtm_Std_Atom_AGC_Functions ATOM AGC Functions
34  * \ingroup IfxLld_Gtm_Std_Atom
35  */
36 
37 #ifndef IFXGTM_ATOM_H
38 #define IFXGTM_ATOM_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 #include "IfxGtm_Cmu.h"
49 
50 /******************************************************************************/
51 /*--------------------------------Enumerations--------------------------------*/
52 /******************************************************************************/
53 
54 /** \addtogroup IfxLld_Gtm_Std_Atom_Enumerations
55  * \{ */
56 /** \brief Reset source for channel counter CN0
57  */
58 typedef enum
59 {
60  IfxGtm_Atom_Ch_OutputTrigger_forward = 0, /**< \brief Forward the trigger from the previous channel */
61  IfxGtm_Atom_Ch_OutputTrigger_generate = 1 /**< \brief Generate the trigger from the current channel */
63 
64 /** \brief Reset event for channel counter CN0
65  */
66 typedef enum
67 {
71 
72 /** \brief Enum for ATOM mode
73  */
74 typedef enum
75 {
81 
82 /** \} */
83 
84 /** \addtogroup IfxLld_Gtm_Std_Atom_Channel_Functions
85  * \{ */
86 
87 /******************************************************************************/
88 /*-------------------------Global Function Prototypes-------------------------*/
89 /******************************************************************************/
90 
91 /** \brief Clears the channel One notification
92  * \param atom Pointer to the ATOM object
93  * \param channel Channel index
94  * \return None
95  */
96 IFX_EXTERN void IfxGtm_Atom_Ch_clearOneNotification(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel);
97 
98 /** \brief Clears the channel Zero notification
99  * \param atom Pointer to the ATOM object
100  * \param channel Channel index
101  * \return None
102  */
103 IFX_EXTERN void IfxGtm_Atom_Ch_clearZeroNotification(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel);
104 
105 /** \brief
106  * \param atom Pointer to the ATOM object
107  * \param channel Channel index
108  * \param clock Clock source
109  * \param activeState Active State
110  * \param resetEvent Channel reset event
111  * \param trigger Channel trigger output mode
112  * \return None
113  */
115 
116 /** \brief Returns the ATOM channel input clock frequency in Hz
117  * \param gtm Pointer to GTM module
118  * \param atom Pointer to the ATOM object
119  * \param channel Channel index
120  * \return ATOM channel input clock frequency in Hz
121  */
122 IFX_EXTERN float32 IfxGtm_Atom_Ch_getClockFrequency(Ifx_GTM *gtm, Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel);
123 
124 /** \brief Returns the channel clock source
125  * \param atom Pointer to the ATOM object
126  * \param channel Channel index
127  * \return The clock source
128  */
130 
131 /** \brief Gets the ATOM output level
132  * \param atom Pointer to the ATOM object
133  * \param channel Channel index
134  * \return TRUE the output is high, FALSE the output is low
135  */
136 IFX_EXTERN boolean IfxGtm_Atom_Ch_getOutputLevel(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel);
137 
138 /** \brief Returns a pointer to the ATOM channel SRC
139  * \param gtm Pointer to GTM module
140  * \param atom Specifies the atom object
141  * \param channel Channel index
142  * \return Pointer to the TOM channel SRC
143  */
144 IFX_EXTERN volatile Ifx_SRC_SRCR *IfxGtm_Atom_Ch_getSrcPointer(Ifx_GTM *gtm, IfxGtm_Atom atom, IfxGtm_Atom_Ch channel);
145 
146 /** \brief Returns the Timer pointer
147  * \param atom Pointer to the ATOM object
148  * \param channel Channel index
149  * \return Timer pointer
150  */
151 IFX_EXTERN volatile uint32 *IfxGtm_Atom_Ch_getTimerPointer(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel);
152 
153 /** \brief Returns the status of channel One notification
154  * \param atom Pointer to the ATOM object
155  * \param channel Channel index
156  * \return Status of channel One notification
157  */
158 IFX_EXTERN boolean IfxGtm_Atom_Ch_isOneNotification(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel);
159 
160 /** \brief Returns the status of channel Zero notification
161  * \param atom Pointer to the ATOM object
162  * \param channel Channel index
163  * \return Status of channel Zero notification
164  */
165 IFX_EXTERN boolean IfxGtm_Atom_Ch_isZeroNotification(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel);
166 
167 /** \brief Raises the interrupt for Compare 1
168  * \param atom Pointer to the ATOM object
169  * \param channel Channel index
170  * \return None
171  */
172 IFX_EXTERN void IfxGtm_Atom_Ch_raiseInterruptOne(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel);
173 
174 /** \brief Raises the interrupt for Compare 0
175  * \param atom Pointer to the ATOM object
176  * \param channel Channel index
177  * \return None
178  */
179 IFX_EXTERN void IfxGtm_Atom_Ch_raiseInterruptZero(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel);
180 
181 /** \brief Sets the channel clock source
182  * \param atom Pointer to the ATOM object
183  * \param channel Channel index
184  * \param clock Channel clock source
185  * \return None
186  */
187 IFX_EXTERN void IfxGtm_Atom_Ch_setClockSource(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel, IfxGtm_Cmu_Clk clock);
188 
189 /** \brief Sets the compare 0 and 1 values
190  * \param atom Pointer to the ATOM object
191  * \param channel Channel index
192  * \param compareZero Compare zero value
193  * \param compareOne Compare one value
194  * \return None
195  */
196 IFX_EXTERN void IfxGtm_Atom_Ch_setCompare(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel, uint32 compareZero, uint32 compareOne);
197 
198 /** \brief Sets the compare 1 value
199  * \param atom Pointer to the ATOM object
200  * \param channel Channel index
201  * \param compareOne Compare one value
202  * \return None
203  */
204 IFX_EXTERN void IfxGtm_Atom_Ch_setCompareOne(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel, uint32 compareOne);
205 
206 /** \brief Sets the compare 1 shadow value
207  * \param atom Pointer to the ATOM object
208  * \param channel Channel index
209  * \param shadowOne Compare one shadow value
210  * \return None
211  */
212 IFX_EXTERN void IfxGtm_Atom_Ch_setCompareOneShadow(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel, uint32 shadowOne);
213 
214 /** \brief Sets the compare 0 and 1 shadow values
215  * \param atom Pointer to the ATOM object
216  * \param channel Channel index
217  * \param shadowZero Compare zero shadow value
218  * \param shadowOne Compare one shadow value
219  * \return None
220  */
221 IFX_EXTERN void IfxGtm_Atom_Ch_setCompareShadow(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel, uint32 shadowZero, uint32 shadowOne);
222 
223 /** \brief Sets the compare 0 value
224  * \param atom Pointer to the ATOM object
225  * \param channel Channel index
226  * \param compareZero Compare zero value
227  * \return None
228  */
229 IFX_EXTERN void IfxGtm_Atom_Ch_setCompareZero(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel, uint32 compareZero);
230 
231 /** \brief Sets the compare 0 shadow value
232  * \param atom Pointer to the ATOM object
233  * \param channel Channel index
234  * \param shadowZero Compare zero shadow value
235  * \return None
236  */
237 IFX_EXTERN void IfxGtm_Atom_Ch_setCompareZeroShadow(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel, uint32 shadowZero);
238 
239 /** \brief Sets the counter value
240  * \param atom Pointer to the ATOM object
241  * \param channel Channel index
242  * \param value Counter value
243  * \return None
244  */
245 IFX_EXTERN void IfxGtm_Atom_Ch_setCounterValue(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel, uint32 value);
246 
247 /** \brief Sets the channel notification
248  * \param atom Pointer to the ATOM object
249  * \param channel Channel index
250  * \param mode Interrupt mode
251  * \param interruptOnCompareZero If TRUE, an interrupt is generated on compare 0, else no interrupt is generated
252  * \param interruptOnCompareOne If TRUE, an interrupt is generated on compare 1, else no interrupt is generated
253  * \return None
254  */
255 IFX_EXTERN void IfxGtm_Atom_Ch_setNotification(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel, IfxGtm_IrqMode mode, boolean interruptOnCompareZero, boolean interruptOnCompareOne);
256 
257 /** \brief Enable/disable the one shot mode
258  * \param atom Pointer to the ATOM object
259  * \param channel Channel index
260  * \param enabled If TRUE, the feature is enabled, else disabled
261  * \return None
262  */
263 IFX_EXTERN void IfxGtm_Atom_Ch_setOneShotMode(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel, boolean enabled);
264 
265 /** \brief Sets the channel clock source either from local or from previous channel
266  * \param atom Pointer to the ATOM object
267  * \param channel Channel index
268  * \param event Channel reset event
269  * \return None
270  */
272 
273 /** \brief Sets the signal level
274  * \param atom Pointer to the ATOM object
275  * \param channel Channel index
276  * \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).
277  * \return None
278  */
279 IFX_EXTERN void IfxGtm_Atom_Ch_setSignalLevel(Ifx_GTM_ATOM *atom, IfxGtm_Atom_Ch channel, Ifx_ActiveState activeState);
280 
281 /** \brief Sets the channel trigger output
282  * \param atom Pointer to the ATOM object
283  * \param channel Channel index
284  * \param trigger Channel trigger output mode
285  * \return None
286  */
288 
289 /** \} */
290 
291 /** \addtogroup IfxLld_Gtm_Std_Atom_AGC_Functions
292  * \{ */
293 
294 /******************************************************************************/
295 /*-------------------------Global Function Prototypes-------------------------*/
296 /******************************************************************************/
297 
298 /** \brief Enable/disable one or more channels (ENDIS)
299  * \param agc Pointer to the AGC object
300  * \param enableMask Mask for the channel feature enable (bit 0: Channel 0, bit 1: channel 1, ...)
301  * \param disableMask Mask for the channel feature disable (bit 0: Channel 0, bit 1: channel 1, ...)
302  * \param immediate If TRUE, the action is done immediately else, the action is done on TGC trigger (CTRL_TRIG)
303  * \return None
304  */
305 IFX_EXTERN void IfxGtm_Atom_Agc_enableChannels(Ifx_GTM_ATOM_AGC *agc, uint16 enableMask, uint16 disableMask, boolean immediate);
306 
307 /** \brief Enable/disable one or more channels output (OUTEN)
308  * \param agc Pointer to the TGC object
309  * \param enableMask Mask for the channel feature enable (bit 0: Channel 0, bit 1: channel 1, ...)
310  * \param disableMask Mask for the channel feature disable (bit 0: Channel 0, bit 1: channel 1, ...)
311  * \param immediate If TRUE, the action is done immediately else, the action is done on TGC trigger (CTRL_TRIG)
312  * \return None
313  */
314 IFX_EXTERN void IfxGtm_Atom_Agc_enableChannelsOutput(Ifx_GTM_ATOM_AGC *agc, uint16 enableMask, uint16 disableMask, boolean immediate);
315 
316 /** \brief Enable/disable the TGC channels trigger
317  * \param agc Pointer to the AGC object
318  * \param enableMask Mask for the channel feature enable (bit 0: Channel 0, bit 1: channel 1, ...)
319  * \param disableMask Mask for the channel feature disable (bit 0: Channel 0, bit 1: channel 1, ...)
320  * \return None
321  */
322 IFX_EXTERN void IfxGtm_Atom_Agc_enableChannelsTrigger(Ifx_GTM_ATOM_AGC *agc, uint16 enableMask, uint16 disableMask);
323 
324 /** \brief Enable/disable one or more channels for update (UPEN)
325  * \param agc Pointer to the AGC object
326  * \param enableMask Mask for the channel feature enable (bit 0: Channel 0, bit 1: channel 1, ...)
327  * \param disableMask Mask for the channel feature disable (bit 0: Channel 0, bit 1: channel 1, ...)
328  * \return None
329  */
330 IFX_EXTERN void IfxGtm_Atom_Agc_enableChannelsUpdate(Ifx_GTM_ATOM_AGC *agc, uint16 enableMask, uint16 disableMask);
331 
332 /** \brief Enable/disable the time base trigger
333  * \param agc Pointer to the AGC object
334  * \param enabled If TRUE, the trigger is enabled else disabled
335  * \return None
336  */
337 IFX_EXTERN void IfxGtm_Atom_Agc_enableTimeTrigger(Ifx_GTM_ATOM_AGC *agc, boolean enabled);
338 
339 /** \brief Reset one or more channels
340  * \param agc Pointer to the AGC object
341  * \param resetMask Mask for the channel reset (bit 0: Channel 0, bit 1: channel 1, ...)
342  * \return None
343  */
344 IFX_EXTERN void IfxGtm_Atom_Agc_resetChannels(Ifx_GTM_ATOM_AGC *agc, uint32 resetMask);
345 
346 /** \brief Enable/disable one or more channels for the force update feature (FUPD)
347  * \param agc Pointer to the AGC object
348  * \param enableMask Mask for the channel feature enable (bit 0: Channel 0, bit 1: channel 1, ...)
349  * \param disableMask Mask for the channel feature disable (bit 0: Channel 0, bit 1: channel 1, ...)
350  * \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, ...)
351  * \param resetDisableMask Mask for the disabled channels with no counter reset on force update (bit 0: Channel 0, bit 1: channel 1, ...)
352  * \return None
353  */
354 IFX_EXTERN void IfxGtm_Atom_Agc_setChannelsForceUpdate(Ifx_GTM_ATOM_AGC *agc, uint16 enableMask, uint16 disableMask, uint16 resetEnableMask, uint16 resetDisableMask);
355 
356 /** \brief Sets the trigger time base and time base value
357  * \param agc Pointer to the AGC object
358  * \param base Time base used for comparison
359  * \param value Compare value that raise the trigger
360  * \return None
361  */
362 IFX_EXTERN void IfxGtm_Atom_Agc_setTimeTrigger(Ifx_GTM_ATOM_AGC *agc, IfxGtm_Tbu_Ts base, uint32 value);
363 
364 /** \brief Raise the trigger for the channel enable/disable settings, output enable settings, and force update event (CTRL_TRIG)
365  * \param agc Pointer to the AGC object
366  * \return None
367  */
368 IFX_EXTERN void IfxGtm_Atom_Agc_trigger(Ifx_GTM_ATOM_AGC *agc);
369 
370 /** \} */
371 
372 #endif /* IFXGTM_ATOM_H */