mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
hw/char/imx_serial: Really use RX FIFO depth
While we model a 32-elements RX FIFO since the IMX serial
model was introduced in commit 988f244297
("hw/char/imx_serial:
Implement receive FIFO and ageing timer") 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>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20250220092903.3726-7-philmd@linaro.org>
This commit is contained in:
parent
2e6b2e0875
commit
91f8c04dd2
1 changed files with 6 additions and 2 deletions
|
@ -386,7 +386,8 @@ static void imx_serial_write(void *opaque, hwaddr offset,
|
|||
static int imx_can_receive(void *opaque)
|
||||
{
|
||||
IMXSerialState *s = (IMXSerialState *)opaque;
|
||||
return s->ucr2 & UCR2_RXEN && fifo32_num_used(&s->rx_fifo) < FIFO_SIZE;
|
||||
|
||||
return s->ucr2 & UCR2_RXEN ? fifo32_num_free(&s->rx_fifo) : 0;
|
||||
}
|
||||
|
||||
static void imx_put_data(void *opaque, uint32_t value)
|
||||
|
@ -417,7 +418,10 @@ static void imx_receive(void *opaque, const uint8_t *buf, int size)
|
|||
IMXSerialState *s = (IMXSerialState *)opaque;
|
||||
|
||||
s->usr2 |= USR2_WAKE;
|
||||
imx_put_data(opaque, *buf);
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
imx_put_data(opaque, buf[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void imx_event(void *opaque, QEMUChrEvent event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue