diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2018-06-07 18:17:50 +0100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-06-12 10:44:36 +1000 |
commit | d638fd5c9681dbb8915147365520888c64f39dac (patch) | |
tree | 08421b576eacc0e20b1e839eb72952d1754a7b55 /hw/misc/macio | |
parent | 2e3e5c7e92452900e2bb5143c5fb6d47c0897a34 (diff) |
mos6522: move timer frequency initialisation to mos6522_reset
The 6522 VIA timer frequency cannot be set by altering registers within the
device itself and hence it is a fixed property of the machine.
Move the initialisation of the timer frequency to the mos6522 reset function
and ensure that any subclasses always call the parent reset function so that
it isn't required to store the timer frequency within vmstate_mos6522_timer
itself.
By moving the frequency initialisation to the device reset function then we
find that the realize function for both mos6522 and mos6522_cuda becomes
obsolete and can simply be removed.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/misc/macio')
-rw-r--r-- | hw/misc/macio/cuda.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c index 8aba2e63ec..9651ed9744 100644 --- a/hw/misc/macio/cuda.c +++ b/hw/misc/macio/cuda.c @@ -597,12 +597,12 @@ static void mos6522_cuda_portB_write(MOS6522State *s) cuda_update(cs); } -static void mos6522_cuda_realize(DeviceState *dev, Error **errp) +static void mos6522_cuda_reset(DeviceState *dev) { MOS6522State *ms = MOS6522(dev); MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(ms); - mdc->parent_realize(dev, errp); + mdc->parent_reset(dev); ms->timers[0].frequency = CUDA_TIMER_FREQ; ms->timers[1].frequency = (SCALE_US * 6000) / 4700; @@ -613,7 +613,7 @@ static void mos6522_cuda_class_init(ObjectClass *oc, void *data) DeviceClass *dc = DEVICE_CLASS(oc); MOS6522DeviceClass *mdc = MOS6522_DEVICE_CLASS(oc); - dc->realize = mos6522_cuda_realize; + dc->reset = mos6522_cuda_reset; mdc->portB_write = mos6522_cuda_portB_write; mdc->get_timer1_counter_value = cuda_get_counter_value; mdc->get_timer2_counter_value = cuda_get_counter_value; |