mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-11-04 06:11:06 +00:00 
			
		
		
		
	Merge branch 'refactor/wdt_use_unified_type' into 'master'
wdt: refactor wdt codes to use unified type Closes IDF-5653 See merge request espressif/esp-idf!22378
This commit is contained in:
		@@ -61,11 +61,7 @@ void bootloader_config_wdt(void)
 | 
				
			|||||||
     * protect the remainder of the bootloader process.
 | 
					     * protect the remainder of the bootloader process.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    //Disable RWDT flashboot protection.
 | 
					    //Disable RWDT flashboot protection.
 | 
				
			||||||
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 // TODO: IDF-5653
 | 
					    wdt_hal_context_t rwdt_ctx = RWDT_HAL_CONTEXT_DEFAULT();
 | 
				
			||||||
    wdt_hal_context_t rwdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &LP_WDT};
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    wdt_hal_context_t rwdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &RTCCNTL};
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    wdt_hal_write_protect_disable(&rwdt_ctx);
 | 
					    wdt_hal_write_protect_disable(&rwdt_ctx);
 | 
				
			||||||
    wdt_hal_set_flashboot_en(&rwdt_ctx, false);
 | 
					    wdt_hal_set_flashboot_en(&rwdt_ctx, false);
 | 
				
			||||||
    wdt_hal_write_protect_enable(&rwdt_ctx);
 | 
					    wdt_hal_write_protect_enable(&rwdt_ctx);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -433,11 +433,8 @@ esp_err_t esp_flash_encrypt_region(uint32_t src_addr, size_t data_length)
 | 
				
			|||||||
        return ESP_FAIL;
 | 
					        return ESP_FAIL;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 // TODO: IDF-5653
 | 
					    wdt_hal_context_t rtc_wdt_ctx = RWDT_HAL_CONTEXT_DEFAULT();
 | 
				
			||||||
    wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &LP_WDT};
 | 
					
 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &RTCCNTL};
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    for (size_t i = 0; i < data_length; i += FLASH_SECTOR_SIZE) {
 | 
					    for (size_t i = 0; i < data_length; i += FLASH_SECTOR_SIZE) {
 | 
				
			||||||
        wdt_hal_write_protect_disable(&rtc_wdt_ctx);
 | 
					        wdt_hal_write_protect_disable(&rtc_wdt_ctx);
 | 
				
			||||||
        wdt_hal_feed(&rtc_wdt_ctx);
 | 
					        wdt_hal_feed(&rtc_wdt_ctx);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -114,11 +114,7 @@ static uint32_t gdbstub_hton(uint32_t i)
 | 
				
			|||||||
    return __builtin_bswap32(i);
 | 
					    return __builtin_bswap32(i);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !CONFIG_IDF_TARGET_ESP32C6 && !CONFIG_IDF_TARGET_ESP32H2 // TODO: IDF-5653
 | 
					static wdt_hal_context_t rtc_wdt_ctx = RWDT_HAL_CONTEXT_DEFAULT();
 | 
				
			||||||
static wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &RTCCNTL};
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
static wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &LP_WDT};
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
static bool rtc_wdt_ctx_enabled = false;
 | 
					static bool rtc_wdt_ctx_enabled = false;
 | 
				
			||||||
static wdt_hal_context_t wdt0_context = {.inst = WDT_MWDT0, .mwdt_dev = &TIMERG0};
 | 
					static wdt_hal_context_t wdt0_context = {.inst = WDT_MWDT0, .mwdt_dev = &TIMERG0};
 | 
				
			||||||
