summaryrefslogtreecommitdiff
path: root/include/debug_uart.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/debug_uart.h')
-rw-r--r--include/debug_uart.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/include/debug_uart.h b/include/debug_uart.h
index a75e377..5d5349b 100644
--- a/include/debug_uart.h
+++ b/include/debug_uart.h
@@ -38,10 +38,15 @@
* To enable the debug UART in your serial driver:
*
* - #include <debug_uart.h>
- * - Define debug_uart_init(), trying to avoid using the stack
+ * - Define _debug_uart_init(), trying to avoid using the stack
* - Define _debug_uart_putc() as static inline (avoiding stack usage)
* - Immediately afterwards, add DEBUG_UART_FUNCS to define the rest of the
* functionality (printch(), etc.)
+ *
+ * If your board needs additional init for the UART to work, enable
+ * CONFIG_DEBUG_UART_BOARD_INIT and write a function called
+ * board_debug_uart_init() to perform that init. When debug_uart_init() is
+ * called, the init will happen automatically.
*/
/**
@@ -57,6 +62,14 @@
*/
void debug_uart_init(void);
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void);
+#else
+static inline void board_debug_uart_init(void)
+{
+}
+#endif
+
/**
* printch() - Output a character to the debug UART
*
@@ -92,6 +105,12 @@ void printhex4(uint value);
*/
void printhex8(uint value);
+#ifdef CONFIG_DEBUG_UART_ANNOUNCE
+#define _DEBUG_UART_ANNOUNCE printascii("<debug_uart> ");
+#else
+#define _DEBUG_UART_ANNOUNCE
+#endif
+
/*
* Now define some functions - this should be inserted into the serial driver
*/
@@ -132,6 +151,13 @@ void printhex8(uint value);
void printhex8(uint value) \
{ \
printhex(value, 8); \
- }
+ } \
+\
+ void debug_uart_init(void) \
+ { \
+ board_debug_uart_init(); \
+ _debug_uart_init(); \
+ _DEBUG_UART_ANNOUNCE \
+ } \
#endif