[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/35] next-cube: use named gpio to set RTC data bit in scr2
From: |
Thomas Huth |
Subject: |
[PULL 24/35] next-cube: use named gpio to set RTC data bit in scr2 |
Date: |
Sun, 29 Dec 2024 08:25:15 +0100 |
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This is in preparation for moving NeXTRTC to its own separate device.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Message-ID: <20241222130012.1013374-23-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Thomas Huth <huth@tuxfamily.org>
---
hw/m68k/next-cube.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index a39117144c..1e9e662b40 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -240,10 +240,13 @@ static void next_scr2_rtc_update(NeXTPC *s)
((scr2_2 & SCR2_RTDATA) ? 1 : 0);
} else {
/* Shift out value to read */
+ qemu_irq rtc_data_in_irq = qdev_get_gpio_in_named(
+ DEVICE(s), "pc-rtc-data-in", 0);
+
if (rtc->retval & (0x80 >> (rtc->phase - 8))) {
- scr2_2 |= SCR2_RTDATA;
+ qemu_irq_raise(rtc_data_in_irq);
} else {
- scr2_2 &= ~SCR2_RTDATA;
+ qemu_irq_lower(rtc_data_in_irq);
}
}
}
@@ -270,8 +273,6 @@ static void next_scr2_rtc_update(NeXTPC *s)
rtc->command = 0;
rtc->value = 0;
}
-
- s->scr2 = deposit32(s->scr2, 8, 8, scr2_2);
}
static uint64_t next_mmio_read(void *opaque, hwaddr addr, unsigned size)
@@ -1001,6 +1002,20 @@ static const MemoryRegionOps next_dummy_en_ops = {
.endianness = DEVICE_BIG_ENDIAN,
};
+static void next_pc_rtc_data_in_irq(void *opaque, int n, int level)
+{
+ NeXTPC *s = NEXT_PC(opaque);
+ uint8_t scr2_2 = extract32(s->scr2, 8, 8);
+
+ if (level) {
+ scr2_2 |= SCR2_RTDATA;
+ } else {
+ scr2_2 &= ~SCR2_RTDATA;
+ }
+
+ s->scr2 = deposit32(s->scr2, 8, 8, scr2_2);
+}
+
static void next_pc_reset_hold(Object *obj, ResetType type)
{
NeXTPC *s = NEXT_PC(obj);
@@ -1087,6 +1102,8 @@ static void next_pc_init(Object *obj)
sysbus_init_mmio(sbd, &s->timer_mem);
s->rtc_power_irq = qdev_get_gpio_in(DEVICE(obj), NEXT_PWR_I);
+ qdev_init_gpio_in_named(DEVICE(obj), next_pc_rtc_data_in_irq,
+ "pc-rtc-data-in", 1);
}
/*
--
2.47.1
- [PULL 14/35] next-cube: move timer MMIO to separate memory region on next-pc device, (continued)
- [PULL 14/35] next-cube: move timer MMIO to separate memory region on next-pc device, Thomas Huth, 2024/12/29
- [PULL 15/35] next-cube: move en ethernet MMIO to separate memory region on next-pc device, Thomas Huth, 2024/12/29
- [PULL 16/35] next-cube: add empty slots for unknown accesses to next.scr memory region, Thomas Huth, 2024/12/29
- [PULL 17/35] next-cube: remove unused next.scr memory region, Thomas Huth, 2024/12/29
- [PULL 25/35] next-cube: use named gpio to read RTC data bit in scr2, Thomas Huth, 2024/12/29
- [PULL 18/35] next-cube: rearrange NeXTState declarations to improve readability, Thomas Huth, 2024/12/29
- [PULL 19/35] next-cube: convert next-pc device to use Resettable interface, Thomas Huth, 2024/12/29
- [PULL 20/35] next-cube: rename typedef struct NextRtc to NeXTRTC, Thomas Huth, 2024/12/29
- [PULL 21/35] next-cube: use qemu_irq to drive int_status in next_scr2_rtc_update(), Thomas Huth, 2024/12/29
- [PULL 23/35] next-cube: always use retval to return rtc read values, Thomas Huth, 2024/12/29
- [PULL 24/35] next-cube: use named gpio to set RTC data bit in scr2,
Thomas Huth <=
- [PULL 30/35] next-cube: use named gpio output for next-rtc data, Thomas Huth, 2024/12/29
- [PULL 26/35] next-cube: don't use rtc phase value of -1, Thomas Huth, 2024/12/29
- [PULL 27/35] next-cube: QOMify NeXTRTC, Thomas Huth, 2024/12/29
- [PULL 29/35] next-cube: move rtc-data-in gpio from next-pc to next-rtc device, Thomas Huth, 2024/12/29
- [PULL 31/35] next-cube: add rtc-cmd-reset named gpio to reset the rtc state machine, Thomas Huth, 2024/12/29
- [PULL 32/35] next-cube: add rtc-power-out named gpio to trigger the NEXT_PWR_I interrupt, Thomas Huth, 2024/12/29
- [PULL 33/35] next-cube: move next_rtc_cmd_is_write() and next_rtc_data_in_irq() functions, Thomas Huth, 2024/12/29
- [PULL 22/35] next-cube: separate rtc read and write shift logic, Thomas Huth, 2024/12/29
- [PULL 35/35] next-cube: add my copyright to the top of the file, Thomas Huth, 2024/12/29
- [PULL 34/35] next-cube: rename old_scr2 and scr2_2 in next_scr2_rtc_update(), Thomas Huth, 2024/12/29