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-2008 by Embedded and Real-Time Systems Laboratory
|
---|
9 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
10 | *
|
---|
11 | * ãLì ÒÍCȺÌ(1)`(4)Ìðð½·êÉÀèC{\tgEF
|
---|
12 | * Ai{\tgEFAðüϵ½àÌðÜÞDȺ¯¶jðgpE¡»Eü
|
---|
13 | * ÏEÄzziȺCpÆÄÔj·é±Æð³Åø·éD
|
---|
14 | * (1) {\tgEFAð\[XR[hÌ`Åp·éêÉÍCãLÌì
|
---|
15 | * \¦C±Ìpð¨æÑºLÌ³ÛØKèªC»ÌÜÜÌ`Å\[
|
---|
16 | * XR[hÉÜÜêĢ鱯D
|
---|
17 | * (2) {\tgEFAðCCu`®ÈÇC¼Ì\tgEFAJÉg
|
---|
18 | * pÅ«é`ÅÄzz·éêÉÍCÄzzɺ¤hL
|
---|
19 | gip
|
---|
20 | * Ò}j
|
---|
21 | AÈÇjÉCãLÌì \¦C±Ìpð¨æÑºL
|
---|
22 | * Ì³ÛØKèðfÚ·é±ÆD
|
---|
23 | * (3) {\tgEFAðC@íÉgÝÞÈÇC¼Ì\tgEFAJÉg
|
---|
24 | * pūȢ`ÅÄzz·éêÉÍCÌ¢¸ê©Ìðð½·±
|
---|
25 | * ÆD
|
---|
26 | * (a) Äzzɺ¤hL
|
---|
27 | gipÒ}j
|
---|
28 | AÈÇjÉCãLÌ
|
---|
29 | * ì \¦C±Ìpð¨æÑºLÌ³ÛØKèðfÚ·é±ÆD
|
---|
30 | * (b) ÄzzÌ`ÔðCÊÉèßéû@ÉæÁÄCTOPPERSvWFNgÉ
|
---|
31 | * ñ·é±ÆD
|
---|
32 | * (4) {\tgEFAÌpÉæè¼ÚIܽÍÔÚIɶ¶é¢©Èé¹
|
---|
33 | * Q©çàCãLì Ò¨æÑTOPPERSvWFNgðÆÓ·é±ÆD
|
---|
34 | * ܽC{\tgEFAÌ[UܽÍGh[U©çÌ¢©Èé
|
---|
35 | * RÉîÿ©çàCãLì Ò¨æÑTOPPERSvWFNgð
|
---|
36 | * ÆÓ·é±ÆD
|
---|
37 | *
|
---|
38 | * {\tgEFAÍC³ÛØÅñ³êÄ¢éàÌÅ éDãLì Ò¨
|
---|
39 | * æÑTOPPERSvWFNgÍC{\tgEFAÉÖµÄCÁèÌgpÚI
|
---|
40 | * ÉηéK«àÜßÄC¢©ÈéÛØàsíÈ¢DܽC{\tgEF
|
---|
41 | * AÌpÉæè¼ÚIܽÍÔÚIɶ¶½¢©Èé¹QÉÖµÄàC»
|
---|
42 | * ÌÓCðíÈ¢D
|
---|
43 | *
|
---|
44 | * @(#) $Id: t_syslog.h 101 2015-06-02 15:37:23Z coas-nagasima $
|
---|
45 | */
|
---|
46 |
|
---|
47 | /*
|
---|
48 | * VXeOoÍðs¤½ßÌè`
|
---|
49 | *
|
---|
50 | * VXeOT[rXÍCVXeÌOîñðoÍ·é½ßÌT[rX
|
---|
51 | * Å éDJ[l©çÌOîñÌoÍÉàp¢é½ßCàÅÒ¿óÔ
|
---|
52 | * ÉÍ¢é±ÆÍÈ¢D
|
---|
53 | *
|
---|
54 | * OîñÍCJ[làÌOobt@ɫީCáx̶o
|
---|
55 | * ÍÖðp¢ÄoÍ·éDÇ¿çðg¤©ÍCg£T[rXR[ÅØè
|
---|
56 | * ·¦é±ÆªÅ«éD
|
---|
57 | *
|
---|
58 | * Oobt@ÌæªI[ot[µ½êÉÍCâOîñðÁµÄã
|
---|
59 | * «·éD
|
---|
60 | *
|
---|
61 | * AZu¾êÌ\[Xt@C©ç±Ìt@CðCN[h·é
|
---|
62 | * ÍCTOPPERS_MACRO_ONLYðè`µÄ¨±ÆÅC}Nè`ÈOÌLqð
|
---|
63 | * ±ÆªÅ«éD
|
---|
64 | *
|
---|
65 | * ±Ìt@CðCN[h·éOÉCt_stddef.hðCN[hµÄ¨
|
---|
66 | * ±ÆªKvÅ éD
|
---|
67 | */
|
---|
68 |
|
---|
69 | #ifndef TOPPERS_T_SYSLOG_H
|
---|
70 | #define TOPPERS_T_SYSLOG_H
|
---|
71 |
|
---|
72 | #ifdef __cplusplus
|
---|
73 | extern "C" {
|
---|
74 | #endif
|
---|
75 |
|
---|
76 | /*
|
---|
77 | * OîñÌíÊÌè`
|
---|
78 | */
|
---|
79 | #define LOG_TYPE_COMMENT UINT_C(0x01) /* Rg */
|
---|
80 | #define LOG_TYPE_ASSERT UINT_C(0x02) /* AT[V̸s */
|
---|
81 |
|
---|
82 | #define LOG_TYPE_INH UINT_C(0x11) /* Ýnh */
|
---|
83 | #define LOG_TYPE_ISR UINT_C(0x12) /* ÝT[rX[` */
|
---|
84 | #define LOG_TYPE_CYC UINT_C(0x13) /* üúnh */
|
---|
85 | #define LOG_TYPE_ALM UINT_C(0x14) /* A[nh */
|
---|
86 | #define LOG_TYPE_OVR UINT_C(0x15) /* I[onh */
|
---|
87 | #define LOG_TYPE_EXC UINT_C(0x16) /* CPUáOnh */
|
---|
88 | #define LOG_TYPE_TEX UINT_C(0x17) /* ^XNáO[` */
|
---|
89 | #define LOG_TYPE_TSKSTAT UINT_C(0x18) /* ^XNóÔÏ» */
|
---|
90 | #define LOG_TYPE_DSP UINT_C(0x19) /* fBXpb` */
|
---|
91 | #define LOG_TYPE_SVC UINT_C(0x1a) /* T[rXR[ */
|
---|
92 |
|
---|
93 | #define LOG_ENTER UINT_C(0x00) /* üû^Jn */
|
---|
94 | #define LOG_LEAVE UINT_C(0x80) /* oû^I¹ */
|
---|
95 |
|
---|
96 | /*
|
---|
97 | * OîñÌdvxÌè`
|
---|
98 | */
|
---|
99 | #define LOG_EMERG UINT_C(0) /* Vbg_EÉl·éG[ */
|
---|
100 | #define LOG_ALERT UINT_C(1)
|
---|
101 | #define LOG_CRIT UINT_C(2)
|
---|
102 | #define LOG_ERROR UINT_C(3) /* VXeG[ */
|
---|
103 | #define LOG_WARNING UINT_C(4) /* xbZ[W */
|
---|
104 | #define LOG_NOTICE UINT_C(5)
|
---|
105 | #define LOG_INFO UINT_C(6)
|
---|
106 | #define LOG_DEBUG UINT_C(7) /* fobOpbZ[W */
|
---|
107 |
|
---|
108 | #ifndef TOPPERS_MACRO_ONLY
|
---|
109 |
|
---|
110 | /*
|
---|
111 | * OîñÌf[^\¢
|
---|
112 | */
|
---|
113 |
|
---|
114 | #define TMAX_LOGINFO 6
|
---|
115 |
|
---|
116 | typedef struct {
|
---|
117 | uint_t logtype; /* OîñÌíÊ */
|
---|
118 | SYSTIM logtim; /* O */
|
---|
119 | intptr_t loginfo[TMAX_LOGINFO]; /* »Ì¼ÌOîñ */
|
---|
120 | } SYSLOG;
|
---|
121 |
|
---|
122 | /*
|
---|
123 | * OîñÌdvxÌrbg}bvðìé½ßÌ}N
|
---|
124 | */
|
---|
125 | #define LOG_MASK(prio) (1U << (prio))
|
---|
126 | #define LOG_UPTO(prio) ((1U << ((prio) + 1)) - 1)
|
---|
127 |
|
---|
128 | /*
|
---|
129 | * OîñðoÍ·é½ßÌCuÖ
|
---|
130 | */
|
---|
131 |
|
---|
132 | #ifndef TOPPERS_OMIT_SYSLOG
|
---|
133 |
|
---|
134 | extern ER syslog_wri_log(uint_t prio, const SYSLOG *p_syslog) throw();
|
---|
135 |
|
---|
136 | Inline void
|
---|
137 | _syslog_0(uint_t prio, uint_t type)
|
---|
138 | {
|
---|
139 | SYSLOG syslog;
|
---|
140 |
|
---|
141 | syslog.logtype = type;
|
---|
142 | (void) syslog_wri_log(prio, &syslog);
|
---|
143 | }
|
---|
144 |
|
---|
145 | Inline void
|
---|
146 | _syslog_1(uint_t prio, uint_t type, intptr_t arg1)
|
---|
147 | {
|
---|
148 | SYSLOG syslog;
|
---|
149 |
|
---|
150 | syslog.logtype = type;
|
---|
151 | syslog.loginfo[0] = arg1;
|
---|
152 | (void) syslog_wri_log(prio, &syslog);
|
---|
153 | }
|
---|
154 |
|
---|
155 | Inline void
|
---|
156 | _syslog_2(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2)
|
---|
157 | {
|
---|
158 | SYSLOG syslog;
|
---|
159 |
|
---|
160 | syslog.logtype = type;
|
---|
161 | syslog.loginfo[0] = arg1;
|
---|
162 | syslog.loginfo[1] = arg2;
|
---|
163 | (void) syslog_wri_log(prio, &syslog);
|
---|
164 | }
|
---|
165 |
|
---|
166 | Inline void
|
---|
167 | _syslog_3(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
168 | intptr_t arg3)
|
---|
169 | {
|
---|
170 | SYSLOG syslog;
|
---|
171 |
|
---|
172 | syslog.logtype = type;
|
---|
173 | syslog.loginfo[0] = arg1;
|
---|
174 | syslog.loginfo[1] = arg2;
|
---|
175 | syslog.loginfo[2] = arg3;
|
---|
176 | (void) syslog_wri_log(prio, &syslog);
|
---|
177 | }
|
---|
178 |
|
---|
179 | Inline void
|
---|
180 | _syslog_4(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
181 | intptr_t arg3, intptr_t arg4)
|
---|
182 | {
|
---|
183 | SYSLOG syslog;
|
---|
184 |
|
---|
185 | syslog.logtype = type;
|
---|
186 | syslog.loginfo[0] = arg1;
|
---|
187 | syslog.loginfo[1] = arg2;
|
---|
188 | syslog.loginfo[2] = arg3;
|
---|
189 | syslog.loginfo[3] = arg4;
|
---|
190 | (void) syslog_wri_log(prio, &syslog);
|
---|
191 | }
|
---|
192 |
|
---|
193 | Inline void
|
---|
194 | _syslog_5(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
195 | intptr_t arg3, intptr_t arg4, intptr_t arg5)
|
---|
196 | {
|
---|
197 | SYSLOG syslog;
|
---|
198 |
|
---|
199 | syslog.logtype = type;
|
---|
200 | syslog.loginfo[0] = arg1;
|
---|
201 | syslog.loginfo[1] = arg2;
|
---|
202 | syslog.loginfo[2] = arg3;
|
---|
203 | syslog.loginfo[3] = arg4;
|
---|
204 | syslog.loginfo[4] = arg5;
|
---|
205 | (void) syslog_wri_log(prio, &syslog);
|
---|
206 | }
|
---|
207 |
|
---|
208 | Inline void
|
---|
209 | _syslog_6(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
210 | intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6)
|
---|
211 | {
|
---|
212 | SYSLOG syslog;
|
---|
213 |
|
---|
214 | syslog.logtype = type;
|
---|
215 | syslog.loginfo[0] = arg1;
|
---|
216 | syslog.loginfo[1] = arg2;
|
---|
217 | syslog.loginfo[2] = arg3;
|
---|
218 | syslog.loginfo[3] = arg4;
|
---|
219 | syslog.loginfo[4] = arg5;
|
---|
220 | syslog.loginfo[5] = arg6;
|
---|
221 | (void) syslog_wri_log(prio, &syslog);
|
---|
222 | }
|
---|
223 |
|
---|
224 | /*
|
---|
225 | * OîñiRgjðoÍ·é½ßÌCuÖivasyslog.cj
|
---|
226 | */
|
---|
227 | extern void syslog(uint_t prio, const char *format, ...) throw();
|
---|
228 |
|
---|
229 | #else /* TOPPERS_OMIT_SYSLOG */
|
---|
230 |
|
---|
231 | /*
|
---|
232 | * VXeOoÍð}~·éê
|
---|
233 | */
|
---|
234 |
|
---|
235 | Inline void
|
---|
236 | _syslog_0(uint_t prio, uint_t type)
|
---|
237 | {
|
---|
238 | }
|
---|
239 |
|
---|
240 | Inline void
|
---|
241 | _syslog_1(uint_t prio, uint_t type, intptr_t arg1)
|
---|
242 | {
|
---|
243 | }
|
---|
244 |
|
---|
245 | Inline void
|
---|
246 | _syslog_2(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2)
|
---|
247 | {
|
---|
248 | }
|
---|
249 |
|
---|
250 | Inline void
|
---|
251 | _syslog_3(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
252 | intptr_t arg3)
|
---|
253 | {
|
---|
254 | }
|
---|
255 |
|
---|
256 | Inline void
|
---|
257 | _syslog_4(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
258 | intptr_t arg3, intptr_t arg4)
|
---|
259 | {
|
---|
260 | }
|
---|
261 |
|
---|
262 | Inline void
|
---|
263 | _syslog_5(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
264 | intptr_t arg3, intptr_t arg4, intptr_t arg5)
|
---|
265 | {
|
---|
266 | }
|
---|
267 |
|
---|
268 | Inline void
|
---|
269 | _syslog_6(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
270 | intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6)
|
---|
271 | {
|
---|
272 | }
|
---|
273 |
|
---|
274 | Inline void
|
---|
275 | syslog(uint_t prio, const char *format, ...)
|
---|
276 | {
|
---|
277 | }
|
---|
278 |
|
---|
279 | #endif /* TOPPERS_OMIT_SYSLOG */
|
---|
280 |
|
---|
281 | /*
|
---|
282 | * OîñiRgjðoÍ·é½ßÌ}N
|
---|
283 | *
|
---|
284 | * format¨æÑã±Ìø©ç쬵½bZ[WðCdåxprioÅOî
|
---|
285 | * ñƵÄoÍ·é½ßÌ}NDarg1`argnÍintptr_t^ÉLXg·é
|
---|
286 | * ½ßCintptr_t^É^Ï·Å«éCÓÌ^Åæ¢D
|
---|
287 | */
|
---|
288 |
|
---|
289 | #define syslog_0(prio, format) \
|
---|
290 | _syslog_1(prio, LOG_TYPE_COMMENT, (intptr_t) format)
|
---|
291 |
|
---|
292 | #define syslog_1(prio, format, arg1) \
|
---|
293 | _syslog_2(prio, LOG_TYPE_COMMENT, (intptr_t) format, \
|
---|
294 | (intptr_t)(arg1))
|
---|
295 |
|
---|
296 | #define syslog_2(prio, format, arg1, arg2) \
|
---|
297 | _syslog_3(prio, LOG_TYPE_COMMENT, (intptr_t) format, \
|
---|
298 | (intptr_t)(arg1), (intptr_t)(arg2))
|
---|
299 |
|
---|
300 | #define syslog_3(prio, format, arg1, arg2, arg3) \
|
---|
301 | _syslog_4(prio, LOG_TYPE_COMMENT, (intptr_t) format, \
|
---|
302 | (intptr_t)(arg1), (intptr_t)(arg2), (intptr_t)(arg3))
|
---|
303 |
|
---|
304 | #define syslog_4(prio, format, arg1, arg2, arg3, arg4) \
|
---|
305 | _syslog_5(prio, LOG_TYPE_COMMENT, (intptr_t) format, \
|
---|
306 | (intptr_t)(arg1), (intptr_t)(arg2), (intptr_t)(arg3), \
|
---|
307 | (intptr_t)(arg4))
|
---|
308 |
|
---|
309 | #define syslog_5(prio, format, arg1, arg2, arg3, arg4, arg5) \
|
---|
310 | _syslog_6(prio, LOG_TYPE_COMMENT, (intptr_t) format, \
|
---|
311 | (intptr_t)(arg1), (intptr_t)(arg2), (intptr_t)(arg3), \
|
---|
312 | (intptr_t)(arg4), (intptr_t)(arg5))
|
---|
313 |
|
---|
314 | /*
|
---|
315 | * OîñiAT[V̸sjðoÍ·é½ßÌ}N
|
---|
316 | */
|
---|
317 | #ifndef TOPPERS_assert_fail
|
---|
318 | #define TOPPERS_assert_fail(exp, file, line) \
|
---|
319 | _syslog_3(LOG_EMERG, LOG_TYPE_ASSERT, (intptr_t)(file), \
|
---|
320 | (intptr_t)(line), (intptr_t)(exp))
|
---|
321 | #endif /* TOPPERS_assert_fail */
|
---|
322 |
|
---|
323 | #endif /* TOPPERS_MACRO_ONLY */
|
---|
324 |
|
---|
325 | #ifdef __cplusplus
|
---|
326 | }
|
---|
327 | #endif
|
---|
328 |
|
---|
329 | #endif /* TOPPERS_T_SYSLOG_H */
|
---|