/*
*******************************************************************************
COPYRIGHT 2002 STMicroelectronics
Source File Name : WDG.h
Group            : IPSW, CMG - IPDF
Author           : MCD Application Team
Date First Issued: 5/3/2002
********************************Documentation**********************************
General Purpose - This file conatains the declaration of functions written in
                  WDG.c 
********************************RevisionHistory********************************
_______________________________________________________________________________
Date : 5/3/2002                   Release: 1.0 
Date : 23/9/2003                Release: 2.0
Date : 28/04/04                 MISRA changes
******************************************************************************/

#ifndef WDG_H
#define WDG_H

#include "ST7lib_Config.h"
#include "wdg_hr.h"

/* Description of all the functions defined in this module. */

/*Loads the counter value & activates WDG*/
#define WDG_Refresh(Counter_Data )    (WDGCR = (unsigned char)(Counter_Data));\
(WDGCR |= WDG_ENABLE);  

/*Reads the WDG counter register and returns the value to the user*/
#define WDG_ReadCounter() WDGCR

/*Computes & loads the counter value.Activates the WDG*/                                                
/* RBuilder will override this function by adding 
                                              #define REM_WGD_COMPUTETIMEOUT */
#ifndef REM_WGD_COMPUTETIMEOUT
void WDG_ComputeTimeout(unsigned long WDG_Timeout); 
#endif /* REM_WGD_COMPUTETIMEOUT */

/* Macros for Window Watchdog */
#ifdef WDG_72F561      

/* Reads the Window register and returns the value to the user */
#define WDG_ReadWindow() WWDGR

/* Loads the value in the Window register */

#define WDG_WriteWindow(Window_Value) (WWDGR = ((Window_Value) & (0x7F)));       

#endif

#endif

/**** (c) 2002   STMicroelectronics *************************** END OF FILE **/
