qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [4430] Update the etrax machine.


From: Edgar E. Iglesias
Subject: [Qemu-devel] [4430] Update the etrax machine.
Date: Sun, 11 May 2008 15:07:20 +0000

Revision: 4430
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4430
Author:   edgar_igl
Date:     2008-05-11 15:07:19 +0000 (Sun, 11 May 2008)

Log Message:
-----------
Update the etrax machine.
* Use CFI-0002 flashes.
* Connect one of the ethernet blocks.
* Simplified irq numbering.

Modified Paths:
--------------
    trunk/Makefile.target
    trunk/hw/etraxfs.c
    trunk/hw/etraxfs_pic.c

Modified: trunk/Makefile.target
===================================================================
--- trunk/Makefile.target       2008-05-11 15:04:22 UTC (rev 4429)
+++ trunk/Makefile.target       2008-05-11 15:07:19 UTC (rev 4430)
@@ -588,12 +588,14 @@
 endif
 ifeq ($(TARGET_BASE_ARCH), cris)
 OBJS+= etraxfs.o
+OBJS+= etraxfs_dma.o
 OBJS+= etraxfs_pic.o
+OBJS+= etraxfs_eth.o
 OBJS+= etraxfs_timer.o
 OBJS+= etraxfs_ser.o
 
 OBJS+= ptimer.o
-OBJS+= pflash_cfi01.o
+OBJS+= pflash_cfi02.o
 endif
 ifeq ($(TARGET_BASE_ARCH), sparc)
 ifeq ($(TARGET_ARCH), sparc64)

Modified: trunk/hw/etraxfs.c
===================================================================
--- trunk/hw/etraxfs.c  2008-05-11 15:04:22 UTC (rev 4429)
+++ trunk/hw/etraxfs.c  2008-05-11 15:07:19 UTC (rev 4430)
@@ -24,10 +24,14 @@
 #include <time.h>
 #include <sys/time.h>
 #include "hw.h"
+#include "net.h"
+#include "flash.h"
 #include "sysemu.h"
-#include "flash.h"
+#include "devices.h"
 #include "boards.h"
 
