/*
  SFBWatchdog.h - 'Platform independent' watchdog reset declarations
  Copyright (C) 2009 The Regents of the University of New Mexico.  All rights reserved.

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
  USA

  $Id$
*/

/**
  \file SFBWatchdog.h 'Platform independent' watchdog timer routines.
  \author David H. Ackley.  
  \date (C) 2009 All rights reserved.
  \lgpl
 */
/*
 * WATCH OUT!  These declarations may be defined either in
 * board/SFBWatchdog.cpp or host/SFBWatchdog.cpp, depending on what we
 * are compiling!
 *
 */

#ifndef SFBWATCHDOG_H
#define SFBWATCHDOG_H

#include "SFBTypes.h"     /* For u32 */

extern bool watchdogActive() ;

extern void watchdogSetInterval(u32 feedIntervalMs) ;

extern u32 watchdogGetInterval() ;

extern bool watchdogStart(u32 feedIntervalMs) ;

extern bool watchdogFeed() ;

extern bool watchdogGetTimeoutFlag() ;

extern void watchdogClearTimeoutFlag() ;

/**
   Force a watchdog timeout to kill the system.  This method first
   starts the watchdog if it's not already going.  Then it resets the
   watchdog timeout to a short time special code (which
   #watchdogItWasSuicide looks for), and then blocks until the
   watchdog timeout fires.
 */
extern void watchdogSuicide() __attribute__ ((noreturn)) ; 

extern bool watchdogItWasSuicide() ;  ///< True if #watchdogGetTimeoutFlag() is only true because of a deliberate crash

#endif /* SFBWATCHDOG_H */
