at32f415_wwdt.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /**
  2. **************************************************************************
  3. * @file at32f415_wwdt.h
  4. * @version v2.0.5
  5. * @date 2022-05-20
  6. * @brief at32f415 wwdt header file
  7. **************************************************************************
  8. * Copyright notice & Disclaimer
  9. *
  10. * The software Board Support Package (BSP) that is made available to
  11. * download from Artery official website is the copyrighted work of Artery.
  12. * Artery authorizes customers to use, copy, and distribute the BSP
  13. * software and its related documentation for the purpose of design and
  14. * development in conjunction with Artery microcontrollers. Use of the
  15. * software is governed by this copyright notice and the following disclaimer.
  16. *
  17. * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  18. * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  19. * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  20. * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  21. * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  22. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  23. *
  24. **************************************************************************
  25. */
  26. /* Define to prevent recursive inclusion -------------------------------------*/
  27. #ifndef __AT32F415_WWDT_H
  28. #define __AT32F415_WWDT_H
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /* Includes ------------------------------------------------------------------*/
  33. #include "at32f415.h"
  34. /** @addtogroup AT32F415_periph_driver
  35. * @{
  36. */
  37. /** @addtogroup WWDT
  38. * @{
  39. */
  40. /** @defgroup WWDT_enable_bit_definition
  41. * @brief wwdt enable bit
  42. * @{
  43. */
  44. #define WWDT_EN_BIT ((uint32_t)0x00000080) /*!< wwdt enable bit */
  45. /**
  46. * @}
  47. */
  48. /** @defgroup WWDT_exported_types
  49. * @{
  50. */
  51. /**
  52. * @brief wwdt division type
  53. */
  54. typedef enum
  55. {
  56. WWDT_PCLK1_DIV_4096 = 0x00, /*!< wwdt counter clock = (pclk1/4096)/1) */
  57. WWDT_PCLK1_DIV_8192 = 0x01, /*!< wwdt counter clock = (pclk1/4096)/2) */
  58. WWDT_PCLK1_DIV_16384 = 0x02, /*!< wwdt counter clock = (pclk1/4096)/4) */
  59. WWDT_PCLK1_DIV_32768 = 0x03 /*!< wwdt counter clock = (pclk1/4096)/8) */
  60. } wwdt_division_type;
  61. /**
  62. * @brief type define wwdt register all
  63. */
  64. typedef struct
  65. {
  66. /**
  67. * @brief wwdt ctrl register, offset:0x00
  68. */
  69. union
  70. {
  71. __IO uint32_t ctrl;
  72. struct
  73. {
  74. __IO uint32_t cnt : 7; /* [6:0] */
  75. __IO uint32_t wwdten : 1; /* [7] */
  76. __IO uint32_t reserved1 : 24;/* [31:8] */
  77. } ctrl_bit;
  78. };
  79. /**
  80. * @brief wwdt cfg register, offset:0x04
  81. */
  82. union
  83. {
  84. __IO uint32_t cfg;
  85. struct
  86. {
  87. __IO uint32_t win : 7; /* [6:0] */
  88. __IO uint32_t div : 2; /* [8:7] */
  89. __IO uint32_t rldien : 1; /* [9] */
  90. __IO uint32_t reserved1 : 22;/* [31:10] */
  91. } cfg_bit;
  92. };
  93. /**
  94. * @brief wwdt cfg register, offset:0x08
  95. */
  96. union
  97. {
  98. __IO uint32_t sts;
  99. struct
  100. {
  101. __IO uint32_t rldf : 1; /* [0] */
  102. __IO uint32_t reserved1 : 31;/* [31:1] */
  103. } sts_bit;
  104. };
  105. } wwdt_type;
  106. /**
  107. * @}
  108. */
  109. #define WWDT ((wwdt_type *) WWDT_BASE)
  110. /** @defgroup WWDT_exported_functions
  111. * @{
  112. */
  113. void wwdt_reset(void);
  114. void wwdt_divider_set(wwdt_division_type division);
  115. void wwdt_flag_clear(void);
  116. void wwdt_enable(uint8_t wwdt_cnt);
  117. void wwdt_interrupt_enable(void);
  118. flag_status wwdt_flag_get(void);
  119. void wwdt_counter_set(uint8_t wwdt_cnt);
  120. void wwdt_window_counter_set(uint8_t window_cnt);
  121. /**
  122. * @}
  123. */
  124. /**
  125. * @}
  126. */
  127. /**
  128. * @}
  129. */
  130. #ifdef __cplusplus
  131. }
  132. #endif
  133. #endif