[PATCH 07/10] bsps/riscv: bsp_interrupt_raise_on()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Nov 9 16:09:17 UTC 2022


Implement bsp_interrupt_raise_on() and bsp_interrupt_raise().
---
 bsps/riscv/riscv/irq/irq.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index 2e68551ae5..2999485f88 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -346,10 +346,27 @@ rtems_status_code bsp_interrupt_is_pending(
   return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_raise(rtems_vector_number vector)
+static inline rtems_status_code riscv_raise_on(
+  rtems_vector_number vector,
+  uint32_t            cpu_index
+)
 {
+  Per_CPU_Control *cpu;
+
   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
-  return RTEMS_UNSATISFIED;
+
+  if (vector != RISCV_INTERRUPT_VECTOR_SOFTWARE) {
+    return RTEMS_UNSATISFIED;
+  }
+
+  cpu = _Per_CPU_Get_by_index(cpu_index);
+  *cpu->cpu_per_cpu.clint_msip = 0x1;
+  return RTEMS_SUCCESSFUL;
+}
+
+rtems_status_code bsp_interrupt_raise(rtems_vector_number vector)
+{
+  return riscv_raise_on(vector, rtems_scheduler_get_processor());
 }
 
 #if defined(RTEMS_SMP)
@@ -358,8 +375,7 @@ rtems_status_code bsp_interrupt_raise_on(
   uint32_t            cpu_index
 )
 {
-  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
-  return RTEMS_UNSATISFIED;
+  return riscv_raise_on(vector, cpu_index);
 }
 #endif
 
-- 
2.35.3



More information about the devel mailing list