Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20170228-tag' into staging
[qemu/ar7.git] / hw / lm32 / lm32.h
blobd1514a61b349486d8e2d7425aef7ad96d169e214
1 #ifndef HW_LM32_H
2 #define HW_LM32_H
4 #include "hw/char/lm32_juart.h"
6 static inline DeviceState *lm32_pic_init(qemu_irq cpu_irq)
8 DeviceState *dev;
9 SysBusDevice *d;
11 dev = qdev_create(NULL, "lm32-pic");
12 qdev_init_nofail(dev);
13 d = SYS_BUS_DEVICE(dev);
14 sysbus_connect_irq(d, 0, cpu_irq);
16 return dev;
19 static inline DeviceState *lm32_juart_init(Chardev *chr)
21 DeviceState *dev;
23 dev = qdev_create(NULL, TYPE_LM32_JUART);
24 qdev_prop_set_chr(dev, "chardev", chr);
25 qdev_init_nofail(dev);
27 return dev;
30 static inline DeviceState *lm32_uart_create(hwaddr addr,
31 qemu_irq irq,
32 Chardev *chr)
34 DeviceState *dev;
35 SysBusDevice *s;
37 dev = qdev_create(NULL, "lm32-uart");
38 s = SYS_BUS_DEVICE(dev);
39 qdev_prop_set_chr(dev, "chardev", chr);
40 qdev_init_nofail(dev);
41 sysbus_mmio_map(s, 0, addr);
42 sysbus_connect_irq(s, 0, irq);
43 return dev;
46 #endif