1 /*! 2 * @file apm32s10x_iwdt.h 3 * 4 * @brief This file contains all the functions prototypes for the IWDT firmware library 5 * 6 * @version V1.0.1 7 * 8 * @date 2022-12-31 9 * 10 * @attention 11 * 12 * Copyright (C) 2022-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 usefull 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 __APM32S10X_IWDT_H 28 #define __APM32S10X_IWDT_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* Includes */ 35 #include "apm32s10x.h" 36 37 /** @addtogroup APM32S10x_StdPeriphDriver 38 @{ 39 */ 40 41 /** @addtogroup IWDT_Driver 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 /** @defgroup IWDT_Functions Functions 93 @{ 94 */ 95 96 /* Enable IWDT */ 97 void IWDT_Enable(void); 98 99 /* Refresh IWDT */ 100 void IWDT_Refresh(void); 101 102 /* Counter reload */ 103 void IWDT_ConfigReload(uint16_t reload); 104 105 /* Divider */ 106 void IWDT_ConfigDivider(uint8_t div); 107 108 /* Write Access */ 109 void IWDT_EnableWriteAccess(void); 110 void IWDT_DisableWriteAccess(void); 111 112 /* flag */ 113 uint8_t IWDT_ReadStatusFlag(uint16_t flag); 114 115 /**@} end of group IWDT_Functions */ 116 /**@} end of group IWDT_Driver */ 117 /**@} end of group APM32S10x_StdPeriphDriver */ 118 119 #ifdef __cplusplus 120 } 121 #endif 122 123 #endif /* __APM32S10X_IWDT_H */ 124