You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/02/03 04:24:18 UTC

[nuttx] branch master updated (8845e6bb38 -> e710ae5daf)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


    from 8845e6bb38 sensor: Report more gps info
     new e950e53df2 esp32c3: Always reserve CPU INT 0 and fix cpu init order
     new c12a60cb5a esp32c3: Fix WiFi adapter to use WMAC instead of MAC_NMI
     new e710ae5daf esp32c3: reserve CPUINTs 5 and 8 for BLE

The 3 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/risc-v/include/esp32c3/irq.h              | 12 +++------
 arch/risc-v/src/esp32c3/esp32c3_irq.c          | 37 ++++++++++++++++----------
 arch/risc-v/src/esp32c3/esp32c3_wifi_adapter.c |  4 +--
 3 files changed, 28 insertions(+), 25 deletions(-)


[nuttx] 01/03: esp32c3: Always reserve CPU INT 0 and fix cpu init order

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e950e53df297f9004c7e1f6a51277b5a08f9e5de
Author: Alan Carvalho de Assis <ac...@gmail.com>
AuthorDate: Wed Feb 1 17:38:12 2023 -0300

    esp32c3: Always reserve CPU INT 0 and fix cpu init order
    
    Co-author: Tiago Medicci <ti...@espressif.com>
    Co-author: Gustavo Henrique Nihei <gu...@espressif.com>
---
 arch/risc-v/include/esp32c3/irq.h     | 12 +++---------
 arch/risc-v/src/esp32c3/esp32c3_irq.c | 26 +++++++++++++-------------
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/arch/risc-v/include/esp32c3/irq.h b/arch/risc-v/include/esp32c3/irq.h
index 9775a7a199..20dc46e377 100644
--- a/arch/risc-v/include/esp32c3/irq.h
+++ b/arch/risc-v/include/esp32c3/irq.h
@@ -46,8 +46,7 @@
 
 /* RESERVED interrupts: 0 to 14 */
 
-#define ESP32C3_PERIPH_MAC                 0  /* Reserved, but needed by WiFi driver */
-#define ESP32C3_PERIPH_MAC_NMI             1  /* Reserved, but needed by WiFi driver */
+#define ESP32C3_PERIPH_WMAC                1  /* Reserved, but needed by WiFi driver */
 
 #define ESP32C3_PERIPH_BT_BB               5 /* Reserved, but needed by BLE driver */
 #define ESP32C3_PERIPH_RWBLE               8 /* Reserved, but needed by BLE driver */
@@ -119,11 +118,7 @@
 #define ESP32C3_NCPUINTS               32
 #define ESP32C3_CPUINT_MAX             (ESP32C3_NCPUINTS - 1)
 
-#define ESP32C3_CPUINT_MAC             0
-#define ESP32C3_CPUINT_MAC_NMI         1
-
-#define ESP32C3_CPUINT_BT_BB           5
-#define ESP32C3_CPUINT_RWBLE_IRQ       8
+#define ESP32C3_CPUINT_ALWAYS_RSVD     0
 
 #define ESP32C3_CPUINT_PERIPHSET       0xffffffff
 
@@ -149,8 +144,7 @@
 
 /* Peripheral IRQs */
 
-#define ESP32C3_IRQ_MAC                 (ESP32C3_IRQ_FIRSTPERIPH + ESP32C3_PERIPH_MAC)
-#define ESP32C3_IRQ_MAC_NMI             (ESP32C3_IRQ_FIRSTPERIPH + ESP32C3_PERIPH_MAC_NMI)
+#define ESP32C3_IRQ_WMAC                (ESP32C3_IRQ_FIRSTPERIPH + ESP32C3_PERIPH_WMAC)
 
 #define ESP32C3_IRQ_BT_BB               (ESP32C3_IRQ_FIRSTPERIPH + ESP32C3_PERIPH_BT_BB)
 #define ESP32C3_IRQ_RWBLE               (ESP32C3_IRQ_FIRSTPERIPH + ESP32C3_PERIPH_RWBLE)
