From fe21c32ccb5aa2266eab04814a00d40ff63fdd73 Mon Sep 17 00:00:00 2001 From: Chen Chen Date: Thu, 11 Jun 2026 11:03:11 +0800 Subject: [PATCH] fix(i2s_pdm): remove incorrect check for raw PDM usage --- components/esp_driver_i2s/i2s_pdm.c | 19 +++++++++++++++---- .../esp_driver_i2s/include/driver/i2s_pdm.h | 2 +- .../esp_hal_i2s/esp32/include/hal/i2s_ll.h | 9 --------- .../esp_hal_i2s/esp32c3/include/hal/i2s_ll.h | 9 --------- .../esp_hal_i2s/esp32c5/include/hal/i2s_ll.h | 9 --------- .../esp_hal_i2s/esp32c6/include/hal/i2s_ll.h | 9 --------- .../esp_hal_i2s/esp32c61/include/hal/i2s_ll.h | 9 --------- .../esp_hal_i2s/esp32h2/include/hal/i2s_ll.h | 9 --------- .../esp_hal_i2s/esp32h21/include/hal/i2s_ll.h | 9 --------- .../esp_hal_i2s/esp32h4/include/hal/i2s_ll.h | 9 --------- .../esp_hal_i2s/esp32p4/include/hal/i2s_ll.h | 9 --------- .../esp_hal_i2s/esp32s2/include/hal/i2s_ll.h | 9 --------- .../esp_hal_i2s/esp32s3/include/hal/i2s_ll.h | 9 --------- .../esp_hal_i2s/esp32s31/include/hal/i2s_ll.h | 9 --------- components/esp_hal_i2s/include/hal/i2s_hal.h | 4 ++-- .../esp_hal_i2s/include/hal/i2s_types.h | 4 ++-- 16 files changed, 20 insertions(+), 117 deletions(-) diff --git a/components/esp_driver_i2s/i2s_pdm.c b/components/esp_driver_i2s/i2s_pdm.c index c7acb795598..8a0751da416 100644 --- a/components/esp_driver_i2s/i2s_pdm.c +++ b/components/esp_driver_i2s/i2s_pdm.c @@ -129,6 +129,12 @@ static esp_err_t i2s_pdm_tx_set_slot(i2s_chan_handle_t handle, const i2s_pdm_tx_ ESP_RETURN_ON_FALSE(slot_cfg->data_fmt != I2S_PDM_DATA_FMT_PCM || i2s_ll_is_pcm2pdm_supported(handle->controller->id), ESP_ERR_NOT_SUPPORTED, TAG, "PCM2PDM converter is not supported on selected port"); +#if SOC_I2S_PDM_MAX_TX_LINES > 1 + int id = handle->controller->id; + ESP_RETURN_ON_FALSE(slot_cfg->line_mode != I2S_PDM_TX_TWO_LINE_DAC || + i2s_periph_signal[id].data_out_sigs[1] != (uint8_t) -1, + ESP_ERR_NOT_SUPPORTED, TAG, "PDM TX dual-line mode is not supported on selected port"); +#endif /* Update the total slot num and active slot num */ handle->is_raw_pdm = slot_cfg->data_fmt == I2S_PDM_DATA_FMT_RAW; handle->total_slot = 2; @@ -214,8 +220,6 @@ esp_err_t i2s_channel_init_pdm_tx_mode(i2s_chan_handle_t handle, const i2s_pdm_t #endif I2S_NULL_POINTER_CHECK(TAG, handle); ESP_RETURN_ON_FALSE(handle->dir == I2S_DIR_TX, ESP_ERR_INVALID_ARG, TAG, "This channel handle is not a TX handle"); - ESP_RETURN_ON_FALSE(i2s_ll_is_pdm_supported(handle->controller->id), - ESP_ERR_NOT_SUPPORTED, TAG, "PDM TX mode is not supported on selected port"); esp_err_t ret = ESP_OK; @@ -478,6 +482,15 @@ static esp_err_t i2s_pdm_rx_set_slot(i2s_chan_handle_t handle, const i2s_pdm_rx_ ESP_RETURN_ON_FALSE(slot_cfg->data_fmt != I2S_PDM_DATA_FMT_PCM || i2s_ll_is_pdm2pcm_supported(handle->controller->id), ESP_ERR_NOT_SUPPORTED, TAG, "PDM2PCM converter is not supported on selected port"); +#if SOC_I2S_PDM_MAX_RX_LINES > 1 + int id = handle->controller->id; + for (int i = 0; i < SOC_I2S_PDM_MAX_RX_LINES; i++) { + if (slot_cfg->slot_mask & (0x03 << (i * 2))) { + ESP_RETURN_ON_FALSE(i2s_periph_signal[id].data_in_sigs[i] != (uint8_t) -1, + ESP_ERR_NOT_SUPPORTED, TAG, "PDM RX line %d is not supported on selected port", i); + } + } +#endif /* Update the total slot num and active slot num */ handle->is_raw_pdm = slot_cfg->data_fmt == I2S_PDM_DATA_FMT_RAW; handle->total_slot = 2; @@ -565,8 +578,6 @@ esp_err_t i2s_channel_init_pdm_rx_mode(i2s_chan_handle_t handle, const i2s_pdm_r #endif I2S_NULL_POINTER_CHECK(TAG, handle); ESP_RETURN_ON_FALSE(handle->dir == I2S_DIR_RX, ESP_ERR_INVALID_ARG, TAG, "This channel handle is not a RX handle"); - ESP_RETURN_ON_FALSE(i2s_ll_is_pdm_supported(handle->controller->id), - ESP_ERR_NOT_SUPPORTED, TAG, "PDM RX mode is not supported on selected port"); esp_err_t ret = ESP_OK; diff --git a/components/esp_driver_i2s/include/driver/i2s_pdm.h b/components/esp_driver_i2s/include/driver/i2s_pdm.h index 09f97ad7d45..5f00fee8666 100644 --- a/components/esp_driver_i2s/include/driver/i2s_pdm.h +++ b/components/esp_driver_i2s/include/driver/i2s_pdm.h @@ -117,7 +117,7 @@ typedef struct { /* Particular fields */ i2s_pdm_slot_mask_t slot_mask; /*!< Choose the slots to activate */ i2s_pdm_data_fmt_t data_fmt; /*!< The data format of PDM RX mode. It determines what kind of data format is read in software. - * Typically, set this field to I2S_PDM_DATA_FMT_PCM when PCM2PDM filter is supported in the hardware, + * Typically, set this field to I2S_PDM_DATA_FMT_PCM when PDM2PCM filter is supported in the hardware, * so that the hardware PDM2PCM filter will help to convert the raw PDM data on the line into PCM format, * And then you can read PCM format data in software. Otherwise if this field is set to I2S_PDM_DATA_FMT_RAW, * The data read in software are still in raw PDM format, you may need to convert the raw PDM data into PCM format manually by a software filter. diff --git a/components/esp_hal_i2s/esp32/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32/include/hal/i2s_ll.h index f5b540a392c..26e64ea460c 100644 --- a/components/esp_hal_i2s/esp32/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32/include/hal/i2s_ll.h @@ -25,7 +25,6 @@ #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_BUS_WIDTH 24 #define I2S_LL_INST_NUM 2 -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #define I2S_LL_PCM2PDM_SUPPORTED_PORT_MASK (1U << 0) // PCM2PDM is supported on I2S0 #define I2S_LL_PDM2PCM_SUPPORTED_PORT_MASK (1U << 0) // PDM2PCM is supported on I2S0 #define I2S_LL_TRANS_SIZE_ALIGN_WORD 1 // I2S DMA transfer size must be aligned to word @@ -1172,14 +1171,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ return destination == I2S_DESTINATION_DMA; } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/esp32c3/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32c3/include/hal/i2s_ll.h index 1cf11826cd0..d5d72e2dace 100644 --- a/components/esp_hal_i2s/esp32c3/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32c3/include/hal/i2s_ll.h @@ -23,7 +23,6 @@ #define I2S_LL_GET(_attr) I2S_LL_ ## _attr #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_INST_NUM 1 -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #define I2S_LL_PCM2PDM_SUPPORTED_PORT_MASK (1U << 0) // PCM2PDM is supported on I2S0 #ifdef __cplusplus @@ -1216,14 +1215,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ return destination == I2S_DESTINATION_DMA; } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/esp32c5/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32c5/include/hal/i2s_ll.h index e16457d6456..a9be0c555b3 100644 --- a/components/esp_hal_i2s/esp32c5/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32c5/include/hal/i2s_ll.h @@ -25,7 +25,6 @@ #define I2S_LL_GET(_attr) I2S_LL_ ## _attr #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_INST_NUM 1 -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #define I2S_LL_PCM2PDM_SUPPORTED_PORT_MASK (1U << 0) // PCM2PDM is supported on I2S0 #ifdef __cplusplus @@ -1390,14 +1389,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ return destination == I2S_DESTINATION_DMA; } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/esp32c6/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32c6/include/hal/i2s_ll.h index 72e04482877..5883e1d3d24 100644 --- a/components/esp_hal_i2s/esp32c6/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32c6/include/hal/i2s_ll.h @@ -24,7 +24,6 @@ #define I2S_LL_GET(_attr) I2S_LL_ ## _attr #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_INST_NUM 1 -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #define I2S_LL_PCM2PDM_SUPPORTED_PORT_MASK (1U << 0) // PCM2PDM is supported on I2S0 #ifdef __cplusplus @@ -1262,14 +1261,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ return destination == I2S_DESTINATION_DMA; } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/esp32c61/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32c61/include/hal/i2s_ll.h index 9554fb80394..a6201adad11 100644 --- a/components/esp_hal_i2s/esp32c61/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32c61/include/hal/i2s_ll.h @@ -25,7 +25,6 @@ #define I2S_LL_GET(_attr) I2S_LL_ ## _attr #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_INST_NUM 1 -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #define I2S_LL_PCM2PDM_SUPPORTED_PORT_MASK (1U << 0) // PCM2PDM is supported on I2S0 #ifdef __cplusplus @@ -1391,14 +1390,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ return destination == I2S_DESTINATION_DMA; } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/esp32h2/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32h2/include/hal/i2s_ll.h index b6c0d84bbcf..d095c6fbdb1 100644 --- a/components/esp_hal_i2s/esp32h2/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32h2/include/hal/i2s_ll.h @@ -24,7 +24,6 @@ #define I2S_LL_GET(_attr) I2S_LL_ ## _attr #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_INST_NUM 1 -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #define I2S_LL_PCM2PDM_SUPPORTED_PORT_MASK (1U << 0) // PCM2PDM is supported on I2S0 #ifdef __cplusplus @@ -1262,14 +1261,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ return destination == I2S_DESTINATION_DMA; } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/esp32h21/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32h21/include/hal/i2s_ll.h index d92f1138690..0297e2f7a0a 100644 --- a/components/esp_hal_i2s/esp32h21/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32h21/include/hal/i2s_ll.h @@ -24,7 +24,6 @@ #define I2S_LL_GET(_attr) I2S_LL_ ## _attr #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_INST_NUM 1 -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #ifdef __cplusplus extern "C" { @@ -1260,14 +1259,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ return destination == I2S_DESTINATION_DMA; } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/esp32h4/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32h4/include/hal/i2s_ll.h index 0c9e96de49d..20a28716ee1 100644 --- a/components/esp_hal_i2s/esp32h4/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32h4/include/hal/i2s_ll.h @@ -25,7 +25,6 @@ #define I2S_LL_GET(_attr) I2S_LL_ ## _attr #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_INST_NUM 1 -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #define I2S_LL_PCM2PDM_SUPPORTED_PORT_MASK (1U << 0) // PCM2PDM is supported on I2S0 #ifdef __cplusplus @@ -1498,14 +1497,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ return destination == I2S_DESTINATION_DMA; } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/esp32p4/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32p4/include/hal/i2s_ll.h index 560fa268c19..161e31fb1d8 100644 --- a/components/esp_hal_i2s/esp32p4/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32p4/include/hal/i2s_ll.h @@ -27,7 +27,6 @@ #define I2S_LL_GET(_attr) I2S_LL_ ## _attr #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_INST_NUM 3 -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #define I2S_LL_PCM2PDM_SUPPORTED_PORT_MASK (1U << 0) // PCM2PDM is supported on I2S0 #define I2S_LL_PDM2PCM_SUPPORTED_PORT_MASK (1U << 0) // PDM2PCM is supported on I2S0 @@ -1823,14 +1822,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ return destination == I2S_DESTINATION_DMA; } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/esp32s2/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32s2/include/hal/i2s_ll.h index 67f511f87c6..654f52454e9 100644 --- a/components/esp_hal_i2s/esp32s2/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32s2/include/hal/i2s_ll.h @@ -27,7 +27,6 @@ #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_BUS_WIDTH 24 #define I2S_LL_INST_NUM 1 -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #ifdef __cplusplus extern "C" { @@ -1035,14 +1034,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ return destination == I2S_DESTINATION_DMA; } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/esp32s3/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32s3/include/hal/i2s_ll.h index ca9758034db..d7a60759415 100644 --- a/components/esp_hal_i2s/esp32s3/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32s3/include/hal/i2s_ll.h @@ -23,7 +23,6 @@ #define I2S_LL_GET(_attr) I2S_LL_ ## _attr #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_INST_NUM 2 -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #define I2S_LL_PCM2PDM_SUPPORTED_PORT_MASK (1U << 0) // PCM2PDM is supported on I2S0 #define I2S_LL_PDM2PCM_SUPPORTED_PORT_MASK (1U << 0) // PDM2PCM is supported on I2S0 @@ -1255,14 +1254,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ return destination == I2S_DESTINATION_DMA; } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/esp32s31/include/hal/i2s_ll.h b/components/esp_hal_i2s/esp32s31/include/hal/i2s_ll.h index 3e3c10a28eb..cfcbcbaeab7 100644 --- a/components/esp_hal_i2s/esp32s31/include/hal/i2s_ll.h +++ b/components/esp_hal_i2s/esp32s31/include/hal/i2s_ll.h @@ -27,7 +27,6 @@ #define I2S_LL_GET(_attr) I2S_LL_ ## _attr #define I2S_LL_SUPPORT(_feat) I2S_LL_SUPPORT_ ## _feat #define I2S_LL_INST_NUM 2 // ESP32S31 has 2 I2S instances -#define I2S_LL_PDM_SUPPORTED_PORT_MASK (1U << 0) // PDM is supported on I2S0 #define I2S_LL_PCM2PDM_SUPPORTED_PORT_MASK (1U << 0) // PCM2PDM is supported on I2S0 #define I2S_LL_PDM2PCM_SUPPORTED_PORT_MASK (1U << 0) // PDM2PCM is supported on I2S0 #define I2S_LL_BT_DEST_SUPPORTED_PORT_MASK (1U << 0) // Bluetooth destination is supported on I2S0 @@ -1873,14 +1872,6 @@ static inline bool i2s_ll_is_destination_supported(int port_id, i2s_destination_ } } -/** - * @brief Check whether I2S PDM mode is supported on the specified port - */ -static inline bool i2s_ll_is_pdm_supported(int port_id) -{ - return (I2S_LL_PDM_SUPPORTED_PORT_MASK & (1U << port_id)) != 0; -} - /** * @brief Check whether I2S TX PCM2PDM converter is supported on the specified port */ diff --git a/components/esp_hal_i2s/include/hal/i2s_hal.h b/components/esp_hal_i2s/include/hal/i2s_hal.h index 911eb7df97a..90e18db1e01 100644 --- a/components/esp_hal_i2s/include/hal/i2s_hal.h +++ b/components/esp_hal_i2s/include/hal/i2s_hal.h @@ -95,11 +95,11 @@ typedef struct { } pdm_tx; /*!< Specific configurations for PDM TX mode */ #endif #if SOC_I2S_SUPPORTS_PDM_RX - /* PDM TX configurations */ + /* PDM RX configurations */ struct { i2s_pdm_slot_mask_t slot_mask; /*!< Choose the slots to activate */ i2s_pdm_data_fmt_t data_fmt; /*!< The data format of PDM RX mode. It determines what kind of data format is read in software. - * Typically, set this field to I2S_PDM_DATA_FMT_PCM when PCM2PDM filter is supported in the hardware, + * Typically, set this field to I2S_PDM_DATA_FMT_PCM when PDM2PCM filter is supported in the hardware, * so that the hardware PDM2PCM filter will help to convert the raw PDM data on the line into PCM format, * And then you can read PCM format data in software. Otherwise if this field is set to I2S_PDM_DATA_FMT_RAW, * The data read in software are still in raw PDM format, you may need to convert the raw PDM data into PCM format manually by a software filter. diff --git a/components/esp_hal_i2s/include/hal/i2s_types.h b/components/esp_hal_i2s/include/hal/i2s_types.h index ba91335bdac..d913f6a8e1f 100644 --- a/components/esp_hal_i2s/include/hal/i2s_types.h +++ b/components/esp_hal_i2s/include/hal/i2s_types.h @@ -100,11 +100,11 @@ typedef enum { I2S_PDM_DATA_FMT_PCM = 0, /*!< PDM RX: * Enable the hardware PDM to PCM filter to convert the inputted PDM data on the line into PCM format in software, * so that the read data in software is PCM format data already, no need additional software filter. - * PCM data format is only available when PCM2PDM filter is supported in hardware. + * PCM data format is only available when PDM2PCM filter is supported in hardware. * PDM TX: * Enable the hardware PCM to PDM filter to convert the written PCM data in software into PDM format on the line, * so that we only need to write the PCM data in software, no need to prepare raw PDM data in software. - * PCM data format is only available when PDM2PCM filter is supported in hardware. + * PCM data format is only available when PCM2PDM filter is supported in hardware. */ I2S_PDM_DATA_FMT_RAW = 1, /*!< PDM RX: * Read the raw PDM data directly in software, without the hardware PDM to PCM filter.