Merge remote-tracking branch 'remotes/elmarco/tags/slirp-pull-request' into staging
[qemu.git] / hw / lm32 / lm32.h
1 #ifndef HW_LM32_H
2 #define HW_LM32_H
3
4 #include "hw/char/lm32_juart.h"
5 #include "hw/qdev-properties.h"
6
7 static inline DeviceState *lm32_pic_init(qemu_irq cpu_irq)
8 {
9 DeviceState *dev;
10 SysBusDevice *d;
11
12 dev = qdev_create(NULL, "lm32-pic");
13 qdev_init_nofail(dev);
14 d = SYS_BUS_DEVICE(dev);
15 sysbus_connect_irq(d, 0, cpu_irq);
16
17 return dev;
18 }
19
20 static inline DeviceState *lm32_juart_init(Chardev *chr)
21 {
22 DeviceState *dev;
23
24 dev = qdev_create(NULL, TYPE_LM32_JUART);
25 qdev_prop_set_chr(dev, "chardev", chr);
26 qdev_init_nofail(dev);
27
28 return dev;
29 }
30
31 static inline DeviceState *lm32_uart_create(hwaddr addr,
32 qemu_irq irq,
33 Chardev *chr)
34 {
35 DeviceState *dev;
36 SysBusDevice *s;
37
38 dev = qdev_create(NULL, "lm32-uart");
39 s = SYS_BUS_DEVICE(dev);
40 qdev_prop_set_chr(dev, "chardev", chr);
41 qdev_init_nofail(dev);
42 sysbus_mmio_map(s, 0, addr);
43 sysbus_connect_irq(s, 0, irq);
44 return dev;
45 }
46
47 #endif