Merge branch 'bugfix/i2s_fix_intr_flag_for_pdm_rx_v5.1' into 'release/v5.1'

i2s: fix interrupt flag of pdm rx mode (v5.1)

See merge request espressif/esp-idf!23125
This commit is contained in:
morris 2023-04-24 10:13:41 +08:00
commit be8727cf88
2 changed files with 5 additions and 3 deletions

View File

@ -1030,11 +1030,13 @@ esp_err_t i2s_channel_disable(i2s_chan_handle_t handle)
ESP_GOTO_ON_FALSE(handle->state > I2S_CHAN_STATE_READY, ESP_ERR_INVALID_STATE, err, TAG, "the channel has not been enabled yet"); ESP_GOTO_ON_FALSE(handle->state > I2S_CHAN_STATE_READY, ESP_ERR_INVALID_STATE, err, TAG, "the channel has not been enabled yet");
/* Update the state to force quit the current reading/writing operation */ /* Update the state to force quit the current reading/writing operation */
handle->state = I2S_CHAN_STATE_READY; handle->state = I2S_CHAN_STATE_READY;
/* Waiting for reading/wrinting operation quit
* It should be acquired before assigning the pointer to NULL,
* otherwise may cause NULL pointer panic while reading/writing threads haven't release the lock */
xSemaphoreTake(handle->binary, portMAX_DELAY);
/* Reset the descriptor pointer */ /* Reset the descriptor pointer */
handle->dma.curr_ptr = NULL; handle->dma.curr_ptr = NULL;
handle->dma.rw_pos = 0; handle->dma.rw_pos = 0;
/* Waiting for reading/wrinting operation quit */
xSemaphoreTake(handle->binary, portMAX_DELAY);
handle->stop(handle); handle->stop(handle);
#if CONFIG_PM_ENABLE #if CONFIG_PM_ENABLE
esp_pm_lock_release(handle->pm_lock); esp_pm_lock_release(handle->pm_lock);

View File

@ -456,7 +456,7 @@ esp_err_t i2s_channel_init_pdm_rx_mode(i2s_chan_handle_t handle, const i2s_pdm_r
} }
#endif #endif
ESP_GOTO_ON_ERROR(i2s_pdm_rx_set_clock(handle, &pdm_rx_cfg->clk_cfg), err, TAG, "initialize channel failed while setting clock"); ESP_GOTO_ON_ERROR(i2s_pdm_rx_set_clock(handle, &pdm_rx_cfg->clk_cfg), err, TAG, "initialize channel failed while setting clock");
ESP_GOTO_ON_ERROR(i2s_init_dma_intr(handle, ESP_INTR_FLAG_LEVEL1), err, TAG, "initialize dma interrupt failed"); ESP_GOTO_ON_ERROR(i2s_init_dma_intr(handle, I2S_INTR_ALLOC_FLAGS), err, TAG, "initialize dma interrupt failed");
i2s_ll_rx_enable_pdm(handle->controller->hal.dev); i2s_ll_rx_enable_pdm(handle->controller->hal.dev);
#if SOC_I2S_HW_VERSION_2 #if SOC_I2S_HW_VERSION_2