source: UsbWattMeter/trunk/asp_dcre/kernel/kernel.tf@ 164

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

TOPPERS/ECNLサンプルアプリ「USB充電器電力計」を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/plain
File size: 44.8 KB
Line 
1$ ======================================================================
2$
3$ TOPPERS/ASP Kernel
4$ Toyohashi Open Platform for Embedded Real-Time Systems/
5$ Advanced Standard Profile Kernel
6$
7$ Copyright (C) 2007 by TAKAGI Nobuhisa
8$ Copyright (C) 2007-2014 by Embedded and Real-Time Systems Laboratory
9$ Graduate School of Information Science, Nagoya Univ., JAPAN
10$
11$ ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì(1)`(4)‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
12$ ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
13$ •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
14$ (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
15$ Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
16$ ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
17$ (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
18$ —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
19ƒƒ“ƒgi—˜—p
20$ ŽÒƒ}ƒjƒ…
21ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
22$ ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
23$ (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
24$ —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
25$ ‚ƁD
26$ (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
27ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
28ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
29$ ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
30$ (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
31$ •ñ‚·‚邱‚ƁD
32$ (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
33$ ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
34$ ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
35$ —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
36$ –Ɛӂ·‚邱‚ƁD
37$
38$ –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
39$ ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
40$ ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
41$ ƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»
42$ ‚̐ӔC‚𕉂í‚È‚¢D
43$
44$ $Id: kernel.tf 164 2016-03-07 11:33:50Z coas-nagasima $
45$
46$ =====================================================================
47
48$ =====================================================================
49$ AID_YYY‚̏ˆ—
50$ =====================================================================
51
52$num_atskid = 0$
53$FOREACH i ATSK.ORDER_LIST$
54$ // notsk‚ª•‰‚̏ꍇiE_PARj
55 $IF ATSK.NOTSK[i] < 0$
56 $ERROR ATSK.TEXT_LINE[i]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "notsk", ATSK.NOTSK[i], "AID_TSK")$$END$
57 $END$
58 $num_atskid = num_atskid + ATSK.NOTSK[i]$
59$END$
60$num_tskid = LENGTH(TSK.ID_LIST) + num_atskid$
61
62$num_asemid = 0$
63$FOREACH i ASEM.ORDER_LIST$
64$ // nosem‚ª•‰‚̏ꍇiE_PARj
65 $IF ASEM.NOSEM[i] < 0$
66 $ERROR ASEM.TEXT_LINE[i]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "nosem", ASEM.NOSEM[i], "AID_SEM")$$END$
67 $END$
68 $num_asemid = num_asemid + ASEM.NOSEM[i]$
69$END$
70$num_semid = LENGTH(SEM.ID_LIST) + num_asemid$
71
72$num_aflgid = 0$
73$FOREACH i AFLG.ORDER_LIST$
74$ // noflg‚ª•‰‚̏ꍇiE_PARj
75 $IF AFLG.NOFLG[i] < 0$
76 $ERROR AFLG.TEXT_LINE[i]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "noflg", AFLG.NOFLG[i], "AID_FLG")$$END$
77 $END$
78 $num_aflgid = num_aflgid + AFLG.NOFLG[i]$
79$END$
80$num_flgid = LENGTH(FLG.ID_LIST) + num_aflgid$
81
82$num_adtqid = 0$
83$FOREACH i ADTQ.ORDER_LIST$
84$ // nodtq‚ª•‰‚̏ꍇiE_PARj
85 $IF ADTQ.NODTQ[i] < 0$
86 $ERROR ADTQ.TEXT_LINE[i]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "nodtq", ADTQ.NODTQ[i], "AID_DTQ")$$END$
87 $END$
88 $num_adtqid = num_adtqid + ADTQ.NODTQ[i]$
89$END$
90$num_dtqid = LENGTH(DTQ.ID_LIST) + num_adtqid$
91
92$num_apdqid = 0$
93$FOREACH i APDQ.ORDER_LIST$
94$ // nopdq‚ª•‰‚̏ꍇiE_PARj
95 $IF APDQ.NOPDQ[i] < 0$
96 $ERROR APDQ.TEXT_LINE[i]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "nopdq", APDQ.NOPDQ[i], "AID_PDQ")$$END$
97 $END$
98 $num_apdqid = num_apdqid + APDQ.NOPDQ[i]$
99$END$
100$num_pdqid = LENGTH(PDQ.ID_LIST) + num_apdqid$
101
102$num_ambxid = 0$
103$FOREACH i AMBX.ORDER_LIST$
104$ // nombx‚ª•‰‚̏ꍇiE_PARj
105 $IF AMBX.NOMBX[i] < 0$
106 $ERROR AMBX.TEXT_LINE[i]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "nombx", AMBX.NOMBX[i], "AID_MBX")$$END$
107 $END$
108 $num_ambxid = num_ambxid + AMBX.NOMBX[i]$
109$END$
110$num_mbxid = LENGTH(MBX.ID_LIST) + num_ambxid$
111
112$num_ampfid = 0$
113$FOREACH i AMPF.ORDER_LIST$
114$ // nompf‚ª•‰‚̏ꍇiE_PARj
115 $IF AMPF.NOMPF[i] < 0$
116 $ERROR AMPF.TEXT_LINE[i]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "nompf", AMPF.NOMPF[i], "AID_MPF")$$END$
117 $END$
118 $num_ampfid = num_ampfid + AMPF.NOMPF[i]$
119$END$
120$num_mpfid = LENGTH(MPF.ID_LIST) + num_ampfid$
121
122$num_acycid = 0$
123$FOREACH i ACYC.ORDER_LIST$
124$ // nocyc‚ª•‰‚̏ꍇiE_PARj
125 $IF ACYC.NOCYC[i] < 0$
126 $ERROR ACYC.TEXT_LINE[i]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "nocyc", ACYC.NOCYC[i], "AID_CYC")$$END$
127 $END$
128 $num_acycid = num_acycid + ACYC.NOCYC[i]$
129$END$
130$num_cycid = LENGTH(CYC.ID_LIST) + num_acycid$
131
132$num_aalmid = 0$
133$FOREACH i AALM.ORDER_LIST$
134$ // noalm‚ª•‰‚̏ꍇiE_PARj
135 $IF AALM.NOALM[i] < 0$
136 $ERROR AALM.TEXT_LINE[i]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "noalm", AALM.NOALM[i], "AID_ALM")$$END$
137 $END$
138 $num_aalmid = num_aalmid + AALM.NOALM[i]$
139$END$
140$num_almid = LENGTH(ALM.ID_LIST) + num_aalmid$
141
142$num_aisrid = 0$
143$FOREACH i AISR.ORDER_LIST$
144$ // noisr‚ª•‰‚̏ꍇiE_PARj
145 $IF AISR.NOISR[i] < 0$
146 $ERROR AISR.TEXT_LINE[i]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "noisr", AISR.NOISR[i], "AID_ISR")$$END$
147 $END$
148 $num_aisrid = num_aisrid + AISR.NOISR[i]$
149$END$
150$num_isrid = num_aisrid$
151$num_isr = LENGTH(ISR.ORDER_LIST) + num_aisrid$
152
153$ =====================================================================
154$ kernel_cfg.h‚̐¶¬
155$ =====================================================================
156
157$FILE "kernel_cfg.h"$
158/* kernel_cfg.h */$NL$
159#ifndef TOPPERS_KERNEL_CFG_H$NL$
160#define TOPPERS_KERNEL_CFG_H$NL$
161$NL$
162#define TNUM_TSKID $num_tskid$$NL$
163#define TNUM_SEMID $num_semid$$NL$
164#define TNUM_FLGID $num_flgid$$NL$
165#define TNUM_DTQID $num_dtqid$$NL$
166#define TNUM_PDQID $num_pdqid$$NL$
167#define TNUM_MBXID $num_mbxid$$NL$
168#define TNUM_MPFID $num_mpfid$$NL$
169#define TNUM_CYCID $num_cycid$$NL$
170#define TNUM_ALMID $num_almid$$NL$
171#define TNUM_ISRID $num_isrid$$NL$
172$NL$
173$FOREACH id TSK.ID_LIST$
174 #define $id$ $+id$$NL$
175$END$
176$FOREACH id SEM.ID_LIST$
177 #define $id$ $+id$$NL$
178$END$
179$FOREACH id FLG.ID_LIST$
180 #define $id$ $+id$$NL$
181$END$
182$FOREACH id DTQ.ID_LIST$
183 #define $id$ $+id$$NL$
184$END$
185$FOREACH id PDQ.ID_LIST$
186 #define $id$ $+id$$NL$
187$END$
188$FOREACH id MBX.ID_LIST$
189 #define $id$ $+id$$NL$
190$END$
191$FOREACH id MPF.ID_LIST$
192 #define $id$ $+id$$NL$
193$END$
194$FOREACH id CYC.ID_LIST$
195 #define $id$ $+id$$NL$
196$END$
197$FOREACH id ALM.ID_LIST$
198 #define $id$ $+id$$NL$
199$END$
200$NL$
201#endif /* TOPPERS_KERNEL_CFG_H */$NL$
202
203$ =====================================================================
204$ kernel_cfg.c‚̐¶¬
205$ =====================================================================
206
207$FILE "kernel_cfg.c"$
208/* kernel_cfg.c */$NL$
209#include "kernel/kernel_int.h"$NL$
210#include "kernel_cfg.h"$NL$
211$NL$
212#if TKERNEL_PRID != 0x07u$NL$
213#error The kernel does not match this configuration file.$NL$
214#endif$NL$
215$NL$
216
217$
218$ ƒCƒ“ƒNƒ‹[ƒhƒfƒBƒŒƒNƒeƒBƒui#includej
219$
220/*$NL$
221$SPC$* Include Directives (#include)$NL$
222$SPC$*/$NL$
223$NL$
224$INCLUDES$
225$NL$
226
227$
228$ ƒIƒuƒWƒFƒNƒg‚ÌID”ԍ†‚ð•ÛŽ‚·‚é•Ï”
229$
230$IF USE_EXTERNAL_ID$
231 /*$NL$
232 $SPC$* Variables for Object ID$NL$
233 $SPC$*/$NL$
234 $NL$
235 $FOREACH id TSK.ID_LIST$
236 const ID $id$_id$SPC$=$SPC$$+id$;$NL$
237 $END$
238 $FOREACH id SEM.ID_LIST$
239 const ID $id$_id$SPC$=$SPC$$+id$;$NL$
240 $END$
241 $FOREACH id FLG.ID_LIST$
242 const ID $id$_id$SPC$=$SPC$$+id$;$NL$
243 $END$
244 $FOREACH id DTQ.ID_LIST$
245 const ID $id$_id$SPC$=$SPC$$+id$;$NL$
246 $END$
247 $FOREACH id PDQ.ID_LIST$
248 const ID $id$_id$SPC$=$SPC$$+id$;$NL$
249 $END$
250 $FOREACH id MBX.ID_LIST$
251 const ID $id$_id$SPC$=$SPC$$+id$;$NL$
252 $END$
253 $FOREACH id MPF.ID_LIST$
254 const ID $id$_id$SPC$=$SPC$$+id$;$NL$
255 $END$
256 $FOREACH id CYC.ID_LIST$
257 const ID $id$_id$SPC$=$SPC$$+id$;$NL$
258 $END$
259 $FOREACH id ALM.ID_LIST$
260 const ID $id$_id$SPC$=$SPC$$+id$;$NL$
261 $END$
262$END$
263
264$
265$ ƒ^ƒXƒN
266$
267/*$NL$
268$SPC$* Task Management Functions$NL$
269$SPC$*/$NL$
270$NL$
271
272$ Ã“I‚ɐ¶¬‚³‚ꂽƒ^ƒXƒN‚ª1ŒÂˆÈã‘¶Ý‚·‚邱‚Ƃ̃`ƒFƒbƒN
273$IF !LENGTH(TSK.ID_LIST)$
274 $ERROR$$FORMAT(_("no task is registered"))$$END$
275$END$
276
277$ Ã“I‚ɐ¶¬‚³‚ꂽƒ^ƒXƒN‚̐”
278#define TNUM_STSKID $LENGTH(TSK.ID_LIST)$$NL$
279$NL$
280
281$ ƒ^ƒXƒNID”ԍ†‚̍őå’l
282const ID _kernel_tmax_tskid = (TMIN_TSKID + TNUM_TSKID - 1);$NL$
283const ID _kernel_tmax_stskid = (TMIN_TSKID + TNUM_STSKID - 1);$NL$
284$NL$
285
286$ ƒGƒ‰[ƒ`ƒFƒbƒN
287$FOREACH tskid TSK.ID_LIST$
288$ // tskatr‚ªimTA_ACTnj‚Å‚È‚¢ê‡iE_RSATRj
289 $IF (TSK.TSKATR[tskid] & ~(TA_ACT|TARGET_TSKATR)) != 0$
290 $ERROR TSK.TEXT_LINE[tskid]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "tskatr", TSK.TSKATR[tskid], tskid, "CRE_TSK")$$END$
291 $END$
292
293$ // (TMIN_TPRI <= itskpri && itskpri <= TMAX_TPRI)‚Å‚È‚¢ê‡iE_PARj
294 $IF !(TMIN_TPRI <= TSK.ITSKPRI[tskid] && TSK.ITSKPRI[tskid] <= TMAX_TPRI)$
295 $ERROR TSK.TEXT_LINE[tskid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "itskpri", TSK.ITSKPRI[tskid], tskid, "CRE_TSK")$$END$
296 $END$
297
298$ // texatr‚ªiTA_NULLj‚Å‚È‚¢ê‡iE_RSATRj
299 $IF LENGTH(TSK.TEXATR[tskid]) && TSK.TEXATR[tskid] != 0$
300 $ERROR DEF_TEX.TEXT_LINE[tskid]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "texatr", TSK.TEXATR[tskid], tskid, "DEF_TEX")$$END$
301 $END$
302$END$
303
304$ ƒXƒ^ƒbƒN—̈æ‚̐¶¬‚Æ‚»‚ê‚ÉŠÖ‚·‚éƒGƒ‰[ƒ`ƒFƒbƒN
305$FOREACH tskid TSK.ID_LIST$
306$ // stksz‚ª0ˆÈ‰º‚©Cƒ^[ƒQƒbƒg’è‹`‚̍ŏ¬’liTARGET_MIN_STKSZj‚æ‚è‚à
307$ // ¬‚³‚¢ê‡iE_PARj
308 $IF TSK.STKSZ[tskid] <= 0 || (TARGET_MIN_STKSZ
309 && TSK.STKSZ[tskid] < TARGET_MIN_STKSZ)$
310 $ERROR TSK.TEXT_LINE[tskid]$E_PAR: $FORMAT(_("%1% `%2%\' of `%3%\' in %4% is too small"), "stksz", TSK.STKSZ[tskid], tskid, "CRE_TSK")$$END$
311 $END$
312
313$ // stksz‚ªƒXƒ^ƒbƒN—̈æ‚̃TƒCƒY‚Æ‚µ‚Đ³‚µ‚­‚È‚¢ê‡iE_PARj
314 $IF !EQ(TSK.STK[tskid], "NULL") && CHECK_STKSZ_ALIGN
315 && (TSK.STKSZ[tskid] & (CHECK_STKSZ_ALIGN - 1))$
316 $ERROR TSK.TEXT_LINE[tskid]$E_PAR: $FORMAT(_("%1% `%2%\' of `%3%\' in %4% is not aligned"), "stksz", TSK.STKSZ[tskid], tskid, "CRE_TSK")$$END$
317 $END$
318
319 $IF EQ(TSK.STK[tskid],"NULL")$
320 static STK_T _kernel_stack_$tskid$[COUNT_STK_T($TSK.STKSZ[tskid]$)];$NL$
321 $TSK.TINIB_STKSZ[tskid] = FORMAT("ROUND_STK_T(%1%)", TSK.STKSZ[tskid])$
322 $TSK.TINIB_STK[tskid] = CONCAT("_kernel_stack_", tskid)$
323 $ELSE$
324 $TSK.TINIB_STKSZ[tskid] = TSK.STKSZ[tskid]$
325 $TSK.TINIB_STK[tskid] = FORMAT("(void *)(%1%)", TSK.STK[tskid])$
326 $END$
327$END$
328$NL$
329
330$ ƒ^ƒXƒN‰Šú‰»ƒuƒƒbƒN‚̐¶¬iƒ^ƒXƒN‚Í1ŒÂˆÈã‘¶Ý‚·‚éj
331const TINIB _kernel_tinib_table[TNUM_STSKID] = {$NL$
332$JOINEACH tskid TSK.ID_LIST ",\n"$
333$ // ƒ^ƒXƒN‘®«CŠg’£î•ñC‹N“®”Ô’nC‹N“®Žž—Dæ“x
334 $TAB${
335 $SPC$($TSK.TSKATR[tskid]$), (intptr_t)($TSK.EXINF[tskid]$),
336 $SPC$((TASK)($TSK.TASK[tskid]$)), INT_PRIORITY($TSK.ITSKPRI[tskid]$),
337
338$ // ƒ^ƒXƒN‰Šú‰»ƒRƒ“ƒeƒLƒXƒgƒuƒƒbƒNCƒXƒ^ƒbƒN—̈æ
339 $IF USE_TSKINICTXB$
340 $GENERATE_TSKINICTXB(tskid)$
341 $ELSE$
342 $SPC$$TSK.TINIB_STKSZ[tskid]$, $TSK.TINIB_STK[tskid]$,
343 $END$
344
345$ // ƒ^ƒXƒN—áŠOˆ—ƒ‹[ƒ`ƒ“‚Ì‘®«‚Æ‹N“®”Ô’n
346 $SPC$($ALT(TSK.TEXATR[tskid],"TA_NULL")$), ($ALT(TSK.TEXRTN[tskid],"NULL")$) }
347$END$$NL$
348};$NL$
349$NL$
350
351$ “®“I¶¬ƒ^ƒXƒN—p‚̃^ƒXƒN‰Šú‰»ƒuƒƒbƒN‚̐¶¬
352$IF num_atskid > 0$
353 TINIB _kernel_atinib_table[$num_atskid$];$NL$
354$ELSE$
355 TOPPERS_EMPTY_LABEL(TINIB, _kernel_atinib_table);$NL$
356$END$$NL$
357
358$ ƒ^ƒXƒNŠÇ—ƒuƒƒbƒN‚̐¶¬
359TCB _kernel_tcb_table[TNUM_TSKID];$NL$
360$NL$
361
362$ ƒ^ƒXƒN¶¬‡˜ƒe[ƒuƒ‹‚̐¶¬
363const ID _kernel_torder_table[TNUM_STSKID] = {$NL$
364$TAB$$JOINEACH tskid TSK.ORDER_LIST ", "$$tskid$$END$$NL$
365};$NL$
366$NL$
367
368$
369$ ƒZƒ}ƒtƒH
370$
371/*$NL$
372$SPC$* Semaphore Functions$NL$
373$SPC$*/$NL$
374$NL$
375
376$ Ã“I‚ɐ¶¬‚³‚ꂽƒZƒ}ƒtƒH‚̐”
377#define TNUM_SSEMID $LENGTH(SEM.ID_LIST)$$NL$
378$NL$
379
380$ ƒZƒ}ƒtƒHID”ԍ†‚̍őå’l
381const ID _kernel_tmax_semid = (TMIN_SEMID + TNUM_SEMID - 1);$NL$
382const ID _kernel_tmax_ssemid = (TMIN_SEMID + TNUM_SSEMID - 1);$NL$
383$NL$
384
385$ ƒZƒ}ƒtƒH‰Šú‰»ƒuƒƒbƒN‚̐¶¬
386$IF LENGTH(SEM.ID_LIST)$
387 const SEMINIB _kernel_seminib_table[TNUM_SSEMID] = {$NL$
388 $JOINEACH semid SEM.ID_LIST ",\n"$
389$ // sematr‚ªimTA_TPRInj‚Å‚È‚¢ê‡iE_RSATRj
390 $IF (SEM.SEMATR[semid] & ~TA_TPRI) != 0$
391 $ERROR SEM.TEXT_LINE[semid]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "sematr", SEM.SEMATR[semid], semid, "CRE_SEM")$$END$
392 $END$
393
394$ // (0 <= isemcnt && isemcnt <= maxsem)‚Å‚È‚¢ê‡iE_PARj
395 $IF !(0 <= SEM.ISEMCNT[semid] && SEM.ISEMCNT[semid] <= SEM.MAXSEM[semid])$
396 $ERROR SEM.TEXT_LINE[semid]$E_PAR: $FORMAT(_("too large %1% `%2%\' of `%3%\' in %4%"), "isemcnt", SEM.ISEMCNT[semid], semid, "CRE_SEM")$$END$
397 $END$
398
399$ // (1 <= maxsem && maxsem <= TMAX_MAXSEM)‚Å‚È‚¢ê‡iE_PARj
400 $IF !(1 <= SEM.MAXSEM[semid] && SEM.MAXSEM[semid] <= TMAX_MAXSEM)$
401 $ERROR SEM.TEXT_LINE[semid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "maxsem", SEM.MAXSEM[semid], semid, "CRE_SEM")$$END$
402 $END$
403
404$ // ƒZƒ}ƒtƒH‰Šú‰»ƒuƒƒbƒN
405 $TAB${ ($SEM.SEMATR[semid]$), ($SEM.ISEMCNT[semid]$), ($SEM.MAXSEM[semid]$) }
406 $END$$NL$
407 };$NL$
408$ELSE$
409 TOPPERS_EMPTY_LABEL(const SEMINIB, _kernel_seminib_table);$NL$
410$END$$NL$
411
412$ “®“I¶¬ƒZƒ}ƒtƒH—p‚̃Zƒ}ƒtƒH‰Šú‰»ƒuƒƒbƒN‚̐¶¬
413$IF num_asemid > 0$
414 SEMINIB _kernel_aseminib_table[$num_asemid$];$NL$
415$ELSE$
416 TOPPERS_EMPTY_LABEL(SEMINIB, _kernel_aseminib_table);$NL$
417$END$$NL$
418
419$ ƒZƒ}ƒtƒHŠÇ—ƒuƒƒbƒN‚̐¶¬
420$IF num_semid > 0$
421 SEMCB _kernel_semcb_table[TNUM_SEMID];$NL$
422$ELSE$
423 TOPPERS_EMPTY_LABEL(SEMCB, _kernel_semcb_table);$NL$
424$END$$NL$
425
426$
427$ ƒCƒxƒ“ƒgƒtƒ‰ƒO
428$
429/*$NL$
430$SPC$* Eventflag Functions$NL$
431$SPC$*/$NL$
432$NL$
433
434$ Ã“I‚ɐ¶¬‚³‚ꂽƒCƒxƒ“ƒgƒtƒ‰ƒO‚̐”
435#define TNUM_SFLGID $LENGTH(FLG.ID_LIST)$$NL$
436$NL$
437
438$ ƒCƒxƒ“ƒgƒtƒ‰ƒOID”ԍ†‚̍őå’l
439const ID _kernel_tmax_flgid = (TMIN_FLGID + TNUM_FLGID - 1);$NL$
440const ID _kernel_tmax_sflgid = (TMIN_FLGID + TNUM_SFLGID - 1);$NL$
441$NL$
442
443$ ƒCƒxƒ“ƒgƒtƒ‰ƒO‰Šú‰»ƒuƒƒbƒN‚̐¶¬
444$IF LENGTH(FLG.ID_LIST)$
445 const FLGINIB _kernel_flginib_table[TNUM_SFLGID] = {$NL$
446 $JOINEACH flgid FLG.ID_LIST ",\n"$
447$ // flgatr‚ªimTA_TPRInbmTA_WMULnbmTA_CLRnj‚Å‚È‚¢ê‡iE_RSATRj
448 $IF (FLG.FLGATR[flgid] & ~(TA_TPRI|TA_WMUL|TA_CLR)) != 0$
449 $ERROR FLG.TEXT_LINE[flgid]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "flgatr", FLG.FLGATR[flgid], flgid, "CRE_FLG")$$END$
450 $END$
451
452$ // iflgptn‚ªFLGPTN‚ÉŠi”[‚Å‚«‚È‚¢ê‡iE_PARj
453 $IF (FLG.IFLGPTN[flgid] & ~((1 << TBIT_FLGPTN) - 1)) != 0$
454 $ERROR FLG.TEXT_LINE[flgid]$E_PAR: $FORMAT(_("too large %1% `%2%\' of `%3%\' in %4%"), "iflgptn", FLG.IFLGPTN[flgid], flgid, "CRE_FLG")$$END$
455 $END$
456
457$ // ƒCƒxƒ“ƒgƒtƒ‰ƒO‰Šú‰»ƒuƒƒbƒN
458 $TAB${ ($FLG.FLGATR[flgid]$), ($FLG.IFLGPTN[flgid]$) }
459 $END$$NL$
460 };$NL$
461$ELSE$
462 TOPPERS_EMPTY_LABEL(const FLGINIB, _kernel_flginib_table);$NL$
463$END$$NL$
464
465$ “®“I¶¬ƒCƒxƒ“ƒgƒtƒ‰ƒO—p‚̃Cƒxƒ“ƒgƒtƒ‰ƒO‰Šú‰»ƒuƒƒbƒN‚̐¶¬
466$IF num_aflgid > 0$
467 FLGINIB _kernel_aflginib_table[$num_aflgid$];$NL$
468$ELSE$
469 TOPPERS_EMPTY_LABEL(FLGINIB, _kernel_aflginib_table);$NL$
470$END$$NL$
471
472$ ƒCƒxƒ“ƒgƒtƒ‰ƒOŠÇ—ƒuƒƒbƒN‚̐¶¬
473$IF num_flgid > 0$
474 FLGCB _kernel_flgcb_table[TNUM_FLGID];$NL$
475$ELSE$
476 TOPPERS_EMPTY_LABEL(FLGCB, _kernel_flgcb_table);$NL$
477$END$$NL$
478
479$
480$ ƒf[ƒ^ƒLƒ…
481[
482$
483/*$NL$
484$SPC$* Dataqueue Functions$NL$
485$SPC$*/$NL$
486$NL$
487
488$ Ã“I‚ɐ¶¬‚³‚ꂽƒf[ƒ^ƒLƒ…
489[‚̐”
490#define TNUM_SDTQID $LENGTH(DTQ.ID_LIST)$$NL$
491$NL$
492
493$ ƒf[ƒ^ƒLƒ…
494[ID”ԍ†‚̍őå’l
495const ID _kernel_tmax_dtqid = (TMIN_DTQID + TNUM_DTQID - 1);$NL$
496const ID _kernel_tmax_sdtqid = (TMIN_DTQID + TNUM_SDTQID - 1);$NL$
497$NL$
498
499$IF LENGTH(DTQ.ID_LIST)$
500 $FOREACH dtqid DTQ.ID_LIST$
501$ // dtqatr‚ªimTA_TPRInj‚Å‚È‚¢ê‡iE_RSATRj
502 $IF (DTQ.DTQATR[dtqid] & ~TA_TPRI) != 0$
503 $ERROR DTQ.TEXT_LINE[dtqid]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "dtqatr", DTQ.DTQATR[dtqid], dtqid, "CRE_DTQ")$$END$
504 $END$
505
506$ // dtqcnt‚ª•‰‚̏ꍇiE_PARj
507 $IF DTQ.DTQCNT[dtqid] < 0$
508 $ERROR DTQ.TEXT_LINE[dtqid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "dtqcnt", DTQ.DTQCNT[dtqid], dtqid, "CRE_DTQ")$$END$
509 $END$
510
511$ // dtqmb‚ªNULL‚Å‚È‚¢ê‡iE_NOSPTj
512 $IF !EQ(DTQ.DTQMB[dtqid], "NULL")$
513 $ERROR DTQ.TEXT_LINE[dtqid]$E_NOSPT: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "dtqmb", DTQ.DTQMB[dtqid], dtqid, "CRE_DTQ")$$END$
514 $END$
515
516$ // ƒf[ƒ^ƒLƒ…
517[ŠÇ——̈æ
518 $IF DTQ.DTQCNT[dtqid]$
519 static DTQMB _kernel_dtqmb_$dtqid$[$DTQ.DTQCNT[dtqid]$];$NL$
520 $END$
521 $END$
522
523$ // ƒf[ƒ^ƒLƒ…
524[‰Šú‰»ƒuƒƒbƒN‚̐¶¬
525 const DTQINIB _kernel_dtqinib_table[TNUM_SDTQID] = {$NL$
526 $JOINEACH dtqid DTQ.ID_LIST ",\n"$
527 $TAB${ ($DTQ.DTQATR[dtqid]$), ($DTQ.DTQCNT[dtqid]$), $IF DTQ.DTQCNT[dtqid]$(_kernel_dtqmb_$dtqid$)$ELSE$NULL$END$ }
528 $END$$NL$
529 };$NL$
530$ELSE$
531 TOPPERS_EMPTY_LABEL(const DTQINIB, _kernel_dtqinib_table);$NL$
532$END$$NL$
533
534$ “®“I¶¬ƒf[ƒ^ƒLƒ…
535[—p‚̃f[ƒ^ƒLƒ…
536[‰Šú‰»ƒuƒƒbƒN‚̐¶¬
537$IF num_adtqid > 0$
538 DTQINIB _kernel_adtqinib_table[$num_adtqid$];$NL$
539$ELSE$
540 TOPPERS_EMPTY_LABEL(DTQINIB, _kernel_adtqinib_table);$NL$
541$END$$NL$
542
543$ ƒf[ƒ^ƒLƒ…
544[ŠÇ—ƒuƒƒbƒN‚̐¶¬
545$IF num_dtqid > 0$
546 DTQCB _kernel_dtqcb_table[TNUM_DTQID];$NL$
547$ELSE$
548 TOPPERS_EMPTY_LABEL(DTQCB, _kernel_dtqcb_table);$NL$
549$END$$NL$
550
551$
552$ —Dæ“xƒf[ƒ^ƒLƒ…
553[
554$
555/*$NL$
556$SPC$* Priority Dataqueue Functions$NL$
557$SPC$*/$NL$
558$NL$
559
560$ Ã“I‚ɐ¶¬‚³‚ꂽ—Dæ“xƒf[ƒ^ƒLƒ…
561[‚̐”
562#define TNUM_SPDQID $LENGTH(PDQ.ID_LIST)$$NL$
563$NL$
564
565$ —Dæ“xƒf[ƒ^ƒLƒ…
566[ID”ԍ†‚̍őå’l
567const ID _kernel_tmax_pdqid = (TMIN_PDQID + TNUM_PDQID - 1);$NL$
568const ID _kernel_tmax_spdqid = (TMIN_PDQID + TNUM_SPDQID - 1);$NL$
569$NL$
570
571$IF LENGTH(PDQ.ID_LIST)$
572 $FOREACH pdqid PDQ.ID_LIST$
573$ // pdqatr‚ªimTA_TPRInj‚Å‚È‚¢ê‡iE_RSATRj
574 $IF (PDQ.PDQATR[pdqid] & ~TA_TPRI) != 0$
575 $ERROR PDQ.TEXT_LINE[pdqid]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "pdqatr", PDQ.PDQATR[pdqid], pdqid, "CRE_PDQ")$$END$
576 $END$
577
578$ // pdqcnt‚ª•‰‚̏ꍇiE_PARj
579 $IF PDQ.PDQCNT[pdqid] < 0$
580 $ERROR PDQ.TEXT_LINE[pdqid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "pdqcnt", PDQ.PDQCNT[pdqid], pdqid, "CRE_PDQ")$$END$
581 $END$
582
583$ // (TMIN_DPRI <= maxdpri && maxdpri <= TMAX_DPRI)‚Å‚È‚¢ê‡iE_PARj
584 $IF !(TMIN_DPRI <= PDQ.MAXDPRI[pdqid] && PDQ.MAXDPRI[pdqid] <= TMAX_DPRI)$
585 $ERROR PDQ.TEXT_LINE[pdqid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "maxdpri", PDQ.MAXDPRI[pdqid], pdqid, "CRE_PDQ")$$END$
586 $END$
587
588$ // pdqmb‚ªNULL‚Å‚È‚¢ê‡iE_NOSPTj
589 $IF !EQ(PDQ.PDQMB[pdqid], "NULL")$
590 $ERROR PDQ.TEXT_LINE[pdqid]$E_NOSPT: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "pdqmb", PDQ.PDQMB[pdqid], pdqid, "CRE_PDQ")$$END$
591 $END$
592
593$ // —Dæ“xƒf[ƒ^ƒLƒ…
594[ŠÇ——̈æ
595 $IF PDQ.PDQCNT[pdqid]$
596 static PDQMB _kernel_pdqmb_$pdqid$[$PDQ.PDQCNT[pdqid]$];$NL$
597 $END$
598 $END$
599
600$ // —Dæ“xƒf[ƒ^ƒLƒ…
601[‰Šú‰»ƒuƒƒbƒN‚̐¶¬
602 const PDQINIB _kernel_pdqinib_table[TNUM_SPDQID] = {$NL$
603 $JOINEACH pdqid PDQ.ID_LIST ",\n"$
604 $TAB${ ($PDQ.PDQATR[pdqid]$), ($PDQ.PDQCNT[pdqid]$), ($PDQ.MAXDPRI[pdqid]$), $IF PDQ.PDQCNT[pdqid]$(_kernel_pdqmb_$pdqid$)$ELSE$NULL$END$ }
605 $END$$NL$
606 };$NL$
607$ELSE$
608 TOPPERS_EMPTY_LABEL(const PDQINIB, _kernel_pdqinib_table);$NL$
609$END$$NL$
610
611$ “®“I¶¬—Dæ“xƒf[ƒ^ƒLƒ…
612[—p‚Ì—Dæ“xƒf[ƒ^ƒLƒ…
613[‰Šú‰»ƒuƒƒbƒN‚̐¶¬
614$IF num_apdqid > 0$
615 PDQINIB _kernel_apdqinib_table[$num_apdqid$];$NL$
616$ELSE$
617 TOPPERS_EMPTY_LABEL(PDQINIB, _kernel_apdqinib_table);$NL$
618$END$$NL$
619
620$ —Dæ“xƒf[ƒ^ƒLƒ…
621[ŠÇ—ƒuƒƒbƒN‚̐¶¬
622$IF num_pdqid > 0$
623 PDQCB _kernel_pdqcb_table[TNUM_PDQID];$NL$
624$ELSE$
625 TOPPERS_EMPTY_LABEL(PDQCB, _kernel_pdqcb_table);$NL$
626$END$$NL$
627
628$
629$ ƒ[ƒ‹ƒ{ƒbƒNƒX
630$
631/*$NL$
632$SPC$* Mailbox Functions$NL$
633$SPC$*/$NL$
634$NL$
635
636$ Ã“I‚ɐ¶¬‚³‚ꂽƒ[ƒ‹ƒ{ƒbƒNƒX‚̐”
637#define TNUM_SMBXID $LENGTH(MBX.ID_LIST)$$NL$
638$NL$
639
640$ ƒ[ƒ‹ƒ{ƒbƒNƒXID”ԍ†‚̍őå’l
641const ID _kernel_tmax_mbxid = (TMIN_MBXID + TNUM_MBXID - 1);$NL$
642const ID _kernel_tmax_smbxid = (TMIN_MBXID + TNUM_SMBXID - 1);$NL$
643$NL$
644
645$ ƒ[ƒ‹ƒ{ƒbƒNƒX‰Šú‰»ƒuƒƒbƒN‚̐¶¬
646$IF LENGTH(MBX.ID_LIST)$
647 const MBXINIB _kernel_mbxinib_table[TNUM_SMBXID] = {$NL$
648 $JOINEACH mbxid MBX.ID_LIST ",\n"$
649$ // mbxatr‚ªimTA_TPRInbmTA_MPRInj‚Å‚È‚¢ê‡iE_RSATRj
650 $IF (MBX.MBXATR[mbxid] & ~(TA_TPRI|TA_MPRI)) != 0$
651 $ERROR MBX.TEXT_LINE[mbxid]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "mbxatr", MBX.MBXATR[mbxid], mbxid, "CRE_MBX")$$END$
652 $END$
653
654$ // (TMIN_MPRI <= maxmpri && maxmpri <= TMAX_MPRI)‚Å‚È‚¢ê‡iE_PARj
655 $IF !(TMIN_MPRI <= MBX.MAXMPRI[mbxid] && MBX.MAXMPRI[mbxid] <= TMAX_MPRI)$
656 $ERROR MBX.TEXT_LINE[mbxid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "maxmpri", MBX.MAXMPRI[mbxid], mbxid, "CRE_MBX")$$END$
657 $END$
658
659$ // mprihd‚ªNULL‚Å‚È‚¢ê‡iE_NOSPTj
660 $IF !EQ(MBX.MPRIHD[mbxid], "NULL")$
661 $ERROR MBX.TEXT_LINE[mbxid]$E_NOSPT: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "mprihd", MBX.MPRIHD[mbxid], mbxid, "CRE_MBX")$$END$
662 $END$
663
664$ // ƒ[ƒ‹ƒ{ƒbƒNƒX‰Šú‰»ƒuƒƒbƒN
665 $TAB${ ($MBX.MBXATR[mbxid]$), ($MBX.MAXMPRI[mbxid]$) }
666 $END$$NL$
667 };$NL$
668$ELSE$
669 TOPPERS_EMPTY_LABEL(const MBXINIB, _kernel_mbxinib_table);$NL$
670$END$$NL$
671
672$ “®“I¶¬ƒ[ƒ‹ƒ{ƒbƒNƒX—p‚̃[ƒ‹ƒ{ƒbƒNƒX‰Šú‰»ƒuƒƒbƒN‚̐¶¬
673$IF num_ambxid > 0$
674 MBXINIB _kernel_ambxinib_table[$num_ambxid$];$NL$
675$ELSE$
676 TOPPERS_EMPTY_LABEL(MBXINIB, _kernel_ambxinib_table);$NL$
677$END$$NL$
678
679$ ƒ[ƒ‹ƒ{ƒbƒNƒXŠÇ—ƒuƒƒbƒN‚̐¶¬
680$IF num_mbxid > 0$
681 MBXCB _kernel_mbxcb_table[TNUM_MBXID];$NL$
682$ELSE$
683 TOPPERS_EMPTY_LABEL(MBXCB, _kernel_mbxcb_table);$NL$
684$END$$NL$
685
686$
687$ ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹
688$
689/*$NL$
690$SPC$* Fixed-sized Memorypool Functions$NL$
691$SPC$*/$NL$
692$NL$
693
694$ Ã“I‚ɐ¶¬‚³‚ꂽŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹‚̐”
695#define TNUM_SMPFID $LENGTH(MPF.ID_LIST)$$NL$
696$NL$
697
698$ ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹ID”ԍ†‚̍őå’l
699const ID _kernel_tmax_mpfid = (TMIN_MPFID + TNUM_MPFID - 1);$NL$
700const ID _kernel_tmax_smpfid = (TMIN_MPFID + TNUM_SMPFID - 1);$NL$
701$NL$
702
703$IF LENGTH(MPF.ID_LIST)$
704 $FOREACH mpfid MPF.ID_LIST$
705$ // mpfatr‚ªimTA_TPRInj‚Å‚È‚¢ê‡iE_RSATRj
706 $IF (MPF.MPFATR[mpfid] & ~TA_TPRI) != 0$
707 $ERROR MPF.TEXT_LINE[mpfid]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "mpfatr", MPF.MPFATR[mpfid], mpfid, "CRE_MPF")$$END$
708 $END$
709
710$ // blkcnt‚ª0ˆÈ‰º‚̏ꍇiE_PARj
711 $IF MPF.BLKCNT[mpfid] <= 0$
712 $ERROR MPF.TEXT_LINE[mpfid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "blkcnt", MPF.BLKCNT[mpfid], mpfid, "CRE_MPF")$$END$
713 $END$
714
715$ // blksz‚ª0ˆÈ‰º‚̏ꍇiE_PARj
716 $IF MPF.BLKSZ[mpfid] <= 0$
717 $ERROR MPF.TEXT_LINE[mpfid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "blksz", MPF.BLKSZ[mpfid], mpfid, "CRE_MPF")$$END$
718 $END$
719
720$ // ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹—̈æ
721 $IF EQ(MPF.MPF[mpfid], "NULL")$
722 static MPF_T _kernel_mpf_$mpfid$[($MPF.BLKCNT[mpfid]$) * COUNT_MPF_T($MPF.BLKSZ[mpfid]$)];$NL$
723 $END$
724
725$ // mpfmb‚ªNULL‚Å‚È‚¢ê‡iE_NOSPTj
726 $IF !EQ(MPF.MPFMB[mpfid], "NULL")$
727 $ERROR MPF.TEXT_LINE[mpfid]$E_NOSPT: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "mpfmb", MPF.MPFMB[mpfid], mpfid, "CRE_MPF")$$END$
728 $END$
729
730$ // ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹ŠÇ——̈æ
731 static MPFMB _kernel_mpfmb_$mpfid$[$MPF.BLKCNT[mpfid]$];$NL$
732 $END$
733
734$ // ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹‰Šú‰»ƒuƒƒbƒN‚̐¶¬
735 const MPFINIB _kernel_mpfinib_table[TNUM_SMPFID] = {$NL$
736 $JOINEACH mpfid MPF.ID_LIST ",\n"$
737 $TAB${ ($MPF.MPFATR[mpfid]$), ($MPF.BLKCNT[mpfid]$), ROUND_MPF_T($MPF.BLKSZ[mpfid]$), $IF EQ(MPF.MPF[mpfid],"NULL")$(_kernel_mpf_$mpfid$)$ELSE$(void *)($MPF.MPF[mpfid]$)$END$, (_kernel_mpfmb_$mpfid$) }
738 $END$$NL$
739 };$NL$
740$ELSE$
741 TOPPERS_EMPTY_LABEL(const MPFINIB, _kernel_mpfinib_table);$NL$
742$END$$NL$
743
744$ “®“I¶¬ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹—p‚̌Œ蒷ƒƒ‚ƒŠƒv[ƒ‹‰Šú‰»ƒuƒƒbƒN‚̐¶¬
745$IF num_ampfid > 0$
746 MPFINIB _kernel_ampfinib_table[$num_ampfid$];$NL$
747$ELSE$
748 TOPPERS_EMPTY_LABEL(MPFINIB, _kernel_ampfinib_table);$NL$
749$END$$NL$
750
751$ ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹ŠÇ—ƒuƒƒbƒN‚̐¶¬
752$IF num_mpfid > 0$
753 MPFCB _kernel_mpfcb_table[TNUM_MPFID];$NL$
754$ELSE$
755 TOPPERS_EMPTY_LABEL(MPFCB, _kernel_mpfcb_table);$NL$
756$END$$NL$
757
758$
759$ ŽüŠúƒnƒ“ƒhƒ‰
760$
761/*$NL$
762$SPC$* Cyclic Handler Functions$NL$
763$SPC$*/$NL$
764$NL$
765
766$ Ã“I‚ɐ¶¬‚³‚ꂽŽüŠúƒnƒ“ƒhƒ‰‚̐”
767#define TNUM_SCYCID $LENGTH(CYC.ID_LIST)$$NL$
768$NL$
769
770$ ŽüŠúƒnƒ“ƒhƒ‰ID”ԍ†‚̍őå’l
771const ID _kernel_tmax_cycid = (TMIN_CYCID + TNUM_CYCID - 1);$NL$
772const ID _kernel_tmax_scycid = (TMIN_CYCID + TNUM_SCYCID - 1);$NL$
773$NL$
774
775$ ŽüŠúƒnƒ“ƒhƒ‰‰Šú‰»ƒe[ƒuƒ‹‚̐¶¬
776$IF LENGTH(CYC.ID_LIST)$
777 const CYCINIB _kernel_cycinib_table[TNUM_SCYCID] = {$NL$
778 $JOINEACH cycid CYC.ID_LIST ",\n"$
779$ // cycatr‚ªimTA_STAnj‚Å‚È‚¢ê‡iE_RSATRj
780 $IF (CYC.CYCATR[cycid] & ~TA_STA) != 0$
781 $ERROR CYC.TEXT_LINE[cycid]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "cycatr", CYC.CYCATR[cycid], cycid, "CRE_CYC")$$END$
782 $END$
783
784$ // (0 < cyctim && cyctim <= TMAX_RELTIM)‚Å‚È‚¢ê‡iE_PARj
785 $IF !(0 < CYC.CYCTIM[cycid] && CYC.CYCTIM[cycid] <= TMAX_RELTIM)$
786 $ERROR CYC.TEXT_LINE[cycid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "cyctim", CYC.CYCTIM[cycid], cycid, "CRE_CYC")$$END$
787 $END$
788
789$ // (0 <= cycphs && cycphs <= TMAX_RELTIM)‚Å‚È‚¢ê‡iE_PARj
790 $IF !(0 <= CYC.CYCPHS[cycid] && CYC.CYCPHS[cycid] <= TMAX_RELTIM)$
791 $ERROR CYC.TEXT_LINE[cycid]$E_PAR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "cycphs", CYC.CYCPHS[cycid], cycid, "CRE_CYC")$$END$
792 $END$
793
794$ // ŒxFcycatr‚ÉTA_STA‚ªÝ’肳‚ê‚Ä‚¢‚āC(cycphs == 0)‚̏ꍇ
795 $IF (CYC.CYCATR[cycid] & TA_STA) != 0 && CYC.CYCPHS[cycid] == 0$
796 $WARNING CYC.TEXT_LINE[cycid]$$FORMAT(_("%1% is not recommended when %2% is set to %3% in %4%"), "cycphs==0", "TA_STA", "cycatr", "CRE_CYC")$$END$
797 $END$
798
799$ // ŽüŠúƒnƒ“ƒhƒ‰‰Šú‰»ƒuƒƒbƒN
800 $TAB${ ($CYC.CYCATR[cycid]$), (intptr_t)($CYC.EXINF[cycid]$), ($CYC.CYCHDR[cycid]$), ($CYC.CYCTIM[cycid]$), ($CYC.CYCPHS[cycid]$) }
801 $END$$NL$
802 };$NL$
803$ELSE$
804 TOPPERS_EMPTY_LABEL(const CYCINIB, _kernel_cycinib_table);$NL$
805$END$$NL$
806
807$ “®“I¶¬ŽüŠúƒnƒ“ƒhƒ‰—p‚ÌŽüŠúƒnƒ“ƒhƒ‰‰Šú‰»ƒuƒƒbƒN‚̐¶¬
808$IF num_acycid > 0$
809 CYCINIB _kernel_acycinib_table[$num_acycid$];$NL$
810$ELSE$
811 TOPPERS_EMPTY_LABEL(CYCINIB, _kernel_acycinib_table);$NL$
812$END$$NL$
813
814$ ŽüŠúƒnƒ“ƒhƒ‰ŠÇ—ƒuƒƒbƒN‚̐¶¬
815$IF num_cycid > 0$
816 CYCCB _kernel_cyccb_table[TNUM_CYCID];$NL$
817$ELSE$
818 TOPPERS_EMPTY_LABEL(CYCCB, _kernel_cyccb_table);$NL$
819$END$$NL$
820
821$
822$ ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰
823$
824/*$NL$
825$SPC$* Alarm Handler Functions$NL$
826$SPC$*/$NL$
827$NL$
828
829$ Ã“I‚ɐ¶¬‚³‚ꂽƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰‚̐”
830#define TNUM_SALMID $LENGTH(ALM.ID_LIST)$$NL$
831$NL$
832
833$ ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰ID”ԍ†‚̍őå’l
834const ID _kernel_tmax_almid = (TMIN_ALMID + TNUM_ALMID - 1);$NL$
835const ID _kernel_tmax_salmid = (TMIN_ALMID + TNUM_SALMID - 1);$NL$
836$NL$
837
838$ ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰‰Šú‰»ƒuƒƒbƒN‚̐¶¬
839$IF LENGTH(ALM.ID_LIST)$
840 const ALMINIB _kernel_alminib_table[TNUM_SALMID] = {$NL$
841 $JOINEACH almid ALM.ID_LIST ",\n"$
842$ // almatr‚ªiTA_NULLj‚Å‚È‚¢ê‡iE_RSATRj
843 $IF ALM.ALMATR[almid] != 0$
844 $ERROR ALM.TEXT_LINE[almid]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "almatr", ALM.ALMATR[almid], almid, "CRE_ALM")$$END$
845 $END$
846
847$ // ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰‰Šú‰»ƒuƒƒbƒN
848 $TAB${ ($ALM.ALMATR[almid]$), (intptr_t)($ALM.EXINF[almid]$), ($ALM.ALMHDR[almid]$) }
849 $END$$NL$
850 };$NL$
851$ELSE$
852 TOPPERS_EMPTY_LABEL(const ALMINIB, _kernel_alminib_table);$NL$
853$END$$NL$
854
855$ “®“I¶¬ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰—p‚̃Aƒ‰[ƒ€ƒnƒ“ƒhƒ‰‰Šú‰»ƒuƒƒbƒN‚̐¶¬
856$IF num_aalmid > 0$
857 ALMINIB _kernel_aalminib_table[$num_aalmid$];$NL$
858$ELSE$
859 TOPPERS_EMPTY_LABEL(ALMINIB, _kernel_aalminib_table);$NL$
860$END$$NL$
861
862$ ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰ŠÇ—ƒuƒƒbƒN‚̐¶¬
863$IF num_almid > 0$
864 ALMCB _kernel_almcb_table[TNUM_ALMID];$NL$
865$ELSE$
866 TOPPERS_EMPTY_LABEL(ALMCB, _kernel_almcb_table);$NL$
867$END$$NL$
868
869$
870$ Š„ž‚ÝŠÇ—‹@”\
871$
872/*$NL$
873$SPC$* Interrupt Management Functions$NL$
874$SPC$*/$NL$
875$NL$
876
877$ Š„ž‚ݔԍ†‚ÆŠ„ž‚݃nƒ“ƒhƒ‰”ԍ†‚Ì•ÏŠ·ƒe[ƒuƒ‹‚̍쐬
878$IF LENGTH(INTNO_ATTISR_VALID) != LENGTH(INHNO_ATTISR_VALID)$
879 $ERROR$length of `INTNO_ATTISR_VALID' is different from length of `INHNO_ATTISR_VALID'$END$
880$END$
881$i = 0$
882$FOREACH intno INTNO_ATTISR_VALID$
883 $inhno = AT(INHNO_ATTISR_VALID, i)$
884 $INHNO[intno] = inhno$
885 $INTNO[inhno] = intno$
886 $i = i + 1$
887$END$
888
889$ Š„ž‚Ý—v‹ƒ‰ƒCƒ“‚ÉŠÖ‚·‚éƒGƒ‰[ƒ`ƒFƒbƒN
890$i = 0$
891$FOREACH intno INT.ORDER_LIST$
892$ // intno‚ªCFG_INT‚ɑ΂·‚銄ž‚ݔԍ†‚Æ‚µ‚Đ³‚µ‚­‚È‚¢ê‡iE_PARj
893 $IF !LENGTH(FIND(INTNO_CFGINT_VALID, INT.INTNO[intno]))$
894 $ERROR INT.TEXT_LINE[intno]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "intno", INT.INTNO[intno], "CFG_INT")$$END$
895 $END$
896
897$ // intno‚ªCFG_INT‚É‚æ‚Á‚ĐݒèÏ‚݂̏ꍇiE_OBJj
898 $j = 0$
899 $FOREACH intno2 INT.ORDER_LIST$
900 $IF INT.INTNO[intno] == INT.INTNO[intno2] && j < i$
901 $ERROR INT.TEXT_LINE[intno]$E_OBJ: $FORMAT(_("%1% `%2%\' in %3% is duplicated"), "intno", INT.INTNO[intno], "CFG_INT")$$END$
902 $END$
903 $j = j + 1$
904 $END$
905
906$ // intatr‚ªimTA_ENAINTnbmTA_EDGEnj‚Å‚È‚¢ê‡iE_RSATRj
907 $IF (INT.INTATR[intno] & ~(TA_ENAINT|TA_EDGE|TARGET_INTATR)) != 0$
908 $ERROR INT.TEXT_LINE[intno]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of %3% `%4%\' in %5%"), "intatr", INT.INTATR[intno], "intno", INT.INTNO[intno], "CFG_INT")$$END$
909 $END$
910
911$ // intpri‚ªCFG_INT‚ɑ΂·‚銄ž‚Ý—Dæ“x‚Æ‚µ‚Đ³‚µ‚­‚È‚¢ê‡iE_PARj
912 $IF !LENGTH(FIND(INTPRI_CFGINT_VALID, INT.INTPRI[intno]))$
913 $ERROR INT.TEXT_LINE[intno]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "intpri", INT.INTPRI[intno], "CFG_INT")$$END$
914 $END$
915
916$ // ƒJ[ƒlƒ‹ŠÇ—‚ɌŒ肳‚ê‚Ä‚¢‚éintno‚ɑ΂µ‚āCintpri‚ÉTMIN_INTPRI
917$ // ‚æ‚è‚à¬‚³‚¢’l‚ªŽw’肳‚ꂽê‡iE_OBJj
918 $IF LENGTH(FIND(INTNO_FIX_KERNEL, intno))$
919 $IF INT.INTPRI[intno] < TMIN_INTPRI$
920 $ERROR INT.TEXT_LINE[intno]$E_OBJ: $FORMAT(_("%1% `%2%\' must not have higher priority than %3%"), "intno", INT.INTNO[intno], "TMIN_INTPRI")$$END$
921 $END$
922 $END$
923
924$ // ƒJ[ƒlƒ‹ŠÇ—ŠO‚ɌŒ肳‚ê‚Ä‚¢‚éintno‚ɑ΂µ‚āCintpri‚ÉTMIN_INTPRI
925$ // ‚æ‚è‚à¬‚³‚¢’l‚ªŽw’肳‚ê‚È‚©‚Á‚½ê‡iE_OBJj
926 $IF LENGTH(FIND(INTNO_FIX_NONKERNEL, intno))$
927 $IF INT.INTPRI[intno] >= TMIN_INTPRI$
928 $ERROR INT.TEXT_LINE[intno]$E_OBJ: $FORMAT(_("%1% `%2%\' must have higher priority than %3%"), "intno", INT.INTNO[intno], "TMIN_INTPRI")$$END$
929 $END$
930 $END$
931 $i = i + 1$
932$END$
933
934$ Š„ž‚݃nƒ“ƒhƒ‰‚ÉŠÖ‚·‚éƒGƒ‰[ƒ`ƒFƒbƒN
935$i = 0$
936$FOREACH inhno INH.ORDER_LIST$
937$ // inhno‚ªDEF_INH‚ɑ΂·‚銄ž‚݃nƒ“ƒhƒ‰”ԍ†‚Æ‚µ‚Đ³‚µ‚­‚È‚¢ê‡iE_PARj
938 $IF !LENGTH(FIND(INHNO_DEFINH_VALID, INH.INHNO[inhno]))$
939 $ERROR INH.TEXT_LINE[inhno]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "inhno", INH.INHNO[inhno], "DEF_INH")$$END$
940 $END$
941
942$ // inhno‚ªDEF_INH‚É‚æ‚Á‚ĐݒèÏ‚݂̏ꍇiE_OBJj
943 $j = 0$
944 $FOREACH inhno2 INH.ORDER_LIST$
945 $IF INH.INHNO[inhno] == INH.INHNO[inhno2] && j < i$
946 $ERROR INH.TEXT_LINE[inhno]$E_OBJ: $FORMAT(_("%1% `%2%\' in %3% is duplicated"), "inhno", INH.INHNO[inhno], "DEF_INH")$$END$
947 $END$
948 $j = j + 1$
949 $END$
950
951$ // inhatr‚ªiTA_NULLj‚Å‚È‚¢ê‡iE_RSATRj
952 $IF (INH.INHATR[inhno] & ~TARGET_INHATR) != 0$
953 $ERROR INH.TEXT_LINE[inhno]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of %3% `%4%\' in %5%"), "inhatr", INH.INHATR[inhno], "inhno", INH.INHNO[inhno], "DEF_INH")$$END$
954 $END$
955
956$ // ƒJ[ƒlƒ‹ŠÇ—‚ɌŒ肳‚ê‚Ä‚¢‚éinhno‚ɑ΂µ‚āCinhatr‚ÉTA_NONKERNEL
957$ //@‚ªŽw’肳‚ê‚Ä‚¢‚éê‡iE_RSATRj
958 $IF LENGTH(FIND(INHNO_FIX_KERNEL, inhno))$
959 $IF (INH.INHATR[inhno] & TA_NONKERNEL) != 0$
960 $ERROR INH.TEXT_LINE[inhno]$E_RSATR: $FORMAT(_("%1% `%2%\' must not be non-kernel interrupt"), "inhno", INH.INHNO[inhno])$$END$
961 $END$
962 $END$
963
964$ // ƒJ[ƒlƒ‹ŠÇ—ŠO‚ɌŒ肳‚ê‚Ä‚¢‚éinhno‚ɑ΂µ‚āCinhatr‚ÉTA_NONKERNEL
965$ // ‚ªŽw’肳‚ê‚Ä‚¢‚È‚¢ê‡iE_RSATRj
966 $IF LENGTH(FIND(INHNO_FIX_NONKERNEL, inhno))$
967 $IF (INH.INHATR[inhno] & TA_NONKERNEL) == 0$
968 $ERROR INH.TEXT_LINE[inhno]$E_RSATR: $FORMAT(_("%1% `%2%\' must be non-kernel interrupt"), "inhno", INH.INHNO[inhno])$$END$
969 $END$
970 $END$
971
972 $IF LENGTH(INTNO[INH.INHNO[inhno]])$
973 $intno = INTNO[INH.INHNO[inhno]]$
974$ // inhno‚ɑΉž‚·‚éintno‚ɑ΂·‚éCFG_INT‚ª‚È‚¢ê‡iE_OBJj
975 $IF !LENGTH(INT.INTNO[intno])$
976 $ERROR INH.TEXT_LINE[inhno]$E_OBJ: $FORMAT(_("%1% `%2%\' corresponding to %3% `%4%\' is not configured with %5%"), "intno", INT.INTNO[intno], "inhno", INH.INHNO[inhno], "CFG_INT")$$END$
977 $ELSE$
978 $IF (INH.INHATR[inhno] & TA_NONKERNEL) == 0$
979$ // inhatr‚ÉTA_NONKERNEL‚ªŽw’肳‚ê‚Ä‚¨‚炸Cinhno‚ɑΉž
980$ // ‚·‚éintno‚ɑ΂µ‚ÄCFG_INT‚Őݒ肳‚ꂽŠ„ž‚Ý—Dæ“x‚ª
981$ // TMIN_INTPRI‚æ‚è‚à¬‚³‚¢ê‡iE_OBJj
982 $IF INT.INTPRI[intno] < TMIN_INTPRI$
983 $ERROR INT.TEXT_LINE[intno]$E_OBJ: $FORMAT(_("%1% `%2%\' configured for %3% `%4%\' is higher than %5%"), "intpri", INT.INTPRI[intno], "inhno", INH.INHNO[inhno], "TMIN_INTPRI")$$END$
984 $END$
985 $ELSE$
986$ // inhatr‚ÉTA_NONKERNEL‚ªŽw’肳‚ê‚Ä‚¨‚èCinhno‚ɑΉž
987$ // ‚·‚éintno‚ɑ΂µ‚ÄCFG_INT‚Őݒ肳‚ꂽŠ„ž‚Ý—Dæ“x‚ª
988$ // TMIN_INTPRIˆÈã‚Å‚ ‚éê‡iE_OBJj
989 $IF INT.INTPRI[intno] >= TMIN_INTPRI$
990 $ERROR INT.TEXT_LINE[intno]$E_OBJ: $FORMAT(_("%1% `%2%\' configured for %3% `%4%\' is lower than or equal to %5%"), "intpri", INT.INTPRI[intno], "inhno", INH.INHNO[inhno], "TMIN_INTPRI")$$END$
991 $END$
992 $END$
993 $END$
994 $END$
995 $i = i + 1$
996$END$
997
998$ Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“iISRj‚ÉŠÖ‚·‚éƒGƒ‰[ƒ`ƒFƒbƒN
999$FOREACH order ISR.ORDER_LIST$
1000$ // isratr‚ªiTA_NULLj‚Å‚È‚¢ê‡iE_RSATRj
1001 $IF (ISR.ISRATR[order] & ~TARGET_ISRATR) != 0$
1002 $ERROR ISR.TEXT_LINE[order]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "isratr", ISR.ISRATR[order], "ATT_ISR")$$END$
1003 $END$
1004
1005$ // intno‚ªATT_ISR‚ɑ΂·‚銄ž‚ݔԍ†‚Æ‚µ‚Đ³‚µ‚­‚È‚¢ê‡iE_PARj
1006 $IF !LENGTH(FIND(INTNO_ATTISR_VALID, ISR.INTNO[order]))$
1007 $ERROR ISR.TEXT_LINE[order]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "intno", ISR.INTNO[order], "ATT_ISR")$$END$
1008 $END$
1009
1010$ // (TMIN_ISRPRI <= isrpri && isrpri <= TMAX_ISRPRI)‚Å‚È‚¢ê‡iE_PARj
1011 $IF !(TMIN_ISRPRI <= ISR.ISRPRI[order] && ISR.ISRPRI[order] <= TMAX_ISRPRI)$
1012 $ERROR ISR.TEXT_LINE[order]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "isrpri", ISR.ISRPRI[order], "ATT_ISR")$$END$
1013 $END$
1014$END$
1015
1016$FOREACH intno INTNO_ATTISR_VALID$
1017 $inhno = INHNO[intno]$
1018
1019$ // Š„ž‚ݔԍ†intno‚ɑ΂µ‚Ä“o˜^‚³‚ꂽISR‚̃ŠƒXƒg‚̍쐬
1020 $isr_order_list = {}$
1021 $FOREACH order ISR.ORDER_LIST$
1022 $IF ISR.INTNO[order] == intno$
1023 $isr_order_list = APPEND(isr_order_list, order)$
1024 $order_for_error = order$
1025 $END$
1026 $END$
1027
1028$ // Š„ž‚ݔԍ†intno‚ɑ΂µ‚Ä“o˜^‚³‚ꂽISR‚ª‘¶Ý‚·‚éê‡
1029 $IF LENGTH(isr_order_list) > 0$
1030$ // intno‚ɑΉž‚·‚éinhno‚ɑ΂µ‚ÄDEF_INH‚ª‚ ‚éê‡iE_OBJj
1031 $IF LENGTH(INH.INHNO[inhno])$
1032 $ERROR ISR.TEXT_LINE[order_for_error]$E_OBJ: $FORMAT(_("%1% `%2%\' in %3% is duplicated with %4% `%5%\'"), "intno", ISR.INTNO[order_for_error], "ATT_ISR", "inhno", INH.INHNO[inhno])$$END$
1033 $END$
1034
1035$ // intno‚ɑ΂·‚éCFG_INT‚ª‚È‚¢ê‡iE_OBJj
1036 $IF !LENGTH(INT.INTNO[intno])$
1037 $ERROR ISR.TEXT_LINE[order_for_error]$E_OBJ: $FORMAT(_("%1% `%2%\' is not configured with %3%"), "intno", ISR.INTNO[order_for_error], "CFG_INT")$$END$
1038 $ELSE$
1039$ // intno‚ɑ΂µ‚ÄCFG_INT‚Őݒ肳‚ꂽŠ„ž‚Ý—Dæ“x‚ªTMIN_INTPRI
1040$ // ‚æ‚è‚à¬‚³‚¢ê‡iE_OBJj
1041 $IF INT.INTPRI[intno] < TMIN_INTPRI$
1042 $ERROR INT.TEXT_LINE[intno]$E_OBJ: $FORMAT(_("%1% `%2%\' configured for %3% `%4%\' is higher than %5%"), "intpri", INT.INTPRI[intno], "intno", ISR.INTNO[order_for_error], "TMIN_INTPRI")$$END$
1043 $END$
1044 $END$
1045 $END$
1046$END$
1047
1048$ Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“iISRjŠÇ—‚̃f[ƒ^\‘¢
1049$intno_isr_list = {}$
1050$FOREACH intno INTNO_ATTISR_VALID$
1051 $inhno = INHNO[intno]$
1052 $IF LENGTH(INT.INTNO[intno]) && !LENGTH(INH.INHNO[inhno])$
1053 $intno_isr_list = APPEND(intno_isr_list, intno)$
1054 $END$
1055$END$
1056
1057$INTNO_ISR = {}$
1058$i = 0$
1059$FOREACH intno SORT(intno_isr_list, "INT.INTNO")$
1060 $INTNO_ISR = APPEND(INTNO_ISR, intno)$
1061 $ISR_QUEUE_HEADER[intno] = FORMAT("&(_kernel_isr_queue_table[%d])", i)$
1062 $i = i + 1$
1063$END$
1064
1065const uint_t _kernel_tnum_isr_queue = $LENGTH(INTNO_ISR)$;$NL$
1066$NL$
1067
1068$IF LENGTH(INTNO_ISR)$
1069 const ISR_ENTRY _kernel_isr_queue_list[$LENGTH(INTNO_ISR)$] = {$NL$
1070 $JOINEACH intno INTNO_ISR ",\n"$
1071 $TAB${ $intno$, $ISR_QUEUE_HEADER[intno]$ }
1072 $END$$NL$
1073 };$NL$
1074$ELSE$
1075 TOPPERS_EMPTY_LABEL(QUEUE, _kernel_isr_queue_table);$NL$
1076$END$$NL$
1077
1078$IF LENGTH(INTNO_ISR)$
1079 QUEUE _kernel_isr_queue_table[$LENGTH(INTNO_ISR)$];$NL$
1080$ELSE$
1081 TOPPERS_EMPTY_LABEL(QUEUE, _kernel_isr_queue_table);$NL$
1082$END$$NL$
1083
1084$ Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“iISRjŒÄo‚µ‚Ì‚½‚ß‚ÌŠ„ž‚݃nƒ“ƒhƒ‰‚̐¶¬
1085$FOREACH intno INTNO_ISR$
1086 $inhno = INHNO[intno]$
1087
1088$ // DEF_INH(inhno, { TA_NULL, _kernel_inthdr_<intno> } );
1089 $INH.INHNO[inhno] = inhno$
1090 $INH.INHATR[inhno] = VALUE("TA_NULL", 0)$
1091 $INH.INTHDR[inhno] = CONCAT("_kernel_inthdr_", intno)$
1092 $INH.ORDER_LIST = APPEND(INH.ORDER_LIST, inhno)$
1093
1094$ // ISR—p‚ÌŠ„ž‚݃nƒ“ƒhƒ‰
1095 void$NL$
1096 _kernel_inthdr_$intno$(void)$NL$
1097 {$NL$
1098 $TAB$i_begin_int($intno$);$NL$
1099 $TAB$_kernel_call_isr($ISR_QUEUE_HEADER[intno]$);$NL$
1100 $TAB$i_end_int($intno$);$NL$
1101 }$NL$
1102 $NL$
1103$END$
1104
1105$ Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“‚̐”
1106#define TNUM_SISR $LENGTH(ISR.ORDER_LIST)$$NL$
1107#define TNUM_ISR $LENGTH(ISR.ORDER_LIST) + num_aisrid$$NL$
1108$NL$
1109
1110$ Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“ID”ԍ†‚̍őå’l
1111const ID _kernel_tmax_isrid = (TMIN_ISRID + TNUM_ISRID - 1);$NL$
1112const uint_t _kernel_tnum_sisr = TNUM_SISR;$NL$
1113$NL$
1114
1115$ Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“‰Šú‰»ƒuƒƒbƒN‚̐¶¬
1116$IF LENGTH(ISR.ORDER_LIST)$
1117 const ISRINIB _kernel_sisrinib_table[TNUM_SISR] = {$NL$
1118 $JOINEACH order ISR.ORDER_LIST ",\n"$
1119 $TAB${ ($ISR.ISRATR[order]$), ($ISR.EXINF[order]$), ($ISR.INTNO[order]$), ($ISR_QUEUE_HEADER[ISR.INTNO[order]]$), ($ISR.ISR[order]$), ($ISR.ISRPRI[order]$) }
1120 $END$$NL$
1121 };$NL$
1122$ELSE$
1123 TOPPERS_EMPTY_LABEL(const ISRINIB, _kernel_sisrinib_table);$NL$
1124$END$
1125$NL$
1126
1127$ “®“I¶¬Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“—p‚ÌŠ„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“‰Šú‰»ƒuƒƒb
1128$ ƒN‚̐¶¬
1129$IF num_aisrid > 0$
1130 ISRINIB _kernel_aisrinib_table[$num_aisrid$];$NL$
1131$ELSE$
1132 TOPPERS_EMPTY_LABEL(ISRINIB, _kernel_aisrinib_table);$NL$
1133$END$
1134$NL$
1135
1136$ Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“ŠÇ—ƒuƒƒbƒN‚̐¶¬
1137$IF num_isr > 0$
1138 ISRCB _kernel_isrcb_table[TNUM_ISR];$NL$
1139$ELSE$
1140 TOPPERS_EMPTY_LABEL(ISRCB, _kernel_isrcb_table);$NL$
1141$END$
1142$NL$
1143
1144$
1145$ Š„ž‚ÝŠÇ—‹@”\‚Ì‚½‚ß‚Ì•W€“I‚ȏ‰Šú‰»î•ñ‚̐¶¬
1146$
1147$ Š„ž‚݃nƒ“ƒhƒ‰‚̏‰Šú‰»‚É•K—v‚ȏî•ñ
1148$IF !OMIT_INITIALIZE_INTERRUPT || ALT(USE_INHINIB_TABLE,0)$
1149
1150$ Š„ž‚݃nƒ“ƒhƒ‰”
1151#define TNUM_INHNO $LENGTH(INH.ORDER_LIST)$$NL$
1152const uint_t _kernel_tnum_inhno = TNUM_INHNO;$NL$
1153$NL$
1154$FOREACH inhno INH.ORDER_LIST$
1155 $IF (INH.INHATR[inhno] & TA_NONKERNEL) == 0$
1156 INTHDR_ENTRY($INH.INHNO[inhno]$, $+INH.INHNO[inhno]$, $INH.INTHDR[inhno]$)$NL$
1157 $END$
1158$END$
1159$NL$
1160
1161$ Š„ž‚݃nƒ“ƒhƒ‰‰Šú‰»ƒe[ƒuƒ‹
1162$IF LENGTH(INH.ORDER_LIST)$
1163 const INHINIB _kernel_inhinib_table[TNUM_INHNO] = {$NL$
1164 $JOINEACH inhno INH.ORDER_LIST ",\n"$
1165 $IF (INH.INHATR[inhno] & TA_NONKERNEL) == 0$
1166 $TAB${ ($INH.INHNO[inhno]$), ($INH.INHATR[inhno]$), (FP)(INT_ENTRY($INH.INHNO[inhno]$, $INH.INTHDR[inhno]$)) }
1167 $ELSE$
1168 $TAB${ ($INH.INHNO[inhno]$), ($INH.INHATR[inhno]$), (FP)($INH.INTHDR[inhno]$) }
1169 $END$
1170 $END$$NL$
1171 };$NL$
1172$ELSE$
1173 TOPPERS_EMPTY_LABEL(const INHINIB, _kernel_inhinib_table);$NL$
1174$END$$NL$
1175$END$
1176
1177$ Š„ž‚Ý—v‹ƒ‰ƒCƒ“‚̏‰Šú‰»‚É•K—v‚ȏî•ñ
1178$IF !OMIT_INITIALIZE_INTERRUPT || ALT(USE_INTINIB_TABLE,0)$
1179
1180$ Š„ž‚Ý—v‹ƒ‰ƒCƒ“”
1181#define TNUM_INTNO $LENGTH(INT.ORDER_LIST)$$NL$
1182const uint_t _kernel_tnum_intno = TNUM_INTNO;$NL$
1183$NL$
1184
1185$ Š„ž‚Ý—v‹ƒ‰ƒCƒ“‰Šú‰»ƒe[ƒuƒ‹
1186$IF LENGTH(INT.ORDER_LIST)$
1187 const INTINIB _kernel_intinib_table[TNUM_INTNO] = {$NL$
1188 $JOINEACH intno INT.ORDER_LIST ",\n"$
1189 $TAB${ ($INT.INTNO[intno]$), ($INT.INTATR[intno]$), ($INT.INTPRI[intno]$) }
1190 $END$$NL$
1191 };$NL$
1192$ELSE$
1193 TOPPERS_EMPTY_LABEL(const INTINIB, _kernel_intinib_table);$NL$
1194$END$$NL$
1195$END$
1196
1197$
1198$ CPU—áŠOŠÇ—‹@”\
1199$
1200/*$NL$
1201$SPC$* CPU Exception Management Functions$NL$
1202$SPC$*/$NL$
1203$NL$
1204
1205$ CPU—áŠOƒnƒ“ƒhƒ‰‚ÉŠÖ‚·‚éƒGƒ‰[ƒ`ƒFƒbƒN
1206$i = 0$
1207$FOREACH excno EXC.ORDER_LIST$
1208$ // excno‚ªDEF_EXC‚ɑ΂·‚éCPU—áŠOƒnƒ“ƒhƒ‰”ԍ†‚Æ‚µ‚Đ³‚µ‚­‚È‚¢ê‡iE_PARj
1209 $IF !LENGTH(FIND(EXCNO_DEFEXC_VALID, EXC.EXCNO[excno]))$
1210 $ERROR EXC.TEXT_LINE[excno]$E_PAR: $FORMAT(_("illegal %1% `%2%\' in %3%"), "excno", EXC.EXCNO[excno], "DEF_EXC")$$END$
1211 $END$
1212
1213$ // excno‚ªDEF_EXC‚É‚æ‚Á‚ĐݒèÏ‚݂̏ꍇiE_OBJj
1214 $j = 0$
1215 $FOREACH excno2 EXC.ORDER_LIST$
1216 $IF EXC.EXCNO[excno] == EXC.EXCNO[excno2] && j < i$
1217 $ERROR EXC.TEXT_LINE[excno]$E_OBJ: $FORMAT(_("%1% `%2%\' in %3% is duplicated"), "excno", EXC.EXCNO[excno], "DEF_EXC")$$END$
1218 $END$
1219 $j = j + 1$
1220 $END$
1221
1222$ // excatr‚ªiTA_NULLj‚Å‚È‚¢ê‡iE_RSATRj
1223 $IF (EXC.EXCATR[excno] & ~TARGET_EXCATR) != 0$
1224 $ERROR EXC.TEXT_LINE[excno]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of %3% `%4%\' in %5%"), "excatr", EXC.EXCATR[excno], "excno", EXC.EXCNO[excno], "DEF_EXC")$$END$
1225 $END$
1226 $i = i + 1$
1227$END$
1228
1229$ CPU—áŠOƒnƒ“ƒhƒ‰‚Ì‚½‚ß‚Ì•W€“I‚ȏ‰Šú‰»î•ñ‚̐¶¬
1230$IF !OMIT_INITIALIZE_EXCEPTION$
1231
1232$ CPU—áŠOƒnƒ“ƒhƒ‰”
1233#define TNUM_EXCNO $LENGTH(EXC.ORDER_LIST)$$NL$
1234const uint_t _kernel_tnum_excno = TNUM_EXCNO;$NL$
1235$NL$
1236$FOREACH excno EXC.ORDER_LIST$
1237 EXCHDR_ENTRY($EXC.EXCNO[excno]$, $+EXC.EXCNO[excno]$, $EXC.EXCHDR[excno]$)$NL$
1238$END$
1239$NL$
1240
1241$ CPU—áŠOƒnƒ“ƒhƒ‰‰Šú‰»ƒe[ƒuƒ‹
1242$IF LENGTH(EXC.ORDER_LIST)$
1243 const EXCINIB _kernel_excinib_table[TNUM_EXCNO] = {$NL$
1244 $JOINEACH excno EXC.ORDER_LIST ",\n"$
1245 $TAB${ ($EXC.EXCNO[excno]$), ($EXC.EXCATR[excno]$), (FP)(EXC_ENTRY($EXC.EXCNO[excno]$, $EXC.EXCHDR[excno]$)) }
1246 $END$$NL$
1247 };$NL$
1248$ELSE$
1249 TOPPERS_EMPTY_LABEL(const EXCINIB, _kernel_excinib_table);$NL$
1250$END$$NL$
1251$END$
1252
1253$
1254$ ”ñƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg—p‚̃Xƒ^ƒbƒN—̈æ
1255$
1256/*$NL$
1257$SPC$* Stack Area for Non-task Context$NL$
1258$SPC$*/$NL$
1259$NL$
1260
1261$IF !LENGTH(ICS.ORDER_LIST)$
1262$ // DEF_ICS‚ª‚È‚¢ê‡‚̃fƒtƒHƒ‹ƒg’l‚̐ݒè
1263 #ifdef DEFAULT_ISTK$NL$
1264 $NL$
1265 #define TOPPERS_ISTKSZ DEFAULT_ISTKSZ$NL$
1266 #define TOPPERS_ISTK DEFAULT_ISTK$NL$
1267 $NL$
1268 #else /* DEAULT_ISTK */$NL$
1269 $NL$
1270 static STK_T _kernel_istack[COUNT_STK_T(DEFAULT_ISTKSZ)];$NL$
1271 #define TOPPERS_ISTKSZ ROUND_STK_T(DEFAULT_ISTKSZ)$NL$
1272 #define TOPPERS_ISTK _kernel_istack$NL$
1273 $NL$
1274 #endif /* DEAULT_ISTK */$NL$
1275$ELSE$
1276
1277$ // Ã“IAPIuDEF_ICSv‚ª•¡”‚ ‚éiE_OBJj
1278 $IF LENGTH(ICS.ORDER_LIST) > 1$
1279 $ERROR$E_OBJ: $FORMAT(_("too many %1%"), "DEF_ICS")$$END$
1280 $END$
1281
1282$ // istksz‚ª0ˆÈ‰º‚©Cƒ^[ƒQƒbƒg’è‹`‚̍ŏ¬’liTARGET_MIN_ISTKSZj‚æ‚è‚à
1283$ // ¬‚³‚¢ê‡iE_PARj
1284 $IF ICS.ISTKSZ[1] <= 0 || (TARGET_MIN_ISTKSZ
1285 && ICS.ISTKSZ[1] < TARGET_MIN_ISTKSZ)$
1286 $ERROR ICS.TEXT_LINE[1]$E_PAR: $FORMAT(_("%1% `%2%\' in %3% is too small"), "istksz", ICS.ISTKSZ[1], "DEF_ICS")$$END$
1287 $END$
1288
1289$ // istksz‚ªƒXƒ^ƒbƒN—̈æ‚̃TƒCƒY‚Æ‚µ‚Đ³‚µ‚­‚È‚¢ê‡iE_PARj
1290 $IF !EQ(ICS.ISTK[1], "NULL") && CHECK_STKSZ_ALIGN
1291 && (ICS.ISTKSZ[1] & (CHECK_STKSZ_ALIGN - 1))$
1292 $ERROR ICS.TEXT_LINE[1]$E_PAR: $FORMAT(_("%1% `%2%\' in %3% is not aligned"), "istksz", ICS.ISTKSZ[1], "DEF_ICS")$$END$
1293 $END$
1294
1295 $IF EQ(ICS.ISTK[1], "NULL")$
1296$ // ƒXƒ^ƒbƒN—̈æ‚ÌŽ©“®Š„•t‚¯
1297 static STK_T _kernel_istack[COUNT_STK_T($ICS.ISTKSZ[1]$)];$NL$
1298 #define TOPPERS_ISTKSZ ROUND_STK_T($ICS.ISTKSZ[1]$)$NL$
1299 #define TOPPERS_ISTK _kernel_istack$NL$
1300 $ELSE$
1301 #define TOPPERS_ISTKSZ ($ICS.ISTKSZ[1]$)$NL$
1302 #define TOPPERS_ISTK (void *)($ICS.ISTK[1]$)$NL$
1303 $END$
1304$END$
1305$NL$
1306
1307$ ”ñƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg—p‚̃Xƒ^ƒbƒN—̈æ
1308const SIZE _kernel_istksz = TOPPERS_ISTKSZ;$NL$
1309STK_T *const _kernel_istk = TOPPERS_ISTK;$NL$
1310$NL$
1311#ifdef TOPPERS_ISTKPT$NL$
1312STK_T *const _kernel_istkpt = TOPPERS_ISTKPT(TOPPERS_ISTK, TOPPERS_ISTKSZ);$NL$
1313#endif /* TOPPERS_ISTKPT */$NL$
1314$NL$
1315
1316$
1317$ ƒJ[ƒlƒ‹‚ªŠ„‚è•t‚¯‚郁ƒ‚ƒŠ—̈æ
1318$
1319/*$NL$
1320$SPC$* Memory Area Allocated by Kernel$NL$
1321$SPC$*/$NL$
1322$NL$
1323
1324$IF !LENGTH(KMM.ORDER_LIST)$
1325$ // DEF_KMM‚ª‚È‚¢ê‡‚̃fƒtƒHƒ‹ƒg’l‚̐ݒè
1326 #define TOPPERS_KMMSZ 0$NL$
1327 #define TOPPERS_KMM NULL$NL$
1328$ELSE$
1329$ // Ã“IAPIuDEF_KMMv‚ª•¡”‚ ‚éiE_OBJj
1330 $IF LENGTH(KMM.ORDER_LIST) > 1$
1331 $ERROR$E_OBJ: $FORMAT(_("too many %1%"), "DEF_KMM")$$END$
1332 $END$
1333
1334$ // kmmsz‚ª0ˆÈ‰º‚̏ꍇiE_PARj
1335 $IF KMM.KMMSZ[1] <= 0$
1336 $ERROR KMM.TEXT_LINE[1]$E_PAR: $FORMAT(_("%1% `%2%\' is zero in %3%"), "kmmsz", KMM.KMMSZ[1], "DEF_KMM")$$END$
1337 $END$
1338
1339$ // kmmsz‚ªƒJ[ƒlƒ‹‚ªŠ„‚è•t‚¯‚郁ƒ‚ƒŠ—̈æ‚̃TƒCƒY‚Æ‚µ‚Đ³‚µ‚­‚È‚¢ê‡iE_PARj
1340 $IF !EQ(KMM.KMM[1], "NULL") && CHECK_MB_ALIGN
1341 && (KMM.KMMSZ[1] & (CHECK_MB_ALIGN - 1))$
1342 $ERROR KMM.TEXT_LINE[1]$E_PAR: $FORMAT(_("%1% `%2%\' in %3% is not aligned"), "kmmsz", KMM.KMMSZ[1], "DEF_KMM")$$END$
1343 $END$
1344
1345 $IF EQ(KMM.KMM[1], "NULL")$
1346$ // ƒJ[ƒlƒ‹‚ªŠ„‚è•t‚¯‚郁ƒ‚ƒŠ—̈æ‚ÌŽ©“®Š„•t‚¯
1347 static MB_T _kernel_memory[TOPPERS_COUNT_SZ($KMM.KMMSZ[1]$, sizeof(MB_T))];$NL$
1348 #define TOPPERS_KMMSZ TOPPERS_ROUND_SZ($KMM.KMMSZ[1]$, sizeof(MB_T))$NL$
1349 #define TOPPERS_KMM _kernel_memory$NL$
1350 $ELSE$
1351 #define TOPPERS_KMMSZ ($KMM.KMMSZ[1]$)$NL$
1352 #define TOPPERS_KMM (void *)($KMM.KMM[1]$)$NL$
1353 $END$
1354$END$
1355$NL$
1356
1357$ ƒJ[ƒlƒ‹‚ªŠ„‚è•t‚¯‚郁ƒ‚ƒŠ—̈æ
1358const SIZE _kernel_kmmsz = TOPPERS_KMMSZ;$NL$
1359MB_T *const _kernel_kmm = TOPPERS_KMM;$NL$
1360$NL$
1361
1362$
1363$ ƒ^ƒCƒ€ƒCƒxƒ“ƒgŠÇ—
1364$
1365/*$NL$
1366$SPC$* Time Event Management$NL$
1367$SPC$*/$NL$
1368$NL$
1369TMEVTN _kernel_tmevt_heap[TNUM_TSKID + TNUM_CYCID + TNUM_ALMID];$NL$
1370$NL$
1371
1372$
1373$ Šeƒ‚ƒWƒ…
1374[ƒ‹‚̏‰Šú‰»ŠÖ”
1375$
1376/*$NL$
1377$SPC$* Module Initialization Function$NL$
1378$SPC$*/$NL$
1379$NL$
1380void$NL$
1381_kernel_initialize_object(void)$NL$
1382{$NL$
1383$TAB$_kernel_initialize_task();$NL$
1384$IF num_semid$$TAB$_kernel_initialize_semaphore();$NL$$END$
1385$IF num_flgid$$TAB$_kernel_initialize_eventflag();$NL$$END$
1386$IF num_dtqid$$TAB$_kernel_initialize_dataqueue();$NL$$END$
1387$IF num_pdqid$$TAB$_kernel_initialize_pridataq();$NL$$END$
1388$IF num_mbxid$$TAB$_kernel_initialize_mailbox();$NL$$END$
1389$IF num_mpfid$$TAB$_kernel_initialize_mempfix();$NL$$END$
1390$IF num_cycid$$TAB$_kernel_initialize_cyclic();$NL$$END$
1391$IF num_almid$$TAB$_kernel_initialize_alarm();$NL$$END$
1392$TAB$_kernel_initialize_interrupt();$NL$
1393$IF num_isr$$TAB$_kernel_initialize_isr();$NL$$END$
1394$TAB$_kernel_initialize_exception();$NL$
1395}$NL$
1396$NL$
1397
1398$
1399$ ‰Šú‰»ƒ‹[ƒ`ƒ“‚ÌŽÀsŠÖ”
1400$
1401/*$NL$
1402$SPC$* Initialization Routine$NL$
1403$SPC$*/$NL$
1404$NL$
1405void$NL$
1406_kernel_call_inirtn(void)$NL$
1407{$NL$
1408$FOREACH order INI.ORDER_LIST$
1409$ // iniatr‚ªiTA_NULLj‚Å‚È‚¢ê‡iE_RSATRj
1410 $IF INI.INIATR[order] != 0$
1411 $ERROR INI.TEXT_LINE[order]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of %3% `%4%\' in %5%"), "iniatr", INI.INIATR[order], "inirtn", INI.INIRTN[order], "ATT_INI")$$END$
1412 $END$
1413 $TAB$((INIRTN)($INI.INIRTN[order]$))((intptr_t)($INI.EXINF[order]$));$NL$
1414$END$
1415}$NL$
1416$NL$
1417
1418$
1419$ I—¹ˆ—ƒ‹[ƒ`ƒ“‚ÌŽÀsŠÖ”
1420$
1421/*$NL$
1422$SPC$* Termination Routine$NL$
1423$SPC$*/$NL$
1424$NL$
1425void$NL$
1426_kernel_call_terrtn(void)$NL$
1427{$NL$
1428$FOREACH rorder TER.RORDER_LIST$
1429$ // teratr‚ªiTA_NULLj‚Å‚È‚¢ê‡iE_RSATRj
1430 $IF TER.TERATR[rorder] != 0$
1431 $ERROR TER.TEXT_LINE[rorder]$E_RSATR: $FORMAT(_("illegal %1% `%2%\' of %3% `%4%\' in %5%"), "teratr", TER.TERATR[rorder], "terrtn", TER.TERRTN[rorder], "ATT_TER")$$END$
1432 $END$
1433 $TAB$((TERRTN)($TER.TERRTN[rorder]$))((intptr_t)($TER.EXINF[rorder]$));$NL$
1434$END$
1435}$NL$
1436$NL$
Note: See TracBrowser for help on using the repository browser.