refactor(esp_system): ind_wdt.c refactor & code clean

1. introduce reconfigure_ticks function for wdt configuration
 2. move esp32eco3 cache livelock workaround code out from int_wdt.c
This commit is contained in:
wuzhenghui
2026-03-20 10:51:39 +08:00
parent 8b4c344ddd
commit 66f24377fc
6 changed files with 217 additions and 85 deletions
@@ -1,15 +1,23 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "sdkconfig.h"
#ifdef __cplusplus
extern "C" {
#endif
#define IWDT_INITIAL_TIMEOUT_S (5)
#define IWDT_TICKS_PER_US (500)
#define IWDT_STAGE0_TIMEOUT_US (CONFIG_ESP_INT_WDT_TIMEOUT_MS * 1000 / IWDT_TICKS_PER_US)
#define IWDT_STAGE1_TIMEOUT_US (2 * IWDT_STAGE0_TIMEOUT_US)
#define IWDT_INITIAL_TIMEOUT_US (IWDT_INITIAL_TIMEOUT_S * 1000000 / IWDT_TICKS_PER_US)
/**
* @brief Initialize the non-CPU-specific parts of interrupt watchdog.
*
@@ -28,6 +36,18 @@ void esp_int_wdt_init(void);
*/
void esp_int_wdt_cpu_init(void);
#if CONFIG_ESP32_ECO3_CACHE_LOCK_FIX
/**
* @brief Reconfigure WDT stage timeouts (ticks).
*
* Low-level API used by the livelock workaround. Prefer esp_int_wdt_livelock_workaround() for sleep flows.
*
* @param stage0_ticks Stage0 timeout ticks
* @param stage1_ticks Stage1 timeout ticks
*/
void esp_int_wdt_reconfigure_ticks(uint32_t stage0_ticks, uint32_t stage1_ticks);
#endif
#ifdef __cplusplus
}
#endif