mac_via: add qdev gpios for nubus slot interrupts to VIA2
These will soon be required to enable nubus devices to support interrupts. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20210830102447.10806-13-mark.cave-ayland@ilande.co.uk> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
812f06995b
commit
dde602ae53
@ -1123,6 +1123,26 @@ static void mos6522_q800_via2_reset(DeviceState *dev)
|
||||
|
||||
ms->dirb = 0;
|
||||
ms->b = 0;
|
||||
ms->dira = 0;
|
||||
ms->a = 0x7f;
|
||||
}
|
||||
|
||||
static void via2_nubus_irq_request(void *opaque, int irq, int level)
|
||||
{
|
||||
MOS6522Q800VIA2State *v2s = opaque;
|
||||
MOS6522State *s = MOS6522(v2s);
|
||||
MOS6522DeviceClass *mdc = MOS6522_GET_CLASS(s);
|
||||
|
||||
if (level) {
|
||||
/* Port A nubus IRQ inputs are active LOW */
|
||||
s->a &= ~(1 << irq);
|
||||
s->ifr |= 1 << VIA2_IRQ_NUBUS_BIT;
|
||||
} else {
|
||||
s->a |= (1 << irq);
|
||||
s->ifr &= ~(1 << VIA2_IRQ_NUBUS_BIT);
|
||||
}
|
||||
|
||||
mdc->update_irq(s);
|
||||
}
|
||||
|
||||
static void mos6522_q800_via2_init(Object *obj)
|
||||
@ -1135,6 +1155,9 @@ static void mos6522_q800_via2_init(Object *obj)
|
||||
sysbus_init_mmio(sbd, &v2s->via_mem);
|
||||
|
||||
qdev_init_gpio_in(DEVICE(obj), via2_irq_request, VIA2_IRQ_NB);
|
||||
|
||||
qdev_init_gpio_in_named(DEVICE(obj), via2_nubus_irq_request, "nubus-irq",
|
||||
VIA2_NUBUS_IRQ_NB);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_q800_via2 = {
|
||||
|
@ -93,6 +93,16 @@ struct MOS6522Q800VIA1State {
|
||||
#define VIA2_IRQ_SCSI (1 << VIA2_IRQ_UNUSED_BIT)
|
||||
#define VIA2_IRQ_ASC (1 << VIA2_IRQ_ASC_BIT)
|
||||
|
||||
#define VIA2_NUBUS_IRQ_NB 7
|
||||
|
||||
#define VIA2_NUBUS_IRQ_9 0
|
||||
#define VIA2_NUBUS_IRQ_A 1
|
||||
#define VIA2_NUBUS_IRQ_B 2
|
||||
#define VIA2_NUBUS_IRQ_C 3
|
||||
#define VIA2_NUBUS_IRQ_D 4
|
||||
#define VIA2_NUBUS_IRQ_E 5
|
||||
#define VIA2_NUBUS_IRQ_INTVIDEO 6
|
||||
|
||||
#define TYPE_MOS6522_Q800_VIA2 "mos6522-q800-via2"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(MOS6522Q800VIA2State, MOS6522_Q800_VIA2)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user