[PATCH 1/8] bsp/shared: Add bsp_interrupt_handler_is_empty.

Chris Johns chrisj at rtems.org
Fri May 6 22:23:45 UTC 2016


---
 c/src/lib/libbsp/shared/include/irq-generic.h | 15 ++++++++++++++-
 c/src/lib/libbsp/shared/src/irq-generic.c     | 19 +++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/c/src/lib/libbsp/shared/include/irq-generic.h b/c/src/lib/libbsp/shared/include/irq-generic.h
index 389bd5a..4e89d74 100644
--- a/c/src/lib/libbsp/shared/include/irq-generic.h
+++ b/c/src/lib/libbsp/shared/include/irq-generic.h
@@ -17,6 +17,8 @@
  *  Germany
  *  <rtems at embedded-brains.de>
  *
+ * Copyright (c) 2016 Chris Johns <chrisj at rtems.org>
+ *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
  * http://www.rtems.org/license/LICENSE.
@@ -106,7 +108,7 @@ static inline rtems_vector_number bsp_interrupt_handler_index(
  * @defgroup bsp_interrupt BSP Interrupt Support
  *
  * @ingroup bsp_shared
- * 
+ *
  * @brief Generic BSP Interrupt Support
  *
  * The BSP interrupt support manages a sequence of interrupt vector numbers
@@ -272,6 +274,17 @@ static inline void bsp_interrupt_handler_dispatch(rtems_vector_number vector)
   }
 }
 
+/**
+ * @brief Is interrupt handler empty.
+ *
+ * This routine returns true if the handler is empty and has not been
+ * initialised else false is returned. The interrupt lock is not used
+ * so this call can be used from within interrupts.
+ *
+ * @return If empty true shall be returned else false is returned.
+ */
+bool bsp_interrupt_handler_is_empty(rtems_vector_number vector);
+
 /** @} */
 
 /* For internal use only */
diff --git a/c/src/lib/libbsp/shared/src/irq-generic.c b/c/src/lib/libbsp/shared/src/irq-generic.c
index 19b52af..c62a756 100644
--- a/c/src/lib/libbsp/shared/src/irq-generic.c
+++ b/c/src/lib/libbsp/shared/src/irq-generic.c
@@ -566,3 +566,22 @@ rtems_status_code rtems_interrupt_handler_iterate(
 {
   return bsp_interrupt_handler_iterate(vector, routine, arg);
 }
+
+bool bsp_interrupt_handler_is_empty(rtems_vector_number vector)
+{
+  rtems_vector_number index = 0;
+  bsp_interrupt_handler_entry *head = NULL;
+  bool empty;
+
+  /* For use in interrupts so no lock. */
+
+  /* Get handler table index */
+  index = bsp_interrupt_handler_index(vector);
+
+  /* Get head entry of the handler list for the vector */
+  head = &bsp_interrupt_handler_table [index];
+
+  empty = bsp_interrupt_is_empty_handler_entry(head);
+
+  return empty;
+}
-- 
2.4.6




More information about the devel mailing list