📄 watchdog.c
字号:
/****************************************************************************/
/* TEXAS INSTRUMENTS PROPRIETARY INFORMATION */
/* */
/* (c) Copyright, Texas Instruments Incorporated, 2006. */
/* All Rights Reserved. */
/* */
/* Property of Texas Instruments Incorporated. Restricted Rights - */
/* Use, duplication, or disclosure is subject to restrictions set */
/* forth in TI's program license agreement and associated documentation. */
/****************************************************************************/
/****************************************************************************/
/* watchdog.c */
/* */
/* Watchdog monitor. */
/****************************************************************************/
#include "common.h"
#include "gpio.h"
#include "tmr.h"
#include "global.h"
#include "watchdog.h"
#include "dbmessage.h"
/****************************************************************************/
/*Local data. */
/****************************************************************************/
static BOOL isEnabled; /* watchdog-is-enabled flag */
/****************************************************************************/
/* Watchdog enable/disable. */
/****************************************************************************/
BOOL watchdog_enable( BOOL enable )
{
if( TRUE == ( isEnabled = ( enable && gpConfiguration -> System.EnableWatchdog )))
return PASS == TMR_SetWatchdog( gpConfiguration -> System.WatchdogInterval );
TMR_SetWatchdog( 0 ); /* disable watchdog */
return TRUE;
}
/****************************************************************************/
/* Module reset function. */
/* */
/* id: reset type. */
/* */
/* The API does not allow the watchdog timer to be allocated but disabled - */
/* Disabling the timer (setting its period to zero) frees the timer. Thus, */
/* the watchdog timer cannot be allocated here, and the application must */
/* ensure that the watchdog timer is not allocated as an interval timer. */
/****************************************************************************/
EXEC_CC_ENUM watchdog_init( void )
{
isEnabled = FALSE; /* indicates watchdog is off */
return EXEC_CC_PASS;
}
/****************************************************************************/
/* Periodic polling callback function. */
/****************************************************************************/
int16 watchdog_poll( uint16 tick )
{
if( isEnabled )
TMR_ServiceWatchdog(); /* ping the watchdog */
return 100 / RTOS_MS_PER_TICK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -