aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/usbh/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/include/usbh/debug.h')
-rw-r--r--os/hal/include/usbh/debug.h49
1 files changed, 42 insertions, 7 deletions
diff --git a/os/hal/include/usbh/debug.h b/os/hal/include/usbh/debug.h
index 41319b9..f90a11a 100644
--- a/os/hal/include/usbh/debug.h
+++ b/os/hal/include/usbh/debug.h
@@ -24,18 +24,53 @@
#if HAL_USE_USBH
#if USBH_DEBUG_ENABLE
+#if USBH_DEBUG_MULTI_HOST
+ /* output callback */
+ void USBH_DEBUG_OUTPUT_CALLBACK(USBHDriver *host, const uint8_t *buff, size_t len);
+
+ /* printing functions */
+ void usbDbgPrintf(USBHDriver *host, const char *fmt, ...);
+ void usbDbgPuts(USBHDriver *host, const char *s);
+ void usbDbgInit(USBHDriver *host);
+#else
+ /* output callback */
+ void USBH_DEBUG_OUTPUT_CALLBACK(const uint8_t *buff, size_t len);
+
+ /* printing functions */
void usbDbgPrintf(const char *fmt, ...);
void usbDbgPuts(const char *s);
- void usbDbgInit(USBHDriver *host);
+ void usbDbgInit(void);
+#endif
+
void usbDbgReset(void);
- void usbDbgSystemHalted(void);
#else
-#define usbDbgPrintf(fmt, ...) do {} while(0)
-#define usbDbgPuts(s) do {} while(0)
-#define usbDbgInit(host) do {} while(0)
-#define usbDbgReset() do {} while(0)
-#define usbDbgSystemHalted() do {} while(0)
+
+#if USBH_DEBUG_MULTI_HOST
+# define usbDbgPrintf(host, fmt, ...) do {} while(0)
+# define usbDbgPuts(host, s) do {} while(0)
+# define usbDbgInit(host) do {} while(0)
+#else
+# define usbDbgPrintf(fmt, ...) do {} while(0)
+# define usbDbgPuts(s) do {} while(0)
+# define usbDbgInit() do {} while(0)
+#endif
+# define usbDbgReset() do {} while(0)
+#endif
+
+#if USBH_DEBUG_MULTI_HOST
+#define _usbh_dbg(host, s) usbDbgPuts(host, s)
+#define _usbh_dbgf(host, f, ...) usbDbgPrintf(host, f, ##__VA_ARGS__)
+#define _usbh_ldbg(host, lvl, n, s) do {if (lvl >= n) usbDbgPuts(host, s); } while(0)
+#define _usbh_ldbgf(host, lvl, n, f, ...) do {if (lvl >= n) usbDbgPrintf(host, f, ##__VA_ARGS__); } while(0)
+#else
+
+#define _usbh_dbg(host, s) usbDbgPuts(s)
+#define _usbh_dbgf(host, f, ...) usbDbgPrintf(f, ##__VA_ARGS__)
+#define _usbh_ldbg(host, lvl, n, s) do {if (lvl >= n) usbDbgPuts(s); } while(0)
+#define _usbh_ldbgf(host, lvl, n, f, ...) do {if (lvl >= n) usbDbgPrintf(f, ##__VA_ARGS__); } while(0)
+
#endif
+
#endif