[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 22/33] next-cube: use named gpio to set RTC data bit in scr2
From: |
Mark Cave-Ayland |
Subject: |
[PATCH v3 22/33] next-cube: use named gpio to set RTC data bit in scr2 |
Date: |
Sun, 22 Dec 2024 13:00:01 +0000 |
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>
---
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 1fb09fee7d..bc3afa7d54 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.39.5
- [PATCH v3 14/33] next-cube: add empty slots for unknown accesses to next.scr memory region, (continued)
- [PATCH v3 14/33] next-cube: add empty slots for unknown accesses to next.scr memory region, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 06/33] next-cube: introduce next-scsi device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 11/33] next-cube: move ESCC to be QOM child of next-pc device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 13/33] next-cube: move en ethernet MMIO to separate memory region on next-pc device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 05/33] next-cube: introduce next_pc_init() object init function, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 08/33] next-cube: move SCSI 4020/4021 logic from next-pc device to next-scsi device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 12/33] next-cube: move timer MMIO to separate memory region on next-pc device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 15/33] next-cube: remove unused next.scr memory region, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 17/33] next-cube: convert next-pc device to use Resettable interface, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 20/33] next-cube: separate rtc read and write shift logic, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 22/33] next-cube: use named gpio to set RTC data bit in scr2,
Mark Cave-Ayland <=
- [PATCH v3 29/33] next-cube: add rtc-cmd-reset named gpio to reset the rtc state machine, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 32/33] next-cube: rename old_scr2 and scr2_2 in next_scr2_rtc_update(), Mark Cave-Ayland, 2024/12/22
- [PATCH v3 19/33] next-cube: use qemu_irq to drive int_status in next_scr2_rtc_update(), Mark Cave-Ayland, 2024/12/22
- [PATCH v3 30/33] next-cube: add rtc-power-out named gpio to trigger the NEXT_PWR_I interrupt, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 10/33] next-cube: map ESCC registers as a subregion of the next.scr memory region, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 09/33] next-cube: move floppy disk MMIO to separate memory region in next-pc, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 16/33] next-cube: rearrange NeXTState declarations to improve readability, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 23/33] next-cube: use named gpio to read RTC data bit in scr2, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 24/33] next-cube: don't use rtc phase value of -1, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 27/33] next-cube: move rtc-data-in gpio from next-pc to next-rtc device, Mark Cave-Ayland, 2024/12/22