mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
hw/char: QOM'ify xilinx_uartlite model
* drop qemu_char_get_next_serial and use chardev prop * create xilinx_uartlite_create wrapper function to create xilinx_uartlite device * change affected board code to use the new way Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Message-id: 1465028065-5855-6-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>
This commit is contained in:
parent
7bd43519da
commit
1b6d0781c2
3 changed files with 44 additions and 6 deletions
|
@ -172,6 +172,11 @@ static const MemoryRegionOps uart_ops = {
|
|||
}
|
||||
};
|
||||
|
||||
static Property xilinx_uartlite_properties[] = {
|
||||
DEFINE_PROP_CHR("chardev", XilinxUARTLite, chr),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static void uart_rx(void *opaque, const uint8_t *buf, int size)
|
||||
{
|
||||
XilinxUARTLite *s = opaque;
|
||||
|
@ -206,8 +211,6 @@ static void xilinx_uartlite_realize(DeviceState *dev, Error **errp)
|
|||
{
|
||||
XilinxUARTLite *s = XILINX_UARTLITE(dev);
|
||||
|
||||
/* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
|
||||
s->chr = qemu_char_get_next_serial();
|
||||
if (s->chr)
|
||||
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
|
||||
}
|
||||
|
@ -229,8 +232,7 @@ static void xilinx_uartlite_class_init(ObjectClass *klass, void *data)
|
|||
|
||||
dc->reset = xilinx_uartlite_reset;
|
||||
dc->realize = xilinx_uartlite_realize;
|
||||
/* Reason: realize() method uses qemu_char_get_next_serial() */
|
||||
dc->cannot_instantiate_with_device_add_yet = true;
|
||||
dc->props = xilinx_uartlite_properties;
|
||||
}
|
||||
|
||||
static const TypeInfo xilinx_uartlite_info = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue