From dada5301b1fad1a81ecab220f2b939ebf66fbba9 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 15 Jan 2014 08:09:19 -0600 Subject: Individual IRQs are not longer disabled on each interrupt. See ChangeLog for detailed explanation --- nuttx/ChangeLog | 10 ++++++++-- nuttx/arch/arm/src/armv6-m/up_doirq.c | 10 +++------- nuttx/arch/arm/src/armv7-m/up_doirq.c | 10 +++------- nuttx/arch/arm/src/common/up_internal.h | 12 +++++++----- nuttx/arch/arm/src/kinetis/kinetis_irq.c | 9 +++------ nuttx/arch/arm/src/kl/kl_irq.c | 17 +++++------------ nuttx/arch/arm/src/lm/lm_irq.c | 11 ++++++----- nuttx/arch/arm/src/lpc17xx/lpc17_irq.c | 13 ++++++------- nuttx/arch/arm/src/lpc43xx/lpc43_irq.c | 13 ++++++------- nuttx/arch/arm/src/nuc1xx/nuc_irq.c | 15 ++++----------- nuttx/arch/arm/src/sam34/sam_irq.c | 9 ++++----- nuttx/arch/arm/src/stm32/stm32_irq.c | 9 ++++----- 12 files changed, 59 insertions(+), 79 deletions(-) (limited to 'nuttx') diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 061def0d3..fb58b6c18 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -6432,7 +6432,7 @@ Unfortunately, it does not yet work (2013-1-14). * configs/px4fmu-v2_upstream: Configuration for testing simple configurations on the the PX4FMU v2. This version is incomplete - for the PX4 appliation and is not a replacement for the version + for the PX4 application and is not a replacement for the version in the PX4 GIT repository. * fs/fat/fs_fat32.c: A correction to FAT cluster allocation from Tridge via Lorenz Meier (2014-1-14). @@ -6446,4 +6446,10 @@ conditionally done only for FAT 32. Apparently this needs to done for all FAT types. From Tridge via Lorenz Meier (2014-1-14). - + * arch/arm/src/armv6-m/up_doirq.c and armv7-m/up_doirq.c and all + implementations of up_mask_acq() for all Cortex-M architectures: Do + not disable and enable the IRQ on each interrupt. Because (1) + interrupts are already disabled on interrupt entry, (2) this + interferes with controlling the IRQ interrrupt setting from interrupt + handlers, and (3) up_disable_irq() does not work anyway so that this + has never done anything (2014-1-15). diff --git a/nuttx/arch/arm/src/armv6-m/up_doirq.c b/nuttx/arch/arm/src/armv6-m/up_doirq.c index 2edbc55dd..cf77bc47b 100644 --- a/nuttx/arch/arm/src/armv6-m/up_doirq.c +++ b/nuttx/arch/arm/src/armv6-m/up_doirq.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv6-m/up_doirq.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -93,9 +93,9 @@ uint32_t *up_doirq(int irq, uint32_t *regs) savestate = (uint32_t*)current_regs; current_regs = regs; - /* Mask and acknowledge the interrupt */ + /* Acknowledge the interrupt */ - up_maskack_irq(irq); + up_ack_irq(irq); /* Deliver the IRQ */ @@ -115,10 +115,6 @@ uint32_t *up_doirq(int irq, uint32_t *regs) */ current_regs = savestate; - - /* Unmask the last interrupt (global interrupts are still disabled) */ - - up_enable_irq(irq); #endif up_ledoff(LED_INIRQ); return regs; diff --git a/nuttx/arch/arm/src/armv7-m/up_doirq.c b/nuttx/arch/arm/src/armv7-m/up_doirq.c index d8a1446de..5cb93bfc9 100644 --- a/nuttx/arch/arm/src/armv7-m/up_doirq.c +++ b/nuttx/arch/arm/src/armv7-m/up_doirq.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-m/up_doirq.c * - * Copyright (C) 2009, 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -93,9 +93,9 @@ uint32_t *up_doirq(int irq, uint32_t *regs) savestate = (uint32_t*)current_regs; current_regs = regs; - /* Mask and acknowledge the interrupt */ + /* Acknowledge the interrupt */ - up_maskack_irq(irq); + up_ack_irq(irq); /* Deliver the IRQ */ @@ -115,10 +115,6 @@ uint32_t *up_doirq(int irq, uint32_t *regs) */ current_regs = savestate; - - /* Unmask the last interrupt (global interrupts are still disabled) */ - - up_enable_irq(irq); #endif up_ledoff(LED_INIRQ); return regs; diff --git a/nuttx/arch/arm/src/common/up_internal.h b/nuttx/arch/arm/src/common/up_internal.h index eb3ca896a..20ae8dc73 100644 --- a/nuttx/arch/arm/src/common/up_internal.h +++ b/nuttx/arch/arm/src/common/up_internal.h @@ -1,7 +1,7 @@ /**************************************************************************** * common/up_internal.h * - * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -313,15 +313,15 @@ void up_systemreset(void) noreturn_function; /* Interrupt handling *******************************************************/ void up_irqinitialize(void); -void up_maskack_irq(int irq); /* Exception handling logic unique to the Cortex-M family */ #if defined(CONFIG_ARCH_CORTEXM0) || defined(CONFIG_ARCH_CORTEXM3) || \ defined(CONFIG_ARCH_CORTEXM4) -/* Interrupt dispatch */ +/* Interrupt acknowledge and dispatch */ +void up_ack_irq(int irq); uint32_t *up_doirq(int irq, uint32_t *regs); /* Exception Handlers */ @@ -341,8 +341,9 @@ int up_memfault(int irq, FAR void *context); #elif defined(CONFIG_ARCH_CORTEXA5) || defined(CONFIG_ARCH_CORTEXA8) -/* Interrupt dispatch */ +/* Interrupt acknowledge and dispatch */ +void up_maskack_irq(int irq); uint32_t *arm_doirq(int irq, uint32_t *regs); /* Paging support */ @@ -365,8 +366,9 @@ uint32_t *arm_undefinedinsn(uint32_t *regs); #else /* ARM7 | ARM9 */ -/* Interrupt dispatch */ +/* Interrupt acknowledge and dispatch */ +void up_maskack_irq(int irq); void up_doirq(int irq, uint32_t *regs); /* Paging support (and exception handlers) */ diff --git a/nuttx/arch/arm/src/kinetis/kinetis_irq.c b/nuttx/arch/arm/src/kinetis/kinetis_irq.c index 5deda2a16..af62b466f 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_irq.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_irq.c @@ -1,6 +1,5 @@ /**************************************************************************** * arch/arm/src/lpc17/kinetis_irq.c - * arch/arm/src/chip/kinetis_irq.c * * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -478,17 +477,15 @@ void up_enable_irq(int irq) } /**************************************************************************** - * Name: up_maskack_irq + * Name: up_ack_irq * * Description: - * Mask the IRQ and acknowledge it + * Acknowledge the IRQ * ****************************************************************************/ -void up_maskack_irq(int irq) +void up_ack_irq(int irq) { - up_disable_irq(irq); - #if 0 /* Does not appear to be necessary in most cases */ kinetis_clrpend(irq); #endif diff --git a/nuttx/arch/arm/src/kl/kl_irq.c b/nuttx/arch/arm/src/kl/kl_irq.c index 1e0477318..127a667a6 100644 --- a/nuttx/arch/arm/src/kl/kl_irq.c +++ b/nuttx/arch/arm/src/kl/kl_irq.c @@ -1,8 +1,7 @@ /**************************************************************************** * arch/arm/src/stm32/kl_irq.c - * arch/arm/src/chip/kl_irq.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -258,11 +257,6 @@ void up_irqinitialize(void) void up_disable_irq(int irq) { - /* This will be called on each interrupt (via up_maskack_irq()) whether - * the interrupt can be disabled or not. So this assertion is necessarily - * lame. - */ - DEBUGASSERT((unsigned)irq < NR_IRQS); /* Check for an external interrupt */ @@ -297,7 +291,7 @@ void up_disable_irq(int irq) void up_enable_irq(int irq) { /* This will be called on each interrupt exit whether the interrupt can be - * enambled or not. So this assertion is necessarily lame. + * enabled or not. So this assertion is necessarily lame. */ DEBUGASSERT((unsigned)irq < NR_IRQS); @@ -324,15 +318,14 @@ void up_enable_irq(int irq) } /**************************************************************************** - * Name: up_maskack_irq + * Name: up_ack_irq * * Description: - * Mask the IRQ and acknowledge it + * Acknowledge the IRQ * ****************************************************************************/ -void up_maskack_irq(int irq) +void up_ack_irq(int irq) { - up_disable_irq(irq); kl_clrpend(irq); } diff --git a/nuttx/arch/arm/src/lm/lm_irq.c b/nuttx/arch/arm/src/lm/lm_irq.c index 0ef8d2197..de5b75bd3 100644 --- a/nuttx/arch/arm/src/lm/lm_irq.c +++ b/nuttx/arch/arm/src/lm/lm_irq.c @@ -2,7 +2,7 @@ * arch/arm/src/lm/lm_irq.c * arch/arm/src/chip/lm_irq.c * - * Copyright (C) 2009, 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -402,6 +402,7 @@ void up_disable_irq(int irq) regval &= ~bit; putreg32(regval, regaddr); } + lm_dumpnvic("disable", irq); } @@ -427,20 +428,20 @@ void up_enable_irq(int irq) regval |= bit; putreg32(regval, regaddr); } + lm_dumpnvic("enable", irq); } /**************************************************************************** - * Name: up_maskack_irq + * Name: up_ack_irq * * Description: - * Mask the IRQ and acknowledge it + * Acknowledge the IRQ * ****************************************************************************/ -void up_maskack_irq(int irq) +void up_ack_irq(int irq) { - up_disable_irq(irq); } /**************************************************************************** diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c index 840574fab..a3fd9043d 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c @@ -1,8 +1,7 @@ /**************************************************************************** * arch/arm/src/lpc17/lpc17_irq.c - * arch/arm/src/chip/lpc17_irq.c * - * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -404,6 +403,7 @@ void up_disable_irq(int irq) lpc17_gpioirqdisable(irq); } #endif + lpc17_dumpnvic("disable", irq); } @@ -437,21 +437,20 @@ void up_enable_irq(int irq) lpc17_gpioirqenable(irq); } #endif + lpc17_dumpnvic("enable", irq); } /**************************************************************************** - * Name: up_maskack_irq + * Name: up_ack_irq * * Description: - * Mask the IRQ and acknowledge it + * Acknowledge the IRQ * ****************************************************************************/ -void up_maskack_irq(int irq) +void up_ack_irq(int irq) { - up_disable_irq(irq); - #if 0 /* Does not appear to be necessary in most cases */ lpc17_clrpend(irq); #endif diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c b/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c index 779a9c50c..c9e130fd4 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c @@ -1,8 +1,7 @@ /**************************************************************************** * arch/arm/src/lpc43/lpc43_irq.c - * arch/arm/src/chip/lpc43_irq.c * - * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -442,6 +441,7 @@ void up_disable_irq(int irq) lpc43_gpioint_disable(irq); } #endif + lpc43_dumpnvic("disable", irq); } @@ -475,21 +475,20 @@ void up_enable_irq(int irq) lpc43_gpioint_enable(irq); } #endif + lpc43_dumpnvic("enable", irq); } /**************************************************************************** - * Name: up_maskack_irq + * Name: up_ack_irq * * Description: - * Mask the IRQ and acknowledge it + * Acknowledge the IRQ * ****************************************************************************/ -void up_maskack_irq(int irq) +void up_ack_irq(int irq) { - up_disable_irq(irq); - #if 0 /* Does not appear to be necessary in most cases */ lpc43_clrpend(irq); #endif diff --git a/nuttx/arch/arm/src/nuc1xx/nuc_irq.c b/nuttx/arch/arm/src/nuc1xx/nuc_irq.c index b6198ff42..e45121b13 100644 --- a/nuttx/arch/arm/src/nuc1xx/nuc_irq.c +++ b/nuttx/arch/arm/src/nuc1xx/nuc_irq.c @@ -1,8 +1,7 @@ /**************************************************************************** * arch/arm/src/stm32/nuc_irq.c - * arch/arm/src/chip/nuc_irq.c * - * Copyright (C) 2009-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -258,11 +257,6 @@ void up_irqinitialize(void) void up_disable_irq(int irq) { - /* This will be called on each interrupt (via up_maskack_irq()) whether - * the interrupt can be disabled or not. So this assertion is necessarily - * lame. - */ - DEBUGASSERT((unsigned)irq < NR_IRQS); /* Check for an external interrupt */ @@ -324,16 +318,15 @@ void up_enable_irq(int irq) } /**************************************************************************** - * Name: up_maskack_irq + * Name: up_ack_irq * * Description: - * Mask the IRQ and acknowledge it + * Acknowledge the IRQ * ****************************************************************************/ -void up_maskack_irq(int irq) +void up_ack_irq(int irq) { - up_disable_irq(irq); nuc_clrpend(irq); } diff --git a/nuttx/arch/arm/src/sam34/sam_irq.c b/nuttx/arch/arm/src/sam34/sam_irq.c index e2117ff09..1cac7da7c 100644 --- a/nuttx/arch/arm/src/sam34/sam_irq.c +++ b/nuttx/arch/arm/src/sam34/sam_irq.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/sam34/sam_irq.c * - * Copyright (C) 2009, 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -507,16 +507,15 @@ void up_enable_irq(int irq) } /**************************************************************************** - * Name: up_maskack_irq + * Name: up_ack_irq * * Description: - * Mask the IRQ and acknowledge it + * Acknowledge the IRQ * ****************************************************************************/ -void up_maskack_irq(int irq) +void up_ack_irq(int irq) { - up_disable_irq(irq); } /**************************************************************************** diff --git a/nuttx/arch/arm/src/stm32/stm32_irq.c b/nuttx/arch/arm/src/stm32/stm32_irq.c index e3fae743b..1e866cd38 100644 --- a/nuttx/arch/arm/src/stm32/stm32_irq.c +++ b/nuttx/arch/arm/src/stm32/stm32_irq.c @@ -2,7 +2,7 @@ * arch/arm/src/stm32/stm32_irq.c * arch/arm/src/chip/stm32_irq.c * - * Copyright (C) 2009-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -458,16 +458,15 @@ void up_enable_irq(int irq) } /**************************************************************************** - * Name: up_maskack_irq + * Name: up_ack_irq * * Description: - * Mask the IRQ and acknowledge it + * Acknowledge the IRQ * ****************************************************************************/ -void up_maskack_irq(int irq) +void up_ack_irq(int irq) { - up_disable_irq(irq); } /**************************************************************************** -- cgit v1.2.3