Infineon MOTIX™ MCU TLE987x Device Family SDK
sdadc.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) Infineon Technologies AG
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the
8  * following conditions are met:
9  *
10  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
11  * disclaimer.
12  *
13  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
14  * following disclaimer in the documentation and/or other materials provided with the distribution.
15  *
16  * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
17  * products derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  **********************************************************************************************************************/
37 /*******************************************************************************
38 ** Author(s) Identity **
39 ********************************************************************************
40 ** Initials Name **
41 ** ---------------------------------------------------------------------------**
42 ** DM Daniel Mysliwitz **
43 ** BG Blandine Guillot **
44 ** JO Julia Ott **
45 *******************************************************************************/
46 
47 /*******************************************************************************
48 ** Revision Control History **
49 ********************************************************************************
50 ** V0.1.0: 2017-11-07, DM: Initial version **
51 ** MISRA 2012 compliance, the following PC-Lint **
52 ** rules are globally deactivated: **
53 ** - Info 793: ANSI/ISO limit of 6 'significant **
54 ** characters in an external identifier **
55 ** - Info 835: A zero has been given as right **
56 ** argument to operator **
57 ** - Info 845: The left argument to operator '&' **
58 ** is certain to be 0 **
59 ** V0.1.1: 2017-11-21, DM: ADC34 prefix in API function replaced by SDADC **
60 ** V0.1.2: 2018-11-27, JO: Doxygen update **
61 ** Moved revision history from sdadc.c to sdadc.h **
62 ** V0.1.3: 2020-04-15, BG: Updated revision history format **
63 ** V0.1.4: 2020-07-21, BG: EP-439: Formatted .h/.c files **
64 ** V0.1.5: 2022-02-28, JO: EP-936: Updated copyright and branding **
65 ** V0.1.6: 2022-10-18, VO: EP-1252: Updated enum definitions **
66 *******************************************************************************/
67 
68 #ifndef SDADC_H
69 #define SDADC_H
70 
71 /*******************************************************************************
72 ** Includes **
73 *******************************************************************************/
74 #include "tle987x.h"
75 #include "types.h"
76 #include "sfr_access.h"
77 
78 /*******************************************************************************
79 ** Global Type Declarations **
80 *******************************************************************************/
84 typedef enum SDADC_OSR
85 {
90  SDADC_OSR_2048 = 11
92 
96 typedef enum SDADC_DITHVAL
97 {
113  SDADC_DITH_187_5_mV = 15
115 
119 typedef enum SDADC_EOC_CNT
120 {
126 
127 /*******************************************************************************
128 ** Global Inline Function Definitions **
129 *******************************************************************************/
143 {
145 }
146 
160 {
163 }
164 
178 {
180 }
181 
195 {
198 }
199 
218 {
219  return ((sint16)ADC34->RESU.bit.ADC3_RESU);
220 }
221 
240 {
241  return ((sint16)ADC34->RESU.bit.ADC4_RESU);
242 }
243 
260 {
262 }
263 
280 {
282 }
283 
297 {
299 }
300 
314 {
316 }
317 
333 {
335 }
336 
352 {
354 }
355 
370 {
372 }
373 
388 {
390 }
391 
406 {
408 }
409 
424 {
426 }
427 
443 {
445 }
446 
462 {
465 }
466 
486 {
488 }
489 
509 {
511 }
512 
526 {
528 }
529 
543 {
545 }
546 
561 {
563 }
564 
579 {
581 }
582 
597 {
599 }
600 
615 {
617 }
618 
637 {
639 }
640 
659 {
661 }
662 
681 {
683 }
684 
704 {
706 }
707 
726 {
728 }
729 
749 {
751 }
752 
753 /*******************************************************************************
754 ** Global Function Declarations **
755 *******************************************************************************/
760 void SDADC_Init(void);
761 
762 #endif
#define SCUPM
Definition: tle987x.h:6098
#define ADC34
Definition: tle987x.h:6085
#define ADC34_CTRL_STS_ADC3_OFS_MEAS_EN_Pos
Definition: tle987x.h:6807
#define ADC34_CTRL_STS_ADC3_OSR_Msk
Definition: tle987x.h:6798
#define ADC34_CTRL_STS_ADC34_DITHVAL_Pos
Definition: tle987x.h:6783
#define SCUPM_SYS_IRQ_CTRL_ADC4_EOC_IE_Msk
Definition: tle987x.h:9593
#define ADC34_CTRL_STS_ADC4_SOC_Msk
Definition: tle987x.h:6792
#define ADC34_CTRL_STS_ADC34_REF_SEL_Msk
Definition: tle987x.h:6800
#define SCUPM_SYS_ISCLR_ADC4_EOC_ICLR_Pos
Definition: tle987x.h:9702
#define SCUPM_SYS_IRQ_CTRL_ADC3_EOC_IE_Msk
Definition: tle987x.h:9595
#define ADC34_CTRL_STS_ADC34_REF_SEL_Pos
Definition: tle987x.h:6799
#define ADC34_CTRL_STS_ADC4_EoC_STS_Pos
Definition: tle987x.h:6789
#define SCUPM_SYS_ISCLR_ADC4_EOC_ICLR_Msk
Definition: tle987x.h:9703
#define ADC34_CTRL_STS_ADC3_SOC_Pos
Definition: tle987x.h:6805
#define ADC34_CTRL_STS_ADC34_DITHEN_Msk
Definition: tle987x.h:6786
#define ADC34_CTRL_STS_ADC34_DITHEN_Pos
Definition: tle987x.h:6785
#define ADC34_CTRL_STS_ADC4_SOC_Pos
Definition: tle987x.h:6791
#define ADC34_CTRL_STS_ADC3_EoC_STS_Pos
Definition: tle987x.h:6803
#define ADC34_CTRL_STS_ADC4_EN_Pos
Definition: tle987x.h:6795
#define ADC34_CTRL_STS_ADC4_EoC_STS_Msk
Definition: tle987x.h:6790
#define ADC34_CTRL_STS_ADC4_OFS_MEAS_EN_Pos
Definition: tle987x.h:6793
#define ADC34_CTRL_STS_ADC4_OSR_Pos
Definition: tle987x.h:6781
#define ADC34_CTRL_STS_ADC4_EN_Msk
Definition: tle987x.h:6796
#define ADC34_CTRL_STS_ADC4_OFS_MEAS_EN_Msk
Definition: tle987x.h:6794
#define ADC34_CTRL_STS_ADC3_EN_Msk
Definition: tle987x.h:6810
#define ADC34_CTRL_STS_ADC3_EoC_STS_Msk
Definition: tle987x.h:6804
#define SCUPM_SYS_IRQ_CTRL_ADC3_EOC_IE_Pos
Definition: tle987x.h:9594
#define SCUPM_SYS_ISCLR_ADC3_EOC_ICLR_Msk
Definition: tle987x.h:9705
#define ADC34_CTRL_STS_ADC3_SOC_Msk
Definition: tle987x.h:6806
#define ADC34_CTRL_STS_ADC3_OFS_MEAS_EN_Msk
Definition: tle987x.h:6808
#define ADC34_CTRL_STS_ADC34_DITHVAL_Msk
Definition: tle987x.h:6784
#define ADC34_CTRL_STS_ADC3_OSR_Pos
Definition: tle987x.h:6797
#define ADC34_CTRL_STS_ADC3_EN_Pos
Definition: tle987x.h:6809
#define ADC34_CTRL_STS_ADC34_EoC_CNT_Msk
Definition: tle987x.h:6788
#define SCUPM_SYS_ISCLR_ADC3_EOC_ICLR_Pos
Definition: tle987x.h:9704
#define SCUPM_SYS_IRQ_CTRL_ADC4_EOC_IE_Pos
Definition: tle987x.h:9592
#define ADC34_CTRL_STS_ADC4_OSR_Msk
Definition: tle987x.h:6782
#define ADC34_CTRL_STS_ADC34_EoC_CNT_Pos
Definition: tle987x.h:6787
INLINE void SDADC_Ch1_SOC_Rst(void)
disables ADC4 conversion
Definition: sdadc.h:423
INLINE uint8 SDADC_Ch0_EOC_Sts(void)
reads ADC3 End of Conversion Status
Definition: sdadc.h:485
INLINE void SDADC_Ch0_Power_On(void)
enables ADC3 analog frontend.
Definition: sdadc.h:142
INLINE void SDADC_Dithering_Dis(void)
disables ADC34 Dithering
Definition: sdadc.h:313
INLINE void SDADC_Ch1_Power_Off(void)
disables ADC4 analog frontend and ADC4 conversion.
Definition: sdadc.h:194
SDADC_DITHVAL
Definition: sdadc.h:97
@ SDADC_DITH_0_mV
Definition: sdadc.h:98
@ SDADC_DITH_25_0_mV
Definition: sdadc.h:100
@ SDADC_DITH_150_0_mV
Definition: sdadc.h:110
@ SDADC_DITH_12_5_mV
Definition: sdadc.h:99
@ SDADC_DITH_112_5_mV
Definition: sdadc.h:107
@ SDADC_DITH_162_5_mV
Definition: sdadc.h:111
@ SDADC_DITH_175_0_mV
Definition: sdadc.h:112
@ SDADC_DITH_75_0_mV
Definition: sdadc.h:104
@ SDADC_DITH_62_5_mV
Definition: sdadc.h:103
@ SDADC_DITH_125_0_mV
Definition: sdadc.h:108
@ SDADC_DITH_50_0_mV
Definition: sdadc.h:102
@ SDADC_DITH_87_5_mV
Definition: sdadc.h:105
@ SDADC_DITH_137_5_mV
Definition: sdadc.h:109
@ SDADC_DITH_187_5_mV
Definition: sdadc.h:113
@ SDADC_DITH_100_0_mV
Definition: sdadc.h:106
@ SDADC_DITH_37_5_mV
Definition: sdadc.h:101
INLINE void SDADC_IRQ_Rate_Sel(uint32 rate)
selects ADC34 EoC counter (IRQ rate of ADC34)
Definition: sdadc.h:351
INLINE void SDADC_VAREF_Set(void)
sets ADC34 reference voltage to VAREF
Definition: sdadc.h:525
INLINE void SDADC_Ch1_SOC_Set(void)
enables ADC4 conversion
Definition: sdadc.h:405
INLINE void SDADC_Ch0_Offset_Meas_Dis(void)
disables ADC3 Offset Measurement
Definition: sdadc.h:578
INLINE void SDADC_Dithering_En(void)
enables ADC34 Dithering
Definition: sdadc.h:296
INLINE void SDADC_Dithering_Sel(uint32 dith)
selects ADC34 Dithering value
Definition: sdadc.h:332
INLINE void SDADC_Ch0_Int_En(void)
enables ADC3 EOC Interrupt.
Definition: sdadc.h:680
INLINE void SDADC_VDDEXT_Set(void)
sets ADC34 reference voltage to VDDEXT
Definition: sdadc.h:542
INLINE void SDADC_Ch0_OverSamplingRatio_Sel(uint32 osr)
selects ADC3 Oversampling Ratio
Definition: sdadc.h:259
void SDADC_Init(void)
Initializes the SDADC module (ADC3 and ADC4) based on the Config Wizard for MOTIX MCU configuration.
INLINE void SDADC_Ch1_Int_Clr(void)
clears ADC4 EOC Interrupt flag.
Definition: sdadc.h:658
INLINE void SDADC_Ch1_Int_Dis(void)
disables ADC4 EOC Interrupt.
Definition: sdadc.h:748
INLINE void SDADC_Ch1_Power_On(void)
enables ADC4 analog frontend.
Definition: sdadc.h:177
INLINE void SDADC_Ch0_Int_Dis(void)
disables ADC3 EOC Interrupt.
Definition: sdadc.h:703
INLINE void SDADC_Ch1_Offset_Meas_En(void)
enables ADC4 Offset Measurement
Definition: sdadc.h:596
INLINE void SDADC_Ch1_Int_En(void)
enables ADC4 EOC Interrupt.
Definition: sdadc.h:725
INLINE void SDADC_Ch1_OverSamplingRatio_Sel(uint32 osr)
selects ADC4 Oversampling Ratio
Definition: sdadc.h:279
INLINE void SDADC_Ch0_Int_Clr(void)
clears ADC3 EOC Interrupt flag.
Definition: sdadc.h:636
enum SDADC_EOC_CNT TSDADC_EOC_CNT
INLINE void SDADC_Ch0_SOC_Set(void)
enables ADC3 conversion
Definition: sdadc.h:369
INLINE void SDADC_SOC_Set(void)
enables ADC3 and ADC4 conversions
Definition: sdadc.h:442
INLINE uint8 SDADC_Ch1_EOC_Sts(void)
reads ADC4 End of Conversion Status
Definition: sdadc.h:508
enum SDADC_DITHVAL TSDADC_DITHVAL
INLINE void SDADC_Ch1_Offset_Meas_Dis(void)
disables ADC4 Offset Measurement
Definition: sdadc.h:614
enum SDADC_OSR TSDADC_OSR
INLINE void SDADC_SOC_Rst(void)
disables ADC3 and ADC4 conversions
Definition: sdadc.h:461
INLINE sint16 SDADC_Ch1_Result_Get(void)
gets ADC4 Result value
Definition: sdadc.h:239
SDADC_EOC_CNT
Definition: sdadc.h:120
@ SDADC_IRQ_AFTER_EVERY_EOC
Definition: sdadc.h:121
@ SDADC_IRQ_AFTER_16TH_EOC
Definition: sdadc.h:123
@ SDADC_IRQ_AFTER_8TH_EOC
Definition: sdadc.h:122
@ SDADC_IRQ_AFTER_32ND_EOC
Definition: sdadc.h:124
INLINE void SDADC_Ch0_SOC_Rst(void)
disables ADC3 conversion
Definition: sdadc.h:387
INLINE void SDADC_Ch0_Power_Off(void)
disables ADC3 analog frontend and ADC3 conversion.
Definition: sdadc.h:159
INLINE sint16 SDADC_Ch0_Result_Get(void)
gets ADC3 Result value
Definition: sdadc.h:217
SDADC_OSR
Definition: sdadc.h:85
@ SDADC_OSR_128
Definition: sdadc.h:86
@ SDADC_OSR_1024
Definition: sdadc.h:89
@ SDADC_OSR_2048
Definition: sdadc.h:90
@ SDADC_OSR_256
Definition: sdadc.h:87
@ SDADC_OSR_512
Definition: sdadc.h:88
INLINE void SDADC_Ch0_Offset_Meas_En(void)
enables ADC3 Offset Measurement
Definition: sdadc.h:560
SFR low level access library.
INLINE void Field_Mod32(volatile uint32 *reg, uint32 pos, uint32 msk, uint32 val)
This function writes a bit field in a 32-bit register.
Definition: sfr_access.h:362
INLINE uint8 u1_Field_Rd32(const volatile uint32 *reg, uint32 pos, uint32 msk)
This function reads a 1-bit field of a 32-bit register.
Definition: sfr_access.h:407
INLINE void Field_Wrt32(volatile uint32 *reg, uint32 pos, uint32 msk, uint32 val)
This function writes a bit field in a 32-bit register.
Definition: sfr_access.h:347
CMSIS register HeaderFile.
General type declarations.
#define INLINE
Definition: types.h:148
uint8_t uint8
8 bit unsigned value
Definition: types.h:153
int16_t sint16
16 bit signed value
Definition: types.h:159
uint32_t uint32
32 bit unsigned value
Definition: types.h:155