[PATCH 02/13] bsps: Add gicv3_sgi_ppi_is_pending()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Mar 18 07:19:04 UTC 2022


---
 bsps/include/dev/irq/arm-gicv3.h | 11 +++++++++++
 bsps/shared/dev/irq/arm-gicv3.c  |  5 +----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/bsps/include/dev/irq/arm-gicv3.h b/bsps/include/dev/irq/arm-gicv3.h
index 60bc315962..0583fded0a 100644
--- a/bsps/include/dev/irq/arm-gicv3.h
+++ b/bsps/include/dev/irq/arm-gicv3.h
@@ -9,6 +9,7 @@
  */
 
 /*
+ * Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de)
  * Copyright (C) 2019 On-Line Applications Research Corporation (OAR)
  *
  * Redistribution and use in source and binary forms, with or without
@@ -155,6 +156,16 @@ static inline volatile gic_sgi_ppi *gicv3_get_sgi_ppi(uint32_t cpu_index)
     ((uintptr_t)BSP_ARM_GIC_REDIST_BASE + cpu_index * 0x20000 + 0x10000);
 }
 
+static inline bool gicv3_sgi_ppi_is_pending(
+  rtems_vector_number vector,
+  uint32_t            cpu_index
+)
+{
+  volatile gic_sgi_ppi *sgi_ppi = gicv3_get_sgi_ppi(cpu_index);
+
+  return (sgi_ppi->icspispendr[0] & (1U << vector)) != 0;
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/bsps/shared/dev/irq/arm-gicv3.c b/bsps/shared/dev/irq/arm-gicv3.c
index 58f97c4f43..682af67b21 100644
--- a/bsps/shared/dev/irq/arm-gicv3.c
+++ b/bsps/shared/dev/irq/arm-gicv3.c
@@ -87,10 +87,7 @@ rtems_status_code bsp_interrupt_is_pending(
   bsp_interrupt_assert(pending != NULL);
 
   if (vector <= ARM_GIC_IRQ_PPI_LAST) {
-    volatile gic_sgi_ppi *sgi_ppi =
-      gicv3_get_sgi_ppi(_SMP_Get_current_processor());
-
-    *pending = (sgi_ppi->icspispendr[0] & (1U << vector)) != 0;
+    *pending = gicv3_sgi_ppi_is_pending(vector, _SMP_Get_current_processor());
   } else {
     volatile gic_dist *dist = ARM_GIC_DIST;
 
-- 
2.34.1



More information about the devel mailing list