tao_z
2022-05-25 1044ba0d2286698d0da28112bffc0f114bef2134
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
 /**
  ******************************************************************************
  * @file     xl_uart.h
  * @author   software group
  * @brief    This file contains all the functions prototypes for the WDOG 
  *           firmware library.
  ******************************************************************************
  * @attention
    *
  * 2019 by Chipways Communications,Inc. All Rights Reserved.
  * This software is supplied under the terms of a license
  * agreement or non-disclosure agreement with Chipways.
  * Passing on and copying of this document,and communication
  * of its contents is not permitted without prior written
  * authorization.
  *
  * <h2><center>&copy; COPYRIGHT 2019 Chipways</center></h2>
  ******************************************************************************
  */ 
  
#ifndef __XL_WDOG_H_
#define __XL_WDOG_H_
 
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ---------------------------------------------------------------*/
#include "xl6600.h"
    
/* Register define ------------------------------------------------------------*/
 
/* CS1 Bit Fields */
#define WDOG_CS1_EN_MASK                        0x00000001u
#define WDOG_CS1_EN_SHIFT                       0
#define WDOG_CS1_RMOD_MASK                      0x00000002u
#define WDOG_CS1_RMOD_SHIFT                     1
#define WDOG_CS1_RPL_MASK                       0x0000001Cu
#define WDOG_CS1_RPL_SHIFT                      2
    
/* TORR Bit Fields */
#define WDOG_TORR_TOP_MASK                      0x0000001Fu
#define WDOG_TORR_TOP_SHIFT                     0
    
/* CCVR Bit Fields */                            
#define WDOG_CCVR_CCV_MASK                      0xFFFFFFFFu
#define WDOG_CCVR_CCV_SHIFT                     0
 
/* CRR Bit Fields */
#define WDOG_CRR_CR_MASK                               0x000000FFu
#define WDOG_CRR_CR_SHIFT                                0
 
/* STAT Bit Fields */
#define WDOG_STAT_INT_MASK                           0x00000001u
#define WDOG_STAT_INT_SHIFT                     0
 
/* EOI Bit Fields */
#define WDOG_EOI_IC_MASK                               0x00000001u
#define WDOG_EOI_IC_SHIFT                       0
 
/* CS2 Bit Fields */
#define WDOG_CS2_CLK_MASK                       0x00000003u
#define WDOG_CS2_CLK_SHIFT                      0
#define WDOG_CS2_PRES_MASK                      0x00000008u
#define WDOG_CS2_PRES_SHIFT                     3u
#define WDOG_CS2_STOP_MASK                      0x00000010u
#define WDOG_CS2_STOP_SHIFT                     4u
#define WDOG_CS2_WAIT_MASK                      0x00000020u
#define WDOG_CS2_WAIT_SHIFT                     5u
#define WDOG_CS2_DEBUG_MASK                     0x00000040u
#define WDOG_CS2_DEBUG_SHIFT                    6u
 
/** ICS - Register Layout Typedef */
typedef struct {
  __IO uint32_t CS1;                             /*!< Watchdog¿ØÖƼĴæÆ÷, offset: 0x00 */
  __IO uint32_t TORR;                            /*!< Watchdog¶¨Ê±Òç³ö·¶Î§¼Ä´æÆ÷, offset: 0x04 */
  __I  uint32_t CCVR;                            /*!< Watchdog¼ÆÊýÖµ¼Ä´æÆ÷, offset: 0x08 */
  __O  uint32_t CRR;                             /*!< Watchdog¼ÆÊýÖØÆô¼Ä´æÆ÷, offset: 0x0c */
  __I  uint32_t STAT;                            /*!< WatchdogÖжÏ״̬¼Ä´æÆ÷, offset: 0x10 */
  __I  uint32_t EOI;                             /*!< WatchdogÖжÏÇåÁã¼Ä´æÆ÷, offset: 0x14 */
         uint32_t RESERVED_0[58];
  __IO uint32_t CS2;                             /*!< WatchdogʱÖӺ͵÷ÊÔģʽ¼Ä´æÆ÷, offset: 0x100 */    
} WDOG_Type;
extern WDOG_Type*        WDOG;
 
 
/** @addtogroup XL6600_StdPeriph_Driver
  * @{
  */
 
/** @addtogroup WDOG
  * @{
  */
 
/* Exported types ------------------------------------------------------------*/ 
 
/** 
  * @brief WDOG³õʼ»¯½á¹¹Ì嶨Òå
  */
