mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-28 21:33:32 +00:00
modem clock: provide a protected wifipwr clock enable/disable interface to fix the bug of selecting xtal as the low power clock source for ble
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "esp_attr.h"
|
||||
#include "hal/modem_clock_hal.h"
|
||||
#include "hal/modem_clock_types.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
#include "hal/assert.h"
|
||||
|
||||
typedef enum {
|
||||
@@ -239,3 +240,22 @@ void modem_clock_hal_select_wifi_lpclk_source(modem_clock_hal_context_t *hal, mo
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void modem_clock_hal_enable_wifipwr_clock(modem_clock_hal_context_t *hal, bool enable)
|
||||
{
|
||||
if (efuse_hal_chip_revision() == 0) { /* eco0 */
|
||||
modem_lpcon_ll_enable_wifipwr_clock(hal->lpcon_dev, enable);
|
||||
} else {
|
||||
static int ref = 0;
|
||||
if (enable) {
|
||||
if (ref++ == 0) {
|
||||
modem_lpcon_ll_enable_wifipwr_clock(hal->lpcon_dev, enable);
|
||||
}
|
||||
} else {
|
||||
if (--ref == 0) {
|
||||
modem_lpcon_ll_enable_wifipwr_clock(hal->lpcon_dev, enable);
|
||||
}
|
||||
}
|
||||
HAL_ASSERT(ref > 0);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user