46 lines
951 B
C
46 lines
951 B
C
#ifndef __DEBUG_H
|
|
#define __DEBUG_H
|
|
|
|
#include "bsp.h"
|
|
|
|
#if (USE_DEBUG != 0)
|
|
|
|
#define BUFSIZE 128
|
|
#define DEBUG_BUFF_SIZE_MAX 512
|
|
|
|
void vcom_Send( char *format, ... );
|
|
void vcom_Send2(uint8_t *sData, uint16_t len);
|
|
|
|
#define DBG_LOG2(x, y) vcom_Send2(x, y) //打印长度超过缓存DEBUG_BUFF_SIZE_MAX的信息
|
|
#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 void (*DebugExec)(int argc, char *argv[]);
|
|
|
|
typedef struct{
|
|
char *DBGCmd;
|
|
DebugExec DBGExec;
|
|
}DBGFunType;
|
|
|
|
void DebugUartIRQ(char Data);
|
|
void DebugLoopHandler(void);
|
|
void Dbg1msRoutine(void);
|
|
#else
|
|
|
|
#define DBG_LOG2(x, y)
|
|
#define DBG_LOG(...)
|
|
#define DBG_LOG_F(fmt,arg...)
|
|
#define DBG_ARRAY(ARRAY,SIZE)
|
|
|
|
#endif
|
|
#endif
|