iLLD_TC29x
1.0
IfxDsadc.h
Go to the documentation of this file.
1
/**
2
* \file IfxDsadc.h
3
* \brief DSADC basic functionality
4
* \ingroup IfxLld_Dsadc
5
*
6
* \version iLLD_1_0_0_11_0
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_Dsadc_Std_Enum Enumerations
25
* \ingroup IfxLld_Dsadc_Std
26
* \defgroup IfxLld_Dsadc_Std_Operative Operative Functions
27
* \ingroup IfxLld_Dsadc_Std
28
* \defgroup IfxLld_Dsadc_Std_Support Support Functions
29
* \ingroup IfxLld_Dsadc_Std
30
* \defgroup IfxLld_Dsadc_Std_Interrupt Interrupt Functions
31
* \ingroup IfxLld_Dsadc_Std
32
* \defgroup IfxLld_Dsadc_Std_IO IO Pin Configuration Functions
33
* \ingroup IfxLld_Dsadc_Std
34
*/
35
36
#ifndef IFXDSADC_H
37
#define IFXDSADC_H 1
38
39
/******************************************************************************/
40
/*----------------------------------Includes----------------------------------*/
41
/******************************************************************************/
42
43
#include "
_Impl/IfxDsadc_cfg.h
"
44
#include "
Src/Std/IfxSrc.h
"
45
#include "
Scu/Std/IfxScuCcu.h
"
46
#include "
_PinMap/IfxDsadc_PinMap.h
"
47
#include "IfxDsadc_reg.h"
48
#include "
Cpu/Std/IfxCpu_Intrinsics.h
"
49
50
/******************************************************************************/
51
/*--------------------------------Enumerations--------------------------------*/
52
/******************************************************************************/
53
54
/** \addtogroup IfxLld_Dsadc_Std_Enum
55
* \{ */
56
/** \brief Comb Filter (auxiliary) shift control\n
57
* Definition in Ifx_DSADC.FCFGA.B.AFSC
58
*/
59
typedef
enum
60
{
61
IfxDsadc_AuxCombFilterShift_noShift
= 0,
/**< \brief no shift, use full range */
62
IfxDsadc_AuxCombFilterShift_shiftBy1
= 1,
/**< \brief Shift by 1 */
63
IfxDsadc_AuxCombFilterShift_shiftBy2
= 2,
/**< \brief Shift by 2 */
64
IfxDsadc_AuxCombFilterShift_shiftBy3
= 3
/**< \brief Shift by 3 */
65
}
IfxDsadc_AuxCombFilterShift
;
66
67
/** \brief Comb Filter (auxiliary) configuration/type\n
68
* Definition in Ifx_DSADC.FCFGA.B.CFAC
69
*/
70
typedef
enum
71
{
72
IfxDsadc_AuxCombFilterType_comb1
= 0,
/**< \brief CIC1 */
73
IfxDsadc_AuxCombFilterType_comb2
= 1,
/**< \brief CIC2 */
74
IfxDsadc_AuxCombFilterType_comb3
= 2,
/**< \brief CIC3 */
75
IfxDsadc_AuxCombFilterType_combF
= 3
/**< \brief CICF */
76
}
IfxDsadc_AuxCombFilterType
;
77
78
/** \brief Service request generation (auxiliary)\n
79
* Definition in Ifx_DSADC.FCFGA.B.ESEL
80
*/
81
typedef
enum
82
{
83
IfxDsadc_AuxEvent_everyNewResult
= 0,
/**< \brief Always, for each new result value */
84
IfxDsadc_AuxEvent_insideBoundary
= 1,
/**< \brief If result is inside the boundary band */
85
IfxDsadc_AuxEvent_outsideBoundary
= 2
/**< \brief If result is outside the boundary band */
86
}
IfxDsadc_AuxEvent
;
87
88
/** \brief Service request generation (auxiliary)\n
89
* Definition in Ifx_DSADC.FCFGA.B.EGT
90
*/
91
typedef
enum
92
{
93
IfxDsadc_AuxGate_definedByESEL
= 0,
/**< \brief Separate: generate events according to ESEL */
94
IfxDsadc_AuxGate_coupledToIntegrator
= 1
/**< \brief Coupled: generate events only when the integrator is enabled and after the discard phase defined by bitfield NVALDIS */
95
}
IfxDsadc_AuxGate
;
96
97
/** \brief Service request generation (auxiliary)\n
98
* Definition in Ifx_DSADC.FCFGA.B.SRGA
99
*/
100
typedef
enum
101
{
102
IfxDsadc_AuxServiceRequest_never
= 0,
/**< \brief Never, service requests disabled */
103
IfxDsadc_AuxServiceRequest_auxFilter
= 1,
/**< \brief Auxiliary filter: As selected by bitfield ESEL (\ref IfxDsadc_AuxEvent) */
104
IfxDsadc_AuxServiceRequest_altSource
= 2
/**< \brief Alternate source: Capturing of a sign delay value to register CGSYNCx (x = 0 - 5) */
105
}
IfxDsadc_AuxServiceRequest
;
106
107
/** \brief Carrier generation mode\n
108
* Definition in Ifx_DSADC.CGCFG.B.CGMOD
109
*/
110
typedef
enum
111
{
112
IfxDsadc_CarrierWaveformMode_stopped
= 0,
/**< \brief Carrier Generator stopped */
113
IfxDsadc_CarrierWaveformMode_square
= 1,
/**< \brief Carrier Generator generates square wave */
114
IfxDsadc_CarrierWaveformMode_triangle
= 2,
/**< \brief Carrier Generator generates triangle wave */
115
IfxDsadc_CarrierWaveformMode_sine
= 3
/**< \brief Carrier Generator generates sine wave */
116
}
IfxDsadc_CarrierWaveformMode
;
117
118
/** \brief Specifies the channel Index
119
*/
120
typedef
enum
121
{
122
IfxDsadc_ChannelId_0
= 0,
/**< \brief Specifies the channel Index 0 */
123
IfxDsadc_ChannelId_1
= 1,
/**< \brief Specifies the channel Index 1 */
124
IfxDsadc_ChannelId_2
= 2,
/**< \brief Specifies the channel Index 2 */
125
IfxDsadc_ChannelId_3
= 3,
/**< \brief Specifies the channel Index 3 */
126
IfxDsadc_ChannelId_4
= 4,
/**< \brief Specifies the channel Index 4 */
127
IfxDsadc_ChannelId_5
= 5,
/**< \brief Specifies the channel Index 5 */
128
IfxDsadc_ChannelId_6
= 6,
/**< \brief Specifies the channel Index 6 */
129
IfxDsadc_ChannelId_7
= 7,
/**< \brief Specifies the channel Index 7 */
130
IfxDsadc_ChannelId_8
= 8,
/**< \brief Specifies the channel Index 8 */
131
IfxDsadc_ChannelId_9
= 9
/**< \brief Specifies the channel Index 9 */
132
}
IfxDsadc_ChannelId
;
133
134
/** \brief Modulator common mode voltage selection\n
135
* Definition in Ifx_DSADC.MODCFGx.B.CMVS
136
*/
137
typedef
enum
138
{
139
IfxDsadc_CommonModeVoltage_a
= 0,
/**< \brief VCM = VAREF / 3.03 (1.65 V for VAREF = 5.0 V), recommended for VDDM = 3.3 V1.65V */
140
IfxDsadc_CommonModeVoltage_b
= 1,
/**< \brief VCM = VAREF / 2.27 (2.2 V for VAREF = 5.0 V), recommended for low distortion of AC-coupled signals */
141
IfxDsadc_CommonModeVoltage_c
= 2
/**< \brief VCM = VAREF / 2.0 (2.5 V for VAREF = 5.0 V), recommended for DC-coupled signals */
142
}
IfxDsadc_CommonModeVoltage
;
143
144
/** \brief FIR data shift control\n
145
* Selects the displacement caused by the data shifter at the FIR filter output\n
146
* Definition in Ifx_DSADC.FCFGM.B.DSH
147
*/
148
typedef
enum
149
{
150
IfxDsadc_FirDataShift_noShift
= 0,
/**< \brief no shift, use full range */
151
IfxDsadc_FirDataShift_shiftBy1
= 1,
/**< \brief Shift by 1 */
152
IfxDsadc_FirDataShift_shiftBy2
= 2,
/**< \brief Shift by 2 */
153
IfxDsadc_FirDataShift_shiftBy3
= 3
/**< \brief Shift by 3 */
154
}
IfxDsadc_FirDataShift
;
155
156
/** \brief FIR shift control\n
157
* Selects the displacement caused by the data shifter inbetween the FIR filter blocks.\n
158
* Definition in Ifx_DSADC.FCFGM.B.FSH
159
*/
160
typedef
enum
161
{
162
IfxDsadc_FirInternalShift_noShift
= 0,
/**< \brief no shift, use full range */
163
IfxDsadc_FirInternalShift_shiftBy1
= 1
/**< \brief Shift by 1 */
164
}
IfxDsadc_FirInternalShift
;
165
166
/** \brief Modulator configuration of positive/negative input line\n
167
* Definition in Ifx_DSADC.MODCFGx.B.INCFGP and Ifx_DSADC.MODCFGx.B.INCFGN
168
*/
169
typedef
enum
170
{
171
IfxDsadc_InputConfig_inputPin
= 0,
/**< \brief Modulator input connected to external pin */
172
IfxDsadc_InputConfig_supplyVoltage
= 1,
/**< \brief Modulator input connected to supply voltage V_ddm */
173
IfxDsadc_InputConfig_commonModeVoltage
= 2,
/**< \brief Modulator input connected to common mode voltage V_cm */
174
IfxDsadc_InputConfig_referenceGround
= 3
/**< \brief Modulator input connected to reference ground V_ref */
175
}
IfxDsadc_InputConfig
;
176
177
/** \brief Demodulator input data source selection\n
178
* Definition in Ifx_DSADC.DICFG.B.DSRC
179
*/
180
typedef
enum
181
{
182
IfxDsadc_InputDataSource_onChipStandAlone
= 0,
/**< \brief On-chip modulator, standalone (3rd order) */
183
IfxDsadc_InputDataSource_onChipCombined
= 1,
/**< \brief On-chip modulator, yield (2nd order) */
184
IfxDsadc_InputDataSource_directInputA
= 2,
/**< \brief External, from input A, direct */
185
IfxDsadc_InputDataSource_invertedInputA
= 3,
/**< \brief External, from input A, inverted */
186
IfxDsadc_InputDataSource_directInputB
= 4,
/**< \brief External, from input B, direct */
187
IfxDsadc_InputDataSource_invertedInputB
= 5
/**< \brief External, from input B, inverted */
188
}
IfxDsadc_InputDataSource
;
189
190
/** \brief Modulator gain select of analog input path\n
191
* Definition in Ifx_DSADC.MODCFGx.B.GAINSEL
192
*/
193
typedef
enum
194
{
195
IfxDsadc_InputGain_factor1
= 0,
/**< \brief Input gain factor: 1 */
196
IfxDsadc_InputGain_factor2
= 1,
/**< \brief Input gain factor: 2 */
197
IfxDsadc_InputGain_factor4
= 2,
/**< \brief Input gain factor: 4 */
198
IfxDsadc_InputGain_factor8
= 3,
/**< \brief Input gain factor: 8 */
199
IfxDsadc_InputGain_factor16
= 4
/**< \brief Input gain factor: 16 */
200
}
IfxDsadc_InputGain
;
201
202
/** \brief Modulator input pin selection\n
203
* Definition in Ifx_DSADC.MODCFGx.B.INMUX
204
*/
205
typedef
enum
206
{
207
IfxDsadc_InputPin_a
= 0,
/**< \brief Pin A connected to modulator input */
208
IfxDsadc_InputPin_b
= 1,
/**< \brief Pin B connected to modulator input */
209
IfxDsadc_InputPin_c
= 2,
/**< \brief Pin C connected to modulator input */
210
IfxDsadc_InputPin_d
= 3
/**< \brief Pin D connected to modulator input */
211
}
IfxDsadc_InputPin
;
212
213
/** \brief Integrator window size\n
214
* Definition in Ifx_DSADC.IWCTR.B.IWS
215
*/
216
typedef
enum
217
{
218
IfxDsadc_IntegrationWindowSize_internalControl
= 0,
/**< \brief Internal control: stop integrator after REPVAL+1 integration cycles */
219
IfxDsadc_IntegrationWindowSize_externalControl
= 1
/**< \brief External control: stop integrator when bit INTEN becomes 0 */
220
}
IfxDsadc_IntegrationWindowSize
;
221
222
/** \brief Integrator trigger mode\n
223
* NOTE: switch-first to bypassed before using other mode\n
224
* Definition in Ifx_DSADC.DICFG.B.ITRMODE
225
*/
226
typedef
enum
227
{
228
IfxDsadc_IntegratorTrigger_bypassed
= 0,
/**< \brief No integration trigger, integrator bypassed */
229
IfxDsadc_IntegratorTrigger_fallingEdge
= 1,
/**< \brief Trigger event upon a falling edge */
230
IfxDsadc_IntegratorTrigger_risingEdge
= 2,
/**< \brief Trigger event upon a rising edge */
231
IfxDsadc_IntegratorTrigger_alwaysActive
= 3
/**< \brief No trigger, integrator active all the time */
232
}
IfxDsadc_IntegratorTrigger
;
233
234
/** \brief Low power supply voltage select\n
235
* Definition in Ifx_DSADC.GLOBCFG.B.LOSUP
236
*/
237
typedef
enum
238
{
239
IfxDsadc_LowPowerSupply_5V
= 0,
/**< \brief Supply Voltage for Analog Circuitry set to 5V */
240
IfxDsadc_LowPowerSupply_3_3V
= 1
/**< \brief Supply Voltage for Analog Circuitry set to 3.3V */
241
}
IfxDsadc_LowPowerSupply
;
242
243
/** \brief Comb Filter (Main Chain) shift control\n
244
* Definition in Ifx_DSADC.FCFGC.B.MFSC
245
*/
246
typedef
enum
247
{
248
IfxDsadc_MainCombFilterShift_noShift
= 0,
/**< \brief no shift, use full range */
249
IfxDsadc_MainCombFilterShift_shiftBy1
= 1,
/**< \brief Shift by 1 */
250
IfxDsadc_MainCombFilterShift_shiftBy2
= 2,
/**< \brief Shift by 2 */
251
IfxDsadc_MainCombFilterShift_shiftBy3
= 3
/**< \brief Shift by 3 */
252
}
IfxDsadc_MainCombFilterShift
;
253
254
/** \brief Comb Filter (Main Chain) configuration/type\n
255
* Definition in Ifx_DSADC.FCFGC.B.CFMC
256
*/
257
typedef
enum
258
{
259
IfxDsadc_MainCombFilterType_comb1
= 0,
/**< \brief CIC1 */
260
IfxDsadc_MainCombFilterType_comb2
= 1,
/**< \brief CIC2 */
261
IfxDsadc_MainCombFilterType_comb3
= 2,
/**< \brief CIC3 */
262
IfxDsadc_MainCombFilterType_combF
= 3
/**< \brief CICF */
263
}
IfxDsadc_MainCombFilterType
;
264
265
/** \brief Service request generation (main chain)\n
266
* Definition in Ifx_DSADC.FCFGC.B.SRGM
267
*/
268
typedef
enum
269
{
270
IfxDsadc_MainServiceRequest_never
= 0,
/**< \brief Never, service requests disabled */
271
IfxDsadc_MainServiceRequest_highGateSignal
= 1,
/**< \brief While gate (selected trigger signal) is high */
272
IfxDsadc_MainServiceRequest_lowGateSignal
= 2,
/**< \brief While gate (selected trigger signal) is low */
273
IfxDsadc_MainServiceRequest_everyNewResult
= 3
/**< \brief Always, for each new result value */
274
}
IfxDsadc_MainServiceRequest
;
275
276
/** \brief Modulator clock select\n
277
* Definition in Ifx_DSADC.GLOBCFG.B.MCSEL
278
*/
279
typedef
enum
280
{
281
IfxDsadc_ModulatorClock_off
= 0,
/**< \brief Internal clock off, no source selected */
282
IfxDsadc_ModulatorClock_fDSD
= 1,
/**< \brief f_dsd clock selected */
283
IfxDsadc_ModulatorClock_fERAY
= 2,
/**< \brief f_eray clock selected */
284
IfxDsadc_ModulatorClock_fOSC0
= 3
/**< \brief f_osc0 clock selected */
285
}
IfxDsadc_ModulatorClock
;
286
287
/** \brief Modulator divider factor for modulator clock\n
288
* Definition in Ifx_DSADC.MODCFGx.B.DIVM
289
*/
290
typedef
enum
291
{
292
IfxDsadc_ModulatorClockDivider_div2
= 0,
/**< \brief f_mod = f_clk / 2 */
293
IfxDsadc_ModulatorClockDivider_div4
,
/**< \brief f_mod = f_clk / 4 */
294
IfxDsadc_ModulatorClockDivider_div6
,
/**< \brief f_mod = f_clk / 6 */
295
IfxDsadc_ModulatorClockDivider_div8
,
/**< \brief f_mod = f_clk / 8 */
296
IfxDsadc_ModulatorClockDivider_div10
,
/**< \brief f_mod = f_clk / 10 */
297
IfxDsadc_ModulatorClockDivider_div12
,
/**< \brief f_mod = f_clk / 12 */
298
IfxDsadc_ModulatorClockDivider_div14
,
/**< \brief f_mod = f_clk / 14 */
299
IfxDsadc_ModulatorClockDivider_div16
,
/**< \brief f_mod = f_clk / 16 */
300
IfxDsadc_ModulatorClockDivider_div18
,
/**< \brief f_mod = f_clk / 18 */
301
IfxDsadc_ModulatorClockDivider_div20
,
/**< \brief f_mod = f_clk / 20 */
302
IfxDsadc_ModulatorClockDivider_div22
,
/**< \brief f_mod = f_clk / 22 */
303
IfxDsadc_ModulatorClockDivider_div24
,
/**< \brief f_mod = f_clk / 24 */
304
IfxDsadc_ModulatorClockDivider_div26
,
/**< \brief f_mod = f_clk / 26 */
305
IfxDsadc_ModulatorClockDivider_div28
,
/**< \brief f_mod = f_clk / 28 */
306
IfxDsadc_ModulatorClockDivider_div30
,
/**< \brief f_mod = f_clk / 30 */
307
IfxDsadc_ModulatorClockDivider_div32
/**< \brief f_mod = f_clk / 32 */
308
}
IfxDsadc_ModulatorClockDivider
;
309
310
/** \brief Rectifier sign source\n
311
* Selects the sign signal that is to be delayed.\n
312
* Definition in Ifx_DSADC.RECT.B.SSRC
313
*/
314
typedef
enum
315
{
316
IfxDsadc_RectifierSignSource_onChipGenerator
= 0,
/**< \brief On-chip carrier generator */
317
IfxDsadc_RectifierSignSource_nextChannel
= 1,
/**< \brief Sign of result of next channel */
318
IfxDsadc_RectifierSignSource_externalA
= 2,
/**< \brief External sign signal A */
319
IfxDsadc_RectifierSignSource_externalB
= 3
/**< \brief External sign signal B */
320
}
IfxDsadc_RectifierSignSource
;
321
322
/** \brief Demodulator sample clock source select\n
323
* Definition in Ifx_DSADC.DICFG.B.CSRC
324
*/
325
typedef
enum
326
{
327
IfxDsadc_SampleClockSource_internal
= 0,
/**< \brief Internal clock */
328
IfxDsadc_SampleClockSource_inputA
= 1,
/**< \brief External clock, from Input A */
329
IfxDsadc_SampleClockSource_inputB
= 2,
/**< \brief External clock, from Input B */
330
IfxDsadc_SampleClockSource_inputC
= 3
/**< \brief External clock, from Input C */
331
}
IfxDsadc_SampleClockSource
;
332
333
/** \brief Demodulator data strobe generation mode\n
334
* Definition in Ifx_DSADC.DICFG.B.STROBE
335
*/
336
typedef
enum
337
{
338
IfxDsadc_SampleStrobe_noDataStrobe
= 0,
/**< \brief No data strobe */
339
IfxDsadc_SampleStrobe_sampleOnRisingEdge
= 1,
/**< \brief Direct clock, a sample trigger is generated at each rising clock edge */
340
IfxDsadc_SampleStrobe_sampleOnFallingEdge
= 2,
/**< \brief Direct clock, a sample trigger is generated at each falling clock edge */
341
IfxDsadc_SampleStrobe_sampleOnBothEdges
= 3,
/**< \brief Double data, a sample trigger is generated at each rising and falling clock edge */
342
IfxDsadc_SampleStrobe_reserved
= 4,
/**< \brief don't use */
343
IfxDsadc_SampleStrobe_sampleOnTwoRisingEdges
= 5,
/**< \brief Double clock, a sample trigger is generated at every 2nd rising clock edge */
344
IfxDsadc_SampleStrobe_sampleOnTwoFallingEdges
= 6
/**< \brief Double clock, a sample trigger is generated at every 2nd falling clock edge */
345
}
IfxDsadc_SampleStrobe
;
346
347
/** \brief Enable/disable the sensitivity of the module to sleep signal\n
348
* Definition in Ifx_DSADC.CLC.B.EDIS
349
*/
350
typedef
enum
351
{
352
IfxDsadc_SleepMode_enable
= 0,
/**< \brief enables sleep mode */
353
IfxDsadc_SleepMode_disable
= 1
/**< \brief disables sleep mode */
354
}
IfxDsadc_SleepMode
;
355
356
/** \brief Timestamp trigger mode\n
357
* Definition in Ifx_DSADC.DICFG.B.TSTRMODE
358
*/
359
typedef
enum
360
{
361
IfxDsadc_TimestampTrigger_noTrigger
= 0,
/**< \brief No timestamp trigger */
362
IfxDsadc_TimestampTrigger_fallingEdge
= 1,
/**< \brief Trigger event upon a falling edge */
363
IfxDsadc_TimestampTrigger_risingEdge
= 2,
/**< \brief Trigger event upon a rising edge */
364
IfxDsadc_TimestampTrigger_eachEdge
= 3
/**< \brief Trigger event upon each edge */
365
}
IfxDsadc_TimestampTrigger
;
366
367
/** \brief Trigger select\n
368
* Definition in Ifx_DSADC.DICFG.B.TRSEL
369
*/
370
typedef
enum
371
{
372
IfxDsadc_TriggerInput_a
= 0,
/**< \brief dsadc trig 0 */
373
IfxDsadc_TriggerInput_b
= 1,
/**< \brief dsadc trig 1 */
374
IfxDsadc_TriggerInput_c
= 2,
/**< \brief vadc trig 0 */
375
IfxDsadc_TriggerInput_d
= 3,
/**< \brief vadc trig 1 */
376
IfxDsadc_TriggerInput_e
= 4,
/**< \brief external pin e */
377
IfxDsadc_TriggerInput_f
= 5,
/**< \brief external pin f */
378
IfxDsadc_TriggerInput_g
= 6,
379
IfxDsadc_TriggerInput_h
= 7
380
}
IfxDsadc_TriggerInput
;
381
382
/** \} */
383
384
/** \addtogroup IfxLld_Dsadc_Std_Operative
385
* \{ */
386
387
/******************************************************************************/
388
/*-------------------------Inline Function Prototypes-------------------------*/
389
/******************************************************************************/
390
391
/** \brief Sets the sensitivity of the module to sleep signal
392
* \param dsadc pointer to DSADC registers
393
* \param mode mode selection (enable/disable)
394
* \return None
395
*/
396
IFX_INLINE
void
IfxDsadc_setSleepMode
(Ifx_DSADC *dsadc,
IfxDsadc_SleepMode
mode);
397
398
/** \brief Enables the conversion of multiple channels
399
* \param dsadc Pointer to the DSADC register space
400
* \param modulatorMask the modulator which should be running (bitwise selection)
401
* \param channelMask the channels which should be scanned (bitwise selection)
402
* \return None
403
*
404
* \code
405
* // enable the conversion of all 6 DSADC channels
406
* IfxDsadc_startScan(&MODULE_DSADC, 0x3FU, 0x3FU);
407
* // results are now available in IFXDSADC(ds).CH[x].RESM.B.RESULT (x=0..5)
408
* \endcode
409
*
410
*/
411
IFX_INLINE
void
IfxDsadc_startScan
(Ifx_DSADC *dsadc,
uint32
modulatorMask,
uint32
channelMask);
412
413
/** \brief Disables the conversion of multiple channels
414
* \param dsadc Pointer to the DSADC register space
415
* \param modulatorMask the modulator which should be disabled (bitwise selection)
416
* \return None
417
*
418
* \code
419
* // disable the modulators of all 6 DSADC channels
420
* IfxDsadc_stopScan(&MODULE_DSADC, 0x3FU);
421
* \endcode
422
*
423
*/
424
IFX_INLINE
void
IfxDsadc_stopScan
(Ifx_DSADC *dsadc,
uint32
modulatorMask);
425
426
/******************************************************************************/
427
/*-------------------------Global Function Prototypes-------------------------*/
428
/******************************************************************************/
429
430
/** \brief resets the DSADC kernel
431
* \param dsadc pointer to DSADC registers
432
* \return None
433
*/
434
IFX_EXTERN
void
IfxDsadc_resetModule
(Ifx_DSADC *dsadc);
435
436
/** \} */
437
438
/** \addtogroup IfxLld_Dsadc_Std_Support
439
* \{ */
440
441
/******************************************************************************/
442
/*-------------------------Inline Function Prototypes-------------------------*/
443
/******************************************************************************/
444
445
/** \brief Get result from the auxiliary chain
446
* \param dsadc Pointer to the DSADC register space
447
* \param channel Channel Id
448
* \return result from the auxiliary chain
449
*/
450
IFX_INLINE
sint16
IfxDsadc_getAuxResult
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel);
451
452
/** \brief Get the main comb decimation factor
453
* \param dsadc Pointer to the DSADC register space
454
* \param channel Channel Id
455
* \return the main comb decimation factor
456
*/
457
IFX_INLINE
uint16
IfxDsadc_getMainCombDecimation
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel);
458
459
/** \brief Get result from the main chain
460
* \param dsadc Pointer to the DSADC register space
461
* \param channel Channel Id
462
* \return result from the main chain
463
*/
464
IFX_INLINE
sint16
IfxDsadc_getMainResult
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel);
465
466
/** \brief Return TRUE if DSADC module is enabled
467
* \param dsadc Pointer to the DSADC register space
468
* \return TRUE if DSADC module is enabled
469
*/
470
IFX_INLINE
boolean
IfxDsadc_isModuleEnabled
(Ifx_DSADC *dsadc);
471
472
/** \brief Set the carrier waveform mode
473
* \param dsadc Pointer to the DSADC register space
474
* \param waveformMode the waveform mode
475
* \return None
476
*/
477
IFX_INLINE
void
IfxDsadc_setCarrierMode
(Ifx_DSADC *dsadc,
IfxDsadc_CarrierWaveformMode
waveformMode);
478
479
/******************************************************************************/
480
/*-------------------------Global Function Prototypes-------------------------*/
481
/******************************************************************************/
482
483
/** \brief Get the sample frequency of the integrator output in Hz
484
* \param dsadc Pointer to the DSADC register space
485
* \param channel Channel Id
486
* \return frequency in Hz
487
*/
488
IFX_EXTERN
float32
IfxDsadc_getIntegratorOutFreq
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel);
489
490
/** \brief Get the sample frequency of the main COMB filter output in Hz
491
* \param dsadc Pointer to the DSADC register space
492
* \param channel Channel Id
493
* \return frequency in Hz
494
*/
495
IFX_EXTERN
float32
IfxDsadc_getMainCombOutFreq
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel);
496
497
/** \brief Estimate the group delay of main-chain filters in seconds
498
* \param dsadc Pointer to the DSADC register space
499
* \param channel Channel Id
500
* \return delay in seconds
501
*/
502
IFX_EXTERN
float32
IfxDsadc_getMainGroupDelay
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel);
503
504
/** \brief Get the modulator clock frequency in Hz
505
* \param dsadc Pointer to the DSADC register space
506
* \param channel Channel Id
507
* \return frequency in Hz
508
*/
509
IFX_EXTERN
float32
IfxDsadc_getModulatorClockFreq
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel);
510
511
/** \brief Get the input frequency of DSADC in Hz
512
* \param dsadc Pointer to the DSADC register space
513
* \return frequency in Hz
514
*/
515
IFX_EXTERN
float32
IfxDsadc_getModulatorInputClockFreq
(Ifx_DSADC *dsadc);
516
517
/** \} */
518
519
/** \addtogroup IfxLld_Dsadc_Std_Interrupt
520
* \{ */
521
522
/******************************************************************************/
523
/*-------------------------Global Function Prototypes-------------------------*/
524
/******************************************************************************/
525
526
/** \brief Address/pointer to the interrupt source register
527
* \param dsadc Pointer to the DSADC register space
528
* \param channel Channel Id
529
* \return Address/pointer to the interrupt source register
530
*/
531
IFX_EXTERN
volatile
Ifx_SRC_SRCR *
IfxDsadc_getAuxSrc
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel);
532
533
/** \brief Get the interrupt source register for a Main event
534
* \param dsadc Pointer to the DSADC register space
535
* \param channel Channel Id
536
* \return Address/pointer to the interrupt source register
537
*/
538
IFX_EXTERN
volatile
Ifx_SRC_SRCR *
IfxDsadc_getMainSrc
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel);
539
540
/** \} */
541
542
/** \addtogroup IfxLld_Dsadc_Std_IO
543
* \{ */
544
545
/******************************************************************************/
546
/*-------------------------Inline Function Prototypes-------------------------*/
547
/******************************************************************************/
548
549
/** \brief Initializes a CGPWM output
550
* \param cgPwm the CGPWM Pin which should be configured
551
* \param pinMode the pin output mode which should be configured
552
* \param padDriver the pad driver mode which should be configured
553
* \return None
554
*/
555
IFX_INLINE
void
IfxDsadc_initCgPwmPin
(
const
IfxDsadc_Cgpwm_Out
*cgPwm,
IfxPort_OutputMode
pinMode,
IfxPort_PadDriver
padDriver);
556
557
/** \brief Initializes a CIN input
558
* \param cIn the CIN Pin which should be configured
559
* \param cInMode the pin input mode which should be configured
560
* \return None
561
*/
562
IFX_INLINE
void
IfxDsadc_initCinPin
(
const
IfxDsadc_Cin_In
*cIn,
IfxPort_InputMode
cInMode);
563
564
/** \brief Initializes a COUT output
565
* \param cout the COUT Pin which should be configured
566
* \param pinMode the pin output mode which should be configured
567
* \param padDriver the pad driver mode which should be configured
568
* \return None
569
*/
570
IFX_INLINE
void
IfxDsadc_initCoutPin
(
const
IfxDsadc_Cout_Out
*cout,
IfxPort_OutputMode
pinMode,
IfxPort_PadDriver
padDriver);
571
572
/** \brief Initializes a DIN input
573
* \param dIn the DIN Pin which should be configured
574
* \param dInMode the pin input mode which should be configured
575
* \return None
576
*/
577
IFX_INLINE
void
IfxDsadc_initDinPin
(
const
IfxDsadc_Din_In
*dIn,
IfxPort_InputMode
dInMode);
578
579
/** \brief Initializes a DS input
580
* \param dsn the DSN Pin which should be configured
581
* \param pinMode the pin input mode which should be configured
582
* \return None
583
*/
584
IFX_INLINE
void
IfxDsadc_initDsnPin
(
const
IfxDsadc_Dsn_In
*dsn,
IfxPort_InputMode
pinMode);
585
586
/** \brief Initializes a DS input
587
* \param dsp the DSP Pin which should be configured
588
* \param pinMode the pin input mode which should be configured
589
* \return None
590
*/
591
IFX_INLINE
void
IfxDsadc_initDspPin
(
const
IfxDsadc_Dsp_In
*dsp,
IfxPort_InputMode
pinMode);
592
593
/** \brief Initializes a ITR input
594
* \param itr the ITR Pin which should be configured
595
* \param itrMode the pin input mode which should be configured
596
* \return None
597
*/
598
IFX_INLINE
void
IfxDsadc_initItrPin
(
const
IfxDsadc_Itr_In
*itr,
IfxPort_InputMode
itrMode);
599
600
/** \brief Initializes a SG input
601
* \param sg the SG Pin which should be configured
602
* \param pinMode the pin input mode which should be configured
603
* \return None
604
*/
605
IFX_INLINE
void
IfxDsadc_initSgPin
(
const
IfxDsadc_Sg_In
*sg,
IfxPort_InputMode
pinMode);
606
607
/** \} */
608
609
/******************************************************************************/
610
/*---------------------Inline Function Implementations------------------------*/
611
/******************************************************************************/
612
613
IFX_INLINE
sint16
IfxDsadc_getAuxResult
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel)
614
{
615
return
(
sint16
)(dsadc->CH[channel].RESA.B.RESULT);
616
}
617
618
619
IFX_INLINE
uint16
IfxDsadc_getMainCombDecimation
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel)
620
{
621
return
(
uint16
)(1U + dsadc->CH[channel].FCFGC.B.CFMDF);
622
}
623
624
625
IFX_INLINE
sint16
IfxDsadc_getMainResult
(Ifx_DSADC *dsadc,
IfxDsadc_ChannelId
channel)
626
{
627
return
(
sint16
)(dsadc->CH[channel].RESM.B.RESULT);
628
}
629
630
631
IFX_INLINE
void
IfxDsadc_initCgPwmPin
(
const
IfxDsadc_Cgpwm_Out
*cgPwm,
IfxPort_OutputMode
pinMode,
IfxPort_PadDriver
padDriver)
632
{
633
IfxPort_setPinModeOutput
(cgPwm->
pin
.
port
, cgPwm->
pin
.
pinIndex
, pinMode, cgPwm->
select
);
634
IfxPort_setPinPadDriver
(cgPwm->
pin
.
port
, cgPwm->
pin
.
pinIndex
, padDriver);
635
}
636
637
638
IFX_INLINE
void
IfxDsadc_initCinPin
(
const
IfxDsadc_Cin_In
*cIn,
IfxPort_InputMode
cInMode)
639
{
640
IfxPort_setPinModeInput
(cIn->
pin
.
port
, cIn->
pin
.
pinIndex
, cInMode);
641
}
642
643
644
IFX_INLINE
void
IfxDsadc_initCoutPin
(
const
IfxDsadc_Cout_Out
*cout,
IfxPort_OutputMode
pinMode,
IfxPort_PadDriver
padDriver)
645
{
646
IfxPort_setPinModeOutput
(cout->
pin
.
port
, cout->
pin
.
pinIndex
, pinMode, cout->
select
);
647
IfxPort_setPinPadDriver
(cout->
pin
.
port
, cout->
pin
.
pinIndex
, padDriver);
648
}
649
650
651
IFX_INLINE
void
IfxDsadc_initDinPin
(
const
IfxDsadc_Din_In
*dIn,
IfxPort_InputMode
dInMode)
652
{
653
IfxPort_setPinModeInput
(dIn->
pin
.
port
, dIn->
pin
.
pinIndex
, dInMode);
654
}
655
656
657
IFX_INLINE
void
IfxDsadc_initDsnPin
(
const
IfxDsadc_Dsn_In
*dsn,
IfxPort_InputMode
pinMode)
658
{
659
if
(dsn->
pin
.
port
!=
NULL_PTR
)
660
{
661
IfxPort_setPinModeInput
(dsn->
pin
.
port
, dsn->
pin
.
pinIndex
, pinMode);
662
}
663
}
664
665
666
IFX_INLINE
void
IfxDsadc_initDspPin
(
const
IfxDsadc_Dsp_In
*dsp,
IfxPort_InputMode
pinMode)
667
{
668
if
(dsp->
pin
.
port
!=
NULL_PTR
)
669
{
670
IfxPort_setPinModeInput
(dsp->
pin
.
port
, dsp->
pin
.
pinIndex
, pinMode);
671
}
672
}
673
674
675
IFX_INLINE
void
IfxDsadc_initItrPin
(
const
IfxDsadc_Itr_In
*itr,
IfxPort_InputMode
itrMode)
676
{
677
IfxPort_setPinModeInput
(itr->
pin
.
port
, itr->
pin
.
pinIndex
, itrMode);
678
}
679
680
681
IFX_INLINE
void
IfxDsadc_initSgPin
(
const
IfxDsadc_Sg_In
*sg,
IfxPort_InputMode
pinMode)
682
{
683
IfxPort_setPinModeInput
(sg->
pin
.
port
, sg->
pin
.
pinIndex
, pinMode);
684
}
685
686
687
IFX_INLINE
boolean
IfxDsadc_isModuleEnabled
(Ifx_DSADC *dsadc)
688
{
689
return
dsadc->CLC.B.DISS == 0;
690
}
691
692
693
IFX_INLINE
void
IfxDsadc_setCarrierMode
(Ifx_DSADC *dsadc,
IfxDsadc_CarrierWaveformMode
waveformMode)
694
{
695
dsadc->CGCFG.B.CGMOD = waveformMode;
696
}
697
698
699
IFX_INLINE
void
IfxDsadc_setSleepMode
(Ifx_DSADC *dsadc,
IfxDsadc_SleepMode
mode)
700
{
701
uint16
passwd =
IfxScuWdt_getCpuWatchdogPassword
();
702
IfxScuWdt_clearCpuEndinit
(passwd);
703
dsadc->CLC.B.EDIS = mode;
704
IfxScuWdt_setCpuEndinit
(passwd);
705
}
706
707
708
IFX_INLINE
void
IfxDsadc_startScan
(Ifx_DSADC *dsadc,
uint32
modulatorMask,
uint32
channelMask)
709
{
710
dsadc->GLOBRC.U = dsadc->GLOBRC.U | ((modulatorMask << 16) | (channelMask));
711
}
712
713
714
IFX_INLINE
void
IfxDsadc_stopScan
(Ifx_DSADC *dsadc,
uint32
modulatorMask)
715
{
716
dsadc->GLOBRC.U &= ~(modulatorMask << 16);
717
}
718
719
720
#endif
/* IFXDSADC_H */
home
mclld
Libraries
release
iLLD_1_0_0_11_0
src
ifx
TC29x
Dsadc
Std
IfxDsadc.h
Generated by
1.8.4