diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-06-20 12:58:36 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-06-20 12:58:36 +0000 |
commit | d7d02e3c3a50782c0fa6b17d16f9957f1cc82a65 (patch) | |
tree | f07209fb39574448a87f576dfaefb655568d1c86 /hw/i8254.c | |
parent | bb0c6722b6606ad34da75d093d95a9bdfe42bc98 (diff) |
new reset API
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@938 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/i8254.c')
-rw-r--r-- | hw/i8254.c | 24 |
1 files changed, 17 insertions, 7 deletions
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; } |