[PATCH 5/6] bsp/lpc32xx: bsp_interrupt_vector_enable()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Jun 7 14:02:17 UTC 2022


The interrupt enables are used to implement a priority scheme in
bsp_interrupt_dispatch().  Enable interrupts through
bsp_interrupt_vector_enable() only if they are not already enabled to
not interfere with the priority scheme while
bsp_interrupt_vector_enable() is called during interrupt dispatching.
---
 bsps/arm/lpc32xx/irq/irq.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bsps/arm/lpc32xx/irq/irq.c b/bsps/arm/lpc32xx/irq/irq.c
index a62eee6dd5..2b047be559 100644
--- a/bsps/arm/lpc32xx/irq/irq.c
+++ b/bsps/arm/lpc32xx/irq/irq.c
@@ -334,8 +334,12 @@ rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
   rtems_interrupt_disable(level);
-  lpc32xx_irq_set_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
-  lpc32xx_irq_set_bit_in_field(vector, &lpc32xx_irq_enable);
+
+  if (!lpc32xx_irq_is_bit_set_in_field(vector, &lpc32xx_irq_enable)) {
+    lpc32xx_irq_set_bit_in_field(vector, &lpc32xx_irq_enable);
+    lpc32xx_irq_set_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
+  }
+
   rtems_interrupt_enable(level);
 
   return RTEMS_SUCCESSFUL;
-- 
2.35.3



More information about the devel mailing list