From 40f1709a1f5b8136c2c805d8b4eed80b0e261903 Mon Sep 17 00:00:00 2001 From: laokaiyao Date: Mon, 27 Feb 2023 11:59:58 +0800 Subject: [PATCH] Revert "i2s: guarantee safety of memcpy from being interrupted by uart logging" This reverts commit 646fd5e15abd23d5237e7aac237eb43be149b0b4. --- components/driver/i2s/i2s_common.c | 9 --------- components/driver/sigma_delta/sdm.c | 13 +++---------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/components/driver/i2s/i2s_common.c b/components/driver/i2s/i2s_common.c index ce530ef236..c3dc28124f 100644 --- a/components/driver/i2s/i2s_common.c +++ b/components/driver/i2s/i2s_common.c @@ -1086,11 +1086,8 @@ esp_err_t i2s_channel_preload_data(i2s_chan_handle_t tx_handle, const void *src, if (bytes_can_load == 0) { break; } - /* Add spinlock in case memcpy be interrupted */ - portENTER_CRITICAL_SAFE(&g_i2s.spinlock); /* Load the data from the last loaded position */ memcpy((uint8_t *)(desc_ptr->buf + tx_handle->dma.rw_pos), data_ptr, bytes_can_load); - portEXIT_CRITICAL_SAFE(&g_i2s.spinlock); data_ptr += bytes_can_load; // Move forward the data pointer total_loaded_bytes += bytes_can_load; // Add to the total loaded bytes remain_bytes -= bytes_can_load; // Update the remaining bytes to be loaded @@ -1146,10 +1143,7 @@ esp_err_t i2s_channel_write(i2s_chan_handle_t handle, const void *src, size_t si if (bytes_can_write > size) { bytes_can_write = size; } - /* Add spinlock in case memcpy be interrupted */ - portENTER_CRITICAL_SAFE(&g_i2s.spinlock); memcpy(data_ptr, src_byte, bytes_can_write); - portEXIT_CRITICAL_SAFE(&g_i2s.spinlock); size -= bytes_can_write; src_byte += bytes_can_write; handle->dma.rw_pos += bytes_can_write; @@ -1191,10 +1185,7 @@ esp_err_t i2s_channel_read(i2s_chan_handle_t handle, void *dest, size_t size, si if (bytes_can_read > (int)size) { bytes_can_read = size; } - /* Add spinlock in case memcpy be interrupted */ - portENTER_CRITICAL_SAFE(&g_i2s.spinlock); memcpy(dest_byte, data_ptr, bytes_can_read); - portEXIT_CRITICAL_SAFE(&g_i2s.spinlock); size -= bytes_can_read; dest_byte += bytes_can_read; handle->dma.rw_pos += bytes_can_read; diff --git a/components/driver/sigma_delta/sdm.c b/components/driver/sigma_delta/sdm.c index e473afe4b0..41005295f2 100644 --- a/components/driver/sigma_delta/sdm.c +++ b/components/driver/sigma_delta/sdm.c @@ -215,21 +215,14 @@ esp_err_t sdm_new_channel(const sdm_config_t *config, sdm_channel_handle_t *ret_ #if CONFIG_PM_ENABLE esp_pm_lock_type_t pm_type = ESP_PM_NO_LIGHT_SLEEP; -#if SOC_SDM_CLK_SUPPORT_XTAL - if (config->clk_src == SDM_CLK_SRC_XTAL) { - pm_type = -1; - } -#endif // SOC_SDM_CLK_SUPPORT_XTAL #if SOC_SDM_CLK_SUPPORT_APB if (config->clk_src == SDM_CLK_SRC_APB) { pm_type = ESP_PM_APB_FREQ_MAX; } #endif // SOC_SDM_CLK_SUPPORT_APB - if (pm_type >= 0) { - sprintf(chan->pm_lock_name, "sdm_%d_%d", group->group_id, chan_id); // e.g. sdm_0_0 - ret = esp_pm_lock_create(pm_type, 0, chan->pm_lock_name, &chan->pm_lock); - ESP_RETURN_ON_ERROR(ret, TAG, "create %s lock failed", chan->pm_lock_name); - } + sprintf(chan->pm_lock_name, "sdm_%d_%d", group->group_id, chan_id); // e.g. sdm_0_0 + ret = esp_pm_lock_create(pm_type, 0, chan->pm_lock_name, &chan->pm_lock); + ESP_GOTO_ON_ERROR(ret, err, TAG, "create %s lock failed", chan->pm_lock_name); #endif // CONFIG_PM_ENABLE group->clk_src = config->clk_src;