[61] | 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 1900 2010-08-14 02:31:44Z ertl-hiro $
|
---|
| 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 | * pPbg`®Ìè`
|
---|
| 130 | */
|
---|
| 131 | typedef struct t_syslog_rlog {
|
---|
| 132 | uint_t count; /* Oobt@ÌOÌ */
|
---|
| 133 | uint_t lost; /* ¸íê½OÌ */
|
---|
| 134 | uint_t logmask; /* Oobt@ÉL^·×«dvx */
|
---|
| 135 | uint_t lowmask; /* áxoͷ׫dvx */
|
---|
| 136 | } T_SYSLOG_RLOG;
|
---|
| 137 |
|
---|
| 138 | /*
|
---|
| 139 | * OîñðoÍ·é½ßÌCuÖ
|
---|
| 140 | */
|
---|
| 141 |
|
---|
| 142 | #ifndef TOPPERS_OMIT_SYSLOG
|
---|
| 143 |
|
---|
| 144 | extern ER syslog_wri_log(uint_t prio, const SYSLOG *p_syslog) throw();
|
---|
| 145 |
|
---|
| 146 | Inline void
|
---|
| 147 | _syslog_0(uint_t prio, uint_t type)
|
---|
| 148 | {
|
---|
| 149 | SYSLOG syslog;
|
---|
| 150 |
|
---|
| 151 | syslog.logtype = type;
|
---|
| 152 | (void) syslog_wri_log(prio, &syslog);
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | Inline void
|
---|
| 156 | _syslog_1(uint_t prio, uint_t type, intptr_t arg1)
|
---|
| 157 | {
|
---|
| 158 | SYSLOG syslog;
|
---|
| 159 |
|
---|
| 160 | syslog.logtype = type;
|
---|
| 161 | syslog.loginfo[0] = arg1;
|
---|
| 162 | (void) syslog_wri_log(prio, &syslog);
|
---|
| 163 | }
|
---|
| 164 |
|
---|
| 165 | Inline void
|
---|
| 166 | _syslog_2(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2)
|
---|
| 167 | {
|
---|
| 168 | SYSLOG syslog;
|
---|
| 169 |
|
---|
| 170 | syslog.logtype = type;
|
---|
| 171 | syslog.loginfo[0] = arg1;
|
---|
| 172 | syslog.loginfo[1] = arg2;
|
---|
| 173 | (void) syslog_wri_log(prio, &syslog);
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | Inline void
|
---|
| 177 | _syslog_3(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
| 178 | intptr_t arg3)
|
---|
| 179 | {
|
---|
| 180 | SYSLOG syslog;
|
---|
| 181 |
|
---|
| 182 | syslog.logtype = type;
|
---|
| 183 | syslog.loginfo[0] = arg1;
|
---|
| 184 | syslog.loginfo[1] = arg2;
|
---|
| 185 | syslog.loginfo[2] = arg3;
|
---|
| 186 | (void) syslog_wri_log(prio, &syslog);
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 | Inline 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 syslog;
|
---|
| 194 |
|
---|
| 195 | syslog.logtype = type;
|
---|
| 196 | syslog.loginfo[0] = arg1;
|
---|
| 197 | syslog.loginfo[1] = arg2;
|
---|
| 198 | syslog.loginfo[2] = arg3;
|
---|
| 199 | syslog.loginfo[3] = arg4;
|
---|
| 200 | (void) syslog_wri_log(prio, &syslog);
|
---|
| 201 | }
|
---|
| 202 |
|
---|
| 203 | Inline 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 syslog;
|
---|
| 208 |
|
---|
| 209 | syslog.logtype = type;
|
---|
| 210 | syslog.loginfo[0] = arg1;
|
---|
| 211 | syslog.loginfo[1] = arg2;
|
---|
| 212 | syslog.loginfo[2] = arg3;
|
---|
| 213 | syslog.loginfo[3] = arg4;
|
---|
| 214 | syslog.loginfo[4] = arg5;
|
---|
| 215 | (void) syslog_wri_log(prio, &syslog);
|
---|
| 216 | }
|
---|
| 217 |
|
---|
| 218 | Inline 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 syslog;
|
---|
| 223 |
|
---|
| 224 | syslog.logtype = type;
|
---|
| 225 | syslog.loginfo[0] = arg1;
|
---|
| 226 | syslog.loginfo[1] = arg2;
|
---|
| 227 | syslog.loginfo[2] = arg3;
|
---|
| 228 | syslog.loginfo[3] = arg4;
|
---|
| 229 | syslog.loginfo[4] = arg5;
|
---|
| 230 | syslog.loginfo[5] = arg6;
|
---|
| 231 | (void) syslog_wri_log(prio, &syslog);
|
---|
| 232 | }
|
---|
| 233 |
|
---|
| 234 | /*
|
---|
| 235 | * OîñiRgjðoÍ·é½ßÌCuÖivasyslog.cj
|
---|
| 236 | */
|
---|
| 237 | extern void syslog(uint_t prio, const char *format, ...) throw();
|
---|
| 238 |
|
---|
| 239 | #else /* TOPPERS_OMIT_SYSLOG */
|
---|
| 240 |
|
---|
| 241 | /*
|
---|
| 242 | * VXeOoÍð}~·éê
|
---|
| 243 | */
|
---|
| 244 |
|
---|
| 245 | Inline void
|
---|
| 246 | _syslog_0(uint_t prio, uint_t type)
|
---|
| 247 | {
|
---|
| 248 | }
|
---|
| 249 |
|
---|
| 250 | Inline void
|
---|
| 251 | _syslog_1(uint_t prio, uint_t type, intptr_t arg1)
|
---|
| 252 | {
|
---|
| 253 | }
|
---|
| 254 |
|
---|
| 255 | Inline void
|
---|
| 256 | _syslog_2(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2)
|
---|
| 257 | {
|
---|
| 258 | }
|
---|
| 259 |
|
---|
| 260 | Inline void
|
---|
| 261 | _syslog_3(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
| 262 | intptr_t arg3)
|
---|
| 263 | {
|
---|
| 264 | }
|
---|
| 265 |
|
---|
| 266 | Inline void
|
---|
| 267 | _syslog_4(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
| 268 | intptr_t arg3, intptr_t arg4)
|
---|
| 269 | {
|
---|
| 270 | }
|
---|
| 271 |
|
---|
| 272 | Inline void
|
---|
| 273 | _syslog_5(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
| 274 | intptr_t arg3, intptr_t arg4, intptr_t arg5)
|
---|
| 275 | {
|
---|
| 276 | }
|
---|
| 277 |
|
---|
| 278 | Inline void
|
---|
| 279 | _syslog_6(uint_t prio, uint_t type, intptr_t arg1, intptr_t arg2,
|
---|
| 280 | intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6)
|
---|
| 281 | {
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | Inline void
|
---|
| 285 | syslog(uint_t prio, const char *format, ...)
|
---|
| 286 | {
|
---|
| 287 | }
|
---|
| 288 |
|
---|
| 289 | #endif /* TOPPERS_OMIT_SYSLOG */
|
---|
| 290 |
|
---|
| 291 | /*
|
---|
| 292 | * OîñiRgjðoÍ·é½ßÌ}N
|
---|
| 293 | *
|
---|
| 294 | * format¨æÑã±Ìø©ç쬵½bZ[WðCdåxprioÅOî
|
---|
| 295 | * ñƵÄoÍ·é½ßÌ}NDarg1`argnÍintptr_t^ÉLXg·é
|
---|
| 296 | * ½ßCintptr_t^É^Ï·Å«éCÓÌ^Åæ¢D
|
---|
| 297 | */
|
---|
| 298 |
|
---|
| 299 | #define syslog_0(prio, format) \
|
---|
| 300 | _syslog_1(prio, LOG_TYPE_COMMENT, (intptr_t) format)
|
---|
| 301 |
|
---|
| 302 | #define syslog_1(prio, format, arg1) \
|
---|
| 303 | _syslog_2(prio, LOG_TYPE_COMMENT, (intptr_t) format, \
|
---|
| 304 | (intptr_t)(arg1))
|
---|
| 305 |
|
---|
| 306 | #define syslog_2(prio, format, arg1, arg2) \
|
---|
| 307 | _syslog_3(prio, LOG_TYPE_COMMENT, (intptr_t) format, \
|
---|
| 308 | (intptr_t)(arg1), (intptr_t)(arg2))
|
---|
| 309 |
|
---|
| 310 | #define syslog_3(prio, format, arg1, arg2, arg3) \
|
---|
| 311 | _syslog_4(prio, LOG_TYPE_COMMENT, (intptr_t) format, \
|
---|
| 312 | (intptr_t)(arg1), (intptr_t)(arg2), (intptr_t)(arg3))
|
---|
| 313 |
|
---|
| 314 | #define syslog_4(prio, format, arg1, arg2, arg3, arg4) \
|
---|
| 315 | _syslog_5(prio, LOG_TYPE_COMMENT, (intptr_t) format, \
|
---|
| 316 | (intptr_t)(arg1), (intptr_t)(arg2), (intptr_t)(arg3), \
|
---|
| 317 | (intptr_t)(arg4))
|
---|
| 318 |
|
---|
| 319 | #define syslog_5(prio, format, arg1, arg2, arg3, arg4, arg5) \
|
---|
| 320 | _syslog_6(prio, LOG_TYPE_COMMENT, (intptr_t) format, \
|
---|
| 321 | (intptr_t)(arg1), (intptr_t)(arg2), (intptr_t)(arg3), \
|
---|
| 322 | (intptr_t)(arg4), (intptr_t)(arg5))
|
---|
| 323 |
|
---|
| 324 | /*
|
---|
| 325 | * OîñiAT[V̸sjðoÍ·é½ßÌ}N
|
---|
| 326 | */
|
---|
| 327 | #ifndef TOPPERS_assert_fail
|
---|
| 328 | #define TOPPERS_assert_fail(exp, file, line) \
|
---|
| 329 | _syslog_3(LOG_EMERG, LOG_TYPE_ASSERT, (intptr_t)(file), \
|
---|
| 330 | (intptr_t)(line), (intptr_t)(exp))
|
---|
| 331 | #endif /* TOPPERS_assert_fail */
|
---|
| 332 |
|
---|
| 333 | #endif /* TOPPERS_MACRO_ONLY */
|
---|
| 334 |
|
---|
| 335 | #ifdef __cplusplus
|
---|
| 336 | }
|
---|
| 337 | #endif
|
---|
| 338 |
|
---|
| 339 | #endif /* TOPPERS_T_SYSLOG_H */
|
---|