source: EcnlProtoTool/trunk/asp3_dcre/sample/tSample2.cdl@ 429

Last change on this file since 429 was 429, checked in by coas-nagasima, 4 years ago

ASP3, TINET, mbed を更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/plain;charset=UTF-8
File size: 7.1 KB
Line 
1/*
2 * サンプルプログラム(2)のコンポーネント記述ファイル
3 *
4 * $Id$
5 */
6
7/*
8 * カーネルオブジェクトの定義
9 */
10import(<kernel.cdl>);
11
12/*
13 * ターゲット非依存のセルタイプの定義
14 */
15import("syssvc/tSerialPort.cdl");
16import("syssvc/tSysLog.cdl");
17import("syssvc/tSysLogAdapter.cdl");
18import("syssvc/tLogTask.cdl");
19import("syssvc/tBanner.cdl");
20
21/*
22 * ターゲット依存部の取り込み
23 */
24import("target.cdl");
25
26/*
27 * サンプルプログラムのC言語ヘッダファイルの取り込み
28 */
29import_C("tSample2.h");
30
31/*
32 * 「セルの組上げ記述」とは,"cell"で始まる行から,それに対応する"};"
33 * の行までのことを言う.
34 */
35
36/*
37 * システムログ機能のアダプタの組上げ記述
38 *
39 * システムログ機能のアダプタは,C言語で記述されたコードから,TECSベー
40 * スのシステムログ機能を呼び出すためのセルである.システムログ機能の
41 * サービスコール(syslog,syslog_0~syslog_5,t_perrorを含む)を呼び
42 * 出さない場合には,以下のセルの組上げ記述を削除してよい.
43 */
44cell tSysLogAdapter SysLogAdapter {
45 cSysLog = SysLog.eSysLog;
46};
47
48/*
49 * システムログ機能の組上げ記述
50 *
51 * システムログ機能を外す場合には,以下のセルの組上げ記述を削除し,コ
52 * ンパイルオプションに-DTOPPERS_OMIT_SYSLOGを追加すればよい.ただし,
53 * システムログタスクはシステムログ機能を使用するため,それも外すこと
54 * が必要である.また,システムログ機能のアダプタも外さなければならな
55 * い.tecsgenが警告メッセージを出すが,無視してよい.
56 */
57cell tSysLog SysLog {
58 logBufferSize = 32; /* ログバッファのサイズ */
59 initLogMask = C_EXP("LOG_UPTO(LOG_NOTICE)");
60 /* ログバッファに記録すべき重要度 */
61 initLowMask = C_EXP("LOG_UPTO(LOG_EMERG)");
62 /* 低レベル出力すべき重要度 */
63 /* 低レベル出力との結合 */
64 cPutLog = PutLogTarget.ePutLog;
65};
66
67/*
68 * シリアルインタフェースドライバの組上げ記述
69 *
70 * シリアルインタフェースドライバを外す場合には,以下のセルの組上げ記
71 * 述を削除すればよい.ただし,システムログタスクはシリアルインタフェー
72 * スドライバを使用するため,それも外すことが必要である.また,シリア
73 * ルインタフェースドライバのアダプタも外さなければならない.
74 */
75cell tSerialPort SerialPort1 {
76 receiveBufferSize = 256; /* 受信バッファのサイズ */
77 sendBufferSize = 256; /* 送信バッファのサイズ */
78
79 /* ターゲット依存部との結合 */
80 cSIOPort = SIOPortTarget1.eSIOPort;
81 eiSIOCBR <= SIOPortTarget1.ciSIOCBR; /* コールバック */
82};
83
84/*
85 * システムログタスクの組上げ記述
86 *
87 * システムログタスクを外す場合には,以下のセルの組上げ記述を削除すれ
88 * ばよい.
89 */
90cell tLogTask LogTask {
91 priority = 3; /* システムログタスクの優先度 */
92 stackSize = LogTaskStackSize; /* システムログタスクのスタックサイズ */
93
94 /* シリアルインタフェースドライバとの結合 */
95 cSerialPort = SerialPort1.eSerialPort;
96 cnSerialPortManage = SerialPort1.enSerialPortManage;
97
98 /* システムログ機能との結合 */
99 cSysLog = SysLog.eSysLog;
100
101 /* 低レベル出力との結合 */
102 cPutLog = PutLogTarget.ePutLog;
103};
104
105/*
106 * カーネル起動メッセージ出力の組上げ記述
107 *
108 * カーネル起動メッセージの出力を外す場合には,以下のセルの組上げ記述
109 * を削除すればよい.
110 */
111cell tBanner Banner {
112 /* 属性の設定 */
113 targetName = BannerTargetName;
114 copyrightNotice = BannerCopyrightNotice;
115};
116
117/*
118 * サンプルプログラムのセルタイプの定義
119 */
120[singleton]
121celltype tSample2 {
122 require tKernel.eKernel; /* 呼び口名なし(例:delay)*/
123 /*require cKernel = tKernel.eKernel;/* 呼び口名あり(例:cKernel_delay)*/
124 require ciKernel = tKernel.eiKernel;/* 呼び口名あり(例:ciKernel_)*/
125
126 call sTask cTask[4]; /* タスク操作 */
127 call sTask cExceptionTask;
128 call sCyclic cCyclic;
129 call sAlarm cAlarm;
130
131 call sSerialPort cSerialPort; /* シリアルドライバとの接続 */
132 call sSysLog cSysLog; /* システムログ機能との接続 */
133
134 entry sTaskBody eMainTask; /* Mainタスク */
135 entry sTaskBody eSampleTask[3]; /* 並行実行されるタスク */
136 entry sTaskBody eExceptionTask; /* 例外処理タスク */
137
138 entry siHandlerBody eiCyclicHandler; /* 周期ハンドラ*/
139 entry siHandlerBody eiAlarmHandler; /* アラームハンドラ */
140
141 entry siHandlerBody eiISR; /* 割込みサービスルーチン */
142
143 entry siCpuExceptionHandlerBody eiCpuExceptionHandler;
144 /* CPU例外ハンドラ */
145};
146
147/*
148 * 組み上げ記述
149 */
150
151cell tKernel ASPKernel {
152};
153
154cell tTask MainTask {
155 /* 呼び口の結合 */
156 cTaskBody = Sample2.eMainTask;
157 /* 属性の設定 */
158 attribute = C_EXP("TA_ACT");
159 priority = C_EXP("MAIN_PRIORITY");
160 stackSize = C_EXP("STACK_SIZE");
161};
162
163cell tTask Task1 {
164 /* 呼び口の結合 */
165 cTaskBody = Sample2.eSampleTask[0];
166 /* 属性の設定 */
167 priority = C_EXP("MID_PRIORITY");
168 stackSize = C_EXP("STACK_SIZE");
169};
170
171cell tTask Task2 {
172 /* 呼び口の結合 */
173 cTaskBody = Sample2.eSampleTask[1];
174 /* 属性の設定 */
175 priority = C_EXP("MID_PRIORITY");
176 stackSize = C_EXP("STACK_SIZE");
177};
178
179cell tTask Task3 {
180 /* 呼び口の結合 */
181 cTaskBody = Sample2.eSampleTask[2];
182 /* 属性の設定 */
183 priority = C_EXP("MID_PRIORITY");
184 stackSize = C_EXP("STACK_SIZE");
185};
186
187cell tTask ExceptionTask {
188 /* 呼び口の結合 */
189 cTaskBody = Sample2.eExceptionTask;
190 /* 属性の設定 */
191 priority = C_EXP("EXC_PRIORITY");
192 stackSize = C_EXP("STACK_SIZE");
193};
194
195cell tCyclicHandler CyclicHandler {
196 /* 呼び口の結合 */
197 ciHandlerBody = Sample2.eiCyclicHandler;
198 /* 属性の設定 */
199 cycleTime = 2000000;
200};
201
202cell tAlarmHandler AlarmHandler {
203 /* 呼び口の結合 */
204 ciHandlerBody = Sample2.eiAlarmHandler;
205};
206
207cell tInterruptRequest InterruptRequest {
208 /* 属性の設定 */
209 interruptNumber = C_EXP("INTNO1");
210 attribute = C_EXP("INTNO1_INTATR");
211 interruptPriority = C_EXP("INTNO1_INTPRI");
212};
213
214cell tISR InterruptServiceRoutine {
215 /* 呼び口の結合 */
216 ciISRBody = Sample2.eiISR;
217 /* 属性の設定 */
218 attribute = C_EXP("TA_NULL");
219 interruptNumber = C_EXP("INTNO1");
220};
221
222cell tCpuExceptionHandler CpuExceptionHandler {
223 /* 呼び口の結合 */
224 ciCpuExceptionHandlerBody = Sample2.eiCpuExceptionHandler;
225 /* 属性の設定 */
226 cpuExceptionHandlerNumber = C_EXP("CPUEXC1");
227};
228
229cell tSample2 Sample2 {
230 /* 呼び口の結合 */
231 cTask[0] = MainTask.eTask;
232 cTask[1] = Task1.eTask;
233 cTask[2] = Task2.eTask;
234 cTask[3] = Task3.eTask;
235
236 cExceptionTask = ExceptionTask.eTask;
237
238 cCyclic = CyclicHandler.eCyclic;
239 cAlarm = AlarmHandler.eAlarm;
240
241 cSerialPort = SerialPort1.eSerialPort;
242 cSysLog = SysLog.eSysLog;
243};
Note: See TracBrowser for help on using the repository browser.