summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-06-23 08:24:49 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-06-24 11:36:28 +0200
commit005c79beb96e8fac00aa38aa6f4a3ab5ca6ca8a9 (patch)
tree30a39fd2e2df8e2f8cf2be60d8d2e41be4824f18
parentsparc: Move FP frame offset defines to cpuimpl.h (diff)
downloadrtems-005c79beb96e8fac00aa38aa6f4a3ab5ca6ca8a9.tar.bz2
bsps: bsp_interrupt_handler_dispatch_unchecked()
Add bsp_interrupt_handler_dispatch_unchecked() as an alternative to bsp_interrupt_handler_dispatch(). It may be used if the caller can ensure that the vector number is valid.
-rw-r--r--bsps/include/bsp/irq-generic.h59
1 files changed, 40 insertions, 19 deletions
diff --git a/bsps/include/bsp/irq-generic.h b/bsps/include/bsp/irq-generic.h
index 5b9ad3ed50..8f7683c517 100644
--- a/bsps/include/bsp/irq-generic.h
+++ b/bsps/include/bsp/irq-generic.h
@@ -251,34 +251,55 @@ void bsp_interrupt_vector_enable(rtems_vector_number vector);
void bsp_interrupt_vector_disable(rtems_vector_number vector);
/**
- * @brief Sequencially calls all interrupt handlers for the vector number @a
- * vector.
+ * @brief Sequentially calls all interrupt handlers installed at the vector.
*
- * If the vector number is out of range or the handler list is empty
- * bsp_interrupt_handler_default() will be called with argument @a vector.
+ * This function does not validate the vector number. If the vector number is
+ * out of range, then the behaviour is undefined.
*
* You can call this function within every context which can be disabled via
- * rtems_interrupt_disable().
+ * rtems_interrupt_local_disable().
+ *
+ * @param vector is the vector number.
*/
-static inline void bsp_interrupt_handler_dispatch(rtems_vector_number vector)
+static inline void bsp_interrupt_handler_dispatch_unchecked(
+ rtems_vector_number vector
+)
{
- if (bsp_interrupt_is_valid_vector(vector)) {
- const bsp_interrupt_handler_entry *e =
- &bsp_interrupt_handler_table [bsp_interrupt_handler_index(vector)];
+ const bsp_interrupt_handler_entry *e;
- do {
- rtems_interrupt_handler handler;
- void *arg;
+ e = &bsp_interrupt_handler_table[ bsp_interrupt_handler_index( vector ) ];
- arg = e->arg;
- bsp_interrupt_fence(ATOMIC_ORDER_ACQUIRE);
- handler = e->handler;
- (*handler)(arg);
+ do {
+ rtems_interrupt_handler handler;
+ void *arg;
- e = e->next;
- } while (e != NULL);
+ arg = e->arg;
+ bsp_interrupt_fence( ATOMIC_ORDER_ACQUIRE );
+ handler = e->handler;
+ ( *handler )( arg );
+
+ e = e->next;
+ } while ( e != NULL );
+}
+
+/**
+ * @brief Sequentially calls all interrupt handlers installed at the vector.
+ *
+ * If the vector number is out of range or the handler list is empty
+ * bsp_interrupt_handler_default() will be called with the vector number as
+ * argument.
+ *
+ * You can call this function within every context which can be disabled via
+ * rtems_interrupt_local_disable().
+ *
+ * @param vector is the vector number.
+ */
+static inline void bsp_interrupt_handler_dispatch( rtems_vector_number vector )
+{
+ if ( bsp_interrupt_is_valid_vector( vector ) ) {
+ bsp_interrupt_handler_dispatch_unchecked( vector );
} else {
- bsp_interrupt_handler_default(vector);
+ bsp_interrupt_handler_default( vector );
}
}