tmedicci opened a new pull request, #16914:
URL: https://github.com/apache/nuttx/pull/16914

   ## Summary
   
   * drivers/i2s/i2schar: Implement blocking read/write operations
     - Implements simple (blocking) read and write operations for the i2schar 
driver. Although it already contained such methods, the read/write operation 
was not being properly handled by the `i2schar_[rx|tx]callback` (called when 
the operation has finished). A semaphore is used to ensure that read data was 
received by the receiver and another semaphore ensures that data was written by 
the transmitter. Please note that the already-existing mutex for the I2S 
peripheral was replaced by two mutexes, one for the receiver and the other for 
the transmitter to allow full-duplex communication.
   
   * drivers/i2s/i2schar: Implement ioctl commands for i2schar
     - Implements a set of commands to the i2s character driver. The 
implemented commands allow getting and setting parameters like data width, 
sample rate and number of channels for both receiver and transmitter. If no 
ioctl is found, the command is redirected to the lower driver implementation if 
it has the ioctl callback registered.
   
   ## Impact
   
   Impact on user: Yes. If used with the updated `apps/examples/i2schar`, it 
allows 1) to properly check the data width to fill the transmitter buffer with 
known data (properly formatted) and 2) to fully receive valid data on the 
receiver. These two features allow creating a loopback mode testing.
   
   Impact on build: No.
   
   Impact on hardware: No.
   
   Impact on documentation: No.
   
   Impact on security: No.
   
   Impact on compatibility: No.
   
   ## Testing
   
   Based on existing defconfigs that select `CONFIG_AUDIO_I2SCHAR=y` and 
`CONFIG_EXAMPLES_I2SCHAR=y`, like `esp32s3-devkit:i2schar`, build the firmware 
as usual. To test the loopback mode, set the DOUT and DIN pins to the same pins 
on ESP32-S3.
   
   ### Building
   
   ```
   make -j distclean && ./tools/configure.sh esp32s3-devkit:i2schar && 
kconfig-tweak --set-val ESPRESSIF_I2S0_DINPIN 10 && kconfig-tweak --set-val 
ESPRESSIF_I2S0_DOUTPIN 10 && make olddefconfig && make flash 
ESPTOOL_PORT=/dev/ttyUSB0
   ```
   
   ### Running
   
   With the updated `i2schar` application 
(https://github.com/apache/nuttx-apps/pull/3166), run the loopback mode testing 
with `i2schar -l`.
   
   ### Results
   
   ```
   nsh> i2schar -l
   i2schar_main: TX data width: 16 bits
   i2schar_prepare_tx_buffer: Prepared transmitter buffer with 16-bit data
   i2schar_main: Loopback mode enabled
   i2schar_main: Start receiver thread
   i2schar_main: Start transmitter thread
   i2schar_receiver: Using allocated buffer for loopback verification
   i2schar_main: Waiting for the transmitter thread
   i2schar_receiver: Received buffer 1
   i2schar_receiver: Received data (first 16 bytes): 0x00 0x00 0x01 0x00 0x02 
0x00 0x03 0x00 0x04 0x00 0x05 0x00 0x06 0x00 0x07 0x00 
   i2schar_transmitter: Send buffer 1
   i2schar_main: Waiting for the receiver thread
   i2schar_receiver: Loopback verification PASSED - data matches expected
   ```


-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to