summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc17xx
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-01-15 15:26:32 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-01-15 15:26:32 -0600
commitfb8316094157de2df6b613de6914dadbd8ff3476 (patch)
tree6aee0957a9dc6c920479a31d2ee1b1007086d303 /nuttx/arch/arm/src/lpc17xx
parentaaa9d752a88b5fe03846364c6d6418ef0e229409 (diff)
downloadnuttx-fb8316094157de2df6b613de6914dadbd8ff3476.tar.gz
nuttx-fb8316094157de2df6b613de6914dadbd8ff3476.tar.bz2
nuttx-fb8316094157de2df6b613de6914dadbd8ff3476.zip
Fix error in last ARMv7-M up_disable_irq checkin
Diffstat (limited to 'nuttx/arch/arm/src/lpc17xx')
-rw-r--r--nuttx/arch/arm/src/lpc17xx/lpc17_irq.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c
index a9c7bcee9..6b163d257 100644
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c
@@ -395,30 +395,24 @@ void up_disable_irq(int irq)
uint32_t regval;
uint32_t bit;
- if (lpc17_irqinfo(irq, &regaddr, &bit) == 0)
+ if (lpc17_irqinfo(irq, &regaddr, &bit, NVIC_CLRENA_OFFSET) == 0)
{
- /* Modify the appropriate bit in the register to disable the interrupt */
-
- regval = getreg32(regaddr);
-
- /* This is awkward... For normal interrupts, we need to set the bit
- * in the associated Interrupt Clear Enable register. For other
- * exceptions, we need to clear the bit in the System Handler Control
- * and State Register.
+ /* Modify the appropriate bit in the register to disable the interrupt.
+ * For normal interrupts, we need to set the bit in the associated
+ * Interrupt Clear Enable register. For other exceptions, we need to
+ * clear the bit in the System Handler Control and State Register.
*/
if (irq >= LPC17_IRQ_EXTINT)
{
- regval |= bit;
+ putreg32(bit, regaddr);
}
else
{
+ regval = getreg32(regaddr);
regval &= ~bit;
+ putreg32(regval, regaddr);
}
-
- /* Save the appropriately modified register */
-
- putreg32(regval, regaddr);
}
#ifdef CONFIG_GPIO_IRQ
else if (irq >= LPC17_VALID_FIRST0L)
@@ -448,11 +442,22 @@ void up_enable_irq(int irq)
if (lpc17_irqinfo(irq, &regaddr, &bit, NVIC_ENA_OFFSET) == 0)
{
- /* Set the appropriate bit in the register to enable the interrupt */
+ /* Modify the appropriate bit in the register to enable the interrupt.
+ * For normal interrupts, we need to set the bit in the associated
+ * Interrupt Set Enable register. For other exceptions, we need to
+ * set the bit in the System Handler Control and State Register.
+ */
- regval = getreg32(regaddr);
- regval |= bit;
- putreg32(regval, regaddr);
+ if (irq >= LPC17_IRQ_EXTINT)
+ {
+ putreg32(bit, regaddr);
+ }
+ else
+ {
+ regval = getreg32(regaddr);
+ regval |= bit;
+ putreg32(regval, regaddr);
+ }
}
#ifdef CONFIG_GPIO_IRQ
else if (irq >= LPC17_VALID_FIRST0L)