source: rc_autosar_rh850/trunk/swc-application/EcuM/EcuM_Callout.h@ 112

Last change on this file since 112 was 112, checked in by ertl-honda, 9 years ago

最初のリリースファイルの追加

File size: 7.7 KB
Line 
1/*
2 * TOPPERS/A-RTEGEN
3 * Automotive Runtime Environment Generator
4 *
5 * Copyright (C) 2013-2014 by Center for Embedded Computing Systems
6 * Graduate School of Information Science, Nagoya Univ., JAPAN
7 * Copyright (C) 2013-2015 by FUJI SOFT INCORPORATED, JAPAN
8 * Copyright (C) 2013-2014 by Panasonic Advanced Technology Development Co., Ltd., JAPAN
9 * Copyright (C) 2013-2014 by Renesas Electronics Corporation, JAPAN
10 * Copyright (C) 2013-2014 by Sunny Giken Inc., JAPAN
11 * Copyright (C) 2013-2014 by TOSHIBA CORPORATION, JAPAN
12 * Copyright (C) 2013-2014 by Witz Corporation, JAPAN
13 *
14 * 上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
15 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
16 * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
17 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
18 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
19 * スコード中に含まれていること.
20 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
21 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
22 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
23 * の無保証規定を掲載すること.
24 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
25 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
26 * と.
27 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
28 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
29 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
30 * 報告すること.
31 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
32 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
33 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
34 * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
35 * 免責すること.
36 *
37 * 本ソフトウェアは,AUTOSAR(AUTomotive Open System ARchitecture)仕
38 * 様に基づいている.上記の許諾は,AUTOSARの知的財産権を許諾するもので
39 * はない.AUTOSARは,AUTOSAR仕様に基づいたソフトウェアを商用目的で利
40 * 用する者に対して,AUTOSARパートナーになることを求めている.
41 *
42 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
43 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
44 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
45 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
46 * の責任を負わない.
47 *
48 * $Id: EcuM_Callout.h 448 2014-12-09 12:05:07Z fsi-asanoto $
49 */
50
51#ifndef ECUM_CALLOUT_H
52#define ECUM_CALLOUT_H
53
54#include "Os.h"
55#include "Rte_Main.h"
56#include "sysmod/serial.h"
57#include "sysmod/syslog.h"
58#include "sysmod/banner.h"
59#include "t_syslog.h"
60
61#ifndef TOPPERS_NO_USE_COMSTACK
62#include "Com.h"
63#include "CanIf.h"
64#include "Can.h"
65#endif /* TOPPERS_NO_USE_COMSTACK */
66
67LOCAL_INLINE void
68EcuM_AL_DriverInitZero(void)
69{
70 syslog_initialize();
71 syslog_msk_log(LOG_UPTO(LOG_INFO));
72 InitSerial();
73 print_banner();
74}
75
76#define ALARM_TICK_125US 1000U
77#define ALARM_TICK_10MS 80000U
78#define ALARM_TICK_20MS 160000U
79#define ALARM_TICK_100MS 800000U
80
81LOCAL_INLINE void
82EcuM_BswStartupTwo(void)
83{
84 Std_ReturnType ercd = E_OK;
85
86#ifndef TOPPERS_NO_USE_COMSTACK
87 /*
88 * COMスタック起動処理
89 */
90 Com_IpduGroupVector vector_on;
91
92 /* Canモジュール初期化 */
93 Can_Init(NULL_PTR);
94
95 /* CanIfモジュール初期化 */
96 CanIf_Init(NULL_PTR);
97 /* CanIfモジュールスタートアップ */
98 ercd = CanIf_SetControllerMode(0U, CANIF_CS_STARTED);
99 if (ercd != E_OK) {
100 syslog(LOG_NOTICE, "## CanIf_SetControllerMode returns E_NOT_OK !!");
101 }
102 ercd = CanIf_SetPduMode(0U, CANIF_SET_ONLINE);
103 if (ercd != E_OK) {
104 syslog(LOG_NOTICE, "## CanIf_SetPduMode returns E_NOT_OK !!");
105 }
106
107 /* Comモジュール初期化 */
108 Com_Init(NULL_PTR);
109 /* Comモジュールスタートアップ */
110 Com_SetIpduGroup(vector_on, 0, TRUE);
111 Com_IpduGroupControl(vector_on, TRUE);
112#endif /* TOPPERS_NO_USE_COMSTACK */
113
114 /*
115 * 各アラーム起動処理
116 * (他の初期化完了前に起動するのを避けるため自動起動はしない)
117 */
118
119#ifdef ECU_CBO_ALARM_125us
120 ercd += SetRelAlarm(ECU_CBO_ALARM_125us, ALARM_TICK_125US, ALARM_TICK_125US);
121#endif /* ECU_CBO_ALARM_125us */
122#ifdef ECU_CBO_ALARM_10ms
123 ercd += SetRelAlarm(ECU_CBO_ALARM_10ms, ALARM_TICK_10MS, ALARM_TICK_10MS);
124#endif /* ECU_CBO_ALARM_10ms */
125#ifdef ECU_CBO_ALARM_100ms
126 ercd += SetRelAlarm(ECU_CBO_ALARM_100ms, ALARM_TICK_100MS, ALARM_TICK_100MS);
127#endif /* ECU_CBO_ALARM_100ms */
128
129#ifdef ECU_CB_ALARM_125us
130 ercd += SetRelAlarm(ECU_CB_ALARM_125us, ALARM_TICK_125US, ALARM_TICK_125US);
131#endif /* ECU_CB_ALARM_125us */
132#ifdef ECU_CB_ALARM_10ms
133 ercd += SetRelAlarm(ECU_CB_ALARM_10ms, ALARM_TICK_10MS, ALARM_TICK_10MS);
134#endif /* ECU_CB_ALARM_10ms */
135#ifdef ECU_CB_ALARM_20ms_SCHM
136 ercd += SetRelAlarm(ECU_CB_ALARM_20ms_SCHM, ALARM_TICK_20MS, ALARM_TICK_20MS);
137#endif /* ECU_CB_ALARM_20ms_SCHM */
138#ifdef ECU_CB_ALARM_100ms
139 ercd += SetRelAlarm(ECU_CB_ALARM_100ms, ALARM_TICK_100MS, ALARM_TICK_100MS);
140#endif /* ECU_CB_ALARM_100ms */
141
142#ifdef ECU_CO_ALARM_10ms
143 ercd += SetRelAlarm(ECU_CO_ALARM_10ms, ALARM_TICK_10MS, ALARM_TICK_10MS);
144#endif /* ECU_CO_ALARM_10ms */
145#ifdef ECU_CO_ALARM_20ms_SCHM
146 ercd += SetRelAlarm(ECU_CO_ALARM_20ms_SCHM, ALARM_TICK_20MS, ALARM_TICK_20MS);
147#endif /* ECU_CO_ALARM_20ms_SCHM */
148#ifdef ECU_CO_ALARM_100ms
149 ercd += SetRelAlarm(ECU_CO_ALARM_100ms, ALARM_TICK_100MS, ALARM_TICK_100MS);
150#endif /* ECU_CO_ALARM_100ms */
151
152#ifdef ECU_COD_ALARM_10ms
153 ercd += SetRelAlarm(ECU_COD_ALARM_10ms, ALARM_TICK_10MS, ALARM_TICK_10MS);
154#endif /* ECU_CO_ALARM_10ms */
155#ifdef ECU_COD_ALARM_20ms_SCHM
156 ercd += SetRelAlarm(ECU_COD_ALARM_20ms_SCHM, ALARM_TICK_20MS, ALARM_TICK_20MS);
157#endif /* ECU_CO_ALARM_20ms_SCHM */
158#ifdef ECU_COD_ALARM_100ms
159 ercd += SetRelAlarm(ECU_COD_ALARM_100ms, ALARM_TICK_100MS, ALARM_TICK_100MS);
160#endif /* ECU_CO_ALARM_100ms */
161
162#ifdef ECU_C_ALARM_10ms
163 ercd += SetRelAlarm(ECU_C_ALARM_10ms, ALARM_TICK_10MS, ALARM_TICK_10MS);
164#endif /* ECU_C_ALARM_10ms */
165#ifdef ECU_C_ALARM_20ms_SCHM
166 ercd += SetRelAlarm(ECU_C_ALARM_20ms_SCHM, ALARM_TICK_20MS, ALARM_TICK_20MS);
167#endif /* ECU_C_ALARM_20ms_SCHM */
168#ifdef ECU_C_ALARM_100ms
169 ercd += SetRelAlarm(ECU_C_ALARM_100ms, ALARM_TICK_100MS, ALARM_TICK_100MS);
170#endif /* ECU_C_ALARM_100ms */
171
172#ifdef ECU_B_ALARM_125us
173 ercd += SetRelAlarm(ECU_B_ALARM_125us, ALARM_TICK_125US, ALARM_TICK_125US);
174#endif /* ECU_B_ALARM_125us */
175#ifdef ECU_B_ALARM_20ms_SCHM
176 ercd += SetRelAlarm(ECU_B_ALARM_20ms_SCHM, ALARM_TICK_20MS, ALARM_TICK_20MS);
177#endif /* ECU_B_ALARM_20ms_SCHM */
178#ifdef ECU_B_ALARM_100ms
179 ercd += SetRelAlarm(ECU_B_ALARM_100ms, ALARM_TICK_100MS, ALARM_TICK_100MS);
180#endif /* ECU_B_ALARM_100ms */
181
182#ifdef ECU_O_ALARM_10ms
183 ercd += SetRelAlarm(ECU_O_ALARM_10ms, ALARM_TICK_10MS, ALARM_TICK_10MS);
184#endif /* ECU_O_ALARM_10ms */
185#ifdef ECU_O_ALARM_20ms_SCHM
186 ercd += SetRelAlarm(ECU_O_ALARM_20ms_SCHM, ALARM_TICK_20MS, ALARM_TICK_20MS);
187#endif /* ECU_O_ALARM_20ms_SCHM */
188#ifdef ECU_O_ALARM_100ms
189 ercd += SetRelAlarm(ECU_O_ALARM_100ms, ALARM_TICK_100MS, ALARM_TICK_100MS);
190#endif /* ECU_O_ALARM_100ms */
191
192#ifdef ECU_OD_ALARM_10ms
193 ercd += SetRelAlarm(ECU_OD_ALARM_10ms, ALARM_TICK_10MS, ALARM_TICK_10MS);
194#endif /* ECU_OD_ALARM_10ms */
195#ifdef ECU_OD_ALARM_20ms_SCHM
196 ercd += SetRelAlarm(ECU_OD_ALARM_20ms_SCHM, ALARM_TICK_20MS, ALARM_TICK_20MS);
197#endif /* ECU_OD_ALARM_20ms_SCHM */
198#ifdef ECU_OD_ALARM_100ms
199 ercd += SetRelAlarm(ECU_OD_ALARM_100ms, ALARM_TICK_100MS, ALARM_TICK_100MS);
200#endif /* ECU_OD_ALARM_100ms */
201
202 /* 1つでもエラーがあれば警告表示 */
203 if (ercd != E_OK) {
204 syslog(LOG_NOTICE, "## SetRelAlarm returns E_NOT_OK !!");
205 }
206}
207
208LOCAL_INLINE void
209EcuM_ApplicationStartupTwo(void)
210{
211 /* RTEの初期化 */
212 Rte_Start();
213}
214
215/* BSWスケジューラ未使用時はスタブを用意 */
216#ifdef TOPPERS_NO_USE_SCHM
217void SchM_Init(void)
218{
219}
220#endif /* TOPPERS_NO_USE_SCHM */
221
222#endif /* ECUM_CALLOUT_H */
Note: See TracBrowser for help on using the repository browser.