88 uint32 singleDistance = ((
uint32)&MODULE_ASCLIN1) - base;
90 uint32 index = distance / singleDistance;
133 volatile Ifx_ASCLIN_RXDATA *rxData = (
volatile Ifx_ASCLIN_RXDATA *)&asclin->RXDATA.U;
137 *data++ = (
uint16)rxData->U;
147 volatile Ifx_ASCLIN_RXDATA *rxData = (
volatile Ifx_ASCLIN_RXDATA *)&asclin->RXDATA.U;
161 volatile Ifx_ASCLIN_RXDATA *rxData = (
volatile Ifx_ASCLIN_RXDATA *)&asclin->RXDATA.U;
165 *data++ = (
uint8)rxData->U;
189 uint32 d, n, dBest = 1, nBest = 1;
194 oversampling =
__maxu(oversampling, 4);
195 samplepoint =
__maxu(samplepoint, 1);
196 fOvs = baudrate * oversampling;
200 boolean terminated =
FALSE;
202 uint32 adder_facL, adder_facH, adder_facL_min, count;
211 relError =
__absf(fOvs - f);
213 if (relError <= limit)
218 for (n = 2; ((!terminated) && ((n * d) <= 0xFFF)); n++)
227 adder_facL = (adder_facL_min * n) / nBest;
228 adder_facH = adder_facL + 1;
231 for (count = adder_facL; count <= adder_facH; count++)
233 f = (fpd * n) / (n * d + count);
234 newRelError =
__absf(fOvs - f);
236 if (relError > (newRelError))
238 relError = newRelError;
240 dBest = (n * d + count);
241 adder_facL_min = count;
245 if (relError <= limit)
252 asclin->BRG.B.DENOMINATOR = dBest;
253 asclin->BRG.B.NUMERATOR = nBest;
256 asclin->BITCON.B.OVERSAMPLING = oversampling - 1;
259 asclin->BITCON.B.SAMPLEPOINT = samplepoint;
262 asclin->BITCON.B.SM = medianFilter ? 1 : 0;
272 asclin->CSR.B.CLKSEL = clockSource;
290 volatile Ifx_ASCLIN_TXDATA *txData = (
volatile Ifx_ASCLIN_TXDATA *)&asclin->TXDATA.U;
304 volatile Ifx_ASCLIN_TXDATA *txData = (
volatile Ifx_ASCLIN_TXDATA *)&asclin->TXDATA.U;
318 volatile Ifx_ASCLIN_TXDATA *txData = (
volatile Ifx_ASCLIN_TXDATA *)&asclin->TXDATA.U;
335 asclin->KRST0.B.RST = 1;
336 asclin->KRST1.B.RST = 1;
339 while (0 == asclin->KRST0.B.RSTSTAT)
343 asclin->KRSTCLR.B.CLR = 1;