From 7be49773c05ebbc02075489332edf694427d90b0 Mon Sep 17 00:00:00 2001 From: Adrien Chardon Date: Tue, 30 Jan 2024 18:02:04 +0100 Subject: [PATCH] bsps/shared/zynq-uart-polled: fix bug in zynq_uart_initialize() Similar to the recent commit in tms570-sci.c, the assumption that a UART will only see printable ASCII characters, instead of any value in the range 0x00-0xFF, is wrong. A non forgiving binary protocol will be thrown off by this driver sending "\r\r\r\r" when initializing. If a user wants to flush the interface, they should explicitely use the dedicated function `tcflush(fd, TCIOFLUSH);`. --- bsps/shared/dev/serial/zynq-uart-polled.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bsps/shared/dev/serial/zynq-uart-polled.c b/bsps/shared/dev/serial/zynq-uart-polled.c index dbf75539f6..dbd61cb79b 100644 --- a/bsps/shared/dev/serial/zynq-uart-polled.c +++ b/bsps/shared/dev/serial/zynq-uart-polled.c @@ -151,12 +151,6 @@ void zynq_uart_initialize(volatile zynq_uart *regs) | ZYNQ_UART_MODE_PAR(ZYNQ_UART_MODE_PAR_NONE) | ZYNQ_UART_MODE_CHRL(ZYNQ_UART_MODE_CHRL_8) | mode_clks; - - while (zynq_uart_read_char_polled(regs) >= 0) { - /* Drop */ - } - - zynq_uart_reset_tx_flush(regs); } int zynq_uart_read_char_polled(volatile zynq_uart *regs)