Blink a single led on each core
Core 0
#include "Ifx_Types.h"
#include "IfxCpu.h"
#include "IfxScuWdt.h"
#include "IfxPort_Io.h"
IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0;
#define DELAY_CORE0 50000000u
void core0_main( void )
{
IfxCpu_enableInterrupts();
/* !!WATCHDOG0 AND SAFETY WATCHDOG ARE DISABLED HERE!!
* Enable the watchdogs and service them periodically if it is required */
IfxScuWdt_disableCpuWatchdog( IfxScuWdt_getCpuWatchdogPassword() );
IfxScuWdt_disableSafetyWatchdog( IfxScuWdt_getSafetyWatchdogPassword() );
/* Wait for CPU sync event */
IfxCpu_emitEvent( &g_cpuSyncEvent );
IfxCpu_waitEvent( &g_cpuSyncEvent, 1u );
IfxPort_setPinMode( &MODULE_P00, 5, IfxPort_Mode_outputPushPullGeneral );
IfxPort_setPinPadDriver( &MODULE_P00, 5, IfxPort_PadDriver_cmosAutomotiveSpeed1 );
while(1)
{
IfxPort_togglePin( &MODULE_P00, 5 );
/*crude delay in milliseconds*/
for(uint32 i = 0 ; i < DELAY_CORE0 ; i++ );
}
}
Core 1
#include "Ifx_Types.h"
#include "IfxCpu.h"
#include "IfxScuWdt.h"
#include "IfxPort_Io.h"
#define DELAY_CORE1 50000000u
extern IfxCpu_syncEvent g_cpuSyncEvent;
void core1_main(void)
{
IfxCpu_enableInterrupts();
/* !!WATCHDOG1 IS DISABLED HERE!!
* Enable the watchdog and service it periodically if it is required
*/
IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword());
/* Wait for CPU sync event */
IfxCpu_emitEvent(&g_cpuSyncEvent);
IfxCpu_waitEvent(&g_cpuSyncEvent, 1);
IfxPort_setPinMode( &MODULE_P00, 7, IfxPort_Mode_outputPushPullGeneral );
IfxPort_setPinPadDriver( &MODULE_P00, 7, IfxPort_PadDriver_cmosAutomotiveSpeed1 );
while(1)
{
IfxPort_togglePin( &MODULE_P00, 7 );
/*crude delay in milliseconds*/
for(uint32 i = 0 ; i < DELAY_CORE1 ; i++ );
}
}
Core 2
#include "Ifx_Types.h"
#include "IfxCpu.h"
#include "IfxScuWdt.h"
#include "IfxPort_Io.h"
#define DELAY_CORE2 50000000u
extern IfxCpu_syncEvent g_cpuSyncEvent;
void core2_main(void)
{
IfxCpu_enableInterrupts();
/* !!WATCHDOG2 IS DISABLED HERE!!
* Enable the watchdog and service it periodically if it is required
*/
IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword());
/* Wait for CPU sync event */
IfxCpu_emitEvent(&g_cpuSyncEvent);
IfxCpu_waitEvent(&g_cpuSyncEvent, 1);
IfxPort_setPinMode( &MODULE_P00, 9, IfxPort_Mode_outputPushPullGeneral );
IfxPort_setPinPadDriver( &MODULE_P00, 9, IfxPort_PadDriver_cmosAutomotiveSpeed1 );
while(1)
{
IfxPort_togglePin( &MODULE_P00, 9 );
/*crude delay in milliseconds*/
for(uint32 i = 0 ; i < DELAY_CORE2 ; i++ );
}
}