1 /* -------------------------------- Arctic Core ------------------------------
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
6 * This source code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by the
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * -------------------------------- Arctic Core ------------------------------*/
16 #warning "This default file may only be used as an example!"
19 #include "EcuM_Cbk.h"
\r
21 #if defined(USE_DEM)
\r
24 #if defined(USE_MCU)
\r
27 #if defined(USE_GPT)
\r
30 #if defined(USE_CAN)
\r
33 #if defined(USE_CANIF)
\r
36 #if defined(USE_PDUR)
\r
39 #if defined(USE_COM)
\r
42 #if defined(USE_CANTP)
\r
45 #if defined(USE_DCM)
\r
48 #if defined(USE_PWM)
\r
51 #if defined(USE_IOHWAB)
\r
75 #if defined(USE_CANNM)
78 #if defined(USE_CANSM)
81 #if defined(USE_LINSM)
94 void EcuM_AL_DriverInitZero(void)
\r
96 Det_Init();/** @req EcuM2783 */
\r
97 Det_Start();/** @req EcuM2634 */
\r
100 EcuM_ConfigType* EcuM_DeterminePbConfiguration(void)
\r
102 return &EcuMConfig;
\r
105 void EcuM_AL_DriverInitOne(const EcuM_ConfigType *ConfigPtr)
\r
108 //lint --e{715} PC-Lint (715) - ConfigPtr usage depends on configuration of modules
\r
109 #if defined(USE_MCU)
\r
110 Mcu_Init(ConfigPtr->McuConfig);
\r
112 /* Set up default clock (Mcu_InitClock requires initRun==1) */
113 /* Ignoring return value */
\r
114 (void) Mcu_InitClock( ConfigPtr->McuConfig->McuDefaultClockSettings );
\r
116 // Wait for PLL to sync.
\r
117 while (Mcu_GetPllStatus() != MCU_PLL_LOCKED)
123 #if defined(USE_DEM)
\r
124 // Preinitialize DEM
\r
128 #if defined(USE_PORT)
\r
130 Port_Init(ConfigPtr->PortConfig);
\r
134 #if defined(USE_GPT)
\r
136 Gpt_Init(ConfigPtr->GptConfig);
\r
141 Wdg_Init(ConfigPtr->WdgConfig);
143 #if defined(USE_WDGM)
144 WdgM_Init(ConfigPtr->WdgMConfig);
148 #if defined(USE_DMA)
\r
150 Dma_Init(ConfigPtr->DmaConfig);
\r
153 #if defined(USE_ADC)
\r
155 Adc_Init(ConfigPtr->AdcConfig);
\r
162 #if defined(USE_PWM)
\r
164 Pwm_Init(ConfigPtr->PwmConfig);
\r
168 void EcuM_AL_DriverInitTwo(const EcuM_ConfigType* ConfigPtr)
\r
171 //lint --e{715} PC-Lint (715) - ConfigPtr usage depends on configuration of modules
173 #if defined(USE_SPI)
\r
175 Spi_Init(ConfigPtr->SpiConfig);
\r
178 #if defined(USE_EEP)
\r
180 Eep_Init(ConfigPtr->EepConfig);
\r
183 #if defined(USE_FLS)
\r
185 Fls_Init(ConfigPtr->FlashConfig);
\r
199 // Setup NVRAM Manager and start the read all job
204 // Setup CAN tranceiver
\r
207 #if defined(USE_CAN)
\r
208 // Setup Can driver
\r
209 Can_Init(ConfigPtr->CanConfig);
\r
212 #if defined(USE_CANIF)
\r
214 CanIf_Init(ConfigPtr->CanIfConfig);
\r
217 #if defined(USE_CANTP)
\r
222 #if defined(USE_CANSM)
223 CanSM_Init(ConfigPtr->CanSMConfig);
229 #if defined(USE_PDUR)
\r
230 // Setup PDU Router
\r
231 PduR_Init(ConfigPtr->PduRConfig);
\r
234 #if defined(USE_CANNM)
235 // Setup Can Network Manager
236 CanNm_Init(ConfigPtr->CanNmConfig);
240 // Setup Network Management Interface
241 Nm_Init(ConfigPtr->NmConfig);
244 #if defined(USE_COM)
\r
246 Com_Init(ConfigPtr->ComConfig);
\r
249 #if defined(USE_DCM)
\r
254 #if defined(USE_IOHWAB)
\r
255 // Setup IO hardware abstraction layer
\r
260 void EcuM_AL_DriverInitThree(const EcuM_ConfigType* ConfigPtr)
\r
263 //lint --e{715} PC-Lint (715) - ConfigPtr usage depends on configuration of modules
265 #if defined(USE_DEM)
\r
270 #if defined(USE_COMM)
271 // Setup Communication Manager
272 ComM_Init(ConfigPtr->ComMConfig);
276 void EcuM_OnEnterRUN(void)
281 void EcuM_OnExitRun(void)
286 void EcuM_OnExitPostRun(void)
291 void EcuM_OnPrepShutdown(void)
296 void EcuM_OnGoSleep(void)
301 void EcuM_OnGoOffOne(void)
306 void EcuM_OnGoOffTwo(void)
311 void EcuM_AL_SwitchOff(void)