X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fdebug_uart.h;h=34e8b2fc810170ec54cb7176cb2155b696f3d144;hb=c960ef29cd1bffccb84366cc6ca9c290cb3c36a0;hp=a6b7ce8e6eede1a1d74850e22663cb0f973bd63c;hpb=0e977bc1455699fd8a9303ee3e8fd66a3c8eaced;p=u-boot diff --git a/include/debug_uart.h b/include/debug_uart.h index a6b7ce8e6e..34e8b2fc81 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -1,10 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Early debug UART support * * (C) Copyright 2014 Google, Inc * Writte by Simon Glass - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _DEBUG_UART_H @@ -105,19 +104,44 @@ void printhex4(uint value); */ void printhex8(uint value); +#ifdef CONFIG_DEBUG_UART_ANNOUNCE +#define _DEBUG_UART_ANNOUNCE printascii(" "); +#else +#define _DEBUG_UART_ANNOUNCE +#endif + +#define serial_dout(reg, value) \ + serial_out_shift((char *)com_port + \ + ((char *)reg - (char *)com_port) * \ + (1 << CONFIG_DEBUG_UART_SHIFT), \ + CONFIG_DEBUG_UART_SHIFT, value) +#define serial_din(reg) \ + serial_in_shift((char *)com_port + \ + ((char *)reg - (char *)com_port) * \ + (1 << CONFIG_DEBUG_UART_SHIFT), \ + CONFIG_DEBUG_UART_SHIFT) + /* * Now define some functions - this should be inserted into the serial driver */ #define DEBUG_UART_FUNCS \ - void printch(int ch) \ +\ + static inline void _printch(int ch) \ { \ + if (ch == '\n') \ + _debug_uart_putc('\r'); \ _debug_uart_putc(ch); \ } \ +\ + void printch(int ch) \ + { \ + _printch(ch); \ + } \ \ void printascii(const char *str) \ { \ while (*str) \ - _debug_uart_putc(*str++); \ + _printch(*str++); \ } \ \ static inline void printhex1(uint digit) \ @@ -151,6 +175,7 @@ void printhex8(uint value); { \ board_debug_uart_init(); \ _debug_uart_init(); \ + _DEBUG_UART_ANNOUNCE \ } \ #endif