source: uKadecot/trunk/ssp/kernel/startup.c@ 101

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

TOPPERS/uKadecotのソースコードを追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/plain
File size: 3.9 KB
Line 
1/*
2 * TOPPERS/SSP Kernel
3 * Smallest Set Profile Kernel
4 *
5 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
6 * Toyohashi Univ. of Technology, JAPAN
7 * Copyright (C) 2005-2009 by Embedded and Real-Time Systems Laboratory
8 * Graduate School of Information Science, Nagoya Univ., JAPAN
9 * Copyright (C) 2010 by Naoki Saito
10 * Nagoya Municipal Industrial Research Institute, JAPAN
11 * Copyright (C) 2010-2011 by Meika Sugimoto
12 *
13 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì (1)`(4) ‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
14 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü•ÏE
15 * Ä”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
16 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ìŒ 
17 * •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[ƒX
18 * ƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
19 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg—p
20 * ‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
21ƒƒ“ƒgi—˜—pŽÒƒ}
22 * ƒjƒ…
23ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•Û
24 * Ø‹K’è‚ðŒfÚ‚·‚邱‚ƁD
25 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg—p
26 * ‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±‚ƁD
27 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
28ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
29ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ì
30 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
31 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É•ñ
32 * ‚·‚邱‚ƁD
33 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹ŠQ
34 * ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD‚Ü‚½C
35 * –{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝—R‚ÉŠî‚Ã
36 * ‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚Ɓ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ƒA‚Ì—˜—p
41 * ‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»‚̐ӔC‚ð•‰
42 * ‚í‚È‚¢D
43 *
44 */
45
46/*
47 * ƒJ[ƒlƒ‹‚̏‰Šú‰»‚ƏI—¹ˆ—
48 */
49
50#include "task.h"
51#include "t_stddef.h"
52#include "kernel_impl.h"
53#include <sil.h>
54
55/*
56 * ƒgƒŒ[ƒXƒƒOƒ}ƒNƒ‚̃fƒtƒHƒ‹ƒg’è‹`
57 */
58#ifndef LOG_KER_ENTER
59#define LOG_KER_ENTER()
60#endif /* LOG_KER_ENTER */
61
62#ifndef LOG_KER_LEAVE
63#define LOG_KER_LEAVE()
64#endif /* LOG_KER_LEAVE */
65
66#ifndef LOG_EXT_KER_ENTER
67#define LOG_EXT_KER_ENTER()
68#endif /* LOG_EXT_KER_ENTER */
69
70#ifndef LOG_EXT_KER_LEAVE
71#define LOG_EXT_KER_LEAVE(ercd)
72#endif /* LOG_EXT_KER_LEAVE */
73
74
75#ifdef TOPPERS_sta_ker
76
77/*
78 * ƒJ[ƒlƒ‹“®ìó‘Ôƒtƒ‰ƒO
79 *
80 * ƒXƒ^[ƒgƒAƒbƒvƒ‹[ƒ`ƒ“‚ŁCfalsei0j‚ɏ‰Šú‰»‚³‚ê‚邱‚Æ‚ðŠú‘Ò‚µ‚Ä
81 * ‚¢‚éD
82 */
83bool_t kerflg = false;
84
85/*
86 * ƒJ[ƒlƒ‹‚Ì‹N“®
87 * NMI‚ðœ‚­‘S‚Ä‚ÌŠ„ž‚Ý‚ªƒ}ƒXƒN‚³‚ꂽó‘Ô(‘SŠ„ž‚݃ƒbƒNó‘Ô‚É‘Š“–)‚ŌĂяo‚³‚ê‚éD
88 */
89void
90sta_ker(void)
91{
92 target_initialize();
93
94 initialize_object();
95
96 call_inirtn();
97
98 /*
99 * ƒJ[ƒlƒ‹‚Ì“®ì‚ðŠJŽn‚·‚éD
100 */
101 kerflg = true;
102
103 /* ƒfƒBƒXƒpƒbƒ`ƒƒ‚ð‹N“®‚µCƒ^ƒXƒN‚Ì“®ì‚ðŠJŽn‚·‚é */
104 LOG_KER_ENTER();
105 start_dispatch();
106 assert(false);
107}
108
109#endif /* TOPPERS_sta_ker */
110
111#ifdef TOPPERS_ext_ker
112
113/*
114 * ƒJ[ƒlƒ‹‚̏I—¹
115 */
116ER
117ext_ker(void)
118{
119 SIL_PRE_LOC;
120
121 LOG_EXT_KER_ENTER();
122
123 /*
124 * Š„ž‚݃ƒbƒNó‘ԂɈڍs
125 */
126 SIL_LOC_INT();
127
128 /*
129 * ƒJ[ƒlƒ‹“®ì‚̏I—¹
130 */
131 LOG_KER_LEAVE();
132 kerflg = false;
133
134 /*
135 * ƒJ[ƒlƒ‹‚̏I—¹ˆ—‚̌ďo‚µ
136 *
137 * ”ñƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg‚ɐ؂芷‚¦‚āCexit_kernel‚ðŒÄ‚яo‚·D
138 */
139 call_exit_kernel();
140
141 /*
142 * SIL_UNL_INT‚ðŒÄ‚яo‚·‚ªC‚±‚±‚É“ž’B‚·‚邱‚Æ‚Í‚È‚¢D
143 * ‹Lq‚·‚é‚Ì‚ÍSIL_PRE_LOC‚Ő錾‚³‚ê‚é•Ï”‚ª‚ ‚éê‡‚ɁC
144 * ƒRƒ“ƒpƒCƒ‰‚ªo—Í‚·‚éŒx‚ð—}§‚·‚邽‚ß‚Å‚ ‚éD
145 */
146 SIL_UNL_INT();
147 LOG_EXT_KER_LEAVE(E_SYS)
148
149 return E_SYS;
150}
151
152
153/*
154 * ƒJ[ƒlƒ‹‚̏I—¹ˆ—
155 */
156void
157exit_kernel(void)
158{
159 /*
160 * I—¹ˆ—ƒ‹[ƒ`ƒ“‚ÌŽÀs
161 */
162 call_terrtn();
163
164 /*
165 * ƒ^[ƒQƒbƒgˆË‘¶‚̏I—¹ˆ—
166 */
167 target_exit();
168 assert(false);
169}
170
171#endif /* TOPPERS_ext_ker */
Note: See TracBrowser for help on using the repository browser.