source: UsbWattMeter/trunk/asp_dcre/arch/rx630_msvc/prc_config.h@ 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-chdr
File size: 16.3 KB
Line 
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,2006 by Embedded and Real-Time Systems Laboratory
9 * Graduate School of Information Science, Nagoya Univ., JAPAN
10 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN
11 *
12 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì(1)`(4)‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
13 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
14 * •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
15 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
16 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
17 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
18 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
19 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
20ƒƒ“ƒgi—˜—p
21 * ŽÒƒ}ƒjƒ…
22ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
23 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
24 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
25 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
26 * ‚Ɓ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‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
34 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
35 * ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
36 * —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
37 * –Ɛӂ·‚邱‚ƁD
38 *
39 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
40 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
41 * ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
42 * ƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»
43 * ‚̐ӔC‚𕉂í‚È‚¢D
44 *
45 * @(#) $Id: prc_config.h 164 2016-03-07 11:33:50Z coas-nagasima $
46 */
47
48/*
49 * ƒvƒƒZƒbƒTˆË‘¶ƒ‚ƒWƒ…
50[ƒ‹iRX630—pj
51 *
52 * ‚±‚̃Cƒ“ƒNƒ‹[ƒhƒtƒ@ƒCƒ‹‚́Ctarget_config.hi‚Ü‚½‚́C‚»‚±‚©‚çƒCƒ“ƒN
53 * ƒ‹[ƒh‚³‚ê‚éƒtƒ@ƒCƒ‹j‚Ì‚Ý‚©‚çƒCƒ“ƒNƒ‹[ƒh‚³‚ê‚éD‘¼‚̃tƒ@ƒCƒ‹‚©‚ç
54 * ’¼ÚƒCƒ“ƒNƒ‹[ƒh‚µ‚Ä‚Í‚È‚ç‚È‚¢D
55 */
56
57#ifndef TOPPERS_PRC_CONFIG_H
58#define TOPPERS_PRC_CONFIG_H
59
60#ifndef TOPPERS_MACRO_ONLY
61
62/*
63 * ƒvƒƒZƒbƒT‚Ì“ÁŽê–½—߂̃Cƒ“ƒ‰ƒCƒ“ŠÖ”’è‹`
64 */
65#include "prc_insn.h"
66#include "sil.h"
67
68/*
69 * ”ñƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg—p‚̃Xƒ^ƒbƒN‰Šú’l
70 */
71
72#define TOPPERS_ISTKPT( istk, istksz ) (( STK_T * )(( char * )( istk ) + ( istksz )))
73
74/*
75 * ƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒgƒuƒƒbƒN‚Ì’è‹`
76 */
77typedef struct task_context_block {
78 void (*start)(void);
79 void *cpu_context;
80} TSKCTXB;
81
82
83/*
84 * Š„ž‚Ý”­¶‰ñ”‚ð•Û‘¶‚·‚é•Ï”
85 */
86extern uint16_t intnest;
87
88
89/*
90 * CPUƒƒbƒNó‘Ô‚Å‚ÌŠ„ž‚Ý—Dæ“xƒ}ƒXƒN
91 *
92 * TIPM_LOCK‚́CCPUƒƒbƒNó‘Ô‚Å‚ÌŠ„ž‚Ý—Dæ“xƒ}ƒXƒNC‚·‚È‚í‚¿CƒJ[ƒl
93 * ƒ‹ŠÇ—ŠO‚Ì‚à‚Ì‚ðœ‚­‚·‚ׂĂ̊„ž‚Ý—v‹‚ðƒ}ƒXƒN‚·‚é’l‚É’è‹`‚·‚éD
94 *
95 * TMIN_INTPRI•ÏX‚·‚邱‚Æ‚ÅŠÇ—ŠOŠ„ž‚Ý‚Ì—L–³‚ðŒˆ’è‚·‚éD
96 * —Ⴆ‚ÎTMIN_INTPRI‚ð-14‚ɐݒ肷‚é‚ƁCƒŒƒxƒ‹7‚ÌŠ„ž‚Ý‚ªƒJ[ƒlƒ‹ŠÇ—ŠO‚Æ
97 * ‚È‚éDTMIN_INTPRI‚ð-15‚ɐݒ肷‚é‚ƁCNMIˆÈŠO‚ɃJ[ƒlƒ‹ŠÇ—ŠO‚ÌŠ„ž‚Ý‚ð
98 * Ý‚¯‚È‚¢‚±‚Æ‚É‚È‚éi‚±‚̏ꍇ‚É‚Í-15‚ɐݒ肷‚邱‚Ƃ𐄏§‚·‚éjD
99 */
100#ifndef TIPM_LOCK
101#define TIPM_LOCK TMIN_INTPRI
102#endif /* TIPM_LOCK */
103
104
105/*
106 * TOPPERS•W€Š„ž‚ݏˆ—ƒ‚ƒfƒ‹‚ÌŽÀŒ»
107 */
108/*
109 * ƒRƒ“ƒeƒLƒXƒg‚ÌŽQÆ
110 *
111 * RX‚ł́CŠ„ž‚Ý‚Ì–ß‚èæ‚ªƒ^ƒXƒN‚©‚Ç‚¤‚©‚ð”»’f‚·‚邽‚ß‚É intnest
112 * ‚ðŽg—p‚µ‚Ä‚¢‚éD‚±‚ê‚ð—p‚¢‚ăRƒ“ƒeƒLƒXƒg‚ð”»’f‚·‚éD
113 */
114extern bool_t sense_context( void );
115
116
117/*
118 * CPUƒƒbƒNƒtƒ‰ƒOŽÀŒ»‚Ì‚½‚߂̕ϐ”
119 *
120 * ‚±‚ê‚ç‚̕ϐ”‚́CCPUƒƒbƒNó‘Ô‚ÌŽž‚̂ݏ‘‚«Š·‚¦‚Ä‚æ‚¢‚à‚Ì‚Æ‚·‚éD
121 */
122#if TIPM_LOCK != -15
123extern bool_t lock_flag; /* CPUƒƒbƒNƒtƒ‰ƒO‚Ì’l‚ð•ÛŽ‚·‚é•Ï” */
124extern uint32_t saved_ipl; /* Š„ž‚Ý—Dæ“xƒŒƒxƒ‹‚ð•Û‘¶‚·‚é•Ï” */
125#endif /* TIPM_LOCK != -15 */
126
127#endif /* TOPPERS_MACRO_ONLY */
128
129
130/*
131 * Š„ž‚Ý—Dæ“xƒ}ƒXƒN‚ÌŠO•”•\Œ»‚Æ“à•”•\Œ»‚Ì•ÏŠ·
132 *
133 * RX630‚ł́CƒvƒƒZƒbƒTƒXƒe[ƒ^ƒXƒ[ƒhƒŒƒWƒXƒ^iPSWj‚̉º‚©‚ç
134 * 24`27ƒrƒbƒg–Ú‚Ì4ƒrƒbƒg‚ÉŠ„ž‚Ý—Dæ“xƒŒƒxƒ‹iIPLj‚ª’u‚©‚ê‚Ä‚¢‚éD
135 * ƒJ[ƒlƒ‹ŠÇ—ŠOŠ„ž‚Ý‚ðŽÀ‘•‚·‚éê‡‚ÉIPL‚ðŽg—p‚µ‚½§Œä‚ðs‚¤D
136 * ƒJ[ƒlƒ‹‚ÍŠ„ž‚Ý—Dæ“xƒ}ƒXƒNi-1‚©‚ç˜A‘±‚µ‚½•‰‚Ì’lj‚ÅŠÇ—‚³‚ê‚Ä
137 * ‚¢‚邽‚ßIPL‚Æ‚Ì•ÏŠ·‚ª•K—v‚Æ‚È‚éD
138 */
139#define IPL_TO_IPM( ipl ) (-(( PRI )(( ipl ) >> 24U ))) /* IPL‚ðIPM‚É */
140#define IPM_TO_IPL( ipm ) ((( uint32_t )(-( ipm ))) << 24U ) /* IPM‚ðIPL‚É */
141
142
143/*
144 * CPUƒƒbƒNó‘Ô‚Å‚ÌŠ„ž‚Ý—Dæ“xƒ}ƒXƒN‚ÌIPL
145 */
146#define IPL_LOCK ( IPM_TO_IPL( TIPM_LOCK ) )
147
148/*
149 * TIPM_ENAALLiŠ„ž‚Ý—Dæ“xƒ}ƒXƒN‘S‰ðœj‚ÌIPL
150 */
151#define IPL_ENAALL ( IPM_TO_IPL( TIPM_ENAALL ) )
152
153
154#ifndef TOPPERS_MACRO_ONLY
155
156/*
157 * Š„ž‚Ý—vˆö–ˆ‚̃Œƒxƒ‹ & ‘®«’è‹`ƒe[ƒuƒ‹
158 * (ƒeƒ“ƒvƒŒ[ƒgƒtƒ@ƒCƒ‹‚É‚æ‚éo—Í)
159 */
160typedef struct cfg_int_info {
161 PRI intpri;
162 ATR intatr;
163} CFG_INT_INFO;
164
165extern const CFG_INT_INFO cfg_int_table[];
166
167
168/*
169 * Š„ž‚ݔԍ†‚͈̔͂̔»’è
170 *
171 * Š„ž‚ݔԍ†‚ª—LŒø‚È’l‚©Œµ–§‚Ƀ`ƒFƒbƒN‚·‚邽‚ß,
172 * ƒRƒ“ƒtƒBƒMƒ…
173ƒŒ[ƒ^o—̓e[ƒuƒ‹‚ðŽQÆ‚·‚é.
174 */
175#define VALID_INTNO( intno ) \
176 ( cfg_int_table[( intno )].intpri > 0 )
177#define VALID_INTNO_DISINT( intno ) VALID_INTNO( intno )
178#define VALID_INTNO_CFGINT( intno ) VALID_INTNO( intno )
179
180/* cre_int‚Å—LŒø‚ÈŠ„ž‚ݔԍ†‚ÌŽw’è */
181#define VALID_INTNO_CREINT VALID_INTNO_CFGINT((intno))
182
183/* cre_isr‚Å—LŒø‚ÈŠ„ž‚ݔԍ†‚ÌŽw’è */
184#define VALID_INTNO_CREISR(intno) VALID_INTNO_CFGINT((intno))
185
186
187/*
188 * Š„ž‚ݐ§ŒäƒŒƒWƒXƒ^ŠÖ˜A‚Ì’è‹`
189 */
190#define IRQ_POSEDGE ( 0x08U )
191#define IRQ_NEGEDGE ( 0x04U )
192#define IRQ_BOTHEDGE ( 0x0CU )
193#define IRQ_LOWLEVEL ( 0x00U )
194
195
196/*
197 * CPUƒƒbƒNó‘Ԃւ̈ڍs
198 *
199 * IPMiƒn[ƒhƒEƒFƒA‚ÌŠ„ž‚Ý—Dæ“xƒ}ƒXƒNj‚ðCsaved_iipm‚É•Û‘¶‚µCƒJ[
200 * ƒlƒ‹ŠÇ—ŠO‚Ì‚à‚Ì‚ðœ‚­‚·‚ׂĂ̊„ž‚Ý—v‹‚ðƒ}ƒXƒN‚·‚é’liTIPM_LOCKj
201 * ‚ɐݒ肷‚éD‚Ü‚½Clock_flag‚ðTRUE‚É‚·‚éD
202 *
203 * IPM‚ªCÅ‰‚©‚çTIPM_LOCK‚Æ“¯‚¶‚©‚»‚ê‚æ‚荂‚¢ê‡‚ɂ́C‚»‚ê‚ð
204 * saved_iipm‚É•Û‘¶‚·‚é‚݂̂ŁCTIPM_LOCK‚ɂ͐ݒ肵‚È‚¢D‚±‚ê‚́Cƒ‚ƒfƒ‹
205 * ã‚ÌŠ„ž‚Ý—Dæ“xƒ}ƒXƒN‚ªCTIPM_LOCK‚Æ“¯‚¶‚©‚»‚ê‚æ‚荂‚¢ƒŒƒxƒ‹‚ɐݒè
206 * ‚³‚ê‚Ä‚¢‚éó‘Ô‚É‚ ‚½‚éD
207 *
208 * ‚±‚̊֐”‚́CCPUƒƒbƒNó‘ԁilock_flag‚ªTRUE‚̏ó‘ԁj‚ŌĂ΂ê‚邱‚Æ‚Í
209 * ‚È‚¢‚à‚Ì‚Æ‘z’肵‚Ä‚¢‚éD
210 */
211Inline void
212x_lock_cpu( void )
213{
214#if TIPM_LOCK == -15
215 disint();
216#else /* TIPM_LOCK == -15 */
217 uint32_t ipl;
218
219 /*
220 * current_ipl()‚Ì•Ô‚è’l‚𒼐Úsaved_ipl‚É•Û‘¶‚¹‚¸CˆêŽž•Ï”ipl
221 * ‚ð—p‚¢‚Ä‚¢‚é‚̂́Ccurrent_ipl()‚ðŒÄ‚ñ‚¾’¼Œã‚ÉŠ„ž‚Ý‚ª”­¶‚µC
222 * ‹N“®‚³‚ꂽŠ„ž‚ݏˆ—‚Åsaved_ipl‚ª•ÏX‚³‚ê‚é‰Â”\«‚ª‚ ‚邽‚ß‚Å
223 * ‚ ‚éD
224 */
225 ipl = current_ipl();
226 if( IPL_LOCK > ipl ){
227 set_ipl( IPL_LOCK );
228 }
229
230 saved_ipl = ipl;
231 lock_flag = true;
232#endif /* TIPM_LOCK == -15 */
233}
234
235#define t_lock_cpu() x_lock_cpu()
236#define i_lock_cpu() x_lock_cpu()
237
238
239/*
240 * CPUƒƒbƒNó‘Ԃ̉ðœ
241 *
242 * lock_flag‚ðFALSE‚É‚µCIPMiƒn[ƒhƒEƒFƒA‚ÌŠ„ž‚Ý—Dæ“xƒ}ƒXƒNj‚ðC
243 * saved_iipm‚É•Û‘¶‚µ‚½’l‚É–ß‚·D
244 *
245 * ‚±‚̊֐”‚́CCPUƒƒbƒNó‘ԁilock_flag‚ªtrue‚̏ó‘ԁj‚ł̂݌Ă΂ê‚é‚à
246 * ‚Ì‚Æ‘z’肵‚Ä‚¢‚éD
247 */
248Inline void
249x_unlock_cpu( void )
250{
251#if TIPM_LOCK == -15
252 enaint();
253#else /* TIPM_LOCK == -15 */
254 lock_flag = false;
255 set_ipl( saved_ipl );
256#endif /* TIPM_LOCK == -15 */
257}
258
259#define t_unlock_cpu() x_unlock_cpu()
260#define i_unlock_cpu() x_unlock_cpu()
261
262
263/*
264 * CPUƒƒbƒNó‘Ô‚ÌŽQÆ
265 */
266extern bool_t t_sense_lock();
267extern bool_t i_sense_lock();
268extern bool_t x_sense_lock();
269
270/*
271 * iƒ‚ƒfƒ‹ã‚́jŠ„ž‚Ý—Dæ“xƒ}ƒXƒN‚̐ݒè
272 *
273 * CPUƒƒbƒNƒtƒ‰ƒO‚ªƒNƒŠƒA‚³‚ê‚Ä‚¢‚鎞‚́Cƒn[ƒhƒEƒFƒA‚ÌŠ„ž‚Ý—Dæ“xƒ}
274 * ƒXƒN‚ðÝ’è‚·‚éDCPUƒƒbƒNƒtƒ‰ƒO‚ªƒZƒbƒg‚³‚ê‚Ä‚¢‚鎞‚́Csaved_iipm
275 * ‚ðÝ’肵C‚³‚ç‚ɁCƒn[ƒhƒEƒFƒA‚ÌŠ„ž‚Ý—Dæ“xƒ}ƒXƒN‚ðCÝ’肵‚悤‚Æ
276 * ‚µ‚½iƒ‚ƒfƒ‹ã‚́jŠ„ž‚Ý—Dæ“xƒ}ƒXƒN‚ÆTIPM_LOCK‚̍‚‚¢•û‚ɐݒ肷‚éD
277 */
278Inline void
279x_set_ipm( PRI intpri )
280{
281 uint32_t ipl = IPM_TO_IPL( intpri );
282#if TIPM_LOCK == -15
283 set_ipl(ipl);
284#else /* TIPM_LOCK == -15 */
285 if( !lock_flag ){
286 set_ipl(ipl);
287 }
288 else {
289 saved_ipl = ipl;
290 set_ipl(ipl > IPL_LOCK ? ipl : IPL_LOCK);
291 }
292#endif /* TIPM_LOCK == -15 */
293}
294
295#define t_set_ipm( intpri ) x_set_ipm( intpri )
296#define i_set_ipm( intpri ) x_set_ipm( intpri )
297
298
299/*
300 * iƒ‚ƒfƒ‹ã‚́jŠ„ž‚Ý—Dæ“xƒ}ƒXƒN‚ÌŽQÆ
301 *
302 * CPUƒƒbƒNƒtƒ‰ƒO‚ªƒNƒŠƒA‚³‚ê‚Ä‚¢‚鎞‚̓n[ƒhƒEƒFƒA‚ÌŠ„ž‚Ý—Dæ“xƒ}
303 * ƒXƒN‚ðCƒZƒbƒg‚³‚ê‚Ä‚¢‚鎞‚Ísaved_iipm‚ðŽQÆ‚·‚éD
304 */
305Inline PRI
306x_get_ipm( void )
307{
308 uint32_t ipl;
309#if TIPM_LOCK == -15
310 ipl = current_ipl();
311#else /* TIPM_LOCK == -15 */
312 if (!lock_flag) {
313 ipl = current_ipl();
314 }
315 else {
316 ipl = saved_ipl;
317 }
318#endif /* TIPM_LOCK == -15 */
319 return IPL_TO_IPM( ipl );
320}
321
322#define t_get_ipm() x_get_ipm()
323#define i_get_ipm() x_get_ipm()
324
325
326/*
327 * Š„ž‚Ý—v‹‹ÖŽ~ƒtƒ‰ƒO‚̃Zƒbƒg
328 *
329 * Š„ž‚Ý‘®«‚ªÝ’肳‚ê‚Ä‚¢‚È‚¢Š„ž‚Ý—v‹ƒ‰ƒCƒ“‚ɑ΂µ‚ÄŠ„ž‚Ý—v‹‹ÖŽ~
330 * ƒtƒ‰ƒO‚ðƒZƒbƒg‚µ‚悤‚Æ‚µ‚½ê‡‚ɂ́CFALSE‚ð•Ô‚·D
331 */
332Inline bool_t
333x_disable_int( INTNO intno )
334{
335 /*
336 * ƒŒƒxƒ‹’è‹`‚ª0‚Å‚ ‚éê‡‚ÍCFG_INT‚³‚ê‚Ä‚¢‚È‚¢
337 */
338 if( cfg_int_table[intno].intpri == 0 ){
339 return ( false );
340 }
341
342 sil_wrb_mem((uint8_t *)ier_reg_addr[intno].addr,
343 sil_reb_mem((uint8_t *)ier_reg_addr[intno].addr) & ~ier_reg_addr[intno].offset);
344
345 return ( true );
346}
347
348#define t_disable_int( intno ) x_disable_int( intno )
349#define i_disable_int( intno ) x_disable_int( intno )
350
351
352/*
353 * Š„ž‚Ý—v‹‹ÖŽ~ƒtƒ‰ƒO‚̃NƒŠƒA
354 *
355 * Š„ž‚Ý‘®«‚ªÝ’肳‚ê‚Ä‚¢‚È‚¢Š„ž‚Ý—v‹ƒ‰ƒCƒ“‚ɑ΂µ‚ÄŠ„ž‚Ý—v‹‹ÖŽ~
356 * ƒtƒ‰ƒO‚ðƒNƒŠƒA‚µ‚悤‚Æ‚µ‚½ê‡‚ɂ́CFALSE‚ð•Ô‚·D
357 */
358Inline bool_t
359x_enable_int( INTNO intno )
360{
361 /*
362 * ƒŒƒxƒ‹’è‹`‚ª0‚Å‚ ‚éê‡‚ÍCFG_INT‚³‚ê‚Ä‚¢‚È‚¢
363 */
364 if( cfg_int_table[intno].intpri == 0 ){
365 return ( false );
366 }
367
368 sil_wrb_mem((uint8_t *)ier_reg_addr[intno].addr,
369 sil_reb_mem((uint8_t *)ier_reg_addr[intno].addr) | ier_reg_addr[intno].offset);
370
371 return ( true );
372}
373
374#define t_enable_int( intno ) x_enable_int( intno )
375#define i_enable_int( intno ) x_enable_int( intno )
376
377
378/*
379 * Š„ž‚Ý—v‹‚̃NƒŠƒA
380 */
381Inline void
382x_clear_int( INTNO intno )
383{
384 sil_wrb_mem((uint8_t *)IR_REG(intno), 0U);
385}
386
387#define t_clear_int( intno ) x_clear_int( intno )
388#define i_clear_int( intno ) x_clear_int( intno )
389
390
391/*
392 * Š„ž‚Ý—v‹‚̃`ƒFƒbƒN
393 */
394Inline bool_t
395x_probe_int( INTNO intno )
396{
397 /*
398 * Š„ž‚Ý—v‹ƒŒƒWƒXƒ^‚Í0 or 1‚Å‚µ‚©‚È‚¢‚½‚ß,
399 * ‚»‚Ì‚Ü‚Ü‚Ì’l‚ð•Ô‚·.
400 */
401 return sil_reb_mem((uint8_t *)IR_REG(intno));
402}
403
404#define t_probe_int( intno ) x_probe_int( intno )
405#define i_probe_int( intno ) x_probe_int( intno )
406
407/*
408 * Š„ž‚Ý—v‹ƒ‰ƒCƒ“‚Ì‘®«‚̐ݒè
409 */
410extern void x_config_int( INTNO intno, ATR intatr, PRI intpri );
411
412/*
413 * Š„ž‚݃nƒ“ƒhƒ‰‚Ì“üŒû‚Å•K—v‚ÈIRC‘€ì
414 *
415 */
416extern void i_begin_int(INTNO intno);
417
418/*
419 * Š„ž‚݃nƒ“ƒhƒ‰‚̏oŒû‚Å•K—v‚ÈIRC‘€ì
420 *
421 */
422extern void i_end_int(INTNO intno);
423
424/*
425 * Å‚—Dæ‡ˆÊƒ^ƒXƒN‚ւ̃fƒBƒXƒpƒbƒ`iprc_support.a30j
426 *
427 * dispatch‚́Cƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg‚©‚çŒÄ‚яo‚³‚ꂽƒT[ƒrƒXƒR[ƒ‹ˆ—‚©
428 * ‚çŒÄ‚яo‚·‚ׂ«‚à‚̂ŁCƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒgECPUƒƒbƒNó‘ԁEƒfƒBƒXƒpƒb
429 * ƒ`‹–‰Âó‘ԁEiƒ‚ƒfƒ‹ã‚́jŠ„ž‚Ý—Dæ“xƒ}ƒXƒN‘S‰ðœó‘ԂŌĂяo‚³‚È
430 * ‚¯‚ê‚΂Ȃç‚È‚¢D
431 */
432extern void dispatch( void );
433
434/*
435 * ƒfƒBƒXƒpƒbƒ`ƒƒ‚Ì“®ìŠJŽniprc_support.a30j
436 *
437 * start_dispatch‚́CƒJ[ƒlƒ‹‹N“®Žž‚ɌĂяo‚·‚ׂ«‚à‚̂ŁC‚·‚ׂĂ̊„ž
438 * ‚Ý‚ð‹ÖŽ~‚µ‚½ó‘ԁi‘SŠ„ž‚݃ƒbƒNó‘Ô‚Æ“¯“™‚̏ó‘ԁj‚ŌĂяo‚³‚È‚¯‚ê‚Î
439 * ‚È‚ç‚È‚¢D
440 */
441extern void _start_dispatch( void );
442#define _kernel_start_dispatch() _start_dispatch(); return
443
444/*
445 * Œ»Ý‚̃Rƒ“ƒeƒLƒXƒg‚ðŽÌ‚ĂăfƒBƒXƒpƒbƒ`iprc_support.a30j
446 *
447 * exit_and_dispatch‚́Cext_tsk‚©‚çŒÄ‚яo‚·‚ׂ«‚à‚̂ŁCƒ^ƒXƒNƒRƒ“ƒeƒL
448 * ƒXƒgECPUƒƒbƒNó‘ԁEƒfƒBƒXƒpƒbƒ`‹–‰Âó‘ԁEiƒ‚ƒfƒ‹ã‚́jŠ„ž‚Ý—Dæ
449 * “xƒ}ƒXƒN‘S‰ðœó‘ԂŌĂяo‚³‚È‚¯‚ê‚΂Ȃç‚È‚¢D
450 */
451#define _kernel_exit_and_dispatch(); \
452 _exit_and_dispatch(); \
453 ercd = E_SYS;
454
455extern void _exit_and_dispatch( void ) NoReturn;
456
457/*
458 * ƒJ[ƒlƒ‹‚̏I—¹ˆ—‚̌ďo‚µiprc_support.a30j
459 *
460 * call_exit_kernel‚́CƒJ[ƒlƒ‹‚̏I—¹Žž‚ɌĂяo‚·‚ׂ«‚à‚̂ŁC”ñƒ^ƒXƒN
461 * ƒRƒ“ƒeƒLƒXƒg‚ɐ؂芷‚¦‚āCƒJ[ƒlƒ‹‚̏I—¹ˆ—iexit_kernelj‚ðŒÄ‚яo
462 * ‚·D
463 */
464extern void call_exit_kernel( void ) NoReturn;
465
466/*
467 * ƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg‚̏‰Šú‰»
468 *
469 * ƒ^ƒXƒN‚ª‹xŽ~ó‘Ô‚©‚çŽÀs‚Å‚«‚éó‘ԂɈڍs‚·‚鎞‚ɌĂ΂ê‚éD‚±‚ÌŽž“_
470 * ‚ŃXƒ^ƒbƒN—̈æ‚ðŽg‚Á‚Ä‚Í‚È‚ç‚È‚¢D
471 *
472 * activate_context‚ðCƒCƒ“ƒ‰ƒCƒ“ŠÖ”‚Å‚Í‚È‚­ƒ}ƒNƒ’è‹`‚Æ‚µ‚Ä‚¢‚é‚̂́C
473 * ‚±‚ÌŽž“_‚Å‚ÍTCB‚ª’è‹`‚³‚ê‚Ä‚¢‚È‚¢‚½‚ß‚Å‚ ‚éD
474 */
475extern void start_r(void);
476
477extern void *new_context(void *p_tcb);
478#define activate_context(p_tcb) \
479{ \
480 (p_tcb)->tskctxb.start = (void (*)(void))start_r; \
481 (p_tcb)->tskctxb.cpu_context = new_context(p_tcb); \
482}
483
484/*
485 * calltex‚ÍŽg—p‚µ‚È‚¢
486 */
487#define OMIT_CALLTEX
488
489
490/*
491 * Š„ž‚݃nƒ“ƒhƒ‰‚̐ݒè
492 *
493 * RX630‚ÍROM‚ÉŠ„ž‚݃xƒNƒ^‚ð”z’u‚·‚邽‚߁C–{ŠÖ”‚Í‹óŠÖ”‚ÅŽÀ‘•‚·‚éD
494 */
495extern void x_define_inh( INHNO inhno, FP inthdr );
496
497/*
498 * CPU—áŠOƒnƒ“ƒhƒ‰‚̐ݒè
499 *
500 * RX630‚ÍROM‚É—áŠOƒxƒNƒ^‚ð”z’u‚·‚邽‚߁C–{ŠÖ”‚Í‹óŠÖ”‚ÅŽÀ‘•‚·‚éD
501 */
502Inline void
503x_define_exc( EXCNO excno, FP exchdr )
504{
505}
506
507
508/*
509 * Š„ž‚Ý/—áŠOƒnƒ“ƒhƒ‰‚Ì“üŒûˆ—‚̐¶¬ƒ}ƒNƒ
510 *
511 * ƒeƒ“ƒvƒŒ[ƒgƒtƒ@ƒCƒ‹‚É‚æ‚萶¬‚·‚邽‚ß‹óƒ}ƒNƒ‚Æ‚·‚éD
512 */
513#define HDR_ENTRY(hdr, intexc_num , tobejmp)
514
515/*
516 * Š„ž‚݃nƒ“ƒhƒ‰‚Ì“üŒûˆ—‚̐¶¬ƒ}ƒNƒ
517 */
518#define _INT_ENTRY(inhno, inthdr) _kernel_##inthdr##_##inhno##_entry
519#define INT_ENTRY(inhno, inthdr) inthdr
520
521#define _INTHDR_ENTRY(inhno, inhno_num ,inthdr) \
522 extern _kernel_##inthdr##_##inhno##_entry(void);
523#define INTHDR_ENTRY(inhno, inhno_num ,inthdr) _INTHDR_ENTRY(inhno, inhno_num ,inthdr)
524
525
526/*
527 * CPU—áŠOƒnƒ“ƒhƒ‰‚Ì“üŒûˆ—‚̐¶¬ƒ}ƒNƒ
528 */
529#define _EXC_ENTRY(excno , exchdr) _kernel_##exchdr##_##excno##_entry
530#define EXC_ENTRY(excno , exchdr) exchdr
531
532#define _EXCHDR_ENTRY(excno , excno_num , exchdr) \
533 extern _kernel_##exchdr##_##excno##_entry(void);
534#define EXCHDR_ENTRY(excno , excno_num , exchdr) _EXCHDR_ENTRY(excno , excno_num , exchdr)
535
536
537/*
538 * CPU—áŠO‚Ì”­¶‚µ‚½Žž‚̃Rƒ“ƒeƒLƒXƒg‚ÌŽQÆ
539 *
540 * CPU—áŠO‚Ì”­¶‚µ‚½Žž‚̃Rƒ“ƒeƒLƒXƒg‚ªCƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg‚ÌŽž‚ÉFALSEC
541 * ‚»‚¤‚Å‚È‚¢Žž‚Étrue‚ð•Ô‚·D
542 */
543extern bool_t exc_sense_context( void *p_excinf );
544
545
546/*
547 * CPU—áŠOî•ñ p_excinf ‚©‚ç PSW ‚Ì’l‚ðŽæ“¾‚·‚邽‚߂̃IƒtƒZƒbƒg’l
548 * EXCNO + ACC + FPSW + R1`R15 + PC
549 */
550#define EXC_GET_PSW_OFFSET (4+8+4+60+4)
551
552/*
553 * CPU—áŠO‚Ì”­¶‚µ‚½Žž‚ÌIPL‚ÌŽQÆ
554 */
555Inline uint32_t
556exc_get_ipl(void *p_excinf)
557{
558 return((*((uint32_t *)((uintptr_t)p_excinf+EXC_GET_PSW_OFFSET)))
559 & PSW_IPL_MASK);
560}
561
562Inline bool_t
563exc_sense_i(void *p_excinf)
564{
565 return((*(((uint32_t *)((uintptr_t)p_excinf+EXC_GET_PSW_OFFSET)))
566 & PSW_I_MASK) != 0u);
567}
568
569
570/*
571 * CPU—áŠO‚Ì”­¶‚µ‚½Žž‚̃Rƒ“ƒeƒLƒXƒg‚ÆŠ„ž‚݂̃}ƒXƒNó‘Ô‚ÌŽQÆ
572 *
573 * CPU—áŠO‚Ì”­¶‚µ‚½Žž‚̃VƒXƒeƒ€ó‘Ô‚ªCƒJ[ƒlƒ‹ŽÀs’†‚Å‚È‚­Cƒ^ƒXƒNƒR
574 * ƒ“ƒeƒLƒXƒg‚Å‚ ‚èC‘SŠ„ž‚݃ƒbƒNó‘Ô‚Å‚È‚­CCPUƒƒbƒNó‘Ô‚Å‚È‚­Ciƒ‚
575 * ƒfƒ‹ã‚́jŠ„ž‚Ý—Dæ“xƒ}ƒXƒN‘S‰ðœó‘Ô‚Å‚ ‚鎞‚ÉtrueC‚»‚¤‚Å‚È‚¢Žž
576 * ‚ÉFALSE‚ð•Ô‚·iCPU—áŠO‚ªƒJ[ƒlƒ‹ŠÇ—ŠO‚ÌŠ„ž‚ݏˆ—’†‚Å”­¶‚µ‚½ê‡
577 * ‚É‚àFALSE‚ð•Ô‚·jD
578 *
579 * ƒJ[ƒlƒ‹ŽÀs’†‚Å‚È‚¢¨ (TIPM_LOCK== -15) Iƒtƒ‰ƒO == 1
580 * (else) IPL < IPL_LOCK
581 * ƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg‚Å‚ ‚遨intnest == 0
582 * ‘SŠ„ž‚݃ƒbƒN‚Å‚È‚¢¨ Iƒtƒ‰ƒO == 1
583 * Š„ž‚Ý—Dæ“xƒ}ƒXƒN‚ª‘S‰ðœ¨IPL == 0
584 *
585 *
586 */
587Inline bool_t
588exc_sense_intmask(void *p_excinf)
589{
590 return((!exc_sense_context(p_excinf))
591 && exc_sense_i(p_excinf)
592 && (exc_get_ipl(p_excinf) == IPL_ENAALL));
593}
594
595/*
596 * CPU—áŠO‚Ì”­¶‚µ‚½Žž‚̃Rƒ“ƒeƒLƒXƒg‚ÆŠ„ž‚݁^CPUƒƒbƒNó‘Ô‚ÌŽQÆ
597 *
598 * CPU—áŠO‚Ì”­¶‚µ‚½Žž‚̃VƒXƒeƒ€ó‘Ô‚ªCƒJ[ƒlƒ‹ŽÀs’†‚Å‚È‚­Cƒ^ƒXƒNƒR
599 * ƒ“ƒeƒLƒXƒg‚Å‚ ‚èC‘SŠ„ž‚݃ƒbƒNó‘Ô‚Å‚È‚­CCPUƒƒbƒNó‘Ô‚Å‚È‚¢Žž‚É
600 * trueC‚»‚¤‚Å‚È‚¢Žž‚Éfalse‚ð•Ô‚·iCPU—áŠO‚ªƒJ[ƒlƒ‹ŠÇ—ŠO‚ÌŠ„ž‚ݏˆ
601 * —’†‚Å”­¶‚µ‚½ê‡‚É‚àfalse‚ð•Ô‚·jD
602 *
603 * ƒJ[ƒlƒ‹ŽÀs’†‚Å‚È‚¢¨ (TIPM_LOCK== -15) Iƒtƒ‰ƒO == 1
604 * (else) IPL < TIPM_LOCK
605 * ƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg‚Å‚ ‚遨intnest < 1
606 * ‘SŠ„ž‚݃ƒbƒN‚Å‚È‚¢¨ Iƒtƒ‰ƒO == 1
607 * CPUƒƒbƒNó‘Ô‚Å‚È‚¢¨(TIPM_LOCK== -15) Iƒtƒ‰ƒO == 1
608 * (else) IPL < TIPM_LOCK
609 */
610Inline bool_t
611exc_sense_unlock(void *p_excinf)
612{
613#if TIPM_LOCK == -15
614 return((!exc_sense_context(p_excinf))
615 && exc_sense_i(p_excinf));
616#else
617 return((!exc_sense_context(p_excinf))
618 && exc_sense_i(p_excinf)
619 && exc_get_ipl(p_excinf) < IPL_LOCK);
620#endif
621}
622
623
624/*
625 * ƒvƒƒZƒbƒTˆË‘¶‚̏‰Šú‰»
626 */
627extern void prc_initialize( void );
628
629/*
630 * ƒvƒƒZƒbƒTˆË‘¶‚̏I—¹Žžˆ—
631 */
632extern void prc_terminate( void );
633
634
635#ifndef OMIT_DEFAULT_INT_HANDLER
636/*
637 * –¢“o˜^‚ÌŠ„ž‚Ý‚ª”­¶‚µ‚½ê‡‚ɌĂяo‚³‚ê‚é
638 */
639void default_int_handler( void );
640#endif /* OMIT_DEFAULT_INT_HANDLER */
641
642#ifndef OMIT_DEFAULT_EXC_HANDLER
643/*
644 * –¢“o˜^‚Ì—áŠO‚ª”­¶‚µ‚½ê‡‚ɌĂяo‚³‚ê‚é
645 */
646void default_exc_handler( void );
647#endif /* OMIT_DEFAULT_EXC_HANDLER */
648
649
650#endif /* TOPPERS_MACRO_ONLY */
651
652#endif /* TOPPERS_PRC_CONFIG_H */
653
Note: See TracBrowser for help on using the repository browser.