]> rtime.felk.cvut.cz Git - arc.git/blob - boards/mpc551xsim/config/EcuM_Lcfg.c
Initial commit.
[arc.git] / boards / mpc551xsim / config / EcuM_Lcfg.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
16
17
18
19
20
21
22
23 \r
24 /* Link time config */\r
25 \r
26 #include "Std_Types.h"\r
27 #include "Os.h"\r
28 #include "Mcu.h"\r
29 #include "Gpt.h"\r
30 #include <assert.h>\r
31 #include "Cpu.h"\r
32 \r
33 //#include "ComM.h"\r
34 //#include "WdgM.h"\r
35 \r
36 //#include "Dem.h"\r
37 //#include "Det.h"\r
38 //#include "NvM.h"\r
39 //#include "rte.h"\r
40 \r
41 extern void os_exception_IVPR();\r
42 extern void os_exception_IVOR10();\r
43 // The OS startup hook\r
44 \r
45 #if 0\r
46 void StartupHook( void ) {\r
47 \r
48         // There a several things we need to connect here\r
49         // * counter id for the system counter is 0\r
50         // * that need to be attached to Gpt\r
51         // --> We need to tell the OS that what Gpt channel it's\r
52         // counter is connected to.\r
53 \r
54         // TODO: We need counter information here..\r
55         // How do I get that information from the OS???\r
56 \r
57         //?     GetCounterAlarmBase()\r
58 \r
59 //      Gpt_StartTimer(GPT_CHANNEL_DEC, 100 );\r
60 //      Gpt_EnableNotification(GPT_CHANNEL_DEC);\r
61 //      Gpt_SetMode(0);\r
62 }\r
63 #endif\r
64 \r
65 extern void os_system_timer( void );\r
66 \r
67 void EcuM_Init( void );\r
68 int  main( void ) {\r
69 \r
70         EcuM_Init();\r
71         return 0;\r
72 }\r
73 \r
74 void EcuM_Init( void ) {\r
75         /* Call all mandatory interfaces, see 8.7.1 */\r
76 \r
77         /* I'm giving up on the MCU configuration. From what I\r
78          * can tell from the documentation the Mcu_Init()\r
79          */\r
80 \r
81 #if 0\r
82         ComM_ConfigType comMConfig;\r
83         WdgM_ConfigType wdgmConfig;\r
84 #endif\r
85 \r
86 // Startup I\r
87         {\r
88                 const Mcu_ConfigType mcuConfig;\r
89                 Mcu_Init(&mcuConfig);\r
90         }\r
91 //      Mcu_GetResetReason();\r
92 #if 0\r
93         Det_Init();\r
94         Dem_PreInit();\r
95         EcuM_AL_DriverInitOne();\r
96 #endif\r
97 \r
98 \r
99         {\r
100                 // If we assume the OS will require SYSTEM_COUNTER to function.\r
101                 // We should either get the values from SYSTEM_COUNTER\r
102 \r
103                 Gpt_ConfigType GptConfigData[] =\r
104                         { {\r
105                                 .GptChannelId = GPT_CHANNEL_DEC,\r
106                                 .GptChannelMode = GPT_MODE_CONTINUOUS,\r
107                                 .GptChannelClkSrc = 0,\r
108                                 .GptNotification = os_system_timer,\r
109                         }\r
110                         };\r
111                 Gpt_Init(&GptConfigData[0]);\r
112 \r
113                 // The timer is actually started in StartupHook()\r
114         }\r
115 \r
116 \r
117 //      EcuM_SelectShutdownTarget(target,mode);\r
118         StartOS(0);\r
119 // Startup II\r
120         //EcuM_AL_DriverInitTwo();\r
121 \r
122 #if 0\r
123         ComM_Init(&comMConfig);\r
124         WdgM_Init(&wdgmConfig);\r
125         NvM_Init();\r
126         NvM_ReadAll();\r
127         NvM_WriteAll();\r
128         NvM_CancelWriteAll();\r
129 \r
130         Dem_PreInit();\r
131         Dem_Init();\r
132         {\r
133                 Dem_EventIdType id = 0;\r
134                 Dem_EventStatusType status = 0;\r
135                 Dem_ReportErrorStatus(id,status);\r
136         }\r
137         Rte_Start();\r
138         Rte_Stop();\r
139 #endif\r
140 \r
141         ShutdownOS(E_OK);\r
142         EnableAllInterrupts();\r
143         DisableAllInterrupts();\r
144 \r
145 //      Det_ReportError(1,2,3,4);\r
146 }\r
147 \r
148 void EcuM_Shutdown( void ) {\r
149 \r
150 }\r
151 \r
152 void EcuM_GetVersionInfo( Std_VersionInfoType *versioninfo ) {\r
153 \r
154 }\r
155 \r