1 | /*
|
---|
2 | * TOPPERS ATK2
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
4 | * Automotive Kernel Version 2
|
---|
5 | *
|
---|
6 | * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
|
---|
7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
8 | * Copyright (C) 2004-2015 by Center for Embedded Computing Systems
|
---|
9 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
10 | * Copyright (C) 2011-2015 by FUJI SOFT INCORPORATED, JAPAN
|
---|
11 | * Copyright (C) 2011-2013 by Spansion LLC, USA
|
---|
12 | * Copyright (C) 2011-2015 by NEC Communication Systems, Ltd., JAPAN
|
---|
13 | * Copyright (C) 2011-2015 by Panasonic Advanced Technology Development Co., Ltd., JAPAN
|
---|
14 | * Copyright (C) 2011-2014 by Renesas Electronics Corporation, JAPAN
|
---|
15 | * Copyright (C) 2011-2015 by Sunny Giken Inc., JAPAN
|
---|
16 | * Copyright (C) 2011-2015 by TOSHIBA CORPORATION, JAPAN
|
---|
17 | * Copyright (C) 2004-2015 by Witz Corporation
|
---|
18 | * Copyright (C) 2014-2015 by AISIN COMCRUISE Co., Ltd., JAPAN
|
---|
19 | * Copyright (C) 2014-2015 by eSOL Co.,Ltd., JAPAN
|
---|
20 | * Copyright (C) 2014-2015 by SCSK Corporation, JAPAN
|
---|
21 | * Copyright (C) 2015 by SUZUKI MOTOR CORPORATION
|
---|
22 | *
|
---|
23 | * ä¸è¨èä½æ¨©è
|
---|
24 | ã¯ï¼ä»¥ä¸ã®(1)ã(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
25 | * ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹
|
---|
26 | * å¤ã»åé
|
---|
27 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
28 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
29 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
30 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
31 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
32 | * ç¨ã§ããå½¢ã§åé
|
---|
33 | å¸ããå ´åã«ã¯ï¼åé
|
---|
34 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
35 | * è
|
---|
36 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
37 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
38 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
39 | * ç¨ã§ããªãå½¢ã§åé
|
---|
40 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
41 | * ã¨ï¼
|
---|
42 | * (a) åé
|
---|
43 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
44 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
45 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
46 | * (b) åé
|
---|
47 | å¸ã®å½¢æ
|
---|
48 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
49 | * å ±åãããã¨ï¼
|
---|
50 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
51 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
52 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
53 | 責ãããã¨ï¼
|
---|
54 | * ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
|
---|
55 | * ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
56 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
57 | * å
|
---|
58 | 責ãããã¨ï¼
|
---|
59 | *
|
---|
60 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼AUTOSARï¼AUTomotive Open System ARchitectureï¼ä»
|
---|
61 | * æ§ã«åºã¥ãã¦ããï¼ä¸è¨ã®è¨±è«¾ã¯ï¼AUTOSARã®ç¥ç財ç£æ¨©ã許諾ãããã®ã§
|
---|
62 | * ã¯ãªãï¼AUTOSARã¯ï¼AUTOSARä»æ§ã«åºã¥ããã½ããã¦ã§ã¢ãåç¨ç®çã§å©
|
---|
63 | * ç¨ããè
|
---|
64 | ã«å¯¾ãã¦ï¼AUTOSARãã¼ããã¼ã«ãªããã¨ãæ±ãã¦ããï¼
|
---|
65 | *
|
---|
66 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
67 | ã
|
---|
68 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
69 | * ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
70 | * ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ã
|
---|
71 | * ã®è²¬ä»»ãè² ããªãï¼
|
---|
72 | *
|
---|
73 | * $Id: interrupt_manage.c 434 2015-12-09 12:24:27Z witz-itoyo $
|
---|
74 | */
|
---|
75 |
|
---|
76 | /*
|
---|
77 | * å²è¾¼ã¿ç®¡çã¢ã¸ã¥ã¼ã«
|
---|
78 | */
|
---|
79 |
|
---|
80 | #include "kernel_impl.h"
|
---|
81 | #include "check.h"
|
---|
82 | #include "interrupt.h"
|
---|
83 |
|
---|
84 | /*
|
---|
85 | * ãã¬ã¼ã¹ãã°ãã¯ãã®ããã©ã«ãå®ç¾©
|
---|
86 | */
|
---|
87 | #ifndef LOG_DISINT_ENTER
|
---|
88 | #define LOG_DISINT_ENTER()
|
---|
89 | #endif /* LOG_DISINT_ENTER */
|
---|
90 |
|
---|
91 | #ifndef LOG_DISINT_LEAVE
|
---|
92 | #define LOG_DISINT_LEAVE()
|
---|
93 | #endif /* LOG_DISINT_LEAVE */
|
---|
94 |
|
---|
95 | #ifndef LOG_ENAINT_ENTER
|
---|
96 | #define LOG_ENAINT_ENTER()
|
---|
97 | #endif /* LOG_ENAINT_ENTER */
|
---|
98 |
|
---|
99 | #ifndef LOG_ENAINT_LEAVE
|
---|
100 | #define LOG_ENAINT_LEAVE()
|
---|
101 | #endif /* LOG_ENAINT_LEAVE */
|
---|
102 |
|
---|
103 | #ifndef LOG_SUSALL_ENTER
|
---|
104 | #define LOG_SUSALL_ENTER()
|
---|
105 | #endif /* LOG_SUSALL_ENTER */
|
---|
106 |
|
---|
107 | #ifndef LOG_SUSALL_LEAVE
|
---|
108 | #define LOG_SUSALL_LEAVE()
|
---|
109 | #endif /* LOG_SUSALL_LEAVE */
|
---|
110 |
|
---|
111 | #ifndef LOG_RSMALL_ENTER
|
---|
112 | #define LOG_RSMALL_ENTER()
|
---|
113 | #endif /* LOG_RSMALL_ENTER */
|
---|
114 |
|
---|
115 | #ifndef LOG_RSMALL_LEAVE
|
---|
116 | #define LOG_RSMALL_LEAVE()
|
---|
117 | #endif /* LOG_RSMALL_LEAVE */
|
---|
118 |
|
---|
119 | #ifndef LOG_SUSOSI_ENTER
|
---|
120 | #define LOG_SUSOSI_ENTER()
|
---|
121 | #endif /* LOG_SUSOSI_ENTER */
|
---|
122 |
|
---|
123 | #ifndef LOG_SUSOSI_LEAVE
|
---|
124 | #define LOG_SUSOSI_LEAVE()
|
---|
125 | #endif /* LOG_SUSOSI_LEAVE */
|
---|
126 |
|
---|
127 | #ifndef LOG_RSMOSI_ENTER
|
---|
128 | #define LOG_RSMOSI_ENTER()
|
---|
129 | #endif /* LOG_RSMOSI_ENTER */
|
---|
130 |
|
---|
131 | #ifndef LOG_RSMOSI_LEAVE
|
---|
132 | #define LOG_RSMOSI_LEAVE()
|
---|
133 | #endif /* LOG_RSMOSI_LEAVE */
|
---|
134 |
|
---|
135 | #ifndef LOG_GETISRID_ENTER
|
---|
136 | #define LOG_GETISRID_ENTER()
|
---|
137 | #endif /* LOG_GETISRID_ENTER */
|
---|
138 |
|
---|
139 | #ifndef LOG_GETISRID_LEAVE
|
---|
140 | #define LOG_GETISRID_LEAVE(ercd)
|
---|
141 | #endif /* LOG_GETISRID_LEAVE */
|
---|
142 |
|
---|
143 | #ifndef LOG_DISINTSRC_ENTER
|
---|
144 | #define LOG_DISINTSRC_ENTER(isrid)
|
---|
145 | #endif /* LOG_DISINTSRC_ENTER */
|
---|
146 |
|
---|
147 | #ifndef LOG_DISINTSRC_LEAVE
|
---|
148 | #define LOG_DISINTSRC_LEAVE(ercd)
|
---|
149 | #endif /* LOG_DISINTSRC_LEAVE */
|
---|
150 |
|
---|
151 | #ifndef LOG_ENAINTSRC_ENTER
|
---|
152 | #define LOG_ENAINTSRC_ENTER(isrid)
|
---|
153 | #endif /* LOG_ENAINTSRC_ENTER */
|
---|
154 |
|
---|
155 | #ifndef LOG_ENAINTSRC_LEAVE
|
---|
156 | #define LOG_ENAINTSRC_LEAVE(ercd)
|
---|
157 | #endif /* LOG_ENAINTSRC_LEAVE */
|
---|
158 |
|
---|
159 | /*
|
---|
160 | * ãã¹ã¦ã®å²è¾¼ã¿ã®ç¦æ¢ï¼é«éç°¡æçï¼
|
---|
161 | * å
|
---|
162 | ¨å²è¾¼ã¿ç¦æ¢ç¶æ
|
---|
163 | ã¸ç§»è¡
|
---|
164 | */
|
---|
165 | #ifdef TOPPERS_DisableAllInterrupts
|
---|
166 |
|
---|
167 | #ifndef OMIT_STANDARD_DISALLINT
|
---|
168 |
|
---|
169 | void
|
---|
170 | DisableAllInterrupts(void)
|
---|
171 | {
|
---|
172 | LOG_DISINT_ENTER();
|
---|
173 | if ((callevel_stat & (TSYS_DISALLINT | TSYS_SUSALLINT | TSYS_SUSOSINT)) == TSYS_NULL) {
|
---|
174 | x_lock_all_int();
|
---|
175 | ENTER_CALLEVEL(TSYS_DISALLINT);
|
---|
176 | }
|
---|
177 | LOG_DISINT_LEAVE();
|
---|
178 | }
|
---|
179 |
|
---|
180 | #endif /* OMIT_STANDARD_DISALLINT */
|
---|
181 |
|
---|
182 | #endif /* TOPPERS_DisableAllInterrupts */
|
---|
183 |
|
---|
184 | /*
|
---|
185 | * ãã¹ã¦ã®å²è¾¼ã¿ã®è¨±å¯ï¼é«éç°¡æçï¼
|
---|
186 | * å
|
---|
187 | ¨å²è¾¼ã¿ç¦æ¢ç¶æ
|
---|
188 | ã解é¤ãã
|
---|
189 | */
|
---|
190 | #ifdef TOPPERS_EnableAllInterrupts
|
---|
191 |
|
---|
192 | #ifndef OMIT_STANDARD_DISALLINT
|
---|
193 |
|
---|
194 | void
|
---|
195 | EnableAllInterrupts(void)
|
---|
196 | {
|
---|
197 | LOG_ENAINT_ENTER();
|
---|
198 | if ((callevel_stat & (TSYS_SUSALLINT | TSYS_SUSOSINT)) == TSYS_NULL) {
|
---|
199 | if ((callevel_stat & TSYS_DISALLINT) != TSYS_NULL) {
|
---|
200 | LEAVE_CALLEVEL(TSYS_DISALLINT);
|
---|
201 | x_unlock_all_int();
|
---|
202 | }
|
---|
203 | }
|
---|
204 | LOG_ENAINT_LEAVE();
|
---|
205 | }
|
---|
206 |
|
---|
207 | #endif /* OMIT_STANDARD_DISALLINT */
|
---|
208 |
|
---|
209 | #endif /* TOPPERS_EnableAllInterrupts */
|
---|
210 |
|
---|
211 | /*
|
---|
212 | * å
|
---|
213 | ¨å²è¾¼ã¿ç¦æ¢
|
---|
214 | * CPUå
|
---|
215 | ¨ã¦ã®å²è¾¼ã¿ã対象ã®å²è¾¼ã¿ç¦æ¢(ãã¹ãã«ã¦ã³ãæã)
|
---|
216 | */
|
---|
217 | #ifdef TOPPERS_SuspendAllInterrupts
|
---|
218 |
|
---|
219 | void
|
---|
220 | SuspendAllInterrupts(void)
|
---|
221 | {
|
---|
222 | #ifdef CFG_USE_ERRORHOOK
|
---|
223 | StatusType ercd;
|
---|
224 | #endif /* CFG_USE_ERRORHOOK */
|
---|
225 |
|
---|
226 | LOG_SUSALL_ENTER();
|
---|
227 | S_N_CHECK_DISALLINT();
|
---|
228 | S_N_CHECK_ERROR((run_trusted != FALSE), E_OS_ACCESS);
|
---|
229 | /* ãã¹ãåæ°ã®ä¸éå¤è¶
|
---|
230 | é */
|
---|
231 | S_N_CHECK_LIMIT(sus_all_cnt != UINT8_INVALID);
|
---|
232 |
|
---|
233 | if (sus_all_cnt == 0U) {
|
---|
234 | x_lock_all_int();
|
---|
235 | ENTER_CALLEVEL(TSYS_SUSALLINT);
|
---|
236 | }
|
---|
237 |
|
---|
238 | sus_all_cnt++;
|
---|
239 |
|
---|
240 | exit_no_errorhook:
|
---|
241 | LOG_SUSALL_LEAVE();
|
---|
242 | return;
|
---|
243 |
|
---|
244 | #ifdef CFG_USE_ERRORHOOK
|
---|
245 | exit_errorhook:
|
---|
246 | if (kerflg != FALSE) {
|
---|
247 | x_nested_lock_os_int();
|
---|
248 | call_errorhook(ercd, OSServiceId_SuspendAllInterrupts);
|
---|
249 | x_nested_unlock_os_int();
|
---|
250 | goto exit_no_errorhook;
|
---|
251 | }
|
---|
252 | #endif /* CFG_USE_ERRORHOOK */
|
---|
253 | }
|
---|
254 |
|
---|
255 | #endif /* TOPPERS_SuspendAllInterrupts */
|
---|
256 |
|
---|
257 | /*
|
---|
258 | * å
|
---|
259 | ¨å²è¾¼ã¿ç¦æ¢è§£é¤
|
---|
260 | * CPUå
|
---|
261 | ¨ã¦ã®å²è¾¼ã¿ã対象ã®å²è¾¼ã¿è¨±å¯(ãã¹ãã«ã¦ã³ãæã)
|
---|
262 | */
|
---|
263 | #ifdef TOPPERS_ResumeAllInterrupts
|
---|
264 |
|
---|
265 | void
|
---|
266 | ResumeAllInterrupts(void)
|
---|
267 | {
|
---|
268 | #ifdef CFG_USE_ERRORHOOK
|
---|
269 | StatusType ercd;
|
---|
270 | #endif /* CFG_USE_ERRORHOOK */
|
---|
271 |
|
---|
272 | LOG_RSMALL_ENTER();
|
---|
273 | S_N_CHECK_DISALLINT();
|
---|
274 | S_N_CHECK_STATE(sus_all_cnt != 0U);
|
---|
275 |
|
---|
276 | sus_all_cnt--;
|
---|
277 |
|
---|
278 | if (sus_all_cnt == 0U) {
|
---|
279 | LEAVE_CALLEVEL(TSYS_SUSALLINT);
|
---|
280 | x_unlock_all_int();
|
---|
281 | }
|
---|
282 |
|
---|
283 | exit_no_errorhook:
|
---|
284 | LOG_RSMALL_LEAVE();
|
---|
285 | return;
|
---|
286 |
|
---|
287 | #ifdef CFG_USE_ERRORHOOK
|
---|
288 | exit_errorhook:
|
---|
289 | if (kerflg != FALSE) {
|
---|
290 | x_nested_lock_os_int();
|
---|
291 | call_errorhook(ercd, OSServiceId_ResumeAllInterrupts);
|
---|
292 | x_nested_unlock_os_int();
|
---|
293 | goto exit_no_errorhook;
|
---|
294 | }
|
---|
295 | #endif /* CFG_USE_ERRORHOOK */
|
---|
296 | }
|
---|
297 |
|
---|
298 | #endif /* TOPPERS_ResumeAllInterrupts */
|
---|
299 |
|
---|
300 | /*
|
---|
301 | * OSå²è¾¼ã¿ã®ç¦æ¢
|
---|
302 | * C2ISRã対象ã®å²è¾¼ã¿ç¦æ¢(ãã¹ãã«ã¦ã³ãæã)
|
---|
303 | */
|
---|
304 | #ifdef TOPPERS_SuspendOSInterrupts
|
---|
305 |
|
---|
306 | void
|
---|
307 | SuspendOSInterrupts(void)
|
---|
308 | {
|
---|
309 | #ifdef CFG_USE_ERRORHOOK
|
---|
310 | StatusType ercd;
|
---|
311 | #endif /* CFG_USE_ERRORHOOK */
|
---|
312 |
|
---|
313 | LOG_SUSOSI_ENTER();
|
---|
314 | S_N_CHECK_DISALLINT();
|
---|
315 | /* ãã¹ãåæ°ã®ä¸éå¤è¶
|
---|
316 | é */
|
---|
317 | S_N_CHECK_LIMIT(sus_os_cnt != UINT8_INVALID);
|
---|
318 |
|
---|
319 | if (sus_os_cnt == 0U) {
|
---|
320 | x_suspend_lock_os_int();
|
---|
321 | ENTER_CALLEVEL(TSYS_SUSOSINT);
|
---|
322 | }
|
---|
323 |
|
---|
324 | sus_os_cnt++;
|
---|
325 |
|
---|
326 | exit_no_errorhook:
|
---|
327 | LOG_SUSOSI_LEAVE();
|
---|
328 | return;
|
---|
329 |
|
---|
330 | #ifdef CFG_USE_ERRORHOOK
|
---|
331 | exit_errorhook:
|
---|
332 | x_nested_lock_os_int();
|
---|
333 | call_errorhook(ercd, OSServiceId_SuspendOSInterrupts);
|
---|
334 | x_nested_unlock_os_int();
|
---|
335 | goto exit_no_errorhook;
|
---|
336 | #endif /* CFG_USE_ERRORHOOK */
|
---|
337 | }
|
---|
338 |
|
---|
339 | #endif /* TOPPERS_SuspendOSInterrupts */
|
---|
340 |
|
---|
341 | /*
|
---|
342 | * OSå²è¾¼ã¿ç¦æ¢è§£é¤
|
---|
343 | * C2ISRã対象ã®å²è¾¼ã¿è¨±å¯(ãã¹ãã«ã¦ã³ãæã)
|
---|
344 | */
|
---|
345 | #ifdef TOPPERS_ResumeOSInterrupts
|
---|
346 |
|
---|
347 | void
|
---|
348 | ResumeOSInterrupts(void)
|
---|
349 | {
|
---|
350 | #ifdef CFG_USE_ERRORHOOK
|
---|
351 | StatusType ercd;
|
---|
352 | #endif /* CFG_USE_ERRORHOOK */
|
---|
353 |
|
---|
354 | LOG_RSMOSI_ENTER();
|
---|
355 | S_N_CHECK_DISALLINT();
|
---|
356 | S_N_CHECK_STATE(sus_os_cnt != 0U);
|
---|
357 |
|
---|
358 | sus_os_cnt--;
|
---|
359 |
|
---|
360 | if (sus_os_cnt == 0U) {
|
---|
361 | LEAVE_CALLEVEL(TSYS_SUSOSINT);
|
---|
362 | x_resume_unlock_os_int();
|
---|
363 | }
|
---|
364 |
|
---|
365 | exit_no_errorhook:
|
---|
366 | LOG_RSMOSI_LEAVE();
|
---|
367 | return;
|
---|
368 |
|
---|
369 | #ifdef CFG_USE_ERRORHOOK
|
---|
370 | exit_errorhook:
|
---|
371 | x_nested_lock_os_int();
|
---|
372 | call_errorhook(ercd, OSServiceId_ResumeOSInterrupts);
|
---|
373 | x_nested_unlock_os_int();
|
---|
374 | goto exit_no_errorhook;
|
---|
375 | #endif /* CFG_USE_ERRORHOOK */
|
---|
376 | }
|
---|
377 |
|
---|
378 | #endif /* TOPPERS_ResumeOSInterrupts */
|
---|
379 |
|
---|
380 | /*
|
---|
381 | * C2ISR IDã®åå¾
|
---|
382 | */
|
---|
383 | #ifdef TOPPERS_GetISRID
|
---|
384 |
|
---|
385 | ISRType
|
---|
386 | GetISRID(void)
|
---|
387 | {
|
---|
388 | ISRType isrid;
|
---|
389 | StatusType ercd;
|
---|
390 |
|
---|
391 | LOG_GETISRID_ENTER();
|
---|
392 | CHECK_CALLEVEL(CALLEVEL_GETISRID);
|
---|
393 |
|
---|
394 | isrid = (p_runisr == NULL) ? INVALID_ISR : ISR2ID(p_runisr);
|
---|
395 |
|
---|
396 | exit_finish:
|
---|
397 | LOG_GETISRID_LEAVE(isrid);
|
---|
398 | return(isrid);
|
---|
399 |
|
---|
400 | #ifdef CFG_USE_ERRORHOOK
|
---|
401 | exit_errorhook:
|
---|
402 | x_nested_lock_os_int();
|
---|
403 | /*
|
---|
404 | * ã¨ã©ã¼çºçæã¯INVALID_ISRIDãè¿ããï¼ã¨ã©ã¼ãçºçããã®ãå®è¡ä¸ã®
|
---|
405 | * C2ISRãåå¨ããªãã®ãåºå¥ããããï¼ã¨ã©ã¼ããã¯ãå¼ã¶
|
---|
406 | */
|
---|
407 | call_errorhook(ercd, OSServiceId_GetISRID);
|
---|
408 | x_nested_unlock_os_int();
|
---|
409 | #endif /* CFG_USE_ERRORHOOK */
|
---|
410 |
|
---|
411 | exit_no_errorhook:
|
---|
412 | isrid = INVALID_ISR;
|
---|
413 | goto exit_finish;
|
---|
414 | }
|
---|
415 |
|
---|
416 | #endif /* TOPPERS_GetISRID */
|
---|
417 |
|
---|
418 | /*
|
---|
419 | * å²è¾¼ã¿ã®ç¦æ¢
|
---|
420 | */
|
---|
421 | #ifdef TOPPERS_DisableInterruptSource
|
---|
422 |
|
---|
423 | StatusType
|
---|
424 | DisableInterruptSource(ISRType DisableISR)
|
---|
425 | {
|
---|
426 | ISRCB *p_isrcb;
|
---|
427 | StatusType ercd;
|
---|
428 |
|
---|
429 | LOG_DISINTSRC_ENTER(DisableISR);
|
---|
430 | CHECK_CALLEVEL(CALLEVEL_DISABLEINTERRUPTSOURCE);
|
---|
431 | CHECK_ID(DisableISR < tnum_isr2);
|
---|
432 | p_isrcb = get_isrcb(DisableISR);
|
---|
433 | CHECK_RIGHT(p_isrcb->p_isrinib->acsbtmp);
|
---|
434 | CHECK_NOFUNC(target_is_int_controllable(p_isrcb->p_isrinib->p_intinib->intno) != FALSE);
|
---|
435 |
|
---|
436 | x_nested_lock_os_int();
|
---|
437 | D_CHECK_ACCESS((p_isrcb->p_isrinib->p_osapcb->osap_stat == APPLICATION_ACCESSIBLE) ||
|
---|
438 | (p_isrcb->p_isrinib->p_osapcb == p_runosap));
|
---|
439 | x_disable_int(GET_INTNO(p_isrcb));
|
---|
440 | ercd = E_OK;
|
---|
441 | d_exit_no_errorhook:
|
---|
442 | x_nested_unlock_os_int();
|
---|
443 |
|
---|
444 | exit_no_errorhook:
|
---|
445 | LOG_DISINTSRC_LEAVE(ercd);
|
---|
446 | return(ercd);
|
---|
447 |
|
---|
448 | #ifdef CFG_USE_ERRORHOOK
|
---|
449 | exit_errorhook:
|
---|
450 | x_nested_lock_os_int();
|
---|
451 | d_exit_errorhook:
|
---|
452 | #ifdef CFG_USE_PARAMETERACCESS
|
---|
453 | _errorhook_par1.isrid = DisableISR;
|
---|
454 | #endif /* CFG_USE_PARAMETERACCESS */
|
---|
455 | call_errorhook(ercd, OSServiceId_DisableInterruptSource);
|
---|
456 | x_nested_unlock_os_int();
|
---|
457 | goto exit_no_errorhook;
|
---|
458 | #endif /* CFG_USE_ERRORHOOK */
|
---|
459 | }
|
---|
460 |
|
---|
461 | #endif /* TOPPERS_DisableInterruptSource */
|
---|
462 |
|
---|
463 | /*
|
---|
464 | * å²è¾¼ã¿ã®è¨±å¯
|
---|
465 | */
|
---|
466 | #ifdef TOPPERS_EnableInterruptSource
|
---|
467 |
|
---|
468 | StatusType
|
---|
469 | EnableInterruptSource(ISRType EnableISR)
|
---|
470 | {
|
---|
471 | ISRCB *p_isrcb;
|
---|
472 | StatusType ercd;
|
---|
473 |
|
---|
474 | LOG_ENAINTSRC_ENTER(EnableISR);
|
---|
475 | CHECK_CALLEVEL(CALLEVEL_ENABLEINTERRUPTSOURCE);
|
---|
476 | CHECK_ID(EnableISR < tnum_isr2);
|
---|
477 | p_isrcb = get_isrcb(EnableISR);
|
---|
478 | CHECK_RIGHT(p_isrcb->p_isrinib->acsbtmp);
|
---|
479 | CHECK_NOFUNC(target_is_int_controllable(p_isrcb->p_isrinib->p_intinib->intno) != FALSE);
|
---|
480 |
|
---|
481 | x_nested_lock_os_int();
|
---|
482 | D_CHECK_ACCESS((p_isrcb->p_isrinib->p_osapcb->osap_stat == APPLICATION_ACCESSIBLE) ||
|
---|
483 | (p_isrcb->p_isrinib->p_osapcb == p_runosap));
|
---|
484 | x_enable_int(GET_INTNO(p_isrcb));
|
---|
485 | ercd = E_OK;
|
---|
486 | d_exit_no_errorhook:
|
---|
487 | x_nested_unlock_os_int();
|
---|
488 |
|
---|
489 | exit_no_errorhook:
|
---|
490 | LOG_ENAINTSRC_LEAVE(ercd);
|
---|
491 | return(ercd);
|
---|
492 |
|
---|
493 | #ifdef CFG_USE_ERRORHOOK
|
---|
494 | exit_errorhook:
|
---|
495 | x_nested_lock_os_int();
|
---|
496 | d_exit_errorhook:
|
---|
497 | #ifdef CFG_USE_PARAMETERACCESS
|
---|
498 | _errorhook_par1.isrid = EnableISR;
|
---|
499 | #endif /* CFG_USE_PARAMETERACCESS */
|
---|
500 | call_errorhook(ercd, OSServiceId_EnableInterruptSource);
|
---|
501 | x_nested_unlock_os_int();
|
---|
502 | goto exit_no_errorhook;
|
---|
503 | #endif /* CFG_USE_ERRORHOOK */
|
---|
504 | }
|
---|
505 |
|
---|
506 | #endif /* TOPPERS_EnableInterruptSource */
|
---|