diff --git a/arch/risc-v/src/esp32c3/esp32c3_irq.c b/arch/risc-v/src/esp32c3/esp32c3_irq.c
index 5b95ceed4a..8159bfd941 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_irq.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_irq.c
@@ -82,10 +82,10 @@
 #define ESP32C3_PRIO_INDEX(p)   ((p) - ESP32C3_MIN_PRIORITY)
 
 #ifdef CONFIG_ESP32C3_WIFI
-#  define ESP32C3_WIFI_RESERVE_INT  ((1 << ESP32C3_CPUINT_MAC | \
-                                      1 << ESP32C3_CPUINT_MAC_NMI))
+#  define ESP32C3_WIFI_RESERVE_INT  ((1 << ESP32C3_CPUINT_ALWAYS_RSVD | \
+                                      1 << ESP32C3_CPUINT_WMAC))
 #else
-#  define ESP32C3_WIFI_RESERVE_INT  0
+#  define ESP32C3_WIFI_RESERVE_INT  (1 << ESP32C3_CPUINT_ALWAYS_RSVD)
 #endif
 
 /****************************************************************************
@@ -196,11 +196,15 @@ void up_irqinitialize(void)
       g_irqmap[i] = IRQ_UNMAPPED;
     }
 
+  /* Initialize CPU interrupts */
+
+  esp32c3_cpuint_initialize();
+
   /* Hard code special cases. */
 
 #ifdef CONFIG_ESP32C3_WIFI
-  g_irqmap[ESP32C3_IRQ_MAC_NMI] = ESP32C3_CPUINT_MAC_NMI;
-  g_cpu_intmap[ESP32C3_CPUINT_MAC_NMI]  = CPUINT_ASSIGN(ESP32C3_IRQ_MAC_NMI);
+  g_irqmap[ESP32C3_IRQ_WMAC] = ESP32C3_CPUINT_WMAC;
+  g_cpu_intmap[ESP32C3_CPUINT_WMAC]  = CPUINT_ASSIGN(ESP32C3_IRQ_WMAC);
 #endif
 
 #ifdef CONFIG_ESP32C3_BLE
@@ -211,10 +215,6 @@ void up_irqinitialize(void)
   g_cpu_intmap[ESP32C3_CPUINT_RWBLE] = CPUINT_ASSIGN(ESP32C3_IRQ_RWBLE);
 #endif
 
-  /* Initialize CPU interrupts */
-
-  esp32c3_cpuint_initialize();
-
   /* Attach the common interrupt handler */
 
   riscv_exception_attach();
@@ -248,7 +248,7 @@ void up_enable_irq(int irq)
 
   irqinfo("irq=%d | cpuint=%d \n", irq, cpuint);
 
-  DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32C3_CPUINT_MAX);
+  DEBUGASSERT(cpuint >= 1 && cpuint <= ESP32C3_CPUINT_MAX);
 
   irqstate = enter_critical_section();
   setbits(1 << cpuint, INTERRUPT_CPU_INT_ENABLE_REG);
@@ -269,7 +269,7 @@ void up_disable_irq(int irq)
 
   irqinfo("irq=%d | cpuint=%d \n", irq, cpuint);
 
