feat(coredump): replace fun sel function

This commit is contained in:
gaoxu 2024-04-25 10:52:32 +08:00
parent 3db559ab21
commit 6e4b50511e
2 changed files with 7 additions and 12 deletions

View File

@ -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);

View File

@ -6,6 +6,7 @@
#include <string.h>
#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;