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