/** * \brief COP watchdog - Force MCU reset by watchdog timer * \author Abraham Tezmol * \param void * \return void * \todo */ void vfnCOPWatchdog_MCUReset( void ) { /* If COP watchdog has been previously armed, proceed to reset MCU using COP watchdog */ if( gu8COPWatchdogStatus == COPWATCHDOG_ARMED ) { #ifdef __S12_CORE /* When COP is enabled, the following applies: */ /* Writing any value other than 0x55 or 0xAA causes a COP reset */ ARMCOP = 0x11u; #endif #ifdef __S08_CORE #endif } /* If COP watchdog has not been initialized, signal status */ else { /* Enable COP Watchdog to support reset functionality */ vfnCOPWatchdog_Init( ); #ifdef __S12_CORE /* When COP is enabled, the following applies: */ /* Writing any value other than 0x55 or 0xAA causes a COP reset */ ARMCOP = 0x11u; #endif #ifdef __S08_CORE #endif } }
void main(void) { /* Disable interrupts */ INTERRUPT_DISABLE(); /* XGATE initialization */ vfn_XGATE_CPU_init(); /* Initialize Interrupt Module */ vfnInterrupt_Init(); /* PLL initialization to the desired target frequency */ vfnPLL_Init(); /* Dynamic Memory Allocation initialization */ vfnMemAlloc_NearInit(&NearMemAlloc_config[0]); vfnMemAlloc_Init(&DynamicMemAlloc_config[0]); /* Microcontroller Input/Output pins initialization */ vfnInputs_Outputs_Init(); /* Initialize Serial Communications */ vfnCommProtocol_Init(); /* Initialize Task Scheduler */ vfnScheduler_Init(); /* Start execution of task scheduler */ vfnScheduler_Start(); /* Arm COP watchdog */ vfnCOPWatchdog_Init(); /* Once all initializations are complete, enable interrupts */ INTERRUPT_ENABLE(); /* Initialize CAM/Crank emulation */ /* vfnCamCrank_Init(); */ /* Start CAM/Crank emulation */ /* vfnCamCrank_Start(); */ /* Initialize PWM emulation */ vfnPWM_Init(); /* Start PWM emulation */ vfnPWM_Start(); /*-- Loop through all the periodic tasks from Task Scheduler --*/ for(;;) { /* Perform all scheduled tasks */ vfnTask_Scheduler(); /* Perform all background susbystem control tasks */ vfnBackgroundSubsystemTasks(); } }