[rtems commit] bsp/raspberry: Add a bsp_fdt_map_intr().

Christian Mauderer christianm at rtems.org
Sat Apr 4 17:49:14 UTC 2020


Module:    rtems
Branch:    master
Commit:    bb8ae78d36d5a32f11404d194d47d8befdbe0664
Changeset: http://git.rtems.org/rtems/commit/?id=bb8ae78d36d5a32f11404d194d47d8befdbe0664

Author:    Christian Mauderer <christian.mauderer at embedded-brains.de>
Date:      Mon Mar  9 23:00:58 2020 +0100

bsp/raspberry: Add a bsp_fdt_map_intr().

Fixes #3903

---

 bsps/arm/raspberrypi/include/bsp/irq.h |  3 +++
 bsps/arm/raspberrypi/start/bspstart.c  | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/bsps/arm/raspberrypi/include/bsp/irq.h b/bsps/arm/raspberrypi/include/bsp/irq.h
index 6a9d05c..17e4472 100644
--- a/bsps/arm/raspberrypi/include/bsp/irq.h
+++ b/bsps/arm/raspberrypi/include/bsp/irq.h
@@ -35,6 +35,8 @@
 
 #define BCM2835_INTC_TOTAL_IRQ       64 + 8
 
+#define BCM2835_IRQ_SET1_MIN         0
+#define BCM2835_IRQ_SET2_MIN         32
 
 #define BCM2835_IRQ_ID_GPU_TIMER_M0  0
 #define BCM2835_IRQ_ID_GPU_TIMER_M1  1
@@ -69,6 +71,7 @@
 
 #define BSP_INTERRUPT_VECTOR_MIN    (0)
 #define BSP_INTERRUPT_VECTOR_MAX    (BCM2835_INTC_TOTAL_IRQ - 1)
+#define BSP_INTERRUPT_VECTOR_INVALID (UINT32_MAX)
 
 #define BSP_IRQ_COUNT               (BCM2835_INTC_TOTAL_IRQ)
 
diff --git a/bsps/arm/raspberrypi/start/bspstart.c b/bsps/arm/raspberrypi/start/bspstart.c
index 49896e4..8d7f6aa 100644
--- a/bsps/arm/raspberrypi/start/bspstart.c
+++ b/bsps/arm/raspberrypi/start/bspstart.c
@@ -23,6 +23,7 @@
 #include <bsp/stackalloc.h>
 #include <bsp/raspberrypi.h>
 #include <bsp/vc.h>
+#include <bsp/fdt.h>
 
 #include <libfdt.h>
 
@@ -101,6 +102,29 @@ void *raspberrypi_get_reg_of_node(const void *fdt, int node)
   return (BUS_TO_PHY((void *) fdt32_to_cpu(val[0])));
 }
 
+#ifdef BSP_FDT_IS_SUPPORTED
+uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)
+{
+  uint32_t controller = intr[0];
+  uint32_t source = intr[1];
+
+  switch ( controller ) {
+    case 0:
+        return source + BCM2835_IRQ_ID_BASIC_BASE_ID;
+        break;
+    case 1:
+        return source + BCM2835_IRQ_SET1_MIN;
+        break;
+    case 2:
+        return source + BCM2835_IRQ_SET2_MIN;
+        break;
+    default:
+        return BSP_INTERRUPT_VECTOR_INVALID;
+        break;
+  }
+}
+#endif /* BSP_FDT_IS_SUPPORTED */
+
 void bsp_start(void)
 {
     bcm2835_get_board_spec_entries spec = { 0 };



More information about the vc mailing list