Beispiel #1
0
/*
 * 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();

}
Beispiel #2
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);
  
}