static void milkymist_uart_realize(DeviceState *dev, Error **errp) { MilkymistUartState *s = MILKYMIST_UART(dev); qemu_chr_fe_set_handlers(&s->chr, uart_can_rx, uart_rx, uart_event, s, NULL, true); }
static void milkymist_uart_realize(DeviceState *dev, Error **errp) { MilkymistUartState *s = MILKYMIST_UART(dev); if (s->chr) { qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s); } }
static void milkymist_uart_init(Object *obj) { SysBusDevice *sbd = SYS_BUS_DEVICE(obj); MilkymistUartState *s = MILKYMIST_UART(obj); sysbus_init_irq(sbd, &s->irq); memory_region_init_io(&s->regs_region, OBJECT(s), &uart_mmio_ops, s, "milkymist-uart", R_MAX * 4); sysbus_init_mmio(sbd, &s->regs_region); }
static void milkymist_uart_reset(DeviceState *d) { MilkymistUartState *s = MILKYMIST_UART(d); int i; for (i = 0; i < R_MAX; i++) { s->regs[i] = 0; } /* THRE is always set */ s->regs[R_STAT] = STAT_THRE; }