1 | /*
|
---|
2 | * TOPPERS Software
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
4 | *
|
---|
5 | * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
|
---|
6 | * Toyohashi Univ. of Technology, JAPAN
|
---|
7 | * Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory
|
---|
8 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
9 | *
|
---|
10 | * ãLì ÒÍCȺÌ(1)`(4)Ìðð½·êÉÀèC{\tgEF
|
---|
11 | * Ai{\tgEFAðüϵ½àÌðÜÞDȺ¯¶jðgpE¡»Eü
|
---|
12 | * ÏEÄzziȺCpÆÄÔj·é±Æð³Åø·éD
|
---|
13 | * (1) {\tgEFAð\[XR[hÌ`Åp·éêÉÍCãLÌì
|
---|
14 | * \¦C±Ìpð¨æѺL̳ÛØKèªC»ÌÜÜÌ`Å\[
|
---|
15 | * XR[hÉÜÜêÄ¢é±ÆD
|
---|
16 | * (2) {\tgEFAðCCu`®ÈÇC¼Ì\tgEFAJÉg
|
---|
17 | * pÅ«é`ÅÄzz·éêÉÍCÄzzɺ¤hL
|
---|
18 | gip
|
---|
19 | * Ò}j
|
---|
20 | AÈÇjÉCãLÌì \¦C±Ìpð¨æѺL
|
---|
21 | * ̳ÛØKèðfÚ·é±ÆD
|
---|
22 | * (3) {\tgEFAðC@íÉgÝÞÈÇC¼Ì\tgEFAJÉg
|
---|
23 | * pÅ«È¢`ÅÄzz·éêÉÍCÌ¢¸ê©Ìðð½·±
|
---|
24 | * ÆD
|
---|
25 | * (a) Äzzɺ¤hL
|
---|
26 | gipÒ}j
|
---|
27 | AÈÇjÉCãLÌ
|
---|
28 | * ì \¦C±Ìpð¨æѺL̳ÛØKèðfÚ·é±ÆD
|
---|
29 | * (b) ÄzzÌ`ÔðCÊÉèßéû@ÉæÁÄCTOPPERSvWFNgÉ
|
---|
30 | * ñ·é±ÆD
|
---|
31 | * (4) {\tgEFAÌpÉæè¼ÚIܽÍÔÚIɶ¶é¢©Èé¹
|
---|
32 | * Q©çàCãLì Ò¨æÑTOPPERSvWFNgðÆÓ·é±ÆD
|
---|
33 | * ܽC{\tgEFAÌ[UܽÍGh[U©çÌ¢©Èé
|
---|
34 | * RÉîÿ©çàCãLì Ò¨æÑTOPPERSvWFNgð
|
---|
35 | * ÆÓ·é±ÆD
|
---|
36 | *
|
---|
37 | * {\tgEFAÍC³ÛØÅñ³êÄ¢éàÌÅ éDãLì Ò¨
|
---|
38 | * æÑTOPPERSvWFNgÍC{\tgEFAÉÖµÄCÁèÌgpÚI
|
---|
39 | * ÉηéK«àÜßÄC¢©ÈéÛØàsíÈ¢DܽC{\tgEF
|
---|
40 | * AÌpÉæè¼ÚIܽÍÔÚIɶ¶½¢©Èé¹QÉÖµÄàC»
|
---|
41 | * ÌÓCðíÈ¢D
|
---|
42 | *
|
---|
43 | * @(#) $Id: t_stddef.h 1958 2010-11-20 02:15:29Z ertl-hiro $
|
---|
44 | */
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * TOPPERS¤Êwb_t@C
|
---|
48 | *
|
---|
49 | * TOPPERSÖAÌ·×ÄÌ\[Xt@CÅCN[h·×«wb_t@C
|
---|
50 | * DeíÌJ[lâ\tgEFAiŤÊÉp¢é±ÆðzèµÄ¢
|
---|
51 | * éDTOPPERSÌeíÌJ[lâ\tgEFAiŤÊÉp¢éf[^^C
|
---|
52 | * èC}NÌè`ÈÇðÜÞD
|
---|
53 | *
|
---|
54 | * AZu¾êÌ\[Xt@C©ç±Ìt@CðCN[h·é
|
---|
55 | * ÍCTOPPERS_MACRO_ONLYðè`µÄ¨D±êÉæèC}Nè`ÈOð
|
---|
56 | * æ¤ÉÈÁÄ¢éD
|
---|
57 | *
|
---|
58 | * ±Ìt@CðCN[h·éOÉCN[hµÄ¨×«t@C
|
---|
59 | * ÍÈ¢D
|
---|
60 | */
|
---|
61 |
|
---|
62 | #ifndef TOPPERS_T_STDDEF_H
|
---|
63 | #define TOPPERS_T_STDDEF_H
|
---|
64 |
|
---|
65 | #ifdef __cplusplus
|
---|
66 | extern "C" {
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | /*
|
---|
70 | * ^[Qbg˶
|
---|
71 | */
|
---|
72 | #include "target_stddef.h"
|
---|
73 |
|
---|
74 | /*
|
---|
75 | * C¾ê/EC++Åthrow()Éηé½ßÌè`
|
---|
76 | */
|
---|
77 | #if !defined(__cplusplus) || defined(__embedded_cplusplus)
|
---|
78 | #define throw()
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | #ifndef TOPPERS_MACRO_ONLY
|
---|
82 |
|
---|
83 | /*
|
---|
84 | * ^[Qbg˶Ìf[^^Ì}NÌftHgè`
|
---|
85 | */
|
---|
86 | #ifndef TOPPERS_bool
|
---|
87 | #define TOPPERS_bool int /* u[^ */
|
---|
88 | #endif /* TOPPERS_bool */
|
---|
89 |
|
---|
90 | #ifndef TOPPERS_size
|
---|
91 | #define TOPPERS_size uintptr_t /* TCY^ */
|
---|
92 | #endif /* TOPPERS_size */
|
---|
93 |
|
---|
94 | #ifndef TOPPERS_fp
|
---|
95 | struct TOPPERS_dummy_t { int TOPPERS_dummy_field; };
|
---|
96 | typedef void (*TOPPERS_fp_t)(struct TOPPERS_dummy_t);
|
---|
97 | #define TOPPERS_fp TOPPERS_fp_t /* vOÌN®Ôn */
|
---|
98 | #endif /* TOPPERS_fp */
|
---|
99 |
|
---|
100 | /*
|
---|
101 | * ¤Êf[^^
|
---|
102 | */
|
---|
103 | typedef TOPPERS_bool bool_t; /* ^Ul */
|
---|
104 | typedef unsigned char char_t; /* ³µÌ¶^ */
|
---|
105 |
|
---|
106 | typedef signed int int_t; /* ©RÈTCYÌt«® */
|
---|
107 | typedef unsigned int uint_t; /* ©RÈTCY̳µ® */
|
---|
108 |
|
---|
109 | typedef signed long long_t; /* ·ßÌTCYÌt«® */
|
---|
110 | typedef unsigned long ulong_t; /* ·ßÌTCY̳µ® */
|
---|
111 |
|
---|
112 | typedef int_t FN; /* @\R[h */
|
---|
113 | typedef int_t ER; /* G[R[h */
|
---|
114 | typedef int_t ID; /* IuWFNgÌIDÔ */
|
---|
115 | typedef uint_t ATR; /* IuWFNgÌ®« */
|
---|
116 | typedef uint_t STAT; /* IuWFNgÌóÔ */
|
---|
117 | typedef uint_t MODE; /* T[rXR[Ì®ì[h */
|
---|
118 | typedef int_t PRI; /* Dæx */
|
---|
119 | typedef TOPPERS_size SIZE; /* ÌæÌTCY */
|
---|
120 |
|
---|
121 | typedef int_t TMO; /* ^CAEgwè */
|
---|
122 | typedef uint_t RELTIM; /* ÎÔ */
|
---|
123 | typedef ulong_t SYSTIM; /* VXe */
|
---|
124 | typedef ulong_t SYSUTM; /* «\]¿pVXe */
|
---|
125 |
|
---|
126 | typedef TOPPERS_fp FP; /* vOÌN®Ôn */
|
---|
127 |
|
---|
128 | typedef int_t ER_BOOL; /* G[R[hܽÍ^Ul */
|
---|
129 | typedef int_t ER_ID; /* G[R[hܽÍIDÔ */
|
---|
130 | typedef int_t ER_UINT; /* G[R[hܽͳµ® */
|
---|
131 |
|
---|
132 | typedef uintptr_t MB_T; /* ÇÌæðmÛ·é½ßÌf[^^ */
|
---|
133 |
|
---|
134 | typedef uint32_t ACPTN; /* ANZXÂp^[ */
|
---|
135 | typedef struct acvct { /* ANZXÂxN^ */
|
---|
136 | ACPTN acptn1; /* Êíì1ÌANZXÂp^[ */
|
---|
137 | ACPTN acptn2; /* Êíì2ÌANZXÂp^[ */
|
---|
138 | ACPTN acptn3; /* ÇìÌANZXÂp^[ */
|
---|
139 | ACPTN acptn4; /* QÆìÌANZXÂp^[ */
|
---|
140 | } ACVCT;
|
---|
141 |
|
---|
142 | #endif /* TOPPERS_MACRO_ONLY */
|
---|
143 |
|
---|
144 | /*
|
---|
145 | * ®èðìé}N
|
---|
146 | */
|
---|
147 | #ifndef UINT_C
|
---|
148 | #define UINT_C(val) (val ## U) /* uint_t^Ìèðìé}N */
|
---|
149 | #endif /* UINT_C */
|
---|
150 |
|
---|
151 | #ifndef ULONG_C
|
---|
152 | #define ULONG_C(val) (val ## UL) /* ulong_t^Ìèðìé}N */
|
---|
153 | #endif /* ULONG_C */
|
---|
154 |
|
---|
155 | /*
|
---|
156 | * êÊè
|
---|
157 | */
|
---|
158 | #ifndef NULL
|
---|
159 | #define NULL 0 /* ³ø|C^ */
|
---|
160 | #endif /* NULL */
|
---|
161 |
|
---|
162 | #ifndef true
|
---|
163 | #define true 1 /* ^ */
|
---|
164 | #endif /* true */
|
---|
165 |
|
---|
166 | #ifndef false
|
---|
167 | #define false 0 /* U */
|
---|
168 | #endif /* false */
|
---|
169 |
|
---|
170 | #define E_OK 0 /* ³íI¹ */
|
---|
171 |
|
---|
172 | /*
|
---|
173 | * CG[R[h
|
---|
174 | */
|
---|
175 | #define E_SYS (-5) /* VXeG[ */
|
---|
176 | #define E_NOSPT (-9) /* ¢T|[g@\ */
|
---|
177 | #define E_RSFN (-10) /* \ñ@\R[h */
|
---|
178 | #define E_RSATR (-11) /* \ñ®« */
|
---|
179 | #define E_PAR (-17) /* p[^G[ */
|
---|
180 | #define E_ID (-18) /* s³IDÔ */
|
---|
181 | #define E_CTX (-25) /* ReLXgG[ */
|
---|
182 | #define E_MACV (-26) /* ANZXá½ */
|
---|
183 | #define E_OACV (-27) /* IuWFNgANZXá½ */
|
---|
184 | #define E_ILUSE (-28) /* T[rXR[s³gp */
|
---|
185 | #define E_NOMEM (-33) /* s« */
|
---|
186 | #define E_NOID (-34) /* IDÔs« */
|
---|
187 | #define E_NORES (-35) /* ¹s« */
|
---|
188 | #define E_OBJ (-41) /* IuWFNgóÔG[ */
|
---|
189 | #define E_NOEXS (-42) /* IuWFNg¢¶¬ */
|
---|
190 | #define E_QOVR (-43) /* L
|
---|
191 | [COI[o[t[ */
|
---|
192 | #define E_RLWAI (-49) /* Ò¿óÔ̧ð */
|
---|
193 | #define E_TMOUT (-50) /* |[O¸sܽÍ^CAEg */
|
---|
194 | #define E_DLT (-51) /* Ò¿IuWFNgÌí */
|
---|
195 | #define E_CLS (-52) /* Ò¿IuWFNgÌóÔÏ» */
|
---|
196 | #define E_WBLK (-57) /* mubLOót¯ */
|
---|
197 | #define E_BOVR (-58) /* obt@I[o[t[ */
|
---|
198 |
|
---|
199 | /*
|
---|
200 | * IuWFNg®«
|
---|
201 | */
|
---|
202 | #define TA_NULL UINT_C(0) /* IuWFNg®«ðwèµÈ¢ */
|
---|
203 |
|
---|
204 | /*
|
---|
205 | * ^CAEgwè
|
---|
206 | */
|
---|
207 | #define TMO_POL 0 /* |[O */
|
---|
208 | #define TMO_FEVR (-1) /* ivÒ¿ */
|
---|
209 | #define TMO_NBLK (-2) /* mubLO */
|
---|
210 |
|
---|
211 | /*
|
---|
212 | * ANZXÂp^[
|
---|
213 | */
|
---|
214 | #define TACP_KERNEL (0U) /* J[lhC¾¯ÉANZXð */
|
---|
215 | #define TACP_SHARED (~0U) /* ·×ÄÌhC©çANZXð */
|
---|
216 |
|
---|
217 | /*
|
---|
218 | * ^ÉÖ·éîñðæèo·½ßÌ}N
|
---|
219 | */
|
---|
220 | #ifndef offsetof
|
---|
221 | #define offsetof(structure, field) ((uintptr_t) &(((structure *) 0)->field))
|
---|
222 | #endif /* offsetof */
|
---|
223 |
|
---|
224 | #ifndef alignof
|
---|
225 | #define alignof(type) offsetof(struct { char field1; type field2; }, field2)
|
---|
226 | #endif /* alignof */
|
---|
227 |
|
---|
228 | #ifndef ALIGN_TYPE /* ACgÌ`FbN */
|
---|
229 | #define ALIGN_TYPE(addr, type) \
|
---|
230 | ((((uintptr_t)(addr)) & (alignof(type) - 1)) == 0U)
|
---|
231 | #endif /* ALIGN_TYPE */
|
---|
232 |
|
---|
233 | /*
|
---|
234 | * assert}N
|
---|
235 | */
|
---|
236 | #undef assert
|
---|
237 | #ifndef NDEBUG
|
---|
238 | #define assert(exp) ((void)((exp) ? 0 : (TOPPERS_assert_fail(#exp, \
|
---|
239 | __FILE__, __LINE__), TOPPERS_assert_abort(), 0)))
|
---|
240 | #else /* NDEBUG */
|
---|
241 | #define assert(exp) ((void) 0)
|
---|
242 | #endif /* NDEBUG */
|
---|
243 |
|
---|
244 | #ifdef __cplusplus
|
---|
245 | }
|
---|
246 | #endif
|
---|
247 |
|
---|
248 | /*
|
---|
249 | * G[R[h¶¬Eªð}N
|
---|
250 | *
|
---|
251 | * ȺÌ}Nè`ÍCt«®ª2ÌâÅ\»³êĨèCEVtg
|
---|
252 | * Zqi>>jªZpVtg³êé±Æð¼èµÄ¢éD»¤ÅÈ¢JÂ
|
---|
253 | * «ÅÍCtarget_stddef.hűêçÌè`ð㫵ȯêÎÈçÈ¢D
|
---|
254 | *
|
---|
255 | * MERCD}NÌè`ÍCCG[R[hªÅ é±Æð¼èµÄ¢éD
|
---|
256 | * »¤ÅÈ¢êC2ÂÌè`ªêvµÈÈéD
|
---|
257 | */
|
---|
258 | #ifndef ERCD
|
---|
259 | #define ERCD(mercd, sercd) \
|
---|
260 | ((ER)((((uint_t) sercd) << 8) | (((uint_t) mercd) & 0xffU)))
|
---|
261 | #endif /* ERCD */
|
---|
262 |
|
---|
263 | #ifndef MERCD
|
---|
264 | #ifdef INT8_MAX
|
---|
265 | #define MERCD(ercd) ((ER)((int8_t)(ercd)))
|
---|
266 | #else /* INT8_MAX */
|
---|
267 | #define MERCD(ercd) ((ER)(((uint_t) ercd) | ~0xffU))
|
---|
268 | #endif /* INT8_MAX */
|
---|
269 | #endif /* MERCD */
|
---|
270 |
|
---|
271 | #ifndef SERCD
|
---|
272 | #define SERCD(ercd) ((ER)((ercd) >> 8))
|
---|
273 | #endif /* SERCD */
|
---|
274 |
|
---|
275 | /*
|
---|
276 | * ANZXÂp^[¶¬}N
|
---|
277 | */
|
---|
278 | #define TACP(domid) (1U << ((domid) - 1)) /* domid¾¯ÉANZXð */
|
---|
279 |
|
---|
280 | /*
|
---|
281 | * ÎÔiRELTIMjÉwèÅ«éÅål
|
---|
282 | */
|
---|
283 | #if UINT_MAX < LONG_MAX
|
---|
284 | #define TMAX_RELTIM ((RELTIM) UINT_MAX)
|
---|
285 | #else /* UINT_MAX < LONG_MAX */
|
---|
286 | #define TMAX_RELTIM ((RELTIM) LONG_MAX)
|
---|
287 | #endif /* UINT_MAX < LONG_MAX */
|
---|
288 |
|
---|
289 | #endif /* TOPPERS_T_STDDEF_H */
|
---|