1 /*! 2 * @file apm32f4xx_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-06-23 9 * 10 * @attention 11 * 12 * Copyright (C) 2021-2022 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 __APM32F4XX_IWDT_H 28 #define __APM32F4XX_IWDT_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* Includes */ 35 #include "apm32f4xx.h" 36 37 /** @addtogroup APM32F4xx_StdPeriphDriver 38 @{ 39 */ 40 41 /** @addtogroup IWDT_Driver 42 @{ 43 */ 44 45 /** @defgroup IWDT_Enumerations 46 @{ 47 */ 48 49 /** 50 * @brief IWDT KEYWORD define 51 */ 52 typedef enum 53 { 54 IWDT_KEYWORD_RELOAD = 0xAAAA, /*!< Reload IWDT_CNTRLD register */ 55 IWDT_KEYWORD_ENABLE = 0xCCCC /*!< Activate watchdog */ 56 } IWDT_KEYWORD_T; 57 58 /** 59 * @brief IWDT Write Access define 60 */ 61 typedef enum 62 { 63 IWDT_WRITEACCESS_ENABLE = 0x5555, /*!< Allow access IWDT register */ 64 IWDT_WRITEACCESS_DISABLE = 0x0000 /*!< Disable access IWDT register */ 65 } IWDT_WRITEACCESS_T; 66 67 /** 68 * @brief IWDT Divider 69 */ 70 typedef enum 71 { 72 IWDT_DIVIDER_4 = 0x00, /*!< Prescaler divider equal to 4 */ 73 IWDT_DIVIDER_8 = 0x01, /*!< Prescaler divider equal to 8 */ 74 IWDT_DIVIDER_16 = 0x02, /*!< Prescaler divider equal to 16 */ 75 IWDT_DIVIDER_32 = 0x03, /*!< Prescaler divider equal to 32 */ 76 IWDT_DIVIDER_64 = 0x04, /*!< Prescaler divider equal to 64 */ 77 IWDT_DIVIDER_128 = 0x05, /*!< Prescaler divider equal to 128 */ 78 IWDT_DIVIDER_256 = 0x06 /*!< Prescaler divider equal to 256 */ 79 } IWDT_DIVIDER_T; 80 81 /** 82 * @brief IWDT Flag 83 */ 84 typedef enum 85 { 86 IWDT_FLAG_PSCU = BIT0, /*!< Watchdog Prescaler Factor Update flag */ 87 IWDT_FLAG_CNTU = BIT1 /*!< Watchdog Counter Reload Value Update flag */ 88 } IWDT_FLAG_T; 89 90 /**@} end of group IWDT_Enumerations*/ 91 92 /** @defgroup IWDT_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 #ifdef __cplusplus 116 } 117 #endif 118 119 #endif /* __APM32F4XX_IWDT_H */ 120 121 /**@} end of group IWDT_Enumerations */ 122 /**@} end of group IWDT_Driver */ 123 /**@} end of group APM32F4xx_StdPeriphDriver */ 124