#include "target_syssvc.h"
マクロ定義 | |
#define | LOGTASK_PRIORITY 3 |
#define | LOGTASK_STACK_SIZE 1024 |
#define | LOGTASK_PORTID 1 |
#define | LOGTASK_INTERVAL 10U |
#define | LOGTASK_FLUSH_WAIT 1U |
関数 | |
ER | logtask_flush (uint_t count) throw () |
void | logtask_main (intptr_t exinf) throw () |
void | logtask_terminate (intptr_t exinf) throw () |
#define LOGTASK_FLUSH_WAIT 1U |
#define LOGTASK_INTERVAL 10U |
参照先 t_syslog_rlog::count, dly_tsk(), E_CTX, E_OK, E_RLWAI, E_SYS, LOGTASK_FLUSH_WAIT, logtask_portid, serial_ref_por(), sns_dpn(), syslog_ref_log(), と T_SERIAL_RPOR::wricnt.
参照元 print_hist().
00073 { 00074 T_SYSLOG_RLOG rlog; 00075 T_SERIAL_RPOR rpor; 00076 ER ercd, rercd; 00077 00078 if (sns_dpn()) { 00079 ercd = E_CTX; 00080 } 00081 else { 00082 for (;;) { 00083 if (syslog_ref_log(&rlog) < 0) { 00084 ercd = E_SYS; 00085 goto error_exit; 00086 } 00087 if (rlog.count <= count) { 00088 if (count == 0U) { 00089 /* 00090 * countが0の場合には,シリアルバッファが空かを確 00091 * 認する. 00092 */ 00093 if (serial_ref_por(logtask_portid, &rpor) < 0) { 00094 ercd = E_SYS; 00095 goto error_exit; 00096 } 00097 if (rpor.wricnt == 0U) { 00098 ercd = E_OK; 00099 goto error_exit; 00100 } 00101 } 00102 else { 00103 ercd = E_OK; 00104 goto error_exit; 00105 } 00106 } 00107 00108 /* 00109 * LOGTASK_FLUSH_WAITミリ秒待つ. 00110 */ 00111 rercd = dly_tsk(LOGTASK_FLUSH_WAIT); 00112 if (rercd < 0) { 00113 ercd = (rercd == E_RLWAI) ? rercd : E_SYS; 00114 goto error_exit; 00115 } 00116 } 00117 } 00118 00119 error_exit: 00120 return(ercd); 00121 }
void logtask_main | ( | intptr_t | exinf | ) | throw () |
参照先 dly_tsk(), LOG_EMERG, LOG_NOTICE, LOG_TYPE_COMMENT, LOG_UPTO, LOGTASK_INTERVAL, logtask_portid, logtask_putc(), SYSLOG::logtype, serial_opn_por(), syslog(), syslog_1, syslog_lostmsg(), syslog_msk_log(), syslog_print(), と syslog_rea_log().
00128 { 00129 SYSLOG syslog; 00130 uint_t lost; 00131 ER_UINT rercd; 00132 00133 logtask_portid = (ID) exinf; 00134 serial_opn_por(logtask_portid); 00135 syslog_msk_log(LOG_UPTO(LOG_NOTICE), LOG_UPTO(LOG_EMERG)); 00136 syslog_1(LOG_NOTICE, "System logging task is started on port %d.", 00137 logtask_portid); 00138 for (;;) { 00139 lost = 0U; 00140 while ((rercd = syslog_rea_log(&syslog)) >= 0) { 00141 lost += (uint_t) rercd; 00142 if (syslog.logtype >= LOG_TYPE_COMMENT) { 00143 if (lost > 0U) { 00144 syslog_lostmsg(lost, logtask_putc); 00145 lost = 0U; 00146 } 00147 syslog_print(&syslog, logtask_putc); 00148 logtask_putc('\n'); 00149 } 00150 } 00151 if (lost > 0U) { 00152 syslog_lostmsg(lost, logtask_putc); 00153 } 00154 dly_tsk(LOGTASK_INTERVAL); 00155 } 00156 }
void logtask_terminate | ( | intptr_t | exinf | ) | throw () |
参照先 LOG_TYPE_COMMENT, logtask_portid, SYSLOG::logtype, serial_get_chr(), syslog(), syslog_lostmsg(), syslog_print(), syslog_rea_log(), と target_fput_log().
00163 { 00164 char_t c; 00165 SYSLOG syslog; 00166 ER_UINT rercd; 00167 00168 /* 00169 * シリアルインタフェースドライバの送信バッファに蓄積されたデータ 00170 * を,低レベル出力機能を用いて出力する. 00171 */ 00172 while (serial_get_chr(logtask_portid, &c)) { 00173 target_fput_log(c); 00174 } 00175 00176 /* 00177 * ログバッファに記録されたログ情報を,低レベル出力機能を用いて出 00178 * 力する. 00179 */ 00180 while ((rercd = syslog_rea_log(&syslog)) >= 0) { 00181 if (rercd > 0) { 00182 syslog_lostmsg((uint_t) rercd, target_fput_log); 00183 } 00184 if (syslog.logtype >= LOG_TYPE_COMMENT) { 00185 syslog_print(&syslog, target_fput_log); 00186 target_fput_log('\n'); 00187 } 00188 } 00189 }
Copyright © 2008 by Kijineko Inc.