summaryrefslogtreecommitdiff
path: root/include/debug_uart.h
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2015-10-21 20:47:40 -0400
committerTom Rini <trini@konsulko.com>2015-10-21 20:47:40 -0400
commit858dbdf8412cefb6dbc4eed63dc3de9744578455 (patch)
tree7cca9f60b3d677b338defa3f4af74a1fff017071 /include/debug_uart.h
parent89b5c81b75658b7ff66dea6c38a51dfecc9dd508 (diff)
parente0ae64880b61fdeaf261fddd747efa80fa53d386 (diff)
Merge git://git.denx.de/u-boot-x86
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 a75e377dc0f..5d5349bbd2e 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