#ifndef _TRACE_H #define _TRACE_H #ifndef TRACE_BUF_LEN_MAX /*定义trace的buf长度*/ #define TRACE_BUF_LEN_MAX 1024 #endif typedef int(* trace_msg_send)(u8 uartid, const char *buf, u32 buflen); /* 格式输出到trace的目的地 输入参数: fmt, 输出格式,printf相同的格式约定 ..., 可选参数,printf相同的格式约定 返回值: 格式化后的字符串长度,与printf的返回值的约定相同 */ u32 trace_otp_trace(const char * fmt, ...); u32 trace_otp_trace1(trace_msg_send msg_send_cb, u8 uartid, const char * fmt, ...); /***************************************************************************** *trace_init trace初始化函数 *Input: * None *Output: * None *Return: * 0/-1 */ int trace_init(void); #define NEWLINE "\r\n" #define SPACE 0x20 #define cmd_out trace_otp_trace #define OTP_TRACE trace_otp_trace #define OTP_TRACE_LINE OTP_TRACE( "TRC-ERR : %d@%s"NEWLINE, __LINE__, __FILE__) #define OTP_TRACE_FMT_ERR(fmt,arg...) OTP_TRACE("TRC-ERR : %d@%s, " fmt NEWLINE, __LINE__,__FILE__, ##arg) //#define EXE_ASSERT #ifdef EXE_ASSERT /*此处的assert暂时无法调试,暂时屏蔽 test */ #define ASSERT(c) \ do{\ if(!(c)) \ {\ (void)trace_otp_trace( NEWLINE"ASSERT : %d@%s"NEWLINE"%s"NEWLINE, __LINE__, __FILE__,__FUNCTION__);\ }\ }while(0) #else #define ASSERT(c); #endif #endif