Esempio n. 1
0
void EcuM_Callout_DriverInitListTwo(void)
{
  /* status of NvM initialization */
  NvM_RequestResultType Result;
  BswM_Init(BswM_ConfigPtr);
  
  
  Fls_Init(NULL_PTR);
#ifdef BASE_EA_ENABLED
  EA_INIT_FUNC();
#endif
#ifdef BASE_FEE_ENABLED
  FEE_INIT_FUNC();
  
  /* wait for FEE to complete the init sequence */
  do
  {
    Fee_MainFunction();
    Fls_MainFunction();
  }
  while (MEMIF_IDLE != Fee_GetStatus());

#endif
#ifdef BASE_NVM_ENABLED
  NVM_INIT_FUNC();
  NvM_ReadAll();
  
  /* wait for the NvM_ReadAll() to complete - some of the remaining
     modules need valid NvRam data...       */
  do
  {
    NvM_MainFunction();
    Fee_MainFunction();
    Fls_MainFunction();

    (void)NvM_GetErrorStatus(NvMConf_NvMBlockDescriptor_NvMBlock_ConfigID, &Result);
  }
  while (Result == NVM_REQ_PENDING);

#endif
  LinEmuUart_Init();
  
  Can_InitMemory();
  Can_Init(&CanConfigSet);

  CanIf_InitMemory();
  CanIf_Init(&CanIf_Config);
  //CanNm_Init(&CanNmGlobalConfig);
  //Nm_Init(&Nm_Configuration0);
  PduR_InitMemory();
  PduR_Init(&PduRGlobalConfig);
  Com_InitMemory();
  Com_Init(&ComConfig);
  CanSM_InitMemory();
  CanSM_Init();
  CanTp_InitMemory();
  CanTp_Init();  
  ComM_InitMemory();
  ComM_Init(&ComMConfig);
  Xcp_Init(NULL);
  FiM_Init(&FiM_Config_0);
  DiagMeas_Init();
  DiagCtrl_Init();
  SCI_B6Bridge_Init();
    SCI_Pfc_Init();
  SCI_IOHW_Init();
  
#ifdef BASE_DEM_ENABLED
  DEM_INIT_FUNC();
  /* start the standard operation cycle */
  /* (void) Dem_SetOperationCycleState(DEM_OPCYC_POWER, DEM_CYCLE_STATE_START); */
#endif  
  Dcm_Init();
}
Esempio n. 2
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 {
        #if defined(__GTK__)
        #ifdef USE_FEE
		Fls_MainFunction();
		Fee_MainFunction();
        #endif
        #ifdef USE_EA
		Eep_MainFunction();
		Ea_MainFunction();
        #endif
		NvM_MainFunction();
        #endif
		/* 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();

}