/***************************************************************************** * DEBUG_DRV.h: Header file for DEBUY DRIVER FILES * * * Copyright(C) 2013, cc * All rights reserved. * * History * 2013.05.24 ver 1.00 Prelimnary version, first Release * 2020.02.22 ver 2.00 step 1 led点灯 step 2.1 uart debug send step 2.2 uart debug rev with led step 2.3 debug protocol test step 3 step 4 timer test --> get tick step 5 TTSS task test step 6 ******************************************************************************/ #ifndef __DEBUG_DRV_H #define __DEBUG_DRV_H #include "c_type51.h" #include "c_lib.h" #include "msp_uartN.h" #include "msp_uart1.h" //#include "msp_uart2.h"/// ///#include "msp_uart3.h" ///#include "msp_uart4.h"/// #include "stdio.h" //#include "msp_uart4.h" #include "tpc_x.h" //#include "tpc_debug.h" extern TS_P_debug *pd; #define D_cmd_filter_debug 0xfd #define D_cmd_filter_gc032A 0xfc #define D_cmd_filter_weight 0xFE #define D_cmd_filter_iicx 0xf1 ///根据实际电路进行调整 #if 0 #define L1_uartD_senduc(x) L1_uart4_senduc((x) #define L1_uartD_sendArray(x,len) L1_uart4_sendArray((x),(len)) #define L1_uartD_sendStr(x) L1_uart4_sendStr((x)) #define L1_uartD_waitFree() L1_uart4_waitFree() #define D_ts_uartX_rev (&TP_Uart_RE_) #define Uart_Send_Msg(X); L1_uartD_sendStr(X); #else #define L1_uartD_0d0a() L0_uartN_0d0a(D_UART1) #define L1_uartD_uc(x) L0_uartN_uc(D_UART1,(x)) #define L1_uartD_us(x) L0_uartN_us(D_UART1,(x)) #define L1_uartD_uchex(x) L0_uartN_uchex(D_UART1,(x)) #define L1_uartD_ushex(x) L0_uartN_ushex(D_UART1,(x)) #define L1_uartD_ulhex(x) L0_uartN_ulhex(D_UART1,(x)) #define L1_uartD_Array(x,len) L0_uartN_Array(D_UART1,(x),(len)) #define L1_uartD_ArrayLong(x,start,end) L0_uartN_Arraylong(D_UART1,x,start,end) #define L1_uartD_Arrayhex(x,len) L0_uartN_Arrayhex_withoutbuf(D_UART1,(x),(len)) ////#define L1_uartD_ushexArray(x,len) L0_uartN_ushexArray(D_UART1,(x),(len)) #define L1_uartD_Str(x) L0_uartN_str(D_UART1,(x)) #define L1_uartD_waitFree() L0_waitFree_uartN(D_UART1) #define D_ts_uartX_rev (&ts_s2b1_road) #define Uart__Msg(X); L1_uartD_Str(X); #define uartSendByte(X) L0_uartN_ushex(D_UART1,(X)) #define Uart__Hex(x,u) L0_uartN_ushex(D_UART1,(x)) #endif ///#define xxxlog(format, ...) printf("[%s:%d->%s] ",format, __FILE__, __LINE__, __func__, ##__VA_ARGS__) //////#define printfs_debug #ifdef printfs_debug #define printfs(str) #define printf1(str,i1) #define printf2(str,i1,i2) #define printf3(str,i1,i2,i3) #define printf4(str,i1,i2,i3,i4) #else #define printfs(str) L1_uartD_waitFree() ;printf(str) #define printf1(str,i1) L1_uartD_waitFree() ;printf(str,i1) #define printf2(str,i1,i2) L1_uartD_waitFree() ;printf(str,i1,i2) #define printf3(str,i1,i2,i3) L1_uartD_waitFree() ;printf(str,i1,i2,i3) #define printf4(str,i1,i2,i3,i4) L1_uartD_waitFree() ;printf(str,i1,i2,i3,i4) #define printf5(str,i1,i2,i3,i4,i5) L1_uartD_waitFree() ;printf(str,i1,i2,i3,i4,i5) /* #define printfs(str) L1_uartD_Str(str);///L1_uartD_waitFree() ;printf(str) #define printf1(str,i1) L1_uartD_Str(str);L1_uartD_ushex(i1);///L1_uartD_waitFree() ;printf(str,i1) #define printf2(str,i1,i2) printf1(str,i1);L1_uartD_ushex(i2);///L1_uartD_waitFree() ;printf(str,i1,i2) #define printf3(str,i1,i2,i3) printf2(str,i1,i2);L1_uartD_ushex(i3);///L1_uartD_Str(str);L1_uartD_ushex(i1);///L1_uartD_waitFree() ;printf(str,i1,i2,i3) #define printf4(str,i1,i2,i3,i4) printf3(str,i1,i2,i3);L1_uartD_ushex(i4);///L1_uartD_Str(str);L1_uartD_ushex(i1);///L1_uartD_waitFree() ;printf(str,i1,i2,i3,i4) #define printf5(str,i1,i2,i3,i4,i5) printf4(str,i1,i2,i3,i4);L1_uartD_ushex(i5);///L1_uartD_Str(str);L0_uartN_ushex(i1);/// L1_uartD_waitFree() ;printf(str,i1,i2,i3,i4,i5) */ #endif ///L0_waitFree_uartN extern void L3_debug_drv_init(void); extern void L3_test_ONdebug(u8 filter); extern vtype L2_debug_ONcomand(void); extern void L3_iicx_debug(u8 filter); #if 0 if(1 == ts_uart4_rev.revok) {ts_uart4_rev.revok= 0; td = (TS_P_debug *)ts_uart4_rev.buf; L1_uart4_sendArray(ts_uart4_rev.buf, 5); if(D_sb_filter == td->filter) { if(0x04 == td->R1)///设置四个传感器的清零 { //// fd 04 33 44 55 void L3_debug_drv_init(void); #define L3_debug_time() L0pf_send_uc = L0_uart0_uc; ///Lc_print("\r\n%s,-%sL:%d,",__DATE__,__TIME__,__LINE__); extern void L3_debug_cycle(void); #define UART_debug_reg ((LPC_UART1_TypeDef *) LPC_UART1_BASE ) //#define UART_debug ((LPC_UART1_TypeDef *) LPC_UART1_BASE ) //#define UART_debug ((LPC_UART_TypeDef *) LPC_UART_BASE ) //#define UART_debug ((LPC_UART_TypeDef *) LPC_UART_BASE ) #define UART_debug 1 #define L0_debugS_uc(x) //L0_Usend_uc(UART_debug,x) #define L0_debugS_uc_hex(x) //L0_Usend_uc_hex(UART_debug,x) #define L0_debug_uc_show(x,y); //L0_USART_print(UART_debug,x,y); #define L0_debug_us_show(x,y); //L0_USART_print(UART_debug,x,y); #define L0_debug_ul_show(x,y); //L0_USART_print(UART_debug,x,y); //#define L2_debug_info(x) //L0_USART_print(UART_debug,x); #define L2_debug_Au4B(x) // L0_Usend_Au4B(UART_debug,x) #define L0_debug_Au4B_show(x,y); //L0_USART_print(UART_debug,x,y); #define L0_debug_Aus_show(x,y); //L0_USART_print(UART_debug,x,y); #define L0_debug_A4B_show(x,y); //L0_USART_print(UART_debug,x,y); //#define debug22(format...) Lc_print("%s (%d): ",__FILE__,__LINE__); //#define LOG(format, args...) Lc_print(format, ##args) //#define RTA_printf(...) Lc_print(__VA_ARGS__) //#define L2_debug_info Lc_print //#define L3_debug_time() Lc_print(L0_uart0_uc,"\r\n%s,-%sL:%d,",__DATE__,__TIME__,__LINE__); #define L2_debug_info(...) \ Lc_print(L0_uart_uc,__VA_ARGS__); //do { //Lc_print("%s (%d): ", __FILE__, __LINE__); //Lc_print(format, __VA_ARGS__); //} while (0) #define CHECK1(x, ...) if (!(x)) { printf(__VA_ARGS__); } #define LOG(...) {\ Lc_print(L0_uart_uc,"%s: Line %d:\t", __FILE__, __LINE__);\ Lc_print(L0_uart_uc, __VA_ARGS__);\ Lc_print(L0_uart_uc,"\n");\ } int main() { int x = 3; // һЩ... LOG("x = %d", x); // 2-1-5.cpp: Line 12: x = 3 } #endif #endif /* end __DEBUG_DRV_H */ /***************************************************************************** ** End Of File ******************************************************************************/