]> rtime.felk.cvut.cz Git - arc.git/blob - boards/generic/EcuM_Callout_template.c
EcuM_SericePort must be explicitly compiled with CFG+=ECUM_USE_RTE
[arc.git] / boards / generic / EcuM_Callout_template.c
1 /* -------------------------------- Arctic Core ------------------------------
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com
3  *
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
5  *
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>.
9  *
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
13  * for more details.
14  * -------------------------------- Arctic Core ------------------------------*/
15 \r
16 #warning "This default file may only be used as an example!"
17
18 #include "EcuM.h"
19 #include "EcuM_Cbk.h"\r
20 #include "Det.h"\r
21 #if defined(USE_DEM)\r
22 #include "Dem.h"\r
23 #endif\r
24 #if defined(USE_MCU)\r
25 #include "Mcu.h"\r
26 #endif\r
27 #if defined(USE_GPT)\r
28 #include "Gpt.h"\r
29 #endif\r
30 #if defined(USE_CAN)\r
31 #include "Can.h"\r
32 #endif\r
33 #if defined(USE_CANIF)\r
34 #include "CanIf.h"\r
35 #endif\r
36 #if defined(USE_PDUR)\r
37 #include "PduR.h"\r
38 #endif\r
39 #if defined(USE_COM)\r
40 #include "Com.h"\r
41 #endif\r
42 #if defined(USE_CANTP)\r
43 #include "CanTp.h"\r
44 #endif\r
45 #if defined(USE_DCM)\r
46 #include "Dcm.h"\r
47 #endif\r
48 #if defined(USE_PWM)\r
49 #include "Pwm.h"\r
50 #endif\r
51 #if defined(USE_IOHWAB)\r
52 #include "IoHwAb.h"\r
53 #endif
54 #if defined(USE_FLS)
55 #include "Fls.h"
56 #endif
57 #if defined(USE_EEP)
58 #include "Eep.h"
59 #endif
60 #if defined(USE_FEE)
61 #include "Fee.h"
62 #endif\r
63 #if defined(USE_EA)
64 #include "Ea.h"
65 #endif
66 #if defined(USE_NVM)
67 #include "NvM.h"
68 #endif
69 #if defined(USE_COMM)
70 #include "ComM.h"
71 #endif
72 #if defined(USE_NM)
73 #include "Nm.h"
74 #endif
75 #if defined(USE_CANNM)
76 #include "CanNm.h"
77 #endif
78 #if defined(USE_CANSM)
79 #include "CanSM.h"
80 #endif
81 #if defined(USE_LINSM)
82 #include "LinSM.h"
83 #endif
84 #if defined(USE_SPI)
85 #include "Spi.h"
86 #endif
87 #if defined(USE_WDG)
88 #include "Wdg.h"
89 #endif
90 #if defined(USE_WDGM)
91 #include "WdgM.h"
92 #endif
93 \r
94 void EcuM_AL_DriverInitZero(void)\r
95 {\r
96         Det_Init();/** @req EcuM2783 */\r
97     Det_Start();/** @req EcuM2634 */\r
98 }\r
99 \r
100 EcuM_ConfigType* EcuM_DeterminePbConfiguration(void)\r
101 {\r
102         return &EcuMConfig;\r
103 }\r
104
105 void EcuM_AL_DriverInitOne(const EcuM_ConfigType *ConfigPtr)\r
106 {
107         (void)ConfigPtr;
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
111 \r
112         /* Set up default clock (Mcu_InitClock requires initRun==1) */
113         /* Ignoring return value */\r
114         (void) Mcu_InitClock( ConfigPtr->McuConfig->McuDefaultClockSettings );\r
115 \r
116         // Wait for PLL to sync.\r
117         while (Mcu_GetPllStatus() != MCU_PLL_LOCKED)
118         {\r
119           ;
120         }\r
121 #endif\r
122 \r
123 #if defined(USE_DEM)\r
124         // Preinitialize DEM\r
125         Dem_PreInit();\r
126 #endif\r
127 \r
128 #if defined(USE_PORT)\r
129         // Setup Port\r
130         Port_Init(ConfigPtr->PortConfig);\r
131 #endif\r
132 \r
133 \r
134 #if defined(USE_GPT)\r
135         // Setup the GPT\r
136         Gpt_Init(ConfigPtr->GptConfig);\r
137 #endif\r
138 \r
139         // Setup watchdog\r
140 #if defined(USE_WDG)
141         Wdg_Init(ConfigPtr->WdgConfig);
142 #endif
143 #if defined(USE_WDGM)
144         WdgM_Init(ConfigPtr->WdgMConfig);
145 #endif
146 \r
147 \r
148 #if defined(USE_DMA)\r
149         // Setup DMA\r
150         Dma_Init(ConfigPtr->DmaConfig);\r
151 #endif\r
152 \r
153 #if defined(USE_ADC)\r
154         // Setup ADC\r
155         Adc_Init(ConfigPtr->AdcConfig);\r
156 #endif\r
157 \r
158         // Setup ICU\r
159         // TODO\r
160 \r
161         // Setup PWM\r
162 #if defined(USE_PWM)\r
163         // Setup PWM\r
164         Pwm_Init(ConfigPtr->PwmConfig);\r
165 #endif\r
166 }\r
167 \r
168 void EcuM_AL_DriverInitTwo(const EcuM_ConfigType* ConfigPtr)\r
169 {
170         (void)ConfigPtr;
171   //lint --e{715}       PC-Lint (715) - ConfigPtr usage depends on configuration of modules
172 \r
173 #if defined(USE_SPI)\r
174         // Setup SPI\r
175         Spi_Init(ConfigPtr->SpiConfig);\r
176 #endif\r
177 \r
178 #if defined(USE_EEP)\r
179         // Setup EEP\r
180         Eep_Init(ConfigPtr->EepConfig);\r
181 #endif\r
182 \r
183 #if defined(USE_FLS)\r
184         // Setup Flash\r
185         Fls_Init(ConfigPtr->FlashConfig);\r
186 #endif\r
187 \r
188 #if defined(USE_FEE)
189         // Setup FEE
190         Fee_Init();
191 #endif
192
193 #if defined(USE_EA)
194         // Setup EA
195         Ea_Init();
196 #endif
197
198 #if defined(USE_NVM)
199         // Setup NVRAM Manager and start the read all job
200         NvM_Init();
201         NvM_ReadAll();
202 #endif
203
204         // Setup CAN tranceiver\r
205         // TODO\r
206 \r
207 #if defined(USE_CAN)\r
208         // Setup Can driver\r
209         Can_Init(ConfigPtr->CanConfig);\r
210 #endif\r
211 \r
212 #if defined(USE_CANIF)\r
213         // Setup CanIf\r
214         CanIf_Init(ConfigPtr->CanIfConfig);\r
215 #endif\r
216 \r
217 #if defined(USE_CANTP)\r
218         // Setup CAN TP\r
219         CanTp_Init();\r
220 #endif
221
222 #if defined(USE_CANSM)
223         CanSM_Init(ConfigPtr->CanSMConfig);
224 #endif
225 \r
226         // Setup LIN\r
227         // TODO\r
228 \r
229 #if defined(USE_PDUR)\r
230         // Setup PDU Router\r
231         PduR_Init(ConfigPtr->PduRConfig);\r
232 #endif\r
233
234 #if defined(USE_CANNM)
235         // Setup Can Network Manager
236         CanNm_Init(ConfigPtr->CanNmConfig);
237 #endif
238
239 #if defined(USE_NM)
240         // Setup Network Management Interface
241         Nm_Init(ConfigPtr->NmConfig);
242 #endif
243 \r
244 #if defined(USE_COM)\r
245         // Setup COM layer\r
246         Com_Init(ConfigPtr->ComConfig);\r
247 #endif\r
248 \r
249 #if defined(USE_DCM)\r
250         // Setup DCM\r
251         Dcm_Init();\r
252 #endif\r
253 \r
254 #if defined(USE_IOHWAB)\r
255         // Setup IO hardware abstraction layer\r
256         IoHwAb_Init();\r
257 #endif\r
258 }\r
259 \r
260 void EcuM_AL_DriverInitThree(const EcuM_ConfigType* ConfigPtr)\r
261 {
262         (void)ConfigPtr;
263   //lint --e{715}       PC-Lint (715) - ConfigPtr usage depends on configuration of modules
264 \r
265 #if defined(USE_DEM)\r
266         // Setup DEM\r
267         Dem_Init();\r
268 #endif\r
269 \r
270 #if defined(USE_COMM)
271         // Setup Communication Manager
272         ComM_Init(ConfigPtr->ComMConfig);
273 #endif
274 }\r
275
276 void EcuM_OnEnterRUN(void)
277 {
278
279 }
280
281 void EcuM_OnExitRun(void)
282 {
283
284 }
285
286 void EcuM_OnExitPostRun(void)
287 {
288
289 }
290
291 void EcuM_OnPrepShutdown(void)
292 {
293
294 }
295
296 void EcuM_OnGoSleep(void)
297 {
298
299 }
300
301 void EcuM_OnGoOffOne(void)
302 {
303
304 }
305
306 void EcuM_OnGoOffTwo(void)
307 {
308
309 }
310
311 void EcuM_AL_SwitchOff(void)
312 {
313
314 }