From 17de3d578710368381b897654e1b7b77f43be875 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Mon, 30 Aug 2021 11:24:36 +0100 Subject: mac_via: introduce new VMStateDescription for q800 VIA1 and VIA2 Move the parent mos6522 objects from vmstate_mac_via into the new VMStateDescription structures to begin the process of splitting MacVIAState into separate VIA1 and VIA2 devices. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20210830102447.10806-2-mark.cave-ayland@ilande.co.uk> Signed-off-by: Laurent Vivier --- hw/misc/mac_via.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'hw') diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c index ff0156db76..46e65058e0 100644 --- a/hw/misc/mac_via.c +++ b/hw/misc/mac_via.c @@ -1083,16 +1083,12 @@ static const VMStateDescription vmstate_mac_via = { .post_load = mac_via_post_load, .fields = (VMStateField[]) { /* VIAs */ - VMSTATE_STRUCT(mos6522_via1.parent_obj, MacVIAState, 0, vmstate_mos6522, - MOS6522State), VMSTATE_UINT8(mos6522_via1.last_b, MacVIAState), VMSTATE_BUFFER(mos6522_via1.PRAM, MacVIAState), VMSTATE_TIMER_PTR(mos6522_via1.one_second_timer, MacVIAState), VMSTATE_INT64(mos6522_via1.next_second, MacVIAState), VMSTATE_TIMER_PTR(mos6522_via1.sixty_hz_timer, MacVIAState), VMSTATE_INT64(mos6522_via1.next_sixty_hz, MacVIAState), - VMSTATE_STRUCT(mos6522_via2.parent_obj, MacVIAState, 0, vmstate_mos6522, - MOS6522State), /* RTC */ VMSTATE_UINT32(tick_offset, MacVIAState), VMSTATE_UINT8(data_out, MacVIAState), @@ -1156,11 +1152,23 @@ static void mos6522_q800_via1_init(Object *obj) VIA1_IRQ_NB); } +static const VMStateDescription vmstate_q800_via1 = { + .name = "q800-via1", + .version_id = 0, + .minimum_version_id = 0, + .fields = (VMStateField[]) { + VMSTATE_STRUCT(parent_obj, MOS6522Q800VIA1State, 0, vmstate_mos6522, + MOS6522State), + VMSTATE_END_OF_LIST() + } +}; + static void mos6522_q800_via1_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->reset = mos6522_q800_via1_reset; + dc->vmsd = &vmstate_q800_via1; } static const TypeInfo mos6522_q800_via1_type_info = { @@ -1200,12 +1208,24 @@ static void mos6522_q800_via2_init(Object *obj) VIA2_IRQ_NB); } +static const VMStateDescription vmstate_q800_via2 = { + .name = "q800-via2", + .version_id = 0, + .minimum_version_id = 0, + .fields = (VMStateField[]) { + VMSTATE_STRUCT(parent_obj, MOS6522Q800VIA2State, 0, vmstate_mos6522, + MOS6522State), + VMSTATE_END_OF_LIST() + } +}; + static void mos6522_q800_via2_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); MOS6522DeviceClass *mdc = MOS6522_CLASS(oc); dc->reset = mos6522_q800_via2_reset; + dc->vmsd = &vmstate_q800_via2; mdc->portB_write = mos6522_q800_via2_portB_write; } -- cgit v1.2.3