mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
hw/char/stm32l4x5_usart.c: Enable USART ACK bit response
SW modifying USART_CR1 TE bit should cuase HW to respond by altering
USART_ISR TEACK bit, and likewise for RE and REACK bit.
This resolves some but not all issues necessary for the official STM USART
HAL driver to function as is.
Fixes: 87b77e6e01
("hw/char/stm32l4x5_usart: Enable serial read and write")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2540
Signed-off-by: Jacob Abrams <satur9nine@gmail.com>
Message-id: 20240911043255.51966-1-satur9nine@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
f21b07e272
commit
6cce0dcc6f
2 changed files with 51 additions and 1 deletions
|
@ -154,6 +154,21 @@ REG32(RDR, 0x24)
|
|||
REG32(TDR, 0x28)
|
||||
FIELD(TDR, TDR, 0, 9)
|
||||
|
||||
static void stm32l4x5_update_isr(Stm32l4x5UsartBaseState *s)
|
||||
{
|
||||
if (s->cr1 & R_CR1_TE_MASK) {
|
||||
s->isr |= R_ISR_TEACK_MASK;
|
||||
} else {
|
||||
s->isr &= ~R_ISR_TEACK_MASK;
|
||||
}
|
||||
|
||||
if (s->cr1 & R_CR1_RE_MASK) {
|
||||
s->isr |= R_ISR_REACK_MASK;
|
||||
} else {
|
||||
s->isr &= ~R_ISR_REACK_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
static void stm32l4x5_update_irq(Stm32l4x5UsartBaseState *s)
|
||||
{
|
||||
if (((s->isr & R_ISR_WUF_MASK) && (s->cr3 & R_CR3_WUFIE_MASK)) ||
|
||||
|
@ -456,6 +471,7 @@ static void stm32l4x5_usart_base_write(void *opaque, hwaddr addr,
|
|||
case A_CR1:
|
||||
s->cr1 = value;
|
||||
stm32l4x5_update_params(s);
|
||||
stm32l4x5_update_isr(s);
|
||||
stm32l4x5_update_irq(s);
|
||||
return;
|
||||
case A_CR2:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue