diff --git a/components/bootloader_support/src/bootloader_clock_init.c b/components/bootloader_support/src/bootloader_clock_init.c index cb26082f60..4598eb6333 100644 --- a/components/bootloader_support/src/bootloader_clock_init.c +++ b/components/bootloader_support/src/bootloader_clock_init.c @@ -22,7 +22,7 @@ #include "hal/clk_tree_ll.h" #endif #include "esp_rom_sys.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" __attribute__((weak)) void bootloader_clock_configure(void) { diff --git a/components/bootloader_support/src/bootloader_console.c b/components/bootloader_support/src/bootloader_console.c index eb83ae8b13..c0b06e45c9 100644 --- a/components/bootloader_support/src/bootloader_console.c +++ b/components/bootloader_support/src/bootloader_console.c @@ -14,6 +14,7 @@ #include "soc/gpio_sig_map.h" #include "soc/rtc.h" #include "hal/gpio_ll.h" +#include "hal/uart_ll.h" #if CONFIG_IDF_TARGET_ESP32S2 #include "esp32s2/rom/usb/cdc_acm.h" #include "esp32s2/rom/usb/usb_common.h" @@ -22,7 +23,7 @@ #include "hal/usb_wrap_ll.h" #endif #include "esp_rom_gpio.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_caps.h" @@ -91,7 +92,7 @@ void bootloader_console_init(void) #if ESP_ROM_UART_CLK_IS_XTAL clock_hz = (uint32_t)rtc_clk_xtal_freq_get() * MHZ; // From esp32-s3 on, UART clk source is selected to XTAL in ROM #endif - esp_rom_uart_set_clock_baudrate(uart_num, clock_hz, CONFIG_ESP_CONSOLE_UART_BAUDRATE); + _uart_ll_set_baudrate(UART_LL_GET_HW(uart_num), CONFIG_ESP_CONSOLE_UART_BAUDRATE, clock_hz); } #endif // CONFIG_ESP_CONSOLE_UART diff --git a/components/bootloader_support/src/bootloader_console_loader.c b/components/bootloader_support/src/bootloader_console_loader.c index 5235bb32a9..83ef372b42 100644 --- a/components/bootloader_support/src/bootloader_console_loader.c +++ b/components/bootloader_support/src/bootloader_console_loader.c @@ -12,7 +12,7 @@ #include #include "sdkconfig.h" #include "bootloader_console.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #if CONFIG_IDF_TARGET_ESP32S2 #include "esp32s2/rom/usb/chip_usb_dw_wrapper.h" diff --git a/components/bootloader_support/src/bootloader_utility.c b/components/bootloader_support/src/bootloader_utility.c index 322db4a755..18004d4d6c 100644 --- a/components/bootloader_support/src/bootloader_utility.c +++ b/components/bootloader_support/src/bootloader_utility.c @@ -12,7 +12,7 @@ #include "esp_log.h" #include "esp_rom_sys.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "sdkconfig.h" #if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/cache.h" diff --git a/components/bootloader_support/src/esp32c2/bootloader_esp32c2.c b/components/bootloader_support/src/esp32c2/bootloader_esp32c2.c index c867d13dfb..381c4ea1fb 100644 --- a/components/bootloader_support/src/esp32c2/bootloader_esp32c2.c +++ b/components/bootloader_support/src/esp32c2/bootloader_esp32c2.c @@ -10,7 +10,7 @@ #include "esp_image_format.h" #include "flash_qio_mode.h" #include "esp_rom_gpio.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_spiflash.h" #include "soc/gpio_sig_map.h" diff --git a/components/bootloader_support/src/esp32c3/bootloader_esp32c3.c b/components/bootloader_support/src/esp32c3/bootloader_esp32c3.c index 6e5dd0b285..dff1999165 100644 --- a/components/bootloader_support/src/esp32c3/bootloader_esp32c3.c +++ b/components/bootloader_support/src/esp32c3/bootloader_esp32c3.c @@ -10,7 +10,7 @@ #include "esp_image_format.h" #include "flash_qio_mode.h" #include "esp_rom_gpio.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_spiflash.h" #include "soc/gpio_sig_map.h" diff --git a/components/bootloader_support/src/esp32c5/bootloader_esp32c5.c b/components/bootloader_support/src/esp32c5/bootloader_esp32c5.c index f9b745b1be..0b1f5924c0 100644 --- a/components/bootloader_support/src/esp32c5/bootloader_esp32c5.c +++ b/components/bootloader_support/src/esp32c5/bootloader_esp32c5.c @@ -10,7 +10,7 @@ #include "esp_image_format.h" #include "flash_qio_mode.h" #include "esp_rom_gpio.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_spiflash.h" #include "soc/soc_caps.h" diff --git a/components/bootloader_support/src/esp32c6/bootloader_esp32c6.c b/components/bootloader_support/src/esp32c6/bootloader_esp32c6.c index 54fa88a191..c7564a17b3 100644 --- a/components/bootloader_support/src/esp32c6/bootloader_esp32c6.c +++ b/components/bootloader_support/src/esp32c6/bootloader_esp32c6.c @@ -10,7 +10,7 @@ #include "esp_image_format.h" #include "flash_qio_mode.h" #include "esp_rom_gpio.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_spiflash.h" #include "soc/gpio_sig_map.h" diff --git a/components/bootloader_support/src/esp32c61/bootloader_esp32c61.c b/components/bootloader_support/src/esp32c61/bootloader_esp32c61.c index 27ea60c446..8d8ede2462 100644 --- a/components/bootloader_support/src/esp32c61/bootloader_esp32c61.c +++ b/components/bootloader_support/src/esp32c61/bootloader_esp32c61.c @@ -10,7 +10,7 @@ #include "esp_image_format.h" #include "flash_qio_mode.h" #include "esp_rom_gpio.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_spiflash.h" #include "soc/gpio_sig_map.h" diff --git a/components/bootloader_support/src/esp32h2/bootloader_esp32h2.c b/components/bootloader_support/src/esp32h2/bootloader_esp32h2.c index f7379fe91b..1ab9ad9f72 100644 --- a/components/bootloader_support/src/esp32h2/bootloader_esp32h2.c +++ b/components/bootloader_support/src/esp32h2/bootloader_esp32h2.c @@ -10,7 +10,7 @@ #include "esp_image_format.h" #include "flash_qio_mode.h" #include "esp_rom_gpio.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_spiflash.h" #include "soc/gpio_sig_map.h" diff --git a/components/bootloader_support/src/esp32h21/bootloader_esp32h21.c b/components/bootloader_support/src/esp32h21/bootloader_esp32h21.c index 005c624277..743fed7d0e 100644 --- a/components/bootloader_support/src/esp32h21/bootloader_esp32h21.c +++ b/components/bootloader_support/src/esp32h21/bootloader_esp32h21.c @@ -10,7 +10,7 @@ #include "esp_image_format.h" #include "flash_qio_mode.h" #include "esp_rom_gpio.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_spiflash.h" #include "soc/gpio_sig_map.h" diff --git a/components/bootloader_support/src/esp32h4/bootloader_esp32h4.c b/components/bootloader_support/src/esp32h4/bootloader_esp32h4.c index bfdb0547f1..b287226712 100644 --- a/components/bootloader_support/src/esp32h4/bootloader_esp32h4.c +++ b/components/bootloader_support/src/esp32h4/bootloader_esp32h4.c @@ -11,7 +11,7 @@ #include "flash_qio_mode.h" #include "esp_rom_gpio.h" #include "esp_rom_efuse.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_spiflash.h" #include "soc/gpio_sig_map.h" diff --git a/components/bootloader_support/src/esp32p4/bootloader_esp32p4.c b/components/bootloader_support/src/esp32p4/bootloader_esp32p4.c index 1e8ccaec29..2f12299a0a 100644 --- a/components/bootloader_support/src/esp32p4/bootloader_esp32p4.c +++ b/components/bootloader_support/src/esp32p4/bootloader_esp32p4.c @@ -10,7 +10,7 @@ #include "esp_image_format.h" #include "flash_qio_mode.h" #include "esp_rom_gpio.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_spiflash.h" #include "soc/gpio_sig_map.h" diff --git a/components/driver/test_apps/touch_sensor_v2/main/touch_scope.c b/components/driver/test_apps/touch_sensor_v2/main/touch_scope.c index e28b2b90f4..9606ff7ff2 100644 --- a/components/driver/test_apps/touch_sensor_v2/main/touch_scope.c +++ b/components/driver/test_apps/touch_sensor_v2/main/touch_scope.c @@ -7,7 +7,7 @@ #include #include "esp_err.h" #include "driver/uart.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #define ROM_UART_DRIVER_ENABLE 0 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 a8b32b8a87..c1a4d6e43f 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 @@ -28,7 +28,7 @@ #include "freertos/queue.h" #include "freertos/semphr.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "spi_flash_mmap.h" #include "esp_attr.h" diff --git a/components/esp_driver_ledc/test_apps/ledc/main/test_ledc_sleep.c b/components/esp_driver_ledc/test_apps/ledc/main/test_ledc_sleep.c index 39bea57ef1..bcd98eb398 100644 --- a/components/esp_driver_ledc/test_apps/ledc/main/test_ledc_sleep.c +++ b/components/esp_driver_ledc/test_apps/ledc/main/test_ledc_sleep.c @@ -16,7 +16,7 @@ #include "esp_private/esp_pmu.h" #include "soc/ledc_periph.h" #include "esp_private/sleep_retention.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" // Note. Test cases in this file cannot run one after another without reset diff --git a/components/esp_driver_uart/src/uart_vfs.c b/components/esp_driver_uart/src/uart_vfs.c index a9ef10e231..9d547db385 100644 --- a/components/esp_driver_uart/src/uart_vfs.c +++ b/components/esp_driver_uart/src/uart_vfs.c @@ -16,7 +16,7 @@ #include "driver/uart_vfs.h" #include "driver/uart.h" #include "driver/uart_select.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "hal/uart_ll.h" #include "soc/soc_caps.h" #include "esp_vfs_dev.h" // Old headers for the aliasing functions diff --git a/components/esp_driver_uart/test_apps/uart_vfs/main/test_vfs_uart.c b/components/esp_driver_uart/test_apps/uart_vfs/main/test_vfs_uart.c index b3266a625d..8e3c7f7486 100644 --- a/components/esp_driver_uart/test_apps/uart_vfs/main/test_vfs_uart.c +++ b/components/esp_driver_uart/test_apps/uart_vfs/main/test_vfs_uart.c @@ -12,7 +12,7 @@ #include #include #include "unity.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" diff --git a/components/esp_hw_support/port/esp32/rtc_clk_init.c b/components/esp_hw_support/port/esp32/rtc_clk_init.c index e9027ee0ff..5458b4b441 100644 --- a/components/esp_hw_support/port/esp32/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32/rtc_clk_init.c @@ -9,7 +9,7 @@ #include #include #include "esp32/rom/rtc.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_cpu.h" #include "soc/rtc.h" #include "soc/rtc_periph.h" diff --git a/components/esp_hw_support/port/esp32c2/rtc_clk_init.c b/components/esp_hw_support/port/esp32c2/rtc_clk_init.c index 38079149de..1e064313a7 100644 --- a/components/esp_hw_support/port/esp32c2/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32c2/rtc_clk_init.c @@ -17,7 +17,7 @@ #include "esp_hw_log.h" #include "esp_cpu.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" static const char *TAG = "rtc_clk_init"; diff --git a/components/esp_hw_support/port/esp32c3/rtc_clk_init.c b/components/esp_hw_support/port/esp32c3/rtc_clk_init.c index 502f16b8ec..f0530f6688 100644 --- a/components/esp_hw_support/port/esp32c3/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32c3/rtc_clk_init.c @@ -17,7 +17,7 @@ #include "esp_hw_log.h" #include "esp_cpu.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" static const char *TAG = "rtc_clk_init"; diff --git a/components/esp_hw_support/port/esp32c6/rtc_clk_init.c b/components/esp_hw_support/port/esp32c6/rtc_clk_init.c index 296f617394..a01979dfbd 100644 --- a/components/esp_hw_support/port/esp32c6/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32c6/rtc_clk_init.c @@ -17,7 +17,7 @@ #include "soc/regi2c_dig_reg.h" #include "esp_hw_log.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_private/esp_pmu.h" #include "hal/clk_tree_ll.h" #include "hal/pmu_ll.h" diff --git a/components/esp_hw_support/port/esp32h2/rtc_clk_init.c b/components/esp_hw_support/port/esp32h2/rtc_clk_init.c index f3496e6c6d..f400553e5a 100644 --- a/components/esp_hw_support/port/esp32h2/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32h2/rtc_clk_init.c @@ -17,7 +17,7 @@ #include "soc/regi2c_pmu.h" #include "esp_hw_log.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "hal/clk_tree_ll.h" #include "soc/pmu_reg.h" #include "pmu_param.h" diff --git a/components/esp_hw_support/port/esp32h4/rtc_clk_init.c b/components/esp_hw_support/port/esp32h4/rtc_clk_init.c index e700f32d3d..ce04b33c9a 100644 --- a/components/esp_hw_support/port/esp32h4/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32h4/rtc_clk_init.c @@ -18,7 +18,7 @@ #include "soc/regi2c_dig_reg.h" #include "esp_hw_log.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_private/esp_pmu.h" #include "hal/clk_tree_ll.h" #include "hal/pmu_ll.h" diff --git a/components/esp_hw_support/port/esp32p4/pmu_sleep.c b/components/esp_hw_support/port/esp32p4/pmu_sleep.c index 61f383de47..b1090b088c 100644 --- a/components/esp_hw_support/port/esp32p4/pmu_sleep.c +++ b/components/esp_hw_support/port/esp32p4/pmu_sleep.c @@ -34,7 +34,7 @@ #include "esp_private/esp_pmu.h" #include "pmu_param.h" #include "esp_rom_sys.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "hal/efuse_hal.h" #if CONFIG_SPIRAM #include "hal/ldo_ll.h" diff --git a/components/esp_hw_support/port/esp32p4/rtc_clk_init.c b/components/esp_hw_support/port/esp32p4/rtc_clk_init.c index 2cd85e78f1..27909eb58c 100644 --- a/components/esp_hw_support/port/esp32p4/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32p4/rtc_clk_init.c @@ -20,7 +20,7 @@ #include "soc/pmu_reg.h" #include "esp_hw_log.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_private/esp_pmu.h" #include "hal/clk_tree_ll.h" diff --git a/components/esp_hw_support/port/esp32s2/rtc_clk_init.c b/components/esp_hw_support/port/esp32s2/rtc_clk_init.c index be497e6d59..acc445ed82 100644 --- a/components/esp_hw_support/port/esp32s2/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32s2/rtc_clk_init.c @@ -9,7 +9,7 @@ #include #include #include "esp32s2/rom/rtc.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "soc/rtc.h" #include "soc/rtc_periph.h" #include "soc/syscon_reg.h" diff --git a/components/esp_hw_support/port/esp32s3/rtc_clk_init.c b/components/esp_hw_support/port/esp32s3/rtc_clk_init.c index 852c4ede49..58a4c0aa85 100644 --- a/components/esp_hw_support/port/esp32s3/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32s3/rtc_clk_init.c @@ -8,7 +8,7 @@ #include #include #include -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp32s3/rom/rtc.h" #include "soc/rtc.h" #include "soc/rtc_cntl_reg.h" diff --git a/components/esp_hw_support/power_supply/brownout.c b/components/esp_hw_support/power_supply/brownout.c index adcc15336d..27179f3641 100644 --- a/components/esp_hw_support/power_supply/brownout.c +++ b/components/esp_hw_support/power_supply/brownout.c @@ -23,7 +23,7 @@ #include "hal/brownout_hal.h" #include "hal/brownout_ll.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "hal/uart_ll.h" #include "soc/power_supply_periph.h" #include "esp_brownout.h" diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index f6d48b9309..29b906c5ee 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -71,7 +71,7 @@ #include "hal/mspi_ll.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_private/cache_utils.h" #include "esp_private/brownout.h" diff --git a/components/esp_hw_support/sleep_wake_stub.c b/components/esp_hw_support/sleep_wake_stub.c index 4c8adefa32..70ad9a4f01 100644 --- a/components/esp_hw_support/sleep_wake_stub.c +++ b/components/esp_hw_support/sleep_wake_stub.c @@ -31,7 +31,7 @@ #endif #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #ifdef CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_dport.c b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_dport.c index fa6d329c40..8e6d275b00 100644 --- a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_dport.c +++ b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_dport.c @@ -22,7 +22,7 @@ #include "driver/uart.h" #include "unity.h" #include "test_utils.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "hal/uart_types.h" #include "hal/uart_ll.h" #include "soc/dport_reg.h" diff --git a/components/esp_hw_support/test_apps/rtc_clk/main/test_rtc_clk.c b/components/esp_hw_support/test_apps/rtc_clk/main/test_rtc_clk.c index 923bc74c58..b7e1bcff4f 100644 --- a/components/esp_hw_support/test_apps/rtc_clk/main/test_rtc_clk.c +++ b/components/esp_hw_support/test_apps/rtc_clk/main/test_rtc_clk.c @@ -19,7 +19,7 @@ #include "freertos/task.h" #include "esp_rom_gpio.h" #include "esp_rom_sys.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "test_utils.h" #include "esp_random.h" #include "esp_sleep.h" diff --git a/components/esp_rom/CMakeLists.txt b/components/esp_rom/CMakeLists.txt index c75e227101..968c974fa5 100644 --- a/components/esp_rom/CMakeLists.txt +++ b/components/esp_rom/CMakeLists.txt @@ -19,7 +19,7 @@ if(target STREQUAL "linux") "${target}/esp_rom_efuse.c") else() list(APPEND sources "patches/esp_rom_crc.c" - "patches/esp_rom_uart.c" + "patches/esp_rom_serial_output.c" "patches/esp_rom_spiflash.c" "patches/esp_rom_efuse.c" "patches/esp_rom_gpio.c") diff --git a/components/esp_rom/README.md b/components/esp_rom/README.md index e1f7f4385e..7249c63301 100644 --- a/components/esp_rom/README.md +++ b/components/esp_rom/README.md @@ -60,7 +60,7 @@ As ROM functions are unique to each target, features are as well. For example, E │   ├── esp_rom_gpio.h │   ├── esp_rom_md5.h │   ├── esp_rom_sys.h -│   ├── esp_rom_uart.h +│   ├── esp_rom_serial_output.h │   └── ... // other ROM wrapper api files ├── Kconfig.projbuild ├── linker.lf diff --git a/components/esp_rom/include/esp_rom_serial_output.h b/components/esp_rom/include/esp_rom_serial_output.h new file mode 100644 index 0000000000..2e77345732 --- /dev/null +++ b/components/esp_rom/include/esp_rom_serial_output.h @@ -0,0 +1,98 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Wait for TX FIFO is empty and all data has been sent out. + * + * @param serial_num The serial number defined in ROM, including UART_x, USB_OTG, USB_SERIAL_JTAG. + * Use ESP_ROM_USB_SERIAL_DEVICE_NUM or ESP_ROM_USB_OTG_NUM to identify USB_SERIAL_JTAG and USB_OTG, respectively. + */ +void esp_rom_output_tx_wait_idle(uint8_t serial_num); + +/** + * @brief Flush TX FIFO + * + * @param serial_num The serial number defined in ROM, including UART_x, USB_OTG, USB_SERIAL_JTAG. + * Use ESP_ROM_USB_SERIAL_DEVICE_NUM or ESP_ROM_USB_OTG_NUM to identify USB_SERIAL_JTAG and USB_OTG, respectively. + */ +void esp_rom_output_flush_tx(uint8_t serial_num); + +/** + * @brief Transmit one character to the console channel. + * + * @param c Character to send + * @return + * - 0 on success + * - 1 on failure + */ +int esp_rom_output_tx_one_char(uint8_t c); + +/** + * @brief Transmit one character to the console channel. + * @note This function can help handle line ending issue by replacing '\n' with '\r\n'. + * + * @param c Character to send + */ +void esp_rom_output_putc(char c); + +/** + * @brief Get one character from the console channel. + * + * @param c Where to store the character + * @return + * - 0 on success + * - 1 on failure or no data available + */ +int esp_rom_output_rx_one_char(uint8_t *c); + +/** + * @brief Get one line of string from console channel (line ending won't be stored in the buffer). + * + * @param str Where to store the string + * @param max_len Maximum length of the buffer (including the NULL delimiter) + * @return always return 0 when on success or wait in a loop for rx data + */ +int esp_rom_output_rx_string(uint8_t *str, uint8_t max_len); + +/** + * @brief Set the serial port used by ROM printf + * + * @param serial_num The serial number defined in ROM, including UART_x, USB_OTG, USB_SERIAL_JTAG. + * Use ESP_ROM_USB_SERIAL_DEVICE_NUM or ESP_ROM_USB_OTG_NUM to identify USB_SERIAL_JTAG and USB_OTG, respectively. + */ +void esp_rom_output_set_as_console(uint8_t serial_num); + +/** + * @brief Switch the serial port that will use a buffer for TX and RX. + * + * @param serial_num The serial number defined in ROM, including UART_x, USB_OTG, USB_SERIAL_JTAG. + * Use ESP_ROM_USB_SERIAL_DEVICE_NUM or ESP_ROM_USB_OTG_NUM to identify USB_SERIAL_JTAG and USB_OTG, respectively. + */ +void esp_rom_output_switch_buffer(uint8_t serial_num); + + +#define ESP_ROM_CDC_ACM_WORK_BUF_MIN 128 + +/** + * @brief Initialize the USB ACM + * @note The ACM working memory should be at least 128 bytes (ESP_ROM_CDC_ACM_WORK_BUF_MIN) in size. + * + * @param cdc_acm_work_mem Pointer to the work memory used for CDC-ACM + * @param cdc_acm_work_mem_len Length of work memory + */ +void esp_rom_output_usb_acm_init(void *cdc_acm_work_mem, int cdc_acm_work_mem_len); + +#ifdef __cplusplus +} +#endif diff --git a/components/esp_rom/include/esp_rom_uart.h b/components/esp_rom/include/esp_rom_uart.h index c09b7c5ac2..145a5dee3e 100644 --- a/components/esp_rom/include/esp_rom_uart.h +++ b/components/esp_rom/include/esp_rom_uart.h @@ -1,19 +1,20 @@ /* - * SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2010-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #pragma once -#ifdef __cplusplus -extern "C" { -#endif +#warning "This header file is deprecated, please use esp_rom_serial_output.h instead" #include #include "hal/uart_ll.h" +#include "esp_rom_serial_output.h" -#define ESP_ROM_CDC_ACM_WORK_BUF_MIN 128 +#ifdef __cplusplus +extern "C" { +#endif typedef enum { ESP_ROM_UART_0, @@ -26,9 +27,8 @@ typedef enum { * * @param serial_num The serial number defined in ROM, including UART_x, USB_OTG, USB_SERIAL_JTAG.. */ -void esp_rom_output_tx_wait_idle(uint8_t serial_num); - -void esp_rom_uart_tx_wait_idle(uint8_t serial_num) __attribute__((deprecated("Please use esp_rom_output_tx_wait_idle instead"))); +__attribute__((deprecated("Please use esp_rom_output_tx_wait_idle instead"))) +void esp_rom_uart_tx_wait_idle(uint8_t serial_num); /** * @brief Set clock source and baud rate for UART. @@ -46,9 +46,8 @@ void esp_rom_uart_tx_wait_idle(uint8_t serial_num) __attribute__((deprecated("Pl * * @param serial_num UART port number */ -void esp_rom_output_flush_tx(uint8_t serial_num); - -void esp_rom_uart_flush_tx(uint8_t serial_num) __attribute__((deprecated("Please use esp_rom_output_flush_tx instead"))); +__attribute__((deprecated("Please use esp_rom_output_flush_tx instead"))) +void esp_rom_uart_flush_tx(uint8_t serial_num); /** * @brief Transmit one character to the console channel. @@ -58,9 +57,8 @@ void esp_rom_uart_flush_tx(uint8_t serial_num) __attribute__((deprecated("Please * - 0 on success * - 1 on failure */ -int esp_rom_output_tx_one_char(uint8_t c); - -int esp_rom_uart_tx_one_char(uint8_t c) __attribute__((deprecated("Please use esp_rom_output_tx_one_char instead"))); +__attribute__((deprecated("Please use esp_rom_output_tx_one_char instead"))) +int esp_rom_uart_tx_one_char(uint8_t c); /** * @brief Transmit one character to the console channel. @@ -68,9 +66,8 @@ int esp_rom_uart_tx_one_char(uint8_t c) __attribute__((deprecated("Please use es * * @param c Character to send */ -void esp_rom_output_putc(char c); - -void esp_rom_uart_putc(char c) __attribute__((deprecated("Please use esp_rom_output_putc instead"))); +__attribute__((deprecated("Please use esp_rom_output_putc instead"))) +void esp_rom_uart_putc(char c); /** * @brief Get one character from the console channel. @@ -80,9 +77,8 @@ void esp_rom_uart_putc(char c) __attribute__((deprecated("Please use esp_rom_out * - 0 on success * - 1 on failure or no data available */ -int esp_rom_output_rx_one_char(uint8_t *c); - -int esp_rom_uart_rx_one_char(uint8_t *c) __attribute__((deprecated("Please use esp_rom_output_rx_one_char instead"))); +__attribute__((deprecated("Please use esp_rom_output_rx_one_char instead"))) +int esp_rom_uart_rx_one_char(uint8_t *c); /** * @brief Get one line of string from console channel (line ending won't be stored in the buffer). @@ -91,9 +87,8 @@ int esp_rom_uart_rx_one_char(uint8_t *c) __attribute__((deprecated("Please use e * @param max_len Maximum length of the buffer (including the NULL delimiter) * @return always return 0 when on success or wait in a loop for rx data */ -int esp_rom_output_rx_string(uint8_t *str, uint8_t max_len); - -int esp_rom_uart_rx_string(uint8_t *str, uint8_t max_len) __attribute__((deprecated("Please use esp_rom_output_rx_string instead"))); +__attribute__((deprecated("Please use esp_rom_output_rx_string instead"))) +int esp_rom_uart_rx_string(uint8_t *str, uint8_t max_len); /** * @brief Set the UART port used by ets_printf. @@ -103,9 +98,8 @@ int esp_rom_uart_rx_string(uint8_t *str, uint8_t max_len) __attribute__((depreca * * @param serial_num UART port number */ -void esp_rom_output_set_as_console(uint8_t serial_num); - -void esp_rom_uart_set_as_console(uint8_t serial_num) __attribute__((deprecated("Please use esp_rom_output_set_as_console instead"))); +__attribute__((deprecated("Please use esp_rom_output_set_as_console instead"))) +void esp_rom_uart_set_as_console(uint8_t serial_num); /** * @brief Switch the UART port that will use a buffer for TX and RX. @@ -115,20 +109,18 @@ void esp_rom_uart_set_as_console(uint8_t serial_num) __attribute__((deprecated(" * * @param serial_num UART port number */ -void esp_rom_output_switch_buffer(uint8_t serial_num); - -void esp_rom_uart_switch_buffer(uint8_t serial_num) __attribute__((deprecated("Please use esp_rom_output_switch_buffer instead"))); +__attribute__((deprecated("Please use esp_rom_output_switch_buffer instead"))) +void esp_rom_uart_switch_buffer(uint8_t serial_num); /** * @brief Initialize the USB ACM UART - * @note The ACM working memroy should be at least 128 bytes (ESP_ROM_CDC_ACM_WORK_BUF_MIN) in size. + * @note The ACM working memory should be at least 128 bytes (ESP_ROM_CDC_ACM_WORK_BUF_MIN) in size. * - * @param cdc_acm_work_mem Pointer to the work memroy used for CDC-ACM + * @param cdc_acm_work_mem Pointer to the work memory used for CDC-ACM * @param cdc_acm_work_mem_len Length of work memory */ -void esp_rom_output_usb_acm_init(void *cdc_acm_work_mem, int cdc_acm_work_mem_len); - -void esp_rom_uart_usb_acm_init(uint8_t serial_num) __attribute__((deprecated("Please use esp_rom_output_usb_acm_init instead"))); +__attribute__((deprecated("Please use esp_rom_output_usb_acm_init instead"))) +void esp_rom_uart_usb_acm_init(void *cdc_acm_work_mem, int cdc_acm_work_mem_len); #ifdef __cplusplus } diff --git a/components/esp_rom/patches/esp_rom_uart.c b/components/esp_rom/patches/esp_rom_serial_output.c similarity index 100% rename from components/esp_rom/patches/esp_rom_uart.c rename to components/esp_rom/patches/esp_rom_serial_output.c diff --git a/components/esp_rom/patches/esp_rom_sys.c b/components/esp_rom/patches/esp_rom_sys.c index cc840e1c73..6ff8c8079b 100644 --- a/components/esp_rom/patches/esp_rom_sys.c +++ b/components/esp_rom/patches/esp_rom_sys.c @@ -9,7 +9,7 @@ #include #include "soc/soc_caps.h" #include "esp_rom_caps.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "rom/ets_sys.h" #include "sdkconfig.h" diff --git a/components/esp_system/esp_system_console.c b/components/esp_system/esp_system_console.c index d2c80081db..f944e2f657 100644 --- a/components/esp_system/esp_system_console.c +++ b/components/esp_system/esp_system_console.c @@ -5,7 +5,7 @@ */ #include "esp_system_console.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_usb_serial.h" #include "esp_rom_caps.h" diff --git a/components/esp_system/fpga_overrides_clk.c b/components/esp_system/fpga_overrides_clk.c index 4ed9d9be3b..34de624cee 100644 --- a/components/esp_system/fpga_overrides_clk.c +++ b/components/esp_system/fpga_overrides_clk.c @@ -19,7 +19,7 @@ #include "esp_log.h" #include "esp_rom_sys.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" static const char *TAG = "fpga_clk"; diff --git a/components/esp_system/port/cpu_start.c b/components/esp_system/port/cpu_start.c index 0afbd83254..0c3c21e854 100644 --- a/components/esp_system/port/cpu_start.c +++ b/components/esp_system/port/cpu_start.c @@ -18,7 +18,7 @@ #include "esp_private/cache_err_int.h" #include "esp_clk_internal.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_caps.h" #include "sdkconfig.h" @@ -97,6 +97,7 @@ #include "hal/cache_hal.h" #include "hal/cache_ll.h" #include "hal/efuse_ll.h" +#include "hal/uart_ll.h" #include "hal/cpu_utility_ll.h" #include "soc/periph_defs.h" #include "esp_cpu.h" @@ -764,9 +765,7 @@ NOINLINE_ATTR static void system_early_init(const soc_reset_reason_t *rst_reas) #endif esp_rom_output_tx_wait_idle(CONFIG_ESP_CONSOLE_ROM_SERIAL_PORT_NUM); - // In a single thread mode, the freertos is not started yet. So don't have to use a critical section. - int __DECLARE_RCC_ATOMIC_ENV __attribute__((unused)); // To avoid build errors about spinlock's __DECLARE_RCC_ATOMIC_ENV - esp_rom_uart_set_clock_baudrate(CONFIG_ESP_CONSOLE_ROM_SERIAL_PORT_NUM, clock_hz, CONFIG_ESP_CONSOLE_UART_BAUDRATE); + _uart_ll_set_baudrate(UART_LL_GET_HW(CONFIG_ESP_CONSOLE_ROM_SERIAL_PORT_NUM), CONFIG_ESP_CONSOLE_UART_BAUDRATE, clock_hz); #endif #endif diff --git a/components/esp_system/port/esp_system_chip.c b/components/esp_system/port/esp_system_chip.c index 95507b322f..3304d31207 100644 --- a/components/esp_system/port/esp_system_chip.c +++ b/components/esp_system/port/esp_system_chip.c @@ -15,7 +15,7 @@ #include "esp_private/panic_internal.h" #include "esp_private/system_internal.h" #include "esp_heap_caps.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "sdkconfig.h" diff --git a/components/esp_system/port/soc/esp32/clk.c b/components/esp_system/port/soc/esp32/clk.c index 91bb4199f6..23002326fe 100644 --- a/components/esp_system/port/soc/esp32/clk.c +++ b/components/esp_system/port/soc/esp32/clk.c @@ -17,7 +17,7 @@ #include "esp_log.h" #include "esp_cpu.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "sdkconfig.h" diff --git a/components/esp_system/port/soc/esp32/system_internal.c b/components/esp_system/port/soc/esp32/system_internal.c index b64320d70d..314b2c048a 100644 --- a/components/esp_system/port/soc/esp32/system_internal.c +++ b/components/esp_system/port/soc/esp32/system_internal.c @@ -12,7 +12,7 @@ #include "esp_log.h" #include "esp_ipc_isr.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "soc/dport_reg.h" #include "soc/gpio_periph.h" #include "soc/efuse_periph.h" @@ -22,6 +22,7 @@ #include "soc/rtc.h" #include "esp_private/rtc_clk.h" #include "hal/wdt_hal.h" +#include "hal/uart_ll.h" #include "soc/soc_memory_layout.h" #include "esp_private/cache_err_int.h" diff --git a/components/esp_system/port/soc/esp32c2/clk.c b/components/esp_system/port/soc/esp32c2/clk.c index d9efd4d598..4f786be4b6 100644 --- a/components/esp_system/port/soc/esp32c2/clk.c +++ b/components/esp_system/port/soc/esp32c2/clk.c @@ -25,7 +25,7 @@ #include "esp_private/periph_ctrl.h" #include "bootloader_clock.h" #include "soc/syscon_reg.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" /* Number of cycles to wait from the 32k XTAL oscillator to consider it running. * Larger values increase startup delay. Smaller values may cause false positive diff --git a/components/esp_system/port/soc/esp32c2/system_internal.c b/components/esp_system/port/soc/esp32c2/system_internal.c index db474d11b3..46674fb221 100644 --- a/components/esp_system/port/soc/esp32c2/system_internal.c +++ b/components/esp_system/port/soc/esp32c2/system_internal.c @@ -12,7 +12,7 @@ #include "esp_attr.h" #include "esp_log.h" #include "riscv/rv_utils.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "soc/gpio_reg.h" #include "soc/timer_group_reg.h" #include "esp_cpu.h" @@ -22,6 +22,7 @@ #include "soc/syscon_reg.h" #include "soc/system_reg.h" #include "hal/wdt_hal.h" +#include "hal/uart_ll.h" #include "esp_private/cache_err_int.h" #include "esp32c2/rom/cache.h" diff --git a/components/esp_system/port/soc/esp32c3/clk.c b/components/esp_system/port/soc/esp32c3/clk.c index d7d6b53624..09bc8eeb8b 100644 --- a/components/esp_system/port/soc/esp32c3/clk.c +++ b/components/esp_system/port/soc/esp32c3/clk.c @@ -25,7 +25,7 @@ #include "esp_private/periph_ctrl.h" #include "esp_private/esp_clk.h" #include "soc/syscon_reg.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" /* Number of cycles to wait from the 32k XTAL oscillator to consider it running. diff --git a/components/esp_system/port/soc/esp32c3/system_internal.c b/components/esp_system/port/soc/esp32c3/system_internal.c index 674b55f7a0..2edbf81732 100644 --- a/components/esp_system/port/soc/esp32c3/system_internal.c +++ b/components/esp_system/port/soc/esp32c3/system_internal.c @@ -12,7 +12,7 @@ #include "esp_attr.h" #include "esp_log.h" #include "riscv/rv_utils.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "soc/gpio_reg.h" #include "soc/timer_group_reg.h" #include "esp_cpu.h" @@ -23,6 +23,7 @@ #include "soc/system_reg.h" #include "soc/uart_reg.h" #include "hal/wdt_hal.h" +#include "hal/uart_ll.h" #include "esp_private/cache_err_int.h" #include "esp32c3/rom/cache.h" diff --git a/components/esp_system/port/soc/esp32c5/clk.c b/components/esp_system/port/soc/esp32c5/clk.c index 2c14e538b7..32176e77f9 100644 --- a/components/esp_system/port/soc/esp32c5/clk.c +++ b/components/esp_system/port/soc/esp32c5/clk.c @@ -64,7 +64,7 @@ #include "esp_private/periph_ctrl.h" #include "esp_private/esp_clk.h" #include "esp_private/esp_pmu.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" /* Number of cycles to wait from the 32k XTAL oscillator to consider it running. diff --git a/components/esp_system/port/soc/esp32c5/system_internal.c b/components/esp_system/port/soc/esp32c5/system_internal.c index 6c1e701d26..b388208910 100644 --- a/components/esp_system/port/soc/esp32c5/system_internal.c +++ b/components/esp_system/port/soc/esp32c5/system_internal.c @@ -13,7 +13,7 @@ #include "esp_log.h" #include "esp_rom_sys.h" #include "riscv/rv_utils.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "soc/soc_caps.h" #include "soc/gpio_reg.h" #include "esp_cpu.h" diff --git a/components/esp_system/port/soc/esp32c6/clk.c b/components/esp_system/port/soc/esp32c6/clk.c index 1405904db6..e322e7d0ef 100644 --- a/components/esp_system/port/soc/esp32c6/clk.c +++ b/components/esp_system/port/soc/esp32c6/clk.c @@ -45,7 +45,7 @@ #include "esp_private/periph_ctrl.h" #include "esp_private/esp_clk.h" #include "esp_private/esp_pmu.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" /* Number of cycles to wait from the 32k XTAL oscillator to consider it running. diff --git a/components/esp_system/port/soc/esp32c6/system_internal.c b/components/esp_system/port/soc/esp32c6/system_internal.c index 4652cda722..dcd653c4ce 100644 --- a/components/esp_system/port/soc/esp32c6/system_internal.c +++ b/components/esp_system/port/soc/esp32c6/system_internal.c @@ -13,7 +13,7 @@ #include "esp_log.h" #include "esp_rom_sys.h" #include "riscv/rv_utils.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "soc/gpio_reg.h" #include "esp_cpu.h" #include "soc/rtc.h" @@ -22,6 +22,7 @@ #include "soc/uart_reg.h" #include "hal/uart_ll.h" #include "hal/wdt_hal.h" +#include "hal/uart_ll.h" #include "hal/modem_syscon_ll.h" #include "hal/modem_lpcon_ll.h" #include "esp_private/cache_err_int.h" diff --git a/components/esp_system/port/soc/esp32c61/clk.c b/components/esp_system/port/soc/esp32c61/clk.c index 12d52156fc..2d37b07149 100644 --- a/components/esp_system/port/soc/esp32c61/clk.c +++ b/components/esp_system/port/soc/esp32c61/clk.c @@ -23,7 +23,7 @@ #include "esp_private/periph_ctrl.h" #include "esp_private/esp_clk.h" #include "esp_private/esp_pmu.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" /* Number of cycles to wait from the 32k XTAL oscillator to consider it running. diff --git a/components/esp_system/port/soc/esp32c61/system_internal.c b/components/esp_system/port/soc/esp32c61/system_internal.c index 6a64bf21db..219152b4d4 100644 --- a/components/esp_system/port/soc/esp32c61/system_internal.c +++ b/components/esp_system/port/soc/esp32c61/system_internal.c @@ -13,7 +13,7 @@ #include "esp_log.h" #include "esp_rom_sys.h" #include "riscv/rv_utils.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "soc/gpio_reg.h" #include "esp_cpu.h" #include "soc/rtc.h" @@ -22,6 +22,7 @@ #include "soc/uart_reg.h" #include "hal/uart_ll.h" #include "hal/wdt_hal.h" +#include "hal/uart_ll.h" #include "esp_private/cache_err_int.h" #if SOC_MODEM_CLOCK_SUPPORTED diff --git a/components/esp_system/port/soc/esp32h2/clk.c b/components/esp_system/port/soc/esp32h2/clk.c index 2401b1136a..524e6d74dd 100644 --- a/components/esp_system/port/soc/esp32h2/clk.c +++ b/components/esp_system/port/soc/esp32h2/clk.c @@ -46,7 +46,7 @@ #include "esp_private/periph_ctrl.h" #include "esp_private/esp_clk.h" #include "esp_private/esp_pmu.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_sleep.h" diff --git a/components/esp_system/port/soc/esp32h2/system_internal.c b/components/esp_system/port/soc/esp32h2/system_internal.c index eb750868b9..3bacf88ade 100644 --- a/components/esp_system/port/soc/esp32h2/system_internal.c +++ b/components/esp_system/port/soc/esp32h2/system_internal.c @@ -14,7 +14,7 @@ #include "esp_rom_sys.h" #include "riscv/rv_utils.h" #include "riscv/interrupt.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "soc/gpio_reg.h" #include "esp_cpu.h" #include "soc/rtc.h" @@ -22,6 +22,7 @@ #include "soc/rtc_periph.h" #include "soc/uart_reg.h" #include "hal/wdt_hal.h" +#include "hal/uart_ll.h" #include "hal/spimem_flash_ll.h" #include "hal/uart_ll.h" #include "esp_private/cache_err_int.h" diff --git a/components/esp_system/port/soc/esp32h21/clk.c b/components/esp_system/port/soc/esp32h21/clk.c index c377305ef1..71f1927bbe 100644 --- a/components/esp_system/port/soc/esp32h21/clk.c +++ b/components/esp_system/port/soc/esp32h21/clk.c @@ -23,7 +23,7 @@ #include "esp_private/periph_ctrl.h" #include "esp_private/esp_clk.h" #include "esp_private/esp_pmu.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_sleep.h" diff --git a/components/esp_system/port/soc/esp32h21/system_internal.c b/components/esp_system/port/soc/esp32h21/system_internal.c index 4f88da7e16..00ccdd2f08 100644 --- a/components/esp_system/port/soc/esp32h21/system_internal.c +++ b/components/esp_system/port/soc/esp32h21/system_internal.c @@ -13,7 +13,8 @@ #include "esp_rom_sys.h" #include "riscv/rv_utils.h" #include "riscv/interrupt.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" +#include "soc/soc_caps.h" #include "soc/gpio_reg.h" #include "esp_cpu.h" #include "soc/rtc.h" @@ -22,6 +23,7 @@ #include "soc/uart_reg.h" #include "hal/uart_ll.h" #include "hal/wdt_hal.h" +#include "hal/uart_ll.h" #include "hal/spimem_flash_ll.h" #include "esp_private/cache_err_int.h" diff --git a/components/esp_system/port/soc/esp32h4/clk.c b/components/esp_system/port/soc/esp32h4/clk.c index 8bd90cfa00..2320f5b2d9 100644 --- a/components/esp_system/port/soc/esp32h4/clk.c +++ b/components/esp_system/port/soc/esp32h4/clk.c @@ -23,7 +23,7 @@ #include "esp_private/periph_ctrl.h" #include "esp_private/esp_clk.h" #include "esp_private/esp_pmu.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" //TODO: [ESP32H4] IDF-12285 inherited from verification branch, need check diff --git a/components/esp_system/port/soc/esp32h4/system_internal.c b/components/esp_system/port/soc/esp32h4/system_internal.c index 960e65f181..40bd2f9eac 100644 --- a/components/esp_system/port/soc/esp32h4/system_internal.c +++ b/components/esp_system/port/soc/esp32h4/system_internal.c @@ -13,7 +13,8 @@ #include "esp_macros.h" #include "esp_rom_sys.h" #include "riscv/rv_utils.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" +#include "soc/soc_caps.h" #include "soc/gpio_reg.h" #include "esp_cpu.h" #include "soc/rtc.h" diff --git a/components/esp_system/port/soc/esp32p4/clk.c b/components/esp_system/port/soc/esp32p4/clk.c index abe9fb58c3..bbefdaa9cd 100644 --- a/components/esp_system/port/soc/esp32p4/clk.c +++ b/components/esp_system/port/soc/esp32p4/clk.c @@ -63,7 +63,7 @@ #include "esp_private/periph_ctrl.h" #include "esp_private/esp_clk.h" #include "esp_private/esp_pmu.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" /* Number of cycles to wait from the 32k XTAL oscillator to consider it running. diff --git a/components/esp_system/port/soc/esp32p4/system_internal.c b/components/esp_system/port/soc/esp32p4/system_internal.c index 3b9955a629..d5af77ffab 100644 --- a/components/esp_system/port/soc/esp32p4/system_internal.c +++ b/components/esp_system/port/soc/esp32p4/system_internal.c @@ -13,7 +13,7 @@ #include "esp_log.h" #include "esp_rom_sys.h" #include "riscv/rv_utils.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "soc/gpio_reg.h" #include "esp_cpu.h" #include "soc/rtc.h" @@ -28,6 +28,7 @@ #include "soc/hp_sys_clkrst_reg.h" #include "soc/lp_clkrst_reg.h" #include "soc/hp_system_reg.h" +#include "hal/uart_ll.h" #include "hal/gdma_ll.h" #include "hal/axi_dma_ll.h" #include "hal/dw_gdma_ll.h" diff --git a/components/esp_system/port/soc/esp32s2/clk.c b/components/esp_system/port/soc/esp32s2/clk.c index 0335b56a22..3addb999fc 100644 --- a/components/esp_system/port/soc/esp32s2/clk.c +++ b/components/esp_system/port/soc/esp32s2/clk.c @@ -13,7 +13,7 @@ #include "esp_log.h" #include "esp_cpu.h" #include "esp_clk_internal.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "soc/system_reg.h" #include "soc/dport_reg.h" diff --git a/components/esp_system/port/soc/esp32s2/system_internal.c b/components/esp_system/port/soc/esp32s2/system_internal.c index 9c37dc9f56..71955c13ad 100644 --- a/components/esp_system/port/soc/esp32s2/system_internal.c +++ b/components/esp_system/port/soc/esp32s2/system_internal.c @@ -12,7 +12,7 @@ #include "esp_attr.h" #include "esp_log.h" #include "esp32s2/rom/cache.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "soc/dport_reg.h" #include "soc/gpio_reg.h" #include "soc/timer_group_reg.h" @@ -22,6 +22,7 @@ #include "soc/syscon_reg.h" #include "soc/rtc_periph.h" #include "hal/wdt_hal.h" +#include "hal/uart_ll.h" #include "soc/soc_memory_layout.h" #include "esp32s2/rom/rtc.h" diff --git a/components/esp_system/port/soc/esp32s3/clk.c b/components/esp_system/port/soc/esp32s3/clk.c index 63b95d8a1f..a9f6f17dc5 100644 --- a/components/esp_system/port/soc/esp32s3/clk.c +++ b/components/esp_system/port/soc/esp32s3/clk.c @@ -13,7 +13,7 @@ #include "esp_log.h" #include "esp_cpu.h" #include "esp_clk_internal.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "soc/system_reg.h" #include "soc/soc.h" diff --git a/components/esp_system/port/soc/esp32s3/system_internal.c b/components/esp_system/port/soc/esp32s3/system_internal.c index 9e9fd4960d..f8484603d3 100644 --- a/components/esp_system/port/soc/esp32s3/system_internal.c +++ b/components/esp_system/port/soc/esp32s3/system_internal.c @@ -12,7 +12,8 @@ #include "esp_private/system_internal.h" #include "esp_attr.h" #include "esp_log.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" +#include "soc/soc_caps.h" #include "soc/dport_reg.h" #include "soc/gpio_reg.h" #include "soc/timer_group_reg.h" @@ -22,6 +23,7 @@ #include "soc/syscon_reg.h" #include "soc/rtc_periph.h" #include "hal/wdt_hal.h" +#include "hal/uart_ll.h" #include "soc/soc_memory_layout.h" #include "esp32s3/rom/cache.h" diff --git a/components/esp_system/port/usb_console.c b/components/esp_system/port/usb_console.c index b81b462652..45a3844f87 100644 --- a/components/esp_system/port/usb_console.c +++ b/components/esp_system/port/usb_console.c @@ -25,7 +25,7 @@ #include "soc/usb_struct.h" #include "soc/usb_reg.h" #include "hal/soc_hal.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_rom_caps.h" #ifdef CONFIG_IDF_TARGET_ESP32S2 diff --git a/components/esp_system/test_apps/console/main/test_app_main.c b/components/esp_system/test_apps/console/main/test_app_main.c index de0afe5c4a..85fa844608 100644 --- a/components/esp_system/test_apps/console/main/test_app_main.c +++ b/components/esp_system/test_apps/console/main/test_app_main.c @@ -8,7 +8,7 @@ #include #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "hal/uart_ll.h" diff --git a/components/esp_system/test_apps/esp_system_unity_tests/main/test_backtrace.c b/components/esp_system/test_apps/esp_system_unity_tests/main/test_backtrace.c index 2d398edb07..c13052d06b 100644 --- a/components/esp_system/test_apps/esp_system_unity_tests/main/test_backtrace.c +++ b/components/esp_system/test_apps/esp_system_unity_tests/main/test_backtrace.c @@ -12,7 +12,7 @@ #include "unity.h" #include "test_utils.h" #include "esp_rom_sys.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #if CONFIG_IDF_TARGET_ARCH_XTENSA diff --git a/components/esp_system/test_apps/esp_system_unity_tests/main/test_sleep.c b/components/esp_system/test_apps/esp_system_unity_tests/main/test_sleep.c index 54b8442b3d..96a5f84c66 100644 --- a/components/esp_system/test_apps/esp_system_unity_tests/main/test_sleep.c +++ b/components/esp_system/test_apps/esp_system_unity_tests/main/test_sleep.c @@ -25,7 +25,7 @@ #include "esp_newlib.h" #include "test_utils.h" #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_rom_sys.h" #include "esp_timer.h" #include "esp_private/esp_clk.h" diff --git a/components/esp_tee/subproject/main/common/brownout.c b/components/esp_tee/subproject/main/common/brownout.c index ca09abb76e..30f7de4bde 100644 --- a/components/esp_tee/subproject/main/common/brownout.c +++ b/components/esp_tee/subproject/main/common/brownout.c @@ -15,8 +15,9 @@ #include "esp_attr.h" #include "hal/brownout_hal.h" #include "hal/brownout_ll.h" +#include "hal/uart_ll.h" #include "esp_rom_sys.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "sdkconfig.h" #include "esp_tee_intr.h" diff --git a/components/esp_tee/subproject/main/common/panic/esp_tee_panic.c b/components/esp_tee/subproject/main/common/panic/esp_tee_panic.c index 4db95e4768..a4911bace1 100644 --- a/components/esp_tee/subproject/main/common/panic/esp_tee_panic.c +++ b/components/esp_tee/subproject/main/common/panic/esp_tee_panic.c @@ -9,7 +9,7 @@ #include "esp_attr.h" #include "esp_macros.h" #include "esp_rom_sys.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "rom/cache.h" #include "riscv/rv_utils.h" diff --git a/components/hal/esp32/include/hal/uart_ll.h b/components/hal/esp32/include/hal/uart_ll.h index 75d0d781c7..25b2284be3 100644 --- a/components/hal/esp32/include/hal/uart_ll.h +++ b/components/hal/esp32/include/hal/uart_ll.h @@ -216,7 +216,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { if (baud == 0) { return false; @@ -233,6 +233,8 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 return true; } +#define uart_ll_set_baudrate(...) _uart_ll_set_baudrate(__VA_ARGS__) + /** * @brief Get the current baud-rate. * diff --git a/components/hal/esp32c2/include/hal/uart_ll.h b/components/hal/esp32c2/include/hal/uart_ll.h index ed1fa16282..31c02aae42 100644 --- a/components/hal/esp32c2/include/hal/uart_ll.h +++ b/components/hal/esp32c2/include/hal/uart_ll.h @@ -220,7 +220,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { #define DIV_UP(a, b) (((a) + (b) - 1) / (b)) if (baud == 0) { @@ -242,6 +242,8 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 return true; } +#define uart_ll_set_baudrate(...) _uart_ll_set_baudrate(__VA_ARGS__) + /** * @brief Get the current baud-rate. * diff --git a/components/hal/esp32c3/include/hal/uart_ll.h b/components/hal/esp32c3/include/hal/uart_ll.h index c142d99b58..c2f77c5335 100644 --- a/components/hal/esp32c3/include/hal/uart_ll.h +++ b/components/hal/esp32c3/include/hal/uart_ll.h @@ -226,7 +226,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { #define DIV_UP(a, b) (((a) + (b) - 1) / (b)) if (baud == 0) { @@ -248,6 +248,8 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 return true; } +#define uart_ll_set_baudrate(...) _uart_ll_set_baudrate(__VA_ARGS__) + /** * @brief Get the current baud-rate. * diff --git a/components/hal/esp32c5/include/hal/uart_ll.h b/components/hal/esp32c5/include/hal/uart_ll.h index 17f8a3b0e1..f7f281dcdc 100644 --- a/components/hal/esp32c5/include/hal/uart_ll.h +++ b/components/hal/esp32c5/include/hal/uart_ll.h @@ -437,7 +437,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { if ((hw) == &LP_UART) { abort(); // need to call lp_uart_ll_set_baudrate() @@ -464,6 +464,8 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 return true; } +#define uart_ll_set_baudrate(...) _uart_ll_set_baudrate(__VA_ARGS__) + /** * @brief Get the current baud-rate. * diff --git a/components/hal/esp32c6/include/hal/uart_ll.h b/components/hal/esp32c6/include/hal/uart_ll.h index a07790084d..1b5b67389f 100644 --- a/components/hal/esp32c6/include/hal/uart_ll.h +++ b/components/hal/esp32c6/include/hal/uart_ll.h @@ -418,7 +418,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { if ((hw) == &LP_UART) { abort(); // need to call lp_uart_ll_set_baudrate() @@ -445,6 +445,8 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 return true; } +#define uart_ll_set_baudrate(...) _uart_ll_set_baudrate(__VA_ARGS__) + /** * @brief Get the current baud-rate. * diff --git a/components/hal/esp32c61/include/hal/uart_ll.h b/components/hal/esp32c61/include/hal/uart_ll.h index 4ca98ecc91..0812a65201 100644 --- a/components/hal/esp32c61/include/hal/uart_ll.h +++ b/components/hal/esp32c61/include/hal/uart_ll.h @@ -265,7 +265,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { #define DIV_UP(a, b) (((a) + (b) - 1) / (b)) if (baud == 0) { @@ -288,6 +288,8 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 return true; } +#define uart_ll_set_baudrate(...) _uart_ll_set_baudrate(__VA_ARGS__) + /** * @brief Get the current baud-rate. * diff --git a/components/hal/esp32h2/include/hal/uart_ll.h b/components/hal/esp32h2/include/hal/uart_ll.h index 2b9cb2479b..a4b41e9947 100644 --- a/components/hal/esp32h2/include/hal/uart_ll.h +++ b/components/hal/esp32h2/include/hal/uart_ll.h @@ -245,7 +245,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { #define DIV_UP(a, b) (((a) + (b) - 1) / (b)) if (baud == 0) { @@ -268,6 +268,8 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 return true; } +#define uart_ll_set_baudrate(...) _uart_ll_set_baudrate(__VA_ARGS__) + /** * @brief Get the current baud-rate. * diff --git a/components/hal/esp32h21/include/hal/uart_ll.h b/components/hal/esp32h21/include/hal/uart_ll.h index 67513010a2..d0f7d9dc93 100644 --- a/components/hal/esp32h21/include/hal/uart_ll.h +++ b/components/hal/esp32h21/include/hal/uart_ll.h @@ -246,7 +246,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { #define DIV_UP(a, b) (((a) + (b) - 1) / (b)) if (baud == 0) { @@ -269,6 +269,8 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 return true; } +#define uart_ll_set_baudrate(...) _uart_ll_set_baudrate(__VA_ARGS__) + /** * @brief Get the current baud-rate. * diff --git a/components/hal/esp32h4/include/hal/uart_ll.h b/components/hal/esp32h4/include/hal/uart_ll.h index e4f68c70bb..fe98d536ba 100644 --- a/components/hal/esp32h4/include/hal/uart_ll.h +++ b/components/hal/esp32h4/include/hal/uart_ll.h @@ -261,7 +261,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { #define DIV_UP(a, b) (((a) + (b) - 1) / (b)) if (baud == 0) { @@ -284,6 +284,8 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 return true; } +#define uart_ll_set_baudrate(...) _uart_ll_set_baudrate(__VA_ARGS__) + /** * @brief Get the current baud-rate. * diff --git a/components/hal/esp32p4/include/hal/uart_ll.h b/components/hal/esp32p4/include/hal/uart_ll.h index 0e831395a3..bf3bc9f879 100644 --- a/components/hal/esp32p4/include/hal/uart_ll.h +++ b/components/hal/esp32p4/include/hal/uart_ll.h @@ -106,6 +106,7 @@ FORCE_INLINE_ATTR void lp_uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *sou case 1: *source_clk = (soc_module_clk_t)LP_UART_SCLK_XTAL_D2; break; + // TODO: IDF-9581 // case 2: // *source_clk = (soc_module_clk_t)LP_UART_SCLK_LP_PLL; // break; @@ -528,7 +529,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { if ((hw) == &LP_UART) { abort(); // need to call lp_uart_ll_set_baudrate() @@ -567,10 +568,16 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 uart_ll_update(hw); return true; } -#if !BOOTLOADER_BUILD + //HP_SYS_CLKRST.peri_clk_ctrlxxx are shared registers, so this function must be used in an atomic way -#define uart_ll_set_baudrate(...) uart_ll_set_baudrate(__VA_ARGS__); (void)__DECLARE_RCC_ATOMIC_ENV -#endif +#define uart_ll_set_baudrate(...) ({ \ + (void)__DECLARE_RCC_ATOMIC_ENV; \ + int _temp; \ + do { \ + _temp = _uart_ll_set_baudrate(__VA_ARGS__); \ + } while(0); \ + _temp; \ +}) /** * @brief Get the current baud-rate. diff --git a/components/hal/esp32s2/include/hal/uart_ll.h b/components/hal/esp32s2/include/hal/uart_ll.h index b605413ccc..23e58c3d5d 100644 --- a/components/hal/esp32s2/include/hal/uart_ll.h +++ b/components/hal/esp32s2/include/hal/uart_ll.h @@ -204,7 +204,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { if (baud == 0) { return false; @@ -221,6 +221,8 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 return true; } +#define uart_ll_set_baudrate(...) _uart_ll_set_baudrate(__VA_ARGS__) + /** * @brief Get the current baud-rate. * diff --git a/components/hal/esp32s3/include/hal/uart_ll.h b/components/hal/esp32s3/include/hal/uart_ll.h index e7a3de1200..2d24124fba 100644 --- a/components/hal/esp32s3/include/hal/uart_ll.h +++ b/components/hal/esp32s3/include/hal/uart_ll.h @@ -230,7 +230,7 @@ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source * * @return True if baud-rate set successfully; False if baud-rate requested cannot be achieved */ -FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) +FORCE_INLINE_ATTR bool _uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t sclk_freq) { #define DIV_UP(a, b) (((a) + (b) - 1) / (b)) if (baud == 0) { @@ -252,6 +252,8 @@ FORCE_INLINE_ATTR bool uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint3 return true; } +#define uart_ll_set_baudrate(...) _uart_ll_set_baudrate(__VA_ARGS__) + /** * @brief Get the current baud-rate. * diff --git a/components/hal/test_apps/tee_apm/components/pms/src/test_panic_handler.c b/components/hal/test_apps/tee_apm/components/pms/src/test_panic_handler.c index aea6d6d1d3..df27547365 100644 --- a/components/hal/test_apps/tee_apm/components/pms/src/test_panic_handler.c +++ b/components/hal/test_apps/tee_apm/components/pms/src/test_panic_handler.c @@ -5,11 +5,11 @@ */ #include - +#include "esp_attr.h" #include "soc/soc_caps.h" #include "esp_macros.h" #include "esp_rom_sys.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "riscv/csr.h" #include "riscv/rvruntime-frames.h" diff --git a/components/log/src/log_format_binary.c b/components/log/src/log_format_binary.c index c6d3fb9dd1..ec6c6be367 100644 --- a/components/log/src/log_format_binary.c +++ b/components/log/src/log_format_binary.c @@ -15,7 +15,7 @@ #include "esp_private/log_print.h" #include "esp_private/log_util.h" #include "soc/soc.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #if BOOTLOADER_BUILD #define APP_TYPE 0x01 diff --git a/components/log/test_apps/main/test_log_level.c b/components/log/test_apps/main/test_log_level.c index ba1e571fbf..e124f99ab4 100644 --- a/components/log/test_apps/main/test_log_level.c +++ b/components/log/test_apps/main/test_log_level.c @@ -10,7 +10,7 @@ #include #include #include "unity.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "sdkconfig.h" /* diff --git a/components/log/test_apps/main/test_log_perf.c b/components/log/test_apps/main/test_log_perf.c index 06f7230254..b75823f37e 100644 --- a/components/log/test_apps/main/test_log_perf.c +++ b/components/log/test_apps/main/test_log_perf.c @@ -14,7 +14,7 @@ #include "freertos/semphr.h" #include "esp_log.h" #include "esp_timer.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "sdkconfig.h" typedef struct { diff --git a/components/newlib/src/reent_syscalls.c b/components/newlib/src/reent_syscalls.c index a036222990..adaab13df5 100644 --- a/components/newlib/src/reent_syscalls.c +++ b/components/newlib/src/reent_syscalls.c @@ -15,7 +15,7 @@ #include #include #include "sdkconfig.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_system_console.h" static int syscall_not_implemented(struct _reent *r, ...) diff --git a/components/soc/esp32p4/include/soc/clk_tree_defs.h b/components/soc/esp32p4/include/soc/clk_tree_defs.h index 7c7904f615..53e607ae98 100644 --- a/components/soc/esp32p4/include/soc/clk_tree_defs.h +++ b/components/soc/esp32p4/include/soc/clk_tree_defs.h @@ -294,7 +294,7 @@ typedef enum { typedef enum { LP_UART_SCLK_LP_FAST = SOC_MOD_CLK_RTC_FAST, /*!< LP_UART source clock is LP(RTC)_FAST */ LP_UART_SCLK_XTAL_D2 = SOC_MOD_CLK_XTAL_D2, /*!< LP_UART source clock is XTAL_D2 */ - // LP_UART_SCLK_LP_PLL = SOC_MOD_CLK_LP_PLL, /*!< LP_UART source clock is LP_PLL (8M PLL) */ TODO: LP_PLL clock requires extra support + // LP_UART_SCLK_LP_PLL = SOC_MOD_CLK_LP_PLL, /*!< LP_UART source clock is LP_PLL (8M PLL) */ TODO: IDF-9581 LP_UART_SCLK_DEFAULT = SOC_MOD_CLK_RTC_FAST, /*!< LP_UART source clock default choice is LP(RTC)_FAST */ } soc_periph_lp_uart_clk_src_t; diff --git a/components/ulp/lp_core/lp_core/lp_core_print.c b/components/ulp/lp_core/lp_core/lp_core_print.c index 64d07b783f..fe4b98e805 100644 --- a/components/ulp/lp_core/lp_core/lp_core_print.c +++ b/components/ulp/lp_core/lp_core/lp_core_print.c @@ -7,7 +7,7 @@ #include "sdkconfig.h" #include "ulp_lp_core_uart.h" #include "hal/uart_hal.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #define LP_UART_PORT_NUM LP_UART_NUM_0 #define BINARY_SUPPORT 1 diff --git a/components/unity/unity_port_esp32.c b/components/unity/unity_port_esp32.c index 42a93fa3e0..ab4c078662 100644 --- a/components/unity/unity_port_esp32.c +++ b/components/unity/unity_port_esp32.c @@ -8,7 +8,7 @@ #include "unity.h" #include "sdkconfig.h" #include "esp_cpu.h" -#include "esp_rom_uart.h" +#include "esp_rom_serial_output.h" #include "esp_system_console.h" #include "esp_private/esp_clk.h"