+#include "etraxfs_dma.h"
+
 static void main_cpu_reset(void *opaque)
 {
     CPUState *env = opaque;
@@ -36,14 +40,18 @@
 
 /* Init functions for different blocks.  */
 extern qemu_irq *etraxfs_pic_init(CPUState *env, target_phys_addr_t base);
-void etraxfs_timer_init(CPUState *env, qemu_irq *irqs, 
+void etraxfs_timer_init(CPUState *env, qemu_irq *irqs,
                        target_phys_addr_t base);
+void *etraxfs_eth_init(NICInfo *nd, CPUState *env, 
+                      qemu_irq *irq, target_phys_addr_t base);
 void etraxfs_ser_init(CPUState *env, qemu_irq *irq, CharDriverState *chr,
                      target_phys_addr_t base);
 
 #define FLASH_SIZE 0x2000000
 #define INTMEM_SIZE (128 * 1024)
 
+static void *etraxfs_dmac;
+
 static
 void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
                        const char *boot_device, DisplayState *ds,
@@ -52,8 +60,9 @@
 {
     CPUState *env;
     qemu_irq *pic;
+    struct etraxfs_dma_client *eth0;
     int kernel_size;
-    int index;
+    int i;
     ram_addr_t phys_ram;
     ram_addr_t phys_intmem;
 
@@ -84,24 +93,37 @@
     cpu_register_physical_memory(0x04000000, FLASH_SIZE, IO_MEM_ROM);
     cpu_register_physical_memory(0x84000000, FLASH_SIZE, 
                                 0x04000000 | IO_MEM_ROM);
-    index = drive_get_index(IF_PFLASH, 0, 0);
-    pflash_cfi01_register(0x80000000, FLASH_SIZE,
-                         drives_table[index].bdrv, 65536, FLASH_SIZE >> 16,
-                         4, 0x0000, 0x0000, 0x0000, 0x0000);
+    i = drive_get_index(IF_PFLASH, 0, 0);
+    pflash_cfi02_register(0x80000000, qemu_ram_alloc(FLASH_SIZE),
+                         drives_table[i].bdrv, (64 * 1024), 
+                         FLASH_SIZE >> 16,
+                         1, 2, 0x0000, 0x0000, 0x0000, 0x0000, 0x555, 0x2aa);
 
     pic = etraxfs_pic_init(env, 0xb001c000);
+    etraxfs_dmac = etraxfs_dmac_init(env, 0xb0000000, 10);
+    for (i = 0; i < 10; i++) {
+           /* On ETRAX, odd numbered channels are inputs.  */
+           etraxfs_dmac_connect(etraxfs_dmac, i, pic + 7 + i, i & 1);
+    }
+
+    /* It has 2, but let's start with one ethernet block.  */
+    eth0 = etraxfs_eth_init(&nd_table[0], env, pic + 25, 0xb0034000);
+    
+    /* The DMA Connector block is missing, hardwire things for now.  */
+    etraxfs_dmac_connect_client(etraxfs_dmac, 0, eth0);
+    etraxfs_dmac_connect_client(etraxfs_dmac, 1, eth0 + 1);
+
     /* 2 timers.  */
-    etraxfs_timer_init(env, pic + 26, 0xb001e000);
-    etraxfs_timer_init(env, pic + 26, 0xb005e000);
-    /* 4 serial ports.  */
-    etraxfs_ser_init(env, pic + 19, serial_hds[0], 0xb0026000);
-    if (serial_hds[1])
-           etraxfs_ser_init(env, pic + 20, serial_hds[1], 0xb0028000);
-    if (serial_hds[2])
-           etraxfs_ser_init(env, pic + 21, serial_hds[2], 0xb002a000);
-    if (serial_hds[3])
-           etraxfs_ser_init(env, pic + 22, serial_hds[3], 0xb002c000);
+    etraxfs_timer_init(env, pic + 0x1b, 0xb001e000);
+    etraxfs_timer_init(env, pic + 0x1b, 0xb005e000);
 
+    for (i = 0; i < 4; i++) {
+           if (serial_hds[i]) {
+                   etraxfs_ser_init(env, pic + 0x14 + i, 
+                                    serial_hds[i], 0xb0026000 + i * 0x2000);
+           }
+    }
+
 #if 1
     /* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis devboard
        SDK.  */
@@ -126,7 +148,7 @@
     }
 
     printf ("pc =%x\n", env->pc);
-    printf ("ram size =%d\n", ram_size);
+    printf ("ram size =%ld\n", ram_size);
     printf ("kernel name =%s\n", kernel_filename);
     printf ("kernel size =%d\n", kernel_size);
     printf ("cpu haltd =%d\n", env->halted);
@@ -134,11 +156,12 @@
 
 void DMA_run(void)
 {
+       etraxfs_dmac_run(etraxfs_dmac);
 }
 
 QEMUMachine bareetraxfs_machine = {
     "bareetraxfs",
     "Bare ETRAX FS board",
     bareetraxfs_init,
-    0x800000,
+    0x4000000,
 };

Modified: trunk/hw/etraxfs_pic.c
===================================================================
--- trunk/hw/etraxfs_pic.c      2008-05-11 15:04:22 UTC (rev 4429)
+++ trunk/hw/etraxfs_pic.c      2008-05-11 15:07:19 UTC (rev 4430)
@@ -154,6 +154,7 @@
                 __func__, irq, level,
                 fs->rw_mask, fs->r_vect, fs->r_masked_vect));
 
+       irq -= 1;
        fs->r_vect &= ~(1 << irq);
        fs->r_vect |= (!!level << irq);
        fs->r_masked_vect = fs->r_vect & fs->rw_mask;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]