meson: convert hw/vfio
[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 #include "qapi/error.h"
7
8 static inline DeviceState *lm32_pic_init(qemu_irq cpu_irq)
9 {
10 DeviceState *dev;
11 SysBusDevice *d;
12
13 dev = qdev_new("lm32-pic");
14 d = SYS_BUS_DEVICE(dev);
15 sysbus_realize_and_unref(d, &error_fatal);
16 sysbus_connect_irq(d, 0, cpu_irq);
17
18 return dev;
19 }
20
21 static inline DeviceState *lm32_juart_init(Chardev *chr)
22 {
23 DeviceState *dev;
24
25 dev = qdev_new(TYPE_LM32_JUART);
26 qdev_prop_set_chr(dev, "chardev", chr);
27 sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
28
29 return dev;
30 }
31
32 static inline DeviceState *lm32_uart_create(hwaddr addr,
33 qemu_irq irq,
34 Chardev *chr)
35 {
36 DeviceState *dev;
37 SysBusDevice *s;
38
39 dev = qdev_new("lm32-uart");
40 s = SYS_BUS_DEVICE(dev);
41 qdev_prop_set_chr(dev, "chardev", chr);
42 sysbus_realize_and_unref(s, &error_fatal);
43 sysbus_mmio_map(s, 0, addr);
44 sysbus_connect_irq(s, 0, irq);
45 return dev;
46 }
47
48 #endif