第一次提交

This commit is contained in:
2025-07-05 20:11:15 +08:00
commit 89b0708dfb
56 changed files with 10876 additions and 0 deletions

48
interface_wdt.c Normal file
View File

@@ -0,0 +1,48 @@
#include <sdrv_btm.h>
#include <regs_base.h>
#include <irq_num.h>
#include <debug.h>
#include <sdrv_rstgen.h>
#include "interface_config.h"
sdrv_wdt_t *wdt_type = (sdrv_wdt_t *)(uintptr_t)APB_WDT1_BASE;
static bool internal_reset_switch = true;
static bool external_reset_switch = false;
//<2F><><EFBFBD>Ź<EFBFBD><C5B9><EFBFBD>ʼ<EFBFBD><CABC>
void wdt_init(uint32_t timeoutms)
{
static sdrv_wdt_config_t wdt_cfg;
int ret = 0;
//--------------------------------------------------
sdrv_wdt_get_default_config(&wdt_cfg);
if (internal_reset_switch) {
wdt_cfg.int_rst.reset_en = true;
sdrv_rstgen_wdt_reset_enable(RESET_WDT1, true);
}
if (external_reset_switch) {
/* config GPIO_H12 as WDT1_RST_N function */
wdt_cfg.ext_rst.reset_en = true;
wdt_cfg.ext_rst.reset_mode = 0; /* low level active */
}
ret = sdrv_wdt_init(wdt_type, &wdt_cfg);
ASSERT(ret == 0);
// irq_attach(wdt_irq, wdt_irq_handler, NULL);
// irq_enable(wdt_irq);
sdrv_wdt_set_timeout(wdt_type, timeoutms);
ret = sdrv_wdt_enable(wdt_type);
}