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