From: Eric Nelson Date: Wed, 14 May 2014 11:04:33 -0700 Subject: [U-Boot] [RFC PATCH 1/2] serial_mxc: return question mark for chars received with high bit set In-Reply-To: <1400090674-10586-1-git-send-email-eric.nelson@boundarydevices.com> References: <1400090674-10586-1-git-send-email-eric.nelson@boundarydevices.com> Message-ID: <1400090674-10586-2-git-send-email-eric.nelson@boundarydevices.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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