-  DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32C3_CPUINT_MAX);
+  DEBUGASSERT(cpuint >= 1 && cpuint <= ESP32C3_CPUINT_MAX);
 
   if (cpuint == IRQ_UNMAPPED)
     {
@@ -358,7 +358,7 @@ int esp32c3_cpuint_initialize(void)
 {
   /* Disable all CPU interrupts on this CPU */
 
-  for (int i = 0; i < ESP32C3_NCPUINTS; i++)
+  for (int i = 1; i <= ESP32C3_CPUINT_MAX; i++)
     {
       putreg32(0, INTERRUPT_CPU_INT_PRI_0_REG + i * 4);
     }
@@ -473,7 +473,7 @@ int esp32c3_setup_irq(int periphid, int priority, int type)
   irq = ESP32C3_PERIPH2IRQ(periphid);
 
   DEBUGASSERT(periphid >= 0 && periphid < ESP32C3_NPERIPHERALS);
-  DEBUGASSERT(cpuint >= 0 && cpuint <= ESP32C3_CPUINT_MAX);
+  DEBUGASSERT(cpuint >= 1 && cpuint <= ESP32C3_CPUINT_MAX);
   DEBUGASSERT(g_cpu_intmap[cpuint] == CPUINT_UNASSIGNED);
 
   g_cpu_intmap[cpuint] = CPUINT_ASSIGN(periphid + ESP32C3_IRQ_FIRSTPERIPH);


[nuttx] 02/03: esp32c3: Fix WiFi adapter to use WMAC instead of MAC_NMI

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit c12a60cb5aa0e714ad6e579d78a547464c6e3216
Author: Alan Carvalho de Assis <ac...@gmail.com>
AuthorDate: Wed Feb 1 18:07:40 2023 -0300

    esp32c3: Fix WiFi adapter to use WMAC instead of MAC_NMI
---
 arch/risc-v/src/esp32c3/esp32c3_wifi_adapter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/risc-v/src/esp32c3/esp32c3_wifi_adapter.c b/arch/risc-v/src/esp32c3/esp32c3_wifi_adapter.c
index 9b7bd06858..1d91f8bec7 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_wifi_adapter.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_wifi_adapter.c
@@ -979,7 +979,7 @@ static void esp32c3_ints_on(uint32_t mask)
 
   wlinfo("INFO mask=%08lx irq=%d\n", mask, n);
 
-  up_enable_irq(ESP32C3_IRQ_MAC_NMI);
+  up_enable_irq(ESP32C3_IRQ_WMAC);
 }
 
 /****************************************************************************
@@ -1002,7 +1002,7 @@ static void esp32c3_ints_off(uint32_t mask)
 
   wlinfo("INFO mask=%08lx irq=%d\n", mask, n);
 
-  up_disable_irq(ESP32C3_IRQ_MAC_NMI);
+  up_disable_irq(ESP32C3_IRQ_WMAC);
 }
 
 /****************************************************************************


[nuttx] 03/03: esp32c3: reserve CPUINTs 5 and 8 for BLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e710ae5daf226bab118d268983e7b878bf1bd392
Author: Alan Carvalho de Assis <ac...@gmail.com>
AuthorDate: Thu Feb 2 16:10:55 2023 -0300

    esp32c3: reserve CPUINTs 5 and 8 for BLE
---
 arch/risc-v/src/esp32c3/esp32c3_irq.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/risc-v/src/esp32c3/esp32c3_irq.c b/arch/risc-v/src/esp32c3/esp32c3_irq.c
index 8159bfd941..c27e40e2c0 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_irq.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_irq.c
@@ -88,6 +88,14 @@
 #  define ESP32C3_WIFI_RESERVE_INT  (1 << ESP32C3_CPUINT_ALWAYS_RSVD)
 #endif
 
+#ifdef CONFIG_ESP32C3_BLE
+#  define ESP32C3_BLE_RESERVE_INT ((1 << ESP32C3_CPUINT_ALWAYS_RSVD) | \
+                                   (1 << ESP32C3_CPUINT_BT_BB) | \
+                                   (1 << ESP32C3_CPUINT_RWBLE))
+#else
+#  define ESP32C3_BLE_RESERVE_INT  (1 << ESP32C3_CPUINT_ALWAYS_RSVD)
+#endif
+
 /****************************************************************************
  * Private Data
  ****************************************************************************/
@@ -103,7 +111,8 @@ static volatile uint8_t g_irqmap[NR_IRQS];
  */
 
 static uint32_t g_cpu_freeints = ESP32C3_CPUINT_PERIPHSET &
-                                 (~ESP32C3_WIFI_RESERVE_INT);
+                                 (~ESP32C3_WIFI_RESERVE_INT &
+                                  ~ESP32C3_BLE_RESERVE_INT);
 
 /****************************************************************************
  * Private Functions