예제 #1
0
void EcuM_Callout_DriverInitListOne(void)
{
  Det_Init();
  Dem_PreInit();
  Mcu_Init(&McuModuleConfiguration_0);
  Mcu_AdditionalInit();
  Mcl_Init(NULL_PTR);
  Port_Init(NULL_PTR);
  Adc_Init(NULL_PTR);
  Dio_Init(NULL_PTR);
  Gpt_Init(NULL_PTR);
  Pwm_Init(NULL_PTR);
  Icu_Init(NULL_PTR);
  Spi_Init(NULL_PTR);
  SpiCtrl_Init();
  SwGpt_Init();
  pIcomInstBle = ICOM_Create();
  ICOMChannelStatus_Init(pIcomInstBle);
  ICOMChannelDiag_Init(pIcomInstBle);
  ExtFlashSpiCtrlInit(SpiConf_SpiChannel_Spi_NVM_Command,\
                      SpiConf_SpiSequence_Spi_Seq_NVM,\
                      SpiConf_SpiJob_Spi_Job_NVM);
  CC254xCDD_Init(pIcomInstBle, 
                 DioConf_DioChannel_B6_SPI_SRDY_CU_LPCPU,\
                 SpiConf_SpiChannel_Spi_TICC2540_Command_8,\
                 SpiConf_SpiSequence_Spi_Seq_Ble_Exchange);
                 
  /* *******************************************************************
   * Wdg must be the latest in the initialization sequence
   * otherwise the function call Spi_SetAsyncMode(SPI_INTERRUPT_MODE)
   * returns a negative response when initializing the CC254xCDD_Init
   *********************************************************************/
  Wdg_Init(NULL_PTR);
  WdgM_Init(NULL_PTR);
  WdgM_SetMode(1U,0U);
  
}
/**
 * Part of STARTUP I
 *
 * @param ConfigPtr
 */
void EcuM_AL_DriverInitOne(const EcuM_ConfigType *ConfigPtr)
{
	(void)ConfigPtr;

#if defined(USE_MCU)
	Mcu_Init(ConfigPtr->McuConfig);

	/* Set up default clock (Mcu_InitClock requires initRun==1) */
	/* Ignoring return value */
	(void) Mcu_InitClock(ConfigPtr->McuConfig->McuDefaultClockSettings);

	// Wait for PLL to sync.
	while (Mcu_GetPllStatus() != MCU_PLL_LOCKED) {
		;
	}

	Mcu_DistributePllClock();
#endif

#if defined(USE_DEM)
	// Preinitialize DEM
	NO_DRIVER(Dem_PreInit(ConfigPtr->DemConfig));
#endif

#if defined(USE_PORT)
	// Setup Port
	Port_Init(ConfigPtr->PortConfig);
#endif

#if defined(USE_DIO)
    // Setup Dio
    Dio_Init(ConfigPtr->DioCfg);
#endif

#if defined(USE_GPT)
	// Setup the GPT
	Gpt_Init(ConfigPtr->GptConfig);
#endif

	// Setup watchdog
#if defined(USE_WDG)
	Wdg_Init(ConfigPtr->WdgConfig);
#endif
#if defined(USE_WDGM)
	NO_DRIVER(WdgM_Init(ConfigPtr->WdgMConfig));
#endif

#if defined(USE_DMA)
	// Setup DMA
	Dma_Init(ConfigPtr->DmaConfig);
#endif

#if defined(USE_ADC)
	// Setup ADC
	Adc_Init(ConfigPtr->AdcConfig);
#endif

#if defined(USE_BSWM)
	// Setup BSWM - not supporting configustructure for BswM
	BswM_Init(NULL);
#endif

	// Setup ICU
#if defined(USE_ICU)
     Icu_Init(ConfigPtr->IcuConfig);
#endif

	// Setup PWM
#if defined(USE_PWM)
	// Setup PWM
	Pwm_Init(ConfigPtr->PwmConfig);
#endif

    // Setup OCU
#if defined(USE_OCU)
	 Ocu_Init(ConfigPtr->OcuConfig);
#endif

#if defined(CFG_SHELL)
	SHELL_Init();
#endif
}
예제 #3
0
void EcuM_AL_DriverInitOne(const EcuM_ConfigType* configPtr) {

   /* provide a proper clock */
   Mcu_Init(configPtr->bsw_driver.init_one.mcu_cfg);
   Mcu_InitClock(0);
   Mcu_DistributePllClock();

   /* -----------------------------------------------------------------------
	      Interrupt System:
	      -----------------------------------------------------------------------
	      - four arbitration cycles (max. 255 interrupt sources)
	      - two clocks per arbitration cycle */

   __mtcr(0xFE2C,  0x00000000);     /* load CPU interrupt control register */
   __isync();

   /* -----------------------------------------------------------------------
	      Peripheral Control Processor (PCP):
	      -----------------------------------------------------------------------
	      - the PCP internal clock is always running

	      - use Full Context save area (R[0] - R[7])
	      - start progam counter as left by last invocation
	      - channel watchdog is disabled
	      - maximum channel number checking is disabled */

   /* - four arbitration cycles (max. 255 PCP channels) */
   /* - two clocks per arbitration cycle */
   PCP_ICR.U        =  0x00000000;  /* load PCP interrupt control register */

   /* - the PCP warning mechanism is disabled */
   PCP_ITR.U        =  0x00000000;  /* load PCP interrupt threshold register */

   /* - type of service of PCP node 4 is CPU interrupt */
   PCP_SRC4.U       =  0x00001000;  /* load service request control register 4 */

   /* - type of service of PCP node 5 is CPU interrupt */
   PCP_SRC5.U       =  0x00001000;  /* load service request control register 5 */

   /* - type of service of PCP node 6 is CPU interrupt */
   PCP_SRC6.U       =  0x00001000;  /* load service request control register 6 */

   /* - type of service of PCP node 7 is CPU interrupt */
   PCP_SRC7.U       =  0x00001000;  /* load service request control register 7 */

   /* - type of service of PCP node 8 is CPU interrupt */
   PCP_SRC8.U       =  0x00001000;  /* load service request control register 8 */


   ts_initGPTAInt();

   Port_Init(configPtr->bsw_driver.init_one.port_cfg);

   Adc_Init(configPtr->bsw_driver.init_one.adc_cfg);
   Fls_Init(configPtr->bsw_driver.init_one.fls_cfg);
   Gpt_Init(configPtr->bsw_driver.init_one.gpt_cfg);
   Pwm_Init(configPtr->bsw_driver.init_one.pwm_cfg);
   Spi_Init(configPtr->bsw_driver.init_one.spi_cfg);
   Wdg_Init(configPtr->bsw_driver.init_one.wdg_cfg);
#ifdef ECUM_WDGM_INCLUDED
   WdgM_Init(configPtr->bsw_driver.init_one.wdgm_cfg);
#endif

   /* setup end of init protected registers for OS */
   ts_endinit_clear();
   osInitProtected();
   ts_endinit_set();

   /* Overlay Ram:
    * Init registers and mem areas for switching from
    * working page (overlay ram) <-> reference page (flash)
    */
   RAM_OverlayRamReset();

   /* - the CPU interrupt system is globally disabled */
   __enable();


   Spi_SetAsyncMode(SPI_INTERRUPT_MODE);
   Adc_StartGroupConversion(0);
   Adc_StartGroupConversion(1);
   EcuM_SelectApplicationMode(OSDEFAULTAPPMODE);

}
예제 #4
0
/**
 * Part of STARTUP I
 *
 * @param ConfigPtr
 */
