Set udre flag when (re)enabling uart transmitter.
authorbsekisser <squirmyworms@embarqmail.com>
Sat, 10 Oct 2020 21:40:59 +0000 (17:40 -0400)
committerbsekisser <squirmyworms@embarqmail.com>
Sat, 10 Oct 2020 22:18:53 +0000 (18:18 -0400)
modified:   sim/avr_uart.c

Previously, disabling the uart transmitter cleared the udrc
interrupt and cleared the udre (udrc.raised) flag.  Upon
reenabling the transmitter, the udre flag is still clear
signifying the buffer is full, thus waiting for the udr to
clear via udre flag hangs.

simavr/sim/avr_uart.c

index 4e3db86..5594170 100644 (file)
@@ -405,6 +405,8 @@ avr_uart_write(
        if (new_txen != txen) {
                if (p->udrc.vector && !new_txen) {
                        avr_uart_clear_interrupt(avr, &p->udrc);
+               } else {
+                       avr_regbit_set(avr, p->udrc.raised);
                }
        }
 }