watchdog.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /**
  2. * \file watchdog.h
  3. *
  4. * \brief Watchdog timer APIs and macros.
  5. *
  6. * This file contains the driver API prototypes and macro definitions.
  7. */
  8. /*
  9. * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
  10. */
  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. #ifndef __WDT_H__
  42. #define __WDT_H__
  43. #include "hw_watchdog.h"
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. /*****************************************************************************/
  48. /*
  49. ** Values that can be passed to WatchdogTimerPreScalerClkEnable API as ptv.
  50. */
  51. /* Divide functional clock by 1 */
  52. #define WDT_PRESCALER_CLK_DIV_1 (0x00000000u)
  53. /* Divide functional clock by 2 */
  54. #define WDT_PRESCALER_CLK_DIV_2 (0x00000004u)
  55. /* Divide functional clock by 4 */
  56. #define WDT_PRESCALER_CLK_DIV_4 (0x00000008u)
  57. /* Divide functional clock by 8 */
  58. #define WDT_PRESCALER_CLK_DIV_8 (0x0000000Cu)
  59. /* Divide functional clock by 16 */
  60. #define WDT_PRESCALER_CLK_DIV_16 (0x00000010u)
  61. /* Divide functional clock by 32 */
  62. #define WDT_PRESCALER_CLK_DIV_32 (0x00000014u)
  63. /* Divide functional clock by 64 */
  64. #define WDT_PRESCALER_CLK_DIV_64 (0x00000018u)
  65. /* Divide functional clock by 128 */
  66. #define WDT_PRESCALER_CLK_DIV_128 (0x0000001Cu)
  67. /*****************************************************************************/
  68. /*
  69. ** Values that can be passed to WatchdogTimerIntRawStatusSet,
  70. ** WatchdogTimerIntStatusClear APIs as intFlags.
  71. ** These values can also be used to read the status obatined from
  72. ** WatchdogTimerIntRawStatusGet, WatchdogTimerIntStatusGet APIs.
  73. ** These values can also be combined together and passed.
  74. ** For e.g. (WDT_INT_DELAY | WDT_INT_OVERFLOW)
  75. */
  76. /* Watchdog delay interrupt */
  77. #define WDT_INT_DELAY (WDT_WIRQSTATRAW_EVENT_DLY)
  78. /* Watchdog overflow interrupt */
  79. #define WDT_INT_OVERFLOW (WDT_WIRQSTATRAW_EVENT_OVF)
  80. /*****************************************************************************/
  81. /*
  82. ** Values that can be passed to WatchdogTimerIntEnable as intFlags.
  83. ** These values can also be used to read the status obtained from
  84. ** WatchdogTimerIntEnableStatusGet API.
  85. ** These values can also be combined together and passed.
  86. ** For e.g. (WDT_INT_ENABLE_DELAY | WDT_INT_ENABLE_OVRFLW)
  87. */
  88. /* Enable delay interrupt */
  89. #define WDT_INT_ENABLE_DELAY (WDT_WIRQENSET_ENABLE_DLY)
  90. /* Enable overflow interrupt */
  91. #define WDT_INT_ENABLE_OVRFLW (WDT_WIRQENSET_ENABLE_OVF)
  92. /*****************************************************************************/
  93. /*
  94. ** Values that can be passed to WatchdogTimerIntDisable as intFlags.
  95. ** These values can also be combined together and passed.
  96. ** For e.g. (WDT_INT_DISABLE_DELAY | WDT_INT_DISABLE_OVRFLW)
  97. */
  98. /* Enable delay interrupt */
  99. #define WDT_INT_DISABLE_DELAY (WDT_WIRQENCLR_ENABLE_DLY)
  100. /* Enable overflow interrupt */
  101. #define WDT_INT_DISABLE_OVRFLW (WDT_WIRQENCLR_ENABLE_OVF)
  102. /*****************************************************************************/
  103. /*
  104. ** Values that can be used to read the status obtained from
  105. ** WatchdogTimerWritePostedStatusGet API.
  106. ** These values can also be combined while reading.
  107. ** For e.g. (WDT_WRITE_PENDING_WCLR | WDT_WRITE_PENDING_WCRR)
  108. */
  109. /* Write pending for register WDT_WCLR */
  110. #define WDT_WRITE_PENDING_WCLR (WDT_WWPS_W_PEND_WCLR)
  111. /* Write pending for register WDT_WCRR */
  112. #define WDT_WRITE_PENDING_WCRR (WDT_WWPS_W_PEND_WCRR)
  113. /* Write pending for register WDT_WLDR */
  114. #define WDT_WRITE_PENDING_WLDR (WDT_WWPS_W_PEND_WLDR)
  115. /* Write pending for register WDT_WTGR */
  116. #define WDT_WRITE_PENDING_WTGR (WDT_WWPS_W_PEND_WTGR)
  117. /* Write pending for register WDT_WSPR */
  118. #define WDT_WRITE_PENDING_WSPR (WDT_WWPS_W_PEND_WSPR)
  119. /* Write pending for register WDT_WDLY */
  120. #define WDT_WRITE_PENDING_WDLY (WDT_WWPS_W_PEND_WDLY)
  121. /***************************************************************************/
  122. /*
  123. ** Watchdog timer API prototypes
  124. */
  125. extern void WatchdogTimerEnable(unsigned int baseAdd);
  126. extern void WatchdogTimerDisable(unsigned int baseAdd);
  127. extern unsigned int WatchdogTimerRevisionIDGet(unsigned int baseAdd);
  128. extern void WatchdogTimerReset(unsigned int baseAdd);
  129. extern void WatchdogTimerPreScalerClkEnable(unsigned int baseAdd, unsigned int ptv);
  130. extern void WatchdogTimerPreScalerClkDisable(unsigned int baseAdd);
  131. extern void WatchdogTimerCounterSet(unsigned int baseAdd, unsigned int countVal);
  132. extern unsigned int WatchdogTimerCounterGet(unsigned int baseAdd);
  133. extern void WatchdogTimerReloadSet(unsigned int baseAdd, unsigned int reloadVal);
  134. extern unsigned int WatchdogTimerReloadGet(unsigned int baseAdd);
  135. extern void WatchdogTimerTriggerSet(unsigned int baseAdd, unsigned int trigVal);
  136. extern void WatchdogTimerDelaySet(unsigned int baseAdd, unsigned int delayVal);
  137. extern unsigned int WatchdogTimerDelayGet(unsigned int baseAdd);
  138. extern void WatchdogTimerIntRawStatusSet(unsigned int baseAdd, unsigned int intFlags);
  139. extern unsigned int WatchdogTimerIntRawStatusGet(unsigned int baseAdd);
  140. extern unsigned int WatchdogTimerIntStatusGet(unsigned int baseAdd);
  141. extern void WatchdogTimerIntStatusClear(unsigned int baseAdd, unsigned int intFlags);
  142. extern void WatchdogTimerIntEnable(unsigned int baseAdd, unsigned int intFlags);
  143. extern unsigned int WatchdogTimerIntEnableStatusGet(unsigned int baseAdd);
  144. extern void WatchdogTimerIntDisable(unsigned int baseAdd, unsigned int intFlags);
  145. extern unsigned int WatchdogTimerWritePostedStatusGet(unsigned int baseAdd, unsigned int flags);
  146. #ifdef __cplusplus
  147. }
  148. #endif
  149. #endif
  150. /********************************* END OF FILE ********************************/