diff options
author | Fabien Chouteau <chouteau@adacore.com> | 2011-01-24 12:56:53 +0100 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-01-24 20:54:34 +0000 |
commit | 3f10bcbb647372f888a9e34f428eb6f0225c38ca (patch) | |
tree | 3a3d1fd89edfb8c8653dfa3ba85eb032b8ec3817 /hw/grlib.h | |
parent | 0f3a4a01ebafe93055069418c9d65cc7b1493b41 (diff) |
SPARC: Emulation of GRLIB IRQMP
This device exposes two parameters:
- set_pil_in (ptr) : A function to set the pil_in of the SPARC CPU
- set_pil_in_opaque (ptr) : Opaque argument of the set_pil_in function
Emulation of GrLib devices is base on the GRLIB IP Core User's Manual:
http://www.gaisler.com/products/grlib/grip.pdf
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/grlib.h')
-rw-r--r-- | hw/grlib.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/hw/grlib.h b/hw/grlib.h index 776acf94b1..f92d6d3ac2 100644 --- a/hw/grlib.h +++ b/hw/grlib.h @@ -32,6 +32,44 @@ * http://www.gaisler.com/products/grlib/grip.pdf */ +/* IRQMP */ + +typedef void (*set_pil_in_fn) (void *opaque, uint32_t pil_in); + +void grlib_irqmp_set_irq(void *opaque, int irq, int level); + +void grlib_irqmp_ack(DeviceState *dev, int intno); + +static inline +DeviceState *grlib_irqmp_create(target_phys_addr_t base, + CPUState *env, + qemu_irq **cpu_irqs, + uint32_t nr_irqs, + set_pil_in_fn set_pil_in) +{ + DeviceState *dev; + + assert(cpu_irqs != NULL); + + dev = qdev_create(NULL, "grlib,irqmp"); + qdev_prop_set_ptr(dev, "set_pil_in", set_pil_in); + qdev_prop_set_ptr(dev, "set_pil_in_opaque", env); + + if (qdev_init(dev)) { + return NULL; + } + + env->irq_manager = dev; + + sysbus_mmio_map(sysbus_from_qdev(dev), 0, base); + + *cpu_irqs = qemu_allocate_irqs(grlib_irqmp_set_irq, + dev, + nr_irqs); + + return dev; +} + /* GPTimer */ static inline |