feat(pm): removed dependency on driver component

This commit is contained in:
Marius Vikhammer 2023-11-11 15:23:41 +08:00
parent 74887d81c9
commit d293ad94bd
6 changed files with 14 additions and 7 deletions

View File

@ -27,7 +27,7 @@
#include "driver/rtc_io.h" #include "driver/rtc_io.h"
#include "driver/uart_select.h" #include "driver/uart_select.h"
#include "driver/lp_io.h" #include "driver/lp_io.h"
#include "esp_private/uart_private.h" #include "esp_private/uart_share_hw_ctrl.h"
#include "esp_private/periph_ctrl.h" #include "esp_private/periph_ctrl.h"
#include "esp_clk_tree.h" #include "esp_clk_tree.h"
#include "sdkconfig.h" #include "sdkconfig.h"

View File

@ -6,5 +6,5 @@ endif()
idf_component_register(SRCS "pm_locks.c" "pm_trace.c" "pm_impl.c" idf_component_register(SRCS "pm_locks.c" "pm_trace.c" "pm_impl.c"
INCLUDE_DIRS include INCLUDE_DIRS include
PRIV_REQUIRES esp_system driver esp_driver_gpio esp_timer PRIV_REQUIRES esp_system esp_driver_gpio esp_timer
LDFRAGMENTS linker.lf) LDFRAGMENTS linker.lf)

View File

@ -15,14 +15,15 @@
#include "esp_pm.h" #include "esp_pm.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_cpu.h" #include "esp_cpu.h"
#include "esp_clk_tree.h"
#include "soc/soc_caps.h"
#include "esp_private/crosscore_int.h" #include "esp_private/crosscore_int.h"
#include "esp_private/uart_private.h" #include "esp_private/periph_ctrl.h"
#include "soc/rtc.h" #include "soc/rtc.h"
#include "hal/uart_ll.h" #include "hal/uart_ll.h"
#include "hal/uart_types.h" #include "hal/uart_types.h"
#include "driver/uart.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
@ -43,11 +44,17 @@
#include "esp_private/sleep_cpu.h" #include "esp_private/sleep_cpu.h"
#include "esp_private/sleep_gpio.h" #include "esp_private/sleep_gpio.h"
#include "esp_private/sleep_modem.h" #include "esp_private/sleep_modem.h"
#include "esp_private/uart_share_hw_ctrl.h"
#include "esp_sleep.h" #include "esp_sleep.h"
#include "esp_memory_utils.h" #include "esp_memory_utils.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#if SOC_PERIPH_CLK_CTRL_SHARED
#define HP_UART_SRC_CLK_ATOMIC() PERIPH_RCC_ATOMIC()
#else
#define HP_UART_SRC_CLK_ATOMIC()
#endif
#define MHZ (1000000) #define MHZ (1000000)
@ -903,7 +910,7 @@ void esp_pm_impl_init(void)
uart_ll_set_sclk(UART_LL_GET_HW(CONFIG_ESP_CONSOLE_UART_NUM), (soc_module_clk_t)clk_source); uart_ll_set_sclk(UART_LL_GET_HW(CONFIG_ESP_CONSOLE_UART_NUM), (soc_module_clk_t)clk_source);
} }
uint32_t sclk_freq; uint32_t sclk_freq;
esp_err_t err = uart_get_sclk_freq(clk_source, &sclk_freq); esp_err_t err = esp_clk_tree_src_get_freq_hz((soc_module_clk_t)clk_source, ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, &sclk_freq);
assert(err == ESP_OK); assert(err == ESP_OK);
HP_UART_SRC_CLK_ATOMIC() { HP_UART_SRC_CLK_ATOMIC() {
uart_ll_set_baudrate(UART_LL_GET_HW(CONFIG_ESP_CONSOLE_UART_NUM), CONFIG_ESP_CONSOLE_UART_BAUDRATE, sclk_freq); uart_ll_set_baudrate(UART_LL_GET_HW(CONFIG_ESP_CONSOLE_UART_NUM), CONFIG_ESP_CONSOLE_UART_BAUDRATE, sclk_freq);

View File

@ -26,7 +26,7 @@
#include "esp_rom_sys.h" #include "esp_rom_sys.h"
#include "esp_timer.h" #include "esp_timer.h"
#include "esp_private/esp_clk.h" #include "esp_private/esp_clk.h"
#include "esp_private/uart_private.h" #include "esp_private/uart_share_hw_ctrl.h"
#include "esp_random.h" #include "esp_random.h"
#include "nvs_flash.h" #include "nvs_flash.h"
#include "nvs.h" #include "nvs.h"

View File

@ -13,7 +13,7 @@
#include "hal/rtc_io_types.h" #include "hal/rtc_io_types.h"
#include "esp_clk_tree.h" #include "esp_clk_tree.h"
#include "esp_private/periph_ctrl.h" #include "esp_private/periph_ctrl.h"
#include "esp_private/uart_private.h" #include "esp_private/uart_share_hw_ctrl.h"
#define LP_UART_PORT_NUM LP_UART_NUM_0 #define LP_UART_PORT_NUM LP_UART_NUM_0
#define LP_UART_TX_IDLE_NUM_DEFAULT (0U) #define LP_UART_TX_IDLE_NUM_DEFAULT (0U)