summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWoodData <[email protected]>2022-06-02 15:20:02 +0800
committersakumisu <[email protected]>2022-06-02 15:51:58 +0800
commit69375a86d661c92df64c76dd6e12212aa16b6100 (patch)
tree67754e628757d0c8ef8d0239e2cf9bf5f3249c41
parent84a68fc04004a748496bd00389c865491ebd69e1 (diff)
modify some config macro define.
-rw-r--r--common/usb_util.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/common/usb_util.h b/common/usb_util.h
index a3c13e48..6f0d7a25 100644
--- a/common/usb_util.h
+++ b/common/usb_util.h
@@ -256,8 +256,8 @@
#define USB_DBG_INFO 2
#define USB_DBG_LOG 3
-#ifndef USB_DBG_LEVEL
-#define USB_DBG_LEVEL USB_DBG_INFO
+#ifndef CONFIG_USB_DBG_LEVEL
+#define CONFIG_USB_DBG_LEVEL USB_DBG_INFO
#endif
#ifndef USB_DBG_TAG
@@ -274,52 +274,55 @@
* CYAN 36
* WHITE 37
*/
-#define _USB_PRINTF printf
-#ifdef _USB_PRINTF_COLOR_ENABLE
-#define _USB_DBG_COLOR(n) _USB_PRINTF("\033[" #n "m")
+#ifndef CONFIG_USB_PRINTF
+#define CONFIG_USB_PRINTF printf
+#endif
+
+#ifdef CONFIG_USB_PRINTF_COLOR_ENABLE
+#define _USB_DBG_COLOR(n) CONFIG_USB_PRINTF("\033[" #n "m")
#define _USB_DBG_LOG_HDR(lvl_name, color_n) \
- _USB_PRINTF("\033[" #color_n "m[" lvl_name "/" USB_DBG_TAG "] ")
+ CONFIG_USB_PRINTF("\033[" #color_n "m[" lvl_name "/" USB_DBG_TAG "] ")
#define _USB_DBG_LOG_X_END \
- _USB_PRINTF("\033[0m")
+ CONFIG_USB_PRINTF("\033[0m")
#else
#define _USB_DBG_COLOR(n)
#define _USB_DBG_LOG_HDR(lvl_name, color_n) \
- _USB_PRINTF("[" lvl_name "/" USB_DBG_TAG "] ")
+ CONFIG_USB_PRINTF("[" lvl_name "/" USB_DBG_TAG "] ")
#define _USB_DBG_LOG_X_END
#endif
#define usb_dbg_log_line(lvl, color_n, fmt, ...) \
do { \
_USB_DBG_LOG_HDR(lvl, color_n); \
- _USB_PRINTF(fmt, ##__VA_ARGS__); \
+ CONFIG_USB_PRINTF(fmt, ##__VA_ARGS__); \
_USB_DBG_LOG_X_END; \
} while (0)
-#if (USB_DBG_LEVEL >= USB_DBG_LOG)
+#if (CONFIG_USB_DBG_LEVEL >= USB_DBG_LOG)
#define USB_LOG_DBG(fmt, ...) usb_dbg_log_line("D", 0, fmt, ##__VA_ARGS__)
#else
#define USB_LOG_DBG(...)
#endif
-#if (USB_DBG_LEVEL >= USB_DBG_INFO)
+#if (CONFIG_USB_DBG_LEVEL >= USB_DBG_INFO)
#define USB_LOG_INFO(fmt, ...) usb_dbg_log_line("I", 32, fmt, ##__VA_ARGS__)
#else
#define USB_LOG_INFO(...)
#endif
-#if (USB_DBG_LEVEL >= USB_DBG_WARNING)
+#if (CONFIG_USB_DBG_LEVEL >= USB_DBG_WARNING)
#define USB_LOG_WRN(fmt, ...) usb_dbg_log_line("W", 33, fmt, ##__VA_ARGS__)
#else
#define USB_LOG_WRN(...)
#endif
-#if (USB_DBG_LEVEL >= USB_DBG_ERROR)
+#if (CONFIG_USB_DBG_LEVEL >= USB_DBG_ERROR)
#define USB_LOG_ERR(fmt, ...) usb_dbg_log_line("E", 31, fmt, ##__VA_ARGS__)
#else
#define USB_LOG_ERR(...)
#endif
-#define USB_LOG_RAW _USB_PRINTF
+#define USB_LOG_RAW CONFIG_USB_PRINTF
void usb_assert(const char *filename, int linenum);
#define USB_ASSERT(f) \