aboutsummaryrefslogtreecommitdiff
path: root/hw/char
diff options
context:
space:
mode:
authorBALATON Zoltan <balaton@eik.bme.hu>2021-10-29 23:02:09 +0200
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2021-10-30 18:39:37 +0200
commit017f77bbf75ef6c9b69188a150020013e6d5d8ad (patch)
tree7ab5a273bdac8c8e84941939146adbe29d1399b8 /hw/char
parent5b344b02e1813c6823e76ea981a56e7b432985a4 (diff)
hw/char/sh_serial: Split off sh_serial_reset() from sh_serial_init()
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <ffb46f2814794c8dfc2c5a0cf83086a7bd754e10.1635541329.git.balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'hw/char')
-rw-r--r--hw/char/sh_serial.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 5ee93dc732..80a548d19d 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -381,18 +381,8 @@ static const MemoryRegionOps sh_serial_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-void sh_serial_init(MemoryRegion *sysmem,
- hwaddr base, int feat,
- uint32_t freq, Chardev *chr,
- qemu_irq eri_source,
- qemu_irq rxi_source,
- qemu_irq txi_source,
- qemu_irq tei_source,
- qemu_irq bri_source)
+static void sh_serial_reset(SHSerialState *s)
{
- SHSerialState *s = g_malloc0(sizeof(*s));
-
- s->feat = feat;
s->flags = SH_SERIAL_FLAG_TEND | SH_SERIAL_FLAG_TDE;
s->rtrg = 1;
@@ -401,13 +391,28 @@ void sh_serial_init(MemoryRegion *sysmem,
s->scr = 1 << 5; /* pretend that TX is enabled so early printk works */
s->sptr = 0;
- if (feat & SH_SERIAL_FEAT_SCIF) {
+ if (s->feat & SH_SERIAL_FEAT_SCIF) {
s->fcr = 0;
} else {
s->dr = 0xff;
}
sh_serial_clear_fifo(s);
+}
+
+void sh_serial_init(MemoryRegion *sysmem,
+ hwaddr base, int feat,
+ uint32_t freq, Chardev *chr,
+ qemu_irq eri_source,
+ qemu_irq rxi_source,
+ qemu_irq txi_source,
+ qemu_irq tei_source,
+ qemu_irq bri_source)
+{
+ SHSerialState *s = g_malloc0(sizeof(*s));
+
+ s->feat = feat;
+ sh_serial_reset(s);
memory_region_init_io(&s->iomem, NULL, &sh_serial_ops, s,
"serial", 0x100000000ULL);