diff options
author | xiaoqiang zhao <zxq_yx_007@163.com> | 2016-06-06 16:59:31 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-06-06 16:59:31 +0100 |
commit | 4be12ea09acc32f7e1b9d11e9f34969c7ae603ee (patch) | |
tree | 99006ed7d226c2f34a0c4c35e6179ef445c8b9cc /include/hw/char | |
parent | f0d1d2c115dffc1fbaf954d0b449db05c5eb79b1 (diff) |
hw/char: QOM'ify cadence_uart model
* drop qemu_char_get_next_serial and use chardev prop
* create cadence_uart_create wrapper function to create
cadence_uart_device
* change affected board code to use the new way
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Message-id: 1465028065-5855-3-git-send-email-zxq_yx_007@163.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/hw/char')
-rw-r--r-- | include/hw/char/cadence_uart.h | 17 |
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 |