[U-Boot] [RFC PATCH 1/2] serial_mxc: return question mark for chars received with high bit set
Eric Nelson
eric.nelson at boundarydevices.com
Wed May 14 20:04:33 CEST 2014
This patch allows testing of patch 2/2 in the series by forcing
bytes read from the i.MX serial port to be printable.
Without this, it's very hard to tell that a series of in-bound
'\xff' characters are being produced, because they'll be
silently ignored.
Note that this is only submitted for testing.
Signed-off-by: Eric Nelson <eric.nelson at boundarydevices.com>
---
drivers/serial/serial_mxc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 56bee55..ef308dc 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -145,9 +145,13 @@ static void mxc_serial_setbrg(void)
static int mxc_serial_getc(void)
{
+ unsigned char rx;
while (__REG(UART_PHYS + UTS) & UTS_RXEMPTY)
WATCHDOG_RESET();
- return (__REG(UART_PHYS + URXD) & URXD_RX_DATA); /* mask out status from upper word */
+ rx = (__REG(UART_PHYS + URXD) & URXD_RX_DATA); /* mask out status from upper word */
+ if (0x80 <= rx)
+ rx = '?';
+ return rx;
}
static void mxc_serial_putc(const char c)
--
1.9.1
More information about the U-Boot
mailing list