mirror of
https://github.com/apache/nuttx.git
synced 2025-12-16 01:34:58 +08:00
risc-v/esp32-c3: Disable wdt in the start function.
This commit is contained in:
@@ -45,7 +45,7 @@ endif
|
||||
|
||||
# Specify our C code within this directory to be included
|
||||
|
||||
CHIP_CSRCS = esp32c3_allocateheap.c esp32c3_start.c esp32c3_idle.c
|
||||
CHIP_CSRCS = esp32c3_allocateheap.c esp32c3_start.c esp32c3_wdt.c esp32c3_idle.c
|
||||
CHIP_CSRCS += esp32c3_irq.c
|
||||
CHIP_CSRCS += esp32c3_clockconfig.c esp32c3_gpio.c
|
||||
CHIP_CSRCS += esp32c3_lowputc.c
|
||||
@@ -85,12 +85,9 @@ ifeq ($(CONFIG_ESP32C3_PARTITION),y)
|
||||
CHIP_CSRCS += esp32c3_partition.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32C3_WDT),y)
|
||||
CHIP_CSRCS += esp32c3_wdt.c
|
||||
ifeq ($(CONFIG_WATCHDOG),y)
|
||||
CHIP_CSRCS += esp32c3_wdt_lowerhalf.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ESP32C3_TIMER),y)
|
||||
CHIP_CSRCS += esp32c3_tim.c
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "esp32c3_irq.h"
|
||||
#include "esp32c3_lowputc.h"
|
||||
#include "esp32c3_start.h"
|
||||
#include "esp32c3_wdt.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@@ -94,6 +95,10 @@ void __esp32c3_start(void)
|
||||
|
||||
showprogress('B');
|
||||
|
||||
/* Disable any wdt enabled by bootloader */
|
||||
|
||||
esp32c3_wdt_early_deinit();
|
||||
|
||||
/* Initialize onboard resources */
|
||||
|
||||
esp32c3_board_initialize();
|
||||
|
||||
@@ -876,6 +876,24 @@ struct esp32c3_wdt_dev_s *esp32c3_wdt_init(enum esp32c3_wdt_inst_e wdt_id)
|
||||
return (struct esp32c3_wdt_dev_s *)wdt;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32c3_wdt_early_deinit
|
||||
*
|
||||
* Description:
|
||||
* Disable the WDT(s) that was/were enabled by the bootloader.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32c3_wdt_early_deinit(void)
|
||||
{
|
||||
uint32_t regval;
|
||||
putreg32(RTC_CNTL_WDT_WKEY_VALUE, RTC_CNTL_WDTWPROTECT_REG);
|
||||
regval = getreg32(RTC_CNTL_WDTCONFIG0_REG);
|
||||
regval &= ~RTC_CNTL_WDT_EN;
|
||||
putreg32(regval, RTC_CNTL_WDTCONFIG0_REG);
|
||||
putreg32(0, RTC_CNTL_WDTWPROTECT_REG);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32c3_wdt_deinit
|
||||
*
|
||||
|
||||
@@ -141,6 +141,7 @@ struct esp32c3_wdt_ops_s
|
||||
****************************************************************************/
|
||||
|
||||
struct esp32c3_wdt_dev_s *esp32c3_wdt_init(enum esp32c3_wdt_inst_e wdt_id);
|
||||
void esp32c3_wdt_early_deinit(void);
|
||||
void esp32c3_wdt_deinit(struct esp32c3_wdt_dev_s *dev);
|
||||
bool esp32c3_wdt_is_running(struct esp32c3_wdt_dev_s *dev);
|
||||
|
||||
|
||||
@@ -49,13 +49,13 @@
|
||||
* write-enable the wdt registers
|
||||
*/
|
||||
|
||||
#define RTC_CNTL_WDT_WKEY_VALUE 0x50D83AA1
|
||||
#define RTC_CNTL_WDT_WKEY_VALUE 0x50d83aa1
|
||||
|
||||
/* The value that needs to be written to RTC_CNTL_SWD_WPROTECT_REG
|
||||
* to write-enable the wdt registers
|
||||
*/
|
||||
|
||||
#define RTC_CNTL_SWD_WKEY_VALUE 0x8F1D312A
|
||||
#define RTC_CNTL_SWD_WKEY_VALUE 0x8f1d312a
|
||||
|
||||
/* Possible values for RTC_CNTL_WDT_CPU_RESET_LENGTH
|
||||
* and RTC_CNTL_WDT_SYS_RESET_LENGTH
|
||||
|
||||
Reference in New Issue
Block a user