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));
137 if (vadc->BRSPND[i].U)
154 Ifx_VADC_G *vadcG = &vadc->G[group];
163 inputClassNum = inputClass;
164 stc = vadcG->ICLASS[inputClassNum].B.STCS;
170 stc = vadc->GLOBICLASS[inputClassNum].B.STCS;
194 conversionTime = (
float32)(2 + stc + n + pc) / analogFrequency + 2.0 / moduleFrequency;
199 conversionTime = (
float32)(2 + stc + 2) / analogFrequency + 2.0 / moduleFrequency;
207 return conversionTime;
216 if (0x7 == group->QSR0.B.FILL)
231 sint32 sourceResultRegister = -1;
232 Ifx_VADC_RES tmpResult;
237 sourceResultRegister = group->QCTRL0.B.SRCRESREG;
241 sourceResultRegister = group->ASCTRL.B.SRCRESREG;
245 sourceResultRegister = vadc->BRSCTRL.B.SRCRESREG;
249 if (sourceResultRegister > 0)
251 tmpResult.U = group->RES[sourceResultRegister].U;
259 tmpResult.B.VF = vadc->GLOBRES.B.VF;
260 tmpResult.B.FCR = vadc->GLOBRES.B.FCR;
261 tmpResult.B.CRS = vadc->GLOBRES.B.CRS;
262 tmpResult.B.EMUX = vadc->GLOBRES.B.EMUX;
263 tmpResult.B.CHNR = vadc->GLOBRES.B.CHNR;
264 tmpResult.B.DRC = vadc->GLOBRES.B.GNR;
265 tmpResult.B.RESULT = vadc->GLOBRES.B.RESULT;
271 tmpResult.U = group->RES[group->CHCTR[channel].B.RESREG].U;
302 if ((group & 0x1) != 0)
324 Ifx_VADC_GLOBCFG tempGLOBCFG;
325 tempGLOBCFG.U = vadc->GLOBCFG.U;
326 tempGLOBCFG.B.DIVD = arbiterClockDivider;
327 tempGLOBCFG.B.DIVWC = 1;
329 vadc->GLOBCFG.U = tempGLOBCFG.U;
336 Ifx_VADC_GLOBCFG tempGLOBCFG;
337 tempGLOBCFG.U = vadc->GLOBCFG.U;
338 tempGLOBCFG.B.DIVA = converterClockDivider;
339 tempGLOBCFG.B.DIVWC = 1;
341 vadc->GLOBCFG.U = tempGLOBCFG.U;
352 divD = (fadc / fAdcD - 1);
354 divD =
__minu(divD, 0x3u);
356 result = fadc / (divD + 1);
369 divA = (fadc << 2) / fAdcI;
371 divA = (divA + 2) >> 2;
372 divA =
__minu(divA - 1, 0x1Fu);
373 result = fadc / (divA + 1);
377 divA =
__minu(divA + 1, 0x1Fu);
379 result = fadc / (divA + 1);
427 default: pcEnabled =
FALSE;
441 vadc->KRST1.B.RST = 1;
442 vadc->KRST0.B.RST = 1;
445 while (vadc->KRST0.B.RSTSTAT == 0)
450 vadc->KRSTCLR.B.CLR = 1;
458 if (slotEnable !=
FALSE)
460 vadcG->ARBPR.U |= slotEnable << (IFX_VADC_G_ARBPR_ASEN0_OFF + slot);
461 vadcG->ARBPR.U &= ~(IFX_VADC_G_ARBPR_PRIO0_MSK << (slot * 4
u));
462 vadcG->ARBPR.U |= (prio << (slot * 4
u));
466 vadcG->ARBPR.U |= 0x1
u << (IFX_VADC_G_ARBPR_CSM0_OFF + (slot * 4
u));
470 vadcG->ARBPR.U &= ~(0x1
u << (IFX_VADC_G_ARBPR_CSM0_OFF + (slot * 4
u)));
475 vadcG->ARBPR.U &= ~(IFX_VADC_G_ARBPR_ASEN0_MSK << (IFX_VADC_G_ARBPR_ASEN0_OFF + slot));
484 group->ASSEL.U = (group->ASSEL.U & ~mask) | (channels & mask);
490 boolean calibrationRunning;
491 uint8 adcCalGroupNum;
503 calibrationRunning =
FALSE;
509 calibrationRunning =
TRUE;
516 }
while (calibrationRunning ==
TRUE);