casaroli commented on code in PR #21986:
URL: https://github.com/apache/nuttx/pull/21986#discussion_r4705119900


##########
arch/xtensa/src/common/espressif/esp_i2s.c:
##########
@@ -3467,16 +3677,21 @@ struct i2s_dev_s *esp_i2sbus_initialize(int port)
 #endif /* I2S_HAVE_TX */
 
 #ifdef I2S_HAVE_RX
-  /* Start RX channel */
+  /* RX must not be started until buffers are queued and AUDIOIOC_START is

Review Comment:
   RX now starts only on `AUDIOIOC_START` with `arg` 0 or on `AUDIOIOC_RESUME`, 
and `i2s_rxdma_setup()` starts the DMA only when `rx_started` is set (line 
1310). `i2schar` (`drivers/i2s/i2schar.c:316`) and the es8311 and es8388 codecs 
call `I2S_RECEIVE()` but never send `AUDIOIOC_START` to the I2S driver. So 
their buffers stay in `rx.pend` and the receive never completes. This file is 
common to esp32, esp32s2 and esp32s3: for example `i2schar -r` on 
esp32-devkitc:i2schar, esp32s2-saola-1:i2schar and esp32s3-devkit:i2schar.
   
   Fix: start the RX channel in `i2s_rxdma_setup()` when `rx_started` is false 
and the driver is not paused, so that the first queued buffer starts RX as 
before.



##########
arch/xtensa/src/esp32s3/esp32s3_cpustart.c:
##########
@@ -49,11 +50,17 @@
 #include "rom/ets_sys.h"
 #include "soc/interrupt_core1_reg.h"
 
+#define APPCPU_START_TIMEOUT_MSEC 2000
+
+extern int ets_printf(const char *fmt, ...);
+
 /****************************************************************************
  * Private Data
  ****************************************************************************/
 
 static volatile bool g_appcpu_started;
+static volatile int g_appcpu_stage;

Review Comment:
   `g_appcpu_stage`, the local `extern` prototype of `ets_printf()` (line 55) 
and the two `ets_printf()` calls (lines 317-324) are debug code.
   
   Fix: remove them, and report the timeout with one `serr()` line before 
`return -ETIMEDOUT`.



##########
arch/xtensa/src/common/xtensa_initialstate.c:
##########
@@ -115,6 +115,14 @@ void up_initial_state(struct tcb_s *tcb)
 
       xtensa_stack_color(tcb->stack_alloc_ptr, 0);
 #endif /* CONFIG_STACK_COLORATION */
+
+#ifdef CONFIG_SMP
+      if (tcb->cpu != 0)

Review Comment:
   This block is inside `if (tcb->pid == IDLE_PROCESS_ID)`. `nx_start()` sets 
`pid = i` and `cpu = i` for each idle TCB (`sched/init/nx_start.c:314` and 
`343`), so only the CPU0 idle TCB comes here and `tcb->cpu` is always 0: the 
`goto` never runs. The rebuild that has an effect is the `up_initial_state()` 
call in `esp32s3_cpustart.c`.
   
   Fix: remove this hunk.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to