Skip to content

Commit

Permalink
litex-uart: Error checking of qemu_chr_fe_write_all
Browse files Browse the repository at this point in the history
  • Loading branch information
mithro committed Apr 16, 2017
1 parent 13cc615 commit f8521ea
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions hw/char/litex-uart.c
Expand Up @@ -211,10 +211,18 @@ static void uart_write(void *opaque, hwaddr addr, uint64_t value, unsigned size)

switch(addr)
{
case CSR_UART_RXTX_ADDR:
qemu_chr_fe_write_all(&s->chr, &ch, 1);
case CSR_UART_RXTX_ADDR: {
int r = 0;
do {
r = qemu_chr_fe_write_all(&s->chr, &ch, 1);
if (r != 1 && r != 0)
printf("litex-uart: qemu_chr_fe_write_all: %d\n", r);
} while (
r != 1 && // One character written.
r != 0 // No console attached.
);
break;

}
case CSR_UART_EV_ENABLE_ADDR:
s->regs[addr] = ch;
DPRINTF("litex-uart: setting EN %x (pen:%x)\n",
Expand Down

0 comments on commit f8521ea

Please sign in to comment.