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