From 90e0b94ed694cd4d60c32db44c00dcc50be1b8b1 Mon Sep 17 00:00:00 2001 From: morris Date: Mon, 25 May 2026 23:50:58 +0800 Subject: [PATCH] test(dma): reenable unit test for esp32p4 rev1 targets --- .../test_apps/dma/main/test_async_crc.c | 20 ++++++++-------- .../test_apps/dma/main/test_gdma_crc.c | 10 ++++---- .../test_apps/dma/pytest_dma.py | 24 +++++++++++++++---- .../test_apps/dma/sdkconfig.ci.esp32p4_rev1 | 6 +++++ .../test_apps/dma2d/pytest_dma2d.py | 14 +++++++++++ .../test_apps/dma2d/sdkconfig.ci.esp32p4_rev1 | 6 +++++ 6 files changed, 60 insertions(+), 20 deletions(-) create mode 100644 components/esp_driver_dma/test_apps/dma/sdkconfig.ci.esp32p4_rev1 create mode 100644 components/esp_driver_dma/test_apps/dma2d/sdkconfig.ci.esp32p4_rev1 diff --git a/components/esp_driver_dma/test_apps/dma/main/test_async_crc.c b/components/esp_driver_dma/test_apps/dma/main/test_async_crc.c index a6f17779d02..dfec38de97f 100644 --- a/components/esp_driver_dma/test_apps/dma/main/test_async_crc.c +++ b/components/esp_driver_dma/test_apps/dma/main/test_async_crc.c @@ -31,14 +31,14 @@ typedef struct { static void test_async_crc_various_poly(async_crc_handle_t driver) { - static const char test_input_string[] __attribute__((aligned(16))) = "GDMACRC Share::Connect::Innovate"; + static const char test_input_string[] __attribute__((aligned(16))) = "GDMACRC::TEST::X"; // CRC online: https://www.lddgo.net/en/encrypt/crc static test_crc_case_t crc_test_cases[] = { { .crc_bit_width = 8, .init_value = 0x00, .poly_hex = 0x07, - .expected_result = 0xB8, + .expected_result = 0x1C, }, { .crc_bit_width = 8, @@ -47,13 +47,13 @@ static void test_async_crc_various_poly(async_crc_handle_t driver) .reverse_data_mask = true, .reverse_result = true, .final_xor = 0x1F, - .expected_result = 0xB7, + .expected_result = 0xC8, }, { .crc_bit_width = 16, .init_value = 0xFFFF, .poly_hex = 0x1021, - .expected_result = 0xA9B2, + .expected_result = 0x7563, }, { .crc_bit_width = 16, @@ -62,7 +62,7 @@ static void test_async_crc_various_poly(async_crc_handle_t driver) .reverse_data_mask = true, .reverse_result = true, .final_xor = 0xABCD, - .expected_result = 0x9C6B, + .expected_result = 0xD5B9, } }; uint32_t result = 0; @@ -128,7 +128,7 @@ static bool test_async_crc_result_cb(async_crc_handle_t crc_hdl, async_crc_event static void test_async_crc_calc_with_callback(async_crc_handle_t driver) { - static const char test_input_string[] __attribute__((aligned(16))) = "GDMACRC Share::Connect::Innovate"; + static const char test_input_string[] __attribute__((aligned(16))) = "GDMACRC::TEST::X"; SemaphoreHandle_t sem = xSemaphoreCreateBinary(); crc_async_user_context_t user_ctx = { .sem = sem, @@ -143,8 +143,8 @@ static void test_async_crc_calc_with_callback(async_crc_handle_t driver) TEST_ESP_OK(esp_async_crc_calc(driver, test_input_string, strlen(test_input_string), ¶ms, test_async_crc_result_cb, &user_ctx)); TEST_ASSERT_EQUAL(pdTRUE, xSemaphoreTake(sem, pdMS_TO_TICKS(100))); - printf("CRC Result: 0x%"PRIx32", Expected: 0x9D1B\r\n", user_ctx.crc_result); - TEST_ASSERT_EQUAL(0x9D1B, user_ctx.crc_result); + printf("CRC Result: 0x%"PRIx32", Expected: 0xE69A\r\n", user_ctx.crc_result); + TEST_ASSERT_EQUAL(0xE69A, user_ctx.crc_result); vSemaphoreDelete(sem); } @@ -172,7 +172,7 @@ TEST_CASE("async_crc calculation with callback", "[async_crc]") static void test_async_crc_multiple_requests(async_crc_handle_t driver) { - static const char test_input_string[] __attribute__((aligned(16))) = "GDMACRC Share::Connect::Innovate"; + static const char test_input_string[] __attribute__((aligned(16))) = "GDMACRC::TEST::X"; SemaphoreHandle_t sem = xSemaphoreCreateCounting(TEST_ASYNC_CRC_BENCH_COUNTS, 0); crc_async_user_context_t user_ctx = { .sem = sem, @@ -192,7 +192,7 @@ static void test_async_crc_multiple_requests(async_crc_handle_t driver) TEST_ASSERT_EQUAL(pdTRUE, xSemaphoreTake(sem, pdMS_TO_TICKS(100))); } printf("CRC Result of request 0x%"PRIx32"\r\n", user_ctx.crc_result); - TEST_ASSERT_EQUAL(0x692F6C7E, user_ctx.crc_result); + TEST_ASSERT_EQUAL(0x069A43E6, user_ctx.crc_result); vSemaphoreDelete(sem); }; diff --git a/components/esp_driver_dma/test_apps/dma/main/test_gdma_crc.c b/components/esp_driver_dma/test_apps/dma/main/test_gdma_crc.c index 2a8233f6906..dd1fae834d0 100644 --- a/components/esp_driver_dma/test_apps/dma/main/test_gdma_crc.c +++ b/components/esp_driver_dma/test_apps/dma/main/test_gdma_crc.c @@ -33,28 +33,28 @@ static test_crc_case_t crc_test_cases[] = { .crc_bit_width = 8, .init_value = 0x00, .poly_hex = 0x07, - .expected_result = 0xB8, + .expected_result = 0x1C, }, [1] = { .crc_bit_width = 8, .init_value = 0x00, .poly_hex = 0x07, .reverse_data_mask = true, // refin = true - .expected_result = 0xF0, + .expected_result = 0xB9, }, // CRC16, x^16+x^12+x^5+1 [2] = { .crc_bit_width = 16, .init_value = 0xFFFF, .poly_hex = 0x1021, - .expected_result = 0xA9B2, + .expected_result = 0x7563, }, // CRC32, x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 [3] = { .crc_bit_width = 32, .init_value = 0xFFFFFFFF, .poly_hex = 0x04C11DB7, - .expected_result = 0x692F6C7E, + .expected_result = 0x069A43E6, } }; @@ -70,7 +70,7 @@ static void test_gdma_crc_calculation(gdma_channel_handle_t tx_chan, int test_nu uint32_t crc_result = 0; - static const char test_input_string[] __attribute__((aligned(SOC_MEMSPI_ENCRYPTION_ALIGNMENT))) = "GDMACRC Share::Connect::Innovate"; + static const char test_input_string[] __attribute__((aligned(SOC_MEMSPI_ENCRYPTION_ALIGNMENT))) = "GDMACRC::TEST::X"; size_t input_data_size = strlen(test_input_string); TEST_ASSERT_EQUAL((uintptr_t)test_input_string % SOC_MEMSPI_ENCRYPTION_ALIGNMENT, 0); diff --git a/components/esp_driver_dma/test_apps/dma/pytest_dma.py b/components/esp_driver_dma/test_apps/dma/pytest_dma.py index 27a2bfe2a18..28f9d14b156 100644 --- a/components/esp_driver_dma/test_apps/dma/pytest_dma.py +++ b/components/esp_driver_dma/test_apps/dma/pytest_dma.py @@ -20,7 +20,21 @@ from pytest_embedded_idf.utils import soc_filtered_targets indirect=['target'], ) def test_dma(dut: Dut) -> None: - dut.run_all_single_board_cases(reset=True) + dut.run_all_single_board_cases() + + +@pytest.mark.generic +@pytest.mark.esp32p4_rev1 +@pytest.mark.parametrize( + 'config', + [ + 'esp32p4_rev1', + ], + indirect=True, +) +@idf_parametrize('target', ['esp32p4'], indirect=['target']) +def test_dma_esp32p4_rev1(dut: Dut) -> None: + dut.run_all_single_board_cases() @pytest.mark.octal_psram @@ -33,7 +47,7 @@ def test_dma(dut: Dut) -> None: ) @idf_parametrize('target', ['esp32s3'], indirect=['target']) def test_dma_psram(dut: Dut) -> None: - dut.run_all_single_board_cases(reset=True) + dut.run_all_single_board_cases() @pytest.mark.generic @@ -46,7 +60,7 @@ def test_dma_psram(dut: Dut) -> None: ) @idf_parametrize('target', soc_filtered_targets('SOC_GDMA_SUPPORT_WEIGHTED_ARBITRATION == 1'), indirect=['target']) def test_dma_weighted_arbitration(dut: Dut) -> None: - dut.run_all_single_board_cases(reset=True) + dut.run_all_single_board_cases() @pytest.mark.flash_encryption @@ -59,7 +73,7 @@ def test_dma_weighted_arbitration(dut: Dut) -> None: ) @idf_parametrize('target', ['esp32p4', 'esp32c5'], indirect=['target']) def test_dma_flash_encryption(dut: Dut) -> None: - dut.run_all_single_board_cases(reset=True) + dut.run_all_single_board_cases() @pytest.mark.flash_encryption_f4r8 @@ -72,4 +86,4 @@ def test_dma_flash_encryption(dut: Dut) -> None: ) @idf_parametrize('target', ['esp32s3'], indirect=['target']) def test_dma_flash_encryption_s3_f4r8(dut: Dut) -> None: - dut.run_all_single_board_cases(reset=True) + dut.run_all_single_board_cases() diff --git a/components/esp_driver_dma/test_apps/dma/sdkconfig.ci.esp32p4_rev1 b/components/esp_driver_dma/test_apps/dma/sdkconfig.ci.esp32p4_rev1 new file mode 100644 index 00000000000..d0fb3a327e7 --- /dev/null +++ b/components/esp_driver_dma/test_apps/dma/sdkconfig.ci.esp32p4_rev1 @@ -0,0 +1,6 @@ +CONFIG_IDF_TARGET="esp32p4" +CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_HEX=y +CONFIG_SPIRAM_SPEED_200M=y diff --git a/components/esp_driver_dma/test_apps/dma2d/pytest_dma2d.py b/components/esp_driver_dma/test_apps/dma2d/pytest_dma2d.py index d4e5003f4f4..73e93613075 100644 --- a/components/esp_driver_dma/test_apps/dma2d/pytest_dma2d.py +++ b/components/esp_driver_dma/test_apps/dma2d/pytest_dma2d.py @@ -19,6 +19,20 @@ def test_dma2d(dut: Dut) -> None: dut.run_all_single_board_cases() +@pytest.mark.generic +@pytest.mark.esp32p4_rev1 +@pytest.mark.parametrize( + 'config', + [ + 'esp32p4_rev1', + ], + indirect=True, +) +@idf_parametrize('target', ['esp32p4'], indirect=['target']) +def test_dma2d_esp32p4_rev1(dut: Dut) -> None: + dut.run_all_single_board_cases() + + @pytest.mark.flash_encryption @pytest.mark.parametrize( 'config', diff --git a/components/esp_driver_dma/test_apps/dma2d/sdkconfig.ci.esp32p4_rev1 b/components/esp_driver_dma/test_apps/dma2d/sdkconfig.ci.esp32p4_rev1 new file mode 100644 index 00000000000..d0fb3a327e7 --- /dev/null +++ b/components/esp_driver_dma/test_apps/dma2d/sdkconfig.ci.esp32p4_rev1 @@ -0,0 +1,6 @@ +CONFIG_IDF_TARGET="esp32p4" +CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_HEX=y +CONFIG_SPIRAM_SPEED_200M=y