csl_wdt.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. /**
  2. * @file csl_wdt.h
  3. *
  4. * @brief
  5. * This is the main header file for the WDT Module which defines
  6. * all the data structures and exported API.
  7. *
  8. * \par
  9. * ============================================================================
  10. * @n (C) Copyright 2002-2011, Texas Instruments, Inc.
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions
  14. * are met:
  15. *
  16. * Redistributions of source code must retain the above copyright
  17. * notice, this list of conditions and the following disclaimer.
  18. *
  19. * Redistributions in binary form must reproduce the above copyright
  20. * notice, this list of conditions and the following disclaimer in the
  21. * documentation and/or other materials provided with the
  22. * distribution.
  23. *
  24. * Neither the name of Texas Instruments Incorporated nor the names of
  25. * its contributors may be used to endorse or promote products derived
  26. * from this software without specific prior written permission.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  29. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  30. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  31. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  32. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  34. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  35. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  36. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  38. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. */
  41. /** @defgroup CSL_WDT_API WDT
  42. *
  43. */
  44. #ifndef CSL_WDTMR_H_
  45. #define CSL_WDTMR_H_
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif
  49. #include <ti/csl/soc.h>
  50. #include <ti/csl/csl.h>
  51. #include <ti/csl/cslr_wdt.h>
  52. /**
  53. @defgroup CSL_WDT_SYMBOL WDT Symbols Defined
  54. @ingroup CSL_WDT_API
  55. */
  56. /**
  57. @defgroup CSL_WDT_DATASTRUCT WDT Data Structures
  58. @ingroup CSL_WDT_API
  59. */
  60. /**
  61. @defgroup CSL_WDT_FUNCTION WDT Functions
  62. @ingroup CSL_WDT_API
  63. */
  64. /**
  65. @defgroup CSL_WDT_ENUM WDT Enumerated Data Types
  66. @ingroup CSL_WDT_API
  67. */
  68. /**
  69. @addtogroup CSL_WDT_ENUM
  70. @{
  71. */
  72. /**
  73. * General purpose global type def declarations
  74. */
  75. /**
  76. * @brief Enumerates the different prescaler values available for WDT
  77. * module.
  78. */
  79. typedef enum
  80. {
  81. /**
  82. * @brief Minimum value of the enum
  83. */
  84. CSL_WDT_PRESCALER_CLK_DIV_MIN,
  85. /**
  86. * @brief WDT functional clock divide by 1
  87. */
  88. CSL_WDT_PRESCALER_CLK_DIV_1 = CSL_WDT_PRESCALER_CLK_DIV_MIN,
  89. /**
  90. * @brief WDT functional clock divide by 2
  91. */
  92. CSL_WDT_PRESCALER_CLK_DIV_2 = 0x1U,
  93. /**
  94. * @brief WDT functional clock divide by 4
  95. */
  96. CSL_WDT_PRESCALER_CLK_DIV_4 = 0x2U,
  97. /**
  98. * @brief WDT functional clock divide by 8
  99. */
  100. CSL_WDT_PRESCALER_CLK_DIV_8 = 0x3U,
  101. /**
  102. * @brief WDT functional clock divide by 16
  103. */
  104. CSL_WDT_PRESCALER_CLK_DIV_16 = 0x4U,
  105. /**
  106. * @brief WDT functional clock divide by 32
  107. */
  108. CSL_WDT_PRESCALER_CLK_DIV_32 = 0x5U,
  109. /**
  110. * @brief WDT functional clock divide by 64
  111. */
  112. CSL_WDT_PRESCALER_CLK_DIV_64 = 0x6U,
  113. /**
  114. * @brief WDT functional clock divide by 128
  115. */
  116. CSL_WDT_PRESCALER_CLK_DIV_128 = 0x7U,
  117. /**
  118. * @brief Maximum value of the enum
  119. */
  120. CSL_WDT_PRESCALER_CLK_DIV_MAX = CSL_WDT_PRESCALER_CLK_DIV_128
  121. } CSL_wdtPrescalerClkDiv;
  122. /**
  123. * @brief Enumerates the values used to represent the WDT interrupts.
  124. */
  125. typedef enum
  126. {
  127. /**
  128. * @brief WDT overflow interrupt
  129. */
  130. CSL_WDT_INTR_MASK_OVERFLOW = CSL_WDT_WIRQENSET_ENABLE_OVF_MASK,
  131. /**
  132. * @brief WDT delay interrupt
  133. */
  134. CSL_WDT_INTR_MASK_DELAY = CSL_WDT_WIRQENSET_ENABLE_DLY_MASK
  135. } CSL_wdtIntrMask;
  136. /**
  137. * @brief Enumerates the supported WDT idle modes.
  138. */
  139. typedef enum
  140. {
  141. /**
  142. * @brief Force Idle mode
  143. */
  144. CSL_WDT_IDLE_MODE_FORCE_IDLE = CSL_WDT_WDSC_IDLEMODE_FORCEIDLE,
  145. /**
  146. * @brief No idle mode
  147. */
  148. CSL_WDT_IDLE_MODE_NO_IDLE = CSL_WDT_WDSC_IDLEMODE_NOIDLE,
  149. /**
  150. * @brief Smart idle mode
  151. */
  152. CSL_WDT_IDLE_MODE_SMART_IDLE = CSL_WDT_WDSC_IDLEMODE_SMARTIDLE,
  153. /**
  154. * @brief Smart idle with wake up mode
  155. */
  156. CSL_WDT_IDLE_MODE_SMART_IDLE_WAKEUP =
  157. CSL_WDT_WDSC_IDLEMODE_SMARTIDLEWAKEUP
  158. } CSL_wdtIdleMode;
  159. /**
  160. * @brief Enumerates the values used to represent the WDT write
  161. * posted status.
  162. */
  163. typedef enum
  164. {
  165. /**
  166. * @brief Write pending for register WCLR
  167. */
  168. CSL_WDT_WRITE_POST_WCLR = CSL_WDT_WWPS_W_PEND_WCLR_MASK,
  169. /**
  170. * @brief Write pending for register WCRR
  171. */
  172. CSL_WDT_WRITE_POST_WCRR = CSL_WDT_WWPS_W_PEND_WCRR_MASK,
  173. /**
  174. * @brief Write pending for register WLDR
  175. */
  176. CSL_WDT_WRITE_POST_WLDR = CSL_WDT_WWPS_W_PEND_WLDR_MASK,
  177. /**
  178. * @brief Write pending for register WTGR
  179. */
  180. CSL_WDT_WRITE_POST_WTGR = CSL_WDT_WWPS_W_PEND_WTGR_MASK,
  181. /**
  182. * @brief Write pending for register WSPR
  183. */
  184. CSL_WDT_WRITE_POST_WSPR = CSL_WDT_WWPS_W_PEND_WSPR_MASK,
  185. /**
  186. * @brief Write pending for register WDLY
  187. */
  188. CSL_WDT_WRITE_POST_WDLY = CSL_WDT_WWPS_W_PEND_WDLY_MASK
  189. } CSL_wdtWritePost;
  190. /**
  191. @}
  192. */
  193. /** @addtogroup CSL_WDT_DATASTRUCT
  194. @{ */
  195. /**
  196. * @brief This data type is the handle to the CSL of the RTC
  197. */
  198. typedef volatile CSL_WdtRegs *CSL_wdtHandle;
  199. /**
  200. @}
  201. */
  202. /**
  203. @addtogroup CSL_WDT_SYMBOL
  204. @{
  205. */
  206. /**
  207. * @brief This macro will check for write POSTED status of WDT registers
  208. *
  209. * \param regField Write posted status register field whose status
  210. * needs to be checked.
  211. * regField will take values from the following enum
  212. * #CSL_wdtWritePost_t
  213. */
  214. #define CSL_WDT_WAIT_FOR_WRITE(regField) \
  215. while(0U != ((hWdt->WWPS) & regField))
  216. #define CSL_WDT_DISABLE_SEQ1 (0x0000AAAAu)
  217. #define CSL_WDT_DISABLE_SEQ2 (0x00005555u)
  218. #define CSL_WDT_ENABLE_SEQ1 (0x0000BBBBu)
  219. #define CSL_WDT_ENABLE_SEQ2 (0x00004444u)
  220. /**
  221. @}
  222. */
  223. /** @addtogroup CSL_WDT_FUNCTION
  224. @{ */
  225. /*******************************************************************************
  226. * Timer global function declarations
  227. ******************************************************************************/
  228. /**
  229. @}
  230. */
  231. #ifdef __cplusplus
  232. }
  233. #endif
  234. #endif /* CSL_WDT_H_ */