From b282c419548268033636c6004d0b41cfee2b51d5 Mon Sep 17 00:00:00 2001 From: wanckl Date: Wed, 23 Oct 2024 18:59:53 +0800 Subject: [PATCH] fix(driver_spi): fixed p4 no dma polling trans cache sync fail --- components/esp_driver_spi/src/gpspi/spi_master.c | 2 +- .../esp_driver_spi/test_apps/master/main/test_spi_master.c | 2 -- .../esp_driver_spi/test_apps/param/main/test_spi_param.c | 2 +- .../esp_driver_spi/test_apps/slave/main/test_spi_slave.c | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/esp_driver_spi/src/gpspi/spi_master.c b/components/esp_driver_spi/src/gpspi/spi_master.c index 7237a0edebcf..b447b40a5f0a 100644 --- a/components/esp_driver_spi/src/gpspi/spi_master.c +++ b/components/esp_driver_spi/src/gpspi/spi_master.c @@ -1415,7 +1415,7 @@ esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_end(spi_device_handle_t handle, #if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE //invalidate here to let user access rx data in post_cb if possible const spi_bus_attr_t *bus_attr = host->bus_attr; - if (host->cur_trans_buf.buffer_to_rcv) { + if (bus_attr->dma_enabled && host->cur_trans_buf.buffer_to_rcv) { uint16_t alignment = bus_attr->internal_mem_align_size; uint32_t buffer_byte_len = (host->cur_trans_buf.trans->rxlength + 7) / 8; buffer_byte_len = (buffer_byte_len + alignment - 1) & (~(alignment - 1)); diff --git a/components/esp_driver_spi/test_apps/master/main/test_spi_master.c b/components/esp_driver_spi/test_apps/master/main/test_spi_master.c index d08e8996bd71..f3d284d69e73 100644 --- a/components/esp_driver_spi/test_apps/master/main/test_spi_master.c +++ b/components/esp_driver_spi/test_apps/master/main/test_spi_master.c @@ -1856,7 +1856,6 @@ TEST_CASE("test_spi_master_sleep_retention", "[spi]") #endif } -#if 0 /* Temp disable, TODO: IDFCI-2455*/ #if CONFIG_PM_ENABLE TEST_CASE("test_spi_master_auto_sleep_retention", "[spi]") { @@ -1922,4 +1921,3 @@ TEST_CASE("test_spi_master_auto_sleep_retention", "[spi]") TEST_ESP_OK(esp_pm_configure(&pm_config)); } #endif //CONFIG_PM_ENABLE -#endif // 0 diff --git a/components/esp_driver_spi/test_apps/param/main/test_spi_param.c b/components/esp_driver_spi/test_apps/param/main/test_spi_param.c index 71506acb752e..7f507a549b98 100644 --- a/components/esp_driver_spi/test_apps/param/main/test_spi_param.c +++ b/components/esp_driver_spi/test_apps/param/main/test_spi_param.c @@ -1438,7 +1438,7 @@ static void test_master_fd_no_dma(void) .length = test_trans_len * 8, }; unity_wait_for_signal("Slave ready"); - TEST_ESP_OK(spi_device_transmit(dev0, &trans_cfg)); + TEST_ESP_OK(spi_device_polling_transmit(dev0, &trans_cfg)); ESP_LOG_BUFFER_HEX("master tx", master_send, test_trans_len); ESP_LOG_BUFFER_HEX_LEVEL("master rx", master_receive, test_trans_len, ESP_LOG_DEBUG); diff --git a/components/esp_driver_spi/test_apps/slave/main/test_spi_slave.c b/components/esp_driver_spi/test_apps/slave/main/test_spi_slave.c index 46537168210b..f5634dbba919 100644 --- a/components/esp_driver_spi/test_apps/slave/main/test_spi_slave.c +++ b/components/esp_driver_spi/test_apps/slave/main/test_spi_slave.c @@ -162,7 +162,7 @@ TEST_CASE("Test slave rx no_dma overwrite when length below/over config", "[spi] .length = 8 * 7, .tx_buffer = master_tx, }; - spi_device_transmit(spidev0, &master_tans); + spi_device_polling_transmit(spidev0, &master_tans); TEST_ESP_OK(spi_slave_get_trans_result(TEST_SLAVE_HOST, &slave_out, portMAX_DELAY)); @@ -181,7 +181,7 @@ TEST_CASE("Test slave rx no_dma overwrite when length below/over config", "[spi] TEST_ESP_OK(spi_slave_queue_trans(TEST_SLAVE_HOST, &slave_tans, portMAX_DELAY)); master_tans.length = 8 * 11, - spi_device_transmit(spidev0, &master_tans); + spi_device_polling_transmit(spidev0, &master_tans); TEST_ESP_OK(spi_slave_get_trans_result(TEST_SLAVE_HOST, &slave_out, portMAX_DELAY));