Update the etrax machine.

* Use CFI-0002 flashes.
* Connect one of the ethernet blocks.
* Simplified irq numbering.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4430 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
edgar_igl 2008-05-11 15:07:19 +00:00
parent a3ea5df588
commit 48318011da
3 changed files with 46 additions and 20 deletions

View File

@ -588,12 +588,14 @@ CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
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)

View File

@ -24,10 +24,14 @@
#include <time.h>
#include <sys/time.h>
#include "hw.h"
#include "sysemu.h"
#include "net.h"
#include "flash.h"
#include "sysemu.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 @@ static void main_cpu_reset(void *opaque)
/* 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 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
{
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,23 +93,36 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
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
@ -126,7 +148,7 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
}
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 bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size,
void DMA_run(void)
{
etraxfs_dmac_run(etraxfs_dmac);
}
QEMUMachine bareetraxfs_machine = {
"bareetraxfs",
"Bare ETRAX FS board",
bareetraxfs_init,
0x800000,
0x4000000,
};

View File

@ -154,6 +154,7 @@ static void etraxfs_pic_handler(void *opaque, int irq, int level)
__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;