source: uKadecot/trunk/ssp/arch/rx630_ccrx/prc_config.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: 6.6 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,2006 by Embedded and Real-Time Systems Laboratory
8 * Graduate School of Information Science, Nagoya Univ., JAPAN
9 * Copyright (C) 2008-2010 by Witz Corporation, JAPAN
10 *
11 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì (1)`(4) ‚ÌðŒ‚©CFree Software Foundation
12 * ‚É‚æ‚Á‚ÄŒö•\‚³‚ê‚Ä‚¢‚é GNU General Public License ‚Ì Version 2 ‚É‹L
13 * q‚³‚ê‚Ä‚¢‚éðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒFƒAi–{ƒ\ƒtƒgƒEƒFƒA
14 * ‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü•ÏEÄ”z•ziˆÈ‰ºC
15 * —˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
16 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
17 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
18 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
19 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
20 * —p‚Å‚«‚éŒ`‚ōĔ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
26 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
27 * ‚ƁD
28 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
29ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
30ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
31 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
32 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
33 * •ñ‚·‚邱‚ƁD
34 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
35 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
36 *
37 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
38 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC‚»‚Ì“K—p‰Â”\«‚à
39 * ŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼
40 * Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»‚̐ӔC‚𕉂í‚È‚¢D
41 *
42 */
43
44/*
45 * ƒvƒƒZƒbƒTˆË‘¶ƒ‚ƒWƒ…
46[ƒ‹iRX630—pj
47 */
48
49#include "kernel_impl.h"
50#include "sil.h"
51
52
53/*
54 * Š„ž‚Ý”­¶‰ñ”‚ð•Û‘¶‚·‚é•Ï”
55 */
56uint16_t intnest;
57
58/*
59 * CPUƒƒbƒNƒtƒ‰ƒOŽÀŒ»‚Ì‚½‚߂̕ϐ”
60 */
61#if TIPM_LOCK != -15
62bool_t lock_flag; /* CPUƒƒbƒNƒtƒ‰ƒO‚Ì’l‚ð•ÛŽ‚·‚é•Ï” */
63uint32_t saved_ipl; /* Š„ž‚Ý—Dæ“xƒŒƒxƒ‹‚ð•Û‘¶‚·‚é•Ï” */
64#endif /* TIPM_LOCK != -15 */
65
66
67/*
68 * ƒvƒƒZƒbƒTˆË‘¶‚̏‰Šú‰»
69 */
70void
71prc_initialize( void )
72{
73 /*
74 * Š„ž‚Ý”­¶‰ñ”‚̏‰Šú‰»
75 *
76 * ƒXƒ^[ƒgƒAƒbƒv‚Í‘SŠ„ž‚݃ƒbƒNó‘Ô & ”ñƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg
77 * ‚É‚Ä“®ì‚·‚邽‚ß, ”ñƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg‚É‹U‘•‚·‚é.
78 */
79 intnest = 1U;
80
81#if TIPM_LOCK != -15
82 /*
83 * CPUƒƒbƒNƒtƒ‰ƒOŽÀŒ»‚Ì‚½‚߂̕ϐ”‚̏‰Šú‰»
84 */
85 lock_flag = true;
86 saved_ipl = IPL_ENAALL;
87#endif /* TIPM_LOCK != -15 */
88}
89
90
91/*
92 * ƒvƒƒZƒbƒTˆË‘¶‚̏I—¹ˆ—
93 */
94void
95prc_terminate( void )
96{
97 /*
98 * “Á‚É•K—v‚ȏˆ—‚Í‚È‚¢
99 */
100}
101
102
103/*
104 * CPU—áŠO‚Ì”­¶ó‹µ‚̃ƒOo—Í
105 *
106 * CPU—áŠOƒnƒ“ƒhƒ‰‚Ì’†‚©‚çCCPU—áŠOî•ñƒ|ƒCƒ“ƒ^ip_excinfj‚ðˆø”‚Æ‚µ
107 * ‚ČĂяo‚·‚±‚ƂŁCCPU—áŠO‚Ì”­¶ó‹µ‚ðƒVƒXƒeƒ€ƒƒO‚ɏo—Í‚·‚éD
108 */
109#ifdef SUPPORT_XLOG_SYS
110void
111xlog_sys( void *p_excinf )
112{
113 syslog(LOG_ERROR , "r1 = %u") , *((uint32_t*)((intptr_t)p_excinf + 14));
114 syslog(LOG_ERROR , "r2 = %u") , *((uint32_t*)((intptr_t)p_excinf + 15));
115 syslog(LOG_ERROR , "r3 = %u") , *((uint32_t*)((intptr_t)p_excinf + 16));
116 syslog(LOG_ERROR , "r4 = %u") , *((uint32_t*)((intptr_t)p_excinf + 17));
117 syslog(LOG_ERROR , "r5 = %u") , *((uint32_t*)((intptr_t)p_excinf + 18));
118 syslog(LOG_ERROR , "r6 = %u") , *((uint32_t*)((intptr_t)p_excinf + 1));
119 syslog(LOG_ERROR , "r7 = %u") , *((uint32_t*)((intptr_t)p_excinf + 2));
120 syslog(LOG_ERROR , "r8 = %u") , *((uint32_t*)((intptr_t)p_excinf + 3));
121 syslog(LOG_ERROR , "r9 = %u") , *((uint32_t*)((intptr_t)p_excinf + 4));
122 syslog(LOG_ERROR , "r10 = %u") , *((uint32_t*)((intptr_t)p_excinf + 5));
123 syslog(LOG_ERROR , "r11 = %u") , *((uint32_t*)((intptr_t)p_excinf + 6));
124 syslog(LOG_ERROR , "r12 = %u") , *((uint32_t*)((intptr_t)p_excinf + 7));
125 syslog(LOG_ERROR , "r13 = %u") , *((uint32_t*)((intptr_t)p_excinf + 8));
126 syslog(LOG_ERROR , "r14 = %u") , *((uint32_t*)((intptr_t)p_excinf + 12));
127 syslog(LOG_ERROR , "r15 = %u") , *((uint32_t*)((intptr_t)p_excinf + 13));
128 syslog(LOG_ERROR , "fpsw = %u") , *((uint32_t*)((intptr_t)p_excinf + 11));
129 syslog(LOG_ERROR , "acclo = %u") , *((uint32_t*)((intptr_t)p_excinf + 10));
130 syslog(LOG_ERROR , "acchi = %u") , *((uint32_t*)((intptr_t)p_excinf + 9));
131 syslog(LOG_ERROR , "pc = %x") , *((uint32_t*)((intptr_t)p_excinf + 19));
132 syslog(LOG_ERROR , "psw = %x") , *((uint32_t*)((intptr_t)p_excinf + 20));
133}
134#endif /* SUPPORT_XLOG_SYS */
135
136
137/*
138 * Š„ž‚Ý—v‹ƒ‰ƒCƒ“‚Ì‘®«‚̐ݒè
139 *
140 * ASPƒJ[ƒlƒ‹‚Å‚Ì—˜—p‚ð‘z’肵‚āCƒpƒ‰ƒ[ƒ^ƒGƒ‰[‚̓AƒT[ƒVƒ‡ƒ“‚Ń`ƒFƒb
141 * ƒN‚µ‚Ä‚¢‚éDcfg_intƒT[ƒrƒXƒR[ƒ‹‚ðÝ‚¯‚éê‡‚ɂ́CƒGƒ‰[‚ð•Ô‚·‚悤
142 * ‚É‚·‚ׂ«‚Å‚ ‚낤D
143 */
144void
145x_config_int( INTNO intno, ATR intatr, PRI intpri )
146{
147 uint8_t irq_offset;
148 uint8_t irq_val;
149
150 assert( VALID_INTNO_CFGINT(intno) );
151
152 assert( ( -15 <= intpri ) && ( intpri <= TMAX_INTPRI ) );
153#if TIPM_LOCK != -15
154 if( intatr == TA_NONKERNEL ){
155 assert( intpri < TMIN_INTPRI );
156 }
157 else{
158 assert( TMIN_INTPRI <= intpri );
159 }
160#endif
161
162 /*
163 * Š„ž‚݂̃}ƒXƒN
164 *
165 * Š„ž‚Ý‚ðŽó‚¯•t‚¯‚½‚܂܁CƒŒƒxƒ‹ƒgƒŠƒK^ƒGƒbƒWƒgƒŠƒK‚̐ݒè‚âCŠ„
166 * ž‚Ý—Dæ“x‚̐ݒè‚ðs‚¤‚̂͊댯‚È‚½‚߁CŠ„ž‚Ý‘®«‚É‚©‚©‚í‚炸C
167 * ˆê’Uƒ}ƒXƒN‚·‚éD
168 */
169 ( void )x_disable_int( intno );
170
171 /*
172 * ƒŒƒxƒ‹ƒgƒŠƒK/ƒGƒbƒWƒgƒŠƒK‚̐ݒè
173 *
174 * IRQ‚̂݃Tƒ|[ƒg‚·‚é
175 */
176 if( INTNO_IRQ( intno ) != 0U ){
177 irq_offset = INTNO_IRQ_OFFSET( intno );
178
179 if( ( intatr & TA_POSEDGE ) != 0U ){
180 irq_val = IRQ_POSEDGE;
181 }
182 else if( ( intatr & TA_NEGEDGE ) != 0U ){
183 irq_val = IRQ_NEGEDGE;
184 }
185 else if( ( intatr & TA_BOTHEDGE ) != 0U ){
186 irq_val = IRQ_BOTHEDGE;
187 }
188 else if( ( intatr & TA_LOWLEVEL ) != 0U ){
189 irq_val = IRQ_LOWLEVEL;
190 }
191 else{
192 /*
193 * ƒRƒ“ƒtƒBƒMƒ…
194ƒŒ[ƒ^‚ɂă`ƒFƒbƒN‚µ‚Ä‚¢‚邽‚ß,
195 * ‚±‚±‚Ö‚­‚邱‚Æ‚Í‚ ‚肦‚È‚¢.
196 */
197 irq_val = 0U;
198 }
199
200 sil_wrb_mem((uint8_t *)irqcr_reg_addr[irq_offset], irq_val);
201 }
202
203 /*
204 * Š„ž‚݃Œƒxƒ‹‚̐ݒè
205 *
206 * Š„ž‚ݔԍ†‚ɑΉž‚µ‚½IPR’l‚ðÝ’è‚·‚é.
207 */
208 sil_wrb_mem((uint8_t *)ipr_reg_addr[intno], cfg_int_table[intno].intpri);
209
210 /*
211 * Š„ž‚݂̃}ƒXƒN‰ðœ
212 */
213 if( ( intatr & TA_ENAINT ) != 0U ){
214 ( void )x_enable_int( intno );
215 }
216}
217
218
219#ifndef OMIT_DEFAULT_INT_HANDLER
220/*
221 * –¢“o˜^‚ÌŠ„ž‚Ý‚ª”­¶‚µ‚½ê‡‚ɌĂяo‚³‚ê‚é
222 */
223void
224default_int_handler( void )
225{
226 syslog(LOG_EMERG, "Unregistered Interrupt occurs.");
227}
228#endif /* OMIT_DEFAULT_INT_HANDLER */
229
230#ifndef OMIT_DEFAULT_EXC_HANDLER
231/*
232 * –¢“o˜^‚Ì—áŠO‚ª”­¶‚µ‚½ê‡‚ɌĂяo‚³‚ê‚é
233 */
234void
235default_exc_handler( void )
236{
237 syslog(LOG_EMERG, "Unregistered Expevt error occurs.");
238}
239#endif /* OMIT_DEFAULT_EXC_HANDLER */
240
Note: See TracBrowser for help on using the repository browser.