aboutsummaryrefslogtreecommitdiff
path: root/hw/char/sh_serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/char/sh_serial.c')
-rw-r--r--hw/char/sh_serial.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 97ce5629a4..c8b91bbaa2 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -29,6 +29,7 @@
#include "hw/sh4/sh.h"
#include "sysemu/char.h"
#include "exec/address-spaces.h"
+#include "qapi/error.h"
//#define DEBUG_SERIAL
@@ -62,7 +63,7 @@ typedef struct {
int flags;
int rtrg;
- CharDriverState *chr;
+ CharBackend chr;
qemu_irq eri;
qemu_irq rxi;
@@ -109,11 +110,11 @@ static void sh_serial_write(void *opaque, hwaddr offs,
}
return;
case 0x0c: /* FTDR / TDR */
- if (s->chr) {
+ if (s->chr.chr) {
ch = val;
/* XXX this blocks entire thread. Rewrite to use
* qemu_chr_fe_write and background I/O callbacks */
- qemu_chr_fe_write_all(s->chr, &ch, 1);
+ qemu_chr_fe_write_all(s->chr.chr, &ch, 1);
}
s->dr = val;
s->flags &= ~SH_SERIAL_FLAG_TDE;
@@ -395,10 +396,9 @@ void sh_serial_init(MemoryRegion *sysmem,
0, 0x28);
memory_region_add_subregion(sysmem, A7ADDR(base), &s->iomem_a7);
- s->chr = chr;
-
if (chr) {
qemu_chr_fe_claim_no_fail(chr);
+ qemu_chr_fe_init(&s->chr, chr, &error_abort);
qemu_chr_add_handlers(chr, sh_serial_can_receive1, sh_serial_receive1,
sh_serial_event, s);
}