2026-07-20 17:04:48 +08:00
|
|
|
#ifndef __DEBUG_H
|
2026-07-13 14:30:13 +08:00
|
|
|
#define __DEBUG_H
|
|
|
|
|
|
|
|
|
|
#include "bsp.h"
|
|
|
|
|
|
|
|
|
|
#if (USE_DEBUG != 0)
|
|
|
|
|
|
|
|
|
|
#define DEBUG_BUFSIZE 200
|
|
|
|
|
#define DEBUG_BUFF_SIZE_MAX 512
|
|
|
|
|
|
|
|
|
|
#define DebugUartSend(X) LPUartSend(X)
|
|
|
|
|
|
|
|
|
|
void vcom_Send( char *format, ... );
|
|
|
|
|
void vcom_Send2(uint8_t *sData, uint16_t len);
|
|
|
|
|
|
2026-07-20 17:04:48 +08:00
|
|
|
#define DBG_LOG2(x, y) vcom_Send2(x, y) //打印长度超过缓存DEBUG_BUFF_SIZE_MAX的信息
|
2026-07-13 14:30:13 +08:00
|
|
|
#define DBG_LOG(...) vcom_Send(__VA_ARGS__)
|
|
|
|
|
#define DBG_LOG_F(fmt,arg...) LOG("[%s] "fmt,__FUNCTION__,##arg)
|
|
|
|
|
|
|
|
|
|
#define DBG_ARRAY(ARRAY,SIZE) { \
|
|
|
|
|
if(ARRAY != NULL) { \
|
|
|
|
|
for(int i = 0; i < SIZE; i++) { \
|
|
|
|
|
DBG_LOG("%02x ",ARRAY[i]); \
|
|
|
|
|
} \
|
|
|
|
|
DBG_LOG("\r\n"); \
|
|
|
|
|
} \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
2026-07-20 17:04:48 +08:00
|
|
|
DBG_CH_UART0 = 0, //默认串口调试方式 Uart0Init
|
2026-07-13 14:30:13 +08:00
|
|
|
DBG_CH_RS485_1, //RS485_1 (LPUART0)
|
|
|
|
|
}DebugChannel_e;
|
|
|
|
|
|
|
|
|
|
extern volatile DebugChannel_e gDebugChannel;
|
|
|
|
|
|
|
|
|
|
typedef void (*DebugExec)(int argc, char *argv[]);
|
|
|
|
|
|
|
|
|
|
typedef struct{
|
|
|
|
|
char *DBGCmd;
|
|
|
|
|
DebugExec DBGExec;
|
|
|
|
|
}DBGFunType;
|
|
|
|
|
|
|
|
|
|
void DebugUartIRQ(uint8_t Data);
|
|
|
|
|
void DebugLoopHandler(void);
|
|
|
|
|
void Debug1mSRoutine(void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//void ReadBootPara(BootPara rData);
|
|
|
|
|
//void WriteBootPara(BootPara wData);
|
|
|
|
|
//extern BootPara_t BLPara;
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
#define DBG_LOG2(x, y)
|
|
|
|
|
#define DBG_LOG(...)
|
|
|
|
|
#define DBG_LOG_F(fmt,arg...)
|
|
|
|
|
#define DBG_ARRAY(ARRAY,SIZE)
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|