/***************************************************************************************************** * Function: main() * * Description: what I can say about it, it just the tipical main * * Caveats: *****************************************************************************************************/ void main(void) { /*Disable interrupts to start the MCU configuration*/ DisableInterrupts; /* Intilialize the interupt vector base address for default location */ Init_Interrupt_Vector(); Mcu_Init(); DDRA =0x0F; DDRB =0x0F; EnableInterrupts; SchM_Init(SchM_TaskConfigInitial); SchM_Start(); for(;;) { /* Call the scheduler */ SchM_Background(); /* feeds the dog */ _FEED_COP(); } /* loop forever */ /* please make sure that you never leave main */ }
/* * The order defined here is found in 3.1.5/EcuM2411 */ void EcuM_StartupTwo(void) { //TODO: Validate that we are in state STARTUP_ONE. #if defined(USE_NVM) extern CounterType Os_Arc_OsTickCounter; TickType tickTimerStart, tickTimerElapsed; static NvM_RequestResultType readAllResult; TickType tickTimer; StatusType tickTimerStatus; #endif set_current_state(ECUM_STATE_STARTUP_TWO); // Initialize the BSW scheduler #if defined(USE_SCHM) SchM_Init(); #endif #if defined(USE_WDGM) if( EcuM_World.config->EcuMWdgMConfig != NULL ) { WdgM_SetMode(EcuM_World.config->EcuMWdgMConfig->EcuMWdgMStartupMode); } #endif // Initialize drivers that don't need NVRAM data EcuM_AL_DriverInitTwo(EcuM_World.config); #if defined(USE_NVM) // Start timer to wait for NVM job to complete tickTimerStart = GetOsTick(); #endif // Prepare the system to startup RTE // TODO EcuM_OnRTEStartup(); #if defined(USE_RTE) Rte_Start(); #endif #if defined(USE_NVM) /* Wait for the NVM job (NvM_ReadAll) to terminate. This assumes that: * - A task runs the memory MainFunctions, e.g. Ea_MainFunction(), Eep_MainFunction() * are run in a higher priority task that the task that executes this code. */ do { /* Read the multiblock status */ NvM_GetErrorStatus(0, &readAllResult); tickTimerElapsed = OS_TICKS2MS_OS_TICK(GetOsTick() - tickTimerStart); /* The timeout EcuMNvramReadAllTimeout is in ms */ } while( (readAllResult == NVM_REQ_PENDING) && (tickTimerElapsed < EcuM_World.config->EcuMNvramReadAllTimeout) ); #endif // Initialize drivers that need NVRAM data EcuM_AL_DriverInitThree(EcuM_World.config); // TODO: Indicate mode change to RTE EcuM_enter_run_mode(); }
void EcuM_StartupTwo(void) { #if defined(USE_SCHM) SchM_Init(); #endif #if defined(USE_BSWM) BswM_Init(EcuM_World.config->BswMConfig); #endif }
/*~~~~~~~ Main Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ void main(void) { initModesAndClock(); initPeriClkGen(); /* Disable Watchdog */ init_disableWatchdog(); /*Initialize LEDs on TRK-MPC560xB board */ init_OnBoardLEDs(); /*Initialize the On-Board push buttons*/ init_OnBoardPushButtons(); /*Initialize Interrupts */ INTC_InitINTCInterrupts(); /*Initialize Exception Handlers */ EXCEP_InitExceptionHandlers(); IntcInterruptLINFLEXHandlers(); InitLinFlex0Slave(9600); LED_Off(LED1); LED_Off(LED2); LED_Off(LED3); LED_Off(LED4); /*Initialize scheduler*/ SchM_Init(&SchConfig); /*Hand control to the scheduler*/ SchM_Start(); for(;;) { } }
/*~~~~~~~ Main Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ int main(void) { initModesAndClock(); /* Disable Watchdog */ disableWatchdog(); /*Initialize LEDs on TRK-MPC560xB board */ MemAllocInit(&MemAllocConfig); vfnGPIO_LED_Init(); /*Initialize Interrupts */ INTC_InitINTCInterrupts(); /*Initialize Exception Handlers */ EXCEP_InitExceptionHandlers(); // PIT_device_init(); // PIT_channel_configure(PIT_CHANNEL_0 , Test); // PIT_channel_start(PIT_CHANNEL_0); /* Enable External Interrupts*/ enableIrq(); /* Infinite loop */ SchM_Init(&SchedulerConfig); SchM_Start(); for (;;) { BackgroundSubsystemTasks(); } }
/*~+:Main Code*/ int main(void) { /*Enable peri set 1 sysclk divided by 1 */ /* Mode initializations */ sysinit_InitMode(); /* Clock initializations */ sysinit_InitSysClock(); /* Memory Allcoation Initialization */ MemAllocInit(&MemAllocConfig); /*Initialize LEDs on TRK-MPC560xB board */ vfnGPIO_LED_Init(); /* SBC dependencies */ InitDSPI_1(); ConfigureMZC33905DSPI_1(); /* CAN Initialization */ CAN_Initialization(&can_driver_config); /* Initialize Interrupts */ INTC_InitINTCInterrupts(); /*Initialize Exception Handlers */ EXCEP_InitExceptionHandlers(); /* SchM Initialization */ SchM_Init(&SchMConfig); /* Enable External Interrupts*/ enableIrq(); /*Selection of type of Car*/ Light_Ctrl_HwConfig(); init_ADC0_P0(); /* SchM Start */ SchM_Start(); /* Infinite loop - Should never reach this point */ for (;;) { } }
/*~~~~~~~ Main Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ int main(void) { initModesAndClock(); /* Disable Watchdog */ disableWatchdog(); MemAllocInit(&MemAllocConfig); Init_LIN_SLV1(); /*Initialize Interrupts */ INTC_InitINTCInterrupts(); /*Initialize Exception Handlers */ EXCEP_InitExceptionHandlers(); /* Enable External Interrupts*/ enableIrq(); /* Infinite loop */ /*init del scheduler*/ SchM_Init(&SchConfig); SchM_Start(); for (;;) { BackgroundSubsystemTasks(); } }