[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 12/30] hw/char/sh_serial: Split off sh_serial_reset() from sh_
From: |
BALATON Zoltan |
Subject: |
[PATCH v6 12/30] hw/char/sh_serial: Split off sh_serial_reset() from sh_serial_init() |
Date: |
Fri, 29 Oct 2021 23:02:09 +0200 |
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/char/sh_serial.c | 29 +++++++++++++++++------------
1 file 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);
--
2.21.4
- [PATCH v6 00/30] More SH4 clean ups (including code style series), BALATON Zoltan, 2021/10/29
- [PATCH v6 04/30] hw/sh4: Coding style: Add missing braces, BALATON Zoltan, 2021/10/29
- [PATCH v6 05/30] hw/sh4: Coding style: Remove unnecessary casts, BALATON Zoltan, 2021/10/29
- [PATCH v6 08/30] hw/sh4/r2d: Use error_report instead of fprintf to stderr, BALATON Zoltan, 2021/10/29
- [PATCH v6 09/30] hw/char/sh_serial: Do not abort on invalid access, BALATON Zoltan, 2021/10/29
- [PATCH v6 12/30] hw/char/sh_serial: Split off sh_serial_reset() from sh_serial_init(),
BALATON Zoltan <=
- [PATCH v6 07/30] hw/sh4: Change debug printfs to traces, BALATON Zoltan, 2021/10/29
- [PATCH v6 10/30] hw/char/sh_serial: Rename type sh_serial_state to SHSerialState, BALATON Zoltan, 2021/10/29
- [PATCH v6 06/30] hw/sh4: Fix typos in a comment, BALATON Zoltan, 2021/10/29
- [PATCH v6 01/30] hw/sh4: Coding style: Remove tabs, BALATON Zoltan, 2021/10/29
- [PATCH v6 02/30] hw/sh4: Coding style: Fix multi-line comments, BALATON Zoltan, 2021/10/29
- [PATCH v6 11/30] hw/char/sh_serial: Embed QEMUTimer in state struct, BALATON Zoltan, 2021/10/29
- [PATCH v6 13/30] hw/char/sh_serial: QOM-ify, BALATON Zoltan, 2021/10/29