From 82b1ed85155de4cac47551adb2363cc36b8806d0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 16 Apr 2013 14:54:08 -0600 Subject: Fix KL25Z interrupt enable/disable logic --- nuttx/arch/arm/include/kinetis/irq.h | 4 ++-- nuttx/arch/arm/include/kl/irq.h | 7 +++---- nuttx/arch/arm/src/kl/kl_irq.c | 16 ++++++++-------- 3 files changed, 13 insertions(+), 14 deletions(-) (limited to 'nuttx/arch') diff --git a/nuttx/arch/arm/include/kinetis/irq.h b/nuttx/arch/arm/include/kinetis/irq.h index 8a020ea1b..7d72fbd18 100644 --- a/nuttx/arch/arm/include/kinetis/irq.h +++ b/nuttx/arch/arm/include/kinetis/irq.h @@ -301,13 +301,13 @@ */ # define NR_VECTORS (120) /* 120 vectors */ -# define NR_IRQS (108) /* 97 interrupts but 108 IRQ numbers */ +# define NR_IRQS (108) /* 120 interrupts but 108 IRQ numbers */ #else /* The interrupt vectors for other parts are defined in other documents and may or * may not be the same as above (the family members are all very similar) This * error just means that you have to look at the document and determine for yourself - * if the memory map is the same. + * if the vectors are the same. */ # error "No IRQ numbers for this Kinetis part" diff --git a/nuttx/arch/arm/include/kl/irq.h b/nuttx/arch/arm/include/kl/irq.h index 0279ea372..78cb0be46 100644 --- a/nuttx/arch/arm/include/kl/irq.h +++ b/nuttx/arch/arm/include/kl/irq.h @@ -122,15 +122,14 @@ * now) seems to justify the waste. */ -# define NR_VECTORS (64) /* 64 vectors */ -# define NR_IRQS (64) /* 64 interrupts but 48 IRQ numbers */ -# define KL_IRQ_INTERRUPT (64) +# define NR_VECTORS (64) /* 64 vectors */ +# define NR_IRQS (48) /* 64 interrupts but 48 IRQ numbers */ #else /* The interrupt vectors for other parts are defined in other documents and may or * may not be the same as above (the family members are all very similar) This * error just means that you have to look at the document and determine for yourself - * if the memory map is the same. + * if the vectors are the same. */ # error "No IRQ numbers for this Kinetis L part" diff --git a/nuttx/arch/arm/src/kl/kl_irq.c b/nuttx/arch/arm/src/kl/kl_irq.c index e4fe27e91..62c1a41b8 100644 --- a/nuttx/arch/arm/src/kl/kl_irq.c +++ b/nuttx/arch/arm/src/kl/kl_irq.c @@ -198,13 +198,13 @@ static inline void kl_clrpend(int irq) /* Check for an external interrupt */ - if (irq >= KL_IRQ_INTERRUPT && irq < KL_IRQ_INTERRUPT + 32) + if (irq >= KL_IRQ_EXTINT && irq < (KL_IRQ_EXTINT + 32)) { /* Set the appropriate bit in the ISER register to enable the * interrupt */ - putreg32((1 << (irq - KL_IRQ_INTERRUPT)), ARMV6M_NVIC_ICPR); + putreg32((1 << (irq - KL_IRQ_EXTINT)), ARMV6M_NVIC_ICPR); } } @@ -295,13 +295,13 @@ void up_disable_irq(int irq) /* Check for an external interrupt */ - if (irq >= KL_IRQ_INTERRUPT && irq < KL_IRQ_INTERRUPT + 32) + if (irq >= KL_IRQ_EXTINT && irq < (KL_IRQ_EXTINT + 32)) { /* Set the appropriate bit in the ICER register to disable the * interrupt */ - putreg32((1 << (irq - KL_IRQ_INTERRUPT)), ARMV6M_NVIC_ICER); + putreg32((1 << (irq - KL_IRQ_EXTINT)), ARMV6M_NVIC_ICER); } /* Handle processor exceptions. Only SysTick can be disabled */ @@ -332,13 +332,13 @@ void up_enable_irq(int irq) /* Check for external interrupt */ - if (irq >= KL_IRQ_INTERRUPT && irq < KL_IRQ_INTERRUPT + 32) + if (irq >= KL_IRQ_EXTINT && irq < (KL_IRQ_EXTINT + 32)) { /* Set the appropriate bit in the ISER register to enable the * interrupt */ - putreg32((1 << (irq - KL_IRQ_INTERRUPT)), ARMV6M_NVIC_ISER); + putreg32((1 << (irq - KL_IRQ_EXTINT)), ARMV6M_NVIC_ISER); } /* Handle processor exceptions. Only SysTick can be disabled */ @@ -386,13 +386,13 @@ int up_prioritize_irq(int irq, int priority) DEBUGASSERT(irq == KL_IRQ_SVCALL || irq == KL_IRQ_PENDSV || irq == KL_IRQ_SYSTICK || - (irq >= KL_IRQ_INTERRUPT && irq < NR_IRQS)); + (irq >= KL_IRQ_EXTINT && irq < NR_IRQS)); DEBUGASSERT(priority >= NVIC_SYSH_DISABLE_PRIORITY && priority <= NVIC_SYSH_PRIORITY_MIN); /* Check for external interrupt */ - if (irq >= KL_IRQ_INTERRUPT && irq < KL_IRQ_INTERRUPT + 32) + if (irq >= KL_IRQ_EXTINT && irq < (KL_IRQ_EXTINT + 32)) { /* ARMV6M_NVIC_IPR() maps register IPR0-IPR7 with four settings per * register. -- cgit v1.2.3