wifi, bt: move esp_phy_common_clock_disable into periph_ctrl and put it into IRAM

Replace periph_module_enable/disable by periph_wifi_bt_common_module_enable which are in IRAM.
AddIRAM_ATTR periph_ll_wifi_bt_module_enable_clk_clear_rstandIRAM_ATTR periph_ll_wifi_bt_module_disable_clk_set_rstto fit O0 optimization level.
Delete duplicated spinlock and counter.
This commit is contained in:
dongyou
2020-07-02 19:53:15 +08:00
parent b3814a1b5e
commit 97ae87df41
5 changed files with 69 additions and 57 deletions

View File

@@ -48,3 +48,23 @@ void periph_module_reset(periph_module_t periph)
periph_ll_reset(periph);
portEXIT_CRITICAL_SAFE(&periph_spinlock);
}
IRAM_ATTR void wifi_bt_common_module_enable(void)
{
portENTER_CRITICAL_SAFE(&periph_spinlock);
if (ref_counts[PERIPH_WIFI_BT_COMMON_MODULE] == 0) {
periph_ll_wifi_bt_module_enable_clk_clear_rst();
}
ref_counts[PERIPH_WIFI_BT_COMMON_MODULE]++;
portEXIT_CRITICAL_SAFE(&periph_spinlock);
}
IRAM_ATTR void wifi_bt_common_module_disable(void)
{
portENTER_CRITICAL_SAFE(&periph_spinlock);
ref_counts[PERIPH_WIFI_BT_COMMON_MODULE]--;
if (ref_counts[PERIPH_WIFI_BT_COMMON_MODULE] == 0) {
periph_ll_wifi_bt_module_disable_clk_set_rst();
}
portEXIT_CRITICAL_SAFE(&periph_spinlock);
}