source: UsbWattMeter/trunk/asp_dcre/kernel/startup.c@ 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/x-csrc
File size: 4.4 KB
RevLine 
[164]1/*
2 * TOPPERS/ASP Kernel
3 * Toyohashi Open Platform for Embedded Real-Time Systems/
4 * Advanced Standard Profile Kernel
5 *
6 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
7 * Toyohashi Univ. of Technology, JAPAN
8 * Copyright (C) 2005-2010 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: startup.c 164 2016-03-07 11:33:50Z coas-nagasima $
45 */
46
47/*
48 * ƒJ[ƒlƒ‹‚̏‰Šú‰»‚ƏI—¹ˆ—
49 */
50
51#include "kernel_impl.h"
52#include "time_event.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#ifdef TOPPERS_sta_ker
75
76/*
77 * ƒJ[ƒlƒ‹“®ìó‘Ôƒtƒ‰ƒO
78 *
79 * ƒXƒ^[ƒgƒAƒbƒvƒ‹[ƒ`ƒ“‚ŁCfalsei0j‚ɏ‰Šú‰»‚³‚ê‚邱‚Æ‚ðŠú‘Ò‚µ‚Ä
80 * ‚¢‚éD
81 */
82bool_t kerflg = false;
83
84/*
85 * ƒJ[ƒlƒ‹‚Ì‹N“®
86 */
87void
88sta_ker(void)
89{
90 /*
91 * ƒ^[ƒQƒbƒgˆË‘¶‚̏‰Šú‰»
92 */
93 target_initialize();
94
95 /*
96 * Šeƒ‚ƒWƒ…
97[ƒ‹‚̏‰Šú‰»
98 *
99 * ƒ^ƒCƒ€ƒCƒxƒ“ƒgŠÇ—ƒ‚ƒWƒ…
100[ƒ‹‚Í‘¼‚̃‚ƒWƒ…
101[ƒ‹‚æ‚èæ‚ɏ‰Šú‰»
102 * ‚·‚é•K—v‚ª‚ ‚éD
103 */
104 initialize_kmm();
105 initialize_tmevt();
106 initialize_object();
107
108 /*
109 * ‰Šú‰»ƒ‹[ƒ`ƒ“‚ÌŽÀs
110 */
111 call_inirtn();
112
113 /*
114 * ƒJ[ƒlƒ‹“®ì‚ÌŠJŽn
115 */
116 kerflg = true;
117 LOG_KER_ENTER();
118 start_dispatch();
119 assert(0);
120}
121
122#endif /* TOPPERS_sta_ker */
123
124/*
125 * ƒJ[ƒlƒ‹‚̏I—¹
126 */
127#ifdef TOPPERS_ext_ker
128
129ER
130ext_ker(void)
131{
132 SIL_PRE_LOC;
133
134 LOG_EXT_KER_ENTER();
135
136 /*
137 * Š„ž‚݃ƒbƒNó‘ԂɈڍs
138 */
139 SIL_LOC_INT();
140
141 /*
142 * ƒJ[ƒlƒ‹“®ì‚̏I—¹
143 */
144 LOG_KER_LEAVE();
145 kerflg = false;
146
147 /*
148 * ƒJ[ƒlƒ‹‚̏I—¹ˆ—‚̌ďo‚µ
149 *
150 * ”ñƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg‚ɐ؂芷‚¦‚āCexit_kernel‚ðŒÄ‚яo‚·D
151 */
152 call_exit_kernel();
153
154 /*
155 * ƒRƒ“ƒpƒCƒ‰‚ÌŒx‘΍ôi‚±‚±‚Ö—ˆ‚邱‚Æ‚Í‚È‚¢‚Í‚¸j
156 */
157 SIL_UNL_INT();
158 LOG_EXT_KER_LEAVE(E_SYS);
159 return(E_SYS);
160}
161
162/*
163 * ƒJ[ƒlƒ‹‚̏I—¹ˆ—
164 */
165void
166exit_kernel(void)
167{
168 /*
169 * I—¹ˆ—ƒ‹[ƒ`ƒ“‚ÌŽÀs
170 */
171 call_terrtn();
172
173 /*
174 * ƒ^[ƒQƒbƒgˆË‘¶‚̏I—¹ˆ—
175 */
176 target_exit();
177 assert(0);
178}
179
180#endif /* TOPPERS_ext_ker */
181
182/*
183 * ƒJ[ƒlƒ‹‚ÌŠ„‚è•t‚¯‚郁ƒ‚ƒŠ—̈æ‚ÌŠÇ—
184 *
185 * ƒƒ‚ƒŠ—̈æ‚ðæ“ª‚©‚珇‚ÉŠ„‚è“–‚āC‰ð•ú‚³‚ꂽƒƒ‚ƒŠ—̈æ‚ðÄ—˜—p‚µ‚È
186 * ‚¢ƒƒ‚ƒŠŠÇ—ƒ‚ƒWƒ…
187[ƒ‹D
188 */
189#ifdef TOPPERS_kermem
190#ifndef OMIT_KMM_ALLOCONLY
191
192static void *kmm_brk;
193
194void
195initialize_kmm(void)
196{
197 kmm_brk = ((char *) kmm) + kmmsz;
198}
199
200void *
201kernel_malloc(SIZE size)
202{
203 if (((char *) kmm_brk) - ((char *) kmm) >= size) {
204 kmm_brk = ((char *) kmm_brk) - size;
205 return(kmm_brk);
206 }
207 else {
208 return(NULL);
209 }
210}
211
212void
213kernel_free(void *ptr)
214{
215}
216
217#endif /* OMIT_KMM_ALLOCONLY */
218#endif /* TOPPERS_kermem */
Note: See TracBrowser for help on using the repository browser.