55 #include "IfxVadc_bf.h"
1663 group->QINR0.U = channel | options;
1671 ticks = (
uint32)(sampleTime * analogFrequency) - 2;
1675 ticks = (ticks / 16) + 15;
1678 ticks =
__minu(ticks, 0xFFu);
1686 vadcG->REFCLR.U = 0x0000FFFF
u;
1692 vadcG->CEFCLR.U = 1 << channelId;
1698 vadcG->QMR0.B.FLUSH = flushQueue;
1704 group->RCR[resultIdx].B.WFR = waitForRead;
1710 vadc->GLOBRCR.B.WFR = waitForRead;
1718 vadc->CLC.B.DISR = 1;
1725 vadcG->QMR0.B.ENTR = 0;
1731 vadcG->ASMR.B.ENTR = 0;
1737 vadc->BRSMR.B.ENTR = 1;
1743 vadcG->RCR[resultRegister].B.FEN = fifoMode;
1752 vadc->CLC.U = 0x00000000;
1759 vadcG->QMR0.B.ENTR = 1;
1765 vadcG->ASMR.B.ENTR = 1;
1771 vadcG->RCR[resultRegister].B.SRGEN = 1;
1778 status = vadc->G[adcCalGroupNum].ARBCFG.B.CAL;
1791 Ifx_VADC_G_CHASS assignChannels;
1792 assignChannels.U = vadcG->CHASS.U;
1793 return assignChannels;
1835 Ifx_VADC_CHCTR tempChctr;
1836 tempChctr.U = vadcG->CHCTR[channelIndex].U;
1849 Ifx_VADC_G_REVNP0 resultServiceRequestNodePtr0;
1850 resultServiceRequestNodePtr0.U = vadcG->REVNP0.U;
1851 return resultServiceRequestNodePtr0;
1857 Ifx_VADC_G_REVNP1 resultServiceRequestNodePtr1;
1858 resultServiceRequestNodePtr1.U = vadcG->REVNP1.U;
1859 return resultServiceRequestNodePtr1;
1865 Ifx_VADC_G_CEVNP0 serviceRequestNodePtr;
1866 serviceRequestNodePtr.U = vadcG->CEVNP0.U;
1867 return serviceRequestNodePtr;
1903 Ifx_VADC_GLOBCFG globCfg;
1904 globCfg.U = vadc->GLOBCFG.U;
1917 Ifx_VADC_GLOBRES tmpGlobalResult;
1919 tmpGlobalResult.U = vadc->GLOBRES.U;
1921 return tmpGlobalResult;
1927 uint32 sampleTime = vadc->GLOBICLASS[inputClassNum].B.STCS;
1929 if (sampleTime > 16)
1931 sampleTime = (sampleTime - 15) * 16;
1948 for (idx = 0; idx < numResults; idx++)
1950 results[idx].U = group->RES[resultOffset + idx].U;
1957 uint32 sampleTime = vadcG->ICLASS[inputClassNum].B.STCS;
1959 if (sampleTime > 16)
1961 sampleTime = (sampleTime - 15) * 16;
1970 uint8 masterIndex = 0;
1971 masterIndex = vadcG->SYNCTR.B.STSEL;
2014 Ifx_VADC_RES tmpResult;
2016 tmpResult.U = group->RES[resultIdx].U;
2060 return (
boolean)vadc->GLOBCFG.B.SUCAL;
2080 vadc->GLOBCFG.B.SUCAL = 1;
2086 return (
boolean)vadc->BRSMR.B.SCAN;
2092 return (
boolean)vadcG->ASMR.B.SCAN;
2098 return (
boolean)vadcG->ARBPR.B.ASEN2;
2104 return (
boolean)vadcG->ARBPR.B.ASEN0;
2110 return (
boolean)vadcG->ARBPR.B.ASEN1;
2122 vadcG->ARBCFG.B.ANONC = analogConverterMode;
2128 vadcG->ARBCFG.B.ARBRND = arbiterRoundLength;
2134 vadc->BRSMR.B.SCAN = autoBackgroundScanEnable;
2140 vadcG->ASMR.B.SCAN = autoscanEnable;
2146 vadcG->CHASS.U &= ~(1 << channelIndex);
2152 vadcG->CHCTR[channelIndex].B.RESTBS = globalResultUsage;
2158 channels = (vadc->BRSSEL[groupId].U & ~mask) | channels;
2159 vadc->BRSSEL[groupId].U = channels;
2165 Ifx_VADC_BRSCTRL brsctrl;
2166 brsctrl.U = vadc->BRSCTRL.U;
2168 brsctrl.B.GTSEL = gatingSource;
2169 vadc->BRSCTRL.U = brsctrl.U;
2170 vadc->BRSMR.B.ENGT = gatingMode;
2176 Ifx_VADC_BRSCTRL brsctrl;
2177 brsctrl.U = vadc->BRSCTRL.U;
2179 brsctrl.B.XTMODE = triggerMode;
2180 brsctrl.B.XTSEL = triggerSource;
2181 vadc->BRSCTRL.U = brsctrl.U;
2187 vadcG->CHCTR[channelIndex].B.BNDSELX = boundaryMode;
2193 vadcG->CEVNP0.U &= ~(IFX_VADC_G_CEVNP0_CEV0NP_MSK << (channel * 4));
2194 vadcG->CEVNP0.U |= (channelSrcNr << (channel * 4));
2200 vadcG->CHCTR[channelIndex].B.ICLSEL = inputClass;
2206 vadcG->CHCTR[channelIndex].B.CHEVMODE = limitCheck;
2212 vadc->GLOBICLASS[inputClassNum].B.CME = resolution;
2224 vadcG->ICLASS[inputClassNum].B.CME = resolution;
2238 vadc->EMUXSEL.B.EMUXGRP0 = group;
2242 vadc->EMUXSEL.B.EMUXGRP1 = group;
2249 vadc->GLOBICLASS[inputClassNum].B.CMS = resolution;
2261 vadcG->CHASS.U |= (1 << channelIndex);
2267 vadcG->ICLASS[inputClassNum].B.CMS = resolution;
2279 vadcG->CHCTR[channelIndex].B.BNDSELL = lowerBoundary;
2285 vadcG->SYNCTR.B.STSEL = (masterIndex % 4);
2286 vadcG->SYNCTR.U |= (0x00000008U << (masterIndex % 4));
2292 Ifx_VADC_G_QCTRL0 qctrl0;
2293 qctrl0.U = vadcG->QCTRL0.U;
2295 qctrl0.B.GTSEL = gatingSource;
2296 vadcG->QCTRL0.U = qctrl0.U;
2297 vadcG->QMR0.B.ENGT = gatingMode;
2303 Ifx_VADC_G_QCTRL0 qctrl0;
2304 qctrl0.U = vadcG->QCTRL0.U;
2306 qctrl0.B.XTMODE = triggerMode;
2307 qctrl0.B.XTSEL = triggerSource;
2308 vadcG->QCTRL0.U = qctrl0.U;
2314 vadcG->CHCTR[channelIndex].B.REFSEL = reference;
2320 vadcG->REVNP0.U &= ~(IFX_VADC_G_REVNP0_REV0NP_MSK << (resultRegister * 4));
2321 vadcG->REVNP0.U |= (resultSrcNr << (resultRegister * 4));
2334 vadcG->CHCTR[channelIndex].B.RESPOS = rightAlignedStorage;
2340 Ifx_VADC_G_ASCTRL asctrl;
2341 asctrl.U = vadcG->ASCTRL.U;
2343 asctrl.B.GTSEL = gatingSource;
2344 vadcG->ASCTRL.U = asctrl.U;
2345 vadcG->ASMR.B.ENGT = gatingMode;
2351 Ifx_VADC_G_ASCTRL asctrl;
2352 asctrl.U = vadcG->ASCTRL.U;
2354 asctrl.B.XTMODE = triggerMode;
2355 asctrl.B.XTSEL = triggerSource;
2356 vadcG->ASCTRL.U = asctrl.U;
2364 vadc->CLC.B.EDIS = mode;
2371 vadcG->CHCTR[channelIndex].B.SYNC = synchonize;
2377 vadcG->CHCTR[channelIndex].B.BNDSELU = upperBoundary;
2383 vadc->BRSMR.B.LDEV = 1;
2389 group->QMR0.B.TREV = 1;
2395 group->ASMR.B.LDEV = 1;
2401 vadcG->CHCTR[channelIndex].B.RESREG = resultRegister;