File tree Expand file tree Collapse file tree 8 files changed +50
-3
lines changed
Expand file tree Collapse file tree 8 files changed +50
-3
lines changed Original file line number Diff line number Diff line change 11/*
2- * SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
2+ * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
33 *
44 * SPDX-License-Identifier: Apache-2.0
55 */
@@ -247,6 +247,16 @@ FORCE_INLINE_ATTR void esp_cpu_intr_set_mtvt_addr(const void *mtvt_addr)
247247}
248248#endif //#if SOC_INT_CLIC_SUPPORTED
249249
250+ #if SOC_CPU_SUPPORT_WFE
251+ /**
252+ * @brief Disable the WFE (wait for event) feature for CPU.
253+ */
254+ FORCE_INLINE_ATTR void rv_utils_disable_wfe_mode (void )
255+ {
256+ rv_utils_wfe_mode_enable (false);
257+ }
258+ #endif
259+
250260#if SOC_CPU_HAS_FLEXIBLE_INTC
251261/**
252262 * @brief Set the interrupt type of a particular interrupt
Original file line number Diff line number Diff line change @@ -218,7 +218,9 @@ void IRAM_ATTR call_start_cpu1(void)
218218 */
219219 esp_cpu_intr_set_mtvt_addr (& _mtvt_table );
220220#endif
221-
221+ #if SOC_CPU_SUPPORT_WFE
222+ rv_utils_disable_wfe_mode ();
223+ #endif
222224 ets_set_appcpu_boot_addr (0 );
223225
224226 bootloader_init_mem ();
@@ -419,6 +421,9 @@ void IRAM_ATTR call_start_cpu0(void)
419421 */
420422 esp_cpu_intr_set_mtvt_addr (& _mtvt_table );
421423#endif
424+ #if SOC_CPU_SUPPORT_WFE
425+ rv_utils_disable_wfe_mode ();
426+ #endif
422427
423428 rst_reas [0 ] = esp_rom_get_reset_reason (0 );
424429#if !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE
Original file line number Diff line number Diff line change 11/*
2- * SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
2+ * SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
33 *
44 * SPDX-License-Identifier: Apache-2.0
55 */
@@ -148,6 +148,20 @@ FORCE_INLINE_ATTR void rv_utils_set_mtvt(uint32_t mtvt_val)
148148 RV_WRITE_CSR (MTVT_CSR , mtvt_val );
149149}
150150
151+ #if SOC_CPU_SUPPORT_WFE
152+ /**
153+ * @brief Set the MEXSTATUS_WFFEN value, used to enable/disable wait for event mode.
154+ */
155+ FORCE_INLINE_ATTR void rv_utils_wfe_mode_enable (bool en )
156+ {
157+ if (en ) {
158+ RV_SET_CSR (MEXSTATUS , MEXSTATUS_WFFEN );
159+ } else {
160+ RV_CLEAR_CSR (MEXSTATUS , MEXSTATUS_WFFEN );
161+ }
162+ }
163+ #endif
164+
151165/**
152166 * @brief Get the current CPU raw interrupt level
153167 */
Original file line number Diff line number Diff line change 5353#define MSTATUS_SXL 0x0000000C00000000
5454#define MSTATUS64_SD 0x8000000000000000
5555
56+ #define MEXSTATUS_SOFT_RST 0x00000003
57+ #define MEXSTATUS_LPMD 0x0000000C
58+ #define MEXSTATUS_WFFEN 0x00000010
59+ #define MEXSTATUS_EXPT_VLD 0x00000020
60+ #define MEXSTATUS_LOCKUP 0x00000040
61+ #define MEXSTATUS_NMISTS 0x00000080
62+ #define MEXSTATUS_BUSEER 0x00000100
63+
5664#define SSTATUS_UIE 0x00000001
5765#define SSTATUS_SIE 0x00000002
5866#define SSTATUS_UPIE 0x00000010
Original file line number Diff line number Diff line change @@ -379,6 +379,10 @@ config SOC_CPU_HAS_FLEXIBLE_INTC
379379 bool
380380 default y
381381
382+ config SOC_CPU_SUPPORT_WFE
383+ bool
384+ default y
385+
382386config SOC_INT_CLIC_SUPPORTED
383387 bool
384388 default y
Original file line number Diff line number Diff line change 153153#define SOC_CPU_CORES_NUM (1U)
154154#define SOC_CPU_INTR_NUM 32
155155#define SOC_CPU_HAS_FLEXIBLE_INTC 1
156+ #define SOC_CPU_SUPPORT_WFE 1
156157#define SOC_INT_CLIC_SUPPORTED 1
157158#define SOC_INT_HW_NESTED_SUPPORTED 1 // Support for hardware interrupts nesting
158159#define SOC_BRANCH_PREDICTOR_SUPPORTED 1
Original file line number Diff line number Diff line change @@ -215,6 +215,10 @@ config SOC_CPU_HAS_FLEXIBLE_INTC
215215 bool
216216 default y
217217
218+ config SOC_CPU_SUPPORT_WFE
219+ bool
220+ default y
221+
218222config SOC_INT_PLIC_SUPPORTED
219223 bool
220224 default n
Original file line number Diff line number Diff line change 126126#define SOC_CPU_CORES_NUM (1U)
127127#define SOC_CPU_INTR_NUM 32
128128#define SOC_CPU_HAS_FLEXIBLE_INTC 1
129+ #define SOC_CPU_SUPPORT_WFE 1
129130#define SOC_INT_PLIC_SUPPORTED 0 //riscv platform-level interrupt controller
130131#define SOC_INT_CLIC_SUPPORTED 1
131132#define SOC_INT_HW_NESTED_SUPPORTED 1 // Support for hardware interrupts nesting
You can’t perform that action at this time.
0 commit comments