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)
85 void EcuM_AL_DriverInitZero(void)
\r
91 EcuM_ConfigType* EcuM_DeterminePbConfiguration(void)
\r
96 void EcuM_AL_DriverInitOne(const EcuM_ConfigType *ConfigPtr)
\r
98 //lint --e{715} PC-Lint (715) - ConfigPtr usage depends on configuration of modules
\r
99 #if defined(USE_MCU)
\r
100 Mcu_Init(ConfigPtr->McuConfig);
\r
102 /* Set up default clock (Mcu_InitClock requires initRun==1) */
103 /* Ignoring return value */
\r
104 (void) Mcu_InitClock( ConfigPtr->McuConfig->McuDefaultClockSettings );
\r
106 // Wait for PLL to sync.
\r
107 while (Mcu_GetPllStatus() != MCU_PLL_LOCKED)
113 #if defined(USE_DEM)
\r
114 // Preinitialize DEM
\r
118 #if defined(USE_PORT)
\r
120 Port_Init(ConfigPtr->PortConfig);
\r
124 #if defined(USE_GPT)
\r
126 Gpt_Init(ConfigPtr->GptConfig);
\r
132 #if defined(USE_DMA)
\r
134 Dma_Init(ConfigPtr->DmaConfig);
\r
137 #if defined(USE_ADC)
\r
139 Adc_Init(ConfigPtr->AdcConfig);
\r
146 #if defined(USE_PWM)
\r
148 Pwm_Init(ConfigPtr->PwmConfig);
\r
152 void EcuM_AL_DriverInitTwo(const EcuM_ConfigType* ConfigPtr)
\r
154 //lint --e{715} PC-Lint (715) - ConfigPtr usage depends on configuration of modules
156 #if defined(USE_SPI)
\r
158 Spi_Init(ConfigPtr->SpiConfig);
\r
161 #if defined(USE_EEP)
\r
163 Eep_Init(ConfigPtr->EEpConfig);
\r
166 #if defined(USE_FLS)
\r
168 Fls_Init(ConfigPtr->FlashConfig);
\r
182 // Setup NVRAM Manager and start the read all job
187 // Setup CAN tranceiver
\r
190 #if defined(USE_CAN)
\r
191 // Setup Can driver
\r
192 Can_Init(ConfigPtr->CanConfig);
\r
195 #if defined(USE_CANIF)
\r
197 CanIf_Init(ConfigPtr->CanIfConfig);
\r
200 #if defined(USE_CANTP)
\r
205 #if defined(USE_CANSM)
206 CanSM_Init(ConfigPtr->CanSMConfig);
212 #if defined(USE_PDUR)
\r
213 // Setup PDU Router
\r
214 PduR_Init(ConfigPtr->PduRConfig);
\r
217 #if defined(USE_CANNM)
218 // Setup Can Network Manager
219 CanNm_Init(ConfigPtr->CanNmConfig);
223 // Setup Network Management Interface
224 Nm_Init(ConfigPtr->NmConfig);
227 #if defined(USE_COM)
\r
229 Com_Init(ConfigPtr->ComConfig);
\r
232 #if defined(USE_DCM)
\r
237 #if defined(USE_IOHWAB)
\r
238 // Setup IO hardware abstraction layer
\r
243 void EcuM_AL_DriverInitThree(const EcuM_ConfigType* ConfigPtr)
\r
245 //lint --e{715} PC-Lint (715) - ConfigPtr usage depends on configuration of modules
247 #if defined(USE_DEM)
\r
252 #if defined(USE_COMM)
253 // Setup Communication Manager
254 ComM_Init(ConfigPtr->ComMConfig);
258 void EcuM_OnEnterRUN(void)
263 void EcuM_OnExitRun(void)
268 void EcuM_OnExitPostRun(void)
273 void EcuM_OnPrepShutdown(void)
278 void EcuM_OnGoSleep(void)
283 void EcuM_OnGoOffOne(void)
288 void EcuM_OnGoOffTwo(void)
293 void EcuM_AL_SwitchOff(void)