Skip to contentSkip to conversation

[5632] SM501 emulation for R2D-SH4

Qemu-devel Blue Swirl 1 participant 1 message Nov 5, 2008 Kbuild

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

Revision: 5632

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5632
Author:   blueswir1
Date:     2008-11-05 20:24:35 +0000 (Wed, 05 Nov 2008)

Log Message:
-----------
SM501 emulation for R2D-SH4

This patch adds minimum emulation of SM501 multifunction device, whose main feature is 2D graphics. It is one of the peripheral of R2D, the SH4 evaluation board. We can see TUX printed on the QEMU console.

Modified Paths:
--------------

    trunk/Makefile.target
    trunk/hw/devices.h
    trunk/hw/r2d.c

Added Paths:
-----------

    trunk/hw/sm501.c
    trunk/hw/sm501_template.h

Modified: trunk/Makefile.target
===================================================================

Makefile.target +1 -1
@@ -731,7 +731,7 @@
 endif
 ifeq ($(TARGET_BASE_ARCH), sh4)
 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
-OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o
+OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sm501.o serial.o
 endif
 ifeq ($(TARGET_BASE_ARCH), m68k)
 OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o

Modified: trunk/hw/devices.h
===================================================================

hw/devices.h +3 -0
@@ -73,4 +73,7 @@
 qemu_irq *tc6393xb_gpio_in_get(struct tc6393xb_s *s);
 qemu_irq tc6393xb_l3v_get(struct tc6393xb_s *s);
 
+/* sm501.c */
+void sm501_init(DisplayState *ds, uint32_t base, unsigned long local_mem_base,
+		uint32_t local_mem_bytes, CharDriverState *chr);
 #endif

Modified: trunk/hw/r2d.c
===================================================================

hw/r2d.c +10 -2
@@ -25,12 +25,15 @@
 
 #include "hw.h"
 #include "sh.h"
+#include "devices.h"
 #include "sysemu.h"
 #include "boards.h"
 
 #define SDRAM_BASE 0x0c000000 /* Physical location of SDRAM: Area 3 */
 #define SDRAM_SIZE 0x04000000
 
+#define SM501_VRAM_SIZE 0x800000
+
 #define PA_POWOFF	0x30
 #define PA_VERREG	0x32
 #define PA_OUTPORT	0x36
@@ -133,6 +136,7 @@
 {
     CPUState *env;
     struct SH7750State *s;
+    ram_addr_t sdram_addr, sm501_vga_ram_addr;
 
     if (!cpu_model)
         cpu_model = "SH7751R";
@@ -144,10 +148,14 @@
     }
 
     /* Allocate memory space */
-    cpu_register_physical_memory(SDRAM_BASE, SDRAM_SIZE, 0);
+    sdram_addr = qemu_ram_alloc(SDRAM_SIZE);
+    cpu_register_physical_memory(SDRAM_BASE, SDRAM_SIZE, sdram_addr);
     /* Register peripherals */
     r2d_fpga_init(0x04000000);
     s = sh7750_init(env);
+    sm501_vga_ram_addr = qemu_ram_alloc(SM501_VRAM_SIZE);
+    sm501_init(ds, 0x10000000, sm501_vga_ram_addr, SM501_VRAM_SIZE,
+	       serial_hds[2]);
     /* Todo: register on board registers */
     {
       int kernel_size;
@@ -167,5 +175,5 @@
     .name = "r2d",
     .desc = "r2d-plus board",
     .init = r2d_init,
-    .ram_require = SDRAM_SIZE | RAMSIZE_FIXED,
+    .ram_require = (SDRAM_SIZE + SM501_VRAM_SIZE) | RAMSIZE_FIXED,
 };

Added: trunk/hw/sm501.c
===================================================================

hw/sm501.c +1129 -0

1,129 lines not on this page · raw message

Added: trunk/hw/sm501_template.h
===================================================================

hw/sm501_template.h +104 -0

104 lines not on this page · raw message