55 #include "IfxVadc_bf.h"
59 #include "IfxCcu6_reg.h"
60 #include "IfxCcu6_bf.h"
1682 group->QINR0.U = channel | options;
1690 ticks = (
uint32)(sampleTime * analogFrequency) - 2;
1694 ticks = (ticks / 16) + 15;
1697 ticks =
__minu(ticks, 0xFFu);
1705 vadcG->REFCLR.U = 0x0000FFFF
u;
1711 vadcG->CEFCLR.U = 1 << channelId;
1717 vadcG->QMR0.B.FLUSH = flushQueue;
1723 group->RCR[resultIdx].B.WFR = waitForRead;
1729 vadc->GLOBRCR.B.WFR = waitForRead;
1737 vadc->CLC.B.DISR = 1;
1744 vadcG->QMR0.B.ENTR = 0;
1750 vadcG->ASMR.B.ENTR = 0;
1756 vadc->BRSMR.B.ENTR = 1;
1762 vadcG->RCR[resultRegister].B.FEN = fifoMode;
1771 vadc->CLC.U = 0x00000000;
1778 vadcG->QMR0.B.ENTR = 1;
1784 vadcG->ASMR.B.ENTR = 1;
1790 vadcG->RCR[resultRegister].B.SRGEN = 1;
1797 status = vadc->G[adcCalGroupNum].ARBCFG.B.CAL;
1810 Ifx_VADC_G_CHASS assignChannels;
1811 assignChannels.U = vadcG->CHASS.U;
1812 return assignChannels;
1854 Ifx_VADC_CHCTR tempChctr;
1855 tempChctr.U = vadcG->CHCTR[channelIndex].U;
1868 Ifx_VADC_G_REVNP0 resultServiceRequestNodePtr0;
1869 resultServiceRequestNodePtr0.U = vadcG->REVNP0.U;
1870 return resultServiceRequestNodePtr0;
1876 Ifx_VADC_G_REVNP1 resultServiceRequestNodePtr1;
1877 resultServiceRequestNodePtr1.U = vadcG->REVNP1.U;
1878 return resultServiceRequestNodePtr1;
1884 Ifx_VADC_G_CEVNP0 serviceRequestNodePtr;
1885 serviceRequestNodePtr.U = vadcG->CEVNP0.U;
1886 return serviceRequestNodePtr;
1916 Ifx_VADC_GLOBCFG globCfg;
1917 globCfg.U = vadc->GLOBCFG.U;
1930 Ifx_VADC_GLOBRES tmpGlobalResult;
1932 tmpGlobalResult.U = vadc->GLOBRES.U;
1934 return tmpGlobalResult;
1940 uint32 sampleTime = vadc->GLOBICLASS[inputClassNum].B.STCS;
1942 if (sampleTime > 16)
1944 sampleTime = (sampleTime - 15) * 16;
1961 for (idx = 0; idx < numResults; idx++)
1963 results[idx].U = group->RES[resultOffset + idx].U;
1970 uint32 sampleTime = vadcG->ICLASS[inputClassNum].B.STCS;
1972 if (sampleTime > 16)
1974 sampleTime = (sampleTime - 15) * 16;
1983 uint8 masterIndex = 0;
1984 masterIndex = vadcG->SYNCTR.B.STSEL;
2027 Ifx_VADC_RES tmpResult;
2029 tmpResult.U = group->RES[resultIdx].U;
2073 return (
boolean)vadc->GLOBCFG.B.SUCAL;
2093 vadc->GLOBCFG.B.SUCAL = 1;
2099 return (
boolean)vadc->BRSMR.B.SCAN;
2105 return (
boolean)vadcG->ASMR.B.SCAN;
2111 return (
boolean)vadcG->ARBPR.B.ASEN2;
2117 return (
boolean)vadcG->ARBPR.B.ASEN0;
2123 return (
boolean)vadcG->ARBPR.B.ASEN1;
2135 vadcG->ARBCFG.B.ANONC = analogConverterMode;
2141 vadcG->ARBCFG.B.ARBRND = arbiterRoundLength;
2147 vadc->BRSMR.B.SCAN = autoBackgroundScanEnable;
2153 vadcG->ASMR.B.SCAN = autoscanEnable;
2159 vadcG->CHASS.U &= ~(1 << channelIndex);
2165 vadcG->CHCTR[channelIndex].B.RESTBS = globalResultUsage;
2171 channels = (vadc->BRSSEL[groupId].U & ~mask) | channels;
2172 vadc->BRSSEL[groupId].U = channels;
2178 Ifx_VADC_BRSCTRL brsctrl;
2179 brsctrl.U = vadc->BRSCTRL.U;
2181 brsctrl.B.GTSEL = gatingSource;
2182 vadc->BRSCTRL.U = brsctrl.U;
2183 vadc->BRSMR.B.ENGT = gatingMode;
2189 Ifx_VADC_BRSCTRL brsctrl;
2190 brsctrl.U = vadc->BRSCTRL.U;
2192 brsctrl.B.XTMODE = triggerMode;
2193 brsctrl.B.XTSEL = triggerSource;
2194 vadc->BRSCTRL.U = brsctrl.U;
2200 vadcG->CHCTR[channelIndex].B.BNDSELX = boundaryMode;
2206 vadcG->CEVNP0.U &= ~(IFX_VADC_G_CEVNP0_CEV0NP_MSK << (channel * 4));
2207 vadcG->CEVNP0.U |= (channelSrcNr << (channel * 4));
2213 vadcG->CHCTR[channelIndex].B.ICLSEL = inputClass;
2219 vadcG->CHCTR[channelIndex].B.CHEVMODE = limitCheck;
2225 vadc->GLOBICLASS[inputClassNum].B.CME = resolution;
2237 vadcG->ICLASS[inputClassNum].B.CME = resolution;
2251 vadc->EMUXSEL.B.EMUXGRP0 = group;
2255 vadc->EMUXSEL.B.EMUXGRP1 = group;
2262 vadc->GLOBICLASS[inputClassNum].B.CMS = resolution;
2274 vadcG->CHASS.U |= (1 << channelIndex);
2280 vadcG->ICLASS[inputClassNum].B.CMS = resolution;
2292 vadcG->CHCTR[channelIndex].B.BNDSELL = lowerBoundary;
2298 vadcG->SYNCTR.B.STSEL = (masterIndex % 4);
2299 vadcG->SYNCTR.U |= (0x00000008U << (masterIndex % 4));
2305 Ifx_VADC_G_QCTRL0 qctrl0;
2306 qctrl0.U = vadcG->QCTRL0.U;
2308 qctrl0.B.GTSEL = gatingSource;
2309 vadcG->QCTRL0.U = qctrl0.U;
2310 vadcG->QMR0.B.ENGT = gatingMode;
2316 Ifx_VADC_G_QCTRL0 qctrl0;
2317 qctrl0.U = vadcG->QCTRL0.U;
2319 qctrl0.B.XTMODE = triggerMode;
2320 qctrl0.B.XTSEL = triggerSource;
2321 vadcG->QCTRL0.U = qctrl0.U;
2327 vadcG->CHCTR[channelIndex].B.REFSEL = reference;
2333 vadcG->REVNP0.U &= ~(IFX_VADC_G_REVNP0_REV0NP_MSK << (resultRegister * 4));
2334 vadcG->REVNP0.U |= (resultSrcNr << (resultRegister * 4));
2347 vadcG->CHCTR[channelIndex].B.RESPOS = rightAlignedStorage;
2353 Ifx_VADC_G_ASCTRL asctrl;
2354 asctrl.U = vadcG->ASCTRL.U;
2356 asctrl.B.GTSEL = gatingSource;
2357 vadcG->ASCTRL.U = asctrl.U;
2358 vadcG->ASMR.B.ENGT = gatingMode;
2364 Ifx_VADC_G_ASCTRL asctrl;
2365 asctrl.U = vadcG->ASCTRL.U;
2367 asctrl.B.XTMODE = triggerMode;
2368 asctrl.B.XTSEL = triggerSource;
2369 vadcG->ASCTRL.U = asctrl.U;
2377 vadc->CLC.B.EDIS = mode;
2384 vadcG->CHCTR[channelIndex].B.SYNC = synchonize;
2390 vadcG->CHCTR[channelIndex].B.BNDSELU = upperBoundary;
2396 vadc->BRSMR.B.LDEV = 1;
2402 group->QMR0.B.TREV = 1;
2408 group->ASMR.B.LDEV = 1;
2414 vadcG->CHCTR[channelIndex].B.RESREG = resultRegister;