124 lines
3.4 KiB
C
Raw Normal View History

2025-04-26 16:03:23 +08:00
/** ##########################################################################
** Filename :
** Project :
** Module :
** Processor :
** Version : 1.0
** Compiler :
** Date/Time :
** Abstract :
** Contents :
** Note :
**
** (c) Copyright dmdz Co.,Ltd
** --------------------------------------------------------------------------
** R E V I S I O N H I S T O R Y
** --------------------------------------------------------------------------
** Date Ver Author Description
** -20230602- --V1.0-- --mingyea--- ----
** #########################################################################*/
#ifndef WDOG_CFG_H__
#define WDOG_CFG_H__
/*---------------------------------------------------------------------------
- I N C L U D E F I L E S
----------------------------------------------------------------------------*/
#include "cpu.h"
/*---------------------------------------------------------------------------
- D E F I N E S / M A C R O S
----------------------------------------------------------------------------*/
//#define WDT_ENABLE_SELF_CHECK 1 /*开启自检*/
#define WDT_SELF_CHECK_DATA 0x5e715896
#define WDT_TIME_UNIT 1 // 1MS任务里跑
#define WDT_OPERATION_NORMAL 0u
#define WDT_OPERATION_WINDOWS 1u
#define WDT_OPERATION_DISABLE 2u
#define WDT_OPERATION_MODE WDT_OPERATION_NORMAL
#if 0
#define WDT_PRE_256_EN 1 // 1开启256分频 0不开启 --切記不能用枚舉
#if 0 //在中断时0.5ms
#define WDT_CR_VALUE 2u
#define WDT_WINDOWS_TIMEOUT 27u //104
#else
#define WDT_CR_VALUE (1u/WDT_TIME_UNIT)
#define WDT_WINDOWS_TIMEOUT (14u/WDT_TIME_UNIT)
#endif
#if WDT_PRE_256_EN == 1
#define WDT_PRE_256_VALUE ENABLE
#define WDG_CLK_S(n) (APB_BUS_FREQ/256u * n -1u)
#define WDG_CLK_MS(n) ( ((APB_BUS_FREQ/1000u) * n)/256u -1u)
#else
#define WDT_PRE_256_VALUE DISABLE
#define WDG_CLK_S(n) (APB_BUS_FREQ * n -1u)
#define WDG_CLK_MS(n) ( (APB_BUS_FREQ/1000u) * n -1u)
#endif
#endif
//#define WDOGx_IRQn WDOG_EWM_IRQn
/*! @brief Device instance number */
#define INST_WATCHDOG1 0U
#if WDT_OPERATION_MODE == WDT_OPERATION_NORMAL
/*! watchdog1 configuration structures */
extern const FL_IWDT_InitTypeDef g_IWDT_InitStruct ;
#elif WDT_OPERATION_MODE == WDT_OPERATION_WINDOWS
/*! watchdog1 configuration structures */
extern const FL_WWDT_InitTypeDef g_WWDT_InitStruct ;
#endif
/*#define WWDG_INTERRUPT_ENABLE 1 */ /*使能中斷*/
#define WDOG_DEBUG_EN //测试宏
/*---------------------------------------------------------------------------
- T Y P E D E F I N I T I O N S
----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
- G L O B A L V A R I A B L E S
- only configuration table allowed here,variables are not allowed!
----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
- C O N S T A N T S
----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
- F U N C T I O N P R O T O T Y P E
----------------------------------------------------------------------------*/
void wdog_irq_task(void);
#endif /* __WDOG_APP_CFG_H__ */