|
| 1 | +/* |
| 2 | + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | + |
| 7 | +// The LL layer for ESP32-H4 MODEM LPCON register operations |
| 8 | + |
| 9 | +#pragma once |
| 10 | + |
| 11 | +#include <stdlib.h> |
| 12 | +#include <stdbool.h> |
| 13 | +#include "soc/soc.h" |
| 14 | +#include "hal/assert.h" |
| 15 | +#include "modem/modem_lpcon_struct.h" |
| 16 | +#include "hal/modem_clock_types.h" |
| 17 | + |
| 18 | +#ifdef __cplusplus |
| 19 | +extern "C" { |
| 20 | +#endif |
| 21 | + |
| 22 | +__attribute__((always_inline)) |
| 23 | +static inline void modem_lpcon_ll_enable_test_clk(modem_lpcon_dev_t *hw, bool en) |
| 24 | +{ |
| 25 | + hw->test_conf.clk_en = en; |
| 26 | +} |
| 27 | + |
| 28 | +__attribute__((always_inline)) |
| 29 | +static inline void modem_lpcon_ll_enable_coex_lpclk_slow_osc(modem_lpcon_dev_t *hw, bool en) |
| 30 | +{ |
| 31 | + hw->coex_lp_clk_conf.clk_coex_lp_sel_osc_slow = en; |
| 32 | +} |
| 33 | + |
| 34 | +__attribute__((always_inline)) |
| 35 | +static inline void modem_lpcon_ll_enable_coex_lpclk_fast_osc(modem_lpcon_dev_t *hw, bool en) |
| 36 | +{ |
| 37 | + hw->coex_lp_clk_conf.clk_coex_lp_sel_osc_fast = en; |
| 38 | +} |
| 39 | + |
| 40 | +__attribute__((always_inline)) |
| 41 | +static inline void modem_lpcon_ll_enable_coex_lpclk_main_xtal(modem_lpcon_dev_t *hw, bool en) |
| 42 | +{ |
| 43 | + hw->coex_lp_clk_conf.clk_coex_lp_sel_xtal = en; |
| 44 | +} |
| 45 | + |
| 46 | +__attribute__((always_inline)) |
| 47 | +static inline void modem_lpcon_ll_enable_coex_lpclk_32k_xtal(modem_lpcon_dev_t *hw, bool en) |
| 48 | +{ |
| 49 | + hw->coex_lp_clk_conf.clk_coex_lp_sel_xtal32k = en; |
| 50 | +} |
| 51 | + |
| 52 | +__attribute__((always_inline)) |
| 53 | +static inline void modem_lpcon_ll_set_coex_lpclk_divisor_value(modem_lpcon_dev_t *hw, uint32_t value) |
| 54 | +{ |
| 55 | + hw->coex_lp_clk_conf.clk_coex_lp_div_num = value; |
| 56 | +} |
| 57 | + |
| 58 | +__attribute__((always_inline)) |
| 59 | +static inline uint32_t modem_lpcon_ll_get_coex_lpclk_divisor_value(modem_lpcon_dev_t *hw) |
| 60 | +{ |
| 61 | + return hw->coex_lp_clk_conf.clk_coex_lp_div_num; |
| 62 | +} |
| 63 | + |
| 64 | +__attribute__((always_inline)) |
| 65 | +static inline void modem_lpcon_ll_enable_coex_clock(modem_lpcon_dev_t *hw, bool en) |
| 66 | +{ |
| 67 | + hw->clk_conf.clk_coex_en = en; |
| 68 | +} |
| 69 | + |
| 70 | +__attribute__((always_inline)) |
| 71 | +static inline void modem_lpcon_ll_enable_fe_mem_clock(modem_lpcon_dev_t *hw, bool en) |
| 72 | +{ |
| 73 | +} |
| 74 | + |
| 75 | +__attribute__((always_inline)) |
| 76 | +static inline void modem_lpcon_ll_enable_coex_force_clock(modem_lpcon_dev_t *hw, bool en) |
| 77 | +{ |
| 78 | + hw->clk_conf_force_on.clk_coex_fo = en; |
| 79 | +} |
| 80 | + |
| 81 | +__attribute__((always_inline)) |
| 82 | +static inline void modem_lpcon_ll_reset_coex(modem_lpcon_dev_t *hw) |
| 83 | +{ |
| 84 | + hw->rst_conf.rst_coex = 1; |
| 85 | + hw->rst_conf.rst_coex = 0; |
| 86 | +} |
| 87 | + |
| 88 | +__attribute__((always_inline)) |
| 89 | +static inline void modem_lpcon_ll_reset_all(modem_lpcon_dev_t *hw) |
| 90 | +{ |
| 91 | + hw->rst_conf.val = 0xf; |
| 92 | + hw->rst_conf.val = 0; |
| 93 | +} |
| 94 | + |
| 95 | +__attribute__((always_inline)) |
| 96 | +static inline uint32_t modem_lpcon_ll_get_date(modem_lpcon_dev_t *hw) |
| 97 | +{ |
| 98 | + return hw->date.val; |
| 99 | +} |
| 100 | + |
| 101 | +#ifdef __cplusplus |
| 102 | +} |
| 103 | +#endif |
0 commit comments