37 Ifx_VADC_G_EMUXCTR emuxctr;
40 emuxctr.B.EMUXMODE = mode;
41 emuxctr.B.EMXCSS = channelSelectionStyle;
42 emuxctr.B.EMUXCH = channels;
43 emuxctr.B.EMUXSET = startChannel;
44 emuxctr.B.EMXCOD = code;
45 emuxctr.B.EMXST = sampleTimeControl;
47 vadcG->EMUXCTR.U = emuxctr.U;
49 vadcG->EMUXCTR.U = emuxctr.U;
61 vadc->ACCPROT0.U |= (0x00000001 << protectionSet);
65 vadc->ACCPROT1.U |= (0x00000001 << (protectionSet & 0x1F));
78 uint32 mask = 1 << (IFX_VADC_GLOBCFG_DPCAL0_OFF + group);
82 vadc->GLOBCFG.U |= mask;
86 vadc->GLOBCFG.U &= ~mask;
101 vadc->ACCPROT0.U &= ~(0x00000001 << protectionSet);
105 vadc->ACCPROT1.U &= ~(0x00000001 << (protectionSet & 0x1F));
119 Ifx_VADC_GLOBCFG vadcGlobCfg;
120 vadcGlobCfg.U = vadc->GLOBCFG.U;
121 vadcGlobCfg.B.DIVWC = 1;
122 vadcGlobCfg.B.DCMSB = 1;
125 vadc->GLOBCFG.U = vadcGlobCfg.U;
139 CCU60_MODCTR.B.ECT13O = 1;
140 CCU60_TCTR4.U = (1 << IFX_CCU6_TCTR4_T13STR_OFF) | (1 << IFX_CCU6_TCTR4_T13RS_OFF);
141 CCU60_MOSEL.B.TRIG1SEL = 0;
143 else if (ccu6Num == 1)
154 CCU61_MODCTR.B.ECT13O = 1;
155 CCU61_TCTR4.U = (1 << IFX_CCU6_TCTR4_T13STR_OFF) | (1 << IFX_CCU6_TCTR4_T13RS_OFF);
156 CCU60_MOSEL.B.TRIG1SEL = 1;
188 if (vadc->BRSPND[i].U)
205 Ifx_VADC_G *vadcG = &vadc->G[group];
214 inputClassNum = inputClass;
215 stc = vadcG->ICLASS[inputClassNum].B.STCS;
221 stc = vadc->GLOBICLASS[inputClassNum].B.STCS;
245 conversionTime = (
float32)(2 + stc + n + pc) / analogFrequency + 2.0 / moduleFrequency;
250 conversionTime = (
float32)(2 + stc + 2) / analogFrequency + 2.0 / moduleFrequency;
258 return conversionTime;
267 if (0x7 == group->QSR0.B.FILL)
282 sint32 sourceResultRegister = -1;
283 Ifx_VADC_RES tmpResult;
288 sourceResultRegister = group->QCTRL0.B.SRCRESREG;
292 sourceResultRegister = group->ASCTRL.B.SRCRESREG;
296 sourceResultRegister = vadc->BRSCTRL.B.SRCRESREG;
300 if (sourceResultRegister > 0)
302 tmpResult.U = group->RES[sourceResultRegister].U;
310 tmpResult.B.VF = vadc->GLOBRES.B.VF;
311 tmpResult.B.FCR = vadc->GLOBRES.B.FCR;
312 tmpResult.B.CRS = vadc->GLOBRES.B.CRS;
313 tmpResult.B.EMUX = vadc->GLOBRES.B.EMUX;
314 tmpResult.B.CHNR = vadc->GLOBRES.B.CHNR;
315 tmpResult.B.DRC = vadc->GLOBRES.B.GNR;
316 tmpResult.B.RESULT = vadc->GLOBRES.B.RESULT;
322 tmpResult.U = group->RES[group->CHCTR[channel].B.RESREG].U;
353 if ((group & 0x1) != 0)
375 Ifx_VADC_GLOBCFG tempGLOBCFG;
376 tempGLOBCFG.U = vadc->GLOBCFG.U;
377 tempGLOBCFG.B.DIVD = arbiterClockDivider;
378 tempGLOBCFG.B.DIVWC = 1;
380 vadc->GLOBCFG.U = tempGLOBCFG.U;
387 Ifx_VADC_GLOBCFG tempGLOBCFG;
388 tempGLOBCFG.U = vadc->GLOBCFG.U;
389 tempGLOBCFG.B.DIVA = converterClockDivider;
390 tempGLOBCFG.B.DIVWC = 1;
392 vadc->GLOBCFG.U = tempGLOBCFG.U;
403 divD = (fadc / fAdcD - 1);
405 divD =
__minu(divD, 0x3u);
407 result = fadc / (divD + 1);
420 divA = (fadc << 2) / fAdcI;
422 divA = (divA + 2) >> 2;
423 divA =
__minu(divA - 1, 0x1Fu);
424 result = fadc / (divA + 1);
428 divA =
__minu(divA + 1, 0x1Fu);
430 result = fadc / (divA + 1);
472 default: pcEnabled =
FALSE;
486 vadc->KRST1.B.RST = 1;
487 vadc->KRST0.B.RST = 1;
490 while (vadc->KRST0.B.RSTSTAT == 0)
495 vadc->KRSTCLR.B.CLR = 1;
503 Ifx_VADC_GLOBCFG tempGLOBCFG;
504 tempGLOBCFG.U = vadc->GLOBCFG.U;
505 tempGLOBCFG.B.LOSUP = supplyVoltage;
506 tempGLOBCFG.B.DIVWC = 1;
508 vadc->GLOBCFG.U = tempGLOBCFG.U;
515 if (slotEnable !=
FALSE)
517 vadcG->ARBPR.U |= slotEnable << (IFX_VADC_G_ARBPR_ASEN0_OFF + slot);
518 vadcG->ARBPR.U &= ~(IFX_VADC_G_ARBPR_PRIO0_MSK << (slot * 4
u));
519 vadcG->ARBPR.U |= (prio << (slot * 4
u));
523 vadcG->ARBPR.U |= 0x1
u << (IFX_VADC_G_ARBPR_CSM0_OFF + (slot * 4
u));
527 vadcG->ARBPR.U &= ~(0x1
u << (IFX_VADC_G_ARBPR_CSM0_OFF + (slot * 4
u)));
532 vadcG->ARBPR.U &= ~(IFX_VADC_G_ARBPR_ASEN0_MSK << (IFX_VADC_G_ARBPR_ASEN0_OFF + slot));
541 group->ASSEL.U = (group->ASSEL.U & ~mask) | (channels & mask);
547 boolean calibrationRunning;
548 uint8 adcCalGroupNum;
560 calibrationRunning =
FALSE;
566 calibrationRunning =
TRUE;
573 }
while (calibrationRunning ==
TRUE);