feat(i2s): supports DMA buffer in PSRAM

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Chen Chen
2026-09-01 16:07:51 +08:00
co-authored by Cursor
parent 1dfce4409a
commit 3cd64a905d
15 changed files with 561 additions and 146 deletions
@@ -26,6 +26,7 @@ extern "C" {
.dma_frame_num = 240, \
.auto_clear_after_cb = false, \
.auto_clear_before_cb = false, \
.dma_buffer_in_psram = false, \
.allow_pd = false, \
.intr_priority = 0, \
.tx_destination = I2S_DESTINATION_DMA, \
@@ -39,6 +40,8 @@ extern "C" {
* @note The callbacks are all running under ISR environment
* @note When CONFIG_I2S_ISR_IRAM_SAFE is enabled, the callback itself and functions called by it should be placed in IRAM.
* The variables used in the function should be in the SRAM as well.
* @note When CONFIG_I2S_ISR_IRAM_SAFE is enabled and the DMA buffers are in PSRAM, the callback must not access
* the DMA buffer while the cache is disabled.
*/
typedef struct {
i2s_isr_callback_t on_recv; /**< Callback of data received event, only for RX channel
@@ -86,6 +89,10 @@ typedef struct {
int intr_priority; /*!< I2S interrupt priority, range [0, 7], if set to 0, the driver will try to allocate an interrupt with a relative low priority (1,2,3) */
i2s_destination_t tx_destination; /*!< TX data path: DMA (memory) or Bluetooth (see `i2s_destination_t`). I2S0 only when set to `I2S_DESTINATION_BT`. Immutable after `i2s_new_channel`. */
i2s_destination_t rx_destination; /*!< RX data path: DMA (memory) or Bluetooth. Same constraints as `tx_destination`. */
bool dma_buffer_in_psram; /*!< Allocate the driver-owned DMA buffers in PSRAM.
* The DMA descriptors are always allocated in internal RAM.
* If PSRAM DMA is unsupported or allocation fails, channel initialization fails without falling back to internal RAM.
*/
} i2s_chan_config_t;
/**