source: UsbWattMeter/trunk/asp_dcre/include/t_syslog.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: 9.3 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-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: t_syslog.h 164 2016-03-07 11:33:50Z coas-nagasima $
45 */
46
47/*
48 * ƒVƒXƒeƒ€ƒƒOo—Í‚ðs‚¤‚½‚ß‚Ì’è‹`
49 *
50 * ƒVƒXƒeƒ€ƒƒOƒT[ƒrƒX‚́CƒVƒXƒeƒ€‚̃ƒOî•ñ‚ðo—Í‚·‚邽‚߂̃T[ƒrƒX
51 * ‚Å‚ ‚éDƒJ[ƒlƒ‹‚©‚ç‚̃ƒOî•ñ‚̏o—Í‚É‚à—p‚¢‚邽‚߁C“à•”‚Å‘Ò‚¿ó‘Ô
52 * ‚É‚Í‚¢‚邱‚Æ‚Í‚È‚¢D
53 *
54 * ƒƒOî•ñ‚́CƒJ[ƒlƒ‹“à‚̃ƒOƒoƒbƒtƒ@‚ɏ‘‚«ž‚Þ‚©C’჌ƒxƒ‹‚Ì•¶Žšo
55 * —͊֐”‚ð—p‚¢‚ďo—Í‚·‚éD‚Ç‚¿‚ç‚ðŽg‚¤‚©‚́CŠg’£ƒT[ƒrƒXƒR[ƒ‹‚Ő؂è
56 * Š·‚¦‚邱‚Æ‚ª‚Å‚«‚éD
57 *
58 * ƒƒOƒoƒbƒtƒ@—̈悪ƒI[ƒoƒtƒ[‚µ‚½ê‡‚ɂ́CŒÃ‚¢ƒƒOî•ñ‚ðÁ‚µ‚ďã
59 * ‘‚«‚·‚éD
60 *
61 * ƒAƒZƒ“ƒuƒŠŒ¾Œê‚̃\[ƒXƒtƒ@ƒCƒ‹‚©‚炱‚̃tƒ@ƒCƒ‹‚ðƒCƒ“ƒNƒ‹[ƒh‚·‚鎞
62 * ‚́CTOPPERS_MACRO_ONLY‚ð’è‹`‚µ‚Ä‚¨‚­‚±‚ƂŁCƒ}ƒNƒ’è‹`ˆÈŠO‚Ì‹Lq‚ð
63 * œ‚­‚±‚Æ‚ª‚Å‚«‚éD
64 *
65 * ‚±‚̃tƒ@ƒCƒ‹‚ðƒCƒ“ƒNƒ‹[ƒh‚·‚é‘O‚ɁCt_stddef.h‚ðƒCƒ“ƒNƒ‹[ƒh‚µ‚Ä‚¨
66 * ‚­‚±‚Æ‚ª•K—v‚Å‚ ‚éD
67 */
68
69#ifndef TOPPERS_T_SYSLOG_H
70#define TOPPERS_T_SYSLOG_H
71
72#ifdef __cplusplus
73extern "C" {
74#endif
75
76/*
77 * ƒƒOî•ñ‚ÌŽí•Ê‚Ì’è‹`
78 */
79#define LOG_TYPE_COMMENT UINT_C(0x01) /* ƒRƒƒ“ƒg */
80#define LOG_TYPE_ASSERT UINT_C(0x02) /* ƒAƒT[ƒVƒ‡ƒ“‚ÌŽ¸”s */
81
82#define LOG_TYPE_INH UINT_C(0x11) /* Š„ž‚݃nƒ“ƒhƒ‰ */
83#define LOG_TYPE_ISR UINT_C(0x12) /* Š„ž‚݃T[ƒrƒXƒ‹[ƒ`ƒ“ */
84#define LOG_TYPE_CYC UINT_C(0x13) /* ŽüŠúƒnƒ“ƒhƒ‰ */
85#define LOG_TYPE_ALM UINT_C(0x14) /* ƒAƒ‰[ƒ€ƒnƒ“ƒhƒ‰ */
86#define LOG_TYPE_OVR UINT_C(0x15) /* ƒI[ƒoƒ‰ƒ“ƒnƒ“ƒhƒ‰ */
87#define LOG_TYPE_EXC UINT_C(0x16) /* CPU—áŠOƒnƒ“ƒhƒ‰ */
88#define LOG_TYPE_TEX UINT_C(0x17) /* ƒ^ƒXƒN—áŠOˆ—ƒ‹[ƒ`ƒ“ */
89#define LOG_TYPE_TSKSTAT UINT_C(0x18) /* ƒ^ƒXƒNó‘ԕω» */
90#define LOG_TYPE_DSP UINT_C(0x19) /* ƒfƒBƒXƒpƒbƒ`ƒƒ */
91#define LOG_TYPE_SVC UINT_C(0x1a) /* ƒT[ƒrƒXƒR[ƒ‹ */
92
93#define LOG_ENTER UINT_C(0x00) /* “üŒû^ŠJŽn */
94#define LOG_LEAVE UINT_C(0x80) /* oŒû^I—¹ */
95
96/*
97 * ƒƒOî•ñ‚̏d—v“x‚Ì’è‹`
98 */
99#define LOG_EMERG UINT_C(0) /* ƒVƒƒƒbƒgƒ_ƒEƒ“‚É’l‚·‚éƒGƒ‰[ */
100#define LOG_ALERT UINT_C(1)
101#define LOG_CRIT UINT_C(2)
102#define LOG_ERROR UINT_C(3) /* ƒVƒXƒeƒ€ƒGƒ‰[ */
103#define LOG_WARNING UINT_C(4) /* ŒxƒƒbƒZ[ƒW */
104#define LOG_NOTICE UINT_C(5)
105#define LOG_INFO UINT_C(6)
106#define LOG_DEBUG UINT_C(7) /* ƒfƒoƒbƒO—pƒƒbƒZ[ƒW */
107
108#ifndef TOPPERS_MACRO_ONLY
109
110/*
111 * ƒƒOî•ñ‚̃f[ƒ^\‘¢
112 */
113
114#define TMAX_LOGINFO 6
115
116typedef struct {
117 uint_t logtype; /* ƒƒOî•ñ‚ÌŽí•Ê */
118 SYSTIM logtim; /* ƒƒOŽž */
119 intptr_t loginfo[TMAX_LOGINFO]; /* ‚»‚Ì‘¼‚̃ƒOî•ñ */
120} SYSLOG;
121
122/*
123 * ƒƒOî•ñ‚̏d—v“x‚̃rƒbƒgƒ}ƒbƒv‚ðì‚邽‚߂̃}ƒNƒ
124 */
125#define LOG_MASK(prio) (1U << (prio))
126#define LOG_UPTO(prio) ((1U << ((prio) + 1)) - 1)
127
128/*
129 * ƒpƒPƒbƒgŒ`Ž®‚Ì’è‹`
130 */
131typedef struct t_syslog_rlog {
132 uint_t count; /* ƒƒOƒoƒbƒtƒ@’†‚̃ƒO‚̐” */
133 uint_t lost; /* Ž¸‚í‚ꂽƒƒO‚̐” */
134 uint_t logmask; /* ƒƒOƒoƒbƒtƒ@‚É‹L˜^‚·‚ׂ«d—v“x */
135 uint_t lowmask; /* ’჌ƒxƒ‹o—Í‚·‚ׂ«d—v“x */
136} T_SYSLOG_RLOG;
137
138/*
139 * ƒƒOî•ñ‚ðo—Í‚·‚邽‚߂̃‰ƒCƒuƒ‰ƒŠŠÖ”
140 */
141
142#ifndef TOPPERS_OMIT_SYSLOG
143
144extern ER syslog_wri_log(uint_t prio, const SYSLOG *p_syslog) throw();
145
146Inline void
147_syslog_0(uint_t prio, uint_t type)
148{
149 SYSLOG logbuf;
150
151 logbuf.logtype = type;
152 (void) syslog_wri_log(prio, &logbuf);
153}
154
155Inline void
156_syslog_1(uint_t prio, uint_t type, intptr_t arg1)
157{
158 SYSLOG logbuf;
159
160 logbuf.logtype = type;
161 logbuf.loginfo[0] = arg1;
162 (void) syslog_wri_log(prio, &logbuf);
163}
164
165Inline void
166_syslog_2(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2)
167{
168 SYSLOG logbuf;
169
170 logbuf.logtype = type;
171 logbuf.loginfo[0] = arg1;
172 logbuf.loginfo[1] = arg2;
173 (void) syslog_wri_log(prio, &logbuf);
174}
175
176Inline void
177_syslog_3(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
178 intptr_t arg3)
179{
180 SYSLOG logbuf;
181
182 logbuf.logtype = type;
183 logbuf.loginfo[0] = arg1;
184 logbuf.loginfo[1] = arg2;
185 logbuf.loginfo[2] = arg3;
186 (void) syslog_wri_log(prio, &logbuf);
187}
188
189Inline void
190_syslog_4(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
191 intptr_t arg3, intptr_t arg4)
192{
193 SYSLOG logbuf;
194
195 logbuf.logtype = type;
196 logbuf.loginfo[0] = arg1;
197 logbuf.loginfo[1] = arg2;
198 logbuf.loginfo[2] = arg3;
199 logbuf.loginfo[3] = arg4;
200 (void) syslog_wri_log(prio, &logbuf);
201}
202
203Inline void
204_syslog_5(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
205 intptr_t arg3, intptr_t arg4, intptr_t arg5)
206{
207 SYSLOG logbuf;
208
209 logbuf.logtype = type;
210 logbuf.loginfo[0] = arg1;
211 logbuf.loginfo[1] = arg2;
212 logbuf.loginfo[2] = arg3;
213 logbuf.loginfo[3] = arg4;
214 logbuf.loginfo[4] = arg5;
215 (void) syslog_wri_log(prio, &logbuf);
216}
217
218Inline void
219_syslog_6(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
220 intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6)
221{
222 SYSLOG logbuf;
223
224 logbuf.logtype = type;
225 logbuf.loginfo[0] = arg1;
226 logbuf.loginfo[1] = arg2;
227 logbuf.loginfo[2] = arg3;
228 logbuf.loginfo[3] = arg4;
229 logbuf.loginfo[4] = arg5;
230 logbuf.loginfo[5] = arg6;
231 (void) syslog_wri_log(prio, &logbuf);
232}
233
234/*
235 * ƒƒOî•ñiƒRƒƒ“ƒgj‚ðo—Í‚·‚邽‚߂̃‰ƒCƒuƒ‰ƒŠŠÖ”ivasyslog.cj
236 */
237extern void syslog(uint_t prio, const char *format, ...) throw();
238extern void vsyslog(uint_t prio, const char *format, va_list ap) throw();
239
240#else /* TOPPERS_OMIT_SYSLOG */
241
242/*
243 * ƒVƒXƒeƒ€ƒƒOo—Í‚ð—}Ž~‚·‚éê‡
244 */
245
246Inline void
247_syslog_0(uint_t prio, uint_t type)
248{
249}
250
251Inline void
252_syslog_1(uint_t prio, uint_t type, intptr_t arg1)
253{
254}
255
256Inline void
257_syslog_2(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2)
258{
259}
260
261Inline void
262_syslog_3(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
263 intptr_t arg3)
264{
265}
266
267Inline void
268_syslog_4(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
269 intptr_t arg3, intptr_t arg4)
270{
271}
272
273Inline void
274_syslog_5(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
275 intptr_t arg3, intptr_t arg4, intptr_t arg5)
276{
277}
278
279Inline void
280_syslog_6(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
281 intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6)
282{
283}
284
285Inline void
286syslog(uint_t prio, const char *format, ...)
287{
288}
289
290#endif /* TOPPERS_OMIT_SYSLOG */
291
292/*
293 * ƒƒOî•ñiƒRƒƒ“ƒgj‚ðo—Í‚·‚邽‚߂̃}ƒNƒ
294 *
295 * format‚¨‚æ‚ь㑱‚̈ø”‚©‚çì¬‚µ‚½ƒƒbƒZ[ƒW‚ðCd‘å“xprio‚эƒOî
296 * •ñ‚Æ‚µ‚ďo—Í‚·‚邽‚߂̃}ƒNƒDarg1`argn‚Íintptr_tŒ^‚ɃLƒƒƒXƒg‚·‚é
297 * ‚½‚߁Cintptr_tŒ^‚ÉŒ^•ÏŠ·‚Å‚«‚é”CˆÓ‚ÌŒ^‚Å‚æ‚¢D
298 */
299
300#define syslog_0(prio, format) \
301 _syslog_1(prio, LOG_TYPE_COMMENT, (intptr_t)(format))
302
303#define syslog_1(prio, format, arg1) \
304 _syslog_2(prio, LOG_TYPE_COMMENT, (intptr_t)(format), \
305 (intptr_t)(arg1))
306
307#define syslog_2(prio, format, arg1, arg2) \
308 _syslog_3(prio, LOG_TYPE_COMMENT, (intptr_t)(format), \
309 (intptr_t)(arg1), (intptr_t)(arg2))
310
311#define syslog_3(prio, format, arg1, arg2, arg3) \
312 _syslog_4(prio, LOG_TYPE_COMMENT, (intptr_t)(format), \
313 (intptr_t)(arg1), (intptr_t)(arg2), (intptr_t)(arg3))
314
315#define syslog_4(prio, format, arg1, arg2, arg3, arg4) \
316 _syslog_5(prio, LOG_TYPE_COMMENT, (intptr_t)(format), \
317 (intptr_t)(arg1), (intptr_t)(arg2), (intptr_t)(arg3), \
318 (intptr_t)(arg4))
319
320#define syslog_5(prio, format, arg1, arg2, arg3, arg4, arg5) \
321 _syslog_6(prio, LOG_TYPE_COMMENT, (intptr_t)(format), \
322 (intptr_t)(arg1), (intptr_t)(arg2), (intptr_t)(arg3), \
323 (intptr_t)(arg4), (intptr_t)(arg5))
324
325/*
326 * ƒƒOî•ñiƒAƒT[ƒVƒ‡ƒ“‚ÌŽ¸”sj‚ðo—Í‚·‚邽‚߂̃}ƒNƒ
327 */
328#ifndef TOPPERS_assert_fail
329#define TOPPERS_assert_fail(exp, file, line) \
330 _syslog_3(LOG_EMERG, LOG_TYPE_ASSERT, (intptr_t)(file), \
331 (intptr_t)(line), (intptr_t)(exp))
332#endif /* TOPPERS_assert_fail */
333
334#endif /* TOPPERS_MACRO_ONLY */
335
336#ifdef __cplusplus
337}
338#endif
339
340#endif /* TOPPERS_T_SYSLOG_H */
Note: See TracBrowser for help on using the repository browser.