From d7d02e3c3a50782c0fa6b17d16f9957f1cc82a65 Mon Sep 17 00:00:00 2001 From: bellard Date: Sun, 20 Jun 2004 12:58:36 +0000 Subject: new reset API git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@938 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/i8254.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'hw/i8254.c') diff --git a/hw/i8254.c b/hw/i8254.c index 1eb4a1860f..6f05168274 100644 --- a/hw/i8254.c +++ b/hw/i8254.c @@ -434,27 +434,37 @@ static int pit_load(QEMUFile *f, void *opaque, int version_id) return 0; } -PITState *pit_init(int base, int irq) +static void pit_reset(void *opaque) { - PITState *pit = &pit_state; + PITState *pit = opaque; PITChannelState *s; int i; for(i = 0;i < 3; i++) { s = &pit->channels[i]; - if (i == 0) { - /* the timer 0 is connected to an IRQ */ - s->irq_timer = qemu_new_timer(vm_clock, pit_irq_timer, s); - s->irq = irq; - } s->mode = 3; s->gate = (i != 2); pit_load_count(s, 0); } +} + +PITState *pit_init(int base, int irq) +{ + PITState *pit = &pit_state; + PITChannelState *s; + + s = &pit->channels[0]; + /* the timer 0 is connected to an IRQ */ + s->irq_timer = qemu_new_timer(vm_clock, pit_irq_timer, s); + s->irq = irq; register_savevm("i8254", base, 1, pit_save, pit_load, pit); + qemu_register_reset(pit_reset, pit); register_ioport_write(base, 4, 1, pit_ioport_write, pit); register_ioport_read(base, 3, 1, pit_ioport_read, pit); + + pit_reset(pit); + return pit; } -- cgit v1.2.3