1 /*
2  * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 #include <stdbool.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 /**
16  * @brief Switch CPU clock source to XTAL, and let cpu frequency equal to main XTAL frequency.
17  *
18  * This function does not disable BBPLL. If BBPLL requires to be disabled to save power, please call
19  * `rtc_clk_cpu_freq_set_xtal` instead. It will always disable the corresponding PLL after switching the CPU clock
20  * source to XTAL (except for S2).
21  *
22  * Currently, this function should only be called in `esp_restart_noos` and `esp_restart_noos_dig` to switch the CPU
23  * clock source back to XTAL (by default) before reset.
24  */
25 void rtc_clk_cpu_set_to_default_config(void);
26 
27 /**
28  * @brief Notify that the BBPLL has a new in-use consumer
29  *
30  * Currently, this function is only used for tracking whether USB Serial/JTAG is using the 48MHz PHY clock
31  *
32  * Note: Calling this function only helps to not disable the BBPLL clock in `rtc_clk_cpu_freq_set_config`.
33  */
34 void rtc_clk_bbpll_add_consumer(void);
35 
36 /**
37  * @brief Notify that the BBPLL has lost a consumer
38  */
39 void rtc_clk_bbpll_remove_consumer(void);
40 
41 #ifdef __cplusplus
42 }
43 #endif
44