gh_wdt.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*!
  2. *******************************************************************************
  3. **
  4. ** \file gh_wdt.h
  5. **
  6. ** \brief Watch Dog Timer.
  7. **
  8. ** Copyright: 2012 - 2016 (C) GoKe Microelectronics
  9. **
  10. ** \attention THIS SAMPLE CODE IS PROVIDED AS IS. GOKE MICROELECTRONICS
  11. ** ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR
  12. ** OMMISSIONS.
  13. **
  14. ** \note Do not modify this file as it is generated automatically.
  15. **
  16. ******************************************************************************/
  17. #ifndef _GH_WDT_H
  18. #define _GH_WDT_H
  19. #ifdef __LINUX__
  20. #include "reg4linux.h"
  21. #else
  22. #define FIO_ADDRESS(block,address) (address)
  23. #define FIO_MOFFSET(block,moffset) (moffset)
  24. #endif
  25. #ifndef __LINUX__
  26. #include "gtypes.h" /* global type definitions */
  27. #include "gh_lib_cfg.h" /* configuration */
  28. #endif
  29. #define GH_WDT_ENABLE_DEBUG_PRINT 0
  30. #ifdef __LINUX__
  31. #define GH_WDT_DEBUG_PRINT_FUNCTION printk
  32. #else
  33. #define GH_WDT_DEBUG_PRINT_FUNCTION printf
  34. #endif
  35. #ifndef __LINUX__
  36. #if GH_WDT_ENABLE_DEBUG_PRINT
  37. #include <stdio.h>
  38. #endif
  39. #endif
  40. /*----------------------------------------------------------------------------*/
  41. /* registers */
  42. /*----------------------------------------------------------------------------*/
  43. #define REG_WDT_CNTSTSR FIO_ADDRESS(WDT,0xa000C000) /* read */
  44. #define REG_WDT_RELOADR FIO_ADDRESS(WDT,0xa000C004) /* read/write */
  45. #define REG_WDT_RESTARTR FIO_ADDRESS(WDT,0xa000C008) /* write */
  46. #define REG_WDT_CTRLR FIO_ADDRESS(WDT,0xa000C00C) /* read/write */
  47. #define REG_WDT_TIMEOUTR FIO_ADDRESS(WDT,0xa000C010) /* read */
  48. #define REG_WDT_CLRR FIO_ADDRESS(WDT,0xa000C014) /* write */
  49. #define REG_WDT_RSTWDR FIO_ADDRESS(WDT,0xa000C018) /* read/write */
  50. /*----------------------------------------------------------------------------*/
  51. /* bit group structures */
  52. /*----------------------------------------------------------------------------*/
  53. typedef union { /* WDT_CtrlR */
  54. U32 all;
  55. struct {
  56. U32 enable : 1;
  57. U32 resetenable : 1;
  58. U32 intenable : 1;
  59. U32 : 29;
  60. } bitc;
  61. } GH_WDT_CTRLR_S;
  62. typedef union { /* WDT_TimeoutR */
  63. U32 all;
  64. struct {
  65. U32 timeout : 1;
  66. U32 : 31;
  67. } bitc;
  68. } GH_WDT_TIMEOUTR_S;
  69. typedef union { /* WDT_ClrR */
  70. U32 all;
  71. struct {
  72. U32 clr : 1;
  73. U32 : 31;
  74. } bitc;
  75. } GH_WDT_CLRR_S;
  76. typedef union { /* WDT_RstWdR */
  77. U32 all;
  78. struct {
  79. U32 rstwd : 8;
  80. U32 : 24;
  81. } bitc;
  82. } GH_WDT_RSTWDR_S;
  83. /*----------------------------------------------------------------------------*/
  84. /* mirror variables */
  85. /*----------------------------------------------------------------------------*/
  86. extern U32 m_wdt_restartr;
  87. extern GH_WDT_CLRR_S m_wdt_clrr;
  88. #ifdef __cplusplus
  89. extern "C" {
  90. #endif
  91. /*----------------------------------------------------------------------------*/
  92. /* register WDT_CntStsR (read) */
  93. /*----------------------------------------------------------------------------*/
  94. /*! \brief Reads the register 'WDT_CntStsR'. */
  95. U32 GH_WDT_get_CntStsR(void);
  96. /*----------------------------------------------------------------------------*/
  97. /* register WDT_ReloadR (read/write) */
  98. /*----------------------------------------------------------------------------*/
  99. /*! \brief Writes the register 'WDT_ReloadR'. */
  100. void GH_WDT_set_ReloadR(U32 data);
  101. /*! \brief Reads the register 'WDT_ReloadR'. */
  102. U32 GH_WDT_get_ReloadR(void);
  103. /*----------------------------------------------------------------------------*/
  104. /* register WDT_RestartR (write) */
  105. /*----------------------------------------------------------------------------*/
  106. /*! \brief Writes the register 'WDT_RestartR'. */
  107. void GH_WDT_set_RestartR(U32 data);
  108. /*! \brief Reads the mirror variable of the register 'WDT_RestartR'. */
  109. U32 GH_WDT_getm_RestartR(void);
  110. /*----------------------------------------------------------------------------*/
  111. /* register WDT_CtrlR (read/write) */
  112. /*----------------------------------------------------------------------------*/
  113. /*! \brief Writes the register 'WDT_CtrlR'. */
  114. void GH_WDT_set_CtrlR(U32 data);
  115. /*! \brief Reads the register 'WDT_CtrlR'. */
  116. U32 GH_WDT_get_CtrlR(void);
  117. /*! \brief Writes the bit group 'Enable' of register 'WDT_CtrlR'. */
  118. void GH_WDT_set_CtrlR_Enable(U8 data);
  119. /*! \brief Reads the bit group 'Enable' of register 'WDT_CtrlR'. */
  120. U8 GH_WDT_get_CtrlR_Enable(void);
  121. /*! \brief Writes the bit group 'ResetEnable' of register 'WDT_CtrlR'. */
  122. void GH_WDT_set_CtrlR_ResetEnable(U8 data);
  123. /*! \brief Reads the bit group 'ResetEnable' of register 'WDT_CtrlR'. */
  124. U8 GH_WDT_get_CtrlR_ResetEnable(void);
  125. /*! \brief Writes the bit group 'IntEnable' of register 'WDT_CtrlR'. */
  126. void GH_WDT_set_CtrlR_IntEnable(U8 data);
  127. /*! \brief Reads the bit group 'IntEnable' of register 'WDT_CtrlR'. */
  128. U8 GH_WDT_get_CtrlR_IntEnable(void);
  129. /*----------------------------------------------------------------------------*/
  130. /* register WDT_TimeoutR (read) */
  131. /*----------------------------------------------------------------------------*/
  132. /*! \brief Reads the register 'WDT_TimeoutR'. */
  133. U32 GH_WDT_get_TimeoutR(void);
  134. /*! \brief Reads the bit group 'Timeout' of register 'WDT_TimeoutR'. */
  135. U8 GH_WDT_get_TimeoutR_Timeout(void);
  136. /*----------------------------------------------------------------------------*/
  137. /* register WDT_ClrR (write) */
  138. /*----------------------------------------------------------------------------*/
  139. /*! \brief Writes the register 'WDT_ClrR'. */
  140. void GH_WDT_set_ClrR(U32 data);
  141. /*! \brief Reads the mirror variable of the register 'WDT_ClrR'. */
  142. U32 GH_WDT_getm_ClrR(void);
  143. /*! \brief Writes the bit group 'Clr' of register 'WDT_ClrR'. */
  144. void GH_WDT_set_ClrR_Clr(U8 data);
  145. /*! \brief Reads the bit group 'Clr' from the mirror variable of register 'WDT_ClrR'. */
  146. U8 GH_WDT_getm_ClrR_Clr(void);
  147. /*----------------------------------------------------------------------------*/
  148. /* register WDT_RstWdR (read/write) */
  149. /*----------------------------------------------------------------------------*/
  150. /*! \brief Writes the register 'WDT_RstWdR'. */
  151. void GH_WDT_set_RstWdR(U32 data);
  152. /*! \brief Reads the register 'WDT_RstWdR'. */
  153. U32 GH_WDT_get_RstWdR(void);
  154. /*! \brief Writes the bit group 'RstWd' of register 'WDT_RstWdR'. */
  155. void GH_WDT_set_RstWdR_RstWd(U8 data);
  156. /*! \brief Reads the bit group 'RstWd' of register 'WDT_RstWdR'. */
  157. U8 GH_WDT_get_RstWdR_RstWd(void);
  158. /*----------------------------------------------------------------------------*/
  159. /* init function */
  160. /*----------------------------------------------------------------------------*/
  161. /*! \brief Initialises the registers and mirror variables. */
  162. void GH_WDT_init(void);
  163. #ifdef SRC_INLINE
  164. #define SRC_INC 1
  165. #include "gh_wdt.c"
  166. #undef SRC_INC
  167. #endif
  168. #ifdef __cplusplus
  169. }
  170. #endif
  171. #endif /* _GH_WDT_H */
  172. /*----------------------------------------------------------------------------*/
  173. /* end of file */
  174. /*----------------------------------------------------------------------------*/