apm32f4xx_iwdt.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. /* Define to prevent recursive inclusion */
  26. #ifndef __APM32F4XX_IWDT_H
  27. #define __APM32F4XX_IWDT_H
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /* Includes */
  32. #include "apm32f4xx.h"
  33. /** @addtogroup APM32F4xx_StdPeriphDriver
  34. @{
  35. */
  36. /** @addtogroup IWDT_Driver
  37. @{
  38. */
  39. /** @defgroup IWDT_Enumerations
  40. @{
  41. */
  42. /**
  43. * @brief IWDT KEYWORD define
  44. */
  45. typedef enum
  46. {
  47. IWDT_KEYWORD_RELOAD = 0xAAAA, /*!< Reload IWDT_CNTRLD register */
  48. IWDT_KEYWORD_ENABLE = 0xCCCC /*!< Activate watchdog */
  49. } IWDT_KEYWORD_T;
  50. /**
  51. * @brief IWDT Write Access define
  52. */
  53. typedef enum
  54. {
  55. IWDT_WRITEACCESS_ENABLE = 0x5555, /*!< Allow access IWDT register */
  56. IWDT_WRITEACCESS_DISABLE = 0x0000 /*!< Disable access IWDT register */
  57. } IWDT_WRITEACCESS_T;
  58. /**
  59. * @brief IWDT Divider
  60. */
  61. typedef enum
  62. {
  63. IWDT_DIVIDER_4 = 0x00, /*!< Prescaler divider equal to 4 */
  64. IWDT_DIVIDER_8 = 0x01, /*!< Prescaler divider equal to 8 */
  65. IWDT_DIVIDER_16 = 0x02, /*!< Prescaler divider equal to 16 */
  66. IWDT_DIVIDER_32 = 0x03, /*!< Prescaler divider equal to 32 */
  67. IWDT_DIVIDER_64 = 0x04, /*!< Prescaler divider equal to 64 */
  68. IWDT_DIVIDER_128 = 0x05, /*!< Prescaler divider equal to 128 */
  69. IWDT_DIVIDER_256 = 0x06 /*!< Prescaler divider equal to 256 */
  70. } IWDT_DIVIDER_T;
  71. /**
  72. * @brief IWDT Flag
  73. */
  74. typedef enum
  75. {
  76. IWDT_FLAG_PSCU = BIT0, /*!< Watchdog Prescaler Factor Update flag */
  77. IWDT_FLAG_CNTU = BIT1 /*!< Watchdog Counter Reload Value Update flag */
  78. } IWDT_FLAG_T;
  79. /**@} end of group IWDT_Enumerations*/
  80. /** @defgroup IWDT_Functions
  81. @{
  82. */
  83. /* Enable IWDT */
  84. void IWDT_Enable(void);
  85. /* Refresh IWDT */
  86. void IWDT_Refresh(void);
  87. /* Counter reload */
  88. void IWDT_ConfigReload(uint16_t reload);
  89. /* Divider */
  90. void IWDT_ConfigDivider(uint8_t div);
  91. /* Write Access */
  92. void IWDT_EnableWriteAccess(void);
  93. void IWDT_DisableWriteAccess(void);
  94. /* flag */
  95. uint8_t IWDT_ReadStatusFlag(uint16_t flag);
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif /* __APM32F4XX_IWDT_H */
  100. /**@} end of group IWDT_Enumerations */
  101. /**@} end of group IWDT_Driver */
  102. /**@} end of group APM32F4xx_StdPeriphDriver */