summaryrefslogtreecommitdiff
path: root/bsp/yichip/yc3121-pos/Libraries/sdk/yc_wdt.h
blob: e9594d035e5d2c1eb81b7a6121c2eb18464abacb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
  ******************************************************************************
  * @file    yc_wdt.h
  * @author  Yichip
  * @version V1.0
  * @date    7-Dec-2019
  * @brief   watchdog encapsulation.
  *
  ******************************************************************************
  */

#ifndef __YC_WDT_H__
#define __YC_WDT_H__

#include "yc3121.h"

/**
  * @brief  timer number Structure definition
  */
typedef enum
{
    WDT_CPUReset = 0,
    WDT_Interrupt,
} WDT_ModeTypeDef;

#define ISWDTRELOAD(load) (load>0&&load<=0x1f)

/**
 * @brief  Set reload counter
 * @param  Reload: Reload counter equal to 2^reload.
 * @retval none
 */
void WDT_SetReload(uint32_t Reload);

/**
 * @brief Set WDT  mode
 * @param WDT_Mode : Select the following values :
 *        WDT_CPUReset
 *        WDT_Interrupt.
 * @retval none
 * @description If Select WDT_CPUReset Mode,the bit for WDT RESET will be set;if
 *              Select WDT_Interrupt the bit for WDT RESET will
 */
void WDT_ModeConfig(WDT_ModeTypeDef WDT_Mode);

/**
 * @brief  Get interrupt Status
 * @param  none
 * @retval SET:interrupt ocuured.
 */
ITStatus WDT_GetITStatus(void);

/**
 * @brief  Clear interrupt
 * @param  none
 * @retval none
 */
void WDT_ClearITPendingBit(void);

/**
 * @brief  Enable WDT
 * @param  none
 * @retval none
 */
void WDT_Enable(void);

/**
 * @brief  Feed the watchdog function
 * @param  none
 * @retval none
 */
void WDT_ReloadCounter(void);

#endif /*__YC_WDT_H__*/