]> rtime.felk.cvut.cz Git - arc.git/blob - boards/mpc551xsim/config/EcuM_Lcfg.c
Merge in Cortex R4 branch.
[arc.git] / boards / mpc551xsim / config / EcuM_Lcfg.c
1 /* -------------------------------- Arctic Core ------------------------------\r
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
3  *\r
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
5  *\r
6  * This source code is free software; you can redistribute it and/or modify it\r
7  * under the terms of the GNU General Public License version 2 as published by the\r
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
9  *\r
10  * This program is distributed in the hope that it will be useful, but\r
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
13  * for more details.\r
14  * -------------------------------- Arctic Core ------------------------------*/\r
15 \r
16 \r
17 \r
18 \r
19 \r
20 \r
21 \r
22 \r
23 \r
24 /* Link time config */\r
25 \r
26 #warning "This default file may only be used as an example!"\r
27 \r
28 #include "Std_Types.h"\r
29 #include "Os.h"\r
30 #include "Mcu.h"\r
31 #include "Gpt.h"\r
32 #include <assert.h>\r
33 #include "Cpu.h"\r
34 \r
35 //#include "ComM.h"\r
36 //#include "WdgM.h"\r
37 \r
38 //#include "Dem.h"\r
39 //#include "Det.h"\r
40 //#include "NvM.h"\r
41 //#include "rte.h"\r
42 \r
43 extern void os_exception_IVPR();\r
44 extern void os_exception_IVOR10();\r
45 // The OS startup hook\r
46 \r
47 #if 0\r
48 void StartupHook( void ) {\r
49 \r
50         // There a several things we need to connect here\r
51         // * counter id for the system counter is 0\r
52         // * that need to be attached to Gpt\r
53         // --> We need to tell the OS that what Gpt channel it's\r
54         // counter is connected to.\r
55 \r
56         // TODO: We need counter information here..\r
57         // How do I get that information from the OS???\r
58 \r
59         //?     GetCounterAlarmBase()\r
60 \r
61 //      Gpt_StartTimer(GPT_CHANNEL_DEC, 100 );\r
62 //      Gpt_EnableNotification(GPT_CHANNEL_DEC);\r
63 //      Gpt_SetMode(0);\r
64 }\r
65 #endif\r
66 \r
67 extern void os_system_timer( void );\r
68 \r
69 void EcuM_Init( void );\r
70 int  main( void ) {\r
71 \r
72         EcuM_Init();\r
73         return 0;\r
74 }\r
75 \r
76 void EcuM_Init( void ) {\r
77         /* Call all mandatory interfaces, see 8.7.1 */\r
78 \r
79         /* I'm giving up on the MCU configuration. From what I\r
80          * can tell from the documentation the Mcu_Init()\r
81          */\r
82 \r
83 #if 0\r
84         ComM_ConfigType comMConfig;\r
85         WdgM_ConfigType wdgmConfig;\r
86 #endif\r
87 \r
88 // Startup I\r
89         {\r
90                 const Mcu_ConfigType mcuConfig;\r
91                 Mcu_Init(&mcuConfig);\r
92         }\r
93 //      Mcu_GetResetReason();\r
94 #if 0\r
95         Det_Init();\r
96 #if defined(USE_DEM)\r
97         Dem_PreInit();\r
98 #endif\r
99         EcuM_AL_DriverInitOne();\r
100 #endif\r
101 \r
102 \r
103         {\r
104                 // If we assume the OS will require SYSTEM_COUNTER to function.\r
105                 // We should either get the values from SYSTEM_COUNTER\r
106 \r
107                 Gpt_ConfigType GptConfigData[] =\r
108                         { {\r
109                                 .GptChannelId = GPT_CHANNEL_DEC,\r
110                                 .GptChannelMode = GPT_MODE_CONTINUOUS,\r
111                                 .GptChannelClkSrc = 0,\r
112                                 .GptNotification = os_system_timer,\r
113                         }\r
114                         };\r
115                 Gpt_Init(&GptConfigData[0]);\r
116 \r
117                 // The timer is actually started in StartupHook()\r
118         }\r
119 \r
120 \r
121 //      EcuM_SelectShutdownTarget(target,mode);\r
122         StartOS(OSDEFAULTAPPMODE);\r
123 // Startup II\r
124         //EcuM_AL_DriverInitTwo();\r
125 \r
126 #if 0\r
127         ComM_Init(&comMConfig);\r
128         WdgM_Init(&wdgmConfig);\r
129         NvM_Init();\r
130         NvM_ReadAll();\r
131         NvM_WriteAll();\r
132         NvM_CancelWriteAll();\r
133 \r
134 #if defined(USE_DEM)\r
135         Dem_PreInit();\r
136         Dem_Init();\r
137         {\r
138                 Dem_EventIdType id = 0;\r
139                 Dem_EventStatusType status = 0;\r
140                 Dem_ReportErrorStatus(id,status);\r
141         }\r
142 #endif\r
143         Rte_Start();\r
144         Rte_Stop();\r
145 #endif\r
146 \r
147         ShutdownOS(E_OK);\r
148         EnableAllInterrupts();\r
149         DisableAllInterrupts();\r
150 \r
151 //      Det_ReportError(1,2,3,4);\r
152 }\r
153 \r
154 void EcuM_Shutdown( void ) {\r
155 \r
156 }\r
157 \r
158 void EcuM_GetVersionInfo( Std_VersionInfoType *versioninfo ) {\r
159 \r
160 }\r
161 \r