[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 28/33] next-cube: use named gpio output for next-rtc data
From: |
Mark Cave-Ayland |
Subject: |
[PATCH v3 28/33] next-cube: use named gpio output for next-rtc data |
Date: |
Sun, 22 Dec 2024 13:00:07 +0000 |
Add a named gpio output for the next-rtc data and then update
next_rtc_data_in_irq() to drive the IRQ directly. This enables the next-rtc to
next-pc data to be wired up using the standard qdev gpio APIs.
At the same time rename the pc-rtc-data-in gpio to rtc-data-in which is possible
now that the previous rtc-data-in gpio has been moved to the next-rtc device.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/m68k/next-cube.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index 83154a3661..8edf51198e 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -56,6 +56,8 @@ struct NeXTRTC {
uint8_t status;
uint8_t control;
uint8_t retval;
+
+ qemu_irq data_out_irq;
};
#define TYPE_NEXT_SCSI "next-scsi"
@@ -234,13 +236,10 @@ static void next_rtc_data_in_irq(void *opaque, int n, int
level)
rtc->value = (rtc->value << 1) | level;
} 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))) {
- qemu_irq_raise(rtc_data_in_irq);
+ qemu_irq_raise(rtc->data_out_irq);
} else {
- qemu_irq_lower(rtc_data_in_irq);
+ qemu_irq_lower(rtc->data_out_irq);
}
}
}
@@ -1028,8 +1027,12 @@ static void next_rtc_reset_hold(Object *obj, ResetType
type)
static void next_rtc_init(Object *obj)
{
+ NeXTRTC *rtc = NEXT_RTC(obj);
+
qdev_init_gpio_in_named(DEVICE(obj), next_rtc_data_in_irq,
"rtc-data-in", 1);
+ qdev_init_gpio_out_named(DEVICE(obj), &rtc->data_out_irq,
+ "rtc-data-out", 1);
}
static const VMStateDescription next_rtc_vmstate = {
@@ -1136,6 +1139,10 @@ static void next_pc_realize(DeviceState *dev, Error
**errp)
/* Data from NeXTPC to RTC */
qdev_connect_gpio_out_named(dev, "rtc-data-out", 0,
qdev_get_gpio_in_named(d, "rtc-data-in", 0));
+ /* Data from RTC to NeXTPC */
+ qdev_connect_gpio_out_named(d, "rtc-data-out", 0,
+ qdev_get_gpio_in_named(dev,
+ "rtc-data-in", 0));
}
static void next_pc_init(Object *obj)
@@ -1173,7 +1180,7 @@ static void next_pc_init(Object *obj)
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);
+ "rtc-data-in", 1);
qdev_init_gpio_out_named(DEVICE(obj), &s->rtc_data_irq,
"rtc-data-out", 1);
}
--
2.39.5
- [PATCH v3 29/33] next-cube: add rtc-cmd-reset named gpio to reset the rtc state machine, (continued)
- [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
- [PATCH v3 28/33] next-cube: use named gpio output for next-rtc data,
Mark Cave-Ayland <=
- [PATCH v3 31/33] next-cube: move next_rtc_cmd_is_write() and next_rtc_data_in_irq() functions, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 25/33] next-cube: QOMify NeXTRTC, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 33/33] next-cube: add my copyright to the top of the file, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 07/33] next-cube: move SCSI CSRs from next-pc to the next-scsi device, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 18/33] next-cube: rename typedef struct NextRtc to NeXTRTC, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 21/33] next-cube: always use retval to return rtc read values, Mark Cave-Ayland, 2024/12/22
- [PATCH v3 26/33] next-cube: move reset of next-rtc fields from next-pc to next-rtc, Mark Cave-Ayland, 2024/12/22
- Re: [PATCH v3 00/33] next-cube: more tidy-ups and improvements, Thomas Huth, 2024/12/29