Beispiel #1
0
void main(void) 
{      
    /* Disable interrupts */
    INTERRUPT_DISABLE(); 
    /* XGATE initialization */
    vfn_XGATE_CPU_init();
    /* Initialize Interrupt Module */
    vfnInterrupt_Init(ASW_WITH_BOOT);          
    /* 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();
    /* Emulated EEPROM initialization */
    u16MemStatus = u16emul_eeprom_init(&vfnCOPWatchdog_Reset,&EEEPROM_config[0]);
    /* Initialize CAM/Crank emulation */
    /*vfnCamCrank_Init();*/
    /* Initialize Task Scheduler */ 
    vfnScheduler_Init();
     /* Arm COP watchdog */
    vfnCOPWatchdog_Init();
    /* Start execution of task scheduler */
    vfnScheduler_Start();
    /* Once all initializations are complete, enable interrupts */
    INTERRUPT_ENABLE();     
    /* Start CAM/Crank emulation */
    /*vfnCamCrank_Start();*/
    /* Start J2716 emulation */
    J2716_Init(&J2716_astDevicesCfg[0]);
    /* Start ADC */
    ADC_vInit();
    /*-- Loop through all the periodic tasks from Task Scheduler --*/
    for(;;)
    {
        /* Perform all scheduled tasks */
        vfnTask_Scheduler();
        /* Perform all background susbystem control tasks */
        vfnBackgroundSubsystemTasks();
                   
    }
}
Beispiel #2
0
void Project_Init(void)
{

  // USER CODE BEGIN (Project_Init,0)

  // USER CODE END

  /// the following initialization is made by the compiler EDE when you
  /// import the DAvE project

  /// --- initialization of the SYSCON Register ---
  ///- 256 words system stack
  ///- the internal ROM area is mapped to segment 1
  ///- the segmentation is enabled (CSP is saved/restored during interrupt entry/exit)
  ///- the internal ROM is disabled: accesses to the ROM area use the external bus
  ///- the pin #BHE (byte high enable) is enabled
  ///- the system clock output is disabled
  ///- the pin #WR acts as #WRL and pin #BHE acts as #WRH
  ///- the on-chip X-Peripherals are enabled and can be accessed
  ///- pin #RSTIN is an input only
  ///- the on-chip oscillator watchdog is disabled
  ///- latched CS mode; CS signals are latch internally


  /// --- initialization of the BUSCON 0-4 and ADRRSEL Registers 1-4 ---

  /// ---------- external bus 0 is enabled ----------
  ///- 16-bit multiplexed bus
  ///- memory cycle time control: 15 waitstates
  ///- read/write delay control: activate signal 1 TCL after falling edge of ALE  
  ///- chip select mode: address chip select 
  ///- memory tristate control: 1 waitstate
  ///- ALE lengthening control: lengthened ALE signal


  // initializes the IO ports
  IO_vInit();

  // initializes the Asynchronous/Synchronous Serial Interface (ASC)
  ASC_vInit();

  // initializes the On-Chip CAN Interface (CAN)
  CAN_vInit();

  // initializes the Analog/Digital Converter (ADC)
  ADC_vInit();

  // initializes the Capture/Compare Unit CAPCOM2
  CC2_vInit();

  // initializes the General Purpose Timer Unit 1 (GPT1)
  GT1_vInit();

  // initializes the Real Time Clock (RTC)
  RTC_vInit();

  // USER CODE BEGIN (Project_Init,1)

	// Compare-Wert neu setzen
	CC2_vSetCCxReg(CC_16, compare16);

  // USER CODE END

  /// globally enable interrupts
  IEN = 1;
}
Beispiel #3
0
void MAIN_vInit(void)
{
  // USER CODE BEGIN (Init,2)

  // USER CODE END

  //// -----------------------------------------------------------------------
  //// Begin of Important Settings for the Start-Up File
  //// -----------------------------------------------------------------------
  ///  All following settings must be set in the start-up file. You can use 
  ///  DAvE's project file (*.dpt) to include this register values into your 
  ///  compiler EDE.

    ///  ---------------------------------------------------------------------
    ///  Initialization of the SYSCON Register:
    ///  ---------------------------------------------------------------------
    ///  - 256 words system stack
    ///  - Internal ROM area mapped to segment 1
    ///  - the segmentation is enabled (CSP is saved/restored during 
    ///  interrupt entry/exit)
    ///  - Internal ROM disabled
    ///  - the pin #BHE is enabled
    ///  - the pins #WR and #BHE retain their normal functions
    ///  - system clock output CLKOUT is disabled
    ///  - latched #CS mode
    ///  - pin #RSTIN is pulled low during the internal reset sequence
    ///  - the on-chip X-Peripherals are enabled and can be accessed
    ///  - accesses to the XBUS peripherals are done internally

    //// this register must be set in the start-up file
    //// SYSCON  =  0x101C

    ///  ---------------------------------------------------------------------
    ///  Initialization of the SYSCON1 Register:
    ///  ---------------------------------------------------------------------

    //// this register must be set in the start-up file
    //// SYSCON1  =  0x0000

    ///  ---------------------------------------------------------------------
    ///  Initialization of the SYSCON2 Register:
    ///  ---------------------------------------------------------------------

    //// this register must be set in the start-up file
    //// SYSCON2  =  0x0000

    ///  ---------------------------------------------------------------------
    ///  Initialization of the SYSCON3 Register:
    ///  ---------------------------------------------------------------------

    //// this register must be set in the start-up file
    //// SYSCON3  =  0x0000

    ///  ---------------------------------------------------------------------
    ///  --- initialization of the BUSCON 0-4 and ADRRSEL Registers 1-4 ---
    ///  ---------------------------------------------------------------------


    ///  ---------------------------------------------------------------------
    ///  ---------- external bus 0 is enabled ----------
    ///  ---------------------------------------------------------------------
    ///  - 16-bit Multiplexed Bus
    ///  - memory cycle time control: 15 waitstates
    ///  - With read/write delay: activate command 1 TCL after falling edge 
    ///  of ALE
    ///  - chip select mode: address chip select
    ///  - memory tristate control: 1 waitstate
    ///  - ALE lengthening control: lengthened ALE signal
    ///  - Address windows are switched immediately
    ///  - Normal #WR signal

    //// this register must be set in the start-up file
    //// BUSCON0  =  0x06C0




  //// -----------------------------------------------------------------------
  //// End of Important Settings for the Start-Up File
  //// -----------------------------------------------------------------------




  //   -----------------------------------------------------------------------
  //   Initialization of the Peripherals:
  //   -----------------------------------------------------------------------

  //   initializes the Parallel Ports
  IO_Init();

  //   initializes the Asynchronous/Synchronous Serial Interface (ASC0)
  ASC0_Init();

  //   initializes the General Purpose Timer Unit (GPT1)
  GPT1_vInit();

  //   initializes the Watchdog Timer (WDT)
  WDT_Init();

  //   initializes the Real Timer Clock (RTC)
  RTC_Init();

  //   initializes the Analog / Digital Converter (ADC)
  ADC_vInit();

  //   initializes the Capture / Compare Unit 2 (CAPCOM2)
  CC2_Init();

  //   initializes the Capture / Compare Unit 6 (CAPCOM6)
  CC6_Init();

  //   initializes the On-Chip CAN Interface 1 (CAN1)
  CAN1_Init();

  // USER CODE BEGIN (Init,3)

  // USER CODE END

  //   globally enable interrupts
  PSW_IEN        =  1;          

} //  End of function MAIN_vInit