42 static void IfxPsi5_Psi5_enableModule(Ifx_PSI5 *psi5);
48 static void IfxPsi5_Psi5_resetModule(Ifx_PSI5 *psi5);
63 static uint32 IfxPsi5_Psi5_getFracDivClock(Ifx_PSI5 *psi5);
80 Ifx_PSI5 *psi5SFR = psi5->
psi5;
82 IfxPsi5_Psi5_resetModule(psi5SFR);
86 static void IfxPsi5_Psi5_enableModule(Ifx_PSI5 *psi5)
88 psi5->CLC.U = 0x00000000;
92 static uint32 IfxPsi5_Psi5_getFracDivClock(Ifx_PSI5 *psi5)
97 switch (psi5->FDR.B.DM)
122 boolean status =
TRUE;
129 Ifx_PSI5_CH *psi5Ch = &psi5->CH[config->
channelId];
134 Ifx_PSI5_CH_PGC tempPGC;
145 tempPGC.B.PTE =
TRUE;
146 tempPGC.B.ETE =
FALSE;
147 tempPGC.B.BYP =
FALSE;
151 tempPGC.B.PTE =
FALSE;
152 tempPGC.B.ETE =
TRUE;
153 tempPGC.B.BYP =
FALSE;
157 tempPGC.B.PTE =
FALSE;
158 tempPGC.B.ETE =
FALSE;
159 tempPGC.B.BYP =
TRUE;
163 psi5Ch->PGC.U = tempPGC.U;
165 Ifx_PSI5_CH_CTV tempCTV;
168 psi5Ch->CTV.U = tempCTV.U;
175 Ifx_PSI5_CH_RCRA tempRCRA;
184 psi5Ch->RCRA.U = tempRCRA.U;
186 Ifx_PSI5_CH_RCRB tempRCRB;
211 psi5Ch->RCRB.U = tempRCRB.U;
213 Ifx_PSI5_CH_RCRC tempRCRC;
218 psi5Ch->RCRC.U = tempRCRC.U;
220 Ifx_PSI5_RFC tempRFC;
222 psi5->RFC[config->
channelId].U = tempRFC.U;
224 Ifx_PSI5_CH_SCR tempSCR;
233 psi5Ch->SCR.U = tempSCR.U;
235 Ifx_PSI5_CH_IOCR tempIOCR;
239 psi5Ch->IOCR.U = tempIOCR.U;
284 .channelTriggerValue = 0x150,
285 .channelTriggerCounter = 0x130
287 .watchdogTimerLimit[0] = 0x0,
288 .watchdogTimerLimit[1] = 0x0,
289 .watchdogTimerLimit[2] = 0x0,
290 .watchdogTimerLimit[3] = 0x0,
291 .watchdogTimerLimit[4] = 0x0,
292 .watchdogTimerLimit[5] = 0x0,
293 .watchdogTimerLimit[6] = 0x0,
295 .payloadLength[0] = 8,
296 .payloadLength[1] = 8,
297 .payloadLength[2] = 8,
298 .payloadLength[3] = 8,
299 .payloadLength[4] = 8,
300 .payloadLength[5] = 8,
301 .asynchronousModeSelected =
FALSE,
331 .fifoWarningLevel = 16
335 .enhancedProtocolSelected =
FALSE,
336 .bitStuffingEnabled =
FALSE,
337 .ssrPayloadLength = 32,
338 .sorPayloadLength = 32,
339 .crcGenerationEnabled =
FALSE,
340 .startSequenceGenerationEnabled =
FALSE,
341 .inhibitingAutomaticTransferEnabled =
FALSE
343 .inputOutputControl = {
345 .outputInverterEnabled =
FALSE,
346 .inputInverterEnabled =
FALSE
349 *config = IfxPsi5_Psi5_defaultChannelConfig;
356 boolean status =
TRUE;
357 Ifx_PSI5 *psi5SFR = config->
psi5;
359 psi5->
psi5 = psi5SFR;
363 IfxPsi5_Psi5_enableModule(psi5SFR);
365 if (IfxPsi5_Psi5_initializeClock(psi5SFR, &config->
fracDiv) == 0)
374 if (IfxPsi5_Psi5_initializeClock(psi5SFR, &config->
slowClock) == 0)
383 if (IfxPsi5_Psi5_initializeClock(psi5SFR, &config->
fastClock) == 0)
392 if (IfxPsi5_Psi5_initializeClock(psi5SFR, &config->
timestampClock) == 0)
441 Ifx_PSI5_FDR tempFDR, tempFDRL, tempFDRH, tempFDRT;
449 fInput = IfxPsi5_Psi5_getFracDivClock(psi5);
506 tempFDR.B.DM = divMode;
507 tempFDR.B.STEP = (
uint32)step;
508 psi5->FDR.U = tempFDR.U;
513 tempFDRL.B.DM = divMode;
514 tempFDRL.B.STEP = (
uint32)step;
515 psi5->FDRL.U = tempFDRL.U;
520 tempFDRH.B.DM = divMode;
521 tempFDRH.B.STEP = (
uint32)step;
522 psi5->FDRH.U = tempFDRH.U;
527 tempFDRT.B.DM = divMode;
528 tempFDRT.B.STEP = (
uint32)step;
529 psi5->FDRT.U = tempFDRT.U;
545 channel->
module->
psi5->INTCLRA[channel->
channelId].U |= (IFX_PSI5_INTCLRA_RDI_MSK << IFX_PSI5_INTCLRA_RDI_OFF) | (IFX_PSI5_INTCLRA_RSI_MSK << IFX_PSI5_INTCLRA_RSI_OFF);
564 static void IfxPsi5_Psi5_resetModule(Ifx_PSI5 *psi5)
569 psi5->KRST1.B.RST = 1;
570 psi5->KRST0.B.RST = 1;
572 while (psi5->KRST0.B.RSTSTAT == 0)
577 psi5->KRSTCLR.B.CLR = 1;
584 channel->
channel->SDRL.U = data & 0xFFFFFFFF;
585 channel->
channel->SDRH.U = (data >> 32) & 0xFFFFFFFF;