/* * システムログタスクの終了処理 */ void logtask_terminate(intptr_t exinf) { char_t c; SYSLOG syslog; bool_t msgflg = false; ER_UINT rercd; ID my_logtask_portid = get_my_logtask_portid(); /* * シリアルインタフェースドライバの送信バッファに蓄積されたデータ * を,低レベル出力機能を用いて出力する. */ while (serial_get_chr(my_logtask_portid, &c)) { target_fput_log(c); } /* * ログバッファに記録されたログ情報を,低レベル出力機能を用いて出 * 力する. */ while ((rercd = syslog_rea_log(&syslog)) >= 0) { if (!msgflg) { /* * ログバッファに残ったログ情報であることを示す文字列を出 * 力する. */ syslog_printf("-- buffered messages --\n", NULL, target_fput_log); msgflg = true; } if (rercd > 0) { syslog_lostmsg((uint_t) rercd, target_fput_log); } if (syslog.logtype >= LOG_TYPE_COMMENT) { syslog_print(&syslog, target_fput_log); target_fput_log('\n'); } } }
/* * システムログタスクの終了処理(受け口関数) */ void eLogTaskTerminate_main(intptr_t exinf) { char c; SYSLOG syslog; bool_t msgflg = false; ER_UINT rercd; /* * シリアルインタフェースドライバの送信バッファに蓄積されたデータ * を,低レベル出力機能を用いて出力する. */ while (cnSerialPortManage_getChar(&c)) { target_fput_log(c); } /* * ログバッファに記録されたログ情報を,低レベル出力機能を用いて出 * 力する. */ while ((rercd = cSysLog_read(&syslog)) >= 0) { if (!msgflg) { /* * ログバッファに残ったログ情報であることを示す文字列を出 * 力する. */ syslog_printf("-- buffered messages --\n", NULL, target_fput_log); msgflg = true; } if (rercd > 0) { syslog_lostmsg((uint_t) rercd, target_fput_log); } if (syslog.logtype >= LOG_TYPE_COMMENT) { syslog_print(&syslog, target_fput_log); target_fput_log('\n'); } } }
static void debug_i2c_sensor() { // Use port 2 for debug //float_inport_2(); #if 1 IicPortEnable(1); #else devcon.Connection[1] = CONN_NXT_IIC; devcon.Mode[1] = 255; Device1Ioctl(NULL, NULL, IIC_SET_CONN, (unsigned long)&devcon); while(((volatile IICPORT*)(IicPort+1))->Initialised == 0); #endif #if 0 syslog(LOG_NOTICE, "IIC_SET_CONN"); devcon.Mode[1] = 1; Device1Ioctl(NULL, NULL, IIC_SET_CONN, (unsigned long)&devcon); #endif // I2C while (0) { int Port = 1; UBYTE TmpBuffer[IIC_DATA_LENGTH]; IicPort[Port].OutBuffer[0] = IicPort[Port].Addr; IicPort[Port].OutBuffer[1] = 0x42; //0x08; IicPort[Port].OutBuffer[2] = 0x00; IicPort[Port].OutBuffer[3] = 0x00; IicPort[Port].OutLength = 2; IicPort[Port].InLength = 8; IicPortSend(Port); tslp_tsk(1000); IicPortReceive(Port, TmpBuffer); syslog(LOG_EMERG, "TmpBuffer %d %d %d %d %d", TmpBuffer[0], TmpBuffer[1], TmpBuffer[2], TmpBuffer[3], TmpBuffer[4]); } #if 0 while (1) { IicPortReceive(Port, TmpBuffer); tslp_tsk(1000); target_fput_log('l'); } #endif T_CCYC ccyc; ccyc.cycatr = TA_STA; ccyc.cychdr = debug_i2c_cyc; ccyc.cycphs = 0; ccyc.cyctim = 200; //ER_ID ercd = acre_cyc(&ccyc); //assert(ercd > 0); }
/* * ログ情報の出力 * * CPUロック状態や実行コンテキストによらず動作できるように実装してある. */ ER syslog_wri_log(uint_t prio, const SYSLOG *p_syslog) { SIL_PRE_LOC; LOG_SYSLOG_WRI_LOG_ENTER(prio, p_syslog); SIL_LOC_INT(); /* * ログ時刻の設定 */ ((SYSLOG *) p_syslog)->logtim = _kernel_current_time; /* * ログバッファに記録 */ if ((syslog_logmask & LOG_MASK(prio)) != 0U) { syslog_buffer[syslog_tail] = *p_syslog; syslog_tail++; if (syslog_tail >= TCNT_SYSLOG_BUFFER) { syslog_tail = 0U; } if (syslog_count < TCNT_SYSLOG_BUFFER) { syslog_count++; } else { syslog_head = syslog_tail; syslog_lost++; } } /* * 低レベル出力 */ if (((~syslog_lowmask_not) & LOG_MASK(prio)) != 0U) { syslog_print(p_syslog, target_fput_log); target_fput_log('\n'); } SIL_UNL_INT(); LOG_SYSLOG_WRI_LOG_LEAVE(E_OK); return(E_OK); }
/* * システムログの出力処理 */ void syslog_flush(void) { SYSLOG syslog; ER_UINT rercd; /* * ログバッファに記録されたログ情報を,低レベル出力機能を用いて出 * 力する. */ while ((rercd = syslog_rea_log(&syslog)) >= 0) { if (rercd > 0) { syslog_lostmsg((uint_t) rercd, target_fput_log); } if (syslog.logtype >= LOG_TYPE_COMMENT) { syslog_print(&syslog, target_fput_log); target_fput_log('\n'); } } }