Infineon MOTIX™ MCU TLE988x/9x 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  * The applicable license agreement can be found at this pack's installation directory in the file
8  * license/IFX_SW_Licence_MOTIX_LITIX.txt
9  *
10  **********************************************************************************************************************/
26 /*******************************************************************************
27 ** Author(s) Identity **
28 ********************************************************************************
29 ** Initials Name **
30 ** ---------------------------------------------------------------------------**
31 ** DM Daniel Mysliwitz **
32 ** BG Blandine Guillot **
33 ** JO Julia Ott **
34 *******************************************************************************/
35 
36 /*******************************************************************************
37 ** Revision Control History **
38 ********************************************************************************
39 ** V0.1.0: 2019-10-28, DM: Initial version **
40 ** V0.2.0: 2020-04-28, BG: Updated revision history format **
41 ** V0.3.0: 2020-08-24, BG: Added first functions **
42 ** V0.3.1: 2020-09-16, BG: Added interrupt enable/disable functions **
43 ** V0.3.2: 2020-10-01, BG: Corrected output type for timestamp functions **
44 ** (uint8 -> uint16) **
45 ** V0.3.3: 2020-10-21, BG: EP-539: Considered the enable checkbox in CW in **
46 ** the initialization function **
47 ** V0.3.4: 2020-11-12, JO: EP-590: Removed \param none and \return none to **
48 ** avoid doxygen warning **
49 ** Added end of group for doxygen **
50 ** V0.3.5: 2020-11-20, BG: EP-610: Corrected MISRA 2012 errors **
51 ** The following rules are globally deactivated: **
52 ** - Info 774: Boolean within 'if' always evaluates **
53 ** to False/True **
54 ** V0.3.6: 2020-12-18, BG: EP-652: Corrected name of error code variable **
55 ** V0.3.7: 2021-04-06, BG: EP-760: Replaced if instructions to check if the **
56 ** module is enabled with preprocessor directives to**
57 ** avoid compiler warnings **
58 ** V0.3.8: 2021-06-11, JO: EP-838: Corrected Interrupt En/Dis functions **
59 ** and SDADC_disSuspendMode **
60 ** V0.3.9: 2021-11-12, JO: EP-937: Updated copyright and branding **
61 ** V0.4.0: 2022-04-19, JO: EP-999: Changed return value of functions **
62 ** SDADC_getCh0Result/SDADC_getCh1Result to sint16 **
63 ** V0.4.1: 2024-11-05, JO: EP-1494: Updated license **
64 *******************************************************************************/
65 
66 #ifndef _SDADC_H
67 #define _SDADC_H
68 
69 /*******************************************************************************
70 ** Includes **
71 *******************************************************************************/
72 
73 #include "types.h"
74 #include "tle989x.h"
75 #include "tle_variants.h"
76 #include "sdadc_defines.h"
77 
78 /*******************************************************************************
79 ** Global Constant Declarations **
80 *******************************************************************************/
81 
82 /*******************************************************************************
83 ** Global Type Declarations **
84 *******************************************************************************/
85 
86 /*******************************************************************************
87 ** Global Function Declarations **
88 *******************************************************************************/
89 
90 sint8 SDADC_init(void);
91 INLINE void SDADC_enCh0ResInt(void);
92 INLINE void SDADC_disCh0ResInt(void);
93 INLINE void SDADC_enCh0CmpUpInt(void);
94 INLINE void SDADC_disCh0CmpUpInt(void);
95 INLINE void SDADC_enCh0CmpLoInt(void);
96 INLINE void SDADC_disCh0CmpLoInt(void);
97 INLINE void SDADC_enCh1ResInt(void);
98 INLINE void SDADC_disCh1ResInt(void);
99 INLINE void SDADC_enCh1CmpUpInt(void);
100 INLINE void SDADC_disCh1CmpUpInt(void);
101 INLINE void SDADC_enCh1CmpLoInt(void);
102 INLINE void SDADC_disCh1CmpLoInt(void);
109 INLINE void SDADC_clrCh0ResIntSts(void);
112 INLINE void SDADC_clrCh1ResIntSts(void);
115 INLINE void SDADC_enSuspendMode(void);
116 INLINE void SDADC_disSuspendMode(void);
134 INLINE void SDADC_clrCh0CmpUpSts(void);
135 INLINE void SDADC_clrCh0CmpLoSts(void);
136 INLINE void SDADC_clrCh0WFRSts(void);
137 INLINE void SDADC_clrCh1CmpUpSts(void);
138 INLINE void SDADC_clrCh1CmpLoSts(void);
139 INLINE void SDADC_clrCh1WFRSts(void);
140 
141 /*******************************************************************************
142 ** Deprecated Function Declarations **
143 *******************************************************************************/
147 void SDADC_setCh0ResIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime, use the ConfigWizard to configure this feature!")));
148 
152 void SDADC_setCh0CmpUpIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime, use the ConfigWizard to configure this feature!")));
153 
157 void SDADC_setCh0CmpLoIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime, use the ConfigWizard to configure this feature!")));
158 
162 void SDADC_setCh1ResIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime, use the ConfigWizard to configure this feature!")));
163 
167 void SDADC_setCh1CmpUpIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime, use the ConfigWizard to configure this feature!")));
168 
172 void SDADC_setCh1CmpLoIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime, use the ConfigWizard to configure this feature!")));
173 
174 
175 /*******************************************************************************
176 ** Global Inline Function Definitions **
177 *******************************************************************************/
181 {
182  SDADC->IEN.bit.RES0_EN = 1u;
183 }
184 
188 {
189  SDADC->IEN.bit.RES0_EN = 0u;
190 }
191 
195 {
196  SDADC->IEN.bit.CMP0_UP_EN = 1u;
197 }
198 
202 {
203  SDADC->IEN.bit.CMP0_UP_EN = 0u;
204 }
205 
209 {
210  SDADC->IEN.bit.CMP0_LO_EN = 1u;
211 }
212 
216 {
217  SDADC->IEN.bit.CMP0_LO_EN = 0u;
218 }
219 
223 {
224  SDADC->IEN.bit.RES1_EN = 1u;
225 }
226 
230 {
231  SDADC->IEN.bit.RES1_EN = 0u;
232 }
233 
237 {
238  SDADC->IEN.bit.CMP1_UP_EN = 1u;
239 }
240 
244 {
245  SDADC->IEN.bit.CMP1_UP_EN = 0u;
246 }
247 
251 {
252  SDADC->IEN.bit.CMP1_LO_EN = 1u;
253 }
254 
258 {
259  SDADC->IEN.bit.CMP1_LO_EN = 0u;
260 }
261 
267 {
268  return (uint8)SDADC->IS.bit.RES0_IS;
269 }
270 
276 {
277  return (uint8)SDADC->IS.bit.CMP0_UP_IS;
278 }
279 
285 {
286  return (uint8)SDADC->IS.bit.CMP0_LO_IS;
287 }
288 
294 {
295  return (uint8)SDADC->IS.bit.RES1_IS;
296 }
297 
303 {
304  return (uint8)SDADC->IS.bit.CMP1_UP_IS;
305 }
306 
312 {
313  return (uint8)SDADC->IS.bit.CMP1_LO_IS;
314 }
315 
319 {
320  SDADC->ISR.bit.RES0_ISC = 1u;
321 }
322 
326 {
327  SDADC->ISR.bit.CMP0_UP_ISC = 1u;
328 }
329 
333 {
334  SDADC->ISR.bit.CMP0_LO_ISC = 1u;
335 }
336 
340 {
341  SDADC->ISR.bit.RES1_ISC = 1u;
342 }
343 
347 {
348  SDADC->ISR.bit.CMP1_UP_ISC = 1u;
349 }
350 
354 {
355  SDADC->ISR.bit.CMP1_LO_ISC = 1u;
356 }
357 
361 {
362  SDADC->SUSCTR.bit.EN = 1u;
363 }
364 
368 {
369  SDADC->SUSCTR.bit.EN = 0u;
370 }
371 
377 {
378  return (uint8)SDADC->SUSSTAT.bit.STAT;
379 }
380 
386 {
387  return (sint16)SDADC->RES0.bit.RESULT;
388 }
389 
395 {
396  return (uint16)SDADC->RES0.bit.TIMVAL;
397 }
398 
404 {
405  return (uint16)SDADC->CTIM0.bit.TIMVAL;
406 }
407 
413 {
414  return (uint8)SDADC->RES0.bit.VALCNT;
415 }
416 
422 {
423  return (uint8)SDADC->RES0.bit.RESVALID;
424 }
425 
431 {
432  return (sint16)SDADC->RES1.bit.RESULT;
433 }
434 
440 {
441  return (uint16)SDADC->RES1.bit.TIMVAL;
442 }
443 
449 {
450  return (uint16)SDADC->CTIM1.bit.TIMVAL;
451 }
452 
458 {
459  return (uint8)SDADC->RES1.bit.VALCNT;
460 }
461 
467 {
468  return (uint8)SDADC->RES1.bit.RESVALID;
469 }
470 
476 {
477  return (uint8)SDADC->STS.bit.CMP0_UP_STS;
478 }
479 
485 {
486  return (uint8)SDADC->STS.bit.CMP0_LO_STS;
487 }
488 
494 {
495  return (uint8)SDADC->STS.bit.WFR0_STS;
496 }
497 
503 {
504  return (uint8)SDADC->STS.bit.CMP1_UP_STS;
505 }
506 
512 {
513  return (uint8)SDADC->STS.bit.CMP1_LO_STS;
514 }
515 
521 {
522  return (uint8)SDADC->STS.bit.WFR1_STS;
523 }
524 
528 {
529  SDADC->STSR.bit.CMP0_UP_SC = 1u;
530 }
531 
535 {
536  SDADC->STSR.bit.CMP0_LO_SC = 1u;
537 }
538 
542 {
543  SDADC->STSR.bit.WFR0_SC = 1u;
544 }
545 
549 {
550  SDADC->STSR.bit.CMP1_UP_SC = 1u;
551 }
552 
556 {
557  SDADC->STSR.bit.CMP1_LO_SC = 1u;
558 }
559 
563 {
564  SDADC->STSR.bit.WFR1_SC = 1u;
565 }
566 
569 #endif /* _SDADC_H */
#define SDADC
Definition: tle989x.h:24076
INLINE void SDADC_enCh1CmpLoInt(void)
Enable Channel 1 Lower Compare Level Interrupt.
Definition: sdadc.h:250
void SDADC_setCh0CmpLoIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime
Set Channel 0 Lower Compare Level Interrupt Node Pointer.
INLINE uint16 SDADC_getCh0CaptTimestamp(void)
Get Channel 0 Captured Timestamp SDADC.CTIM0.TIMVAL.
Definition: sdadc.h:403
void SDADC_setCh1CmpLoIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime
Set Channel 1 Lower Compare Level Interrupt Node Pointer.
INLINE uint8 SDADC_getCh0CmpUpIntSts(void)
Get Channel 0 Upper Compare Level Interrupt Status SDADC.IS.CMP0_UP_IS.
Definition: sdadc.h:275
INLINE uint8 SDADC_getCh1CmpLoSts(void)
Get Channel 1 Lower Compare Level Status SDADC.STS.CMP1_LO_STS.
Definition: sdadc.h:511
INLINE uint8 SDADC_getSuspendModeSts(void)
Get Suspend Mode Status SDADC.SUSSTAT.STAT.
Definition: sdadc.h:376
INLINE sint16 SDADC_getCh1Result(void)
Get Channel 1 Result SDADC.RES1.RESULT.
Definition: sdadc.h:430
INLINE uint8 SDADC_getCh0WFRSts(void)
Get Channel 0 Wait For Read Status SDADC.STS.WFR0_STS.
Definition: sdadc.h:493
void SDADC_setCh1ResIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime
Set Channel 1 Result Interrupt Node Pointer.
INLINE void SDADC_clrCh1CmpUpIntSts(void)
Clear Channel 1 Upper Compare Level Interrupt Status SDADC.ISR.CMP1_UP_ISC.
Definition: sdadc.h:346
void SDADC_setCh0CmpUpIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime
Set Channel 0 Upper Compare Level Interrupt Node Pointer.
INLINE void SDADC_disCh1ResInt(void)
Disable Channel 1 Result Interrupt.
Definition: sdadc.h:229
INLINE void SDADC_clrCh1CmpLoSts(void)
Clear Channel 1 Lower Compare Level Status SDADC.STSR.CMP1_LO_SC.
Definition: sdadc.h:555
INLINE uint16 SDADC_getCh1Timestamp(void)
Get Channel 1 Timestamp SDADC.RES1.TIMVAL.
Definition: sdadc.h:439
INLINE uint8 SDADC_getCh0CmpLoIntSts(void)
Get Channel 0 Lower Compare Level Interrupt Status SDADC.IS.CMP0_LO_IS.
Definition: sdadc.h:284
INLINE void SDADC_clrCh1ResIntSts(void)
Clear Channel 1 Result Interrupt Status SDADC.ISR.RES1_ISC.
Definition: sdadc.h:339
INLINE uint8 SDADC_getCh1CmpLoIntSts(void)
Get Channel 1 Lower Compare Level Interrupt Status SDADC.IS.CMP1_LO_IS.
Definition: sdadc.h:311
INLINE uint8 SDADC_getCh0CmpLoSts(void)
Get Channel 0 Lower Compare Level Status SDADC.STS.CMP0_LO_STS.
Definition: sdadc.h:484
INLINE uint8 SDADC_getCh0ValidResSts(void)
Get Channel 0 Valid Result Status SDADC.RES0.RESVALID.
Definition: sdadc.h:421
void SDADC_setCh0ResIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime
Set Channel 0 Result Interrupt Node Pointer.
INLINE void SDADC_disCh0CmpLoInt(void)
Disable Channel 0 Lower Compare Level Interrupt.
Definition: sdadc.h:215
INLINE uint8 SDADC_getCh1ResIntSts(void)
Get Channel 1 Result Interrupt Status SDADC.IS.RES1_IS.
Definition: sdadc.h:293
INLINE uint8 SDADC_getCh1ValidResSts(void)
Get Channel 1 Valid Result Status SDADC.RES1.RESVALID.
Definition: sdadc.h:466
INLINE uint8 SDADC_getCh1ResValidCnt(void)
Get Channel 1 Result Valid Counter SDADC.RES1.VALCNT.
Definition: sdadc.h:457
INLINE uint8 SDADC_getCh0ResIntSts(void)
Get Channel 0 Result Interrupt Status SDADC.IS.RES0_IS.
Definition: sdadc.h:266
INLINE uint8 SDADC_getCh0ResValidCnt(void)
Get Channel 0 Result Valid Counter SDADC.RES0.VALCNT.
Definition: sdadc.h:412
INLINE void SDADC_clrCh0ResIntSts(void)
Clear Channel 0 Result Interrupt Status SDADC.ISR.RES0_ISC.
Definition: sdadc.h:318
INLINE void SDADC_clrCh0WFRSts(void)
Clear Channel 0 Wait For Read Status SDADC.STSR.WFR0_SC.
Definition: sdadc.h:541
INLINE void SDADC_enCh1ResInt(void)
Enable Channel 1 Result Interrupt.
Definition: sdadc.h:222
INLINE uint16 SDADC_getCh0Timestamp(void)
Get Channel 0 Timestamp SDADC.RES0.TIMVAL.
Definition: sdadc.h:394
INLINE void SDADC_clrCh0CmpUpIntSts(void)
Clear Channel 0 Upper Compare Level Interrupt Status SDADC.ISR.CMP0_UP_ISC.
Definition: sdadc.h:325
INLINE void SDADC_enCh0CmpLoInt(void)
Enable Channel 0 Lower Compare Level Interrupt.
Definition: sdadc.h:208
INLINE uint16 SDADC_getCh1CaptTimestamp(void)
Get Channel 1 Captured Timestamp SDADC.CTIM1.TIMVAL.
Definition: sdadc.h:448
INLINE uint8 SDADC_getCh1CmpUpIntSts(void)
Get Channel 1 Upper Compare Level Interrupt Status SDADC.IS.CMP1_UP_IS.
Definition: sdadc.h:302
INLINE uint8 SDADC_getCh1CmpUpSts(void)
Get Channel 1 Upper Compare Level Status SDADC.STS.CMP1_UP_STS.
Definition: sdadc.h:502
INLINE void SDADC_disCh1CmpLoInt(void)
Disable Channel 1 Lower Compare Level Interrupt.
Definition: sdadc.h:257
INLINE sint16 SDADC_getCh0Result(void)
Get Channel 0 Result SDADC.RES0.RESULT.
Definition: sdadc.h:385
sint8 SDADC_init(void)
Initialize all CW registers of the SDADC module.
Definition: sdadc.c:42
INLINE void SDADC_clrCh1WFRSts(void)
Clear Channel 1 Wait For Read Status SDADC.STSR.WFR1_SC.
Definition: sdadc.h:562
INLINE void SDADC_clrCh1CmpUpSts(void)
Clear Channel 1 Upper Compare Level Status SDADC.STSR.CMP1_UP_SC.
Definition: sdadc.h:548
INLINE void SDADC_disSuspendMode(void)
Disable Suspend Mode SDADC.SUSCTR.EN.
Definition: sdadc.h:367
INLINE void SDADC_clrCh1CmpLoIntSts(void)
Clear Channel 1 Lower Compare Level Interrupt Status SDADC.ISR.CMP1_LO_ISC.
Definition: sdadc.h:353
INLINE void SDADC_clrCh0CmpUpSts(void)
Clear Channel 0 Upper Compare Level Status SDADC.STSR.CMP0_UP_SC.
Definition: sdadc.h:527
INLINE void SDADC_enCh0ResInt(void)
Enable Channel 0 Result Interrupt.
Definition: sdadc.h:180
INLINE void SDADC_disCh0CmpUpInt(void)
Disable Channel 0 Upper Compare Level Interrupt.
Definition: sdadc.h:201
void SDADC_setCh1CmpUpIntNodePtr(void) __attribute__((deprecated("Do not change this at runtime
Set Channel 1 Upper Compare Level Interrupt Node Pointer.
INLINE void SDADC_enCh0CmpUpInt(void)
Enable Channel 0 Upper Compare Level Interrupt.
Definition: sdadc.h:194
INLINE void SDADC_enSuspendMode(void)
Enable Suspend Mode SDADC.SUSCTR.EN.
Definition: sdadc.h:360
INLINE void SDADC_clrCh0CmpLoIntSts(void)
Clear Channel 0 Lower Compare Level Interrupt Status SDADC.ISR.CMP0_LO_ISC.
Definition: sdadc.h:332
INLINE void SDADC_clrCh0CmpLoSts(void)
Clear Channel 0 Lower Compare Level Status SDADC.STSR.CMP0_LO_SC.
Definition: sdadc.h:534
INLINE void SDADC_disCh0ResInt(void)
Disable Channel 0 Result Interrupt.
Definition: sdadc.h:187
INLINE void SDADC_disCh1CmpUpInt(void)
Disable Channel 1 Upper Compare Level Interrupt.
Definition: sdadc.h:243
INLINE void SDADC_enCh1CmpUpInt(void)
Enable Channel 1 Upper Compare Level Interrupt.
Definition: sdadc.h:236
INLINE uint8 SDADC_getCh1WFRSts(void)
Get Channel 1 Wait For Read Status SDADC.STS.WFR1_STS.
Definition: sdadc.h:520
INLINE uint8 SDADC_getCh0CmpUpSts(void)
Get Channel 0 Upper Compare Level Status SDADC.STS.CMP0_UP_STS.
Definition: sdadc.h:475
__attribute__((noreturn))
Definition: startup_tle989x.c:193
Device specific memory layout defines and features.
General type declarations.
#define INLINE
Definition: types.h:151
uint8_t uint8
8 bit unsigned value
Definition: types.h:204
int8_t sint8
8 bit signed value
Definition: types.h:209
int16_t sint16
16 bit signed value
Definition: types.h:210
uint16_t uint16
16 bit unsigned value
Definition: types.h:205