1 | #! /usr/bin/perl
|
---|
2 | #
|
---|
3 | # TOPPERS Software
|
---|
4 | # Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
5 | #
|
---|
6 | # Copyright (C) 2007-2015 by Embedded and Real-Time Systems Laboratory
|
---|
7 | # Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
8 | #
|
---|
9 | # ä¸è¨èä½æ¨©è
|
---|
10 | ã¯ï¼ä»¥ä¸ã®(1)ã(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
11 | # ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹
|
---|
12 | # å¤ã»åé
|
---|
13 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
14 | # (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
15 | # 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
16 | # ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
17 | # (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
18 | # ç¨ã§ããå½¢ã§åé
|
---|
19 | å¸ããå ´åã«ã¯ï¼åé
|
---|
20 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
21 | # è
|
---|
22 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
23 | # ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
24 | # (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
25 | # ç¨ã§ããªãå½¢ã§åé
|
---|
26 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
27 | # ã¨ï¼
|
---|
28 | # (a) åé
|
---|
29 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
30 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
31 | # ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
32 | # (b) åé
|
---|
33 | å¸ã®å½¢æ
|
---|
34 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
35 | # å ±åãããã¨ï¼
|
---|
36 | # (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
37 | # 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
38 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
39 | 責ãããã¨ï¼
|
---|
40 | # ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
|
---|
41 | # ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
42 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
43 | # å
|
---|
44 | 責ãããã¨ï¼
|
---|
45 | #
|
---|
46 | # æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
47 | ã
|
---|
48 | # ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
49 | # ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
50 | # ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ã
|
---|
51 | # ã®è²¬ä»»ãè² ããªãï¼
|
---|
52 | #
|
---|
53 | # $Id: gentest 336 2015-06-28 08:26:10Z ertl-hiro $
|
---|
54 | #
|
---|
55 |
|
---|
56 | #
|
---|
57 | # ãã¹ãããã°ã©ã çæãã¼ã«
|
---|
58 | #
|
---|
59 |
|
---|
60 | $infile = $ARGV[0];
|
---|
61 |
|
---|
62 | %parampos = (
|
---|
63 | "get_tst" => 2,
|
---|
64 | "get_pri" => 2,
|
---|
65 | "get_inf" => 1,
|
---|
66 | "ref_tsk" => 2,
|
---|
67 | "ref_sem" => 2,
|
---|
68 | "ref_flg" => 2,
|
---|
69 | "ref_dtq" => 2,
|
---|
70 | "ref_pdq" => 2,
|
---|
71 | "ref_mtx" => 2,
|
---|
72 | "ref_mbf" => 2,
|
---|
73 | "ref_mpf" => 2,
|
---|
74 | "get_tim" => 1,
|
---|
75 | "ref_cyc" => 2,
|
---|
76 | "ref_alm" => 2,
|
---|
77 | "ref_ovr" => 2,
|
---|
78 | "get_tid" => 1,
|
---|
79 | "iget_tid" => 1,
|
---|
80 | "get_lod" => 2,
|
---|
81 | "get_nth" => 3,
|
---|
82 | "get_ipm" => 1,
|
---|
83 | "wai_flg" => 4,
|
---|
84 | "pol_flg" => 4,
|
---|
85 | "twai_flg" => 4,
|
---|
86 | "rcv_dtq" => 2,
|
---|
87 | "prcv_dtq" => 2,
|
---|
88 | "trcv_dtq" => 2,
|
---|
89 | );
|
---|
90 |
|
---|
91 | %paramtype = (
|
---|
92 | "get_tst" => "STAT",
|
---|
93 | "get_pri" => "PRI",
|
---|
94 | "get_inf" => "intptr_t",
|
---|
95 | "ref_tsk" => "T_RTSK",
|
---|
96 | "ref_sem" => "T_RSEM",
|
---|
97 | "ref_flg" => "T_RFLG",
|
---|
98 | "ref_dtq" => "T_RDTQ",
|
---|
99 | "ref_pdq" => "T_RPDQ",
|
---|
100 | "ref_mtx" => "T_RMTX",
|
---|
101 | "ref_mbf" => "T_RMBF",
|
---|
102 | "ref_mpf" => "T_RMPF",
|
---|
103 | "get_tim" => "SYSTIM",
|
---|
104 | "ref_cyc" => "T_RCYC",
|
---|
105 | "ref_alm" => "T_RALM",
|
---|
106 | "ref_ovr" => "T_ROVR",
|
---|
107 | "get_tid" => "ID",
|
---|
108 | "iget_tid" => "ID",
|
---|
109 | "get_lod" => "uint_t",
|
---|
110 | "get_nth" => "ID",
|
---|
111 | "get_ipm" => "PRI",
|
---|
112 | "wai_flg" => "FLGPTN",
|
---|
113 | "pol_flg" => "FLGPTN",
|
---|
114 | "twai_flg" => "FLGPTN",
|
---|
115 | "rcv_dtq" => "intptr_t",
|
---|
116 | "prcv_dtq" => "intptr_t",
|
---|
117 | "trcv_dtq" => "intptr_t",
|
---|
118 | );
|
---|
119 |
|
---|
120 | %funcparams = (
|
---|
121 | "target_hrt_set_event" => "HRTCNT hrtcnt",
|
---|
122 | );
|
---|
123 |
|
---|
124 | %funcvalue = (
|
---|
125 | "target_hrt_get_current" => "HRTCNT",
|
---|
126 | );
|
---|
127 |
|
---|
128 | %funcreturn = (
|
---|
129 | "target_hrt_get_current" => "0U",
|
---|
130 | );
|
---|
131 |
|
---|
132 | %funccheckparam = (
|
---|
133 | "target_hrt_set_event" => "hrtcnt",
|
---|
134 | );
|
---|
135 |
|
---|
136 | $last_check_point = 0;
|
---|
137 |
|
---|
138 | sub gen_var_def {
|
---|
139 | local($svc_call) = @_;
|
---|
140 | local($svcname, @params);
|
---|
141 | local($typename, $varname);
|
---|
142 |
|
---|
143 | if ($svc_call =~ /^([a-z_]+)\((.*)\)$/) {
|
---|
144 | $svcname = $1;
|
---|
145 | @params = split(/\s*,\s*/, $2);
|
---|
146 |
|
---|
147 | if ($parampos{$svcname}) {
|
---|
148 | $varname = $params[@parampos{$svcname} - 1];
|
---|
149 | $varname =~ s/^\&//;
|
---|
150 | $typename = $paramtype{$svcname};
|
---|
151 | ${$TASKVAR{$tskid}}{$typename} = ${varname};
|
---|
152 | }
|
---|
153 | }
|
---|
154 | }
|
---|
155 |
|
---|
156 | sub gen_svc_call {
|
---|
157 | local($svc_call, $error_code_string) = @_;
|
---|
158 | local($error_code);
|
---|
159 |
|
---|
160 | ${$TASKVAR{$tskid}}{"ER_UINT"} = "ercd";
|
---|
161 |
|
---|
162 | push(@{$TASKCODE{$tskid}{$tskcnt}}, sprintf("\tercd = %s;", $svc_call));
|
---|
163 | gen_var_def($svc_call);
|
---|
164 |
|
---|
165 | if ($error_code_string eq "") {
|
---|
166 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
167 | sprintf("\tcheck_ercd(ercd, E_OK);"), "");
|
---|
168 | }
|
---|
169 | elsif ($error_code_string =~ /^\-\>\s*noreturn$/) {
|
---|
170 | push(@{$TASKCODE{$tskid}{$tskcnt}}, "");
|
---|
171 | }
|
---|
172 | else {
|
---|
173 | $error_code = $error_code_string;
|
---|
174 | $error_code =~ s/^\-\>\s*([A-Za-z0-9_]*)$/$1/;
|
---|
175 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
176 | sprintf("\tcheck_ercd(ercd, %s);", $error_code), "");
|
---|
177 | }
|
---|
178 | }
|
---|
179 |
|
---|
180 | sub init_taskcountvar {
|
---|
181 | if (!$TASKCOUNTVAR{$tskid}) {
|
---|
182 | if ($tskid =~ /^TASK([0-9]*)$/) {
|
---|
183 | $countvar = "task$1_count";
|
---|
184 | }
|
---|
185 | elsif ($tskid =~ /^CYC([0-9]*)$/) {
|
---|
186 | $countvar = "cyclic$1_count";
|
---|
187 | }
|
---|
188 | elsif ($tskid =~ /^ALM([0-9]*)$/) {
|
---|
189 | $countvar = "alarm$1_count";
|
---|
190 | }
|
---|
191 | elsif ($tskid =~ /^OVR$/) {
|
---|
192 | $countvar = "overrun_count";
|
---|
193 | }
|
---|
194 | elsif ($tskid =~ /^CPUEXC([0-9]*)$/) {
|
---|
195 | $countvar = "cpuexc$1_count";
|
---|
196 | }
|
---|
197 | elsif ($tskid =~ /^EXTSVC([0-9]*)$/) {
|
---|
198 | $countvar = "extsvc$1_count";
|
---|
199 | }
|
---|
200 | else {
|
---|
201 | $countvar = $tskid."_count";
|
---|
202 | }
|
---|
203 | $TASKCOUNTVAR{$tskid} = $countvar;
|
---|
204 | $TASKCOUNT{$tskid} = 1;
|
---|
205 | }
|
---|
206 | }
|
---|
207 |
|
---|
208 | sub test_start_code {
|
---|
209 | if ($startflag) {
|
---|
210 | push(@{$TASKCODE{$tskid}{$tskcnt}}, "\ttest_start(__FILE__);");
|
---|
211 | push(@{$TASKCODE{$tskid}{$tskcnt}}, "");
|
---|
212 | $startflag = 0;
|
---|
213 | }
|
---|
214 | }
|
---|
215 |
|
---|
216 | sub target_func {
|
---|
217 | local($line) = @_;
|
---|
218 | local($tskid, $tskcnt, $retval, $param);
|
---|
219 |
|
---|
220 | if ($line =~ /^([a-zA-Z_]+)\s*(.*)$/) {
|
---|
221 | $tskid = $1;
|
---|
222 | $line = $2;
|
---|
223 | }
|
---|
224 | if ($line =~ /\-\>\s*([^\s]+)\s*(.*)$/) {
|
---|
225 | $retval = $1;
|
---|
226 | $line = $2;
|
---|
227 | }
|
---|
228 | if ($line =~ /\<\-\s*([^\s]+)\s*(.*)$/) {
|
---|
229 | $param = $1;
|
---|
230 | $line = $2;
|
---|
231 | }
|
---|
232 | init_taskcountvar();
|
---|
233 | $tskcnt = $TASKCOUNT{$tskid};
|
---|
234 | test_start_code();
|
---|
235 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
236 | sprintf("\tcheck_point(%d);", $check_no));
|
---|
237 | if ($param && $funccheckparam{$tskid}) {
|
---|
238 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
239 | sprintf("\tcheck_assert(%s == %s);",
|
---|
240 | $funccheckparam{$tskid}, $param), "");
|
---|
241 | }
|
---|
242 | if ($retval) {
|
---|
243 | push(@{$TASKCODE{$tskid}{$tskcnt}}, "\treturn(".$retval.");", "");
|
---|
244 | }
|
---|
245 | else {
|
---|
246 | push(@{$TASKCODE{$tskid}{$tskcnt}}, "\treturn;", "");
|
---|
247 | }
|
---|
248 | $TASKCOUNT{$tskid} = $TASKCOUNT{$tskid} + 1
|
---|
249 | }
|
---|
250 |
|
---|
251 | sub parse_line {
|
---|
252 | local($line) = @_;
|
---|
253 |
|
---|
254 | if ($line =~ /^==\s*(([a-zA-Z_]+)[0-9]*)(.*)$/) {
|
---|
255 | $procflag = 1;
|
---|
256 | $tskid = $1;
|
---|
257 | $line2 = $3;
|
---|
258 | if ($line2 =~ /^\-([0-9]+)(.*)$/) {
|
---|
259 | $tskcnt = $1;
|
---|
260 | init_taskcountvar();
|
---|
261 | $TASKCOUNT{$tskid} = $tskcnt;
|
---|
262 | }
|
---|
263 | elsif ($line2 =~ /^\-[nN](.*)$/) {
|
---|
264 | init_taskcountvar();
|
---|
265 | $tskcnt = $TASKCOUNT{$tskid};
|
---|
266 | }
|
---|
267 | else {
|
---|
268 | $tskcnt = "";
|
---|
269 | }
|
---|
270 | if ($tskid !~ /^START/) {
|
---|
271 | test_start_code();
|
---|
272 | }
|
---|
273 | }
|
---|
274 | elsif (!$procflag) {
|
---|
275 | # do nothing.
|
---|
276 | }
|
---|
277 | elsif ($line =~ /^([0-9]+\:)\s*END$/) {
|
---|
278 | $check_str = $1;
|
---|
279 | $check_no = ++$last_check_point;
|
---|
280 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
281 | sprintf("\tcheck_finish(%d);", $check_no));
|
---|
282 | $procflag = 0;
|
---|
283 | $output_line =~ s/$check_str/$check_no:/;
|
---|
284 | }
|
---|
285 | else {
|
---|
286 | if ($line =~ /^([0-9]+\:)\s*(.*)$/) {
|
---|
287 | $check_str = $1;
|
---|
288 | $line = $2;
|
---|
289 | $check_no = ++$last_check_point;
|
---|
290 | $output_line =~ s/$check_str/$check_no:/;
|
---|
291 | if ($line =~ /^HOOK\((.*)\)$/) {
|
---|
292 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
293 | sprintf("\t".$1.";", $check_no));
|
---|
294 | return;
|
---|
295 | }
|
---|
296 | elsif ($line =~ /^\[(.*)\]$/) {
|
---|
297 | target_func($1);
|
---|
298 | return;
|
---|
299 | }
|
---|
300 | else {
|
---|
301 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
302 | sprintf("\tcheck_point(%d);", $check_no));
|
---|
303 | }
|
---|
304 | }
|
---|
305 | if ($line =~ /^(assert\(.*\))$/) {
|
---|
306 | $assert_string = $1;
|
---|
307 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
308 | sprintf("\tcheck_%s;", $assert_string), "");
|
---|
309 | }
|
---|
310 | elsif ($line =~ /^((state|ipm)\(.*\))$/) {
|
---|
311 | $state_string = $1;
|
---|
312 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
313 | sprintf("\tcheck_%s;", $state_string), "");
|
---|
314 | }
|
---|
315 | elsif ($line =~ /^call\((.*)\)$/ || $line =~ /^DO\((.*)\)$/) {
|
---|
316 | $call_string = $1;
|
---|
317 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
318 | sprintf("\t%s;", $call_string), "");
|
---|
319 | if ($call_string =~ /^SIL_..._INT\(\)$/) {
|
---|
320 | $TASKSILLOC{$tskid} = 1;
|
---|
321 | }
|
---|
322 | }
|
---|
323 | elsif ($line =~ /^RETURN((\(.*\))?)$/) {
|
---|
324 | $return_string = $1;
|
---|
325 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
326 | "\treturn".$return_string.";", "");
|
---|
327 | $TASKCOUNT{$tskid} = $TASKCOUNT{$tskid} + 1
|
---|
328 | }
|
---|
329 | elsif ($line =~ /^GOTO\((.*)\)$/) {
|
---|
330 | $goto_string = $1;
|
---|
331 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
332 | sprintf("\tgoto %s;", $goto_string), "");
|
---|
333 | }
|
---|
334 | elsif ($line =~ /^LABEL\((.*)\)$/) {
|
---|
335 | $label_string = $1;
|
---|
336 | $indent_string = $indentstr;
|
---|
337 | $indent_string =~ s/\t$//;
|
---|
338 | push(@{$TASKCODE{$tskid}{$tskcnt}},
|
---|
339 | sprintf("%s:", $label_string));
|
---|
340 | }
|
---|
341 | elsif ($line =~ /^([a-z_]+\(.*\))\s*(\-\>\s*[A-Za-z0-9_]*)?\s*$/) {
|
---|
342 | $svc_call = $1;
|
---|
343 | $error_code_string = $2;
|
---|
344 | gen_svc_call($svc_call, $error_code_string);
|
---|
345 | }
|
---|
346 | else {
|
---|
347 | print STDERR "Error: ",$line,"\n";
|
---|
348 | }
|
---|
349 | }
|
---|
350 | }
|
---|
351 |
|
---|
352 | #
|
---|
353 | # ã¹ã¯ãªãããã¡ã¤ã«èªè¾¼ã¿å¦ç
|
---|
354 | #
|
---|
355 | $procflag = 0;
|
---|
356 | $startflag = 1;
|
---|
357 | $outflag = 1;
|
---|
358 | open(INFILE, $infile) || die "Cannot open $infile";
|
---|
359 | while (($line = <INFILE>) && $outflag) {
|
---|
360 | $output_line = $line;
|
---|
361 | chomp $line;
|
---|
362 | $line =~ s/^\s*\*\s*//;
|
---|
363 | $line =~ s/\s*\/\/.*$//;
|
---|
364 | $line =~ s/\s*\.\.\..*$//;
|
---|
365 | while ($line =~ s/\\$//) {
|
---|
366 | $line1 = <INFILE>;
|
---|
367 | $output_line .= $line1;
|
---|
368 | chomp $line1;
|
---|
369 | $line1 =~ s/^\s*\*\s*//;
|
---|
370 | $line1 =~ s/\s*\/\/.*$//;
|
---|
371 | $line1 =~ s/\s*\.\.\..*$//;
|
---|
372 | $line .= $line1;
|
---|
373 | }
|
---|
374 | if ($line) {
|
---|
375 | parse_line($line);
|
---|
376 | }
|
---|
377 | print $output_line;
|
---|
378 | if ($output_line =~ /DO NOT DELETE THIS LINE/) {
|
---|
379 | $outflag = 0;
|
---|
380 | }
|
---|
381 | }
|
---|
382 | close(INFILE);
|
---|
383 |
|
---|
384 | #
|
---|
385 | # ã¿ã¹ã¯ã®å¤æ°å®ç¾©ã®ã³ã¼ãåºå
|
---|
386 | #
|
---|
387 | sub output_task_vardef {
|
---|
388 | my($tskid) = @_;
|
---|
389 |
|
---|
390 | foreach my $typename (keys(%{$TASKVAR{$tskid}})) {
|
---|
391 | print "\t",$typename, (length($typename) < 4 ? "\t\t" : "\t"),
|
---|
392 | ${$TASKVAR{$tskid}}{$typename},";\n";
|
---|
393 | }
|
---|
394 | if ($TASKSILLOC{$tskid}) {
|
---|
395 | print "\tSIL_PRE_LOC;\n";
|
---|
396 | }
|
---|
397 | }
|
---|
398 |
|
---|
399 | #
|
---|
400 | # ã¿ã¹ã¯æ¬ä½ã®ã³ã¼ãåºå
|
---|
401 | #
|
---|
402 | sub output_task_body {
|
---|
403 | my($tskid) = @_;
|
---|
404 |
|
---|
405 | foreach my $tskcnt (sort {$a <=> $b} (keys(%{$TASKCODE{$tskid}}))) {
|
---|
406 | printf "\tcase %d:\n", $tskcnt;
|
---|
407 | foreach my $line (@{$TASKCODE{$tskid}{$tskcnt}}) {
|
---|
408 | print "\t",$line if ($line);
|
---|
409 | print "\n";
|
---|
410 | }
|
---|
411 | printf "\t\tcheck_point(0);\n\n";
|
---|
412 | }
|
---|
413 | }
|
---|
414 |
|
---|
415 | #
|
---|
416 | # ã¿ã¹ã¯ã³ã¼ãã®åºå
|
---|
417 | #
|
---|
418 | sub output_task {
|
---|
419 | if ($TASKCOUNTVAR{$tskid}) {
|
---|
420 | printf "\nstatic uint_t\t%s = 0;\n", $TASKCOUNTVAR{$tskid};
|
---|
421 | }
|
---|
422 | if ($tskid =~ /^TASK([0-9]*)$/) {
|
---|
423 | print "\nvoid\n";
|
---|
424 | print "task$1(intptr_t exinf)\n";
|
---|
425 | }
|
---|
426 | elsif ($tskid =~ /^CYC([0-9]*)$/) {
|
---|
427 | print "\nvoid\n";
|
---|
428 | print "cyclic$1_handler(intptr_t exinf)\n";
|
---|
429 | }
|
---|
430 | elsif ($tskid =~ /^ALM([0-9]*)$/) {
|
---|
431 | print "\nvoid\n";
|
---|
432 | print "alarm$1_handler(intptr_t exinf)\n";
|
---|
433 | }
|
---|
434 | elsif ($tskid =~ /^OVR$/) {
|
---|
435 | print "\nvoid\n";
|
---|
436 | print "overrun_handler(ID tskid, intptr_t exinf)\n";
|
---|
437 | }
|
---|
438 | elsif ($tskid =~ /^CPUEXC([0-9]*)$/) {
|
---|
439 | print "\nvoid\n";
|
---|
440 | print "cpuexc$1_handler(void *p_excinf)\n";
|
---|
441 | }
|
---|
442 | elsif ($tskid =~ /^EXTSVC([0-9]*)$/) {
|
---|
443 | print "\nER_UINT\n";
|
---|
444 | print "extsvc$1_routine(intptr_t par1, intptr_t par2, intptr_t par3,\n";
|
---|
445 | print "\t\t\t\t\t\t\t\tintptr_t par4, intptr_t par5, ID cdmid)\n";
|
---|
446 | }
|
---|
447 | else {
|
---|
448 | if ($funcvalue{$tskid}) {
|
---|
449 | print "\n",$funcvalue{$tskid},"\n";
|
---|
450 | }
|
---|
451 | else {
|
---|
452 | print "\nvoid\n";
|
---|
453 | }
|
---|
454 | print $tskid;
|
---|
455 | if ($funcparams{$tskid}) {
|
---|
456 | print "(",$funcparams{$tskid},")\n";
|
---|
457 | }
|
---|
458 | else {
|
---|
459 | print "(void)\n";
|
---|
460 | }
|
---|
461 | }
|
---|
462 | print "{\n";
|
---|
463 | output_task_vardef($tskid);
|
---|
464 | print "\n";
|
---|
465 | if ($TASKCOUNTVAR{$tskid}) {
|
---|
466 | printf "\tswitch (++%s) {\n", $TASKCOUNTVAR{$tskid};
|
---|
467 | output_task_body($tskid);
|
---|
468 | printf "\tdefault:\n";
|
---|
469 | printf "\t\tcheck_point(0);\n";
|
---|
470 | printf "\t}\n";
|
---|
471 | }
|
---|
472 | else {
|
---|
473 | foreach my $line (@{$TASKCODE{$tskid}{""}}) {
|
---|
474 | print $line,"\n";
|
---|
475 | }
|
---|
476 | }
|
---|
477 | print "\tcheck_point(0);\n";
|
---|
478 | if ($tskid =~ /^EXTSVC([0-9]*)$/) {
|
---|
479 | print "\treturn(E_SYS);\n";
|
---|
480 | }
|
---|
481 | else {
|
---|
482 | if ($funcreturn{$tskid}) {
|
---|
483 | print "\treturn(",$funcreturn{$tskid},");\n";
|
---|
484 | }
|
---|
485 | }
|
---|
486 | print "}\n";
|
---|
487 | }
|
---|
488 |
|
---|
489 | #
|
---|
490 | # ãã¹ãããã°ã©ã åºåå¦ç
|
---|
491 | #
|
---|
492 | foreach $tskid (sort(keys(%TASKCODE))) {
|
---|
493 | output_task();
|
---|
494 | }
|
---|