Skip to content

Commit ccbc8fa

Browse files
mcaylandhuth
authored andcommitted
next-cube: use named gpio to set RTC data bit in scr2
This is in preparation for moving NeXTRTC to its own separate device. Signed-off-by: Mark Cave-Ayland <[email protected]> Reviewed-by: Thomas Huth <[email protected]> Message-ID: <[email protected]> Signed-off-by: Thomas Huth <[email protected]>
1 parent bbcaced commit ccbc8fa

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

hw/m68k/next-cube.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,13 @@ static void next_scr2_rtc_update(NeXTPC *s)
240240
((scr2_2 & SCR2_RTDATA) ? 1 : 0);
241241
} else {
242242
/* Shift out value to read */
243+
qemu_irq rtc_data_in_irq = qdev_get_gpio_in_named(
244+
DEVICE(s), "pc-rtc-data-in", 0);
245+
243246
if (rtc->retval & (0x80 >> (rtc->phase - 8))) {
244-
scr2_2 |= SCR2_RTDATA;
247+
qemu_irq_raise(rtc_data_in_irq);
245248
} else {
246-
scr2_2 &= ~SCR2_RTDATA;
249+
qemu_irq_lower(rtc_data_in_irq);
247250
}
248251
}
249252
}
@@ -270,8 +273,6 @@ static void next_scr2_rtc_update(NeXTPC *s)
270273
rtc->command = 0;
271274
rtc->value = 0;
272275
}
273-
274-
s->scr2 = deposit32(s->scr2, 8, 8, scr2_2);
275276
}
276277

277278
static uint64_t next_mmio_read(void *opaque, hwaddr addr, unsigned size)
@@ -1001,6 +1002,20 @@ static const MemoryRegionOps next_dummy_en_ops = {
10011002
.endianness = DEVICE_BIG_ENDIAN,
10021003
};
10031004

1005+
static void next_pc_rtc_data_in_irq(void *opaque, int n, int level)
1006+
{
1007+
NeXTPC *s = NEXT_PC(opaque);
1008+
uint8_t scr2_2 = extract32(s->scr2, 8, 8);
1009+
1010+
if (level) {
1011+
scr2_2 |= SCR2_RTDATA;
1012+
} else {
1013+
scr2_2 &= ~SCR2_RTDATA;
1014+
}
1015+
1016+
s->scr2 = deposit32(s->scr2, 8, 8, scr2_2);
1017+
}
1018+
10041019
static void next_pc_reset_hold(Object *obj, ResetType type)
10051020
{
10061021
NeXTPC *s = NEXT_PC(obj);
@@ -1087,6 +1102,8 @@ static void next_pc_init(Object *obj)
10871102
sysbus_init_mmio(sbd, &s->timer_mem);
10881103

10891104
s->rtc_power_irq = qdev_get_gpio_in(DEVICE(obj), NEXT_PWR_I);
1105+
qdev_init_gpio_in_named(DEVICE(obj), next_pc_rtc_data_in_irq,
1106+
"pc-rtc-data-in", 1);
10901107
}
10911108

10921109
/*

0 commit comments

Comments
 (0)