arm: Add Clock peripheral stub to NRF51 SOC
This stubs enables the microbit-micropython firmware to run on the microbit machine. Signed-off-by: Steffen Görtz <contrib@steffen-goertz.de> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20190103091119.9367-12-stefanha@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
7ec543e4b9
commit
b39dced66a
|
@ -34,6 +34,26 @@
|
||||||
|
|
||||||
#define BASE_TO_IRQ(base) ((base >> 12) & 0x1F)
|
#define BASE_TO_IRQ(base) ((base >> 12) & 0x1F)
|
||||||
|
|
||||||
|
static uint64_t clock_read(void *opaque, hwaddr addr, unsigned int size)
|
||||||
|
{
|
||||||
|
qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " [%u]\n",
|
||||||
|
__func__, addr, size);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void clock_write(void *opaque, hwaddr addr, uint64_t data,
|
||||||
|
unsigned int size)
|
||||||
|
{
|
||||||
|
qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " <- 0x%" PRIx64 " [%u]\n",
|
||||||
|
__func__, addr, data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const MemoryRegionOps clock_ops = {
|
||||||
|
.read = clock_read,
|
||||||
|
.write = clock_write
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
|
static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||||
{
|
{
|
||||||
NRF51State *s = NRF51_SOC(dev_soc);
|
NRF51State *s = NRF51_SOC(dev_soc);
|
||||||
|
@ -130,6 +150,12 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||||
BASE_TO_IRQ(base_addr)));
|
BASE_TO_IRQ(base_addr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* STUB Peripherals */
|
||||||
|
memory_region_init_io(&s->clock, NULL, &clock_ops, NULL,
|
||||||
|
"nrf51_soc.clock", 0x1000);
|
||||||
|
memory_region_add_subregion_overlap(&s->container,
|
||||||
|
NRF51_IOMEM_BASE, &s->clock, -1);
|
||||||
|
|
||||||
create_unimplemented_device("nrf51_soc.io", NRF51_IOMEM_BASE,
|
create_unimplemented_device("nrf51_soc.io", NRF51_IOMEM_BASE,
|
||||||
NRF51_IOMEM_SIZE);
|
NRF51_IOMEM_SIZE);
|
||||||
create_unimplemented_device("nrf51_soc.ficr", NRF51_FICR_BASE,
|
create_unimplemented_device("nrf51_soc.ficr", NRF51_FICR_BASE,
|
||||||
|
|
|
@ -38,6 +38,7 @@ typedef struct NRF51State {
|
||||||
MemoryRegion iomem;
|
MemoryRegion iomem;
|
||||||
MemoryRegion sram;
|
MemoryRegion sram;
|
||||||
MemoryRegion flash;
|
MemoryRegion flash;
|
||||||
|
MemoryRegion clock;
|
||||||
|
|
||||||
uint32_t sram_size;
|
uint32_t sram_size;
|
||||||
uint32_t flash_size;
|
uint32_t flash_size;
|
||||||
|
|
Loading…
Reference in a new issue