mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
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 <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>
This commit is contained in:
parent
bbcaced2bf
commit
ccbc8fa3f9
1 changed files with 21 additions and 4 deletions
|
@ -240,10 +240,13 @@ static void next_scr2_rtc_update(NeXTPC *s)
|
||||||
((scr2_2 & SCR2_RTDATA) ? 1 : 0);
|
((scr2_2 & SCR2_RTDATA) ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
/* Shift out value to read */
|
/* 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))) {
|
if (rtc->retval & (0x80 >> (rtc->phase - 8))) {
|
||||||
scr2_2 |= SCR2_RTDATA;
|
qemu_irq_raise(rtc_data_in_irq);
|
||||||
} else {
|
} 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->command = 0;
|
||||||
rtc->value = 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)
|
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,
|
.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)
|
static void next_pc_reset_hold(Object *obj, ResetType type)
|
||||||
{
|
{
|
||||||
NeXTPC *s = NEXT_PC(obj);
|
NeXTPC *s = NEXT_PC(obj);
|
||||||
|
@ -1087,6 +1102,8 @@ static void next_pc_init(Object *obj)
|
||||||
sysbus_init_mmio(sbd, &s->timer_mem);
|
sysbus_init_mmio(sbd, &s->timer_mem);
|
||||||
|
|
||||||
s->rtc_power_irq = qdev_get_gpio_in(DEVICE(obj), NEXT_PWR_I);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue