at32f413_wwdt.h 3.9 KB

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