typedef struct 
{
    uint8_t                WDOG_ClkSource;          /*!< WDOG Ê±ÖÓÔ´Ñ¡Ôñ */
    uint8_t                WDOG_PulseLength;        /*!< ¸´Î»Âö³å³¤¶È */
    uint8_t                WDOG_ResponseMode;       /*!< Ó¦´ðģʽ */
    FunctionalState        WDOG_PRESEn;             /*!< 256Ô¤·ÖƵÆ÷ʹÄÜ */
    FunctionalState        WDOG_STOPEn;             /*!< StopģʽÏÂʹÄÜ */
    FunctionalState        WDOG_WAITEn;             /*!< WaitģʽÏÂʹÄÜ */
    FunctionalState        WDOG_DEBUGEn;               /*!< DebugģʽÏÂʹÄÜ */                
}WDOG_InitTypeDef, *WDOG_InitConfigPtr;
 
 
/* Exported constants --------------------------------------------------------*/
/** @defgroup WDOG_Exported_Constants WDOGÄ£¿éʹÓòÎÊý¶¨Òå
  * @{
  */
 
/** @defgroup WDOG_ClocksSource_Select WDOGʱÖÓÔ´Ñ¡Ôñ
  * @{
  */
#define WDOG_Bus_Clock                                           ((uint8_t)0x0)                /*!< APBCLK */
#define WDOG_LPO_Clock                                           ((uint8_t)0x1)                /*!< LPOCLK */
#define WDOG_Internal_Clock                                     ((uint8_t)0x2)                /*!< ICSIRCLK */
#define WDOG_External_Clock                                     ((uint8_t)0x3)                /*!< OSCCLK */
/**
    * @}
    */
 
/** @defgroup WDOG_ResetPulse_Seclect WDOG¸´Î»Ê±ÖÓÂö³å¶¨Òå
  * @{
  */
#define WDOG_PclkCycles_2                               ((uint8_t)0x0)      /*!< 2ʱÖÓÔ´ÖÜÆÚ */
#define WDOG_PclkCycles_4                                 ((uint8_t)0x1)      /*!< 4ʱÖÓÔ´ÖÜÆÚ */
#define WDOG_PclkCycles_8                                 ((uint8_t)0x2)      /*!< 8ʱÖÓÔ´ÖÜÆÚ */      
#define WDOG_PclkCycles_16                               ((uint8_t)0x3)      /*!< 16ʱÖÓÔ´ÖÜÆÚ */
#define WDOG_PclkCycles_32                               ((uint8_t)0x4)      /*!< 32ʱÖÓÔ´ÖÜÆÚ */
#define WDOG_PclkCycles_64                               ((uint8_t)0x5)      /*!< 64ʱÖÓÔ´ÖÜÆÚ */
#define WDOG_PclkCycles_128                               ((uint8_t)0x6)      /*!< 128ʱÖÓÔ´ÖÜÆÚ */
#define WDOG_PclkCycles_256                               ((uint8_t)0x7)      /*!< 256ʱÖÓÔ´ÖÜÆÚ */
/**
    * @}
    */
    
/** @defgroup WDOG_Response_Mode WDOGÏàӦģʽ¶¨Òå
  * @{
  */    
#define WDOG_ResponseMode_Reset                  ((uint8_t)0x0)      /*!< Éú³ÉÒ»¸öϵͳ¸´Î» */
#define WDOG_ResponseMode_Interrupt              ((uint8_t)0x1)      /*!< Ê×ÏÈÉú³ÉÒ»¸öÖжϣ¬Èç¹ûÔÚµÚ¶þ¸ö¶¨Ê±Òç³ö·¢ÉúµÄʱ¼äÄÚδÇåÁã´ËÖжϣ¬Ôò»áÉú³ÉÒ»¸öϵͳ¸´Î» */
/**
    * @}
    */ 
 
/**
  * @}
  */
    
 
/* Exported macro ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/ 
void WDOG_DeInit(WDOG_Type *WDOGx);
void WDOG_Init(WDOG_Type *WDOGx, const WDOG_InitTypeDef *WDOG_InitStruct);
void WDOG_EnableCmd(WDOG_Type *WDOGx,FunctionalState State);
void WDOG_SetTimeoutPeriod(WDOG_Type *WDOGx,uint8_t TimeoutIndex);
uint32_t WDOG_GetCurrentVal(const WDOG_Type *WDOGx);
void WDOG_CountRestart(WDOG_Type *WDOGx);
FlagStatus WDOG_GetIntStatus(const WDOG_Type *WDOGx);
void WDOG_ClrInt(const WDOG_Type *WDOGx);
 
#ifdef __cplusplus
}
#endif    
    
#endif 
/**
  * @}
  */ 
 
/**
  * @}
  */