[PATCH 2/2] Enable/Disable vector routines now check for a valid vector. Without these guards, the Enable/Disable vector routines will not work with the interrupt server

Kevin Kirspel kevin-kirspel at idexx.com
Mon Jan 23 13:51:27 UTC 2017


---
 c/src/lib/libbsp/arm/lpc32xx/irq/irq.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
 mode change 100644 => 100755 c/src/lib/libbsp/arm/lpc32xx/irq/irq.c

diff --git a/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c b/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c
old mode 100644
new mode 100755
index 77a0c19..8657140
--- a/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c
+++ b/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c
@@ -269,10 +269,12 @@ rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
   rtems_interrupt_level level;

-  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);
-  rtems_interrupt_enable(level);
+  if (lpc32xx_irq_is_valid(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);
+    rtems_interrupt_enable(level);
+  }

   return RTEMS_SUCCESSFUL;
 }
@@ -281,10 +283,12 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
   rtems_interrupt_level level;

-  rtems_interrupt_disable(level);
-  lpc32xx_irq_clear_bit_in_field(vector, &lpc32xx_irq_enable);
-  lpc32xx_irq_clear_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
-  rtems_interrupt_enable(level);
+  if (lpc32xx_irq_is_valid(vector)) {
+    rtems_interrupt_disable(level);
+    lpc32xx_irq_clear_bit_in_field(vector, &lpc32xx_irq_enable);
+    lpc32xx_irq_clear_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
+    rtems_interrupt_enable(level);
+  }

   return RTEMS_SUCCESSFUL;
 }
--
1.9.1



More information about the devel mailing list