Use small lock to protect resources related to irq in arch ARM.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
This commit is contained in:
wangzhi16
2025-01-24 02:05:35 +08:00
committed by Xiang Xiao
parent 919ed2e3d4
commit c754019f5a
54 changed files with 614 additions and 237 deletions
+28 -16
View File
@@ -31,7 +31,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include "arm_internal.h"
@@ -40,6 +40,12 @@
#include "a1x_pio.h"
#include "a1x_irq.h"
/****************************************************************************
* Private Data
****************************************************************************/
static spinlock_t g_irq_lock = SP_UNLOCKED;
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -53,14 +59,10 @@
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static void a1x_dumpintc(const char *msg, int irq)
static void a1x_dumpintc_nolock(const char *msg, int irq)
{
irqstate_t flags;
/* Dump some relevant ARMv7 register contents */
flags = enter_critical_section();
irqinfo("ARMv7 (%s, irq=%d):\n", msg, irq);
irqinfo(" CPSR: %08x SCTLR: %08x\n", flags, cp15_rdsctlr());
@@ -95,10 +97,20 @@ static void a1x_dumpintc(const char *msg, int irq)
getreg32(A1X_INTC_PRIO0), getreg32(A1X_INTC_PRIO1),
getreg32(A1X_INTC_PRIO2), getreg32(A1X_INTC_PRIO3),
getreg32(A1X_INTC_PRIO4));
}
leave_critical_section(flags);
static void a1x_dumpintc(const char *msg, int irq)
{
irqstate_t flags;
flags = spin_lock_irqsave(&g_irq_lock);
a1x_dumpintc_nolock(msg, irq);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define a1x_dumpintc_nolock(msg, irq)
# define a1x_dumpintc(msg, irq)
#endif
@@ -297,7 +309,7 @@ void up_disable_irq(int irq)
{
/* These operations must be atomic */
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
/* Make sure that the interrupt is disabled. */
@@ -313,8 +325,8 @@ void up_disable_irq(int irq)
regval |= INTC_MASK(irq);
putreg32(regval, regaddr);
a1x_dumpintc("disable", irq);
leave_critical_section(flags);
a1x_dumpintc_nolock("disable", irq);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#ifdef CONFIG_A1X_PIO_IRQ
@@ -345,7 +357,7 @@ void up_enable_irq(int irq)
{
/* These operations must be atomic */
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
/* Make sure that the interrupt is enabled. */
@@ -361,8 +373,8 @@ void up_enable_irq(int irq)
regval &= ~INTC_MASK(irq);
putreg32(regval, regaddr);
a1x_dumpintc("enable", irq);
leave_critical_section(flags);
a1x_dumpintc_nolock("enable", irq);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#ifdef CONFIG_A1X_PIO_IRQ
@@ -398,7 +410,7 @@ int up_prioritize_irq(int irq, int priority)
{
/* These operations must be atomic */
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
/* Set the new priority */
@@ -408,8 +420,8 @@ int up_prioritize_irq(int irq, int priority)
regval |= INTC_PRIO(irq, priority);
putreg32(regval, regaddr);
a1x_dumpintc("prioritize", irq);
leave_critical_section(flags);
a1x_dumpintc_nolock("prioritize", irq);
spin_unlock_irqrestore(&g_irq_lock, flags);
return OK;
}
+2
View File
@@ -41,8 +41,10 @@
* Private Data
****************************************************************************/
#ifdef CONFIG_ARCH_IRQPRIO
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
#endif
/****************************************************************************
* Public Data
+11 -3
View File
@@ -31,7 +31,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -62,6 +62,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -79,7 +87,7 @@ static void at32_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -123,7 +131,7 @@ static void at32_dumpnvic(const char *msg, int irq)
irqinfo(" %08x\n",
getreg32(NVIC_IRQ64_67_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define at32_dumpnvic(msg, irq)
+15 -9
View File
@@ -31,7 +31,7 @@
#include <assert.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include "arm_internal.h"
#include "hardware/efm32_gpio.h"
@@ -44,6 +44,12 @@
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
static spinlock_t g_gpioirq_lock = SP_UNLOCKED;
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -198,7 +204,7 @@ void efm32_gpioirq(gpio_pinset_t pinset)
/* Make sure that the pin interrupt is disabled */
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_gpioirq_lock);
regval = getreg32(EFM32_GPIO_IEN);
regval &= ~bit;
putreg32(regval, EFM32_GPIO_IEN);
@@ -248,7 +254,7 @@ void efm32_gpioirq(gpio_pinset_t pinset)
}
putreg32(regval, EFM32_GPIO_EXTIFALL);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
}
/****************************************************************************
@@ -270,11 +276,11 @@ void efm32_gpioirqenable(int irq)
uint32_t regval;
uint32_t bit;
bit = ((uint32_t)1 << (irq - EFM32_IRQ_EXTI0));
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_gpioirq_lock);
regval = getreg32(EFM32_GPIO_IEN);
regval |= bit;
putreg32(regval, EFM32_GPIO_IEN);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
#else
bitband_set_peripheral(EFM32_GPIO_IEN, (irq - EFM32_IRQ_EXTI0), 1);
#endif
@@ -301,11 +307,11 @@ void efm32_gpioirqdisable(int irq)
uint32_t bit;
bit = ((uint32_t)1 << (irq - EFM32_IRQ_EXTI0));
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_gpioirq_lock);
regval = getreg32(EFM32_GPIO_IEN);
regval &= ~bit;
putreg32(regval, EFM32_GPIO_IEN);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
#else
bitband_set_peripheral(EFM32_GPIO_IEN, (irq - EFM32_IRQ_EXTI0), 0);
#endif
@@ -332,11 +338,11 @@ void efm32_gpioirqclear(int irq)
uint32_t bit;
bit = ((uint32_t)1 << (irq - EFM32_IRQ_EXTI0));
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_gpioirq_lock);
regval = getreg32(EFM32_GPIO_IFC);
regval |= bit;
putreg32(regval, EFM32_GPIO_IFC);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
#else
bitband_set_peripheral(EFM32_GPIO_IFC, (irq - EFM32_IRQ_EXTI0), 1);
#endif
+11 -3
View File
@@ -31,7 +31,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/armv7-m/nvicpri.h>
@@ -61,6 +61,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Function
****************************************************************************/
@@ -78,7 +86,7 @@ static void efm32_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -126,7 +134,7 @@ static void efm32_dumpnvic(const char *msg, int irq)
#endif
#endif
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define efm32_dumpnvic(msg, irq)
+11 -3
View File
@@ -31,7 +31,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/armv7-m/nvicpri.h>
@@ -60,6 +60,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -77,7 +85,7 @@ static void eoss3_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -107,7 +115,7 @@ static void eoss3_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ24_27_PRIORITY),
getreg32(NVIC_IRQ28_31_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define eoss3_dumpnvic(msg, irq)
+11 -3
View File
@@ -31,7 +31,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -62,6 +62,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -79,7 +87,7 @@ static void gd32_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -133,7 +141,7 @@ static void gd32_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ92_95_PRIORITY));
#endif
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define gd32_dumpnvic(msg, irq)
+5 -3
View File
@@ -33,7 +33,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include "arm_internal.h"
#include "imx9_gpio.h"
@@ -64,6 +64,8 @@ struct imx9_portisr_s
static struct imx9_portisr_s g_isrtab[IMX9_GPIO_NPORTS];
static spinlock_t g_gpioirq_lock = SP_UNLOCKED;
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -204,12 +206,12 @@ int imx9_gpioirq_attach(gpio_pinset_t pinset, xcpt_t isr, void *arg)
/* Atomically change the handler */
irqstate_t flags = enter_critical_section();
irqstate_t flags = spin_lock_irqsave(&g_gpioirq_lock);
g_isrtab[port].pins[pin].isr = isr;
g_isrtab[port].pins[pin].arg = arg;
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
return OK;
}
+11 -3
View File
@@ -32,7 +32,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -65,6 +65,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -82,7 +90,7 @@ static void imx9_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -210,7 +218,7 @@ static void imx9_dumpnvic(const char *msg, int irq)
# warning Missing logic
#endif
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define imx9_dumpnvic(msg, irq)
+11 -3
View File
@@ -31,7 +31,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -64,6 +64,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -81,7 +89,7 @@ static void imxrt_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -209,7 +217,7 @@ static void imxrt_dumpnvic(const char *msg, int irq)
# warning Missing logic
#endif
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define imxrt_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -59,6 +59,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -76,7 +84,7 @@ static void kinetis_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -139,7 +147,7 @@ static void kinetis_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ116_119_PRIORITY));
#endif
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define kinetis_dumpnvic(msg, irq)
+10 -4
View File
@@ -31,7 +31,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include "arm_internal.h"
@@ -95,6 +95,12 @@ static struct kinetis_pinirq_s g_portdisrs[32];
static struct kinetis_pinirq_s g_porteisrs[32];
#endif
/* Spinlock */
#ifdef HAVE_PORTINTS
static spinlock_t g_pinirq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -297,7 +303,7 @@ int kinetis_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg)
/* Get the table associated with this port */
DEBUGASSERT(port < KINETIS_NPORTS);
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_pinirq_lock);
switch (port)
{
#ifdef CONFIG_KINETIS_PORTAINTS
@@ -326,7 +332,7 @@ int kinetis_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg)
break;
#endif
default:
leave_critical_section(flags);
spin_unlock_irqrestore(&g_pinirq_lock, flags);
return -EINVAL;
}
@@ -337,7 +343,7 @@ int kinetis_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg)
/* And return the old PIN isr address */
leave_critical_section(flags);
spin_unlock_irqrestore(&g_pinirq_lock, flags);
return OK;
#else
return -ENOSYS;
+10 -4
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include "arm_internal.h"
@@ -89,6 +89,12 @@ static struct g_portisrs_s g_portaisrs[32];
static struct g_portisrs_s g_portdisrs[32];
#endif
/* Spinlock */
#ifdef HAVE_PORTINTS
static spinlock_t g_gpioirq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -251,7 +257,7 @@ int kl_gpioirqattach(uint32_t pinset, xcpt_t pinisr, void *pinarg)
/* Get the table associated with this port */
DEBUGASSERT(port < KL_NPORTS);
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_gpioirq_lock);
switch (port)
{
#ifdef CONFIG_KL_PORTAINTS
@@ -265,7 +271,7 @@ int kl_gpioirqattach(uint32_t pinset, xcpt_t pinisr, void *pinarg)
break;
#endif
default:
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
return NULL;
}
@@ -276,7 +282,7 @@ int kl_gpioirqattach(uint32_t pinset, xcpt_t pinisr, void *pinarg)
/* And return the old PIN isr address */
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
return OK;
#else
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -48,6 +48,14 @@
(NVIC_SYSH_PRIORITY_DEFAULT << 24 | NVIC_SYSH_PRIORITY_DEFAULT << 16 | \
NVIC_SYSH_PRIORITY_DEFAULT << 8 | NVIC_SYSH_PRIORITY_DEFAULT)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -65,7 +73,7 @@ static void kl_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" ISER: %08x ICER: %08x\n",
@@ -89,7 +97,7 @@ static void kl_dumpnvic(const char *msg, int irq)
irqinfo(" SHPR2: %08x SHPR3: %08x\n",
getreg32(ARMV6M_SYSCON_SHPR2), getreg32(ARMV6M_SYSCON_SHPR3));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
+2 -6
View File
@@ -30,7 +30,6 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/spinlock.h>
#include <nuttx/board.h>
@@ -124,7 +123,7 @@ static void lc823450_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_lc823450_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
getreg32(NVIC_INTCTRL), getreg32(NVIC_VECTAB));
@@ -166,7 +165,7 @@ static void lc823450_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ60_63_PRIORITY));
irqinfo(" %08x\n",
getreg32(NVIC_IRQ64_67_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_lc823450_irq_lock, flags);
}
#else
# define lc823450_dumpnvic(msg, irq)
@@ -186,7 +185,6 @@ static void lc823450_dumpnvic(const char *msg, int irq)
#ifdef CONFIG_DEBUG
static int lc823450_nmi(int irq, void *context, void *arg)
{
enter_critical_section();
irqinfo("PANIC!!! NMI received\n");
PANIC();
return 0;
@@ -194,7 +192,6 @@ static int lc823450_nmi(int irq, void *context, void *arg)
static int lc823450_pendsv(int irq, void *context, void *arg)
{
enter_critical_section();
irqinfo("PANIC!!! PendSV received\n");
PANIC();
return 0;
@@ -202,7 +199,6 @@ static int lc823450_pendsv(int irq, void *context, void *arg)
static int lc823450_reserved(int irq, void *context, void *arg)
{
enter_critical_section();
irqinfo("PANIC!!! Reserved interrupt\n");
PANIC();
return 0;
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -60,6 +60,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -77,7 +85,7 @@ static void lpc17_40_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -111,7 +119,7 @@ static void lpc17_40_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ40_43_PRIORITY),
getreg32(NVIC_IRQ44_47_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define lpc17_40_dumpnvic(msg, irq)
+11 -4
View File
@@ -29,12 +29,19 @@
#include <stdint.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/spinlock.h>
#include "arm.h"
#include "chip.h"
#include "arm_internal.h"
#include "lpc214x_vic.h"
/****************************************************************************
* Private Data
****************************************************************************/
static spinlock_t g_irq_lock = SP_UNLOCKED;
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -116,7 +123,7 @@ void up_enable_irq(int irq)
{
/* Disable all interrupts */
irqstate_t flags = enter_critical_section();
irqstate_t flags = spin_lock_irqsave(&g_irq_lock);
/* Enable the irq by setting the corresponding bit in the VIC
* Interrupt Enable register.
@@ -124,7 +131,7 @@ void up_enable_irq(int irq)
uint32_t val = vic_getreg(LPC214X_VIC_INTENABLE_OFFSET);
vic_putreg(val | (1 << irq), LPC214X_VIC_INTENABLE_OFFSET);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
}
@@ -147,7 +154,7 @@ void up_attach_vector(int irq, int vector, vic_vector_t handler)
/* Disable all interrupts */
irqstate_t flags = enter_critical_section();
irqstate_t flags = spin_lock_irqsave(&g_irq_lock);
/* Save the vector address */
@@ -158,7 +165,7 @@ void up_attach_vector(int irq, int vector, vic_vector_t handler)
vic_putreg(((irq << LPC214X_VECTCNTL_IRQSHIFT) |
LPC214X_VECTCNTL_ENABLE),
LPC214X_VIC_VECTCNTL0_OFFSET + offset);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
}
#endif
+11 -4
View File
@@ -46,6 +46,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/spinlock.h>
#include "arm.h"
#include "chip.h"
@@ -53,6 +54,12 @@
#include "lpc2378.h"
#include "lpc23xx_vic.h"
/****************************************************************************
* Private Data
****************************************************************************/
static spinlock_t g_irq_lock = SP_UNLOCKED;
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -153,7 +160,7 @@ void up_enable_irq(int irq)
{
/* Disable all interrupts */
irqstate_t flags = enter_critical_section();
irqstate_t flags = spin_lock_irqsave(&g_irq_lock);
/* Enable the irq by setting the corresponding bit in the VIC Interrupt
* Enable register.
@@ -161,7 +168,7 @@ void up_enable_irq(int irq)
uint32_t val = vic_getreg(VIC_INTENABLE_OFFSET);
vic_putreg(val | (1 << irq), VIC_INTENABLE_OFFSET);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
}
@@ -239,7 +246,7 @@ void up_attach_vector(int irq, int vector, vic_vector_t handler)
/* Disable all interrupts */
irqstate_t flags = enter_critical_section();
irqstate_t flags = spin_lock_irqsave(&g_irq_lock);
/* Save the vector address */
@@ -250,7 +257,7 @@ void up_attach_vector(int irq, int vector, vic_vector_t handler)
uint32_t val = vic_getreg(VIC_INTENABLE_OFFSET);
vic_putreg(val | (1 << irq), VIC_INTENABLE_OFFSET);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
}
#endif
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -60,6 +60,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -77,7 +85,7 @@ static void lpc43_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -117,7 +125,7 @@ static void lpc43_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ52_55_PRIORITY),
getreg32(NVIC_IRQ56_59_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define lpc43_dumpnvic(msg, irq)
+11 -7
View File
@@ -30,7 +30,7 @@
#include <errno.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include "arm_internal.h"
#include "hardware/lpc54_syscon.h"
@@ -71,6 +71,10 @@ static const uint8_t g_pinirq[MAX_PININT] =
LPC54_IRQ_PININT4, LPC54_IRQ_PININT5, LPC54_IRQ_PININT6, LPC54_IRQ_PININT7
};
/* Spinlock */
static spinlock_t g_gpioirq_lock = SP_UNLOCKED;
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -86,7 +90,7 @@ static const uint8_t g_pinirq[MAX_PININT] =
static int lpc54_alloc_pinint(lpc54_pinset_t pinset)
{
irqstate_t flags = enter_critical_section();
irqstate_t flags = spin_lock_irqsave(&g_gpioirq_lock);
int pin;
/* REVISIT: This is overlying complex in the current design. There is
@@ -102,12 +106,12 @@ static int lpc54_alloc_pinint(lpc54_pinset_t pinset)
if ((g_pinints & mask) == 0)
{
g_pinints |= mask;
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
return pin;
}
}
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
return -ENOSPC;
}
@@ -284,7 +288,7 @@ int lpc54_gpio_irqno(lpc54_pinset_t pinset)
int portpin = pinset & GPIO_PORTPIN_MASK;
int i;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_gpioirq_lock);
/* Find the PININT index that as the assignment to the this port and pin */
@@ -295,12 +299,12 @@ int lpc54_gpio_irqno(lpc54_pinset_t pinset)
regval = getreg32(regaddr) & GPIO_PORTPIN_MASK;
if (regval == portpin)
{
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
return (int)g_pinirq[i];
}
}
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
return -ENOENT;
}
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -59,6 +59,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -76,7 +84,7 @@ static void lpc54_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -116,7 +124,7 @@ static void lpc54_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ52_55_PRIORITY),
getreg32(NVIC_IRQ56_59_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define lpc54_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -59,6 +59,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -76,7 +84,7 @@ static void max326_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -117,7 +125,7 @@ static void max326_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ56_59_PRIORITY),
getreg32(NVIC_IRQ60_63_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define max326_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -60,6 +60,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -77,7 +85,7 @@ static void mx8mp_dump_nvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -147,7 +155,7 @@ static void mx8mp_dump_nvic(const char *msg, int irq)
irqinfo(" %08x %08x\n",
getreg32(NVIC_IRQ144_147_PRIORITY),
getreg32(NVIC_IRQ148_151_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define mx8mp_dump_nvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -61,6 +61,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -78,7 +86,7 @@ static void nrf52_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -118,7 +126,7 @@ static void nrf52_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ52_55_PRIORITY),
getreg32(NVIC_IRQ56_59_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define nrf52_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv8-m/nvicpri.h>
@@ -61,6 +61,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -78,7 +86,7 @@ static void nrf53_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -118,7 +126,7 @@ static void nrf53_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ52_55_PRIORITY),
getreg32(NVIC_IRQ56_59_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define nrf53_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv8-m/nvicpri.h>
@@ -61,6 +61,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -78,7 +86,7 @@ static void nrf91_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -118,7 +126,7 @@ static void nrf91_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ52_55_PRIORITY),
getreg32(NVIC_IRQ56_59_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define nrf91_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -48,6 +48,14 @@
(NVIC_SYSH_PRIORITY_DEFAULT << 24 | NVIC_SYSH_PRIORITY_DEFAULT << 16 | \
NVIC_SYSH_PRIORITY_DEFAULT << 8 | NVIC_SYSH_PRIORITY_DEFAULT)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -65,7 +73,7 @@ static void nuc_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" ISER: %08x ICER: %08x\n",
@@ -89,7 +97,7 @@ static void nuc_dumpnvic(const char *msg, int irq)
irqinfo(" SHPR2: %08x SHPR3: %08x\n",
getreg32(ARMV6M_SYSCON_SHPR2), getreg32(ARMV6M_SYSCON_SHPR3));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -52,6 +52,14 @@
# define INTSTACK_ALLOC (CONFIG_SMP_NCPUS * INTSTACK_SIZE)
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Public Data
****************************************************************************/
@@ -95,7 +103,7 @@ static void rp2040_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" ISER: %08x ICER: %08x\n",
@@ -119,7 +127,7 @@ static void rp2040_dumpnvic(const char *msg, int irq)
irqinfo(" SHPR2: %08x SHPR3: %08x\n",
getreg32(ARMV6M_SYSCON_SHPR2), getreg32(ARMV6M_SYSCON_SHPR3));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -52,6 +52,14 @@
# define INTSTACK_ALLOC (CONFIG_SMP_NCPUS * INTSTACK_SIZE)
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Public Data
****************************************************************************/
@@ -95,7 +103,7 @@ static void rp23xx_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" ISER0: %08x ICER0: %08x\n",
@@ -137,7 +145,7 @@ static void rp23xx_dumpnvic(const char *msg, int irq)
irqinfo(" SHPR3: %08x\n",
getreg32(NVIC_SYSH12_15_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -49,6 +49,14 @@
(NVIC_SYSH_PRIORITY_DEFAULT << 24 | NVIC_SYSH_PRIORITY_DEFAULT << 16 | \
NVIC_SYSH_PRIORITY_DEFAULT << 8 | NVIC_SYSH_PRIORITY_DEFAULT)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -279,7 +287,7 @@ void s32k11x_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" ISER: %08x ICER: %08x\n",
@@ -303,7 +311,7 @@ void s32k11x_dumpnvic(const char *msg, int irq)
irqinfo(" SHPR2: %08x SHPR3: %08x\n",
getreg32(ARMV6M_SYSCON_SHPR2), getreg32(ARMV6M_SYSCON_SHPR3));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -59,6 +59,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -76,7 +84,7 @@ static void s32k14x_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -151,7 +159,7 @@ static void s32k14x_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ152_155_PRIORITY),
getreg32(NVIC_IRQ156_159_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define s32k14x_dumpnvic(msg, irq)
+10 -4
View File
@@ -31,7 +31,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include "arm_internal.h"
@@ -95,6 +95,12 @@ static struct s32k1xx_pinirq_s g_portdisrs[32];
static struct s32k1xx_pinirq_s g_porteisrs[32];
#endif
/* Spinlock */
#ifdef HAVE_PORTINTS
static spinlock_t g_pinirq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -297,7 +303,7 @@ int s32k1xx_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg)
/* Get the table associated with this port */
DEBUGASSERT(port < S32K1XX_NPORTS);
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_pinirq_lock);
switch (port)
{
#ifdef CONFIG_S32K1XX_PORTAINTS
@@ -326,7 +332,7 @@ int s32k1xx_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg)
break;
#endif
default:
leave_critical_section(flags);
spin_unlock_irqrestore(&g_pinirq_lock, flags);
return -EINVAL;
}
@@ -337,7 +343,7 @@ int s32k1xx_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg)
/* And return the old PIN isr address */
leave_critical_section(flags);
spin_unlock_irqrestore(&g_pinirq_lock, flags);
return OK;
#else
return -ENOSYS;
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -64,6 +64,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -81,7 +89,7 @@ static void s32k3xx_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -156,7 +164,7 @@ static void s32k3xx_dumpnvic(const char *msg, int irq)
getreg32(NVIC_IRQ152_155_PRIORITY),
getreg32(NVIC_IRQ156_159_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define s32k3xx_dumpnvic(msg, irq)
+7 -5
View File
@@ -31,7 +31,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include "arm_internal.h"
@@ -75,6 +75,8 @@ static struct s32k3xx_pinirq_s g_eirqisrs[32];
static struct s32k3xx_pinirq_s g_wkpuisrs[60];
#endif
static spinlock_t g_pinirq_lock = SP_UNLOCKED;
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -280,12 +282,12 @@ int s32k3xx_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg)
/* Attach the interrupt handler */
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_pinirq_lock);
g_eirqisrs[index].handler = pinisr;
g_eirqisrs[index].arg = arg;
leave_critical_section(flags);
spin_unlock_irqrestore(&g_pinirq_lock, flags);
return OK;
}
#endif /* CONFIG_S32K3XX_EIRQINTS */
@@ -299,12 +301,12 @@ int s32k3xx_pinirqattach(uint32_t pinset, xcpt_t pinisr, void *arg)
/* Attach the interrupt handler */
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_pinirq_lock);
g_wkpuisrs[index].handler = pinisr;
g_wkpuisrs[index].arg = arg;
leave_critical_section(flags);
spin_unlock_irqrestore(&g_pinirq_lock, flags);
return OK;
}
#endif /* CONFIG_S32K3XX_WKPUINTS */
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -62,6 +62,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -79,7 +87,7 @@ static void sam_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -137,7 +145,7 @@ static void sam_dumpnvic(const char *msg, int irq)
# warning Missing logic
#endif
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define sam_dumpnvic(msg, irq)
+15 -14
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -92,6 +92,12 @@ static const uint32_t g_h64mxpids[3] =
};
#endif
/****************************************************************************
* Private Data
****************************************************************************/
static spinlock_t g_irq_lock = SP_UNLOCKED;
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -107,9 +113,6 @@ static const uint32_t g_h64mxpids[3] =
#if defined(CONFIG_DEBUG_IRQ_INFO)
static void sam_dumpaic(const char *msg, uintptr_t base, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
irqinfo("AIC (%s, base=%08x irq=%d):\n", msg, base, irq);
/* Select the register set associated with this irq */
@@ -151,8 +154,6 @@ static void sam_dumpaic(const char *msg, uintptr_t base, int irq)
getreg32(base + SAM_AIC_DCR_OFFSET),
getreg32(base + SAM_AIC_WPMR_OFFSET),
getreg32(base + SAM_AIC_WPSR_OFFSET));
leave_critical_section(flags);
}
#else
# define sam_dumpaic(msg, base, irq)
@@ -670,7 +671,7 @@ static void sam_disable_irq(uintptr_t base, int irq)
{
/* These operations must be atomic */
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
/* Select the register set associated with this irq */
@@ -680,7 +681,7 @@ static void sam_disable_irq(uintptr_t base, int irq)
putreg32(AIC_IDCR_INTD, base + SAM_AIC_IDCR_OFFSET);
sam_dumpaic("disable", base, irq);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#ifdef CONFIG_SAMA5_PIO_IRQ
else
@@ -722,7 +723,7 @@ static void sam_enable_irq(uintptr_t base, int irq)
{
/* These operations must be atomic */
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
/* Select the register set associated with this irq */
@@ -732,7 +733,7 @@ static void sam_enable_irq(uintptr_t base, int irq)
putreg32(AIC_IECR_INTEN, base + SAM_AIC_IECR_OFFSET);
sam_dumpaic("enable", base, irq);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#ifdef CONFIG_SAMA5_PIO_IRQ
else
@@ -781,7 +782,7 @@ static int sam_prioritize_irq(uint32_t base, int irq, int priority)
{
/* These operations must be atomic */
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
/* Select the register set associated with this irq */
@@ -802,7 +803,7 @@ static int sam_prioritize_irq(uint32_t base, int irq, int priority)
putreg32(AIC_WPMR_WPKEY | AIC_WPMR_WPEN, base + SAM_AIC_WPMR_OFFSET);
sam_dumpaic("prioritize", base, irq);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
return OK;
@@ -844,7 +845,7 @@ static void _sam_irq_srctype(uintptr_t base, int irq,
/* These operations must be atomic */
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
/* Select the register set associated with this irq */
@@ -865,7 +866,7 @@ static void _sam_irq_srctype(uintptr_t base, int irq,
putreg32(AIC_WPMR_WPKEY | AIC_WPMR_WPEN, base + SAM_AIC_WPMR_OFFSET);
sam_dumpaic("srctype", base, irq);
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
void sam_irq_srctype(int irq, enum sam_srctype_e srctype)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -48,6 +48,14 @@
(NVIC_SYSH_PRIORITY_DEFAULT << 24 | NVIC_SYSH_PRIORITY_DEFAULT << 16 | \
NVIC_SYSH_PRIORITY_DEFAULT << 8 | NVIC_SYSH_PRIORITY_DEFAULT)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -270,7 +278,7 @@ void sam_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" ISER: %08x ICER: %08x\n",
@@ -294,7 +302,7 @@ void sam_dumpnvic(const char *msg, int irq)
irqinfo(" SHPR2: %08x SHPR3: %08x\n",
getreg32(ARMV6M_SYSCON_SHPR2), getreg32(ARMV6M_SYSCON_SHPR3));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -62,6 +62,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -79,7 +87,7 @@ static void sam_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -175,7 +183,7 @@ static void sam_dumpnvic(const char *msg, int irq)
# warning Missing logic
#endif
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define sam_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -64,6 +64,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -81,7 +89,7 @@ static void sam_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -139,7 +147,7 @@ static void sam_dumpnvic(const char *msg, int irq)
# warning Missing logic
#endif
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define sam_dumpnvic(msg, irq)
+13 -3
View File
@@ -31,7 +31,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -62,6 +62,16 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -79,7 +89,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -123,7 +133,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
irqinfo(" %08x\n",
getreg32(NVIC_IRQ64_67_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define stm32_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -49,6 +49,14 @@
(NVIC_SYSH_PRIORITY_DEFAULT << 24 | NVIC_SYSH_PRIORITY_DEFAULT << 16 | \
NVIC_SYSH_PRIORITY_DEFAULT << 8 | NVIC_SYSH_PRIORITY_DEFAULT)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -66,7 +74,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" ISER: %08x ICER: %08x\n",
@@ -90,7 +98,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
irqinfo(" SHPR2: %08x SHPR3: %08x\n",
getreg32(ARMV6M_SYSCON_SHPR2), getreg32(ARMV6M_SYSCON_SHPR3));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -63,6 +63,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -80,7 +88,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08" PRIx32 " VECTAB: %08" PRIx32 "\n",
@@ -159,7 +167,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
# warning Missing logic
#endif
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define stm32_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv8-m/nvicpri.h>
@@ -59,6 +59,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -76,7 +84,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -105,7 +113,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
irqinfo(" %08x\n",
getreg32(NVIC_IRQ64_67_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define stm32_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
@@ -63,6 +63,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -80,7 +88,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -154,7 +162,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
/* TODO: Make sure this covers all interrupts that are available. */
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define stm32_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -59,6 +59,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -76,7 +84,7 @@ static void stm32l4_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -120,7 +128,7 @@ static void stm32l4_dumpnvic(const char *msg, int irq)
irqinfo(" %08x\n",
getreg32(NVIC_IRQ64_67_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define stm32l4_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv8-m/nvicpri.h>
@@ -59,6 +59,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -76,7 +84,7 @@ static void stm32l5_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -105,7 +113,7 @@ static void stm32l5_dumpnvic(const char *msg, int irq)
irqinfo(" %08x\n",
getreg32(NVIC_IRQ64_67_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define stm32l5_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv8-m/nvicpri.h>
@@ -59,6 +59,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -76,7 +84,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -105,7 +113,7 @@ static void stm32_dumpnvic(const char *msg, int irq)
irqinfo(" %08x\n",
getreg32(NVIC_IRQ64_67_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define stm32_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <debug.h>
#include <assert.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include "arm_internal.h"
@@ -60,6 +60,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -77,7 +85,7 @@ static void stm32wb_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -121,7 +129,7 @@ static void stm32wb_dumpnvic(const char *msg, int irq)
irqinfo(" %08x\n",
getreg32(NVIC_IRQ64_67_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define stm32wb_dumpnvic(msg, irq)
+11 -3
View File
@@ -30,7 +30,7 @@
#include <assert.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include <arch/armv7-m/nvicpri.h>
@@ -59,6 +59,14 @@
#define NVIC_ENA_OFFSET (0)
#define NVIC_CLRENA_OFFSET (NVIC_IRQ0_31_CLEAR - NVIC_IRQ0_31_ENABLE)
/****************************************************************************
* Private Data
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
static spinlock_t g_irq_lock = SP_UNLOCKED;
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -76,7 +84,7 @@ static void stm32wl5_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_irq_lock);
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
@@ -120,7 +128,7 @@ static void stm32wl5_dumpnvic(const char *msg, int irq)
irqinfo(" %08x\n",
getreg32(NVIC_IRQ64_67_PRIORITY));
leave_critical_section(flags);
spin_unlock_irqrestore(&g_irq_lock, flags);
}
#else
# define stm32wl5_dumpnvic(msg, irq)
+7 -3
View File
@@ -26,7 +26,7 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include <nuttx/spinlock.h>
#include <stdint.h>
#include <string.h>
@@ -61,6 +61,10 @@ struct gpio_handler_s
static struct gpio_handler_s g_gpio_inthandler[TIVA_NIRQ_PINS];
/* Spinlock */
static spinlock_t g_gpioirq_lock = SP_UNLOCKED;
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -176,7 +180,7 @@ int tiva_gpioirqattach(pinconfig_t pinconfig, xcpt_t isr, void *arg)
if (dio < TIVA_NDIO)
{
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_gpioirq_lock);
/* If the new ISR is NULL, then the ISR is being detached.
* In this case, disable the ISR and direct any interrupts
@@ -199,7 +203,7 @@ int tiva_gpioirqattach(pinconfig_t pinconfig, xcpt_t isr, void *arg)
tiva_gpioirqenable(pinconfig);
}
leave_critical_section(flags);
spin_unlock_irqrestore(&g_gpioirq_lock, flags);
}
return OK;

Some files were not shown because too many files have changed in this diff Show More