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
This commit is contained in:
aurel32 2009-01-18 14:08:04 +00:00
parent 9c554c1c0b
commit ceecf1d158
9 changed files with 36 additions and 25 deletions

View file

@ -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");
s->display = qemu_chr_open("fpga", "vc:320x200", malta_fpga_led_init);
uart_chr = qemu_chr_open("cbus", "vc:80Cx24C");
qemu_chr_printf(uart_chr, "CBUS UART\r\n");
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);