diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-02-19 16:25:17 +0100 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-03-04 14:45:34 +0100 |
commit | 3ca8af5445b493ae3bc1520c71de3fd7e4555af4 (patch) | |
tree | 919b4f9848494e0d0b440f01328c11ab28ee2ad1 /hw/char | |
parent | 3d978e7b9b25913620d57eb73256f395ab1c18a0 (diff) | |
download | qemu-3ca8af5445b493ae3bc1520c71de3fd7e4555af4.zip qemu-3ca8af5445b493ae3bc1520c71de3fd7e4555af4.tar.gz qemu-3ca8af5445b493ae3bc1520c71de3fd7e4555af4.tar.bz2 |
hw/char/mcf_uart: Really use RX FIFO depth
While we model a 4-elements RX FIFO since the MCF UART model
was introduced in commit 20dcee94833 ("MCF5208 emulation"),
we only read 1 char at a time!
Have the IOCanReadHandler handler return how many elements are
available, and use that in the IOReadHandler handler.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Luc Michel <luc.michel@amd.com>
Tested-by: Thomas Huth <huth@tuxfamily.org>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250220092903.3726-9-philmd@linaro.org>
Diffstat (limited to 'hw/char')
-rw-r--r-- | hw/char/mcf_uart.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c index 95f269e..529c26b 100644 --- a/hw/char/mcf_uart.c +++ b/hw/char/mcf_uart.c @@ -281,14 +281,16 @@ static int mcf_uart_can_receive(void *opaque) { mcf_uart_state *s = (mcf_uart_state *)opaque; - return s->rx_enabled && (s->sr & MCF_UART_FFULL) == 0; + return s->rx_enabled ? FIFO_DEPTH - s->fifo_len : 0; } static void mcf_uart_receive(void *opaque, const uint8_t *buf, int size) { mcf_uart_state *s = (mcf_uart_state *)opaque; - mcf_uart_push_byte(s, buf[0]); + for (int i = 0; i < size; i++) { + mcf_uart_push_byte(s, buf[i]); + } } static const MemoryRegionOps mcf_uart_ops = { |