⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wdt.c

📁 嵌入式系统
💻 C
字号:
/*-----------------------------------------------------------------------------
@@
@@ (Summary): LH7953x series Watchdog Timer (WDT) Device Driver Source File
@@
@@ (Comment): Source codes of routines for the WDT
@@
@@ (Author) : 
@@
@@ (RCS ID)     :
@@
-----------------------------------------------------------------------------*/

#define APD_WDT_C

/*+include files**************************************************************/
/*                                                                           */
/*                                                                           */
/***************************************************************************-*/
#include "wdt.h"

/******************************************************************************
@@
@@ [Name]       : apd_WDTInit
@@
@@ [Summary]    : This function initialise the watchdog timer.
@@
@@ [Argument]   : None
@@
@@ [Return]     : None
@@
@@ [Desc]       : Initialise the WDT control register
@@
@@ [Note]       :
@@
@@ [END]
******************************************************************************/

APD_VOID apd_WDTInit(APD_VOID)
{
    *APD_WDTCTLR = APD_WDT_TOP| APD_WDT_RSP;

    apd_WDTReset();
}

/******************************************************************************
@@
@@ [Name]       : apd_WDTEnable
@@
@@ [Summary]    : This function enables the watchdog timer.
@@
@@ [Argument]   : None
@@
@@ [Return]     : None
@@
@@ [Desc]       : Enables the watchdog timer.
@@
@@ [Note]       : None
@@
@@ [History]    : 25/10/00  Tan WK      Version 1.0
@@                18/01/01  Tan WK      Version 1.1 Define APD_WDT_EN
@@                                      as a constant variable.
@@                28/05/01  Tan WK      Version 2.0 No change
@@                29/08/01  Teo LL      Version 3.0 No change for LH79533
@@
@@ [END]
******************************************************************************/

APD_VOID apd_WDTEnable (APD_VOID)
{
    *APD_WDTCTLR |=APD_WDT_EN;
}

/******************************************************************************
@@
@@ [Name]       : apd_WDTDisable
@@
@@ [Summary]    : This function disables the watchdog timer.
@@
@@ [Argument]   : None
@@
@@ [Return]     : None
@@
@@ [Desc]       : Disables the watchdog timer.
@@
@@ [Note]       : If the "FRZ" bit is set in watchdog control register, the
@@                watchdog cannot be disabled.
@@
@@ [History]    : 25/10/00  Tan WK      Version 1.0
@@                18/01/01  Tan WK      Version 1.1 Define APD_WDT_EN
@@                                      as a constant
@@                28/05/01  Tan WK      Version 2.0 No change
@@                29/08/01  Teo LL      Version 3.0 no change for LH79533
@@
@@ [END]
******************************************************************************/

APD_VOID apd_WDTDisable(APD_VOID)
{
    *APD_WDTCTLR &= ~APD_WDT_EN;
}

/******************************************************************************
@@
@@ [Name]       : apd_WDTFreeze
@@
@@ [Summary]    : This function freezes the watchdog timer.
@@
@@ [Argument]   : None
@@
@@ [Return]     : None
@@
@@ [Desc]       : Freeze the watchdog timer.
@@
@@ [Note]       : Once the watchdog timer is freezed, the watchdog timer cannot be
@@                enabled or disabled. The "FRZ" bit in watchdog timer control
@@                register when set can only be cleared by a system reset.
@@
@@ [History]    : 29/03/01  KW Kam      Version 1.3 New function
@@                28/05/01  Tan WK      Version 2.0 No change
@@                29/08/01  Teo LL      Version 3.0 no change for LH79533
@@
@@ [END]
******************************************************************************/

APD_VOID apd_WDTFreeze (APD_VOID)
{
    *APD_WDTCTLR |=APD_WDT_FRZ_EN;
}

/******************************************************************************
@@
@@ [Name]       : apd_WDTReset
@@
@@ [Summary]    : This function resets the watchdog timer.
@@
@@ [Argument]   : None
@@
@@ [Return]     : None
@@
@@ [Desc]       : Resets the watchdog timer.
@@
@@ [Note]       :
@@
@@ [History]    : 25/10/00  Tan WK      Version 1.0
@@                18/01/01  Tan WK      Version 1.1
@@                26/02/01  Tan WK      Version 1.2 Define APD_WDT_Reset
@@                                      as a constant
@@                28/05/01  Tan WK      Version 2.0 No change
@@                29/08/01  Teo LL      Version 3.0 no change for LH79533
@@
@@ [END]
******************************************************************************/

APD_VOID apd_WDTReset(APD_VOID)
{
    *APD_WDTCNTR = APD_WDT_RESET;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -