From 2a8c8686acc891cfd95e4721e4790525150d2088 Mon Sep 17 00:00:00 2001 From: liuning Date: Thu, 27 Jan 2022 19:21:48 +0800 Subject: [PATCH] esp_wifi: fix common clock bug --- components/driver/periph_ctrl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/driver/periph_ctrl.c b/components/driver/periph_ctrl.c index 7de3b09cbc..8a226b236f 100644 --- a/components/driver/periph_ctrl.c +++ b/components/driver/periph_ctrl.c @@ -65,11 +65,15 @@ IRAM_ATTR void wifi_bt_common_module_disable(void) void wifi_module_enable(void) { + portENTER_CRITICAL_SAFE(&periph_spinlock); periph_ll_wifi_module_enable_clk_clear_rst(); + portEXIT_CRITICAL_SAFE(&periph_spinlock); } void wifi_module_disable(void) { + portENTER_CRITICAL_SAFE(&periph_spinlock); periph_ll_wifi_module_disable_clk_set_rst(); + portEXIT_CRITICAL_SAFE(&periph_spinlock); } #endif // CONFIG_ESP32_WIFI_ENABLED