1 /* 2 * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #pragma once 8 9 #include <stdint.h> 10 #include "esp_clk_tree.h" 11 #include "soc/soc_caps.h" 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 #if SOC_CLK_RC_FAST_D256_SUPPORTED 18 /** 19 * @brief Get frequency of RC_FAST_D256_CLK 20 * 21 * @param precision Degree of precision of the returned frequency value, one of esp_clk_tree_src_freq_precision_t values 22 * 23 * @return RC_FAST_D256 clock frequency, in Hz. Returns 0 if degree of precision is invalid or calibration failed. 24 */ 25 uint32_t esp_clk_tree_rc_fast_d256_get_freq_hz(esp_clk_tree_src_freq_precision_t precision); 26 #endif 27 28 #if SOC_CLK_XTAL32K_SUPPORTED 29 /** 30 * @brief Get frequency of XTAL32K_CLK 31 * 32 * @param precision Degree of precision of the returned frequency value, one of esp_clk_tree_src_freq_precision_t values 33 * 34 * @return XTAL32K clock frequency, in Hz. Returns 0 if degree of precision is invalid or calibration failed. 35 */ 36 uint32_t esp_clk_tree_xtal32k_get_freq_hz(esp_clk_tree_src_freq_precision_t precision); 37 #endif 38 39 #if SOC_CLK_OSC_SLOW_SUPPORTED 40 /** 41 * @brief Get frequency of OSC_SLOW_CLK 42 * 43 * @param precision Degree of precision of the returned frequency value, one of esp_clk_tree_src_freq_precision_t values 44 * 45 * @return OSC_SLOW clock frequency, in Hz. Returns 0 if degree of precision is invalid or calibration failed. 46 */ 47 uint32_t esp_clk_tree_osc_slow_get_freq_hz(esp_clk_tree_src_freq_precision_t precision); 48 #endif 49 50 /** 51 * @brief Get frequency of RC_FAST_CLK 52 * 53 * @param precision Degree of precision of the returned frequency value, one of esp_clk_tree_src_freq_precision_t values 54 * 55 * @return RC_FAST clock frequency, in Hz. Returns 0 if degree of precision is invalid or calibration failed. 56 */ 57 uint32_t esp_clk_tree_rc_fast_get_freq_hz(esp_clk_tree_src_freq_precision_t precision); 58 59 /** 60 * @brief Get frequency of LP_SLOW_CLK (i.e. RTC_SLOW_CLK) 61 * 62 * @param precision Degree of precision of the returned frequency value, one of esp_clk_tree_src_freq_precision_t values 63 * 64 * @return LP_SLOW clock frequency, in Hz. Returns 0 if degree of precision is invalid or calibration failed. 65 */ 66 uint32_t esp_clk_tree_lp_slow_get_freq_hz(esp_clk_tree_src_freq_precision_t precision); 67 68 /** 69 * @brief Get frequency of LP_FAST_CLK (i.e. RTC_FAST_CLK) 70 * 71 * @param precision Degree of precision of the returned frequency value, one of esp_clk_tree_src_freq_precision_t values 72 * 73 * @return LP_FAST clock frequency, in Hz. Returns 0 if degree of precision is invalid or calibration failed. 74 */ 75 uint32_t esp_clk_tree_lp_fast_get_freq_hz(esp_clk_tree_src_freq_precision_t precision); 76 77 #ifdef __cplusplus 78 } 79 #endif 80