From 16049ab6ad7c5e4e1e54d8fab1327edb52fcb512 Mon Sep 17 00:00:00 2001 From: morris Date: Wed, 10 Jan 2024 10:33:33 +0800 Subject: [PATCH] change(pcnt): reenable the target test for esp32p4 by changing the GPIO assignment --- components/driver/test_apps/.build-test-rules.yml | 4 ---- .../legacy_pcnt_driver/main/test_legacy_pcnt.c | 11 ++++++++++- .../legacy_pcnt_driver/pytest_legacy_pcnt.py | 1 + .../esp_driver_pcnt/test_apps/.build-test-rules.yml | 4 ---- .../test_apps/pulse_cnt/main/test_pulse_cnt_board.h | 10 +++++++++- .../test_apps/pulse_cnt/pytest_pulse_cnt.py | 1 + 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/components/driver/test_apps/.build-test-rules.yml b/components/driver/test_apps/.build-test-rules.yml index 7696651dbc..3e53b1a1aa 100644 --- a/components/driver/test_apps/.build-test-rules.yml +++ b/components/driver/test_apps/.build-test-rules.yml @@ -43,10 +43,6 @@ components/driver/test_apps/legacy_mcpwm_driver: components/driver/test_apps/legacy_pcnt_driver: disable: - if: SOC_PCNT_SUPPORTED != 1 - disable_test: - - if: IDF_TARGET == "esp32p4" - temporary: true - reason: test not pass, should be re-enable # TODO: IDF-8965 depends_filepatterns: - components/driver/deprecated/**/*pcnt* diff --git a/components/driver/test_apps/legacy_pcnt_driver/main/test_legacy_pcnt.c b/components/driver/test_apps/legacy_pcnt_driver/main/test_legacy_pcnt.c index 40d5ac5989..e42fe9fcf5 100644 --- a/components/driver/test_apps/legacy_pcnt_driver/main/test_legacy_pcnt.c +++ b/components/driver/test_apps/legacy_pcnt_driver/main/test_legacy_pcnt.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -8,6 +8,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/queue.h" +#include "sdkconfig.h" #include "soc/soc_caps.h" #include "driver/gpio.h" #include "driver/pcnt.h" @@ -23,10 +24,18 @@ #include "unity.h" #include "esp_rom_gpio.h" +#if CONFIG_IDF_TARGET_ESP32P4 +#define PULSE_IO 20 +#define PCNT_INPUT_IO 21 +#define PCNT_CTRL_VCC_IO 1 +#define PCNT_CTRL_GND_IO 0 +#else #define PULSE_IO 12 #define PCNT_INPUT_IO 4 #define PCNT_CTRL_VCC_IO 5 #define PCNT_CTRL_GND_IO 2 +#endif + #define HIGHEST_LIMIT 10 #define LOWEST_LIMIT 0 #define MAX_THRESHOLD 5 diff --git a/components/driver/test_apps/legacy_pcnt_driver/pytest_legacy_pcnt.py b/components/driver/test_apps/legacy_pcnt_driver/pytest_legacy_pcnt.py index 8f9938918a..355ddb908b 100644 --- a/components/driver/test_apps/legacy_pcnt_driver/pytest_legacy_pcnt.py +++ b/components/driver/test_apps/legacy_pcnt_driver/pytest_legacy_pcnt.py @@ -10,6 +10,7 @@ from pytest_embedded import Dut @pytest.mark.esp32s3 @pytest.mark.esp32c6 @pytest.mark.esp32h2 +@pytest.mark.esp32p4 @pytest.mark.generic @pytest.mark.parametrize( 'config', diff --git a/components/esp_driver_pcnt/test_apps/.build-test-rules.yml b/components/esp_driver_pcnt/test_apps/.build-test-rules.yml index 2119175e78..d94a1f9237 100644 --- a/components/esp_driver_pcnt/test_apps/.build-test-rules.yml +++ b/components/esp_driver_pcnt/test_apps/.build-test-rules.yml @@ -3,9 +3,5 @@ components/esp_driver_pcnt/test_apps/pulse_cnt: disable: - if: SOC_PCNT_SUPPORTED != 1 - disable_test: - - if: IDF_TARGET == "esp32p4" - temporary: true - reason: test not pass, should be re-enable # TODO: IDF-8965 depends_components: - esp_driver_pcnt diff --git a/components/esp_driver_pcnt/test_apps/pulse_cnt/main/test_pulse_cnt_board.h b/components/esp_driver_pcnt/test_apps/pulse_cnt/main/test_pulse_cnt_board.h index 0f6385c0e1..5e3181606e 100644 --- a/components/esp_driver_pcnt/test_apps/pulse_cnt/main/test_pulse_cnt_board.h +++ b/components/esp_driver_pcnt/test_apps/pulse_cnt/main/test_pulse_cnt_board.h @@ -1,17 +1,25 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include "sdkconfig.h" + #ifdef __cplusplus extern "C" { #endif +#if CONFIG_IDF_TARGET_ESP32P4 +#define TEST_PCNT_GPIO_A 20 +#define TEST_PCNT_GPIO_B 21 +#define TEST_PCNT_GPIO_Z 22 +#else #define TEST_PCNT_GPIO_A 0 #define TEST_PCNT_GPIO_B 2 #define TEST_PCNT_GPIO_Z 4 +#endif #if CONFIG_PCNT_ISR_IRAM_SAFE #define TEST_PCNT_CALLBACK_ATTR IRAM_ATTR diff --git a/components/esp_driver_pcnt/test_apps/pulse_cnt/pytest_pulse_cnt.py b/components/esp_driver_pcnt/test_apps/pulse_cnt/pytest_pulse_cnt.py index 7a9414e235..5c0f4a88a5 100644 --- a/components/esp_driver_pcnt/test_apps/pulse_cnt/pytest_pulse_cnt.py +++ b/components/esp_driver_pcnt/test_apps/pulse_cnt/pytest_pulse_cnt.py @@ -10,6 +10,7 @@ from pytest_embedded import Dut @pytest.mark.esp32s3 @pytest.mark.esp32c6 @pytest.mark.esp32h2 +@pytest.mark.esp32p4 @pytest.mark.generic @pytest.mark.parametrize( 'config',