qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] serial: Add interface to set reference oscillator frequency
@ 2009-10-31 10:28 Stefan Weil
  0 siblings, 0 replies; only message in thread
From: Stefan Weil @ 2009-10-31 10:28 UTC (permalink / raw)
  To: QEMU Developers

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 <weil@mail.berlios.de>
---
 hw/pc.h     |    1 +
 hw/serial.c |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/hw/pc.h b/hw/pc.h
index 15fff8d..03ffc91 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -13,6 +13,7 @@ SerialState *serial_mm_init (target_phys_addr_t base, int it_shift,
                              qemu_irq irq, int baudbase,
                              CharDriverState *chr, int ioregister);
 SerialState *serial_isa_init(int index, CharDriverState *chr);
+void serial_set_frequency(SerialState *s, uint32_t frequency);
 
 /* parallel.c */
 
diff --git a/hw/serial.c b/hw/serial.c
index 9353201..754727f 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -731,6 +731,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 };
 
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-31 10:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-31 10:28 [Qemu-devel] [PATCH] serial: Add interface to set reference oscillator frequency Stefan Weil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).