1 /*!
2  * @file        apm32e10x_iwdt.h
3  *
4  * @brief       This file contains all the functions prototypes for the IWDT firmware library
5  *
6  * @version     V1.0.2
7  *
8  * @date        2022-12-31
9  *
10  * @attention
11  *
12  *  Copyright (C) 2021-2023 Geehy Semiconductor
13  *
14  *  You may not use this file except in compliance with the
15  *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
16  *
17  *  The program is only for reference, which is distributed in the hope
18  *  that it will be useful and instructional for customers to develop
19  *  their software. Unless required by applicable law or agreed to in
20  *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
21  *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
22  *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
23  *  and limitations under the License.
24  */
25 
26 /* Define to prevent recursive inclusion */
27 #ifndef __APM32E10X_IWDT_H
28 #define __APM32E10X_IWDT_H
29 
30 /* Includes */
31 #include "apm32e10x.h"
32 
33 #ifdef __cplusplus
34  extern "C" {
35 #endif
36 
37 /** @addtogroup APM32E10x_StdPeriphDriver
38   @{
39 */
40 
41 /** @addtogroup IWDT_Driver
42   @{
43 */
44 
45 /** @defgroup IWDT_Enumerations Enumerations
46   @{
47 */
48 
49 /**
50  * @brief    IWDT KEYWORD define
51  */
52 typedef enum
53 {
54     IWDT_KEYWORD_RELOAD = 0xAAAA,
55     IWDT_KEYWORD_ENABLE = 0xCCCC
56 }IWDT_KEYWORD_T;
57 
58 /**
59  * @brief    IWDT Write Access define
60  */
61 typedef enum
62 {
63     IWDT_WRITEACCESS_ENABLE  = 0x5555,
64     IWDT_WRITEACCESS_DISABLE = 0x0000
65 }IWDT_WRITEACCESS_T;
66 
67 /**
68  * @brief    IWDT Divider
69  */
70 typedef enum
71 {
72     IWDT_DIVIDER_4   = 0x00,
73     IWDT_DIVIDER_8   = 0x01,
74     IWDT_DIVIDER_16  = 0x02,
75     IWDT_DIVIDER_32  = 0x03,
76     IWDT_DIVIDER_64  = 0x04,
77     IWDT_DIVIDER_128 = 0x05,
78     IWDT_DIVIDER_256 = 0x06
79 }IWDT_DIVIDER_T;
80 
81 /**
82  * @brief    IWDT Flag
83  */
84 typedef enum
85 {
86     IWDT_FLAG_PSCU = BIT0,
87     IWDT_FLAG_CNTU = BIT1
88 }IWDT_FLAG_T;
89 
90 /**@} end of group IWDT_Enumerations */
91 
92 
93 /** @defgroup IWDT_Functions Functions
94   @{
95 */
96 
97 /* Enable IWDT */
98 void IWDT_Enable(void);
99 
100 /* Refresh IWDT */
101 void IWDT_Refresh(void);
102 
103 /* Counter reload */
104 void IWDT_ConfigReload(uint16_t reload);
105 
106 /* Divider */
107 void IWDT_ConfigDivider(uint8_t div);
108 
109 /* Write Access */
110 void IWDT_EnableWriteAccess(void);
111 void IWDT_DisableWriteAccess(void);
112 
113 /* flag */
114 uint8_t IWDT_ReadStatusFlag(uint16_t flag);
115 
116 /**@} end of group IWDT_Functions*/
117 /**@} end of group IWDT_Driver */
118 /**@} end of group APM32E10x_StdPeriphDriver*/
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif /* __APM32E10X_IWDT_H */
125