1 /**
2     *****************************************************************************
3     * @file     cmem7_wdg.h
4     *
5     * @brief    CMEM7 watchdog header file
6     *
7     *
8     * @version  V1.0
9     * @date     3. September 2013
10     *
11     * @note
12     *
13     *****************************************************************************
14     * @attention
15     *
16     * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
17     * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
18     * TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
19     * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
20     * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
21     * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
22     *
23     * <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
24     *****************************************************************************
25     */
26 
27 #ifndef __CMEM7_WDG_H
28 #define __CMEM7_WDG_H
29 
30 #ifdef __cplusplus
31  extern "C" {
32 #endif
33 
34 #include "cmem7.h"
35 #include "cmem7_conf.h"
36 
37 /** @defgroup WDG_INT
38   * @{
39   */
40 #define WDG_INT_QUARTER                 0
41 #define WDG_INT_HALF                    1
42 #define IS_WDG_INT(INT)                 (((INT) == WDG_INT_QUARTER) || \
43                                          ((INT) == WDG_INT_HALF))
44 /**
45   * @}
46   */
47 
48 /** @defgroup WDG_TRIGGER_MODE
49   * @{
50   */
51 #define WDG_TRIGGER_MODE_EDGE           0
52 #define WDG_TRIGGER_MODE_LEVEL          1
53 #define IS_WDG_TRIGGER_MODE(TRI)        (((TRI) == WDG_TRIGGER_MODE_EDGE) || \
54                                          ((TRI) == WDG_TRIGGER_MODE_LEVEL))
55 /**
56   * @}
57   */
58 
59 /**
60   * @brief  Deinitializes the Watchdog peripheral registers to their default reset values.
61     * @param[in] None
62   * @retval None
63     */
64 void WDG_DeInit(void);
65 
66 /**
67   * @brief  Watchdog initialization
68   * @note   This function should be called at first before any other interfaces.
69     * @param[in] trigger Watchdog interrupt trigger mode, which is a value of @ref WDG_TRIGGER_MODE
70     * @param[in] ResetMillSecond MillSeconds lasts before global reset
71   * @retval None
72     */
73 void WDG_Init(uint8_t trigger, uint16_t ResetMillSecond);
74 
75 /**
76   * @brief  Enable or disable watchdog interrupt.
77     * @param[in] Int interrupt mask bits, which is a value of @ref WDG_INT
78     * @param[in] Enable The bit indicates if the specific interrupt are enable or not
79   * @retval None
80     */
81 void WDG_ITConfig(uint8_t Int, BOOL Enable);
82 
83 /**
84   * @brief  Check the specific interrupt are set or not
85     * @param    None
86   * @retval BOOL The bit indicates if the specific interrupt are set or not
87     */
88 BOOL WDG_GetITStatus(void);
89 
90 /**
91   * @brief  Clear the specific interrupt
92     * @param    None
93   * @retval None
94     */
95 void WDG_ClearITPendingBit(void);
96 
97 /**
98   * @brief  Enable or disable watchdog.
99     * @param[in] Enable The bit indicates if watchdog is enable or not
100   * @retval None
101     */
102 void WDG_Cmd(BOOL Enable);
103 
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* __CMEM7_WDG_H */
110 
111