Merge branch 'feature/support_to_get_dma_buffer_size' into 'master'

feat(i2s): support to get total dma buffer size

Closes IDF-9005

See merge request espressif/esp-idf!28345
This commit is contained in:
Kevin (Lao Kaiyao)
2024-01-09 14:56:36 +08:00
2 changed files with 7 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -972,6 +972,7 @@ found:
chan_info->dir = handle->dir; chan_info->dir = handle->dir;
chan_info->role = handle->role; chan_info->role = handle->role;
chan_info->mode = handle->mode; chan_info->mode = handle->mode;
chan_info->total_dma_buf_size = handle->state >= I2S_CHAN_STATE_READY ? handle->dma.desc_num * handle->dma.buf_size : 0;
if (handle->controller->full_duplex) { if (handle->controller->full_duplex) {
if (handle->dir == I2S_DIR_TX) { if (handle->dir == I2S_DIR_TX) {
chan_info->pair_chan = handle->controller->rx_chan; chan_info->pair_chan = handle->controller->rx_chan;

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -76,6 +76,10 @@ typedef struct {
i2s_dir_t dir; /*!< I2S channel direction */ i2s_dir_t dir; /*!< I2S channel direction */
i2s_comm_mode_t mode; /*!< I2S channel communication mode */ i2s_comm_mode_t mode; /*!< I2S channel communication mode */
i2s_chan_handle_t pair_chan; /*!< I2S pair channel handle in duplex mode, always NULL in simplex mode */ i2s_chan_handle_t pair_chan; /*!< I2S pair channel handle in duplex mode, always NULL in simplex mode */
uint32_t total_dma_buf_size; /*!< Total size of all the allocated DMA buffers
* - 0 if the channel has not been initialized
* - non-zero if the channel has been initialized
*/
} i2s_chan_info_t; } i2s_chan_info_t;
/** /**