am_reg_wdt.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. //*****************************************************************************
  2. //
  3. // am_reg_wdt.h
  4. //! @file
  5. //!
  6. //! @brief Register macros for the WDT module
  7. //
  8. //*****************************************************************************
  9. //*****************************************************************************
  10. //
  11. // Copyright (c) 2017, Ambiq Micro
  12. // All rights reserved.
  13. //
  14. // Redistribution and use in source and binary forms, with or without
  15. // modification, are permitted provided that the following conditions are met:
  16. //
  17. // 1. Redistributions of source code must retain the above copyright notice,
  18. // this list of conditions and the following disclaimer.
  19. //
  20. // 2. Redistributions in binary form must reproduce the above copyright
  21. // notice, this list of conditions and the following disclaimer in the
  22. // documentation and/or other materials provided with the distribution.
  23. //
  24. // 3. Neither the name of the copyright holder nor the names of its
  25. // contributors may be used to endorse or promote products derived from this
  26. // software without specific prior written permission.
  27. //
  28. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  29. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  30. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  31. // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  32. // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  34. // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  35. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  36. // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  37. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  38. // POSSIBILITY OF SUCH DAMAGE.
  39. //
  40. // This is part of revision 1.2.11 of the AmbiqSuite Development Package.
  41. //
  42. //*****************************************************************************
  43. #ifndef AM_REG_WDT_H
  44. #define AM_REG_WDT_H
  45. //*****************************************************************************
  46. //
  47. // Instance finder. (1 instance(s) available)
  48. //
  49. //*****************************************************************************
  50. #define AM_REG_WDT_NUM_MODULES 1
  51. #define AM_REG_WDTn(n) \
  52. (REG_WDT_BASEADDR + 0x00000000 * n)
  53. //*****************************************************************************
  54. //
  55. // Register offsets.
  56. //
  57. //*****************************************************************************
  58. #define AM_REG_WDT_CFG_O 0x00000000
  59. #define AM_REG_WDT_RSTRT_O 0x00000004
  60. #define AM_REG_WDT_LOCK_O 0x00000008
  61. #define AM_REG_WDT_COUNT_O 0x0000000C
  62. #define AM_REG_WDT_INTEN_O 0x00000200
  63. #define AM_REG_WDT_INTSTAT_O 0x00000204
  64. #define AM_REG_WDT_INTCLR_O 0x00000208
  65. #define AM_REG_WDT_INTSET_O 0x0000020C
  66. //*****************************************************************************
  67. //
  68. // WDT_INTEN - WDT Interrupt register: Enable
  69. //
  70. //*****************************************************************************
  71. // Watchdog Timer Interrupt.
  72. #define AM_REG_WDT_INTEN_WDT_S 0
  73. #define AM_REG_WDT_INTEN_WDT_M 0x00000001
  74. #define AM_REG_WDT_INTEN_WDT(n) (((uint32_t)(n) << 0) & 0x00000001)
  75. //*****************************************************************************
  76. //
  77. // WDT_INTSTAT - WDT Interrupt register: Status
  78. //
  79. //*****************************************************************************
  80. // Watchdog Timer Interrupt.
  81. #define AM_REG_WDT_INTSTAT_WDT_S 0
  82. #define AM_REG_WDT_INTSTAT_WDT_M 0x00000001
  83. #define AM_REG_WDT_INTSTAT_WDT(n) (((uint32_t)(n) << 0) & 0x00000001)
  84. //*****************************************************************************
  85. //
  86. // WDT_INTCLR - WDT Interrupt register: Clear
  87. //
  88. //*****************************************************************************
  89. // Watchdog Timer Interrupt.
  90. #define AM_REG_WDT_INTCLR_WDT_S 0
  91. #define AM_REG_WDT_INTCLR_WDT_M 0x00000001
  92. #define AM_REG_WDT_INTCLR_WDT(n) (((uint32_t)(n) << 0) & 0x00000001)
  93. //*****************************************************************************
  94. //
  95. // WDT_INTSET - WDT Interrupt register: Set
  96. //
  97. //*****************************************************************************
  98. // Watchdog Timer Interrupt.
  99. #define AM_REG_WDT_INTSET_WDT_S 0
  100. #define AM_REG_WDT_INTSET_WDT_M 0x00000001
  101. #define AM_REG_WDT_INTSET_WDT(n) (((uint32_t)(n) << 0) & 0x00000001)
  102. //*****************************************************************************
  103. //
  104. // WDT_CFG - Configuration Register
  105. //
  106. //*****************************************************************************
  107. // Select the frequency for the WDT. All values not enumerated below are
  108. // undefined.
  109. #define AM_REG_WDT_CFG_CLKSEL_S 24
  110. #define AM_REG_WDT_CFG_CLKSEL_M 0x07000000
  111. #define AM_REG_WDT_CFG_CLKSEL(n) (((uint32_t)(n) << 24) & 0x07000000)
  112. #define AM_REG_WDT_CFG_CLKSEL_OFF 0x00000000
  113. #define AM_REG_WDT_CFG_CLKSEL_128HZ 0x01000000
  114. #define AM_REG_WDT_CFG_CLKSEL_16HZ 0x02000000
  115. #define AM_REG_WDT_CFG_CLKSEL_1HZ 0x03000000
  116. #define AM_REG_WDT_CFG_CLKSEL_1_16HZ 0x04000000
  117. // This bitfield is the compare value for counter bits 7:0 to generate a
  118. // watchdog interrupt.
  119. #define AM_REG_WDT_CFG_INTVAL_S 16
  120. #define AM_REG_WDT_CFG_INTVAL_M 0x00FF0000
  121. #define AM_REG_WDT_CFG_INTVAL(n) (((uint32_t)(n) << 16) & 0x00FF0000)
  122. // This bitfield is the compare value for counter bits 7:0 to generate a
  123. // watchdog reset.
  124. #define AM_REG_WDT_CFG_RESVAL_S 8
  125. #define AM_REG_WDT_CFG_RESVAL_M 0x0000FF00
  126. #define AM_REG_WDT_CFG_RESVAL(n) (((uint32_t)(n) << 8) & 0x0000FF00)
  127. // This bitfield enables the WDT reset.
  128. #define AM_REG_WDT_CFG_RESEN_S 2
  129. #define AM_REG_WDT_CFG_RESEN_M 0x00000004
  130. #define AM_REG_WDT_CFG_RESEN(n) (((uint32_t)(n) << 2) & 0x00000004)
  131. // This bitfield enables the WDT interrupt. Note : This bit must be set before
  132. // the interrupt status bit will reflect a watchdog timer expiration. The IER
  133. // interrupt register must also be enabled for a WDT interrupt to be sent to the
  134. // NVIC.
  135. #define AM_REG_WDT_CFG_INTEN_S 1
  136. #define AM_REG_WDT_CFG_INTEN_M 0x00000002
  137. #define AM_REG_WDT_CFG_INTEN(n) (((uint32_t)(n) << 1) & 0x00000002)
  138. // This bitfield enables the WDT.
  139. #define AM_REG_WDT_CFG_WDTEN_S 0
  140. #define AM_REG_WDT_CFG_WDTEN_M 0x00000001
  141. #define AM_REG_WDT_CFG_WDTEN(n) (((uint32_t)(n) << 0) & 0x00000001)
  142. //*****************************************************************************
  143. //
  144. // WDT_RSTRT - Restart the watchdog timer
  145. //
  146. //*****************************************************************************
  147. // Writing 0xB2 to WDTRSTRT restarts the watchdog timer.
  148. #define AM_REG_WDT_RSTRT_RSTRT_S 0
  149. #define AM_REG_WDT_RSTRT_RSTRT_M 0x000000FF
  150. #define AM_REG_WDT_RSTRT_RSTRT(n) (((uint32_t)(n) << 0) & 0x000000FF)
  151. #define AM_REG_WDT_RSTRT_RSTRT_KEYVALUE 0x000000B2
  152. //*****************************************************************************
  153. //
  154. // WDT_LOCK - Locks the WDT
  155. //
  156. //*****************************************************************************
  157. // Writing 0x3A locks the watchdog timer. Once locked, the WDTCFG reg cannot be
  158. // written and WDTEN is set.
  159. #define AM_REG_WDT_LOCK_LOCK_S 0
  160. #define AM_REG_WDT_LOCK_LOCK_M 0x000000FF
  161. #define AM_REG_WDT_LOCK_LOCK(n) (((uint32_t)(n) << 0) & 0x000000FF)
  162. #define AM_REG_WDT_LOCK_LOCK_KEYVALUE 0x0000003A
  163. //*****************************************************************************
  164. //
  165. // WDT_COUNT - Current Counter Value for WDT
  166. //
  167. //*****************************************************************************
  168. // Read-Only current value of the WDT counter
  169. #define AM_REG_WDT_COUNT_COUNT_S 0
  170. #define AM_REG_WDT_COUNT_COUNT_M 0x000000FF
  171. #define AM_REG_WDT_COUNT_COUNT(n) (((uint32_t)(n) << 0) & 0x000000FF)
  172. #endif // AM_REG_WDT_H