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

📄 wd.cxx

📁 CMX990 demonstration board (DE9901)
💻 CXX
字号:
/****h* DE9901/WD
* FILE NAME
*  wd.cxx
* COPYRIGHT
*  (c) 2004-2005 Mobitex Technology AB - All rights reserved
* 
*  Redistribution and use in source and binary forms, with or without modification,
*  are permitted provided that the following conditions are met:
*  * 1. Redistributions of source code must retain the above copyright notice,
*       this list of conditions and the following disclaimer. 
*  * 2. Redistributions in binary form must reproduce the above copyright notice,
*       this list of conditions and the following disclaimer in the documentation
*       and/or other materials provided with the distribution.
*  * 3. The name Mobitex Technology AB may not be used to endorse or promote products
*       derived from this software without specific prior written permission.
*
*  THIS SOFTWARE IS PROVIDED BY MOBITEX TECHNOLOGY AB "AS IS" AND ANY EXPRESS OR
*  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
*  SHALL MOBITEX TECHNOLOGY AB BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
*  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
*  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
*  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
*  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
*  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* AUTHOR
*  MPN/Kjell Westerberg
* HISTORY
*  Changes in the file are recorded in this list.
*   Ver:  Date:       Responsible:         Comments:
*   R1A01 2005-01-13  Kjell Westerberg     Approved.
* DESCRIPTION
*  Handles the Atmel watchdog.
*  This is a collection of functions to call the eCos
*  watchdog handler from C.
***/

#include <cyg/kernel/kapi.h>
#include <cyg/io/watchdog.hxx>
#include "wd.h"

/****f* WD/WD_Disable
* DESCRIPTION
* Disables the watchdog.
***/
__externC void WD_Disable(void) {
  Cyg_Watchdog::watchdog.stop();
}


/****f* WD/WD_Enable
* DESCRIPTION
* Enables the watchdog. After doing that, it is
* necessary to call WD_Kick within 0.5 s to avoid a CPU reset.
***/
__externC void WD_Enable(void) {
  Cyg_Watchdog::watchdog.start();
}


/****f* WD/WD_Kick
* DESCRIPTION
* Resets the watchdog timeout counter, must be called within
* 0.5 s after a call to WD_Enable or itself otherwise the
* watchdog will bark.
***/
__externC void WD_Kick(void) {
  Cyg_Watchdog::watchdog.reset(); 
}


/****f* WD/WD_ForceSystemReset
* DESCRIPTION
* Forces a CPU reset. This is done by disabling all
* interrupts, enabling the watchdog and then just wait
* for the watchdog timeout counter to expire.
***/
__externC void WD_ForceSystemReset(void) {

  Cyg_Watchdog::watchdog.start();
  cyg_interrupt_disable();

  /* Wait for watchdog reset. */
  while(1);
}

⌨️ 快捷键说明

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