iLLD_TC27xC  1.0
IfxIom_Iom.h
Go to the documentation of this file.
1 /**
2  * \file IfxIom_Iom.h
3  * \brief IOM IOM details
4  * \ingroup IfxLld_Iom
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  *
25  * \defgroup IfxLld_Iom_Iom_Usage How to use the IOM Iom Interface driver?
26  * \ingroup IfxLld_Iom
27  *
28  * IOM Module takes the monitor and reference signals from applicable system peripherals(GTM,CCU6,QSPI,PSI5,ASCLIN) and also from external hardware(Sensors) and compare them with respect to one another and generate the alarm events which are routed to SMU.
29  *
30  * In the following sections it will be described, how to integrate the driver into the application framework.
31  *
32  * \section IfxLld_Iom_Iom_Preparation Preparation
33  * \subsection IfxLld_Iom_Iom_Include Include Files
34  *
35  * Include following header file into your C code:
36  *
37  * \code
38  *
39  * #include <Iom/Iom/IfxIom_Iom.h>
40  *
41  * \endcode
42  *
43  * \subsection IfxLld_Iom_Iom_Variables Variables
44  *
45  * Declare the IOM handle and the configuration buffers as global variables in your C code:
46  * \code
47  *
48  * static IfxIom_Iom_EcmConfig ecmConfig;
49  * static IfxIom_Iom_FpcConfig fpcConfig;
50  * static IfxIom_Iom_LamConfig lamConfig;
51  * static IfxIom_Iom iom;
52  *
53  * \endcode
54  * \subsection IfxLld_Iom_Iom_Init Module Initialisation
55  *
56  * The module initialisation can be done in the same function. Here an example:
57  * \code
58  * //Initialize the module handle
59  * IfxIom_Iom_initModuleConfig(&iom, &MODULE_IOM);
60  *
61  * //Enable the module control
62  * IfxIom_Iom_initModule(&iom);
63  *
64  * //Initialize the default Filter & Prescaler Cell channel configuration buffer
65  * IfxIom_Iom_initFpcChannelConfig(&fpcConfig);
66  * //Filter & Prescaler Cell channel supplied configuration
67  * fpcConfig.channelId = IfxIom_FpcChannelId_2;
68  * fpcConfig.filterMode = IfxIom_FilterMode_delayedDebounce;
69  * fpcConfig.comparatorThreshold = 15;
70  * fpcConfig.monitorSignal = IfxIom_MonitorSignal_portLogic;
71  * fpcConfig.referenceSignal = IfxIom_ReferenceSignal_0;
72  * fpcConfig.timerReset = TRUE;
73  * //Initialize the Filter & Prescaler Cell channel with supplied configuration
74  * IfxIom_Iom_initFpcChannel(&iom, &fpcConfig);
75  *
76  * //Initialize the default Logic Analyser Module configuration buffer
77  * IfxIom_Iom_initAnalyserConfig(&lamConfig);
78  * //Logic Analyser Module Block supplied configuration
79  * lamConfig.monitorSignalInverted = FALSE;
80  * lamConfig.referenceSignalInverted = FALSE;
81  * lamConfig.lamMonitorSource = IfxIom_LamMonitorSource_directFpcMonitor;
82  * lamConfig.lamMode = IfxIom_LamRunMode_running;
83  * lamConfig.eventSource = IfxIom_EventSource_monitor;
84  * lamConfig.eventActiveEdgeSelection = IfxIom_EventActiveEdgeSelection_negativeGateEitherClear;
85  * lamConfig.eventWindowInverted = TRUE;
86  * lamConfig.lamMonitorInputChannel = IfxIom_LamMonitorInputChannel_2;
87  * lamConfig.lamReferenceInputChannel = IfxIom_LamReferenceInputChannel_2;
88  * lamConfig.lamId = IfxIom_LamId_2;
89  * lamConfig.eventWindowThreshold = 15;
90  * //Initialize the Logic Analyser Module with supplied configuration
91  * IfxIom_Iom_initAnalyser(&iom, &lamConfig);
92  *
93  * //Initialize the default Event Combiner Module configuration buffer
94  * IfxIom_Iom_initCombinerConfig(&ecmConfig);
95  * //Initialize the Logic Analyser Module with supplied configuration
96  * IfxIom_Iom_initCombiner(&iom, &ecmConfig);
97  * \endcode
98  *
99  * The IOM is ready for use now!
100  *
101  * Once the Iom driver is initialized, GTM or CCU6 or QSPI or PSI5 or ASCLIN should be configured to get the two signals with some delay by which event occur.
102  *
103  * The tested two signals are at below pins.
104  *
105  * To generate GTM signals see \ref IfxLld_Gtm_Tom_PwmHl_Usage
106  *
107  * Two GTM signals at below PWM out pins are used as monitor or reference to IOM
108  *
109  * Ifx_P* testPort0 = &MODULE_P33;
110  * uint8 testPin0 = 2;
111  * Ifx_P* testPort1 = &MODULE_P02;
112  * uint8 testPin1 = 2;
113  *
114  * First pin is for Monitor and second pin is for reference. The above initialized IOM generates the event to SMU if pulse or duty cycle too short.
115  *
116  * \defgroup IfxLld_Iom_Iom Iom
117  * \ingroup IfxLld_Iom
118  * \defgroup IfxLld_Iom_Iom_Structures Data Structures
119  * \ingroup IfxLld_Iom_Iom
120  * \defgroup IfxLld_Iom_Iom_Module Module Functions
121  * \ingroup IfxLld_Iom_Iom
122  * \defgroup IfxLld_Iom_Iom_Operative Operative Functions
123  * \ingroup IfxLld_Iom_Iom
124  */
125 
126 #ifndef IFXIOM_IOM_H
127 #define IFXIOM_IOM_H 1
128 
129 /******************************************************************************/
130 /*----------------------------------Includes----------------------------------*/
131 /******************************************************************************/
132 
133 #include "Iom/Std/IfxIom.h"
134 
135 /******************************************************************************/
136 /*-----------------------------Data Structures--------------------------------*/
137 /******************************************************************************/
138 
139 /** \addtogroup IfxLld_Iom_Iom_Structures
140  * \{ */
141 /** \brief Event Combiner Module Global Event Selection Bit Field
142  */
143 typedef struct
144 {
145  uint32 eventCombinerSelection0 : 1; /**< \brief Determines the inclusion of the channel0 event in the generation of the global event */
146  uint32 eventCombinerSelection1 : 1; /**< \brief Determines the inclusion of the channel1 event in the generation of the global event */
147  uint32 eventCombinerSelection2 : 1; /**< \brief Determines the inclusion of the channel2 event in the generation of the global event */
148  uint32 eventCombinerSelection3 : 1; /**< \brief Determines the inclusion of the channel3 event in the generation of the global event */
149  uint32 eventCombinerSelection4 : 1; /**< \brief Determines the inclusion of the channel4 event in the generation of the global event */
150  uint32 eventCombinerSelection5 : 1; /**< \brief Determines the inclusion of the channel5 event in the generation of the global event */
151  uint32 eventCombinerSelection6 : 1; /**< \brief Determines the inclusion of the channel6 event in the generation of the global event */
152  uint32 eventCombinerSelection7 : 1; /**< \brief Determines the inclusion of the channel7 event in the generation of the global event */
153  uint32 eventCombinerSelection8 : 1; /**< \brief Determines the inclusion of the channel8 event in the generation of the global event */
154  uint32 eventCombinerSelection9 : 1; /**< \brief Determines the inclusion of the channel9 event in the generation of the global event */
155  uint32 eventCombinerSelection10 : 1; /**< \brief Determines the inclusion of the channel10 event in the generation of the global event */
156  uint32 eventCombinerSelection11 : 1; /**< \brief Determines the inclusion of the channel11 event in the generation of the global event */
157  uint32 eventCombinerSelection12 : 1; /**< \brief Determines the inclusion of the channel12 event in the generation of the global event */
158  uint32 eventCombinerSelection13 : 1; /**< \brief Determines the inclusion of the channel13 event in the generation of the global event */
159  uint32 eventCombinerSelection14 : 1; /**< \brief Determines the inclusion of the channel14 event in the generation of the global event */
160  uint32 eventCombinerSelection15 : 1; /**< \brief Determines the inclusion of the channel15 event in the generation of the global event */
161  uint32 countedEventCombinerSelection0 : 1; /**< \brief Determines the inclusion of the respective channel event counter output (1 of 4) in the generation of the global event (AND function). */
162  uint32 countedEventCombinerSelection1 : 1; /**< \brief Determines the inclusion of the respective channel event counter output (1 of 4) in the generation of the global event (AND function). */
163  uint32 countedEventCombinerSelection2 : 1; /**< \brief Determines the inclusion of the respective channel event counter output (1 of 4) in the generation of the global event (AND function). */
164  uint32 countedEventCombinerSelection3 : 1; /**< \brief Determines the inclusion of the respective channel event counter output (1 of 4) in the generation of the global event (AND function). */
165  uint32 reserved : 12; /**< \brief reserved */
167 
168 /** \} */
169 
170 /** \addtogroup IfxLld_Iom_Iom_Structures
171  * \{ */
172 typedef struct
173 {
174  IfxIom_EventCounterChannel input; /**< \brief Specifies which channel output event to be routed to the Counter */
175  IfxIom_EventCounterThreshold threshold; /**< \brief Specifies the Counter threshold value */
177 
178 /** \} */
179 
180 /** \brief Event Combiner Module Global Event Selection
181  */
182 typedef union
183 {
187 
188 /** \addtogroup IfxLld_Iom_Iom_Structures
189  * \{ */
190 /** \brief Specifies handle to IOM module.
191  */
192 typedef struct
193 {
194  Ifx_IOM *iom; /**< \brief Specifies the pointer to IOM registers. */
195 } IfxIom_Iom;
196 
197 /** \brief Specifies the ECM block configuration structure
198  */
199 typedef struct
200 {
202  IfxIom_Iom_EcmGlobalEventSelection globalEventSelection; /**< \brief Specifies which channel event & which counted event to be included in global event generation. bit [15:0] specifies the channel event selection and bit [19:16] specifies accumulated event */
204 
205 /** \brief Specifies Filter and Prescaler Cell configuration.
206  */
207 typedef struct
208 {
209  uint16 comparatorThreshold; /**< \brief Specifies the threshold value that is compared with timer */
210  boolean timerReset; /**< \brief Specifies the timer reset bit */
211  IfxIom_MonitorSignal monitorSignal; /**< \brief Specifies the monitor signal input for Filter & Prescaler cell */
212  IfxIom_ReferenceSignal referenceSignal; /**< \brief Specifies the reference signal input for Filter & Prescaler cell */
213  IfxIom_FilterMode filterMode; /**< \brief Specifies the Filter & Prescaler Cell mode */
214  IfxIom_FpcChannelId channelId; /**< \brief Specifies the number of Filter & Prescaler Cell channel */
215  IfxIom_EdgeClearType edgeType; /**< \brief Specifies the edge type which need to be cleared. */
216  boolean exorInputEnable[8]; /**< \brief Specifies the EXOR GTM input signal enable array (8 GTM inputs can be selected by enabling them). */
218 
219 /** \brief Specifies Logic Analyser Module configuration.
220  */
221 typedef struct
222 {
223  IfxIom_LamId lamId; /**< \brief Specifies Id of Logic Analyser Module */
224  uint32 eventWindowThreshold; /**< \brief This bit field determines the threshold value for the event window
225  * counter from which an event is generated. */
226  boolean monitorSignalInverted; /**< \brief Specifies whether the monitor signal from the FPC channel to LAM is inverted or not. */
227  boolean referenceSignalInverted; /**< \brief Specifies whether the reference signal from the FPC channel to LAM is inverted or not. */
228  IfxIom_EventSource eventSource; /**< \brief Specifies whether the event window generation is from the monitor or reference signal. */
229  IfxIom_LamMonitorInputChannel lamMonitorInputChannel; /**< \brief Specifies which FPC/mux block monitor output signal is to be used for LAM block */
230  IfxIom_LamReferenceInputChannel lamReferenceInputChannel; /**< \brief Specifies which FPC/mux block reference output signal is to be used for LAM block */
231  IfxIom_LamMonitorSource lamMonitorSource; /**< \brief Specifies whether the monitor signal from the FPC monitor channel is sourced directly or compared with the reference signal from the FPC reference channel for the event compare. */
232  IfxIom_LamRunMode lamMode; /**< \brief Specifies whether the event window generation is free-running or gated with the monitor or reference. */
233  boolean eventWindowInverted; /**< \brief Specifies whether the event window polarity is inverted or not. */
234  IfxIom_EventActiveEdgeSelection eventActiveEdgeSelection; /**< \brief Specifies which active edges of the monitor and reference signals are used for the event window generation. */
236 
237 /** \} */
238 
239 /** \addtogroup IfxLld_Iom_Iom_Module
240  * \{ */
241 
242 /******************************************************************************/
243 /*-------------------------Global Function Prototypes-------------------------*/
244 /******************************************************************************/
245 
246 /** \brief Reset the IOM module
247  * \param iom Specifies handle to IOM module.
248  * \return None
249  */
251 
252 /** \brief Initializes the Logic Analyser Module for internal event generation
253  * \param iom Specifies handle to IOM module.
254  * \param lamConfig Specifies Logic Analyser Module configuration.
255  * \return Return TRUE if valid initialization otherwise FALSE
256  *
257  * Usage example: see \ref IfxLld_Iom_Iom_Usage
258  *
259  */
260 IFX_EXTERN boolean IfxIom_Iom_initAnalyser(IfxIom_Iom *iom, const IfxIom_Iom_LamConfig *lamConfig);
261 
262 /** \brief Initializes the default Logic Analyser Module buffer
263  * \param lamConfig Specifies Logic Analyser Module configuration.
264  * \return None
265  *
266  * Usage example: see \ref IfxLld_Iom_Iom_Usage
267  *
268  */
270 
271 /** \brief Initializes the Event Combiner Module for Global event
272  * \param iom Specifies handle to IOM module.
273  * \param ecmConfig Specifies the ECM block configuration structure
274  * \return Return TRUE if valid initialization otherwise FALSE
275  *
276  * Usage example: see \ref IfxLld_Iom_Iom_Usage
277  *
278  */
279 IFX_EXTERN boolean IfxIom_Iom_initCombiner(IfxIom_Iom *iom, const IfxIom_Iom_EcmConfig *ecmConfig);
280 
281 /** \brief Initializes the default Event Combiner Module buffer
282  * \param ecmConfig Specifies the ECM block configuration structure
283  * \return None
284  *
285  * Usage example: see \ref IfxLld_Iom_Iom_Usage
286  *
287  */
289 
290 /** \brief Initializes the Filter & Prescaler Cell for filtering the signals.
291  * \param iom Specifies handle to IOM module.
292  * \param fpcConfig Specifies Filter and Prescaler Cell configuration.
293  * \return Return TRUE if valid initialization otherwise FALSE
294  *
295  * Usage example: see \ref IfxLld_Iom_Iom_Usage
296  *
297  */
299 
300 /** \brief Initializes the default Filter & Prescaler Cell buffer
301  * \param fpcConfig Specifies Filter and Prescaler Cell configuration.
302  * \return None
303  *
304  * Usage example: see \ref IfxLld_Iom_Iom_Usage
305  *
306  */
308 
309 /** \brief Initialize the IOM module with supplied configuration.
310  * \param iom Specifies handle to IOM module.
311  * \return Return TRUE if valid module initialization otherwise FALSE.
312  *
313  * Usage example: see \ref IfxLld_Iom_Iom_Usage
314  *
315  */
317 
318 /** \brief Initializes the Module default configuration buffer.
319  * \param iom Specifies the IOM configuration structure
320  * \param module Specifies handle to IOM module.
321  * \return None
322  *
323  * Usage example: see \ref IfxLld_Iom_Iom_Usage
324  *
325  */
326 IFX_EXTERN void IfxIom_Iom_initModuleConfig(IfxIom_Iom *iom, Ifx_IOM *module);
327 
328 /** \} */
329 
330 /** \addtogroup IfxLld_Iom_Iom_Operative
331  * \{ */
332 
333 /******************************************************************************/
334 /*-------------------------Global Function Prototypes-------------------------*/
335 /******************************************************************************/
336 
337 /** \brief clear the falling and rising edges which are detected.
338  * \param fpcConfig Specifies Filter and Prescaler Cell configuration.
339  * \param iom Specifies handle to IOM module.
340  * \return None
341  *
342  * Usage example: see \ref IfxLld_Iom_Iom_Usage
343  *
344  */
346 
347 /** \} */
348 
349 #endif /* IFXIOM_IOM_H */