source: ssp_qb_r5f100le_cs/trunk/arch/rl78_ca78k0r/prc.tf@ 93

Last change on this file since 93 was 93, checked in by nmir-saito, 8 years ago

add Combined package of SSP kernel for QB-R5F100LE-TB(RL78 processor)

File size: 8.7 KB
Line 
1$
2$ TOPPERS/SSP Kernel
3$ Smallest Set Profile Kernel
4$
5$ Copyright (C) 2008 by Witz Corporation, JAPAN
6$ Copyright (C) 2010-2014 by Naoki Saito
7$ Nagoya Municipal Industrial Research Institute, JAPAN
8$
9$ ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì (1)`(4) ‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
10$ ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü•ÏE
11$ Ä”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
12$ (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ìŒ 
13$ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[ƒX
14$ ƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
15$ (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg—p
16$ ‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
17ƒƒ“ƒgi—˜—pŽÒƒ}
18$ ƒjƒ…
19ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•Û
20$ Ø‹K’è‚ðŒfÚ‚·‚邱‚ƁD
21$ (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg—p
22$ ‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±‚ƁD
23$ (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
24ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
25ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ì
26$ Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
27$ (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É•ñ
28$ ‚·‚邱‚ƁD
29$ (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹ŠQ
30$ ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD‚Ü‚½C
31$ –{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝—R‚ÉŠî‚Ã
32$ ‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
33$
34$ –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨‚æ
35$ ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I‚ɑ΂·
36$ ‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p
37$ ‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»‚̐ӔC‚ð•‰
38$ ‚í‚È‚¢D
39$
40
41$
42$ ƒvƒƒZƒbƒTˆË‘¶ƒeƒ“ƒvƒŒ[ƒg
43$
44
45$
46$ ATT_ISR‚ÅŽg—p‚Å‚«‚銄ž‚ݔԍ†‚Æ‚»‚ê‚ɑΉž‚·‚銄ž‚݃nƒ“ƒhƒ‰”ԍ†
47$
48
49$INTNO_ATTISR_VALID = INTNO_VALID$
50$INHNO_ATTISR_VALID = INHNO_VALID$
51
52$
53$ DEF_INH^DEF_EXC‚ÅŽg—p‚Å‚«‚銄ž‚݃nƒ“ƒhƒ‰”ԍ†^CPU—áŠOƒnƒ“ƒhƒ‰”ԍ†
54$
55
56$INHNO_DEFINH_VALID = INHNO_VALID$
57$EXCNO_DEFEXC_VALID = EXCNO_VALID$
58
59$
60$ CFG_INT‚ÅŽg—p‚Å‚«‚銄ž‚ݔԍ†‚ÆŠ„ž‚Ý—Dæ“x
61$
62
63$INTNO_CFGINT_VALID = INTNO_VALID$
64
65$ // INTPRI_CFGINT_VALID ‚̓vƒƒZƒbƒT‚ɃZƒbƒg‰Â”\‚È—Dæ“x‚Ì”ÍˆÍ‚ðŽ¦‚µC
66$ // ƒJ[ƒlƒ‹ŠÇ—(ŠO)‚©‚Ç‚¤‚©‚Ì‹æ•Ê‚ð‚µ‚Ä‚¢‚È‚¢D
67$ // ƒJ[ƒlƒ‹ŠÇ—‚ƂȂ銄ž‚Ý—Dæ“x‚͈̔͂ð•ÏX‚·‚éê‡C
68$ // TMIN_INTPRI (prc_kernel.h) ‚Ì’l‚ð•K—v‚ɉž‚¶‚ĕύX‚·‚éD
69$INTPRI_CFGINT_VALID = { -4,-3,-2,-1 }$
70
71$
72$ ƒXƒ^ƒbƒNƒTƒCƒY‚̃`ƒFƒbƒN•û–@Žw’è
73$
74$ ƒAƒ‰ƒCƒƒ“ƒg‚ÉŠÖŒW‚È‚­“¯‚¶‘¬“x‚ŃAƒNƒZƒX‚Å‚«‚é
75$
76
77$CHECK_STKSZ_ALIGN = 1$
78
79
80$
81$ ’萔’è‹`
82$
83$TA_POSEDGE = TA_EDGE$
84
85$
86$ ƒ^[ƒQƒbƒgˆË‘¶‚ÌŠ„ž‚Ý‘®«‚Ì’è‹`
87$
88
89$TARGET_INTATR = TA_POSEDGE | TA_NEGEDGE | TA_BOTHEDGE$
90
91$
92$ •W€ƒeƒ“ƒvƒŒ[ƒgƒtƒ@ƒCƒ‹‚̃Cƒ“ƒNƒ‹[ƒh
93$
94$INCLUDE "kernel.tf"$
95
96
97$
98$ CFG_INT‚̃^[ƒQƒbƒgˆË‘¶‚̃Gƒ‰[ƒ`ƒFƒbƒN
99$
100$
101$
102
103$FOREACH intno INT.ORDER_LIST$
104$ // INTŠ„ž‚݂ɑ΂·‚銄ž‚ݔԍ†‚©‚Ç‚¤‚©
105 $IF (LENGTH(FIND(INTNO_INT , INT.INTNO[intno])) != 0)$
106$ // TA_POSEDGE ‚Ü‚½‚Í TA_NEGEDGE ‚Ü‚½‚Í TA_BOTHEDGE ‚ª“¯Žž‚ɐݒ肳‚ê‚Ä‚È‚¢‚©‚Ç‚¤‚©
107 $IF
108 ( ((INT.INTATR[intno] & (TA_POSEDGE|TA_NEGEDGE|TA_BOTHEDGE)) != (TA_POSEDGE))
109 & ((INT.INTATR[intno] & (TA_POSEDGE|TA_NEGEDGE|TA_BOTHEDGE)) != (TA_NEGEDGE))
110 & ((INT.INTATR[intno] & (TA_POSEDGE|TA_NEGEDGE|TA_BOTHEDGE)) != (TA_BOTHEDGE))
111 )$
112 $ERROR$ INT.TEXT_LINE[intno]:$FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "intatr", INT.INTATR[intno], INT.INTNO[intno], "CFG_INT")$$END$
113 $END$
114 $ELSE$
115$ // INTŠ„ž‚݈ȊO‚ÌŠ„ž‚݂ɑ΂µ‚Ä TA_ENAINT ‹y‚Ñ TA_EDGE ˆÈŠO‚ÌŠ„ž‚Ý‘®«‚ªŽw’肳‚ê‚Ä‚¢‚È‚¢‚©‚Ç‚¤‚©
116 $IF (INT.INTATR[intno] & ~(TA_ENAINT|TA_EDGE)) != 0$
117 $ERROR$ INT.TEXT_LINE[intno]: $FORMAT(_("illegal %1% `%2%\' of `%3%\' in %4%"), "intatr", INT.INTATR[intno], INT.INTNO[intno], "CFG_INT")$$END$
118 $END$
119 $END$
120$END$
121
122
123$
124$ Š„ž‚ݔԍ†‚©‚犄ž‚Ý—Dæ“x‚ðŽæ‚èo‚·ƒe[ƒuƒ‹
125$
126
127$FILE "kernel_cfg.c"$
128
129const PRI _kernel_intpri_table[$LENGTH(INTNO_RANGE)$] = $NL$
130{
131$FOREACH intno INTNO_RANGE$
132 $IF LENGTH(INT.INTNO[intno])$
133 $intpri = INT.INTPRI[intno]$
134 $ELSE$
135 $intpri = "0"$
136 $END$
137 $TAB$$FORMAT("INT8_C(%2d), /* %02u */", intpri , +intno)$$NL$
138$END$
139};$NL$$NL$
140
141
142$
143$ ƒA[ƒLƒeƒNƒ`ƒƒˆË‘¶ƒeƒ“ƒvƒŒ[ƒgiƒAƒZƒ“ƒuƒ‰ŒÅ—L•”•ªj
144$
145
146$
147$ ƒAƒZƒ“ƒuƒ‰o—̓tƒ@ƒCƒ‹ (‹¤’Ê•”•ª)
148$
149
150$FILE "kernel_cfg_asm.asm"$
151
152;$NL$
153; RL78ƒA[ƒLƒeƒNƒ`ƒƒˆË‘¶o—̓tƒ@ƒCƒ‹$NL$
154;$NL$
155; Š„ž‚݃nƒ“ƒhƒ‰“üŒûˆ—‚Ì’è‹`$NL$
156;$NL$
157$NL$$NL$
158
159
160$
161$ Š„ž‚Ý“üŒûˆ—
162$
163
164$
165$ ƒOƒ[ƒoƒ‹ƒVƒ“ƒ{ƒ‹
166$
167
168$TAB$extrn __kernel_interrupt_entry $NL$
169$TAB$extrn __kernel_int_return$NL$$NL$
170
171$TAB$; ƒRƒ“ƒpƒCƒ‰‚ªŽg—p‚·‚é saddr—̈æ‚̃ŒƒWƒXƒ^$NL$
172$TAB$extrn _@RTARG0,_@RTARG2,_@RTARG4,_@RTARG6,_@SEGAX,_@SEGDE$NL$
173$TAB$extrn _@NRARG0,_@NRARG1,_@NRARG2,_@NRARG3$NL$
174$TAB$extrn _@NRAT00,_@NRAT02,_@NRAT04,_@NRAT06$NL$
175$NL$
176
177; $NL$
178; ƒRƒ“ƒpƒCƒ‰‚ªŽg—p‚·‚ésaddr—̈æ‚Ì‘Þ”ð $NL$
179; $NL$
180save_saddr_regs macro$NL$
181 $TAB$movw ax, _@RTARG0 $NL$
182 $TAB$push ax $NL$
183 $TAB$movw ax, _@RTARG2 $NL$
184 $TAB$push ax $NL$
185 $TAB$movw ax, _@RTARG4 $NL$
186 $TAB$push ax $NL$
187 $TAB$movw ax, _@RTARG6 $NL$
188 $TAB$push ax $NL$
189 $TAB$movw ax, _@SEGAX $NL$
190 $TAB$push ax $NL$
191 $TAB$movw ax, _@SEGDE $NL$
192 $TAB$push ax $NL$
193 $TAB$$$if (ALLOC_REGVAR_TO_SADDR) ; -qr ƒIƒvƒVƒ‡ƒ“‚ðŽg—p‚·‚éê‡ $NL$
194 $TAB$movw ax, _@NRARG0 $NL$
195 $TAB$push ax $NL$
196 $TAB$movw ax, _@NRARG1 $NL$
197 $TAB$push ax $NL$
198 $TAB$movw ax, _@NRARG2 $NL$
199 $TAB$push ax $NL$
200 $TAB$movw ax, _@NRARG3 $NL$
201 $TAB$push ax $NL$
202 $TAB$movw ax, _@NRAT00 $NL$
203 $TAB$push ax $NL$
204 $TAB$movw ax, _@NRAT02 $NL$
205 $TAB$push ax $NL$
206 $TAB$movw ax, _@NRAT04 $NL$
207 $TAB$push ax $NL$
208 $TAB$movw ax, _@NRAT06 $NL$
209 $TAB$push ax $NL$
210 $TAB$$$endif$NL$
211 $TAB$endm$NL$
212 $NL$
213
214@@BASE$TAB$CSEG BASE$NL$
215
216$
217$ Š„ž‚݃nƒ“ƒhƒ‰“üŒûˆ—
218$
219
220$FOREACH inhno INHNO_RANGE$
221 $IF LENGTH(INH.INHNO[inhno])$
222 $TAB$extrn _$INH.INTHDR[inhno]$ $NL$
223 $TAB$public __kernel_$INH.INTHDR[inhno]$_$+INH.INHNO[inhno]$_entry $NL$
224 __kernel_$INH.INTHDR[inhno]$_$+INH.INHNO[inhno]$_entry: $NL$
225 $TAB$push ax ; ƒŒƒWƒXƒ^‚ðƒ^ƒXƒNƒXƒ^ƒbƒN‚Ö‘Þ”ð $NL$
226 $TAB$push bc $NL$
227 $TAB$push de $NL$
228 $TAB$push hl $NL$
229 $TAB$mov a,es ; ES, CS ‚Ì‘Þ”ð $NL$
230 $TAB$mov x,a $NL$
231 $TAB$mov a,cs $NL$
232 $TAB$push ax $NL$
233 $TAB$save_saddr_regs$NL$
234 $TAB$movw bc, #_$INH.INTHDR[inhno]$ ; ƒnƒ“ƒhƒ‰‚̃AƒhƒŒƒX‚ð bc ‚Ö $NL$
235
236 $IF (INH.INHATR[inhno] & TA_NONKERNEL) == 0$
237 $TAB$br __kernel_interrupt_entry ; ‹¤’Ê‚Ì“üŒûˆ—‚Ö $NL$
238 $NL$$NL$
239 $ELSE$
240 $TAB$;ƒJ[ƒlƒ‹ŠÇ—ŠO‚ÌŠ„ž‚݂̏ꍇCƒnƒ“ƒhƒ‰ŽÀs‚µ‚Ä‚»‚̂܂܃Šƒ^[ƒ“ $NL$
241 $TAB$call bc ; Š„ž‚݃nƒ“ƒhƒ‰ŒÄ‚яo‚µ$NL$
242 $TAB$br __kernel_int_return ; ƒŒƒWƒXƒ^•œ‹A & Š„ž‚Ý‚©‚烊ƒ^[ƒ“(prc_support.asm) $NL$
243 $END$
244 $END$
245$END$
246
247
248$
249$ CPU—áŠOƒnƒ“ƒhƒ‰“üŒûˆ—
250$
251
252$FOREACH excno EXCNO_RANGE$
253 $IF LENGTH(EXC.EXCNO[excno])$
254 $TAB$extrn _$EXC.EXCHDR[excno]$ $NL$
255 $TAB$public __kernel_$EXC.EXCHDR[excno]$_$+EXC.EXCNO[excno]$_entry $NL$
256 __kernel_$EXC.EXCHDR[excno]$_$+EXC.EXCNO[excno]$_entry: $NL$
257 $TAB$push ax ; ƒŒƒWƒXƒ^‚ðƒ^ƒXƒNƒXƒ^ƒbƒN‚Ö‘Þ”ð $NL$
258 $TAB$push bc $NL$
259 $TAB$push de $NL$
260 $TAB$push hl $NL$
261 $TAB$mov a,es ; ES, CS ‚Ì‘Þ”ð $NL$
262 $TAB$mov x,a $NL$
263 $TAB$mov a,cs $NL$
264 $TAB$push ax $NL$
265 $TAB$save_saddr_regs $NL$
266 $TAB$movw ax, sp ; SP(ƒnƒ“ƒhƒ‰‚̈ø”‚Æ‚È‚é)‚ð ax ‚Ö $NL$
267 $TAB$movw bc, #_$EXC.EXCHDR[excno]$ ; ƒnƒ“ƒhƒ‰‚̃AƒhƒŒƒX‚ð bc ‚Ö $NL$
268 $TAB$br __kernel_interrupt_entry ; ‹¤’Ê‚Ì“üŒûˆ—‚Ö $NL$
269 $NL$$NL$
270 $END$
271$END$
272
273
274$
275$ ƒxƒNƒ^ƒe[ƒuƒ‹
276$
277
278;$NL$
279; ƒxƒNƒ^ƒe[ƒuƒ‹$NL$
280;$NL$
281$NL$
282
283$TAB$extrn $TAB$ _unused_interrupt $NL$
284$TAB$org 0004h$NL$$NL$
285$FOREACH inhno INHNO_RANGE$
286 $IF LENGTH(INH.INHNO[inhno])$
287 $inhhdr = CONCAT(CONCAT("_kernel_" , CONCAT(INH.INTHDR[inhno] , "_")) , CONCAT(+INH.INHNO[inhno] , "_entry"))$
288 $ELSE$
289 $inhhdr = "unused_interrupt"$
290 $END$
291 $TAB$dw$TAB$_$inhhdr$ $TAB$ $TAB$ $FORMAT("; %02d" , inhno)$ $NL$
292$END$
293$NL$$NL$
294
295$TAB$org 007eh$NL$$NL$
296$FOREACH excno EXCNO_RANGE$
297 $IF LENGTH(EXC.EXCNO[excno])$
298 $exchdr = CONCAT(CONCAT("_kernel_" , CONCAT(EXC.EXCHDR[excno] , "_")) , CONCAT(+EXC.EXCNO[excno] , "_entry"))$
299 $ELSE$
300 $exchdr = "unused_interrupt"$
301 $END$
302 $TAB$dw$TAB$_$exchdr$ $TAB$ $TAB$ $FORMAT("; %02d" , excno)$ $NL$
303$END$
304$NL$$NL$
305
306 $TAB$end
307$NL$
308
309$
310$ prc_support.asm —pƒ}ƒNƒ’è‹`ƒtƒ@ƒCƒ‹
311$
312
313$FILE "prc_support_def.inc"$
314
315$IF TMIN_INTPRI == -4$
316 TMIN_INTPRI_EQU_MINUS4 equ 1 $NL$
317$ELSE$
318 TMIN_INTPRI_EQU_MINUS4 equ 0 $NL$
319$END$
Note: See TracBrowser for help on using the repository browser.