You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gu...@apache.org on 2021/08/20 16:17:30 UTC
[incubator-nuttx] branch master updated (c826c37 -> 2925d49)
This is an automated email from the ASF dual-hosted git repository.
gustavonihei pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.
from c826c37 nuttx/up_backtrace: add up_backtrace interface
new 633cdf8 arch/xtensa/esp32: Map NuttX's IRQs to ESP32 CPU interrupts.
new 97dca8f arch/xtensa/esp32: Use the same g_intenable shadows in cpuint.c and irq.c
new 5be9f24 arch/xtensa/esp32: Disable the CPU interrupt right when it's alloacted.
new 56a7f3b arch/xtensa/esp32: Update the drivers regarding the API change in IRQ handling.
new 5d626f7 xtensa/esp32_irq.c: Hard code special IRQs in the IRQ map. These IRQs are do not go through the regular process where we attache the CPU interrupt to a peripheral and update our map, also, they are fixed and a have reserved CPU interrupt, thus hard code their values at startup.
new 2925d49 xtensa/esp32: Use up_cpu_index instead of this_cpu.
The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
arch/xtensa/src/esp32/esp32_cpuint.c | 77 +++++-------
arch/xtensa/src/esp32/esp32_cpuint.h | 10 ++
arch/xtensa/src/esp32/esp32_cpustart.c | 3 +-
arch/xtensa/src/esp32/esp32_emac.c | 5 +-
arch/xtensa/src/esp32/esp32_gpio.c | 11 +-
arch/xtensa/src/esp32/esp32_i2c.c | 5 +-
arch/xtensa/src/esp32/esp32_irq.c | 130 ++++++++++++++++++++-
.../src/esp32/esp32_irq.h} | 40 +++----
arch/xtensa/src/esp32/esp32_serial.c | 21 ++--
arch/xtensa/src/esp32/esp32_spi.c | 5 +-
arch/xtensa/src/esp32/esp32_spi_slave.c | 7 +-
arch/xtensa/src/esp32/esp32_tickless.c | 4 +-
arch/xtensa/src/esp32/esp32_tim.c | 6 +-
arch/xtensa/src/esp32/esp32_timerisr.c | 2 +-
arch/xtensa/src/esp32/esp32_wdt.c | 8 +-
arch/xtensa/src/esp32/esp32_wifi_adapter.c | 4 +-
16 files changed, 224 insertions(+), 114 deletions(-)
copy arch/{risc-v/src/bl602/bl602_spiflash.h => xtensa/src/esp32/esp32_irq.h} (74%)
[incubator-nuttx] 03/06: arch/xtensa/esp32: Disable the CPU
interrupt right when it's alloacted.
Posted by gu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 5be9f24fe53b17cbffaa2d16505f4518bd79120d
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Thu Aug 5 15:12:05 2021 +0200
arch/xtensa/esp32: Disable the CPU interrupt right when it's alloacted.
At this point we are in a critical section and have all the necessary
information to disable the interrupt properly (CPU, and CPU interrupt).
Leaving it to the drivers will complicate things as converting from IRQs
to CPU interrupts could be tricky in SMP mode.
Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
arch/xtensa/src/esp32/esp32_cpuint.c | 13 +++++++++++--
arch/xtensa/src/esp32/esp32_cpustart.c | 1 -
arch/xtensa/src/esp32/esp32_emac.c | 1 -
arch/xtensa/src/esp32/esp32_gpio.c | 1 -
arch/xtensa/src/esp32/esp32_i2c.c | 1 -
arch/xtensa/src/esp32/esp32_irq.c | 1 -
arch/xtensa/src/esp32/esp32_serial.c | 3 ---
arch/xtensa/src/esp32/esp32_spi.c | 1 -
arch/xtensa/src/esp32/esp32_spi_slave.c | 1 -
arch/xtensa/src/esp32/esp32_wdt.c | 4 ----
10 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/arch/xtensa/src/esp32/esp32_cpuint.c b/arch/xtensa/src/esp32/esp32_cpuint.c
index 6d45e18..dcb8446 100644
--- a/arch/xtensa/src/esp32/esp32_cpuint.c
+++ b/arch/xtensa/src/esp32/esp32_cpuint.c
@@ -221,7 +221,7 @@ static inline void xtensa_disable_all(void)
* be allocated from free interrupts within this set
*
* Returned Value:
- * On success, the allocated level-sensitive, CPU interrupt numbr is
+ * On success, the allocated level-sensitive, CPU interrupt number is
* returned. A negated errno is returned on failure. The only possible
* failure is that all level-sensitive CPU interrupts have already been
* allocated.
@@ -236,6 +236,7 @@ static int esp32_alloc_cpuint(uint32_t intmask)
uint32_t intset;
int cpuint;
int ret = -ENOMEM;
+ int cpu = 0;
/* Check if there are CPU interrupts with the requested properties
* available.
@@ -243,8 +244,9 @@ static int esp32_alloc_cpuint(uint32_t intmask)
flags = enter_critical_section();
+ cpu = up_cpu_index();
#ifdef CONFIG_SMP
- if (this_cpu() != 0)
+ if (cpu != 0)
{
freeints = &g_cpu1_freeints;
}
@@ -287,6 +289,13 @@ static int esp32_alloc_cpuint(uint32_t intmask)
}
}
+ /* Make sure the CPU interrupt is disabled. */
+
+ if (ret >= 0)
+ {
+ xtensa_disable_cpuint(&g_intenable[cpu], (1ul << ret));
+ }
+
leave_critical_section(flags);
return ret;
}
diff --git a/arch/xtensa/src/esp32/esp32_cpustart.c b/arch/xtensa/src/esp32/esp32_cpustart.c
index 531c494..747973a 100644
--- a/arch/xtensa/src/esp32/esp32_cpustart.c
+++ b/arch/xtensa/src/esp32/esp32_cpustart.c
@@ -97,7 +97,6 @@ static inline void xtensa_attach_fromcpu0_interrupt(void)
/* Connect all CPU peripheral source to allocated CPU interrupt */
- up_disable_irq(cpuint);
esp32_attach_peripheral(1, ESP32_PERIPH_CPU_CPU0, cpuint);
/* Attach the inter-CPU interrupt. */
diff --git a/arch/xtensa/src/esp32/esp32_emac.c b/arch/xtensa/src/esp32/esp32_emac.c
index 5f055b3..ec2320f 100644
--- a/arch/xtensa/src/esp32/esp32_emac.c
+++ b/arch/xtensa/src/esp32/esp32_emac.c
@@ -2196,7 +2196,6 @@ int esp32_emac_init(void)
goto error;
}
- up_disable_irq(priv->cpuint);
esp32_attach_peripheral(0, ESP32_PERIPH_EMAC, priv->cpuint);
ret = irq_attach(ESP32_IRQ_EMAC, emac_interrupt, priv);
diff --git a/arch/xtensa/src/esp32/esp32_gpio.c b/arch/xtensa/src/esp32/esp32_gpio.c
index 8f89c96..7a36607 100644
--- a/arch/xtensa/src/esp32/esp32_gpio.c
+++ b/arch/xtensa/src/esp32/esp32_gpio.c
@@ -421,7 +421,6 @@ void esp32_gpioirqinitialize(void)
/* Attach the GPIO peripheral to the allocated CPU interrupt */
- up_disable_irq(g_gpio_cpuint);
esp32_attach_peripheral(cpu, ESP32_PERIPH_CPU_GPIO, g_gpio_cpuint);
/* Attach and enable the interrupt handler */
diff --git a/arch/xtensa/src/esp32/esp32_i2c.c b/arch/xtensa/src/esp32/esp32_i2c.c
index 2e2e158..4c399f6 100644
--- a/arch/xtensa/src/esp32/esp32_i2c.c
+++ b/arch/xtensa/src/esp32/esp32_i2c.c
@@ -1567,7 +1567,6 @@ FAR struct i2c_master_s *esp32_i2cbus_initialize(int port)
/* Set up to receive peripheral interrupts on the current CPU */
priv->cpu = up_cpu_index();
- up_disable_irq(priv->cpuint);
esp32_attach_peripheral(priv->cpu, config->periph, priv->cpuint);
ret = irq_attach(config->irq, esp32_i2c_irq, priv);
diff --git a/arch/xtensa/src/esp32/esp32_irq.c b/arch/xtensa/src/esp32/esp32_irq.c
index 3b93f8c..de01176 100644
--- a/arch/xtensa/src/esp32/esp32_irq.c
+++ b/arch/xtensa/src/esp32/esp32_irq.c
@@ -139,7 +139,6 @@ static inline void xtensa_attach_fromcpu1_interrupt(void)
/* Connect all CPU peripheral source to allocated CPU interrupt */
- up_disable_irq(cpuint);
esp32_attach_peripheral(0, ESP32_PERIPH_CPU_CPU1, cpuint);
/* Attach the inter-CPU interrupt. */
diff --git a/arch/xtensa/src/esp32/esp32_serial.c b/arch/xtensa/src/esp32/esp32_serial.c
index 352aad2..659ea2f 100644
--- a/arch/xtensa/src/esp32/esp32_serial.c
+++ b/arch/xtensa/src/esp32/esp32_serial.c
@@ -1029,7 +1029,6 @@ static int esp32_attach(struct uart_dev_s *dev)
/* Attach the GPIO peripheral to the allocated CPU interrupt */
- up_disable_irq(priv->cpuint);
esp32_attach_peripheral(priv->cpu, priv->config->periph,
priv->cpuint);
@@ -1158,8 +1157,6 @@ static void dma_attach(uint8_t dma_chan)
* and attach and enable the IRQ.
*/
- up_disable_irq(dma_cpuint);
-
if (dma_chan == 0)
{
esp32_attach_peripheral(cpu, ESP32_PERIPH_UHCI0, dma_cpuint);
diff --git a/arch/xtensa/src/esp32/esp32_spi.c b/arch/xtensa/src/esp32/esp32_spi.c
index 5c9b8e0..bac7e46 100644
--- a/arch/xtensa/src/esp32/esp32_spi.c
+++ b/arch/xtensa/src/esp32/esp32_spi.c
@@ -1474,7 +1474,6 @@ FAR struct spi_dev_s *esp32_spibus_initialize(int port)
/* Set up to receive peripheral interrupts on the current CPU */
priv->cpu = up_cpu_index();
- up_disable_irq(priv->cpuint);
esp32_attach_peripheral(priv->cpu,
priv->config->periph,
priv->cpuint);
diff --git a/arch/xtensa/src/esp32/esp32_spi_slave.c b/arch/xtensa/src/esp32/esp32_spi_slave.c
index 7764bc9..bd463ab 100644
--- a/arch/xtensa/src/esp32/esp32_spi_slave.c
+++ b/arch/xtensa/src/esp32/esp32_spi_slave.c
@@ -1307,7 +1307,6 @@ FAR struct spi_slave_ctrlr_s *esp32_spislv_ctrlr_initialize(int port)
/* Set up to receive peripheral interrupts on the current CPU */
priv->cpu = up_cpu_index();
- up_disable_irq(priv->cpuint);
esp32_attach_peripheral(priv->cpu,
priv->config->periph,
priv->cpuint);
diff --git a/arch/xtensa/src/esp32/esp32_wdt.c b/arch/xtensa/src/esp32/esp32_wdt.c
index 8b903d4..ef40840 100644
--- a/arch/xtensa/src/esp32/esp32_wdt.c
+++ b/arch/xtensa/src/esp32/esp32_wdt.c
@@ -752,10 +752,6 @@ static int esp32_wdt_setisr(FAR struct esp32_wdt_dev_s *dev, xcpt_t handler,
wdt->cpu = up_cpu_index();
- /* Disable the provided CPU Interrupt to configure it */
-
- up_disable_irq(wdt->cpuint);
-
/* Attach a peripheral interrupt to the available CPU interrupt in
* the current core
*/
[incubator-nuttx] 05/06: xtensa/esp32_irq.c: Hard code special IRQs
in the IRQ map. These IRQs are do not go through the regular process where
we attache the CPU interrupt to a peripheral and update our map, also,
they are fixed and a have reserved CPU interrupt,
thus hard code their values at startup.
Posted by gu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 5d626f7267cbcf20b668947178b17aa0c477ae55
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Thu Aug 5 16:58:07 2021 +0200
xtensa/esp32_irq.c: Hard code special IRQs in the IRQ map. These IRQs
are do not go through the regular process where we attache the CPU
interrupt to a peripheral and update our map, also, they are fixed and a
have reserved CPU interrupt, thus hard code their values at startup.
Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
arch/xtensa/src/esp32/esp32_irq.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/arch/xtensa/src/esp32/esp32_irq.c b/arch/xtensa/src/esp32/esp32_irq.c
index cdbc865..efe4801 100644
--- a/arch/xtensa/src/esp32/esp32_irq.c
+++ b/arch/xtensa/src/esp32/esp32_irq.c
@@ -167,6 +167,14 @@ void up_irqinitialize(void)
g_irqmap[i] = IRQ_UNMAPPED;
}
+ /* Hard code special cases. */
+
+ g_irqmap[XTENSA_IRQ_TIMER0] = IRQ_MKMAP(0, ESP32_CPUINT_TIMER0);
+
+#ifdef CONFIG_ESP32_WIRELESS
+ g_irqmap[ESP32_IRQ_MAC] = IRQ_MKMAP(0, ESP32_CPUINT_MAC);
+#endif
+
/* Initialize CPU interrupts */
esp32_cpuint_initialize();
@@ -287,18 +295,6 @@ void up_enable_irq(int irq)
int cpu = IRQ_GETCPU(g_irqmap[irq]);
int cpuint = IRQ_GETCPUINT(g_irqmap[irq]);
- /* The internal Timer 0 interrupt is not attached to any peripheral, and
- * thus has no mapping, it has to be handled separately.
- * We know it's enabled early before the second CPU has started, so we don't
- * need any IPC call.
- */
-
- if (irq == XTENSA_IRQ_TIMER0)
- {
- cpu = 0;
- cpuint = ESP32_CPUINT_TIMER0;
- }
-
DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
#ifdef CONFIG_SMP
DEBUGASSERT(cpu >= 0 && cpu <= CONFIG_SMP_NCPUS);
[incubator-nuttx] 01/06: arch/xtensa/esp32: Map NuttX's IRQs to
ESP32 CPU interrupts.
Posted by gu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 633cdf8e2769f28be4456524c89f01a04c7aead3
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Thu Aug 5 12:04:13 2021 +0200
arch/xtensa/esp32: Map NuttX's IRQs to ESP32 CPU interrupts.
This map also keeps track of the CPU that attached the IRQ. This will
be used to properly disable the interrupt in the correct CPU in SMP
mode.
Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
arch/xtensa/src/esp32/esp32_cpuint.c | 60 ++++-----------
arch/xtensa/src/esp32/esp32_irq.c | 141 +++++++++++++++++++++++++++++++++++
arch/xtensa/src/esp32/esp32_irq.h | 85 +++++++++++++++++++++
3 files changed, 239 insertions(+), 47 deletions(-)
diff --git a/arch/xtensa/src/esp32/esp32_cpuint.c b/arch/xtensa/src/esp32/esp32_cpuint.c
index 515ac47..d0764ae 100644
--- a/arch/xtensa/src/esp32/esp32_cpuint.c
+++ b/arch/xtensa/src/esp32/esp32_cpuint.c
@@ -34,11 +34,13 @@
#include <nuttx/irq.h>
#include <arch/irq.h>
-#include "hardware/esp32_dport.h"
-#include "esp32_cpuint.h"
#include "xtensa.h"
-#include "sched/sched.h"
+#include "hardware/esp32_dport.h"
+
+#include "esp32_irq.h"
+
+#include "esp32_cpuint.h"
/****************************************************************************
* Pre-processor Definitions
@@ -156,16 +158,6 @@ uint8_t g_cpu1_intmap[ESP32_NCPUINTS];
* Private Data
****************************************************************************/
-/* g_intenable[] is a shadow copy of the per-CPU INTENABLE register
- * content.
- */
-
-#ifdef CONFIG_SMP
-static uint32_t g_intenable[CONFIG_SMP_NCPUS];
-#else
-static uint32_t g_intenable[1];
-#endif
-
/* Bitsets for free, unallocated CPU interrupts available to peripheral
* devices.
*/
@@ -390,40 +382,6 @@ int esp32_cpuint_initialize(void)
}
/****************************************************************************
- * Name: up_disable_irq
- *
- * Description:
- * Disable the CPU interrupt specified by 'cpuint'
- *
- ****************************************************************************/
-
-void up_disable_irq(int cpuint)
-{
- int cpu = up_cpu_index();
-
- DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
-
- xtensa_disable_cpuint(&g_intenable[cpu], (1ul << cpuint));
-}
-
-/****************************************************************************
- * Name: up_enable_irq
- *
- * Description:
- * Enable the CPU interrupt specified by 'cpuint'
- *
- ****************************************************************************/
-
-void up_enable_irq(int cpuint)
-{
- int cpu = up_cpu_index();
-
- DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
-
- xtensa_enable_cpuint(&g_intenable[cpu], (1ul << cpuint));
-}
-
-/****************************************************************************
* Name: esp32_alloc_levelint
*
* Description:
@@ -552,6 +510,9 @@ void esp32_attach_peripheral(int cpu, int periphid, int cpuint)
{
uintptr_t regaddr;
uint8_t *intmap;
+ int irq;
+
+ irq = ESP32_PERIPH2IRQ(periphid);
DEBUGASSERT(periphid >= 0 && periphid < ESP32_NPERIPHERALS);
DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
@@ -572,6 +533,7 @@ void esp32_attach_peripheral(int cpu, int periphid, int cpuint)
DEBUGASSERT(intmap[cpuint] == CPUINT_UNASSIGNED);
intmap[cpuint] = periphid + XTENSA_IRQ_FIRSTPERIPH;
+ esp32_mapirq(irq, cpu, cpuint);
putreg32(cpuint, regaddr);
}
@@ -598,6 +560,9 @@ void esp32_detach_peripheral(int cpu, int periphid, int cpuint)
{
uintptr_t regaddr;
uint8_t *intmap;
+ int irq;
+
+ irq = ESP32_PERIPH2IRQ(periphid);
DEBUGASSERT(periphid >= 0 && periphid < ESP32_NPERIPHERALS);
#ifdef CONFIG_SMP
@@ -617,6 +582,7 @@ void esp32_detach_peripheral(int cpu, int periphid, int cpuint)
DEBUGASSERT(intmap[cpuint] != CPUINT_UNASSIGNED);
intmap[cpuint] = CPUINT_UNASSIGNED;
+ esp32_unmapirq(irq);
putreg32(NO_CPUINT, regaddr);
}
diff --git a/arch/xtensa/src/esp32/esp32_irq.c b/arch/xtensa/src/esp32/esp32_irq.c
index 617f716..3c6cd2d 100644
--- a/arch/xtensa/src/esp32/esp32_irq.c
+++ b/arch/xtensa/src/esp32/esp32_irq.c
@@ -33,10 +33,13 @@
#include <arch/irq.h>
#include "xtensa.h"
+
#include "esp32_cpuint.h"
#include "esp32_smp.h"
#include "esp32_gpio.h"
+#include "esp32_irq.h"
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -47,10 +50,25 @@
# define INTSTACK_ALLOC (CONFIG_SMP_NCPUS * INTSTACK_SIZE)
#endif
+#define IRQ_UNMAPPED 0xff
+#define IRQ_GETCPU(m) (((m) & 0x80) >> 0x07)
+#define IRQ_GETCPUINT(m) ((m) & 0x7f)
+#define IRQ_MKMAP(c, i) (((c) << 0x07) | (i))
+
/****************************************************************************
* Public Data
****************************************************************************/
+/* g_intenable[] is a shadow copy of the per-CPU INTENABLE register
+ * content.
+ */
+
+#ifdef CONFIG_SMP
+static uint32_t g_intenable[CONFIG_SMP_NCPUS];
+#else
+static uint32_t g_intenable[1];
+#endif
+
/* g_current_regs[] holds a reference to the current interrupt level
* register storage structure. It is non-NULL only during interrupt
* processing. Access to g_current_regs[] must be through the macro
@@ -88,6 +106,8 @@ uintptr_t g_cpu_intstack_top[CONFIG_SMP_NCPUS] =
};
#endif /* defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15 */
+static volatile uint8_t g_irqmap[NR_IRQS];
+
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -152,6 +172,12 @@ static inline void xtensa_attach_fromcpu1_interrupt(void)
void up_irqinitialize(void)
{
+ int i;
+ for (i = 0; i < NR_IRQS; i++)
+ {
+ g_irqmap[i] = IRQ_UNMAPPED;
+ }
+
/* Initialize CPU interrupts */
esp32_cpuint_initialize();
@@ -180,6 +206,121 @@ void up_irqinitialize(void)
}
/****************************************************************************
+ * Name: esp32_mapirq
+ *
+ * Description:
+ * Map the given IRQ to the CPU and allocated CPU interrupt.
+ *
+ * Input Parameters:
+ * irq - IRQ number (see esp32/include/irq.h)
+ * cpu - The CPU receiving the interrupt 0=PRO CPU 1=APP CPU
+ * cpuint - The allocated CPU interrupt.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+void esp32_mapirq(int irq, int cpu, int cpuint)
+{
+ DEBUGASSERT(irq >= 0 && irq < NR_IRQS);
+ DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
+#ifdef CONFIG_SMP
+ DEBUGASSERT(cpu >= 0 && cpu < CONFIG_SMP_NCPUS);
+#else
+ DEBUGASSERT(cpu == 0);
+#endif
+
+ g_irqmap[irq] = IRQ_MKMAP(cpu, cpuint);
+}
+
+/****************************************************************************
+ * Name: esp32_unmapirq
+ *
+ * Description:
+ * Unmap the given IRQ.
+ *
+ * Input Parameters:
+ * irq - IRQ number (see esp32/include/irq.h)
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+void esp32_unmapirq(int irq)
+{
+ DEBUGASSERT(irq >= 0 && irq < NR_IRQS);
+
+ g_irqmap[irq] = IRQ_UNMAPPED;
+}
+
+/****************************************************************************
+ * Name: up_disable_irq
+ *
+ * Description:
+ * Disable the IRQ specified by 'irq'
+ *
+ ****************************************************************************/
+
+void up_disable_irq(int irq)
+{
+ int cpu = up_cpu_index();
+ int cpuint = IRQ_GETCPUINT(g_irqmap[irq]);
+
+ if (g_irqmap[irq] == IRQ_UNMAPPED)
+ {
+ /* This interrupt is already disabled. */
+
+ return;
+ }
+
+ DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
+#ifdef CONFIG_SMP
+ DEBUGASSERT(cpu >= 0 && cpu <= CONFIG_SMP_NCPUS);
+#else
+ DEBUGASSERT(cpu == 0);
+#endif
+
+ xtensa_disable_cpuint(&g_intenable[cpu], (1ul << cpuint));
+}
+
+/****************************************************************************
+ * Name: up_enable_irq
+ *
+ * Description:
+ * Enable the IRQ specified by 'irq'
+ *
+ ****************************************************************************/
+
+void up_enable_irq(int irq)
+{
+ int cpu = IRQ_GETCPU(g_irqmap[irq]);
+ int cpuint = IRQ_GETCPUINT(g_irqmap[irq]);
+
+ /* The internal Timer 0 interrupt is not attached to any peripheral, and
+ * thus has no mapping, it has to be handled separately.
+ * We know it's enabled early before the second CPU has started, so we don't
+ * need any IPC call.
+ */
+
+ if (irq == XTENSA_IRQ_TIMER0)
+ {
+ cpu = 0;
+ cpuint = ESP32_CPUINT_TIMER0;
+ }
+
+ DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32_CPUINT_MAX);
+#ifdef CONFIG_SMP
+ DEBUGASSERT(cpu >= 0 && cpu <= CONFIG_SMP_NCPUS);
+#else
+ DEBUGASSERT(cpu == 0);
+#endif
+
+ xtensa_enable_cpuint(&g_intenable[cpu], (1ul << cpuint));
+}
+
+/****************************************************************************
* Name: xtensa_intstack_top
*
* Description:
diff --git a/arch/xtensa/src/esp32/esp32_irq.h b/arch/xtensa/src/esp32/esp32_irq.h
new file mode 100644
index 0000000..65a0429
--- /dev/null
+++ b/arch/xtensa/src/esp32/esp32_irq.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * arch/xtensa/src/esp32/esp32_irq.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_XTENSA_SRC_ESP32_ESP32_IRQ_H
+#define __ARCH_XTENSA_SRC_ESP32_ESP32_IRQ_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Functions Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp32_mapirq
+ *
+ * Description:
+ * Map the given IRQ to the CPU and allocated CPU interrupt.
+ *
+ * Input Parameters:
+ * irq - IRQ number (see esp32/include/irq.h)
+ * cpu - The CPU receiving the interrupt 0=PRO CPU 1=APP CPU
+ * cpuint - The allocated CPU interrupt.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+void esp32_mapirq(int irq, int cpu, int cpuint);
+
+/****************************************************************************
+ * Name: esp32_unmapirq
+ *
+ * Description:
+ * Unmap the given IRQ.
+ *
+ * Input Parameters:
+ * irq - IRQ number (see esp32/include/irq.h)
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+void esp32_unmapirq(int irq);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_XTENSA_SRC_ESP32_ESP32_IRQ_H */
[incubator-nuttx] 02/06: arch/xtensa/esp32: Use the same
g_intenable shadows in cpuint.c and irq.c
Posted by gu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 97dca8fe10e7ecf88cfa94e9151d3e422256fe74
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Thu Aug 5 14:44:48 2021 +0200
arch/xtensa/esp32: Use the same g_intenable shadows in cpuint.c and
irq.c
Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
arch/xtensa/src/esp32/esp32_cpuint.c | 10 ++++++++++
arch/xtensa/src/esp32/esp32_cpuint.h | 10 ++++++++++
arch/xtensa/src/esp32/esp32_irq.c | 10 ----------
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/arch/xtensa/src/esp32/esp32_cpuint.c b/arch/xtensa/src/esp32/esp32_cpuint.c
index d0764ae..6d45e18 100644
--- a/arch/xtensa/src/esp32/esp32_cpuint.c
+++ b/arch/xtensa/src/esp32/esp32_cpuint.c
@@ -154,6 +154,16 @@ uint8_t g_cpu0_intmap[ESP32_NCPUINTS];
uint8_t g_cpu1_intmap[ESP32_NCPUINTS];
#endif
+/* g_intenable[] is a shadow copy of the per-CPU INTENABLE register
+ * content.
+ */
+
+#ifdef CONFIG_SMP
+uint32_t g_intenable[CONFIG_SMP_NCPUS];
+#else
+uint32_t g_intenable[1];
+#endif
+
/****************************************************************************
* Private Data
****************************************************************************/
diff --git a/arch/xtensa/src/esp32/esp32_cpuint.h b/arch/xtensa/src/esp32/esp32_cpuint.h
index 07916a3..4f5baf7 100644
--- a/arch/xtensa/src/esp32/esp32_cpuint.h
+++ b/arch/xtensa/src/esp32/esp32_cpuint.h
@@ -46,6 +46,16 @@ extern uint8_t g_cpu0_intmap[ESP32_NCPUINTS];
extern uint8_t g_cpu1_intmap[ESP32_NCPUINTS];
#endif
+/* g_intenable[] is a shadow copy of the per-CPU INTENABLE register
+ * content.
+ */
+
+#ifdef CONFIG_SMP
+extern uint32_t g_intenable[CONFIG_SMP_NCPUS];
+#else
+extern uint32_t g_intenable[1];
+#endif
+
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
diff --git a/arch/xtensa/src/esp32/esp32_irq.c b/arch/xtensa/src/esp32/esp32_irq.c
index 3c6cd2d..3b93f8c 100644
--- a/arch/xtensa/src/esp32/esp32_irq.c
+++ b/arch/xtensa/src/esp32/esp32_irq.c
@@ -59,16 +59,6 @@
* Public Data
****************************************************************************/
-/* g_intenable[] is a shadow copy of the per-CPU INTENABLE register
- * content.
- */
-
-#ifdef CONFIG_SMP
-static uint32_t g_intenable[CONFIG_SMP_NCPUS];
-#else
-static uint32_t g_intenable[1];
-#endif
-
/* g_current_regs[] holds a reference to the current interrupt level
* register storage structure. It is non-NULL only during interrupt
* processing. Access to g_current_regs[] must be through the macro
[incubator-nuttx] 04/06: arch/xtensa/esp32: Update the drivers
regarding the API change in IRQ handling.
Posted by gu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 56a7f3b651491880d065776f341052a9da0f1373
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Thu Aug 5 15:33:37 2021 +0200
arch/xtensa/esp32: Update the drivers regarding the API change in IRQ
handling.
Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
arch/xtensa/src/esp32/esp32_cpustart.c | 2 +-
arch/xtensa/src/esp32/esp32_emac.c | 4 ++--
arch/xtensa/src/esp32/esp32_gpio.c | 10 +++++-----
arch/xtensa/src/esp32/esp32_i2c.c | 4 ++--
arch/xtensa/src/esp32/esp32_irq.c | 2 +-
arch/xtensa/src/esp32/esp32_serial.c | 18 +++++++++++-------
arch/xtensa/src/esp32/esp32_spi.c | 4 ++--
arch/xtensa/src/esp32/esp32_spi_slave.c | 6 +++---
arch/xtensa/src/esp32/esp32_tickless.c | 4 ++--
arch/xtensa/src/esp32/esp32_tim.c | 6 +++---
arch/xtensa/src/esp32/esp32_timerisr.c | 2 +-
arch/xtensa/src/esp32/esp32_wdt.c | 4 ++--
arch/xtensa/src/esp32/esp32_wifi_adapter.c | 4 ++--
13 files changed, 37 insertions(+), 33 deletions(-)
diff --git a/arch/xtensa/src/esp32/esp32_cpustart.c b/arch/xtensa/src/esp32/esp32_cpustart.c
index 747973a..83e3cd6 100644
--- a/arch/xtensa/src/esp32/esp32_cpustart.c
+++ b/arch/xtensa/src/esp32/esp32_cpustart.c
@@ -105,7 +105,7 @@ static inline void xtensa_attach_fromcpu0_interrupt(void)
/* Enable the inter 0 CPU interrupts. */
- up_enable_irq(cpuint);
+ up_enable_irq(ESP32_IRQ_CPU_CPU0);
}
#endif
diff --git a/arch/xtensa/src/esp32/esp32_emac.c b/arch/xtensa/src/esp32/esp32_emac.c
index ec2320f..1bf723f 100644
--- a/arch/xtensa/src/esp32/esp32_emac.c
+++ b/arch/xtensa/src/esp32/esp32_emac.c
@@ -1315,7 +1315,7 @@ static void emac_txtimeout_expiry(wdparm_t arg)
* Interrupts will be re-enabled when emac_ifup() is called.
*/
- up_disable_irq(priv->cpuint);
+ up_disable_irq(ESP32_IRQ_EMAC);
/* Schedule to perform the TX timeout processing on the worker thread,
* perhaps canceling any pending IRQ processing.
@@ -1904,7 +1904,7 @@ static int emac_ifup(struct net_driver_s *dev)
/* Enable the Ethernet interrupt */
- up_enable_irq(priv->cpuint);
+ up_enable_irq(ESP32_IRQ_EMAC);
leave_critical_section(flags);
diff --git a/arch/xtensa/src/esp32/esp32_gpio.c b/arch/xtensa/src/esp32/esp32_gpio.c
index 7a36607..af75aea 100644
--- a/arch/xtensa/src/esp32/esp32_gpio.c
+++ b/arch/xtensa/src/esp32/esp32_gpio.c
@@ -426,7 +426,7 @@ void esp32_gpioirqinitialize(void)
/* Attach and enable the interrupt handler */
DEBUGVERIFY(irq_attach(ESP32_IRQ_CPU_GPIO, gpio_interrupt, NULL));
- up_enable_irq(g_gpio_cpuint);
+ up_enable_irq(ESP32_IRQ_CPU_GPIO);
}
#endif
@@ -456,7 +456,7 @@ void esp32_gpioirqenable(int irq, gpio_intrtype_t intrtype)
/* Get the address of the GPIO PIN register for this pin */
- up_disable_irq(g_gpio_cpuint);
+ up_disable_irq(ESP32_IRQ_CPU_GPIO);
regaddr = GPIO_REG(pin);
regval = getreg32(regaddr);
@@ -490,7 +490,7 @@ void esp32_gpioirqenable(int irq, gpio_intrtype_t intrtype)
regval |= (intrtype << GPIO_PIN_INT_TYPE_S);
putreg32(regval, regaddr);
- up_enable_irq(g_gpio_cpuint);
+ up_enable_irq(ESP32_IRQ_CPU_GPIO);
}
#endif
@@ -517,14 +517,14 @@ void esp32_gpioirqdisable(int irq)
/* Get the address of the GPIO PIN register for this pin */
- up_disable_irq(g_gpio_cpuint);
+ up_disable_irq(ESP32_IRQ_CPU_GPIO);
regaddr = GPIO_REG(pin);
regval = getreg32(regaddr);
regval &= ~(GPIO_PIN_INT_ENA_M | GPIO_PIN_INT_TYPE_M);
putreg32(regval, regaddr);
- up_enable_irq(g_gpio_cpuint);
+ up_enable_irq(ESP32_IRQ_CPU_GPIO);
}
#endif
diff --git a/arch/xtensa/src/esp32/esp32_i2c.c b/arch/xtensa/src/esp32/esp32_i2c.c
index 4c399f6..4c41733 100644
--- a/arch/xtensa/src/esp32/esp32_i2c.c
+++ b/arch/xtensa/src/esp32/esp32_i2c.c
@@ -1580,7 +1580,7 @@ FAR struct i2c_master_s *esp32_i2cbus_initialize(int port)
return NULL;
}
- up_enable_irq(priv->cpuint);
+ up_enable_irq(config->irq);
#endif
esp32_i2c_sem_init(priv);
@@ -1623,7 +1623,7 @@ int esp32_i2cbus_uninitialize(FAR struct i2c_master_s *dev)
leave_critical_section(flags);
#ifndef CONFIG_I2C_POLLED
- up_disable_irq(priv->cpuint);
+ up_disable_irq(priv->config->irq);
esp32_detach_peripheral(priv->cpu,
priv->config->periph,
priv->cpuint);
diff --git a/arch/xtensa/src/esp32/esp32_irq.c b/arch/xtensa/src/esp32/esp32_irq.c
index de01176..cdbc865 100644
--- a/arch/xtensa/src/esp32/esp32_irq.c
+++ b/arch/xtensa/src/esp32/esp32_irq.c
@@ -147,7 +147,7 @@ static inline void xtensa_attach_fromcpu1_interrupt(void)
/* Enable the inter 0 CPU interrupt. */
- up_enable_irq(cpuint);
+ up_enable_irq(ESP32_IRQ_CPU_CPU1);
}
#endif
diff --git a/arch/xtensa/src/esp32/esp32_serial.c b/arch/xtensa/src/esp32/esp32_serial.c
index 659ea2f..ca75022 100644
--- a/arch/xtensa/src/esp32/esp32_serial.c
+++ b/arch/xtensa/src/esp32/esp32_serial.c
@@ -1041,7 +1041,7 @@ static int esp32_attach(struct uart_dev_s *dev)
* in the UART
*/
- up_enable_irq(priv->cpuint);
+ up_enable_irq(priv->config->irq);
}
return ret;
@@ -1063,7 +1063,7 @@ static void esp32_detach(struct uart_dev_s *dev)
/* Disable and detach the CPU interrupt */
- up_disable_irq(priv->cpuint);
+ up_disable_irq(priv->config->irq);
irq_detach(priv->config->irq);
/* Disassociate the peripheral interrupt from the CPU interrupt */
@@ -1133,6 +1133,8 @@ static void dma_attach(uint8_t dma_chan)
int dma_cpuint;
int cpu;
int ret;
+ int periph;
+ int irq;
/* Clear the interrupts */
@@ -1159,20 +1161,22 @@ static void dma_attach(uint8_t dma_chan)
if (dma_chan == 0)
{
- esp32_attach_peripheral(cpu, ESP32_PERIPH_UHCI0, dma_cpuint);
- ret = irq_attach(ESP32_IRQ_UHCI0, esp32_interrupt_dma, NULL);
+ periph = ESP32_PERIPH_UHCI0;
+ irq = ESP32_IRQ_UHCI0;
}
else
{
- esp32_attach_peripheral(cpu, ESP32_PERIPH_UHCI1, dma_cpuint);
- ret = irq_attach(ESP32_IRQ_UHCI1, esp32_interrupt_dma, NULL);
+ periph = ESP32_PERIPH_UHCI1;
+ irq = ESP32_IRQ_UHCI1;
}
+ esp32_attach_peripheral(cpu, periph, dma_cpuint);
+ ret = irq_attach(irq, esp32_interrupt_dma, NULL);
if (ret == OK)
{
/* Enable the CPU interrupt */
- up_enable_irq(dma_cpuint);
+ up_enable_irq(irq);
}
else
{
diff --git a/arch/xtensa/src/esp32/esp32_spi.c b/arch/xtensa/src/esp32/esp32_spi.c
index bac7e46..1637ea0 100644
--- a/arch/xtensa/src/esp32/esp32_spi.c
+++ b/arch/xtensa/src/esp32/esp32_spi.c
@@ -1489,7 +1489,7 @@ FAR struct spi_dev_s *esp32_spibus_initialize(int port)
return NULL;
}
- up_enable_irq(priv->cpuint);
+ up_enable_irq(priv->config->irq);
}
esp32_spi_init(spi_dev);
@@ -1533,7 +1533,7 @@ int esp32_spibus_uninitialize(FAR struct spi_dev_s *dev)
if (priv->config->use_dma)
{
- up_disable_irq(priv->cpuint);
+ up_disable_irq(priv->config->irq);
esp32_detach_peripheral(priv->cpu,
priv->config->periph,
priv->cpuint);
diff --git a/arch/xtensa/src/esp32/esp32_spi_slave.c b/arch/xtensa/src/esp32/esp32_spi_slave.c
index bd463ab..a42c9a1 100644
--- a/arch/xtensa/src/esp32/esp32_spi_slave.c
+++ b/arch/xtensa/src/esp32/esp32_spi_slave.c
@@ -1027,7 +1027,7 @@ static void esp32_spislv_bind(struct spi_slave_ctrlr_s *ctrlr,
esp32_spislv_setmode(ctrlr, mode);
esp32_spislv_setbits(ctrlr, nbits);
- up_enable_irq(priv->cpuint);
+ up_enable_irq(priv->config->irq);
esp32_spi_set_regbits(priv, SPI_CMD_OFFSET, SPI_USR_M);
@@ -1063,7 +1063,7 @@ static void esp32_spislv_unbind(struct spi_slave_ctrlr_s *ctrlr)
flags = enter_critical_section();
- up_disable_irq(priv->cpuint);
+ up_disable_irq(priv->config->irq);
esp32_gpioirqdisable(ESP32_PIN2IRQ(priv->config->cs_pin));
esp32_spi_reset_regbits(priv, SPI_SLAVE_OFFSET, SPI_INT_EN_M);
@@ -1365,7 +1365,7 @@ int esp32_spislv_ctrlr_uninitialize(FAR struct spi_slave_ctrlr_s *ctrlr)
return OK;
}
- up_disable_irq(priv->cpuint);
+ up_disable_irq(priv->config->irq);
esp32_detach_peripheral(priv->cpu,
priv->config->periph,
priv->cpuint);
diff --git a/arch/xtensa/src/esp32/esp32_tickless.c b/arch/xtensa/src/esp32/esp32_tickless.c
index 382c82c..1b70588 100644
--- a/arch/xtensa/src/esp32/esp32_tickless.c
+++ b/arch/xtensa/src/esp32/esp32_tickless.c
@@ -499,7 +499,7 @@ void up_timer_initialize(void)
/* Enable the timer 0 CPU interrupt. */
- up_enable_irq(ESP32_CPUINT_TIMER0);
+ up_enable_irq(XTENSA_IRQ_TIMER0);
return;
}
@@ -586,4 +586,4 @@ void IRAM_ATTR up_step_idletime(uint32_t us)
leave_critical_section(flags);
}
-#endif /* CONFIG_SCHED_TICKLESS */
\ No newline at end of file
+#endif /* CONFIG_SCHED_TICKLESS */
diff --git a/arch/xtensa/src/esp32/esp32_tim.c b/arch/xtensa/src/esp32/esp32_tim.c
index e62973d..85f111a 100644
--- a/arch/xtensa/src/esp32/esp32_tim.c
+++ b/arch/xtensa/src/esp32/esp32_tim.c
@@ -528,7 +528,7 @@ static int esp32_tim_setisr(FAR struct esp32_tim_dev_s *dev, xcpt_t handler,
* CPU Interrupt
*/
- up_disable_irq(tim->cpuint);
+ up_disable_irq(tim->irq);
esp32_detach_peripheral(tim->core, tim->periph, tim->cpuint);
esp32_free_cpuint(tim->cpuint);
irq_detach(tim->irq);
@@ -545,7 +545,7 @@ static int esp32_tim_setisr(FAR struct esp32_tim_dev_s *dev, xcpt_t handler,
{
/* Disable the previous CPU Interrupt */
- up_disable_irq(tim->cpuint);
+ up_disable_irq(tim->irq);
/* Free cpu interrupt
* because we will get another from esp32_alloc_levelint
@@ -585,7 +585,7 @@ static int esp32_tim_setisr(FAR struct esp32_tim_dev_s *dev, xcpt_t handler,
/* Enable the CPU Interrupt that is linked to the timer */
- up_enable_irq(tim->cpuint);
+ up_enable_irq(tim->irq);
}
errout:
diff --git a/arch/xtensa/src/esp32/esp32_timerisr.c b/arch/xtensa/src/esp32/esp32_timerisr.c
index 01e3fee..f191068 100644
--- a/arch/xtensa/src/esp32/esp32_timerisr.c
+++ b/arch/xtensa/src/esp32/esp32_timerisr.c
@@ -135,5 +135,5 @@ void up_timer_initialize(void)
/* Enable the timer 0 CPU interrupt. */
- up_enable_irq(ESP32_CPUINT_TIMER0);
+ up_enable_irq(XTENSA_IRQ_TIMER0);
}
diff --git a/arch/xtensa/src/esp32/esp32_wdt.c b/arch/xtensa/src/esp32/esp32_wdt.c
index ef40840..886b4c0 100644
--- a/arch/xtensa/src/esp32/esp32_wdt.c
+++ b/arch/xtensa/src/esp32/esp32_wdt.c
@@ -726,7 +726,7 @@ static int esp32_wdt_setisr(FAR struct esp32_wdt_dev_s *dev, xcpt_t handler,
* CPU Interrupt
*/
- up_disable_irq(wdt->cpuint);
+ up_disable_irq(wdt->irq);
esp32_detach_peripheral(wdt->cpu, wdt->periph, wdt->cpuint);
esp32_free_cpuint(wdt->cpuint);
irq_detach(wdt->irq);
@@ -772,7 +772,7 @@ static int esp32_wdt_setisr(FAR struct esp32_wdt_dev_s *dev, xcpt_t handler,
/* Enable the CPU Interrupt that is linked to the wdt */
- up_enable_irq(wdt->cpuint);
+ up_enable_irq(wdt->irq);
}
errout:
diff --git a/arch/xtensa/src/esp32/esp32_wifi_adapter.c b/arch/xtensa/src/esp32/esp32_wifi_adapter.c
index 056afab..985ab28 100644
--- a/arch/xtensa/src/esp32/esp32_wifi_adapter.c
+++ b/arch/xtensa/src/esp32/esp32_wifi_adapter.c
@@ -844,7 +844,7 @@ static void esp32_ints_on(uint32_t mask)
wlinfo("INFO mask=%08x irq=%d\n", mask, irq);
- up_enable_irq(irq);
+ up_enable_irq(ESP32_IRQ_MAC);
}
/****************************************************************************
@@ -867,7 +867,7 @@ static void esp32_ints_off(uint32_t mask)
wlinfo("INFO mask=%08x irq=%d\n", mask, irq);
- up_disable_irq(irq);
+ up_disable_irq(ESP32_IRQ_MAC);
}
/****************************************************************************
[incubator-nuttx] 06/06: xtensa/esp32: Use up_cpu_index instead of
this_cpu.
Posted by gu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 2925d4956b1c67eaedf1e82ebfa952b9f04653e4
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Thu Aug 5 23:05:09 2021 +0200
xtensa/esp32: Use up_cpu_index instead of this_cpu.
this_cpu requires sched.h to be included.
---
arch/xtensa/src/esp32/esp32_cpuint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/xtensa/src/esp32/esp32_cpuint.c b/arch/xtensa/src/esp32/esp32_cpuint.c
index dcb8446..3218a37 100644
--- a/arch/xtensa/src/esp32/esp32_cpuint.c
+++ b/arch/xtensa/src/esp32/esp32_cpuint.c
@@ -492,7 +492,7 @@ void esp32_free_cpuint(int cpuint)
flags = enter_critical_section();
#ifdef CONFIG_SMP
- if (this_cpu() != 0)
+ if (up_cpu_index() != 0)
{
freeints = &g_cpu1_freeints;
}