Revision 79bbe8bf
b/hw/char/milkymist-uart.c | ||
---|---|---|
52 | 52 |
DBG_BREAK_EN = (1<<0), |
53 | 53 |
}; |
54 | 54 |
|
55 |
#define TYPE_MILKYMIST_UART "milkymist-uart" |
|
56 |
#define MILKYMIST_UART(obj) \ |
|
57 |
OBJECT_CHECK(MilkymistUartState, (obj), TYPE_MILKYMIST_UART) |
|
58 |
|
|
55 | 59 |
struct MilkymistUartState { |
56 |
SysBusDevice busdev; |
|
60 |
SysBusDevice parent_obj; |
|
61 |
|
|
57 | 62 |
MemoryRegion regs_region; |
58 | 63 |
CharDriverState *chr; |
59 | 64 |
qemu_irq irq; |
... | ... | |
179 | 184 |
|
180 | 185 |
static void milkymist_uart_reset(DeviceState *d) |
181 | 186 |
{ |
182 |
MilkymistUartState *s = container_of(d, MilkymistUartState, busdev.qdev);
|
|
187 |
MilkymistUartState *s = MILKYMIST_UART(d);
|
|
183 | 188 |
int i; |
184 | 189 |
|
185 | 190 |
for (i = 0; i < R_MAX; i++) { |
... | ... | |
192 | 197 |
|
193 | 198 |
static int milkymist_uart_init(SysBusDevice *dev) |
194 | 199 |
{ |
195 |
MilkymistUartState *s = FROM_SYSBUS(typeof(*s), dev);
|
|
200 |
MilkymistUartState *s = MILKYMIST_UART(dev);
|
|
196 | 201 |
|
197 | 202 |
sysbus_init_irq(dev, &s->irq); |
198 | 203 |
|
199 | 204 |
memory_region_init_io(&s->regs_region, OBJECT(s), &uart_mmio_ops, s, |
200 |
"milkymist-uart", R_MAX * 4); |
|
205 |
"milkymist-uart", R_MAX * 4);
|
|
201 | 206 |
sysbus_init_mmio(dev, &s->regs_region); |
202 | 207 |
|
203 | 208 |
s->chr = qemu_char_get_next_serial(); |
... | ... | |
230 | 235 |
} |
231 | 236 |
|
232 | 237 |
static const TypeInfo milkymist_uart_info = { |
233 |
.name = "milkymist-uart",
|
|
238 |
.name = TYPE_MILKYMIST_UART,
|
|
234 | 239 |
.parent = TYPE_SYS_BUS_DEVICE, |
235 | 240 |
.instance_size = sizeof(MilkymistUartState), |
236 | 241 |
.class_init = milkymist_uart_class_init, |
Also available in: Unified diff