diff options
author | Guan Xuetao | 2012-08-10 08:42:28 +0200 |
---|---|---|
committer | Blue Swirl | 2012-08-11 11:36:59 +0200 |
commit | 5c8556a6f64842c78c2e3493f9d7544af5736ddb (patch) | |
tree | 209d5cdf80efd9e4b2fdecbe4e25d2c9026e3073 /hw/puv3.c | |
parent | unicore32-softmmu: Add puv3 soc/board support (diff) | |
download | qemu-5c8556a6f64842c78c2e3493f9d7544af5736ddb.tar.gz qemu-5c8556a6f64842c78c2e3493f9d7544af5736ddb.tar.xz qemu-5c8556a6f64842c78c2e3493f9d7544af5736ddb.zip |
unicore32-softmmu: Add puv3 interrupt support
This patch adds puv3 interrupt support, include interrupt controler
device simulation and interrupt handler in puv3 machine.
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/puv3.c')
-rw-r--r-- | hw/puv3.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -22,9 +22,30 @@ #define KERNEL_LOAD_ADDR 0x03000000 #define KERNEL_MAX_SIZE 0x00800000 /* Just a guess */ +static void puv3_intc_cpu_handler(void *opaque, int irq, int level) +{ + CPUUniCore32State *env = opaque; + + assert(irq == 0); + if (level) { + cpu_interrupt(env, CPU_INTERRUPT_HARD); + } else { + cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); + } +} + static void puv3_soc_init(CPUUniCore32State *env) { - /* TODO */ + qemu_irq *cpu_intc, irqs[PUV3_IRQS_NR]; + DeviceState *dev; + int i; + + /* Initialize interrupt controller */ + cpu_intc = qemu_allocate_irqs(puv3_intc_cpu_handler, env, 1); + dev = sysbus_create_simple("puv3_intc", PUV3_INTC_BASE, *cpu_intc); + for (i = 0; i < PUV3_IRQS_NR; i++) { + irqs[i] = qdev_get_gpio_in(dev, i); + } } static void puv3_board_init(CPUUniCore32State *env, ram_addr_t ram_size) |