Revision a8a00822 hw/syborg_serial.c
b/hw/syborg_serial.c | ||
---|---|---|
58 | 58 |
|
59 | 59 |
typedef struct { |
60 | 60 |
SysBusDevice busdev; |
61 |
MemoryRegion iomem; |
|
61 | 62 |
uint32_t int_enable; |
62 | 63 |
uint32_t fifo_size; |
63 | 64 |
uint32_t *read_fifo; |
... | ... | |
152 | 153 |
syborg_serial_update(s); |
153 | 154 |
} |
154 | 155 |
|
155 |
static uint32_t syborg_serial_read(void *opaque, target_phys_addr_t offset) |
|
156 |
static uint64_t syborg_serial_read(void *opaque, target_phys_addr_t offset, |
|
157 |
unsigned size) |
|
156 | 158 |
{ |
157 | 159 |
SyborgSerialState *s = (SyborgSerialState *)opaque; |
158 | 160 |
uint32_t c; |
... | ... | |
192 | 194 |
} |
193 | 195 |
|
194 | 196 |
static void syborg_serial_write(void *opaque, target_phys_addr_t offset, |
195 |
uint32_t value)
|
|
197 |
uint64_t value, unsigned size)
|
|
196 | 198 |
{ |
197 | 199 |
SyborgSerialState *s = (SyborgSerialState *)opaque; |
198 | 200 |
unsigned char ch; |
... | ... | |
261 | 263 |
/* TODO: Report BREAK events? */ |
262 | 264 |
} |
263 | 265 |
|
264 |
static CPUReadMemoryFunc * const syborg_serial_readfn[] = { |
|
265 |
syborg_serial_read, |
|
266 |
syborg_serial_read, |
|
267 |
syborg_serial_read |
|
268 |
}; |
|
269 |
|
|
270 |
static CPUWriteMemoryFunc * const syborg_serial_writefn[] = { |
|
271 |
syborg_serial_write, |
|
272 |
syborg_serial_write, |
|
273 |
syborg_serial_write |
|
266 |
static const MemoryRegionOps syborg_serial_ops = { |
|
267 |
.read = syborg_serial_read, |
|
268 |
.write = syborg_serial_write, |
|
269 |
.endianness = DEVICE_NATIVE_ENDIAN, |
|
274 | 270 |
}; |
275 | 271 |
|
276 | 272 |
static const VMStateDescription vmstate_syborg_serial = { |
... | ... | |
295 | 291 |
static int syborg_serial_init(SysBusDevice *dev) |
296 | 292 |
{ |
297 | 293 |
SyborgSerialState *s = FROM_SYSBUS(SyborgSerialState, dev); |
298 |
int iomemtype; |
|
299 | 294 |
|
300 | 295 |
sysbus_init_irq(dev, &s->irq); |
301 |
iomemtype = cpu_register_io_memory(syborg_serial_readfn, |
|
302 |
syborg_serial_writefn, s, |
|
303 |
DEVICE_NATIVE_ENDIAN); |
|
304 |
sysbus_init_mmio(dev, 0x1000, iomemtype); |
|
296 |
memory_region_init_io(&s->iomem, &syborg_serial_ops, s, |
|
297 |
"serial", 0x1000); |
|
298 |
sysbus_init_mmio_region(dev, &s->iomem); |
|
305 | 299 |
s->chr = qdev_init_chardev(&dev->qdev); |
306 | 300 |
if (s->chr) { |
307 | 301 |
qemu_chr_add_handlers(s->chr, syborg_serial_can_receive, |
Also available in: Unified diff