#ifdef DEBUG
#define STATIC
#else
#define STATIC static
#endif
#ifdef USE_HPC_DPRINTF
#ifdef DPRINTF_ENABLE
#ifndef DPRINTF_DEBUG
#error "specify unique debug variable"
#endif
#ifndef DPRINTF_LEVEL
#define DPRINTF_LEVEL 1
#endif
int DPRINTF_DEBUG = DPRINTF_LEVEL;
#endif
#ifdef __DPRINTF_EXT
#define PRINTF(fmt, args...) do { \
printf("%s: " fmt, __func__ , ##args); \
} while (0)
#ifdef DPRINTF_ENABLE
#define DPRINTF(fmt, args...) do { \
if (DPRINTF_DEBUG) \
PRINTF(fmt, ##args); \
} while (0)
#define _DPRINTF(fmt, args...) do { \
if (DPRINTF_DEBUG) \
printf(fmt, ##args); \
} while (0)
#define DPRINTFN(n, fmt, args...) do { \
if (DPRINTF_DEBUG > (n)) \
PRINTF(fmt, ##args); \
} while (0)
#define _DPRINTFN(n, fmt, args...) do { \
if (DPRINTF_DEBUG > (n)) \
printf(fmt, ##args); \
} while (0)
#else
#define DPRINTF(args...) do {} while ( 0)
#define _DPRINTF(args...) do {} while ( 0)
#define DPRINTFN(n, args...) do {} while ( 0)
#define _DPRINTFN(n, args...) do {} while ( 0)
#endif
#else
#ifdef DPRINTF_ENABLE
#define DPRINTF(arg) do { \
if (DPRINTF_DEBUG) \
printf arg; \
} while (0)
#define DPRINTFN(n, arg) do { \
if (DPRINTF_DEBUG > (n)) \
printf arg; \
} while (0)
#else
#define DPRINTF(arg) do {} while ( 0)
#define DPRINTFN(n, arg) do {} while ( 0)
#endif
#endif
#endif
#define DBG_BIT_PRINT_COUNT (1 << 0)
#define DBG_BIT_PRINT_QUIET (1 << 1)
void __dbg_bit_print(uint32_t, int, int, int, const char *, int);
#define dbg_bit_print(a) do { \
__dbg_bit_print((a), sizeof(typeof(a)), 0, 0, NULL, \
DBG_BIT_PRINT_COUNT); \
} while (0)
#define dbg_bit_print_msg(a, m) do { \
__dbg_bit_print((a), sizeof(typeof(a)), 0, 0, (m), \
DBG_BIT_PRINT_COUNT); \
} while (0)
#define dbg_bit_display(a) do { \
__dbg_bit_print((a), sizeof(typeof(a)), 0, 0, NULL, \
DBG_BIT_PRINT_QUIET); \
} while (0)
void dbg_bitmask_print(uint32_t, uint32_t, const char *);
void dbg_draw_line(int);
void dbg_banner_title(const char *, size_t);
void dbg_banner_line(void);
#define dbg_banner_function() do { \
dbg_banner_title(__func__, sizeof(__func__) - 1); \
} while ( 0)
#define RGB565_BLACK 0x0000
#define RGB565_RED 0xf800
#define RGB565_GREEN 0x07e0
#define RGB565_YELLOW 0xffe0
#define RGB565_BLUE 0x001f
#define RGB565_MAGENTA 0xf81f
#define RGB565_CYAN 0x07ff
#define RGB565_WHITE 0xffff
void dbg_lcd_test(void);