[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH 1/7] hw/arm/nrf51_soc: nRF51 Calculate peripheral id f
From: |
Steffen Görtz |
Subject: |
[Qemu-arm] [PATCH 1/7] hw/arm/nrf51_soc: nRF51 Calculate peripheral id from base address |
Date: |
Sat, 11 Aug 2018 11:08:30 +0200 |
The base address determines a peripherals id, which identifies its
interrupt line, see NRF51 reference manual section 10 peripheral
interface. This little gem calculates the peripheral id based
on its base address.
Signed-off-by: Steffen Görtz <address@hidden>
---
hw/arm/nrf51_soc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
index 9f9649c780..441d05e1ef 100644
--- a/hw/arm/nrf51_soc.c
+++ b/hw/arm/nrf51_soc.c
@@ -38,6 +38,9 @@
#define NRF51822_FLASH_SIZE (256 * 1024)
#define NRF51822_SRAM_SIZE (16 * 1024)
+/* IRQ lines can be derived from peripheral base addresses */
+#define BASE_TO_IRQ(base) (((base) >> 12) & 0x1F)
+
static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
{
NRF51State *s = NRF51_SOC(dev_soc);
--
2.18.0
- [Qemu-arm] [PATCH 2/7] arm: Move nRF51 machine state to dedicated header, (continued)
- [Qemu-arm] [PATCH 4/7] arm: Add additional datasheets and copyright lines, Steffen Görtz, 2018/08/11
- [Qemu-arm] [PATCH 5/7] arm: Improve error propagation in nRF51 SOC, Steffen Görtz, 2018/08/11
- [Qemu-arm] [PATCH 1/7] hw/arm/nrf51_soc: nRF51 Calculate peripheral id from base address,
Steffen Görtz <=
- [Qemu-arm] [PATCH 7/7] arm: Instantiate Microbit board-level devices, Steffen Görtz, 2018/08/11
- [Qemu-arm] [PATCH 6/7] arm: Instantiate nRF51 peripherals, Steffen Görtz, 2018/08/11