static bool wdt0_context_enabled = false;
 | 
					static bool wdt0_context_enabled = false;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -851,11 +851,7 @@ esp_err_t esp_light_sleep_start(void)
 | 
				
			|||||||
    periph_inform_out_light_sleep_overhead(s_config.sleep_time_adjustment - sleep_time_overhead_in);
 | 
					    periph_inform_out_light_sleep_overhead(s_config.sleep_time_adjustment - sleep_time_overhead_in);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Safety net: enable WDT in case exit from light sleep fails
 | 
					    // Safety net: enable WDT in case exit from light sleep fails
 | 
				
			||||||
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 // TODO: IDF-5653
 | 
					    wdt_hal_context_t rtc_wdt_ctx = RWDT_HAL_CONTEXT_DEFAULT();
 | 
				
			||||||
    wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &LP_WDT};
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &RTCCNTL};
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    bool wdt_was_enabled = wdt_hal_is_enabled(&rtc_wdt_ctx);    // If WDT was enabled in the user code, then do not change it here.
 | 
					    bool wdt_was_enabled = wdt_hal_is_enabled(&rtc_wdt_ctx);    // If WDT was enabled in the user code, then do not change it here.
 | 
				
			||||||
    if (!wdt_was_enabled) {
 | 
					    if (!wdt_was_enabled) {
 | 
				
			||||||
        wdt_hal_init(&rtc_wdt_ctx, WDT_RWDT, 0, false);
 | 
					        wdt_hal_init(&rtc_wdt_ctx, WDT_RWDT, 0, false);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,11 +27,7 @@ void wdt_hal_init(wdt_hal_context_t *hal, wdt_inst_t wdt_inst, uint32_t prescale
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2      // ESP32C6-TODO, ESP32H2-TODO: IDF-5653
 | 
					        hal->rwdt_dev = RWDT_DEV_GET();
 | 
				
			||||||
        hal->rwdt_dev = &LP_WDT;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
        hal->rwdt_dev = &RTCCNTL;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    hal->inst = wdt_inst;
 | 
					    hal->inst = wdt_inst;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,11 +62,7 @@
 | 
				
			|||||||
bool g_panic_abort = false;
 | 
					bool g_panic_abort = false;
 | 
				
			||||||
static char *s_panic_abort_details = NULL;
 | 
					static char *s_panic_abort_details = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2// ESP32C6,ESP32H2-TODO: IDF-5653
 | 
					static wdt_hal_context_t rtc_wdt_ctx = RWDT_HAL_CONTEXT_DEFAULT();
 | 
				
			||||||
static wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &LP_WDT};
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
static wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &RTCCNTL};
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT
 | 
					#if !CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -320,11 +320,7 @@ void IRAM_ATTR call_start_cpu0(void)
 | 
				
			|||||||
            || rst_reas[1] == RESET_REASON_CORE_RTC_WDT || rst_reas[1] == RESET_REASON_CORE_MWDT0
 | 
					            || rst_reas[1] == RESET_REASON_CORE_RTC_WDT || rst_reas[1] == RESET_REASON_CORE_MWDT0
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
       ) {
 | 
					       ) {
 | 
				
			||||||
#if CONFIG_IDF_TARGET_ESP32C6 // TODO: IDF-5653
 | 
					        wdt_hal_context_t rtc_wdt_ctx = RWDT_HAL_CONTEXT_DEFAULT();
 | 
				
			||||||
        wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &LP_WDT};
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
        wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &RTCCNTL};
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        wdt_hal_write_protect_disable(&rtc_wdt_ctx);
 | 
					        wdt_hal_write_protect_disable(&rtc_wdt_ctx);
 | 
				
			||||||
        wdt_hal_disable(&rtc_wdt_ctx);
 | 
					        wdt_hal_disable(&rtc_wdt_ctx);
 | 
				
			||||||
        wdt_hal_write_protect_enable(&rtc_wdt_ctx);
 | 
					        wdt_hal_write_protect_enable(&rtc_wdt_ctx);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -57,7 +57,7 @@ static const char *TAG = "clk";
 | 
				
			|||||||
    // Therefore, for the time of frequency change, set a new lower timeout value (1.6 sec).
 | 
					    // Therefore, for the time of frequency change, set a new lower timeout value (1.6 sec).
 | 
				
			||||||
    // This prevents excessive delay before resetting in case the supply voltage is drawdown.
 | 
					    // This prevents excessive delay before resetting in case the supply voltage is drawdown.
 | 
				
			||||||
    // (If frequency is changed from 150kHz to 32kHz then WDT timeout will increased to 1.6sec * 150/32 = 7.5 sec).
 | 
					    // (If frequency is changed from 150kHz to 32kHz then WDT timeout will increased to 1.6sec * 150/32 = 7.5 sec).
 | 
				
			||||||
    wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &LP_WDT}; // TODO: IDF-5653
 | 
					    wdt_hal_context_t rtc_wdt_ctx = RWDT_HAL_CONTEXT_DEFAULT();
 | 
				
			||||||
    uint32_t stage_timeout_ticks = (uint32_t)(1600ULL * rtc_clk_slow_freq_get_hz() / 1000ULL);
 | 
					    uint32_t stage_timeout_ticks = (uint32_t)(1600ULL * rtc_clk_slow_freq_get_hz() / 1000ULL);
 | 
				
			||||||
    wdt_hal_write_protect_disable(&rtc_wdt_ctx);
 | 
					    wdt_hal_write_protect_disable(&rtc_wdt_ctx);
 | 
				
			||||||
    wdt_hal_feed(&rtc_wdt_ctx);
 | 
					    wdt_hal_feed(&rtc_wdt_ctx);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -468,11 +468,7 @@ static void start_cpu0_default(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Now that the application is about to start, disable boot watchdog
 | 
					    // Now that the application is about to start, disable boot watchdog
 | 
				
			||||||
#ifndef CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE
 | 
					#ifndef CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE
 | 
				
			||||||
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2// ESP32H2, ESP32C6-TODO: IDF-5653
 | 
					    wdt_hal_context_t rtc_wdt_ctx = RWDT_HAL_CONTEXT_DEFAULT();
 | 
				
			||||||
    wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &LP_WDT};
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    wdt_hal_context_t rtc_wdt_ctx = {.inst = WDT_RWDT, .rwdt_dev = &RTCCNTL};
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    wdt_hal_write_protect_disable(&rtc_wdt_ctx);
 | 
					    wdt_hal_write_protect_disable(&rtc_wdt_ctx);
 | 
				
			||||||
    wdt_hal_disable(&rtc_wdt_ctx);
 | 
					    wdt_hal_disable(&rtc_wdt_ctx);
 | 
				
			||||||
    wdt_hal_write_protect_enable(&rtc_wdt_ctx);
 | 
					    wdt_hal_write_protect_enable(&rtc_wdt_ctx);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,6 +37,9 @@ ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_800ns == RTC_WDT_RESET_LENGTH_800_NS, "Ad
 | 
				
			|||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RTC_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RTC_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RTC_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RTC_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef rtc_cntl_dev_t rwdt_dev_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RWDT_DEV_GET() &RTCCNTL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief Enable the RWDT
 | 
					 * @brief Enable the RWDT
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,6 +37,10 @@ ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_800ns == RTC_WDT_RESET_LENGTH_800_NS, "Ad
 | 
				
			|||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RTC_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RTC_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RTC_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RTC_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef rtc_cntl_dev_t rwdt_dev_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RWDT_DEV_GET() &RTCCNTL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief Enable the RWDT
 | 
					 * @brief Enable the RWDT
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,6 +39,10 @@ ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_800ns == RTC_WDT_RESET_LENGTH_800_NS, "Ad
 | 
				
			|||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RTC_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RTC_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RTC_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RTC_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef rtc_cntl_dev_t rwdt_dev_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RWDT_DEV_GET() &RTCCNTL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief Enable the RWDT
 | 
					 * @brief Enable the RWDT
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * SPDX-License-Identifier: Apache-2.0
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -14,6 +14,10 @@ extern "C" {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "hal/lpwdt_ll.h"
 | 
					#include "hal/lpwdt_ll.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef lp_wdt_dev_t rwdt_dev_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RWDT_DEV_GET() &LP_WDT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define rwdt_ll_enable(hw) \
 | 
					#define rwdt_ll_enable(hw) \
 | 
				
			||||||
        lpwdt_ll_enable(hw)
 | 
					        lpwdt_ll_enable(hw)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 * SPDX-License-Identifier: Apache-2.0
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -15,6 +15,10 @@ extern "C" {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "hal/lpwdt_ll.h"
 | 
					#include "hal/lpwdt_ll.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef lp_wdt_dev_t rwdt_dev_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RWDT_DEV_GET() &LP_WDT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define rwdt_ll_enable(hw) \
 | 
					#define rwdt_ll_enable(hw) \
 | 
				
			||||||
        lpwdt_ll_enable(hw)
 | 
					        lpwdt_ll_enable(hw)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,6 +36,10 @@ ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_800ns == RTC_WDT_RESET_LENGTH_800_NS, "Ad
 | 
				
			|||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RTC_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RTC_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RTC_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RTC_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef rtc_cntl_dev_t rwdt_dev_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RWDT_DEV_GET() &RTCCNTL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief Enable the RWDT
 | 
					 * @brief Enable the RWDT
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,6 +39,10 @@ ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_800ns == RTC_WDT_RESET_LENGTH_800_NS, "Ad
 | 
				
			|||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RTC_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RTC_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RTC_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RTC_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef rtc_cntl_dev_t rwdt_dev_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RWDT_DEV_GET() &RTCCNTL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief Enable the RWDT
 | 
					 * @brief Enable the RWDT
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -59,6 +59,10 @@ ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_800ns == RWDT_LL_RESET_LENGTH_800_NS, "Ad
 | 
				
			|||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RWDT_LL_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_1_6us == RWDT_LL_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RWDT_LL_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
					ESP_STATIC_ASSERT(WDT_RESET_SIG_LENGTH_3_2us == RWDT_LL_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef rtc_cntl_dev_t rwdt_dev_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RWDT_DEV_GET() &RTCCNTL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief Enable the RWDT
 | 
					 * @brief Enable the RWDT
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,14 +29,15 @@ typedef struct {
 | 
				
			|||||||
    wdt_inst_t inst;                /**< Which WDT instance this HAL context is using (i.e. MWDT0, MWDT1, RWDT)*/
 | 
					    wdt_inst_t inst;                /**< Which WDT instance this HAL context is using (i.e. MWDT0, MWDT1, RWDT)*/
 | 
				
			||||||
    union {
 | 
					    union {
 | 
				
			||||||
        timg_dev_t *mwdt_dev;       /**< Starting address of the MWDT */
 | 
					        timg_dev_t *mwdt_dev;       /**< Starting address of the MWDT */
 | 
				
			||||||
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 // TODO: IDF-5653
 | 
					        rwdt_dev_t *rwdt_dev;       /**< Starting address of the RWDT*/
 | 
				
			||||||
        lp_wdt_dev_t *rwdt_dev;     /**< Starting address of the RWDT*/
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
        rtc_cntl_dev_t *rwdt_dev;   /**< Starting address of the RWDT*/
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
} wdt_hal_context_t;
 | 
					} wdt_hal_context_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define RWDT_HAL_CONTEXT_DEFAULT() { \
 | 
				
			||||||
 | 
					    .inst = WDT_RWDT,                \
 | 
				
			||||||
 | 
					    .rwdt_dev = RWDT_DEV_GET()       \
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ---------------------------- Init and Config ----------------------------- */
 | 
					/* ---------------------------- Init and Config ----------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,11 +24,7 @@ void wdt_hal_init(wdt_hal_context_t *hal, wdt_inst_t wdt_inst, uint32_t prescale
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2      // ESP32C6-TODO, ESP32H2-TODO: IDF-5653
 | 
					        hal->rwdt_dev = RWDT_DEV_GET();
 | 
				
			||||||
        hal->rwdt_dev = &LP_WDT;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
        hal->rwdt_dev = &RTCCNTL;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    hal->inst = wdt_inst;
 | 
					    hal->inst = wdt_inst;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user