mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-01 06:39:27 +01:00
Merge branch 'refactor/add_alias_name_for_ets_common_api' into 'master'
esp_rom: extract common ets apis into esp_rom_sys.h See merge request espressif/esp-idf!9701
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "esp32s2/rom/ets_sys.h"
|
||||
#include "esp32s2/rom/ets_sys.h" // for ets_update_cpu_frequency
|
||||
#include "esp32s2/rom/rtc.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "soc/rtc_cntl_reg.h"
|
||||
@@ -101,7 +101,7 @@ void rtc_clk_8m_enable(bool clk_8m_en, bool d256_en)
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M);
|
||||
/* no need to wait once enabled by software */
|
||||
REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CK8M_ENABLE_WAIT_DEFAULT);
|
||||
ets_delay_us(DELAY_8M_ENABLE);
|
||||
esp_rom_delay_us(DELAY_8M_ENABLE);
|
||||
} else {
|
||||
SET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M);
|
||||
REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CNTL_CK8M_WAIT_DEFAULT);
|
||||
@@ -146,8 +146,8 @@ void rtc_clk_apll_enable(bool enable, uint32_t sdm0, uint32_t sdm1, uint32_t sdm
|
||||
|
||||
/* wait for calibration end */
|
||||
while (!(I2C_READREG_MASK_RTC(I2C_APLL, I2C_APLL_OR_CAL_END))) {
|
||||
/* use ets_delay_us so the RTC bus doesn't get flooded */
|
||||
ets_delay_us(1);
|
||||
/* use esp_rom_delay_us so the RTC bus doesn't get flooded */
|
||||
esp_rom_delay_us(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -190,7 +190,7 @@ void rtc_clk_slow_freq_set(rtc_slow_freq_t slow_freq)
|
||||
*/
|
||||
REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_CK8M_FORCE_PU, (slow_freq == RTC_SLOW_FREQ_8MD256) ? 1 : 0);
|
||||
rtc_clk_set_xtal_wait();
|
||||
ets_delay_us(DELAY_SLOW_CLK_SWITCH);
|
||||
esp_rom_delay_us(DELAY_SLOW_CLK_SWITCH);
|
||||
}
|
||||
|
||||
rtc_slow_freq_t rtc_clk_slow_freq_get(void)
|
||||
@@ -211,7 +211,7 @@ uint32_t rtc_clk_slow_freq_get_hz(void)
|
||||
void rtc_clk_fast_freq_set(rtc_fast_freq_t fast_freq)
|
||||
{
|
||||
REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_FAST_CLK_RTC_SEL, fast_freq);
|
||||
ets_delay_us(DELAY_FAST_CLK_SWITCH);
|
||||
esp_rom_delay_us(DELAY_FAST_CLK_SWITCH);
|
||||
}
|
||||
|
||||
rtc_fast_freq_t rtc_clk_fast_freq_get(void)
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "soc/nrx_reg.h"
|
||||
#include "soc/fe_reg.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "esp32s2/rom/ets_sys.h"
|
||||
|
||||
/**
|
||||
* Configure whether certain peripherals are powered down in deep sleep
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
#include <stdint.h>
|
||||
#include "esp32s2/rom/ets_sys.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "soc/rtc_cntl_reg.h"
|
||||
#include "soc/timer_group_reg.h"
|
||||
@@ -92,7 +92,7 @@ uint32_t rtc_clk_cal_internal(rtc_cal_sel_t cal_clk, uint32_t slowclk_cycles)
|
||||
SET_PERI_REG_MASK(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_START);
|
||||
|
||||
/* Wait for calibration to finish up to another us_time_estimate */
|
||||
ets_delay_us(us_time_estimate);
|
||||
esp_rom_delay_us(us_time_estimate);
|
||||
uint32_t cal_val;
|
||||
while (true) {
|
||||
if (GET_PERI_REG_MASK(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_RDY)) {
|
||||
@@ -151,7 +151,7 @@ uint64_t rtc_time_get(void)
|
||||
SET_PERI_REG_MASK(RTC_CNTL_TIME_UPDATE_REG, RTC_CNTL_TIME_UPDATE);
|
||||
#if 0 // ToDo: Re-enable it in the future
|
||||
while (GET_PERI_REG_MASK(RTC_CNTL_TIME_UPDATE_REG, RTC_CNTL_TIME_VALID) == 0) {
|
||||
ets_delay_us(1); // might take 1 RTC slowclk period, don't flood RTC bus
|
||||
esp_rom_delay_us(1); // might take 1 RTC slowclk period, don't flood RTC bus
|
||||
}
|
||||
SET_PERI_REG_MASK(RTC_CNTL_INT_CLR_REG, RTC_CNTL_TIME_VALID_INT_CLR);
|
||||
#endif
|
||||
@@ -181,7 +181,7 @@ void rtc_clk_wait_for_slow_cycle(void) //This function may not by useful any mor
|
||||
{
|
||||
SET_PERI_REG_MASK(RTC_CNTL_SLOW_CLK_CONF_REG, RTC_CNTL_SLOW_CLK_NEXT_EDGE);
|
||||
while (GET_PERI_REG_MASK(RTC_CNTL_SLOW_CLK_CONF_REG, RTC_CNTL_SLOW_CLK_NEXT_EDGE)) {
|
||||
ets_delay_us(1);
|
||||
esp_rom_delay_us(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user