Revision 71d9bc50 hw/integratorcp.c
b/hw/integratorcp.c | ||
---|---|---|
18 | 18 |
|
19 | 19 |
typedef struct { |
20 | 20 |
SysBusDevice busdev; |
21 |
MemoryRegion iomem; |
|
21 | 22 |
uint32_t memsz; |
22 | 23 |
MemoryRegion flash; |
23 | 24 |
bool flash_mapped; |
... | ... | |
39 | 40 |
0xe, 4, 0x1c, 1, 2, 0x20, 0xc0, 0, 0, 0, 0, 0x30, 0x28, 0x30, 0x28, 0x40 |
40 | 41 |
}; |
41 | 42 |
|
42 |
static uint32_t integratorcm_read(void *opaque, target_phys_addr_t offset) |
|
43 |
static uint64_t integratorcm_read(void *opaque, target_phys_addr_t offset, |
|
44 |
unsigned size) |
|
43 | 45 |
{ |
44 | 46 |
integratorcm_state *s = (integratorcm_state *)opaque; |
45 | 47 |
if (offset >= 0x100 && offset < 0x200) { |
... | ... | |
152 | 154 |
} |
153 | 155 |
|
154 | 156 |
static void integratorcm_write(void *opaque, target_phys_addr_t offset, |
155 |
uint32_t value)
|
|
157 |
uint64_t value, unsigned size)
|
|
156 | 158 |
{ |
157 | 159 |
integratorcm_state *s = (integratorcm_state *)opaque; |
158 | 160 |
switch (offset >> 2) { |
... | ... | |
228 | 230 |
|
229 | 231 |
/* Integrator/CM control registers. */ |
230 | 232 |
|
231 |
static CPUReadMemoryFunc * const integratorcm_readfn[] = { |
|
232 |
integratorcm_read, |
|
233 |
integratorcm_read, |
|
234 |
integratorcm_read |
|
235 |
}; |
|
236 |
|
|
237 |
static CPUWriteMemoryFunc * const integratorcm_writefn[] = { |
|
238 |
integratorcm_write, |
|
239 |
integratorcm_write, |
|
240 |
integratorcm_write |
|
233 |
static const MemoryRegionOps integratorcm_ops = { |
|
234 |
.read = integratorcm_read, |
|
235 |
.write = integratorcm_write, |
|
236 |
.endianness = DEVICE_NATIVE_ENDIAN, |
|
241 | 237 |
}; |
242 | 238 |
|
243 | 239 |
static int integratorcm_init(SysBusDevice *dev) |
244 | 240 |
{ |
245 |
int iomemtype; |
|
246 | 241 |
integratorcm_state *s = FROM_SYSBUS(integratorcm_state, dev); |
247 | 242 |
|
248 | 243 |
s->cm_osc = 0x01000048; |
... | ... | |
269 | 264 |
memory_region_init_ram(&s->flash, NULL, "integrator.flash", 0x100000); |
270 | 265 |
s->flash_mapped = false; |
271 | 266 |
|
272 |
iomemtype = cpu_register_io_memory(integratorcm_readfn,
|
|
273 |
integratorcm_writefn, s,
|
|
274 |
DEVICE_NATIVE_ENDIAN);
|
|
275 |
sysbus_init_mmio(dev, 0x00800000, iomemtype); |
|
267 |
memory_region_init_io(&s->iomem, &integratorcm_ops, s,
|
|
268 |
"integratorcm", 0x00800000);
|
|
269 |
sysbus_init_mmio_region(dev, &s->iomem);
|
|
270 |
|
|
276 | 271 |
integratorcm_do_remap(s, 1); |
277 | 272 |
/* ??? Save/restore. */ |
278 | 273 |
return 0; |
Also available in: Unified diff