mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
Merge branch 'feature/bringup_esp32c6_light_sleep_pd_cpu' into 'master'
esp32c6: support light_sleep (Stage 1: support CPU power down) See merge request espressif/esp-idf!21985
This commit is contained in:
@@ -147,6 +147,14 @@ config SOC_APM_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PMU_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_LP_TIMER_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_XTAL_SUPPORT_40M
|
||||
bool
|
||||
default y
|
||||
@@ -659,14 +667,6 @@ config SOC_MCPWM_CLK_SUPPORT_XTAL
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_RTC_CNTL_CPU_PD_DMA_BUS_WIDTH
|
||||
int
|
||||
default 128
|
||||
|
||||
config SOC_RTC_CNTL_CPU_PD_REG_FILE_NUM
|
||||
int
|
||||
default 108
|
||||
|
||||
config SOC_RSA_MAX_BIT_LEN
|
||||
int
|
||||
default 3072
|
||||
@@ -839,6 +839,14 @@ config SOC_SYSTIMER_SUPPORT_ETM
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_LP_TIMER_BIT_WIDTH_LO
|
||||
int
|
||||
default 32
|
||||
|
||||
config SOC_LP_TIMER_BIT_WIDTH_HI
|
||||
int
|
||||
default 16
|
||||
|
||||
config SOC_TIMER_GROUPS
|
||||
int
|
||||
default 2
|
||||
@@ -963,6 +971,10 @@ config SOC_UART_SUPPORT_XTAL_CLK
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_UART_SUPPORT_WAKEUP_INT
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_UART_SUPPORT_FSM_TX_WAIT_SEND
|
||||
bool
|
||||
default y
|
||||
@@ -991,11 +1003,7 @@ config SOC_PM_SUPPORT_CPU_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_WIFI_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_BT_PD
|
||||
config SOC_PM_SUPPORT_MODEM_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
@@ -1011,10 +1019,18 @@ config SOC_PM_SUPPORT_RC_FAST_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_VDDSDIO_PD
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_CPU_RETENTION_BY_SW
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_CLK_RC_FAST_SUPPORT_CALIBRATION
|
||||
bool
|
||||
default y
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -10,346 +10,99 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Group: configure_register */
|
||||
/** Type of tar0_low register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** main_timer_tar_low0 : R/W; bitpos: [31:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_tar_low0:32;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_tar0_low_reg_t;
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
uint32_t target_lo: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} lo;
|
||||
union {
|
||||
struct {
|
||||
uint32_t target_hi: 16;
|
||||
uint32_t reserved0: 15;
|
||||
uint32_t enable : 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} hi;
|
||||
} lp_timer_target_reg_t;
|
||||
|
||||
/** Type of tar0_high register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** main_timer_tar_high0 : R/W; bitpos: [15:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_tar_high0:16;
|
||||
uint32_t reserved_16:15;
|
||||
/** main_timer_tar_en0 : WT; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_tar_en0:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_tar0_high_reg_t;
|
||||
|
||||
/** Type of tar1_low register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** main_timer_tar_low1 : R/W; bitpos: [31:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_tar_low1:32;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_tar1_low_reg_t;
|
||||
|
||||
/** Type of tar1_high register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** main_timer_tar_high1 : R/W; bitpos: [15:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_tar_high1:16;
|
||||
uint32_t reserved_16:15;
|
||||
/** main_timer_tar_en1 : WT; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_tar_en1:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_tar1_high_reg_t;
|
||||
|
||||
/** Type of update register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0:28;
|
||||
/** main_timer_update : WT; bitpos: [28]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_update:1;
|
||||
/** main_timer_xtal_off : R/W; bitpos: [29]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_xtal_off:1;
|
||||
/** main_timer_sys_stall : R/W; bitpos: [30]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_sys_stall:1;
|
||||
/** main_timer_sys_rst : R/W; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_sys_rst:1;
|
||||
uint32_t reserved0: 28;
|
||||
uint32_t update : 1;
|
||||
uint32_t xtal_off : 1;
|
||||
uint32_t sys_stall: 1;
|
||||
uint32_t sys_rst : 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_update_reg_t;
|
||||
|
||||
/** Type of main_buf0_low register
|
||||
* need_des
|
||||
*/
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
uint32_t counter_lo: 32;
|
||||
};
|
||||
uint32_t val;
|
||||
} lo;
|
||||
union {
|
||||
struct {
|
||||
uint32_t counter_hi: 16;
|
||||
uint32_t reserved0 : 16;
|
||||
};
|
||||
uint32_t val;
|
||||
} hi;
|
||||
} lp_timer_counter_reg_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
/** main_timer_buf0_low : RO; bitpos: [31:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_buf0_low:32;
|
||||
uint32_t reserved0: 31;
|
||||
uint32_t trigger : 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_main_buf0_low_reg_t;
|
||||
} lp_timer_overflow_reg_t;
|
||||
|
||||
/** Type of main_buf0_high register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** main_timer_buf0_high : RO; bitpos: [15:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_buf0_high:16;
|
||||
uint32_t reserved_16:16;
|
||||
uint32_t reserved0: 30;
|
||||
uint32_t overflow : 1;
|
||||
uint32_t alarm : 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_main_buf0_high_reg_t;
|
||||
} lp_timer_intr_reg_t;
|
||||
|
||||
/** Type of main_buf1_low register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** main_timer_buf1_low : RO; bitpos: [31:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_buf1_low:32;
|
||||
uint32_t reserved0: 30;
|
||||
uint32_t overflow : 1;
|
||||
uint32_t alarm : 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_main_buf1_low_reg_t;
|
||||
} lp_timer_lp_intr_reg_t;
|
||||
|
||||
/** Type of main_buf1_high register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** main_timer_buf1_high : RO; bitpos: [15:0]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_buf1_high:16;
|
||||
uint32_t reserved_16:16;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_main_buf1_high_reg_t;
|
||||
typedef volatile struct lp_timer_dev_t{
|
||||
lp_timer_target_reg_t target[2];
|
||||
lp_timer_update_reg_t update;
|
||||
lp_timer_counter_reg_t counter[2];
|
||||
lp_timer_overflow_reg_t overflow;
|
||||
lp_timer_intr_reg_t int_raw;
|
||||
lp_timer_intr_reg_t int_st;
|
||||
lp_timer_intr_reg_t int_en;
|
||||
lp_timer_intr_reg_t int_clr;
|
||||
lp_timer_lp_intr_reg_t lp_int_raw;
|
||||
lp_timer_lp_intr_reg_t lp_int_st;
|
||||
lp_timer_lp_intr_reg_t lp_int_en;
|
||||
lp_timer_lp_intr_reg_t lp_int_clr;
|
||||
|
||||
/** Type of main_overflow register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0:31;
|
||||
/** main_timer_alarm_load : WT; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_alarm_load:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_main_overflow_reg_t;
|
||||
uint32_t reserved[237];
|
||||
|
||||
/** Type of int_raw register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0:30;
|
||||
/** overflow_raw : R/WTC/SS; bitpos: [30]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t overflow_raw:1;
|
||||
/** soc_wakeup_int_raw : R/WTC/SS; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t soc_wakeup_int_raw:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_int_raw_reg_t;
|
||||
|
||||
/** Type of int_st register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0:30;
|
||||
/** overflow_st : RO; bitpos: [30]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t overflow_st:1;
|
||||
/** soc_wakeup_int_st : RO; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t soc_wakeup_int_st:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_int_st_reg_t;
|
||||
|
||||
/** Type of int_ena register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0:30;
|
||||
/** overflow_ena : R/W; bitpos: [30]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t overflow_ena:1;
|
||||
/** soc_wakeup_int_ena : R/W; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t soc_wakeup_int_ena:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_int_ena_reg_t;
|
||||
|
||||
/** Type of int_clr register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0:30;
|
||||
/** overflow_clr : WT; bitpos: [30]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t overflow_clr:1;
|
||||
/** soc_wakeup_int_clr : WT; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t soc_wakeup_int_clr:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_int_clr_reg_t;
|
||||
|
||||
/** Type of lp_int_raw register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0:30;
|
||||
/** main_timer_overflow_lp_int_raw : R/WTC/SS; bitpos: [30]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_overflow_lp_int_raw:1;
|
||||
/** main_timer_lp_int_raw : R/WTC/SS; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_lp_int_raw:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_lp_int_raw_reg_t;
|
||||
|
||||
/** Type of lp_int_st register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0:30;
|
||||
/** main_timer_overflow_lp_int_st : RO; bitpos: [30]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_overflow_lp_int_st:1;
|
||||
/** main_timer_lp_int_st : RO; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_lp_int_st:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_lp_int_st_reg_t;
|
||||
|
||||
/** Type of lp_int_ena register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0:30;
|
||||
/** main_timer_overflow_lp_int_ena : R/W; bitpos: [30]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_overflow_lp_int_ena:1;
|
||||
/** main_timer_lp_int_ena : R/W; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_lp_int_ena:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_lp_int_ena_reg_t;
|
||||
|
||||
/** Type of lp_int_clr register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t reserved_0:30;
|
||||
/** main_timer_overflow_lp_int_clr : WT; bitpos: [30]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_overflow_lp_int_clr:1;
|
||||
/** main_timer_lp_int_clr : WT; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t main_timer_lp_int_clr:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_lp_int_clr_reg_t;
|
||||
|
||||
/** Type of date register
|
||||
* need_des
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** date : R/W; bitpos: [30:0]; default: 34672976;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t date:31;
|
||||
/** clk_en : R/W; bitpos: [31]; default: 0;
|
||||
* need_des
|
||||
*/
|
||||
uint32_t clk_en:1;
|
||||
};
|
||||
uint32_t val;
|
||||
} lp_timer_date_reg_t;
|
||||
|
||||
|
||||
typedef struct lp_timer_dev_t {
|
||||
volatile lp_timer_tar0_low_reg_t tar0_low;
|
||||
volatile lp_timer_tar0_high_reg_t tar0_high;
|
||||
volatile lp_timer_tar1_low_reg_t tar1_low;
|
||||
volatile lp_timer_tar1_high_reg_t tar1_high;
|
||||
volatile lp_timer_update_reg_t update;
|
||||
volatile lp_timer_main_buf0_low_reg_t main_buf0_low;
|
||||
volatile lp_timer_main_buf0_high_reg_t main_buf0_high;
|
||||
volatile lp_timer_main_buf1_low_reg_t main_buf1_low;
|
||||
volatile lp_timer_main_buf1_high_reg_t main_buf1_high;
|
||||
volatile lp_timer_main_overflow_reg_t main_overflow;
|
||||
volatile lp_timer_int_raw_reg_t int_raw;
|
||||
volatile lp_timer_int_st_reg_t int_st;
|
||||
volatile lp_timer_int_ena_reg_t int_ena;
|
||||
volatile lp_timer_int_clr_reg_t int_clr;
|
||||
volatile lp_timer_lp_int_raw_reg_t lp_int_raw;
|
||||
volatile lp_timer_lp_int_st_reg_t lp_int_st;
|
||||
volatile lp_timer_lp_int_ena_reg_t lp_int_ena;
|
||||
volatile lp_timer_lp_int_clr_reg_t lp_int_clr;
|
||||
uint32_t reserved_048[237];
|
||||
volatile lp_timer_date_reg_t date;
|
||||
union {
|
||||
struct {
|
||||
uint32_t date : 31;
|
||||
uint32_t clk_en: 1;
|
||||
};
|
||||
uint32_t val;
|
||||
} date;
|
||||
} lp_timer_dev_t;
|
||||
|
||||
extern lp_timer_dev_t LP_TIMER;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@ extern "C" {
|
||||
|
||||
/**
|
||||
* @file rtc.h
|
||||
* @brief Low-level RTC power, clock, and sleep functions.
|
||||
* @brief Low-level RTC power, clock functions.
|
||||
*
|
||||
* Functions in this file facilitate configuration of ESP32's RTC_CNTL peripheral.
|
||||
* RTC_CNTL peripheral handles many functions:
|
||||
@@ -514,204 +514,8 @@ bool rtc_dig_8m_enabled(void);
|
||||
*/
|
||||
uint32_t rtc_clk_freq_cal(uint32_t cal_val);
|
||||
|
||||
/**
|
||||
* @brief Power down flags for rtc_sleep_pd function
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t dig_fpu : 1; //!< Set to 1 to power UP digital part in sleep
|
||||
uint32_t rtc_fpu : 1; //!< Set to 1 to power UP RTC memories in sleep
|
||||
uint32_t cpu_fpu : 1; //!< Set to 1 to power UP digital memories and CPU in sleep
|
||||
uint32_t i2s_fpu : 1; //!< Set to 1 to power UP I2S in sleep
|
||||
uint32_t bb_fpu : 1; //!< Set to 1 to power UP WiFi in sleep
|
||||
uint32_t nrx_fpu : 1; //!< Set to 1 to power UP WiFi in sleep
|
||||
uint32_t fe_fpu : 1; //!< Set to 1 to power UP WiFi in sleep
|
||||
uint32_t sram_fpu : 1; //!< Set to 1 to power UP SRAM in sleep
|
||||
uint32_t rom_ram_fpu : 1; //!< Set to 1 to power UP ROM/IRAM0_DRAM0 in sleep
|
||||
} rtc_sleep_pu_config_t;
|
||||
|
||||
/**
|
||||
* Initializer for rtc_sleep_pu_config_t which sets all flags to the same value
|
||||
*/
|
||||
#define RTC_SLEEP_PU_CONFIG_ALL(val) {\
|
||||
.dig_fpu = (val), \
|
||||
.rtc_fpu = (val), \
|
||||
.cpu_fpu = (val), \
|
||||
.i2s_fpu = (val), \
|
||||
.bb_fpu = (val), \
|
||||
.nrx_fpu = (val), \
|
||||
.fe_fpu = (val), \
|
||||
.sram_fpu = (val), \
|
||||
.rom_ram_fpu = (val), \
|
||||
}
|
||||
|
||||
void rtc_sleep_pu(rtc_sleep_pu_config_t cfg);
|
||||
|
||||
/**
|
||||
* @brief sleep configuration for rtc_sleep_init function
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t lslp_mem_inf_fpu : 1; //!< force normal voltage in sleep mode (digital domain memory)
|
||||
uint32_t rtc_mem_inf_follow_cpu : 1;//!< keep low voltage in sleep mode (even if ULP/touch is used)
|
||||
uint32_t rtc_fastmem_pd_en : 1; //!< power down RTC fast memory
|
||||
uint32_t rtc_slowmem_pd_en : 1; //!< power down RTC slow memory
|
||||
uint32_t rtc_peri_pd_en : 1; //!< power down RTC peripherals
|
||||
uint32_t wifi_pd_en : 1; //!< power down WiFi
|
||||
uint32_t bt_pd_en : 1; //!< power down BT
|
||||
uint32_t cpu_pd_en : 1; //!< power down CPU, but not restart when lightsleep.
|
||||
uint32_t int_8m_pd_en : 1; //!< Power down Internal 8M oscillator
|
||||
uint32_t dig_peri_pd_en : 1; //!< power down digital peripherals
|
||||
uint32_t deep_slp : 1; //!< power down digital domain
|
||||
uint32_t wdt_flashboot_mod_en : 1; //!< enable WDT flashboot mode
|
||||
uint32_t dig_dbias_wak : 5; //!< set bias for digital domain, in active mode
|
||||
uint32_t dig_dbias_slp : 5; //!< set bias for digital domain, in sleep mode
|
||||
uint32_t rtc_dbias_wak : 5; //!< set bias for RTC domain, in active mode
|
||||
uint32_t rtc_dbias_slp : 5; //!< set bias for RTC domain, in sleep mode
|
||||
uint32_t dbg_atten_monitor : 4; //!< voltage parameter, in monitor mode
|
||||
uint32_t bias_sleep_monitor : 1; //!< circuit control parameter, in monitor mode
|
||||
uint32_t dbg_atten_slp : 4; //!< voltage parameter, in sleep mode
|
||||
uint32_t bias_sleep_slp : 1; //!< circuit control parameter, in sleep mode
|
||||
uint32_t pd_cur_monitor : 1; //!< circuit control parameter, in monitor mode
|
||||
uint32_t pd_cur_slp : 1; //!< circuit control parameter, in sleep mode
|
||||
uint32_t vddsdio_pd_en : 1; //!< power down VDDSDIO regulator
|
||||
uint32_t xtal_fpu : 1; //!< keep main XTAL powered up in sleep
|
||||
uint32_t deep_slp_reject : 1; //!< enable deep sleep reject
|
||||
uint32_t light_slp_reject : 1; //!< enable light sleep reject
|
||||
} rtc_sleep_config_t;
|
||||
|
||||
#define RTC_SLEEP_PD_DIG BIT(0) //!< Deep sleep (power down digital domain)
|
||||
#define RTC_SLEEP_PD_RTC_PERIPH BIT(1) //!< Power down RTC peripherals
|
||||
#define RTC_SLEEP_PD_RTC_SLOW_MEM BIT(2) //!< Power down RTC SLOW memory
|
||||
#define RTC_SLEEP_PD_RTC_FAST_MEM BIT(3) //!< Power down RTC FAST memory
|
||||
#define RTC_SLEEP_PD_RTC_MEM_FOLLOW_CPU BIT(4) //!< RTC FAST and SLOW memories are automatically powered up and down along with the CPU
|
||||
#define RTC_SLEEP_PD_VDDSDIO BIT(5) //!< Power down VDDSDIO regulator
|
||||
#define RTC_SLEEP_PD_WIFI BIT(6) //!< Power down WIFI
|
||||
#define RTC_SLEEP_PD_BT BIT(7) //!< Power down BT
|
||||
#define RTC_SLEEP_PD_CPU BIT(8) //!< Power down CPU when in lightsleep, but not restart
|
||||
#define RTC_SLEEP_PD_DIG_PERIPH BIT(9) //!< Power down DIG peripherals
|
||||
#define RTC_SLEEP_PD_INT_8M BIT(10) //!< Power down Internal 8M oscillator
|
||||
#define RTC_SLEEP_PD_XTAL BIT(11) //!< Power down main XTAL
|
||||
|
||||
//These flags are not power domains, but will affect some sleep parameters
|
||||
#define RTC_SLEEP_DIG_USE_8M BIT(16)
|
||||
#define RTC_SLEEP_USE_ADC_TESEN_MONITOR BIT(17)
|
||||
#define RTC_SLEEP_NO_ULTRA_LOW BIT(18) //!< Avoid using ultra low power in deep sleep, in which RTCIO cannot be used as input, and RTCMEM can't work under high temperature
|
||||
|
||||
/**
|
||||
* Default initializer for rtc_sleep_config_t
|
||||
*
|
||||
* This initializer sets all fields to "reasonable" values (e.g. suggested for
|
||||
* production use) based on a combination of RTC_SLEEP_PD_x flags.
|
||||
*
|
||||
* @param RTC_SLEEP_PD_x flags combined using bitwise OR
|
||||
*/
|
||||
void rtc_sleep_get_default_config(uint32_t sleep_flags, rtc_sleep_config_t *out_config);
|
||||
|
||||
/**
|
||||
* @brief Prepare the chip to enter sleep mode
|
||||
*
|
||||
* This function configures various power control state machines to handle
|
||||
* entry into light sleep or deep sleep mode, switches APB and CPU clock source
|
||||
* (usually to XTAL), and sets bias voltages for digital and RTC power domains.
|
||||
*
|
||||
* This function does not actually enter sleep mode; this is done using
|
||||
* rtc_sleep_start function. Software may do some other actions between
|
||||
* rtc_sleep_init and rtc_sleep_start, such as set wakeup timer and configure
|
||||
* wakeup sources.
|
||||
* @param cfg sleep mode configuration
|
||||
*/
|
||||
void rtc_sleep_init(rtc_sleep_config_t cfg);
|
||||
|
||||
/**
|
||||
* @brief Low level initialize for rtc state machine waiting cycles after waking up
|
||||
*
|
||||
* This function configures the cycles chip need to wait for internal 8MHz
|
||||
* oscillator and external 40MHz crystal. As we configure fixed time for waiting
|
||||
* crystal, we need to pass period to calculate cycles. Now this function only
|
||||
* used in lightsleep mode.
|
||||
*
|
||||
* @param slowclk_period re-calibrated slow clock period
|
||||
*/
|
||||
void rtc_sleep_low_init(uint32_t slowclk_period);
|
||||
|
||||
/**
|
||||
* @brief Set target value of RTC counter for RTC_TIMER_TRIG_EN wakeup source
|
||||
* @param t value of RTC counter at which wakeup from sleep will happen;
|
||||
* only the lower 48 bits are used
|
||||
*/
|
||||
void rtc_sleep_set_wakeup_time(uint64_t t);
|
||||
|
||||
#define RTC_GPIO_TRIG_EN BIT(2) //!< GPIO wakeup
|
||||
#define RTC_TIMER_TRIG_EN BIT(3) //!< Timer wakeup
|
||||
#define RTC_WIFI_TRIG_EN BIT(5) //!< WIFI wakeup (light sleep only)
|
||||
#define RTC_UART0_TRIG_EN BIT(6) //!< UART0 wakeup (light sleep only)
|
||||
#define RTC_UART1_TRIG_EN BIT(7) //!< UART1 wakeup (light sleep only)
|
||||
#define RTC_BT_TRIG_EN BIT(10) //!< BT wakeup (light sleep only)
|
||||
#define RTC_XTAL32K_DEAD_TRIG_EN BIT(12)
|
||||
#define RTC_USB_TRIG_EN BIT(14)
|
||||
#define RTC_BROWNOUT_DET_TRIG_EN BIT(16)
|
||||
|
||||
/**
|
||||
* RTC_SLEEP_REJECT_MASK records sleep reject sources supported by chip
|
||||
*/
|
||||
#define RTC_SLEEP_REJECT_MASK (RTC_GPIO_TRIG_EN | \
|
||||
RTC_TIMER_TRIG_EN | \
|
||||
RTC_WIFI_TRIG_EN | \
|
||||
RTC_UART0_TRIG_EN | \
|
||||
RTC_UART1_TRIG_EN | \
|
||||
RTC_BT_TRIG_EN | \
|
||||
RTC_XTAL32K_DEAD_TRIG_EN | \
|
||||
RTC_USB_TRIG_EN | \
|
||||
RTC_BROWNOUT_DET_TRIG_EN)
|
||||
|
||||
/**
|
||||
* @brief Enter deep or light sleep mode
|
||||
*
|
||||
* This function enters the sleep mode previously configured using rtc_sleep_init
|
||||
* function. Before entering sleep, software should configure wake up sources
|
||||
* appropriately (set up GPIO wakeup registers, timer wakeup registers,
|
||||
* and so on).
|
||||
*
|
||||
* If deep sleep mode was configured using rtc_sleep_init, and sleep is not
|
||||
* rejected by hardware (based on reject_opt flags), this function never returns.
|
||||
* When the chip wakes up from deep sleep, CPU is reset and execution starts
|
||||
* from ROM bootloader.
|
||||
*
|
||||
* If light sleep mode was configured using rtc_sleep_init, this function
|
||||
* returns on wakeup, or if sleep is rejected by hardware.
|
||||
*
|
||||
* @param wakeup_opt bit mask wake up reasons to enable (RTC_xxx_TRIG_EN flags
|
||||
* combined with OR)
|
||||
* @param reject_opt bit mask of sleep reject reasons:
|
||||
* - RTC_CNTL_GPIO_REJECT_EN
|
||||
* - RTC_CNTL_SDIO_REJECT_EN
|
||||
* These flags are used to prevent entering sleep when e.g.
|
||||
* an external host is communicating via SDIO slave
|
||||
* @return non-zero if sleep was rejected by hardware
|
||||
*/
|
||||
uint32_t rtc_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt, uint32_t lslp_mem_inf_fpu);
|
||||
|
||||
/**
|
||||
* @brief Enter deep sleep mode
|
||||
*
|
||||
* Similar to rtc_sleep_start(), but additionally uses hardware to calculate the CRC value
|
||||
* of RTC FAST memory. On wake, this CRC is used to determine if a deep sleep wake
|
||||
* stub is valid to execute (if a wake address is set).
|
||||
*
|
||||
* No RAM is accessed while calculating the CRC and going into deep sleep, which makes
|
||||
* this function safe to use even if the caller's stack is in RTC FAST memory.
|
||||
*
|
||||
* @note If no deep sleep wake stub address is set then calling rtc_sleep_start() will
|
||||
* have the same effect and takes less time as CRC calculation is skipped.
|
||||
*
|
||||
* @note This function should only be called after rtc_sleep_init() has been called to
|
||||
* configure the system for deep sleep.
|
||||
*
|
||||
* @param wakeup_opt - same as for rtc_sleep_start
|
||||
* @param reject_opt - same as for rtc_sleep_start
|
||||
*
|
||||
* @return non-zero if sleep was rejected by hardware
|
||||
*/
|
||||
uint32_t rtc_deep_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt);
|
||||
|
||||
/**
|
||||
* RTC power and clock control initialization settings
|
||||
@@ -754,37 +558,6 @@ typedef struct {
|
||||
*/
|
||||
void rtc_init(rtc_config_t cfg);
|
||||
|
||||
/**
|
||||
* Structure describing vddsdio configuration
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t force : 1; //!< If 1, use configuration from RTC registers; if 0, use EFUSE/bootstrapping pins.
|
||||
uint32_t enable : 1; //!< Enable VDDSDIO regulator
|
||||
uint32_t tieh : 1; //!< Select VDDSDIO voltage. One of RTC_VDDSDIO_TIEH_1_8V, RTC_VDDSDIO_TIEH_3_3V
|
||||
uint32_t drefh : 2; //!< Tuning parameter for VDDSDIO regulator
|
||||
uint32_t drefm : 2; //!< Tuning parameter for VDDSDIO regulator
|
||||
uint32_t drefl : 2; //!< Tuning parameter for VDDSDIO regulator
|
||||
} rtc_vddsdio_config_t;
|
||||
|
||||
/**
|
||||
* Get current VDDSDIO configuration
|
||||
* If VDDSDIO configuration is overridden by RTC, get values from RTC
|
||||
* Otherwise, if VDDSDIO is configured by EFUSE, get values from EFUSE
|
||||
* Otherwise, use default values and the level of MTDI bootstrapping pin.
|
||||
* @return currently used VDDSDIO configuration
|
||||
*/
|
||||
rtc_vddsdio_config_t rtc_vddsdio_get_config(void);
|
||||
|
||||
/**
|
||||
* Set new VDDSDIO configuration using RTC registers.
|
||||
* If config.force == 1, this overrides configuration done using bootstrapping
|
||||
* pins and EFUSE.
|
||||
*
|
||||
* @param config new VDDSDIO configuration
|
||||
*/
|
||||
void rtc_vddsdio_set_config(rtc_vddsdio_config_t config);
|
||||
|
||||
|
||||
// -------------------------- CLOCK TREE DEFS ALIAS ----------------------------
|
||||
// **WARNING**: The following are only for backwards compatibility.
|
||||
// Please use the declarations in soc/clk_tree_defs.h instead.
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
#define EFUSE_CLK_FREQ_ROM ( 20*1000000)
|
||||
#define CPU_CLK_FREQ APB_CLK_FREQ
|
||||
#define APB_CLK_FREQ ( 40*1000000 )
|
||||
#define MODEM_APB_CLK_FREQ ( 80*1000000 )
|
||||
#define REF_CLK_FREQ ( 1000000 )
|
||||
#define RTC_CLK_FREQ (20*1000000)
|
||||
#define XTAL_CLK_FREQ (40*1000000)
|
||||
|
||||
@@ -63,6 +63,8 @@
|
||||
#define SOC_SDIO_SLAVE_SUPPORTED 1
|
||||
#define SOC_BOD_SUPPORTED 1
|
||||
#define SOC_APM_SUPPORTED 1
|
||||
#define SOC_PMU_SUPPORTED 1
|
||||
#define SOC_LP_TIMER_SUPPORTED 1
|
||||
|
||||
/*-------------------------- XTAL CAPS ---------------------------------------*/
|
||||
#define SOC_XTAL_SUPPORT_40M 1
|
||||
@@ -281,15 +283,6 @@
|
||||
#define SOC_MCPWM_CLK_SUPPORT_PLL160M (1) ///< Support PLL160M as clock source
|
||||
#define SOC_MCPWM_CLK_SUPPORT_XTAL (1) ///< Support XTAL as clock source
|
||||
|
||||
// TODO: IDF-5348 (Copy from esp32c3, need check)
|
||||
/*-------------------------- RTC CAPS --------------------------------------*/
|
||||
#define SOC_RTC_CNTL_CPU_PD_DMA_BUS_WIDTH (128)
|
||||
#define SOC_RTC_CNTL_CPU_PD_REG_FILE_NUM (108)
|
||||
#define SOC_RTC_CNTL_CPU_PD_DMA_ADDR_ALIGN (SOC_RTC_CNTL_CPU_PD_DMA_BUS_WIDTH >> 3)
|
||||
#define SOC_RTC_CNTL_CPU_PD_DMA_BLOCK_SIZE (SOC_RTC_CNTL_CPU_PD_DMA_BUS_WIDTH >> 3)
|
||||
|
||||
#define SOC_RTC_CNTL_CPU_PD_RETENTION_MEM_SIZE (SOC_RTC_CNTL_CPU_PD_REG_FILE_NUM * (SOC_RTC_CNTL_CPU_PD_DMA_BUS_WIDTH >> 3))
|
||||
|
||||
// TODO: IDF-5359 (Copy from esp32c3, need check)
|
||||
/*--------------------------- RSA CAPS ---------------------------------------*/
|
||||
#define SOC_RSA_MAX_BIT_LEN (3072)
|
||||
@@ -368,6 +361,10 @@
|
||||
#define SOC_SYSTIMER_ALARM_MISS_COMPENSATE 1 // Systimer peripheral can generate interrupt immediately if t(target) > t(current)
|
||||
#define SOC_SYSTIMER_SUPPORT_ETM 1 // Systimer comparator can generate ETM event
|
||||
|
||||
/*-------------------------- LP_TIMER CAPS ----------------------------------*/
|
||||
#define SOC_LP_TIMER_BIT_WIDTH_LO 32 // Bit width of lp_timer low part
|
||||
#define SOC_LP_TIMER_BIT_WIDTH_HI 16 // Bit width of lp_timer high part
|
||||
|
||||
/*--------------------------- TIMER GROUP CAPS ---------------------------------------*/
|
||||
#define SOC_TIMER_GROUPS (2)
|
||||
#define SOC_TIMER_GROUP_TIMERS_PER_GROUP (1U)
|
||||
@@ -410,14 +407,13 @@
|
||||
// TODO: IDF-5338 (Copy from esp32c3, need check)
|
||||
/*-------------------------- UART CAPS ---------------------------------------*/
|
||||
// ESP32-C6 has 2 UARTs
|
||||
#define SOC_UART_NUM (2)
|
||||
#define SOC_UART_FIFO_LEN (128) /*!< The UART hardware FIFO length */
|
||||
#define SOC_UART_BITRATE_MAX (5000000) /*!< Max bit rate supported by UART */
|
||||
|
||||
#define SOC_UART_SUPPORT_PLL_F80M_CLK (1) /*!< Support PLL_DIV as the clock source */
|
||||
#define SOC_UART_SUPPORT_RTC_CLK (1) /*!< Support RTC clock as the clock source */
|
||||
#define SOC_UART_SUPPORT_XTAL_CLK (1) /*!< Support XTAL clock as the clock source */
|
||||
// #define SOC_UART_SUPPORT_WAKEUP_INT (1) /*!< Support UART wakeup interrupt */ // TODO: Test UART wakeup while supporting sleep
|
||||
#define SOC_UART_NUM (2)
|
||||
#define SOC_UART_FIFO_LEN (128) /*!< The UART hardware FIFO length */
|
||||
#define SOC_UART_BITRATE_MAX (5000000) /*!< Max bit rate supported by UART */
|
||||
#define SOC_UART_SUPPORT_PLL_F80M_CLK (1) /*!< Support PLL_DIV as the clock source */
|
||||
#define SOC_UART_SUPPORT_RTC_CLK (1) /*!< Support RTC clock as the clock source */
|
||||
#define SOC_UART_SUPPORT_XTAL_CLK (1) /*!< Support XTAL clock as the clock source */
|
||||
#define SOC_UART_SUPPORT_WAKEUP_INT (1) /*!< Support UART wakeup interrupt */ // TODO: Test UART wakeup while supporting sleep
|
||||
|
||||
// UART has an extra TX_WAIT_SEND state when the FIFO is not empty and XOFF is enabled
|
||||
#define SOC_UART_SUPPORT_FSM_TX_WAIT_SEND (1)
|
||||
@@ -438,14 +434,16 @@
|
||||
#define SOC_PM_SUPPORT_WIFI_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_BT_WAKEUP (1)
|
||||
#define SOC_PM_SUPPORT_CPU_PD (1)
|
||||
#define SOC_PM_SUPPORT_WIFI_PD (1)
|
||||
#define SOC_PM_SUPPORT_BT_PD (1)
|
||||
#define SOC_PM_SUPPORT_MODEM_PD (1)
|
||||
#define SOC_PM_SUPPORT_XTAL32K_PD (1)
|
||||
#define SOC_PM_SUPPORT_RC32K_PD (1)
|
||||
#define SOC_PM_SUPPORT_RC_FAST_PD (1)
|
||||
#define SOC_PM_SUPPORT_VDDSDIO_PD (1)
|
||||
|
||||
#define SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY (1) /*!<Supports CRC only the stub code in RTC memory */
|
||||
|
||||
#define SOC_PM_CPU_RETENTION_BY_SW (1)
|
||||
|
||||
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
|
||||
#define SOC_CLK_RC_FAST_SUPPORT_CALIBRATION (1)
|
||||
#define SOC_MODEM_CLOCK_IS_INDEPENDENT (1)
|
||||
|
||||
Reference in New Issue
Block a user