From a08558a85372e62b695bd5891b57bf7047a261bf Mon Sep 17 00:00:00 2001 From: gaoxu Date: Thu, 25 Apr 2024 10:52:32 +0800 Subject: [PATCH] feat(coredump): replace fun sel function --- .../test_apps/gpio/main/test_gpio.c | 4 ---- components/espcoredump/src/core_dump_uart.c | 15 +++++++-------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/components/esp_driver_gpio/test_apps/gpio/main/test_gpio.c b/components/esp_driver_gpio/test_apps/gpio/main/test_gpio.c index d1811d2a06..177c65862f 100644 --- a/components/esp_driver_gpio/test_apps/gpio/main/test_gpio.c +++ b/components/esp_driver_gpio/test_apps/gpio/main/test_gpio.c @@ -535,8 +535,6 @@ TEST_CASE("GPIO_set_output_level_get_input_level_test", "[gpio]") TEST_ASSERT_EQUAL_INT_MESSAGE(1, gpio_get_level(TEST_GPIO_EXT_IN_IO), "get level error! the level should be high!"); } -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C5) -// C5 on FPGA do not support GPIO pull down // This test routes constant-high/low signal to pins, another way is to directly connect TEST_GPIO_EXT_IN_IO to // 3.3v or GND pin TEST_CASE("GPIO_get_level_from_fixed_voltage_test", "[gpio]") @@ -664,8 +662,6 @@ TEST_CASE("GPIO_mode_test", "[gpio]") TEST_ASSERT_EQUAL_INT_MESSAGE(!level, gpio_get_level(TEST_GPIO_EXT_IN_IO), "direction GPIO_MODE_INPUT_OUTPUT set error, it gives incorrect output"); } -#endif - static void prompt_to_continue(const char *str) { printf("%s , please press \"Enter\" to go on!\n", str); diff --git a/components/espcoredump/src/core_dump_uart.c b/components/espcoredump/src/core_dump_uart.c index b859c4ea0d..00414aaa7b 100644 --- a/components/espcoredump/src/core_dump_uart.c +++ b/components/espcoredump/src/core_dump_uart.c @@ -6,6 +6,7 @@ #include #include "soc/uart_reg.h" #include "soc/gpio_periph.h" +#include "soc/uart_pins.h" #include "driver/gpio.h" #include "hal/gpio_hal.h" #include "esp_core_dump_types.h" @@ -147,17 +148,15 @@ static esp_err_t esp_core_dump_uart_hw_init(void) uint32_t tm_cur = 0; int ch = 0; - // TODO: move chip dependent code to portable part + gpio_hal_context_t gpio_hal = { + .dev = GPIO_HAL_GET_HW(GPIO_PORT_0) + }; + //Make sure txd/rxd are enabled // use direct reg access instead of gpio_pullup_dis which can cause exception when flash cache is disabled REG_CLR_BIT(GPIO_PIN_REG_1, FUN_PU); -#if CONFIG_IDF_TARGET_ESP32P4 - gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U_PAD_GPIO38, FUNC_GPIO38_UART0_RXD_PAD); - gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U_PAD_GPIO37, FUNC_GPIO37_UART0_TXD_PAD); -#else - gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_U0RXD); - gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_U0TXD); -#endif + gpio_hal_func_sel(&gpio_hal, U0RXD_GPIO_NUM, U0RXD_MUX_FUNC); + gpio_hal_func_sel(&gpio_hal, U0TXD_GPIO_NUM, U0TXD_MUX_FUNC); ESP_COREDUMP_LOGI("Press Enter to print core dump to UART..."); const int cpu_ticks_per_ms = esp_clk_cpu_freq() / 1000; tm_end = esp_cpu_get_cycle_count() / cpu_ticks_per_ms + CONFIG_ESP_COREDUMP_UART_DELAY;