diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-08-26 18:00:36 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-08-26 18:00:36 +0000 |
commit | 508d92d0573319d7dbd827f6216aec44c1421832 (patch) | |
tree | af764c72da711385a3bb5941970af1392aaa2f5b | |
parent | 64f5a135a7fee4e95efa08861698373b30a23bb0 (diff) |
16 bit divider
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2138 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | hw/serial.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/hw/serial.c b/hw/serial.c index f36beb209f..16dbc65c37 100644 --- a/hw/serial.c +++ b/hw/serial.c @@ -71,7 +71,7 @@ #define UART_LSR_DR 0x01 /* Receiver data ready */ struct SerialState { - uint8_t divider; + uint16_t divider; uint8_t rbr; /* receive register */ uint8_t ier; uint8_t iir; /* read only */ @@ -310,7 +310,7 @@ static void serial_save(QEMUFile *f, void *opaque) { SerialState *s = opaque; - qemu_put_8s(f,&s->divider); + qemu_put_be16s(f,&s->divider); qemu_put_8s(f,&s->rbr); qemu_put_8s(f,&s->ier); qemu_put_8s(f,&s->iir); @@ -325,10 +325,13 @@ static int serial_load(QEMUFile *f, void *opaque, int version_id) { SerialState *s = opaque; - if(version_id != 1) + if(version_id > 2) return -EINVAL; - qemu_get_8s(f,&s->divider); + if (version_id >= 2) + qemu_get_be16s(f, &s->divider); + else + s->divider = qemu_get_byte(f); qemu_get_8s(f,&s->rbr); qemu_get_8s(f,&s->ier); qemu_get_8s(f,&s->iir); @@ -357,7 +360,7 @@ SerialState *serial_init(SetIRQFunc *set_irq, void *opaque, s->iir = UART_IIR_NO_INT; s->msr = UART_MSR_DCD | UART_MSR_DSR | UART_MSR_CTS; - register_savevm("serial", base, 1, serial_save, serial_load, s); + register_savevm("serial", base, 2, serial_save, serial_load, s); register_ioport_write(base, 8, 1, serial_ioport_write, s); register_ioport_read(base, 8, 1, serial_ioport_read, s); @@ -444,7 +447,7 @@ SerialState *serial_mm_init (SetIRQFunc *set_irq, void *opaque, s->base = base; s->it_shift = it_shift; - register_savevm("serial", base, 1, serial_save, serial_load, s); + register_savevm("serial", base, 2, serial_save, serial_load, s); s_io_memory = cpu_register_io_memory(0, serial_mm_read, serial_mm_write, s); |