void EcuM_AL_DriverInitOne(const EcuM_ConfigType *ConfigPtr)
{
	(void)ConfigPtr;

//	VALIDATE_STATE( ECUM_STATE_STARTUP_ONE );

  //lint --e{715}       PC-Lint (715) - ConfigPtr usage depends on configuration of modules

#if defined(USE_MCU)
	Mcu_Init(ConfigPtr->McuConfig);

	/* Set up default clock (Mcu_InitClock requires initRun==1) */
	/* Ignoring return value */
	(void) Mcu_InitClock(ConfigPtr->McuConfig->McuDefaultClockSettings);

	// Wait for PLL to sync.
	while (Mcu_GetPllStatus() != MCU_PLL_LOCKED) {
		;
	}

	Mcu_DistributePllClock();
#endif

#if defined(USE_DEM)
	// Preinitialize DEM
	NO_DRIVER(Dem_PreInit(ConfigPtr->DemConfig));
#endif

#if defined(USE_PORT)
	// Setup Port
	Port_Init(ConfigPtr->PortConfig);
#endif

#if defined(USE_GPT)
	// Setup the GPT
	Gpt_Init(ConfigPtr->GptConfig);
#endif

	// Setup watchdog
#if defined(USE_WDG)
	Wdg_Init(ConfigPtr->WdgConfig);
#endif
#if defined(USE_WDGM)
	NO_DRIVER(WdgM_Init(ConfigPtr->WdgMConfig));
#endif

#if defined(USE_DMA)
	// Setup DMA
	Dma_Init(ConfigPtr->DmaConfig);
#endif

#if defined(USE_ADC)
	// Setup ADC
	Adc_Init(ConfigPtr->AdcConfig);
#endif

	// Setup ICU
	// TODO
	// Setup PWM
#if defined(USE_PWM)
	// Setup PWM
	Pwm_Init(ConfigPtr->PwmConfig);
#endif

#if defined(CFG_SHELL)
	SHELL_Init();
#endif


}