mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
Merge branch 'fix/fix_i2c_modem_clock_ref_count_mismatch_v6.0' into 'release/v6.0'
feat(esp_hw_support): add reference count control & clock enable checking for modem clock devices (v6.0) See merge request espressif/esp-idf!45533
This commit is contained in:
@@ -25,6 +25,12 @@ static inline void modem_lpcon_ll_enable_test_clk(modem_lpcon_dev_t *hw, bool en
|
||||
hw->test_conf.clk_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_lpcon_ll_test_clk_is_enabled(modem_lpcon_dev_t *hw)
|
||||
{
|
||||
return hw->test_conf.clk_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_lpcon_ll_enable_ble_rtc_timer_slow_osc(modem_lpcon_dev_t *hw, bool en)
|
||||
{
|
||||
@@ -163,6 +169,12 @@ static inline void modem_lpcon_ll_enable_coex_clock(modem_lpcon_dev_t *hw, bool
|
||||
hw->clk_conf.clk_coex_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_lpcon_ll_coex_clock_is_enabled(modem_lpcon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf.clk_coex_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_lpcon_ll_enable_ble_rtc_timer_clock(modem_lpcon_dev_t *hw, bool en)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include "soc/soc.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "hal/assert.h"
|
||||
#include "modem/modem_syscon_struct.h"
|
||||
#include "hal/modem_clock_types.h"
|
||||
@@ -25,12 +26,24 @@ static inline void modem_syscon_ll_enable_test_clk(modem_syscon_dev_t *hw, bool
|
||||
hw->test_conf.clk_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_test_clk_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->test_conf.clk_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_pwdet_sar_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf.pwdet_sar_clock_ena = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_pwdet_sar_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf.pwdet_sar_clock_ena;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_set_pwdet_clk_div_num(modem_syscon_dev_t *hw, uint32_t div)
|
||||
{
|
||||
@@ -61,24 +74,48 @@ static inline void modem_syscon_ll_enable_data_dump_mux_clock(modem_syscon_dev_t
|
||||
hw->clk_conf.clk_data_dump_mux = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_data_dump_mux_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf.clk_data_dump_mux;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_etm_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf.clk_etm_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_etm_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf.clk_etm_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_ieee802154_apb_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf.clk_zb_apb_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_ieee802154_apb_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf.clk_zb_apb_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_ieee802154_mac_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf.clk_zbmac_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_ieee802154_mac_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf.clk_zbmac_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_modem_sec_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
@@ -89,18 +126,40 @@ static inline void modem_syscon_ll_enable_modem_sec_clock(modem_syscon_dev_t *hw
|
||||
hw->clk_conf.clk_modem_sec_apb_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_modem_sec_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf.clk_modem_sec_en &&
|
||||
hw->clk_conf.clk_modem_sec_ecb_en &&
|
||||
hw->clk_conf.clk_modem_sec_ccm_en &&
|
||||
hw->clk_conf.clk_modem_sec_bah_en &&
|
||||
hw->clk_conf.clk_modem_sec_apb_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_ble_timer_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf.clk_ble_timer_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_ble_timer_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf.clk_ble_timer_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_data_dump_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf.clk_data_dump_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_data_dump_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf.clk_data_dump_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_etm_force_clock(modem_syscon_dev_t *hw)
|
||||
{
|
||||
@@ -352,6 +411,16 @@ static inline void modem_syscon_ll_clk_wifibb_configure(modem_syscon_dev_t *hw,
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_wifibb_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
#if SOC_PHY_CALIBRATION_CLOCK_IS_INDEPENDENT
|
||||
return (hw->clk_conf1.val & 0x1fb) == 0x1fb;
|
||||
#else
|
||||
return (hw->clk_conf1.val & 0x1ff) == 0x1ff;
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_wifibb_22m_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
@@ -370,6 +439,12 @@ static inline void modem_syscon_ll_enable_wifibb_44m_clock(modem_syscon_dev_t *h
|
||||
hw->clk_conf1.clk_wifibb_44m_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_wifibb_44m_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_wifibb_44m_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_wifibb_80m_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
@@ -419,12 +494,24 @@ static inline void modem_syscon_ll_enable_wifi_mac_clock(modem_syscon_dev_t *hw,
|
||||
hw->clk_conf1.clk_wifimac_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_wifi_mac_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_wifimac_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_wifi_apb_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf1.clk_wifi_apb_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_wifi_apb_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_wifi_apb_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_fe_20m_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
@@ -443,18 +530,36 @@ static inline void modem_syscon_ll_enable_fe_80m_clock(modem_syscon_dev_t *hw, b
|
||||
hw->clk_conf1.clk_fe_80m_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_fe_80m_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_fe_80m_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_fe_160m_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf1.clk_fe_160m_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_fe_160m_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_fe_160m_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_fe_apb_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf1.clk_fe_apb_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_fe_apb_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_fe_apb_en;
|
||||
}
|
||||
|
||||
// The modem_syscon of esp32c5 adds the enablement of the adc clock on the analog front end compared to esp32h2 and esp32c6.
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_fe_adc_clock(modem_syscon_dev_t *hw, bool en)
|
||||
@@ -462,6 +567,12 @@ static inline void modem_syscon_ll_enable_fe_adc_clock(modem_syscon_dev_t *hw, b
|
||||
hw->clk_conf1.clk_fe_adc_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_fe_adc_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_fe_adc_en;
|
||||
}
|
||||
|
||||
// The modem_syscon of esp32c5 adds the enablement of the dac clock on the analog front end compared to esp32h2 and esp32c6.
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_fe_dac_clock(modem_syscon_dev_t *hw, bool en)
|
||||
@@ -469,6 +580,12 @@ static inline void modem_syscon_ll_enable_fe_dac_clock(modem_syscon_dev_t *hw, b
|
||||
hw->clk_conf1.clk_fe_dac_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_fe_dac_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_fe_dac_en;
|
||||
}
|
||||
|
||||
// The modem_syscon of esp32c5 adds the enablement of the analog power detect clock on the analog front end compared to esp32h2 and esp32c6.
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_fe_pwdet_clock(modem_syscon_dev_t *hw, bool en)
|
||||
@@ -476,24 +593,48 @@ static inline void modem_syscon_ll_enable_fe_pwdet_clock(modem_syscon_dev_t *hw,
|
||||
hw->clk_conf1.clk_fe_pwdet_adc_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_fe_pwdet_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_fe_pwdet_adc_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_bt_apb_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf1.clk_bt_apb_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_bt_apb_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_bt_apb_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_bt_mac_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf1.clk_btmac_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_bt_mac_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_btmac_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_bt_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
hw->clk_conf1.clk_btbb_en = en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline bool modem_syscon_ll_bt_clock_is_enabled(modem_syscon_dev_t *hw)
|
||||
{
|
||||
return hw->clk_conf1.clk_btbb_en;
|
||||
}
|
||||
|
||||
__attribute__((always_inline))
|
||||
static inline void modem_syscon_ll_enable_fe_480m_clock(modem_syscon_dev_t *hw, bool en)
|
||||
{
|
||||
|
||||
@@ -103,6 +103,12 @@ void IRAM_ATTR modem_clock_hal_enable_modem_common_fe_clock(modem_clock_hal_cont
|
||||
}
|
||||
}
|
||||
|
||||
bool IRAM_ATTR modem_clock_hal_modem_common_fe_clock_is_enabled(modem_clock_hal_context_t *hal)
|
||||
{
|
||||
return modem_syscon_ll_fe_apb_clock_is_enabled(hal->syscon_dev) &&
|
||||
modem_syscon_ll_fe_80m_clock_is_enabled(hal->syscon_dev);
|
||||
}
|
||||
|
||||
void IRAM_ATTR modem_clock_hal_enable_modem_private_fe_clock(modem_clock_hal_context_t *hal, bool enable)
|
||||
{
|
||||
if (enable) {
|
||||
@@ -113,6 +119,14 @@ void IRAM_ATTR modem_clock_hal_enable_modem_private_fe_clock(modem_clock_hal_con
|
||||
}
|
||||
}
|
||||
|
||||
bool IRAM_ATTR modem_clock_hal_modem_private_fe_clock_is_enabled(modem_clock_hal_context_t *hal)
|
||||
{
|
||||
return modem_syscon_ll_fe_160m_clock_is_enabled(hal->syscon_dev) &&
|
||||
modem_syscon_ll_fe_adc_clock_is_enabled(hal->syscon_dev) &&
|
||||
modem_syscon_ll_fe_dac_clock_is_enabled(hal->syscon_dev) &&
|
||||
modem_syscon_ll_fe_pwdet_clock_is_enabled(hal->syscon_dev);
|
||||
}
|
||||
|
||||
void modem_clock_hal_set_ble_rtc_timer_divisor_value(modem_clock_hal_context_t *hal, uint32_t divider)
|
||||
{
|
||||
modem_lpcon_ll_set_ble_rtc_timer_divisor_value(hal->lpcon_dev, divider);
|
||||
|
||||
Reference in New Issue
Block a user