aboutsummaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-18 14:08:04 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-18 14:08:04 +0000
commitceecf1d158d324c61a7ec1ba5de57dbc8a0f8373 (patch)
treebb58577711ef3fedae6ebbe731ac4da7f2d85bde /hw
parent9c554c1c0b01642c39232489cef8301a7858824d (diff)
add an init function parameter to qemu_chr_open()
And use it for the malta emulation. Fix segfault introduced in revision 6352. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6365 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r--hw/mips_malta.c35
-rw-r--r--hw/omap1.c4
-rw-r--r--hw/omap2.c2
-rw-r--r--hw/usb-serial.c2
4 files changed, 25 insertions, 18 deletions
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index 42f77f1ee..42169bf32 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -418,7 +418,24 @@ static void malta_fpga_reset(void *opaque)
s->display_text[8] = '\0';
snprintf(s->display_text, 9, " ");
- malta_fpga_update_display(s);
+}
+
+static void malta_fpga_uart_init(CharDriverState *chr)
+{
+ qemu_chr_printf(chr, "CBUS UART\r\n");
+}
+
+static void malta_fpga_led_init(CharDriverState *chr)
+{
+ qemu_chr_printf(chr, "\e[HMalta LEDBAR\r\n");
+ qemu_chr_printf(chr, "+--------+\r\n");
+ qemu_chr_printf(chr, "+ +\r\n");
+ qemu_chr_printf(chr, "+--------+\r\n");
+ qemu_chr_printf(chr, "\n");
+ qemu_chr_printf(chr, "Malta ASCII\r\n");
+ qemu_chr_printf(chr, "+--------+\r\n");
+ qemu_chr_printf(chr, "+ +\r\n");
+ qemu_chr_printf(chr, "+--------+\r\n");
}
static MaltaFPGAState *malta_fpga_init(target_phys_addr_t base, CPUState *env)
@@ -436,19 +453,9 @@ static MaltaFPGAState *malta_fpga_init(target_phys_addr_t base, CPUState *env)
/* 0xa00 is less than a page, so will still get the right offsets. */
cpu_register_physical_memory(base + 0xa00, 0x100000 - 0xa00, malta);
- s->display = qemu_chr_open("fpga", "vc:320x200");
- qemu_chr_printf(s->display, "\e[HMalta LEDBAR\r\n");
- qemu_chr_printf(s->display, "+--------+\r\n");
- qemu_chr_printf(s->display, "+ +\r\n");
- qemu_chr_printf(s->display, "+--------+\r\n");
- qemu_chr_printf(s->display, "\n");
- qemu_chr_printf(s->display, "Malta ASCII\r\n");
- qemu_chr_printf(s->display, "+--------+\r\n");
- qemu_chr_printf(s->display, "+ +\r\n");
- qemu_chr_printf(s->display, "+--------+\r\n");
-
- uart_chr = qemu_chr_open("cbus", "vc:80Cx24C");
- qemu_chr_printf(uart_chr, "CBUS UART\r\n");
+ s->display = qemu_chr_open("fpga", "vc:320x200", malta_fpga_led_init);
+
+ uart_chr = qemu_chr_open("cbus", "vc:80Cx24C", malta_fpga_uart_init);
s->uart =
serial_mm_init(base + 0x900, 3, env->irq[2], 230400, uart_chr, 1);
diff --git a/hw/omap1.c b/hw/omap1.c
index 4c7902869..c32d3f7f0 100644
--- a/hw/omap1.c
+++ b/hw/omap1.c
@@ -1988,7 +1988,7 @@ struct omap_uart_s *omap_uart_init(target_phys_addr_t base,
s->fclk = fclk;
s->irq = irq;
s->serial = serial_mm_init(base, 2, irq, omap_clk_getrate(fclk)/16,
- chr ?: qemu_chr_open("null", "null"), 1);
+ chr ?: qemu_chr_open("null", "null", NULL), 1);
return s;
}
@@ -2104,7 +2104,7 @@ void omap_uart_attach(struct omap_uart_s *s, CharDriverState *chr)
/* TODO: Should reuse or destroy current s->serial */
s->serial = serial_mm_init(s->base, 2, s->irq,
omap_clk_getrate(s->fclk) / 16,
- chr ?: qemu_chr_open("null", "null"), 1);
+ chr ?: qemu_chr_open("null", "null", NULL), 1);
}
/* MPU Clock/Reset/Power Mode Control */
diff --git a/hw/omap2.c b/hw/omap2.c
index b9f770609..20b38116f 100644
--- a/hw/omap2.c
+++ b/hw/omap2.c
@@ -2161,7 +2161,7 @@ static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta,
s->irq = irq;
omap_sti_reset(s);
- s->chr = chr ?: qemu_chr_open("null", "null");
+ s->chr = chr ?: qemu_chr_open("null", "null", NULL);
iomemtype = l4_register_io_memory(0, omap_sti_readfn,
omap_sti_writefn, s);
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index a6a756d95..9dd2c072d 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -558,7 +558,7 @@ USBDevice *usb_serial_init(const char *filename)
return NULL;
snprintf(label, sizeof(label), "usbserial%d", index++);
- cdrv = qemu_chr_open(label, filename);
+ cdrv = qemu_chr_open(label, filename, NULL);
if (!cdrv)
goto fail;
s->cs = cdrv;