source: UsbWattMeter/trunk/asp_dcre/kernel/task.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: 10.8 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-2011 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: task.c 164 2016-03-07 11:33:50Z coas-nagasima $
45 */
46
47/*
48 * ƒ^ƒXƒNŠÇ—ƒ‚ƒWƒ…
49[ƒ‹
50 */
51
52#include "kernel_impl.h"
53#include "wait.h"
54#include "task.h"
55
56/*
57 * ƒgƒŒ[ƒXƒƒOƒ}ƒNƒ‚̃fƒtƒHƒ‹ƒg’è‹`
58 */
59#ifndef LOG_TEX_ENTER
60#define LOG_TEX_ENTER(p_tcb, texptn)
61#endif /* LOG_TEX_ENTER */
62
63#ifndef LOG_TEX_LEAVE
64#define LOG_TEX_LEAVE(p_tcb, texptn)
65#endif /* LOG_TEX_LEAVE */
66
67#ifdef TOPPERS_tskini
68
69/*
70 * ŽÀsó‘Ԃ̃^ƒXƒN
71 */
72TCB *p_runtsk;
73
74/*
75 * Å‚—Dæ‡ˆÊ‚̃^ƒXƒN
76 */
77TCB *p_schedtsk;
78
79/*
80 * ƒ^ƒXƒNƒfƒBƒXƒpƒbƒ`^ƒ^ƒXƒN—áŠOˆ—ƒ‹[ƒ`ƒ“‹N“®—v‹ƒtƒ‰ƒO
81 */
82bool_t reqflg;
83
84/*
85 * Š„ž‚Ý—Dæ“xƒ}ƒXƒN‘S‰ðœó‘Ô
86 */
87bool_t ipmflg;
88
89/*
90 * ƒfƒBƒXƒpƒbƒ`‹ÖŽ~ó‘Ô
91 */
92bool_t disdsp;
93
94/*
95 * ƒ^ƒXƒNƒfƒBƒXƒpƒbƒ`‰Â”\ó‘Ô
96 */
97bool_t dspflg;
98
99/*
100 * ƒŒƒfƒBƒLƒ…
101[
102 */
103QUEUE ready_queue[TNUM_TPRI];
104
105/*
106 * ƒŒƒfƒBƒLƒ…
107[ƒT[ƒ`‚Ì‚½‚߂̃rƒbƒgƒ}ƒbƒv
108 */
109uint16_t ready_primap;
110
111/*
112 * Žg—p‚µ‚Ä‚¢‚È‚¢TCB‚̃ŠƒXƒg
113 */
114QUEUE free_tcb;
115
116/*
117 * ƒ^ƒXƒNŠÇ—ƒ‚ƒWƒ…
118[ƒ‹‚̏‰Šú‰»
119 */
120void
121initialize_task(void)
122{
123 uint_t i, j;
124 TCB *p_tcb;
125 TINIB *p_tinib;
126
127 p_runtsk = NULL;
128 p_schedtsk = NULL;
129 reqflg = false;
130 ipmflg = true;
131 disdsp = false;
132 dspflg = true;
133
134 for (i = 0; i < TNUM_TPRI; i++) {
135 queue_initialize(&(ready_queue[i]));
136 }
137 ready_primap = 0U;
138
139 for (i = 0; i < tnum_stsk; i++) {
140 j = INDEX_TSK(torder_table[i]);
141 p_tcb = &(tcb_table[j]);
142 p_tcb->p_tinib = &(tinib_table[j]);
143 p_tcb->actque = false;
144 make_dormant(p_tcb);
145 if ((p_tcb->p_tinib->tskatr & TA_ACT) != 0U) {
146 (void) make_active(p_tcb);
147 }
148 }
149 queue_initialize(&free_tcb);
150 for (j = 0; i < tnum_tsk; i++, j++) {
151 p_tcb = &(tcb_table[i]);
152 p_tinib = &(atinib_table[j]);
153 p_tinib->tskatr = TA_NOEXS;
154 p_tcb->p_tinib = ((const TINIB *) p_tinib);
155 queue_insert_prev(&free_tcb, &(p_tcb->task_queue));
156 }
157}
158
159#endif /* TOPPERS_tskini */
160
161/*
162 * ƒrƒbƒgƒ}ƒbƒvƒT[ƒ`ŠÖ”
163 *
164 * bitmap“à‚Ì1‚̃rƒbƒg‚Ì“àCÅ‚à‰ºˆÊi‰Ej‚Ì‚à‚Ì‚ðƒT[ƒ`‚µC‚»‚̃rƒb
165 * ƒg”ԍ†‚ð•Ô‚·Dƒrƒbƒg”ԍ†‚́CÅ‰ºˆÊƒrƒbƒg‚ð0‚Æ‚·‚éDbitmap‚É0‚ðŽw’è
166 * ‚µ‚Ä‚Í‚È‚ç‚È‚¢D‚±‚̊֐”‚ł́Cbitmap‚ª16ƒrƒbƒg‚Å‚ ‚邱‚Æ‚ð‰¼’è‚µC
167 * uint16_tŒ^‚Æ‚µ‚Ä‚¢‚éD
168 *
169 * ƒrƒbƒgƒT[ƒ`–½—ß‚ðŽ‚ÂƒvƒƒZƒbƒT‚ł́CƒrƒbƒgƒT[ƒ`–½—ß‚ðŽg‚¤‚悤‚É
170 * ‘‚«’¼‚µ‚½•û‚ªŒø—¦‚ª—Ç‚¢ê‡‚ª‚ ‚éD‚±‚̂悤‚ȏꍇ‚ɂ́Cƒ^[ƒQƒbƒg
171 * ˆË‘¶•”‚ŃrƒbƒgƒT[ƒ`–½—ß‚ðŽg‚Á‚½bitmap_search‚ð’è‹`‚µC
172 * OMIT_BITMAP_SEARCH‚ðƒ}ƒNƒ’è‹`‚·‚ê‚΂悢D‚Ü‚½CƒrƒbƒgƒT[ƒ`–½—ß‚Ì
173 * ƒT[ƒ`•ûŒü‚ª‹t‚È‚Ç‚Ì——R‚Å—Dæ“x‚ƃrƒbƒg‚Ƃ̑Ήž‚ð•ÏX‚µ‚½‚¢ê‡‚É
174 * ‚́CPRIMAP_BIT‚ðƒ}ƒNƒ’è‹`‚·‚ê‚΂悢D
175 *
176 * ‚Ü‚½Cƒ‰ƒCƒuƒ‰ƒŠ‚Éffs‚ª‚ ‚é‚È‚çCŽŸ‚̂悤‚É’è‹`‚µ‚ă‰ƒCƒuƒ‰ƒŠŠÖ”‚ð
177 * Žg‚Á‚½•û‚ªŒø—¦‚ª—Ç‚¢‰Â”\«‚à‚ ‚éD
178 * #define bitmap_search(bitmap) (ffs(bitmap) - 1)
179 */
180#ifndef PRIMAP_BIT
181#define PRIMAP_BIT(pri) (1U << (pri))
182#endif /* PRIMAP_BIT */
183
184#ifndef OMIT_BITMAP_SEARCH
185
186static const unsigned char bitmap_search_table[] = { 0, 1, 0, 2, 0, 1, 0,
187 3, 0, 1, 0, 2, 0, 1, 0 };
188
189Inline uint_t
190bitmap_search(uint16_t bitmap)
191{
192 uint_t n = 0U;
193
194 assert(bitmap != 0U);
195 if ((bitmap & 0x00ffU) == 0U) {
196 bitmap >>= 8;
197 n += 8;
198 }
199 if ((bitmap & 0x0fU) == 0U) {
200 bitmap >>= 4;
201 n += 4;
202 }
203 return(n + bitmap_search_table[(bitmap & 0x0fU) - 1]);
204}
205
206#endif /* OMIT_BITMAP_SEARCH */
207
208/*
209 * —Dæ“xƒrƒbƒgƒ}ƒbƒv‚ª‹ó‚©‚̃`ƒFƒbƒN
210 */
211Inline bool_t
212primap_empty(void)
213{
214 return(ready_primap == 0U);
215}
216
217/*
218 * —Dæ“xƒrƒbƒgƒ}ƒbƒv‚̃T[ƒ`
219 */
220Inline uint_t
221primap_search(void)
222{
223 return(bitmap_search(ready_primap));
224}
225
226/*
227 * —Dæ“xƒrƒbƒgƒ}ƒbƒv‚̃Zƒbƒg
228 */
229Inline void
230primap_set(uint_t pri)
231{
232 ready_primap |= PRIMAP_BIT(pri);
233}
234
235/*
236 * —Dæ“xƒrƒbƒgƒ}ƒbƒv‚̃NƒŠƒA
237 */
238Inline void
239primap_clear(uint_t pri)
240{
241 ready_primap &= ~PRIMAP_BIT(pri);
242}
243
244/*
245 * Å‚—Dæ‡ˆÊƒ^ƒXƒN‚̃T[ƒ`
246 */
247#ifdef TOPPERS_tsksched
248
249TCB *
250search_schedtsk(void)
251{
252 uint_t schedpri;
253
254 schedpri = primap_search();
255 return((TCB *)(ready_queue[schedpri].p_next));
256}
257
258#endif /* TOPPERS_tsksched */
259
260/*
261 * ŽÀs‚Å‚«‚éó‘Ô‚Ö‚Ì‘JˆÚ
262 *
263 * Å‚—Dæ‡ˆÊ‚̃^ƒXƒN‚ðXV‚·‚é‚̂́CŽÀs‚Å‚«‚éƒ^ƒXƒN‚ª‚È‚©‚Á‚½ê‡
264 * ‚ƁCp_tcb‚Ì—Dæ“x‚ªÅ‚—Dæ‡ˆÊ‚̃^ƒXƒN‚Ì—Dæ“x‚æ‚è‚à‚‚¢ê‡‚Å‚ 
265 * ‚éD
266 */
267#ifdef TOPPERS_tskrun
268
269bool_t
270make_runnable(TCB *p_tcb)
271{
272 uint_t pri = p_tcb->priority;
273
274 queue_insert_prev(&(ready_queue[pri]), &(p_tcb->task_queue));
275 primap_set(pri);
276
277 if (p_schedtsk == (TCB *) NULL || pri < p_schedtsk->priority) {
278 p_schedtsk = p_tcb;
279 return(dspflg);
280 }
281 return(false);
282}
283
284#endif /* TOPPERS_tskrun */
285
286/*
287 * ŽÀs‚Å‚«‚éó‘Ô‚©‚瑼‚̏ó‘Ô‚Ö‚Ì‘JˆÚ
288 *
289 * Å‚—Dæ‡ˆÊ‚̃^ƒXƒN‚ðXV‚·‚é‚̂́Cp_tcb‚ªÅ‚—Dæ‡ˆÊ‚̃^ƒXƒN‚Å
290 * ‚ ‚Á‚½ê‡‚Å‚ ‚éDp_tcb‚Æ“¯‚¶—Dæ“x‚̃^ƒXƒN‚ª‘¼‚É‚ ‚éê‡‚́Cp_tcb
291 * ‚ÌŽŸ‚̃^ƒXƒN‚ªÅ‚—Dæ‡ˆÊ‚É‚È‚éD‚»‚¤‚Å‚È‚¢ê‡‚́CƒŒƒfƒBƒLƒ…
292[‚ð
293 * ƒT[ƒ`‚·‚é•K—v‚ª‚ ‚éD
294 */
295#ifdef TOPPERS_tsknrun
296
297bool_t
298make_non_runnable(TCB *p_tcb)
299{
300 uint_t pri = p_tcb->priority;
301 QUEUE *p_queue = &(ready_queue[pri]);
302
303 queue_delete(&(p_tcb->task_queue));
304 if (queue_empty(p_queue)) {
305 primap_clear(pri);
306 if (p_schedtsk == p_tcb) {
307 p_schedtsk = primap_empty() ? (TCB *) NULL : search_schedtsk();
308 return(dspflg);
309 }
310 }
311 else {
312 if (p_schedtsk == p_tcb) {
313 p_schedtsk = (TCB *)(p_queue->p_next);
314 return(dspflg);
315 }
316 }
317 return(false);
318}
319
320#endif /* TOPPERS_tsknrun */
321
322/*
323 * ‹xŽ~ó‘Ô‚Ö‚Ì‘JˆÚ
324 */
325#ifdef TOPPERS_tskdmt
326
327void
328make_dormant(TCB *p_tcb)
329{
330 p_tcb->tstat = TS_DORMANT;
331 p_tcb->priority = p_tcb->p_tinib->ipriority;
332 p_tcb->wupque = false;
333 p_tcb->enatex = false;
334 p_tcb->texptn = 0U;
335 LOG_TSKSTAT(p_tcb);
336}
337
338#endif /* TOPPERS_tskdmt */
339
340/*
341 * ‹xŽ~ó‘Ô‚©‚çŽÀs‚Å‚«‚éó‘Ô‚Ö‚Ì‘JˆÚ
342 */
343#ifdef TOPPERS_tskact
344
345bool_t
346make_active(TCB *p_tcb)
347{
348 activate_context(p_tcb);
349 p_tcb->tstat = TS_RUNNABLE;
350 LOG_TSKSTAT(p_tcb);
351 return(make_runnable(p_tcb));
352}
353
354#endif /* TOPPERS_tskact */
355
356/*
357 * ƒ^ƒXƒN‚Ì—Dæ“x‚̕ύX
358 *
359 * ƒ^ƒXƒN‚ªŽÀs‚Å‚«‚éó‘Ԃ̏ꍇ‚ɂ́CƒŒƒfƒBƒLƒ…
360[‚Ì’†‚ł̈ʒu‚ð•ÏX‚·
361 * ‚éDƒIƒuƒWƒFƒNƒg‚Ì‘Ò‚¿ƒLƒ…
362[‚Ì’†‚Å‘Ò‚¿ó‘Ô‚É‚È‚Á‚Ä‚¢‚éê‡‚ɂ́C‘Ò
363 * ‚¿ƒLƒ…
364[‚Ì’†‚ł̈ʒu‚ð•ÏX‚·‚éD
365 *
366 * Å‚—Dæ‡ˆÊ‚̃^ƒXƒN‚ðXV‚·‚é‚̂́C(1) p_tcb‚ªÅ‚—Dæ‡ˆÊ‚̃^ƒX
367 * ƒN‚Å‚ ‚Á‚āC‚»‚Ì—Dæ“x‚ð‰º‚°‚½ê‡C(2) p_tcb‚ªÅ‚—Dæ‡ˆÊ‚̃^ƒX
368 * ƒN‚Å‚Í‚È‚­C•ÏXŒã‚Ì—Dæ“x‚ªÅ‚—Dæ‡ˆÊ‚̃^ƒXƒN‚Ì—Dæ“x‚æ‚è‚à‚‚¢
369 * ê‡‚Å‚ ‚éD(1)‚̏ꍇ‚ɂ́CƒŒƒfƒBƒLƒ…
370[‚ðƒT[ƒ`‚·‚é•K—v‚ª‚ ‚éD
371 */
372#ifdef TOPPERS_tskpri
373
374bool_t
375change_priority(TCB *p_tcb, uint_t newpri)
376{
377 uint_t oldpri;
378
379 oldpri = p_tcb->priority;
380 p_tcb->priority = newpri;
381
382 if (TSTAT_RUNNABLE(p_tcb->tstat)) {
383 /*
384 * ƒ^ƒXƒN‚ªŽÀs‚Å‚«‚éó‘Ԃ̏ꍇ
385 */
386 queue_delete(&(p_tcb->task_queue));
387 if (queue_empty(&(ready_queue[oldpri]))) {
388 primap_clear(oldpri);
389 }
390 queue_insert_prev(&(ready_queue[newpri]), &(p_tcb->task_queue));
391 primap_set(newpri);
392
393 if (p_schedtsk == p_tcb) {
394 if (newpri >= oldpri) {
395 p_schedtsk = search_schedtsk();
396 return(p_schedtsk != p_tcb && dspflg);
397 }
398 }
399 else {
400 if (newpri < p_schedtsk->priority) {
401 p_schedtsk = p_tcb;
402 return(dspflg);
403 }
404 }
405 }
406 else {
407 if (TSTAT_WAIT_WOBJCB(p_tcb->tstat)) {
408 /*
409 * ƒ^ƒXƒN‚ªC“¯ŠúE’ʐMƒIƒuƒWƒFƒNƒg‚ÌŠÇ—ƒuƒƒbƒN‚Ì‹¤’Ê•”
410 * •ªiWOBJCBj‚Ì‘Ò‚¿ƒLƒ…
411[‚ɂ‚Ȃª‚ê‚Ä‚¢‚éê‡
412 */
413 wobj_change_priority(((WINFO_WOBJ *)(p_tcb->p_winfo))->p_wobjcb,
414 p_tcb);
415 }
416 }
417 return(false);
418}
419
420#endif /* TOPPERS_tskpri */
421
422/*
423 * ƒŒƒfƒBƒLƒ…
424[‚̉ñ“]
425 *
426 * Å‚—Dæ‡ˆÊ‚̃^ƒXƒN‚ðXV‚·‚é‚̂́CÅ‚—Dæ‡ˆÊ‚̃^ƒXƒN‚ªƒ^ƒXƒNƒL
427 * ƒ…
428[‚Ì––”ö‚Ɉړ®‚µ‚½ê‡‚Å‚ ‚éD
429 */
430#ifdef TOPPERS_tskrot
431
432bool_t
433rotate_ready_queue(uint_t pri)
434{
435 QUEUE *p_queue = &(ready_queue[pri]);
436 QUEUE *p_entry;
437
438 if (!queue_empty(p_queue) && p_queue->p_next->p_next != p_queue) {
439 p_entry = queue_delete_next(p_queue);
440 queue_insert_prev(p_queue, p_entry);
441 if (p_schedtsk == (TCB *) p_entry) {
442 p_schedtsk = (TCB *)(p_queue->p_next);
443 return(dspflg);
444 }
445 }
446 return(false);
447}
448
449#endif /* TOPPERS_tskrot */
450
451/*
452 * ƒ^ƒXƒN—áŠOˆ—ƒ‹[ƒ`ƒ“‚̌ďo‚µ
453 *
454 * ASPƒJ[ƒlƒ‹‚ł́Cƒ^ƒXƒN—áŠOˆ—ƒ‹[ƒ`ƒ““à‚ÅCPUƒƒbƒNó‘Ô‚É‘JˆÚ‚µC
455 * Œ³‚̏ó‘Ô‚É–ß‚³‚¸‚ɃŠƒ^[ƒ“‚µ‚½ê‡CƒJ[ƒlƒ‹‚ªŒ³‚̏ó‘Ô‚É–ß‚·D
456 */
457#ifdef TOPPERS_tsktex
458
459void
460call_texrtn(void)
461{
462 TEXPTN texptn;
463 bool_t saved_disdsp;
464
465 saved_disdsp = disdsp;
466 p_runtsk->enatex = false;
467 do {
468 texptn = p_runtsk->texptn;
469 p_runtsk->texptn = 0U;
470
471 t_unlock_cpu();
472 LOG_TEX_ENTER(p_runtsk, texptn);
473 (*((TEXRTN)(p_runtsk->p_tinib->texrtn)))(texptn,
474 p_runtsk->p_tinib->exinf);
475 LOG_TEX_LEAVE(p_runtsk, texptn);
476 if (!t_sense_lock()) {
477 t_lock_cpu();
478 }
479 if (!ipmflg) {
480 t_set_ipm(TIPM_ENAALL);
481 ipmflg = true;
482 }
483 disdsp = saved_disdsp;
484 dspflg = !disdsp;
485 p_runtsk->enatex = false;
486 if (p_runtsk != p_schedtsk && dspflg) {
487 /*
488 * ‚±‚±‚Ådispatch‚ðŒÄ‚яo‚·ˆ—‚́C‘ŠŒÝÄ‹AŒÄo‚µ‚É‚È‚Á‚Ä
489 * ‚¢‚邪Cdispatch‚ðŒÄ‚Ô‘O‚Ép_runtsk->enatex‚ðfalse‚É‚µ‚Ä
490 * ‚¨‚¯‚ÎŽxá‚ª‚È‚¢D‚»‚Ì——R‚ɂ‚¢‚ẮCuTOPPERS/ASP ƒJ[
491 * ƒlƒ‹ ÝŒvƒƒ‚v‚ðŽQÆ‚Ì‚±‚ƁD
492 */
493 dispatch();
494 }
495 } while (p_runtsk->texptn != 0U);
496 p_runtsk->enatex = true;
497}
498
499/*
500 * ƒ^ƒXƒN—áŠOˆ—ƒ‹[ƒ`ƒ“‚Ì‹N“®
501 */
502#ifndef OMIT_CALLTEX
503
504void
505calltex(void)
506{
507 if (p_runtsk->enatex && p_runtsk->texptn != 0U && ipmflg) {
508 call_texrtn();
509 }
510}
511
512#endif /* OMIT_CALLTEX */
513#endif /* TOPPERS_tsktex */
Note: See TracBrowser for help on using the repository browser.