iLLD_TC27xC  1.0
How to use the PSI5 PSI5 Interface driver?
Collaboration diagram for How to use the PSI5 PSI5 Interface driver?:

PSI5 communicates with the external world via one input/output line for each channel.

In the following sections it will be described, how to integrate the driver into the application framework.

Preparation

Include Files

Include following header file into your C code:

Variables

//used globally

Module Initialisation

// create module config
IfxPsi5_Psi5_initModuleConfig(&psi5Config, &MODULE_PSI5);
// initialize module
IfxPsi5_Psi5_initModule(&psi5, &psi5Config);

Channel Initialisation

// create channel config
IfxPsi5_Psi5_ChannelConfig psi5ChannelConfig;
IfxPsi5_Psi5_initChannelConfig(&psi5ChannelConfig, &psi5);
psi5ChannelConfig.watchdogTimerLimit[0] = 0x32; // initial delay before slot 0 starts
psi5ChannelConfig.watchdogTimerLimit[1] = 0x90;
psi5ChannelConfig.watchdogTimerLimit[2] = 0x10;
psi5ChannelConfig.watchdogTimerLimit[3] = 0x10;
psi5ChannelConfig.watchdogTimerLimit[4] = 0x10;
psi5ChannelConfig.watchdogTimerLimit[5] = 0x10;
psi5ChannelConfig.watchdogTimerLimit[6] = 0x10;
for(int slot=0; slot<6; ++slot) {
psi5ChannelConfig.receiveControl.payloadLength[slot] = 8;
if( slot == 0 )
psi5ChannelConfig.receiveControl.frameExpectation[slot] = IfxPsi5_FrameExpectation_Expected;
else
psi5ChannelConfig.receiveControl.frameExpectation[slot] = IfxPsi5_FrameExpectation_NotExpected;
}
// initialize channels
for(int chn=0; chn<IFXPSI5_PINMAP_NUM_CHANNELS; ++chn) {
psi5ChannelConfig.channelId = (IfxPsi5_ChannelId)chn;
// TODO: currently no IOCRx.ALTI config field
unsigned alti = 0;
pinsConfig.in = IfxPsi5_Rx_In_pinTable[module][chn][alti];
pinsConfig.out = IfxPsi5_Tx_Out_pinTable[module][chn][alti];
psi5ChannelConfig.pinsConfig = &pinsConfig;
IfxPsi5_Psi5_initChannel(&psi5Channel[chn], &psi5ChannelConfig);
}

read channel frame

for(int i=0; i<5; ++i) {
for(int chn=0; chn<IFXPSI5_PINMAP_NUM_CHANNELS; ++chn) {
while( !IfxPsi5_Psi5_readChannelFrame(&psi5Channel[chn], &frame) );
clib_ver_printf("Chn%d: 0x%08x 0x%08x\n",
(int)psi5Channel[chn].channelId,
frame.rdm.lowWord, frame.rdm.highWord);
}
}