source: UsbWattMeter/trunk/asp_dcre/include/kernel.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: 20.1 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) 2004-2014 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: kernel.h 164 2016-03-07 11:33:50Z coas-nagasima $
45 */
46
47/*
48 * TOPPERS/ASPƒJ[ƒlƒ‹ •W€ƒwƒbƒ_ƒtƒ@ƒCƒ‹
49 *
50 * TOPPERS/ASPƒJ[ƒlƒ‹‚ªƒTƒ|[ƒg‚·‚éƒT[ƒrƒXƒR[ƒ‹‚̐錾‚ƁC•K—v‚ȃf[
51 * ƒ^Œ^C’萔Cƒ}ƒNƒ‚Ì’è‹`‚ðŠÜ‚Þƒwƒbƒ_ƒtƒ@ƒCƒ‹D
52 *
53 * ƒAƒZƒ“ƒuƒŠŒ¾Œê‚̃\[ƒXƒtƒ@ƒCƒ‹‚©‚炱‚̃tƒ@ƒCƒ‹‚ðƒCƒ“ƒNƒ‹[ƒh‚·‚鎞
54 * ‚́CTOPPERS_MACRO_ONLY‚ð’è‹`‚µ‚Ä‚¨‚­D‚±‚ê‚É‚æ‚èCƒ}ƒNƒ’è‹`ˆÈŠO‚ð
55 * œ‚­‚悤‚É‚È‚Á‚Ä‚¢‚éD
56 *
57 * ‚±‚̃tƒ@ƒCƒ‹‚ðƒCƒ“ƒNƒ‹[ƒh‚·‚é‘O‚ɃCƒ“ƒNƒ‹[ƒh‚µ‚Ä‚¨‚­‚ׂ«ƒtƒ@ƒCƒ‹
58 * ‚Í‚È‚¢D
59 */
60
61#ifndef TOPPERS_KERNEL_H
62#define TOPPERS_KERNEL_H
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68/*
69 * TOPPERS‹¤’ʂ̃f[ƒ^Œ^E’萔Eƒ}ƒNƒ
70 */
71#include <t_stddef.h>
72
73/*
74 * ƒ^[ƒQƒbƒgˆË‘¶•”
75 */
76#include "target_kernel.h"
77
78#ifndef TOPPERS_MACRO_ONLY
79
80/*
81 * ƒf[ƒ^Œ^‚Ì’è‹`
82 */
83
84/*
85 * ƒrƒbƒgƒpƒ^[ƒ“‚âƒIƒuƒWƒFƒNƒg”ԍ†‚ÌŒ^’è‹`
86 */
87typedef uint_t TEXPTN; /* ƒ^ƒXƒN—áŠO—vˆö‚̃rƒbƒgƒpƒ^[ƒ“ */
88typedef uint_t FLGPTN; /* ƒCƒxƒ“ƒgƒtƒ‰ƒO‚̃rƒbƒgƒpƒ^[ƒ“ */
89typedef uint_t INTNO; /* Š„ž‚ݔԍ† */
90typedef uint_t INHNO; /* Š„ž‚݃nƒ“ƒhƒ‰”ԍ† */
91typedef uint_t EXCNO; /* CPU—áŠOƒnƒ“ƒhƒ‰”ԍ† */
92
93/*
94 * ˆ—’PˆÊ‚ÌŒ^’è‹`
95 */
96typedef void (*TASK)(intptr_t exinf);
97typedef void (*TEXRTN)(TEXPTN texptn, intptr_t exinf);
98typedef void (*CYCHDR)(intptr_t exinf);
99typedef void (*ALMHDR)(intptr_t exinf);
100typedef void (*ISR)(intptr_t exinf);
101typedef void (*INTHDR)(void);
102typedef void (*EXCHDR)(void *p_excinf);
103typedef void (*INIRTN)(intptr_t exinf);
104typedef void (*TERRTN)(intptr_t exinf);
105
106/*
107 * ƒƒ‚ƒŠ—̈æŠm•Û‚Ì‚½‚ß‚ÌŒ^’è‹`
108 */
109#ifndef TOPPERS_STK_T
110#define TOPPERS_STK_T intptr_t
111#endif /* TOPPERS_STK_T */
112typedef TOPPERS_STK_T STK_T; /* ƒXƒ^ƒbƒN—̈æ‚ðŠm•Û‚·‚邽‚ß‚ÌŒ^ */
113
114#ifndef TOPPERS_MPF_T
115#define TOPPERS_MPF_T intptr_t
116#endif /* TOPPERS_MPF_T */
117typedef TOPPERS_MPF_T MPF_T; /* ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹—̈æ‚ðŠm•Û‚·‚邽‚ß‚ÌŒ^ */
118
119/*
120 * ƒƒbƒZ[ƒWƒwƒbƒ_‚ÌŒ^’è‹`
121 */
122typedef struct t_msg { /* ƒ[ƒ‹ƒ{ƒbƒNƒX‚̃ƒbƒZ[ƒWƒwƒbƒ_ */
123 struct t_msg *pk_next;
124} T_MSG;
125
126typedef struct t_msg_pri { /* —Dæ“x•t‚«ƒƒbƒZ[ƒWƒwƒbƒ_ */
127 T_MSG msgque; /* ƒƒbƒZ[ƒWƒwƒbƒ_ */
128 PRI msgpri; /* ƒƒbƒZ[ƒW—Dæ“x */
129} T_MSG_PRI;
130
131/*
132 * ƒpƒPƒbƒgŒ`Ž®‚Ì’è‹`
133 */
134typedef struct t_ctsk {
135 ATR tskatr; /* ƒ^ƒXƒN‘®« */
136 intptr_t exinf; /* ƒ^ƒXƒN‚ÌŠg’£î•ñ */
137 TASK task; /* ƒ^ƒXƒN‚̃ƒCƒ“ƒ‹[ƒ`ƒ“‚̐擪”Ô’n */
138 PRI itskpri; /* ƒ^ƒXƒN‚Ì‹N“®Žž—Dæ“x */
139 SIZE stksz; /* ƒ^ƒXƒN‚̃Xƒ^ƒbƒN—̈æ‚̃TƒCƒY */
140 STK_T *stk; /* ƒ^ƒXƒN‚̃Xƒ^ƒbƒN—̈æ‚̐擪”Ô’n */
141} T_CTSK;
142
143typedef struct t_rtsk {
144 STAT tskstat; /* ƒ^ƒXƒNó‘Ô */
145 PRI tskpri; /* ƒ^ƒXƒN‚ÌŒ»Ý—Dæ“x */
146 PRI tskbpri; /* ƒ^ƒXƒN‚̃x[ƒX—Dæ“x */
147 STAT tskwait; /* ‘Ò‚¿—vˆö */
148 ID wobjid; /* ‘Ò‚¿‘Ώۂ̃IƒuƒWƒFƒNƒg‚ÌID */
149 TMO lefttmo; /* ƒ^ƒCƒ€ƒAƒEƒg‚·‚é‚Ü‚Å‚ÌŽžŠÔ */
150 uint_t actcnt; /* ‹N“®—v‹ƒLƒ…
151[ƒCƒ“ƒO” */
152 uint_t wupcnt; /* ‹N°—v‹ƒLƒ…
153[ƒCƒ“ƒO” */
154} T_RTSK;
155
156typedef struct t_dtex {
157 ATR texatr; /* ƒ^ƒXƒN—áŠOˆ—ƒ‹[ƒ`ƒ“‘®« */
158 TEXRTN texrtn; /* ƒ^ƒXƒN—áŠOˆ—ƒ‹[ƒ`ƒ“‚̐擪”Ô’n */
159} T_DTEX;
160
161typedef struct t_rtex {
162 STAT texstat; /* ƒ^ƒXƒN—áŠOˆ—‚̏ó‘Ô */
163 TEXPTN pndptn; /* •Û—¯—áŠO—vˆö */
164} T_RTEX;
165
166typedef struct t_csem {
167 ATR sematr; /* ƒZƒ}ƒtƒH‘®« */
168 uint_t isemcnt; /* ƒZƒ}ƒtƒH‚̏‰ŠúŽ‘Œ¹” */
169 uint_t maxsem; /* ƒZƒ}ƒtƒH‚̍ő厑Œ¹” */
170} T_CSEM;
171
172typedef struct t_rsem {
173 ID wtskid; /* ƒZƒ}ƒtƒH‚Ì‘Ò‚¿s—ñ‚̐擪‚̃^ƒXƒN‚ÌID”ԍ† */
174 uint_t semcnt; /* ƒZƒ}ƒtƒH‚ÌŒ»Ý‚ÌŽ‘Œ¹” */
175} T_RSEM;
176
177typedef struct t_cflg {
178 ATR flgatr; /* ƒCƒxƒ“ƒgƒtƒ‰ƒO‘®« */
179 FLGPTN iflgptn; /* ƒCƒxƒ“ƒgƒtƒ‰ƒO‚̏‰Šúƒrƒbƒgƒpƒ^[ƒ“ */
180} T_CFLG;
181
182typedef struct t_rflg {
183 ID wtskid; /* ƒCƒxƒ“ƒgƒtƒ‰ƒO‚Ì‘Ò‚¿s—ñ‚̐擪‚̃^ƒXƒN‚ÌID”ԍ† */
184 FLGPTN flgptn; /* ƒCƒxƒ“ƒgƒtƒ‰ƒO‚ÌŒ»Ý‚̃rƒbƒgƒpƒ^[ƒ“ */
185} T_RFLG;
186
187typedef struct t_cdtq {
188 ATR dtqatr; /* ƒf[ƒ^ƒLƒ…
189[‘®« */
190 uint_t dtqcnt; /* ƒf[ƒ^ƒLƒ…
191[ŠÇ——̈æ‚ÉŠi”[‚Å‚«‚éƒf[ƒ^” */
192 void *dtqmb; /* ƒf[ƒ^ƒLƒ…
193[ŠÇ——̈æ‚̐擪”Ô’n */
194} T_CDTQ;
195
196typedef struct t_rdtq {
197 ID stskid; /* ƒf[ƒ^ƒLƒ…
198[‚Ì‘—M‘Ò‚¿s—ñ‚̐擪‚̃^ƒXƒN‚ÌID”ԍ† */
199 ID rtskid; /* ƒf[ƒ^ƒLƒ…
200[‚ÌŽóM‘Ò‚¿s—ñ‚̐擪‚̃^ƒXƒN‚ÌID”ԍ† */
201 uint_t sdtqcnt; /* ƒf[ƒ^ƒLƒ…
202[ŠÇ——̈æ‚ÉŠi”[‚³‚ê‚Ä‚¢‚éƒf[ƒ^‚̐” */
203} T_RDTQ;
204
205typedef struct t_cpdq {
206 ATR pdqatr; /* —Dæ“xƒf[ƒ^ƒLƒ…
207[‘®« */
208 uint_t pdqcnt; /* —Dæ“xƒf[ƒ^ƒLƒ…
209[ŠÇ——̈æ‚ÉŠi”[‚Å‚«‚éƒf[ƒ^” */
210 PRI maxdpri; /* —Dæ“xƒf[ƒ^ƒLƒ…
211[‚É‘—M‚Å‚«‚éƒf[ƒ^—Dæ“x‚̍Å
212 ‘å’l */
213 void *pdqmb; /* —Dæ“xƒf[ƒ^ƒLƒ…
214[ŠÇ——̈æ‚̐擪”Ô’n */
215} T_CPDQ;
216
217typedef struct t_rpdq {
218 ID stskid; /* —Dæ“xƒf[ƒ^ƒLƒ…
219[‚Ì‘—M‘Ò‚¿s—ñ‚̐擪‚̃^ƒXƒN
220 ‚ÌID”ԍ† */
221 ID rtskid; /* —Dæ“xƒf[ƒ^ƒLƒ…
222[‚ÌŽóM‘Ò‚¿s—ñ‚̐擪‚̃^ƒXƒN
223 ‚ÌID”ԍ† */
224 uint_t spdqcnt; /* —Dæ“xƒf[ƒ^ƒLƒ…
225[ŠÇ——̈æ‚ÉŠi”[‚³‚ê‚Ä‚¢‚éƒf[
226 ƒ^‚̐” */
227} T_RPDQ;
228
229typedef struct t_cmbx {
230 ATR mbxatr; /* ƒ[ƒ‹ƒ{ƒbƒNƒX‘®« */
231 PRI maxmpri; /* —Dæ“xƒ[ƒ‹ƒ{ƒbƒNƒX‚É‘—M‚Å‚«‚郁ƒbƒZ[ƒW—Dæ
232 “x‚̍őå’l */
233 void *mprihd; /* —Dæ“x•Ê‚̃ƒbƒZ[ƒWƒLƒ…
234[ƒwƒbƒ_—̈æ‚̐擪”Ô’n */
235} T_CMBX;
236
237typedef struct t_rmbx {
238 ID wtskid; /* ƒ[ƒ‹ƒ{ƒbƒNƒX‚Ì‘Ò‚¿s—ñ‚̐擪‚̃^ƒXƒN‚ÌID”ԍ† */
239 T_MSG *pk_msg; /* ƒƒbƒZ[ƒWƒLƒ…
240[‚̐擪‚ɂ‚Ȃª‚ꂽƒƒbƒZ[ƒW
241 ‚̐擪”Ô’n */
242} T_RMBX;
243
244typedef struct t_cmpf {
245 ATR mpfatr; /* ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹‘®« */
246 uint_t blkcnt; /* Šl“¾‚Å‚«‚éŒÅ’è’·ƒƒ‚ƒŠƒuƒƒbƒN‚̐” */
247 uint_t blksz; /* ŒÅ’è’·ƒƒ‚ƒŠƒuƒƒbƒN‚̃TƒCƒY */
248 MPF_T *mpf; /* ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹—̈æ‚̐擪”Ô’n */
249 void *mpfmb; /* ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹ŠÇ——̈æ‚̐擪”Ô’n */
250} T_CMPF;
251
252typedef struct t_rmpf {
253 ID wtskid; /* ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹‚Ì‘Ò‚¿s—ñ‚̐擪‚̃^ƒXƒN‚Ì
254 ID”ԍ† */
255 uint_t fblkcnt; /* ŒÅ’è’·ƒƒ‚ƒŠƒv[ƒ‹—̈æ‚̋󂫃ƒ‚ƒŠ—̈æ‚ÉŠ„‚è
256 •t‚¯‚邱‚Æ‚ª‚Å‚«‚éŒÅ’è’·ƒƒ‚ƒŠƒuƒƒbƒN‚̐” */
257} T_RMPF;
258
259typedef struct t_ccyc {
260 ATR cycatr; /* ŽüŠúƒnƒ“ƒhƒ‰‘®« */
261 intptr_t exinf; /* ŽüŠúƒnƒ“ƒhƒ‰‚ÌŠg’£î•ñ */
262 CYCHDR cychdr; /* ŽüŠúƒnƒ“ƒhƒ‰‚̐擪”Ô’n */
263 RELTIM cyctim; /* ŽüŠúƒnƒ“ƒhƒ‰‚Ì‹N“®ŽüŠú */
264 RELTIM cycphs; /* ŽüŠúƒnƒ“ƒhƒ‰‚Ì‹N“®ˆÊ‘Š */
265} T_CCYC;
266
267typedef struct t_rcyc {
268 STAT cycstat; /* ŽüŠúƒnƒ“ƒhƒ‰‚Ì“®ìó‘Ô */
269 RELTIM lefttim; /* ŽŸ‚ÉŽüŠúƒnƒ“ƒhƒ‰‚ð‹N“®‚·‚鎞‚Ü‚Å‚Ì‘Š‘ÎŽžŠÔ */
270} T_RCYC;
271
272typedef struct t_calm {
273 ATR almatr; /* ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰‘®« */
274 intptr_t exinf; /* ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰‚ÌŠg’£î•ñ */
275 ALMHDR almhdr; /* ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰‚̐擪”Ô’n */
276} T_CALM;
277
278typedef struct t_ralm {
279 STAT almstat; /* ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰‚Ì“®ìó‘Ô */
280 RELTIM lefttim; /* ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰‚ð‹N“®‚·‚鎞‚Ü‚Å‚Ì‘Š‘ÎŽžŠÔ */
281} T_RALM;
282
283typedef struct t_cisr {
284 ATR isratr; /* Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“‘®« */
285 intptr_t exinf; /* Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“‚ÌŠg’£î•ñ */
286 INTNO intno; /* Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“‚ð“o˜^‚·‚銄ž‚ݔԍ† */
287 ISR isr; /* Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“‚̐擪”Ô’n */
288 PRI isrpri; /* Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“—Dæ“x */
289} T_CISR;
290
291/*
292 * ƒT[ƒrƒXƒR[ƒ‹‚̐錾
293 */
294
295/*
296 * ƒ^ƒXƒNŠÇ—‹@”\
297 */
298extern ER_UINT acre_tsk(const T_CTSK *pk_ctsk) throw();
299extern ER del_tsk(ID tskid) throw();
300extern ER act_tsk(ID tskid) throw();
301extern ER iact_tsk(ID tskid) throw();
302extern ER_UINT can_act(ID tskid) throw();
303extern ER ext_tsk(void) throw();
304extern ER ter_tsk(ID tskid) throw();
305extern ER chg_pri(ID tskid, PRI tskpri) throw();
306extern ER get_pri(ID tskid, PRI *p_tskpri) throw();
307extern ER get_inf(intptr_t *p_exinf) throw();
308extern ER ref_tsk(ID tskid, T_RTSK *pk_rtsk) throw();
309
310/*
311 * ƒ^ƒXƒN•t‘®“¯Šú‹@”\
312 */
313extern ER slp_tsk(void) throw();
314extern ER tslp_tsk(TMO tmout) throw();
315extern ER wup_tsk(ID tskid) throw();
316extern ER iwup_tsk(ID tskid) throw();
317extern ER_UINT can_wup(ID tskid) throw();
318extern ER rel_wai(ID tskid) throw();
319extern ER irel_wai(ID tskid) throw();
320extern ER sus_tsk(ID tskid) throw();
321extern ER rsm_tsk(ID tskid) throw();
322extern ER dly_tsk(RELTIM dlytim) throw();
323
324/*
325 * ƒ^ƒXƒN—áŠOˆ—‹@”\
326 */
327extern ER def_tex(ID tskid, const T_DTEX *pk_dtex) throw();
328extern ER ras_tex(ID tskid, TEXPTN rasptn) throw();
329extern ER iras_tex(ID tskid, TEXPTN rasptn) throw();
330extern ER dis_tex(void) throw();
331extern ER ena_tex(void) throw();
332extern bool_t sns_tex(void) throw();
333extern ER ref_tex(ID tskid, T_RTEX *pk_rtex) throw();
334
335/*
336 * “¯ŠúE’ʐM‹@”\
337 */
338extern ER_ID acre_sem(const T_CSEM *pk_csem) throw();
339extern ER del_sem(ID semid) throw();
340extern ER sig_sem(ID semid) throw();
341extern ER isig_sem(ID semid) throw();
342extern ER wai_sem(ID semid) throw();
343extern ER pol_sem(ID semid) throw();
344extern ER twai_sem(ID semid, TMO tmout) throw();
345extern ER ini_sem(ID semid) throw();
346extern ER ref_sem(ID semid, T_RSEM *pk_rsem) throw();
347
348extern ER_ID acre_flg(const T_CFLG *pk_cflg) throw();
349extern ER del_flg(ID flgid) throw();
350extern ER set_flg(ID flgid, FLGPTN setptn) throw();
351extern ER iset_flg(ID flgid, FLGPTN setptn) throw();
352extern ER clr_flg(ID flgid, FLGPTN clrptn) throw();
353extern ER wai_flg(ID flgid, FLGPTN waiptn,
354 MODE wfmode, FLGPTN *p_flgptn) throw();
355extern ER pol_flg(ID flgid, FLGPTN waiptn,
356 MODE wfmode, FLGPTN *p_flgptn) throw();
357extern ER twai_flg(ID flgid, FLGPTN waiptn,
358 MODE wfmode, FLGPTN *p_flgptn, TMO tmout) throw();
359extern ER ini_flg(ID flgid) throw();
360extern ER ref_flg(ID flgid, T_RFLG *pk_rflg) throw();
361
362extern ER_ID acre_dtq(const T_CDTQ *pk_cdtq) throw();
363extern ER del_dtq(ID dtqid) throw();
364extern ER snd_dtq(ID dtqid, intptr_t data) throw();
365extern ER psnd_dtq(ID dtqid, intptr_t data) throw();
366extern ER ipsnd_dtq(ID dtqid, intptr_t data) throw();
367extern ER tsnd_dtq(ID dtqid, intptr_t data, TMO tmout) throw();
368extern ER fsnd_dtq(ID dtqid, intptr_t data) throw();
369extern ER ifsnd_dtq(ID dtqid, intptr_t data) throw();
370extern ER rcv_dtq(ID dtqid, intptr_t *p_data) throw();
371extern ER prcv_dtq(ID dtqid, intptr_t *p_data) throw();
372extern ER trcv_dtq(ID dtqid, intptr_t *p_data, TMO tmout) throw();
373extern ER ini_dtq(ID dtqid) throw();
374extern ER ref_dtq(ID dtqid, T_RDTQ *pk_rdtq) throw();
375
376extern ER_ID acre_pdq(const T_CPDQ *pk_cpdq) throw();
377extern ER del_pdq(ID pdqid) throw();
378extern ER snd_pdq(ID pdqid, intptr_t data, PRI datapri) throw();
379extern ER psnd_pdq(ID pdqid, intptr_t data, PRI datapri) throw();
380extern ER ipsnd_pdq(ID pdqid, intptr_t data, PRI datapri) throw();
381extern ER tsnd_pdq(ID pdqid, intptr_t data,
382 PRI datapri, TMO tmout) throw();
383extern ER rcv_pdq(ID pdqid, intptr_t *p_data, PRI *p_datapri) throw();
384extern ER prcv_pdq(ID pdqid, intptr_t *p_data, PRI *p_datapri) throw();
385extern ER trcv_pdq(ID pdqid, intptr_t *p_data,
386 PRI *p_datapri, TMO tmout) throw();
387extern ER ini_pdq(ID pdqid) throw();
388extern ER ref_pdq(ID pdqid, T_RPDQ *pk_rpdq) throw();
389
390extern ER_ID acre_mbx(const T_CMBX *pk_cmbx) throw();
391extern ER del_mbx(ID mbxid) throw();
392extern ER snd_mbx(ID mbxid, T_MSG *pk_msg) throw();
393extern ER rcv_mbx(ID mbxid, T_MSG **ppk_msg) throw();
394extern ER prcv_mbx(ID mbxid, T_MSG **ppk_msg) throw();
395extern ER trcv_mbx(ID mbxid, T_MSG **ppk_msg, TMO tmout) throw();
396extern ER ini_mbx(ID mbxid) throw();
397extern ER ref_mbx(ID mbxid, T_RMBX *pk_rmbx) throw();
398
399/*
400 * ƒƒ‚ƒŠƒv[ƒ‹ŠÇ—‹@”\
401 */
402extern ER_ID acre_mpf(const T_CMPF *pk_cmpf) throw();
403extern ER del_mpf(ID mpfid) throw();
404extern ER get_mpf(ID mpfid, void **p_blk) throw();
405extern ER pget_mpf(ID mpfid, void **p_blk) throw();
406extern ER tget_mpf(ID mpfid, void **p_blk, TMO tmout) throw();
407extern ER rel_mpf(ID mpfid, void *blk) throw();
408extern ER ini_mpf(ID mpfid) throw();
409extern ER ref_mpf(ID mpfid, T_RMPF *pk_rmpf) throw();
410
411/*
412 * ŽžŠÔŠÇ—‹@”\
413 */
414extern ER get_tim(SYSTIM *p_systim) throw();
415extern ER get_utm(SYSUTM *p_sysutm) throw();
416
417extern ER_ID acre_cyc(const T_CCYC *pk_ccyc) throw();
418extern ER del_cyc(ID cycid) throw();
419extern ER sta_cyc(ID cycid) throw();
420extern ER stp_cyc(ID cycid) throw();
421extern ER ref_cyc(ID cycid, T_RCYC *pk_rcyc) throw();
422
423extern ER_ID acre_alm(const T_CALM *pk_calm) throw();
424extern ER del_alm(ID almid) throw();
425extern ER sta_alm(ID almid, RELTIM almtim) throw();
426extern ER ista_alm(ID almid, RELTIM almtim) throw();
427extern ER stp_alm(ID almid) throw();
428extern ER istp_alm(ID almid) throw();
429extern ER ref_alm(ID almid, T_RALM *pk_ralm) throw();
430
431/*
432 * ƒVƒXƒeƒ€ó‘ÔŠÇ—‹@”\
433 */
434extern ER rot_rdq(PRI tskpri) throw();
435extern ER irot_rdq(PRI tskpri) throw();
436extern ER get_tid(ID *p_tskid) throw();
437extern ER iget_tid(ID *p_tskid) throw();
438extern ER loc_cpu(void) throw();
439extern ER iloc_cpu(void) throw();
440extern ER unl_cpu(void) throw();
441extern ER iunl_cpu(void) throw();
442extern ER dis_dsp(void) throw();
443extern ER ena_dsp(void) throw();
444extern bool_t sns_ctx(void) throw();
445extern bool_t sns_loc(void) throw();
446extern bool_t sns_dsp(void) throw();
447extern bool_t sns_dpn(void) throw();
448extern bool_t sns_ker(void) throw();
449extern ER ext_ker(void) throw();
450
451/*
452 * Š„ž‚ÝŠÇ—‹@”\
453 */
454extern ER_ID acre_isr(const T_CISR *pk_cisr) throw();
455extern ER del_isr(ID isrid) throw();
456extern ER dis_int(INTNO intno) throw();
457extern ER ena_int(INTNO intno) throw();
458extern ER chg_ipm(PRI intpri) throw();
459extern ER get_ipm(PRI *p_intpri) throw();
460
461/*
462 * CPU—áŠOŠÇ—‹@”\
463 */
464extern bool_t xsns_dpn(void *p_excinf) throw();
465extern bool_t xsns_xpn(void *p_excinf) throw();
466
467#endif /* TOPPERS_MACRO_ONLY */
468
469/*
470 * ƒIƒuƒWƒFƒNƒg‘®«‚Ì’è‹`
471 */
472#define TA_ACT UINT_C(0x02) /* ƒ^ƒXƒN‚ð‹N“®‚³‚ꂽó‘ԂŐ¶¬ */
473
474#define TA_TPRI UINT_C(0x01) /* ƒ^ƒXƒN‚Ì‘Ò‚¿s—ñ‚ð—Dæ“x‡‚É */
475#define TA_MPRI UINT_C(0x02) /* ƒƒbƒZ[ƒWƒLƒ…
476[‚ð—Dæ“x‡‚É */
477
478#define TA_WMUL UINT_C(0x02) /* •¡”‚Ì‘Ò‚¿ƒ^ƒXƒN */
479#define TA_CLR UINT_C(0x04) /* ƒCƒxƒ“ƒgƒtƒ‰ƒO‚̃NƒŠƒAŽw’è */
480
481#define TA_STA UINT_C(0x02) /* ŽüŠúƒnƒ“ƒhƒ‰‚𓮍ìó‘ԂŐ¶¬ */
482
483#define TA_NONKERNEL UINT_C(0x02) /* ƒJ[ƒlƒ‹ŠÇ—ŠO‚ÌŠ„ž‚Ý */
484
485#define TA_ENAINT UINT_C(0x01) /* Š„ž‚Ý—v‹‹ÖŽ~ƒtƒ‰ƒO‚ðƒNƒŠƒA */
486#define TA_EDGE UINT_C(0x02) /* ƒGƒbƒWƒgƒŠƒK */
487
488/*
489 * ƒT[ƒrƒXƒR[ƒ‹‚Ì“®ìƒ‚[ƒh‚Ì’è‹`
490 */
491#define TWF_ORW UINT_C(0x01) /* ƒCƒxƒ“ƒgƒtƒ‰ƒO‚ÌOR‘Ò‚¿ */
492#define TWF_ANDW UINT_C(0x02) /* ƒCƒxƒ“ƒgƒtƒ‰ƒO‚ÌAND‘Ò‚¿ */
493
494/*
495 * ƒIƒuƒWƒFƒNƒg‚̏ó‘Ô‚Ì’è‹`
496 */
497#define TTS_RUN UINT_C(0x01) /* ŽÀsó‘Ô */
498#define TTS_RDY UINT_C(0x02) /* ŽÀs‰Â”\ó‘Ô */
499#define TTS_WAI UINT_C(0x04) /* ‘Ò‚¿ó‘Ô */
500#define TTS_SUS UINT_C(0x08) /* ‹­§‘Ò‚¿ó‘Ô */
501#define TTS_WAS UINT_C(0x0c) /* “ñd‘Ò‚¿ó‘Ô */
502#define TTS_DMT UINT_C(0x10) /* ‹xŽ~ó‘Ô */
503
504#define TTW_SLP UINT_C(0x0001) /* ‹N°‘Ò‚¿ */
505#define TTW_DLY UINT_C(0x0002) /* ŽžŠÔŒo‰ß‘Ò‚¿ */
506#define TTW_SEM UINT_C(0x0004) /* ƒZƒ}ƒtƒH‚ÌŽ‘Œ¹Šl“¾‘Ò‚¿ */
507#define TTW_FLG UINT_C(0x0008) /* ƒCƒxƒ“ƒgƒtƒ‰ƒO‘Ò‚¿ */
508#define TTW_SDTQ UINT_C(0x0010) /* ƒf[ƒ^ƒLƒ…
509[‚Ö‚Ì‘—M‘Ò‚¿ */
510#define TTW_RDTQ UINT_C(0x0020) /* ƒf[ƒ^ƒLƒ…
511[‚©‚ç‚ÌŽóM‘Ò‚¿ */
512#define TTW_SPDQ UINT_C(0x0100) /* —Dæ“xƒf[ƒ^ƒLƒ…
513[‚Ö‚Ì‘—M‘Ò‚¿ */
514#define TTW_RPDQ UINT_C(0x0200) /* —Dæ“xƒf[ƒ^ƒLƒ…
515[‚©‚ç‚ÌŽóM‘Ò‚¿ */
516#define TTW_MBX UINT_C(0x0040) /* ƒ[ƒ‹ƒ{ƒbƒNƒX‚©‚ç‚ÌŽóM‘Ò‚¿ */
517#define TTW_MPF UINT_C(0x2000) /* ŒÅ’è’·ƒƒ‚ƒŠƒuƒƒbƒN‚ÌŠl“¾‘Ò‚¿ */
518
519#define TTEX_ENA UINT_C(0x01) /* ƒ^ƒXƒN—áŠOˆ—‹–‰Âó‘Ô */
520#define TTEX_DIS UINT_C(0x02) /* ƒ^ƒXƒN—áŠOˆ—‹ÖŽ~ó‘Ô */
521
522#define TCYC_STP UINT_C(0x01) /* ŽüŠúƒnƒ“ƒhƒ‰‚ª“®ì‚µ‚Ä‚¢‚È‚¢ */
523#define TCYC_STA UINT_C(0x02) /* ŽüŠúƒnƒ“ƒhƒ‰‚ª“®ì‚µ‚Ä‚¢‚é */
524
525#define TALM_STP UINT_C(0x01) /* ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰‚ª“®ì‚µ‚Ä‚¢‚È‚¢ */
526#define TALM_STA UINT_C(0x02) /* ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰‚ª“®ì‚µ‚Ä‚¢‚é */
527
528/*
529 * ‚»‚Ì‘¼‚̒萔‚Ì’è‹`
530 */
531#define TSK_SELF 0 /* Ž©ƒ^ƒXƒNŽw’è */
532#define TSK_NONE 0 /* ŠY“–‚·‚éƒ^ƒXƒN‚ª‚È‚¢ */
533
534#define TPRI_SELF 0 /* Ž©ƒ^ƒXƒN‚̃x[ƒX—Dæ“x */
535#define TPRI_INI 0 /* ƒ^ƒXƒN‚Ì‹N“®Žž—Dæ“x */
536
537#define TIPM_ENAALL 0 /* Š„ž‚Ý—Dæ“xƒ}ƒXƒN‘S‰ðœ */
538
539/*
540 * \¬’萔‚ƃ}ƒNƒ
541 */
542
543/*
544 * ƒTƒ|[ƒg‚·‚é‹@”\
545 */
546#ifdef TOPPERS_TARGET_SUPPORT_DIS_INT
547#define TOPPERS_SUPPORT_DIS_INT /* dis_int‚ªƒTƒ|[ƒg‚³‚ê‚Ä‚¢‚é */
548#endif /* TOPPERS_TARGET_SUPPORT_DIS_INT */
549
550#ifdef TOPPERS_TARGET_SUPPORT_ENA_INT
551#define TOPPERS_SUPPORT_ENA_INT /* ena_int‚ªƒTƒ|[ƒg‚³‚ê‚Ä‚¢‚é */
552#endif /* TOPPERS_TARGET_SUPPORT_ENA_INT */
553
554#ifdef TOPPERS_TARGET_SUPPORT_GET_UTM
555#define TOPPERS_SUPPORT_GET_UTM /* get_utm‚ªƒTƒ|[ƒg‚³‚ê‚Ä‚¢‚é */
556#endif /* TOPPERS_TARGET_SUPPORT_GET_UTM */
557
558#define TOPPERS_SUPPORT_DYNAMIC_CRE /* “®“I¶¬‹@”\Šg’£ */
559
560/*
561 * —Dæ“x‚͈̔Í
562 */
563#define TMIN_TPRI 1 /* ƒ^ƒXƒN—Dæ“x‚̍ŏ¬’liÅ‚’lj*/
564#define TMAX_TPRI 16 /* ƒ^ƒXƒN—Dæ“x‚̍őå’liÅ’á’lj*/
565#define TMIN_DPRI 1 /* ƒf[ƒ^—Dæ“x‚̍ŏ¬’liÅ‚’lj*/
566#define TMAX_DPRI 16 /* ƒf[ƒ^—Dæ“x‚̍őå’liÅ’á’lj*/
567#define TMIN_MPRI 1 /* ƒƒbƒZ[ƒW—Dæ“x‚̍ŏ¬’liÅ‚’lj*/
568#define TMAX_MPRI 16 /* ƒƒbƒZ[ƒW—Dæ“x‚̍őå’liÅ’á’lj*/
569#define TMIN_ISRPRI 1 /* Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“—Dæ“x‚̍ŏ¬’l */
570#define TMAX_ISRPRI 16 /* Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“—Dæ“x‚̍őå’l */
571
572/*
573 * ƒo[ƒWƒ‡ƒ“î•ñ
574 */
575#define TKERNEL_MAKER UINT_C(0x0118) /* ƒJ[ƒlƒ‹‚̃[ƒJ[ƒR[ƒh */
576#define TKERNEL_PRID UINT_C(0x0007) /* ƒJ[ƒlƒ‹‚ÌŽ¯•Ê”ԍ† */
577#define TKERNEL_SPVER UINT_C(0xf517) /* ƒJ[ƒlƒ‹Žd—l‚̃o[ƒWƒ‡ƒ“”ԍ† */
578#define TKERNEL_PRVER UINT_C(0x1092) /* ƒJ[ƒlƒ‹‚̃o[ƒWƒ‡ƒ“”ԍ† */
579
580/*
581 * ƒLƒ…
582[ƒCƒ“ƒO‰ñ”‚̍őå’l
583 */
584#define TMAX_ACTCNT UINT_C(1) /* ‹N“®—v‹ƒLƒ…
585[ƒCƒ“ƒO”‚̍őå’l */
586#define TMAX_WUPCNT UINT_C(1) /* ‹N°—v‹ƒLƒ…
587[ƒCƒ“ƒO”‚̍őå’l */
588
589/*
590 * ƒrƒbƒgƒpƒ^[ƒ“‚̃rƒbƒg”
591 */
592#ifndef TBIT_TEXPTN /* ƒ^ƒXƒN—áŠO—vˆö‚̃rƒbƒg” */
593#define TBIT_TEXPTN (sizeof(TEXPTN) * CHAR_BIT)
594#endif /* TBIT_TEXPTN */
595
596#ifndef TBIT_FLGPTN /* ƒCƒxƒ“ƒgƒtƒ‰ƒO‚̃rƒbƒg” */
597#define TBIT_FLGPTN (sizeof(FLGPTN) * CHAR_BIT)
598#endif /* TBIT_FLGPTN */
599
600/*
601 * ƒƒ‚ƒŠ—̈æŠm•Û‚Ì‚½‚߂̃}ƒNƒ
602 *
603 * ˆÈ‰º‚ÌTOPPERS_COUNT_SZ‚ÆTOPPERS_ROUND_SZ‚Ì’è‹`‚́Cunit‚ª2‚̋Џæ‚Å‚ 
604 * ‚邱‚Æ‚ð‰¼’è‚µ‚Ä‚¢‚éD
605 */
606#ifndef TOPPERS_COUNT_SZ
607#define TOPPERS_COUNT_SZ(sz, unit) (((sz) + (unit) - 1) / (unit))
608#endif /* TOPPERS_COUNT_SZ */
609#ifndef TOPPERS_ROUND_SZ
610#define TOPPERS_ROUND_SZ(sz, unit) (((sz) + (unit) - 1) & ~((unit) - 1))
611#endif /* TOPPERS_ROUND_SZ */
612
613#define COUNT_STK_T(sz) TOPPERS_COUNT_SZ(sz, sizeof(STK_T))
614#define ROUND_STK_T(sz) TOPPERS_ROUND_SZ(sz, sizeof(STK_T))
615
616#define COUNT_MPF_T(blksz) TOPPERS_COUNT_SZ(blksz, sizeof(MPF_T))
617#define ROUND_MPF_T(blksz) TOPPERS_ROUND_SZ(blksz, sizeof(MPF_T))
618
619#define TSZ_DTQMB(dtqcnt) (sizeof(intptr_t) * (dtqcnt))
620#define TCNT_DTQMB(dtqcnt) TOPPERS_COUNT_SZ(TSZ_DTQMB(dtqcnt), sizeof(MB_T))
621
622#ifndef TSZ_PDQMB
623#define TSZ_PDQMB(pdqcnt) (sizeof(intptr_t) * 3 * (pdqcnt))
624#endif /* TSZ_PDQMB */
625#define TCNT_PDQMB(pdqcnt) TOPPERS_COUNT_SZ(TSZ_PDQMB(pdqcnt), sizeof(MB_T))
626
627#define TSZ_MPFMB(blkcnt) (sizeof(uint_t) * (blkcnt))
628#define TCNT_MPFMB(blkcnt) TOPPERS_COUNT_SZ(TSZ_MPFMB(blkcnt), sizeof(MB_T))
629
630/*
631 * ‚»‚Ì‘¼‚̍\¬’萔
632 */
633#define TMAX_MAXSEM UINT_MAX /* ƒZƒ}ƒtƒH‚̍ő厑Œ¹”‚̍őå’l */
634
635#ifdef __cplusplus
636}
637#endif
638
639#endif /* TOPPERS_KERNEL_H */
Note: See TracBrowser for help on using the repository browser.