diff options
author | Fabien Chouteau <chouteau@adacore.com> | 2011-01-24 12:56:54 +0100 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-01-24 20:54:34 +0000 |
commit | 8b1e1320748f0aca2319ee272f106ca41a7580a2 (patch) | |
tree | 40d817e8200dc60f8ecb5668c6e6b1988e4c6577 /hw/grlib.h | |
parent | 3f10bcbb647372f888a9e34f428eb6f0225c38ca (diff) |
SPARC: Emulation of GRLIB APB UART
This device exposes one parameter:
- chardev (ptr) : Pointer to a qemu character device
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 | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/hw/grlib.h b/hw/grlib.h index f92d6d3ac2..fdf4b1190a 100644 --- a/hw/grlib.h +++ b/hw/grlib.h @@ -100,4 +100,27 @@ DeviceState *grlib_gptimer_create(target_phys_addr_t base, return dev; } +/* APB UART */ + +static inline +DeviceState *grlib_apbuart_create(target_phys_addr_t base, + CharDriverState *serial, + qemu_irq irq) +{ + DeviceState *dev; + + dev = qdev_create(NULL, "grlib,apbuart"); + qdev_prop_set_chr(dev, "chrdev", serial); + + if (qdev_init(dev)) { + return NULL; + } + + sysbus_mmio_map(sysbus_from_qdev(dev), 0, base); + + sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq); + + return dev; +} + #endif /* ! _GRLIB_H_ */ |