Skip to content
Snippets Groups Projects
Commit 10394cb4 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

Fix KL25Z interrupt enable/disable logic

parent 8e5ae388
Branches
Tags
No related merge requests found
......@@ -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"
......
......@@ -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"
......
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment