Exemplo n.º 1
0
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();
                   
    }
}
Exemplo n.º 2
0
/*-- Main Code ----------------------------------------------------------------*/
void main(void)
{
/* Global Sleep Mode enable flag */
UINT8 gu8SleepModeEnabled;

    /* Initialize auxiliary variables */
    gu8Index = 0;                   
    gu8SleepModeEnabled = 0;
    
    /* Prior Initialization, disable interrupts */
    DISABLE_INTERRUPTS();           
    
    /* Initial configuration for ECU hardware resources */
    vfnECU_Init();
    
    /* Initialization of resources for user's, data and engine management */       
    User_Management_Init();    
    Data_Management_Init();
    Engine_Management_Init(); 
    
    /* Start execution of task scheduler */
    vfnScheduler_Start(); 
    
// Only while debugging
//    _DISABLE_COP();
              
    /* Initialization complete, enable interrupts */
    ENABLE_INTERRUPTS();            
      
    /*-- While Power-savings mode is NOT requested --*/
    while (gu8SleepModeEnabled == 0)
    {
// Only while debugging - need to find the right place for this. Maybe in the 1ms task?
        _FEED_COP(); /* feeds the dog */

        /* Execute Multi-thread round robin task scheduler */
        vfnTask_Scheduler();
    }
    
    /* If we ever reach this then we have a problem */
    while(1);
}