aboutsummaryrefslogtreecommitdiff
path: root/include/hw/char/cadence_uart.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/hw/char/cadence_uart.h')
-rw-r--r--include/hw/char/cadence_uart.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/hw/char/cadence_uart.h b/include/hw/char/cadence_uart.h
index 6310f52512..a12773c076 100644
--- a/include/hw/char/cadence_uart.h
+++ b/include/hw/char/cadence_uart.h
@@ -49,5 +49,22 @@ typedef struct {
QEMUTimer *fifo_trigger_handle;
} CadenceUARTState;
+static inline DeviceState *cadence_uart_create(hwaddr addr,
+ qemu_irq irq,
+ CharDriverState *chr)
+{
+ DeviceState *dev;
+ SysBusDevice *s;
+
+ dev = qdev_create(NULL, TYPE_CADENCE_UART);
+ s = SYS_BUS_DEVICE(dev);
+ qdev_prop_set_chr(dev, "chardev", chr);
+ qdev_init_nofail(dev);
+ sysbus_mmio_map(s, 0, addr);
+ sysbus_connect_irq(s, 0, irq);
+
+ return dev;
+}
+
#define CADENCE_UART_H
#endif