1 /*
2 * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 // The LL layer for ESP32-H2 LP CLKRST register operations
8
9 #pragma once
10
11 #include <stdlib.h>
12 #include "soc/soc.h"
13 #include "soc/lp_clkrst_struct.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 __attribute__((always_inline))
lp_clkrst_ll_enable_ble_rtc_timer_slow_osc(lp_clkrst_dev_t * hw,bool en)20 static inline void lp_clkrst_ll_enable_ble_rtc_timer_slow_osc(lp_clkrst_dev_t *hw, bool en)
21 {
22 hw->lpperi.lp_sel_osc_slow = en;
23 }
24
25 __attribute__((always_inline))
lp_clkrst_ll_enable_ble_rtc_timer_fast_osc(lp_clkrst_dev_t * hw,bool en)26 static inline void lp_clkrst_ll_enable_ble_rtc_timer_fast_osc(lp_clkrst_dev_t *hw, bool en)
27 {
28 hw->lpperi.lp_sel_osc_fast = en;
29 }
30
31 __attribute__((always_inline))
lp_clkrst_ll_enable_ble_rtc_timer_main_xtal(lp_clkrst_dev_t * hw,bool en)32 static inline void lp_clkrst_ll_enable_ble_rtc_timer_main_xtal(lp_clkrst_dev_t *hw, bool en)
33 {
34 hw->lpperi.lp_sel_xtal = en;
35 }
36
37 __attribute__((always_inline))
lp_clkrst_ll_enable_ble_rtc_timer_32k_xtal(lp_clkrst_dev_t * hw,bool en)38 static inline void lp_clkrst_ll_enable_ble_rtc_timer_32k_xtal(lp_clkrst_dev_t *hw, bool en)
39 {
40 hw->lpperi.lp_sel_xtal32k = en;
41 }
42
43 __attribute__((always_inline))
lp_clkrst_ll_set_ble_rtc_timer_divisor_value(lp_clkrst_dev_t * hw,uint32_t value)44 static inline void lp_clkrst_ll_set_ble_rtc_timer_divisor_value(lp_clkrst_dev_t *hw, uint32_t value)
45 {
46 hw->lpperi.lp_bletimer_div_num = value;
47 }
48
49 __attribute__((always_inline))
lp_clkrst_ll_get_ble_rtc_timer_divisor_value(lp_clkrst_dev_t * hw)50 static inline uint32_t lp_clkrst_ll_get_ble_rtc_timer_divisor_value(lp_clkrst_dev_t *hw)
51 {
52 return hw->lpperi.lp_bletimer_div_num;
53 }
54
55 __attribute__((always_inline))
lp_clkrst_ll_select_modem_32k_clock_source(lp_clkrst_dev_t * hw,uint32_t src)56 static inline void lp_clkrst_ll_select_modem_32k_clock_source(lp_clkrst_dev_t *hw, uint32_t src)
57 {
58 hw->lpperi.lp_bletimer_32k_sel = src;
59 }
60
61 #ifdef __cplusplus
62 }
63 #endif
64