refactor(hal): update assist_debug_ll_reset_register() to pass core_id

This commit is contained in:
Erhan Kurubas
2026-03-19 11:40:44 +08:00
committed by BOT
parent d13bbd4b2b
commit 18a583e517
8 changed files with 15 additions and 17 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ ESP_SYSTEM_INIT_FN(esp_hw_stack_guard_init, SECONDARY, ESP_SYSTEM_INIT_ALL_CORES
#endif #endif
{ {
assist_debug_ll_enable_bus_clock(true); assist_debug_ll_enable_bus_clock(true);
assist_debug_ll_reset_register(); assist_debug_ll_reset_register(core_id);
} }
/* set interrupt to matrix */ /* set interrupt to matrix */
@@ -38,7 +38,7 @@ ESP_SYSTEM_INIT_FN(esp_hw_stack_guard_init, SECONDARY, ESP_SYSTEM_INIT_ALL_CORES
* - trigger event happened * - trigger event happened
* - you get an interrupt right after enabling interrupts * - you get an interrupt right after enabling interrupts
* So, use monitor to disable hw_guard to avoid false-positives. * So, use monitor to disable hw_guard to avoid false-positives.
* And keep interrupt always enabled for better performace (don't spend cpu time for enable/disable) * And keep interrupt always enabled for better performance (don't spend cpu time for enable/disable)
*/ */
assist_debug_hal_sp_int_enable(core_id); assist_debug_hal_sp_int_enable(core_id);
@@ -119,7 +119,7 @@ FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
SYSTEM.cpu_peri_clk_en.clk_en_assist_debug = enable; SYSTEM.cpu_peri_clk_en.clk_en_assist_debug = enable;
} }
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void) FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
{ {
SYSTEM.cpu_peri_rst_en.rst_en_assist_debug = true; SYSTEM.cpu_peri_rst_en.rst_en_assist_debug = true;
SYSTEM.cpu_peri_rst_en.rst_en_assist_debug = false; SYSTEM.cpu_peri_rst_en.rst_en_assist_debug = false;
@@ -119,7 +119,7 @@ FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
SYSTEM.cpu_peri_clk_en.reg_clk_en_assist_debug = enable; SYSTEM.cpu_peri_clk_en.reg_clk_en_assist_debug = enable;
} }
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void) FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
{ {
SYSTEM.cpu_peri_rst_en.reg_rst_en_assist_debug = true; SYSTEM.cpu_peri_rst_en.reg_rst_en_assist_debug = true;
SYSTEM.cpu_peri_rst_en.reg_rst_en_assist_debug = false; SYSTEM.cpu_peri_rst_en.reg_rst_en_assist_debug = false;
@@ -121,7 +121,7 @@ FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
PCR.assist_conf.assist_clk_en = enable; PCR.assist_conf.assist_clk_en = enable;
} }
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void) FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
{ {
PCR.assist_conf.assist_rst_en = true; PCR.assist_conf.assist_rst_en = true;
PCR.assist_conf.assist_rst_en = false; PCR.assist_conf.assist_rst_en = false;
@@ -119,7 +119,7 @@ FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
PCR.assist_conf.assist_clk_en = enable; PCR.assist_conf.assist_clk_en = enable;
} }
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void) FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
{ {
PCR.assist_conf.assist_rst_en = true; PCR.assist_conf.assist_rst_en = true;
PCR.assist_conf.assist_rst_en = false; PCR.assist_conf.assist_rst_en = false;
@@ -121,7 +121,7 @@ FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
PCR.assist_conf.assist_clk_en = enable; PCR.assist_conf.assist_clk_en = enable;
} }
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void) FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
{ {
PCR.assist_conf.assist_rst_en = true; PCR.assist_conf.assist_rst_en = true;
PCR.assist_conf.assist_rst_en = false; PCR.assist_conf.assist_rst_en = false;
@@ -119,7 +119,7 @@ FORCE_INLINE_ATTR void assist_debug_ll_enable_bus_clock(bool enable)
PCR.assist_conf.assist_clk_en = enable; PCR.assist_conf.assist_clk_en = enable;
} }
FORCE_INLINE_ATTR void assist_debug_ll_reset_register(void) FORCE_INLINE_ATTR void assist_debug_ll_reset_register(__attribute__((unused)) uint32_t core_id)
{ {
PCR.assist_conf.assist_rst_en = true; PCR.assist_conf.assist_rst_en = true;
PCR.assist_conf.assist_rst_en = false; PCR.assist_conf.assist_rst_en = false;
@@ -124,17 +124,15 @@ FORCE_INLINE_ATTR void _assist_debug_ll_enable_bus_clock(bool enable)
#define assist_debug_ll_enable_bus_clock(...) \ #define assist_debug_ll_enable_bus_clock(...) \
(void)__DECLARE_RCC_ATOMIC_ENV; _assist_debug_ll_enable_bus_clock(__VA_ARGS__) (void)__DECLARE_RCC_ATOMIC_ENV; _assist_debug_ll_enable_bus_clock(__VA_ARGS__)
FORCE_INLINE_ATTR void _assist_debug_ll_reset_register(void) FORCE_INLINE_ATTR void _assist_debug_ll_reset_register(uint32_t core_id)
{ {
/* esp32p4 has no assist_debug reset register: disable & clear interrupts manually. */ /* esp32p4 has no assist_debug reset register: disable & clear interrupts manually. */
for (int i = 0; i < SOC_CPU_CORES_NUM; i++) { assist_debug_ll_sp_spill_monitor_disable(core_id);
assist_debug_ll_sp_spill_monitor_disable(i); assist_debug_ll_sp_spill_interrupt_clear(core_id);
assist_debug_ll_sp_spill_interrupt_clear(i); assist_debug_ll_sp_spill_set_min(core_id, 0);
assist_debug_ll_sp_spill_set_min(i, 0); assist_debug_ll_sp_spill_set_max(core_id, 0xffffffff);
assist_debug_ll_sp_spill_set_max(i, 0xffffffff); /* Enable PC register storing when trigger stack monitor. */
/* Enable PC register storing when trigger stack monitor. */ REG_WRITE(core_id ? ASSIST_DEBUG_CORE_1_RCD_EN_REG : ASSIST_DEBUG_CORE_0_RCD_EN_REG, ASSIST_DEBUG_CORE_1_RCD_PDEBUGEN | ASSIST_DEBUG_CORE_1_RCD_RECORDEN);
REG_WRITE(i ? ASSIST_DEBUG_CORE_1_RCD_EN_REG : ASSIST_DEBUG_CORE_0_RCD_EN_REG, ASSIST_DEBUG_CORE_1_RCD_PDEBUGEN | ASSIST_DEBUG_CORE_1_RCD_RECORDEN);
}
} }
#define assist_debug_ll_reset_register(...) \ #define assist_debug_ll_reset_register(...) \
(void)__DECLARE_RCC_ATOMIC_ENV; _assist_debug_ll_reset_register(__VA_ARGS__) (void)__DECLARE_RCC_ATOMIC_ENV; _assist_debug_ll_reset_register(__VA_ARGS__)