From 038eaf82c853f3bf8d4c106c0677bbf4adada7de Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 31 Oct 2009 11:28:11 +0100 Subject: serial: Add interface to set reference oscillator frequency Many (most?) serial interfaces have a programmable clock which provides the reference frequency ("baudbase"). So a fixed baudbase which is only set once can be wrong. omap1.c is an example which could use the new interface to change baudbase when the programmable clock changes. ar7 system emulation (still not part of standard QEMU) is similar to omap and already uses serial_set_frequency. Signed-off-by: Stefan Weil Signed-off-by: Anthony Liguori --- hw/serial.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'hw/serial.c') diff --git a/hw/serial.c b/hw/serial.c index fa12dcc075..0063260569 100644 --- a/hw/serial.c +++ b/hw/serial.c @@ -730,6 +730,13 @@ static void serial_init_core(SerialState *s) serial_event, s); } +/* Change the main reference oscillator frequency. */ +void serial_set_frequency(SerialState *s, uint32_t frequency) +{ + s->baudbase = frequency; + serial_update_parameters(s); +} + static const int isa_serial_io[MAX_SERIAL_PORTS] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; static const int isa_serial_irq[MAX_SERIAL_PORTS] = { 4, 3, 4, 3 }; -- cgit v1.2.1