gh_pmu_rtc.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. /*!
  2. *******************************************************************************
  3. **
  4. ** \file gh_pmu_rtc.h
  5. **
  6. ** \brief PMU_RTC.
  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_PMU_RTC_H
  18. #define _GH_PMU_RTC_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_PMU_RTC_ENABLE_DEBUG_PRINT 0
  30. #ifdef __LINUX__
  31. #define GH_PMU_RTC_DEBUG_PRINT_FUNCTION printk
  32. #else
  33. #define GH_PMU_RTC_DEBUG_PRINT_FUNCTION printf
  34. #endif
  35. #ifndef __LINUX__
  36. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  37. #include <stdio.h>
  38. #endif
  39. #endif
  40. /*----------------------------------------------------------------------------*/
  41. /* registers */
  42. /*----------------------------------------------------------------------------*/
  43. #define REG_PMU_RTC_SYS_CONFIG FIO_ADDRESS(PMU_RTC,0x90080000) /* read/write */
  44. #define REG_PMU_RTC_P_SCALER_DIV0 FIO_ADDRESS(PMU_RTC,0x90080004) /* read/write */
  45. #define REG_PMU_RTC_P_SCALER_DIV1 FIO_ADDRESS(PMU_RTC,0x90080008) /* read/write */
  46. #define REG_PMU_RTC_P_SCALER_DIV2 FIO_ADDRESS(PMU_RTC,0x9008000C) /* read/write */
  47. #define REG_PMU_RTC_P_SCALER_DIV3 FIO_ADDRESS(PMU_RTC,0x90080010) /* read/write */
  48. #define REG_PMU_RTC_PRE_LOAD_HOUR FIO_ADDRESS(PMU_RTC,0x90080014) /* write */
  49. #define REG_PMU_RTC_PRE_LOAD_MIN FIO_ADDRESS(PMU_RTC,0x90080018) /* write */
  50. #define REG_PMU_RTC_PRE_LOAD_SEC FIO_ADDRESS(PMU_RTC,0x9008001C) /* write */
  51. #define REG_PMU_RTC_IRQ_CLEAR FIO_ADDRESS(PMU_RTC,0x90080020) /* write */
  52. #define REG_PMU_RTC_PRE_LOAD_DAY_L FIO_ADDRESS(PMU_RTC,0x90080024) /* write */
  53. #define REG_PMU_RTC_PRE_LOAD_DAY_H FIO_ADDRESS(PMU_RTC,0x90080028) /* write */
  54. #define REG_PMU_RTC_IRQ_STATUS FIO_ADDRESS(PMU_RTC,0x90080068) /* read */
  55. #define REG_PMU_RTC_SEC_VALUE FIO_ADDRESS(PMU_RTC,0x9008006c) /* read */
  56. #define REG_PMU_RTC_MIN_VALUE FIO_ADDRESS(PMU_RTC,0x90080070) /* read */
  57. #define REG_PMU_RTC_HOUR_VALUE FIO_ADDRESS(PMU_RTC,0x90080074) /* read */
  58. #define REG_PMU_RTC_DAY_L_VALUE FIO_ADDRESS(PMU_RTC,0x90080078) /* read */
  59. #define REG_PMU_RTC_DAY_H_VALUE FIO_ADDRESS(PMU_RTC,0x9008007c) /* read */
  60. /*----------------------------------------------------------------------------*/
  61. /* bit group structures */
  62. /*----------------------------------------------------------------------------*/
  63. typedef union { /* PMU_RTC_SYS_CONFIG */
  64. U8 all;
  65. struct {
  66. U8 enable : 1;
  67. U8 : 2;
  68. U8 stop : 1;
  69. U8 pause : 1;
  70. U8 irq : 1;
  71. U8 : 2;
  72. } bitc;
  73. } GH_PMU_RTC_SYS_CONFIG_S;
  74. typedef union { /* PMU_RTC_IRQ_CLEAR */
  75. U8 all;
  76. struct {
  77. U8 clear : 1;
  78. U8 : 7;
  79. } bitc;
  80. } GH_PMU_RTC_IRQ_CLEAR_S;
  81. typedef union { /* PMU_RTC_IRQ_STATUS */
  82. U32 all;
  83. struct {
  84. U32 gen : 1;
  85. U32 : 31;
  86. } bitc;
  87. } GH_PMU_RTC_IRQ_STATUS_S;
  88. /*----------------------------------------------------------------------------*/
  89. /* mirror variables */
  90. /*----------------------------------------------------------------------------*/
  91. extern U8 m_pmu_rtc_pre_load_hour;
  92. extern U8 m_pmu_rtc_pre_load_min;
  93. extern U8 m_pmu_rtc_pre_load_sec;
  94. extern GH_PMU_RTC_IRQ_CLEAR_S m_pmu_rtc_irq_clear;
  95. extern U8 m_pmu_rtc_pre_load_day_l;
  96. extern U8 m_pmu_rtc_pre_load_day_h;
  97. #ifdef __cplusplus
  98. extern "C" {
  99. #endif
  100. /*----------------------------------------------------------------------------*/
  101. /* register PMU_RTC_SYS_CONFIG (read/write) */
  102. /*----------------------------------------------------------------------------*/
  103. /*! \brief Writes the register 'PMU_RTC_SYS_CONFIG'. */
  104. void GH_PMU_RTC_set_SYS_CONFIG(U8 data);
  105. /*! \brief Reads the register 'PMU_RTC_SYS_CONFIG'. */
  106. U8 GH_PMU_RTC_get_SYS_CONFIG(void);
  107. /*! \brief Writes the bit group 'Enable' of register 'PMU_RTC_SYS_CONFIG'. */
  108. void GH_PMU_RTC_set_SYS_CONFIG_Enable(U8 data);
  109. /*! \brief Reads the bit group 'Enable' of register 'PMU_RTC_SYS_CONFIG'. */
  110. U8 GH_PMU_RTC_get_SYS_CONFIG_Enable(void);
  111. /*! \brief Writes the bit group 'Stop' of register 'PMU_RTC_SYS_CONFIG'. */
  112. void GH_PMU_RTC_set_SYS_CONFIG_Stop(U8 data);
  113. /*! \brief Reads the bit group 'Stop' of register 'PMU_RTC_SYS_CONFIG'. */
  114. U8 GH_PMU_RTC_get_SYS_CONFIG_Stop(void);
  115. /*! \brief Writes the bit group 'Pause' of register 'PMU_RTC_SYS_CONFIG'. */
  116. void GH_PMU_RTC_set_SYS_CONFIG_Pause(U8 data);
  117. /*! \brief Reads the bit group 'Pause' of register 'PMU_RTC_SYS_CONFIG'. */
  118. U8 GH_PMU_RTC_get_SYS_CONFIG_Pause(void);
  119. /*! \brief Writes the bit group 'IRQ' of register 'PMU_RTC_SYS_CONFIG'. */
  120. void GH_PMU_RTC_set_SYS_CONFIG_IRQ(U8 data);
  121. /*! \brief Reads the bit group 'IRQ' of register 'PMU_RTC_SYS_CONFIG'. */
  122. U8 GH_PMU_RTC_get_SYS_CONFIG_IRQ(void);
  123. /*----------------------------------------------------------------------------*/
  124. /* register PMU_RTC_P_SCALER_DIV0 (read/write) */
  125. /*----------------------------------------------------------------------------*/
  126. /*! \brief Writes the register 'PMU_RTC_P_SCALER_DIV0'. */
  127. void GH_PMU_RTC_set_P_SCALER_DIV0(U8 data);
  128. /*! \brief Reads the register 'PMU_RTC_P_SCALER_DIV0'. */
  129. U8 GH_PMU_RTC_get_P_SCALER_DIV0(void);
  130. /*----------------------------------------------------------------------------*/
  131. /* register PMU_RTC_P_SCALER_DIV1 (read/write) */
  132. /*----------------------------------------------------------------------------*/
  133. /*! \brief Writes the register 'PMU_RTC_P_SCALER_DIV1'. */
  134. void GH_PMU_RTC_set_P_SCALER_DIV1(U8 data);
  135. /*! \brief Reads the register 'PMU_RTC_P_SCALER_DIV1'. */
  136. U8 GH_PMU_RTC_get_P_SCALER_DIV1(void);
  137. /*----------------------------------------------------------------------------*/
  138. /* register PMU_RTC_P_SCALER_DIV2 (read/write) */
  139. /*----------------------------------------------------------------------------*/
  140. /*! \brief Writes the register 'PMU_RTC_P_SCALER_DIV2'. */
  141. void GH_PMU_RTC_set_P_SCALER_DIV2(U8 data);
  142. /*! \brief Reads the register 'PMU_RTC_P_SCALER_DIV2'. */
  143. U8 GH_PMU_RTC_get_P_SCALER_DIV2(void);
  144. /*----------------------------------------------------------------------------*/
  145. /* register PMU_RTC_P_SCALER_DIV3 (read/write) */
  146. /*----------------------------------------------------------------------------*/
  147. /*! \brief Writes the register 'PMU_RTC_P_SCALER_DIV3'. */
  148. void GH_PMU_RTC_set_P_SCALER_DIV3(U8 data);
  149. /*! \brief Reads the register 'PMU_RTC_P_SCALER_DIV3'. */
  150. U8 GH_PMU_RTC_get_P_SCALER_DIV3(void);
  151. /*----------------------------------------------------------------------------*/
  152. /* register PMU_RTC_PRE_LOAD_HOUR (write) */
  153. /*----------------------------------------------------------------------------*/
  154. /*! \brief Writes the register 'PMU_RTC_PRE_LOAD_HOUR'. */
  155. void GH_PMU_RTC_set_PRE_LOAD_HOUR(U8 data);
  156. /*! \brief Reads the mirror variable of the register 'PMU_RTC_PRE_LOAD_HOUR'. */
  157. U8 GH_PMU_RTC_getm_PRE_LOAD_HOUR(void);
  158. /*----------------------------------------------------------------------------*/
  159. /* register PMU_RTC_PRE_LOAD_MIN (write) */
  160. /*----------------------------------------------------------------------------*/
  161. /*! \brief Writes the register 'PMU_RTC_PRE_LOAD_MIN'. */
  162. void GH_PMU_RTC_set_PRE_LOAD_MIN(U8 data);
  163. /*! \brief Reads the mirror variable of the register 'PMU_RTC_PRE_LOAD_MIN'. */
  164. U8 GH_PMU_RTC_getm_PRE_LOAD_MIN(void);
  165. /*----------------------------------------------------------------------------*/
  166. /* register PMU_RTC_PRE_LOAD_SEC (write) */
  167. /*----------------------------------------------------------------------------*/
  168. /*! \brief Writes the register 'PMU_RTC_PRE_LOAD_SEC'. */
  169. void GH_PMU_RTC_set_PRE_LOAD_SEC(U8 data);
  170. /*! \brief Reads the mirror variable of the register 'PMU_RTC_PRE_LOAD_SEC'. */
  171. U8 GH_PMU_RTC_getm_PRE_LOAD_SEC(void);
  172. /*----------------------------------------------------------------------------*/
  173. /* register PMU_RTC_IRQ_CLEAR (write) */
  174. /*----------------------------------------------------------------------------*/
  175. /*! \brief Writes the register 'PMU_RTC_IRQ_CLEAR'. */
  176. void GH_PMU_RTC_set_IRQ_CLEAR(U8 data);
  177. /*! \brief Reads the mirror variable of the register 'PMU_RTC_IRQ_CLEAR'. */
  178. U8 GH_PMU_RTC_getm_IRQ_CLEAR(void);
  179. /*! \brief Writes the bit group 'Clear' of register 'PMU_RTC_IRQ_CLEAR'. */
  180. void GH_PMU_RTC_set_IRQ_CLEAR_Clear(U8 data);
  181. /*! \brief Reads the bit group 'Clear' from the mirror variable of register 'PMU_RTC_IRQ_CLEAR'. */
  182. U8 GH_PMU_RTC_getm_IRQ_CLEAR_Clear(void);
  183. /*----------------------------------------------------------------------------*/
  184. /* register PMU_RTC_PRE_LOAD_DAY_L (write) */
  185. /*----------------------------------------------------------------------------*/
  186. /*! \brief Writes the register 'PMU_RTC_PRE_LOAD_DAY_L'. */
  187. void GH_PMU_RTC_set_PRE_LOAD_DAY_L(U8 data);
  188. /*! \brief Reads the mirror variable of the register 'PMU_RTC_PRE_LOAD_DAY_L'. */
  189. U8 GH_PMU_RTC_getm_PRE_LOAD_DAY_L(void);
  190. /*----------------------------------------------------------------------------*/
  191. /* register PMU_RTC_PRE_LOAD_DAY_H (write) */
  192. /*----------------------------------------------------------------------------*/
  193. /*! \brief Writes the register 'PMU_RTC_PRE_LOAD_DAY_H'. */
  194. void GH_PMU_RTC_set_PRE_LOAD_DAY_H(U8 data);
  195. /*! \brief Reads the mirror variable of the register 'PMU_RTC_PRE_LOAD_DAY_H'. */
  196. U8 GH_PMU_RTC_getm_PRE_LOAD_DAY_H(void);
  197. /*----------------------------------------------------------------------------*/
  198. /* register PMU_RTC_IRQ_STATUS (read) */
  199. /*----------------------------------------------------------------------------*/
  200. /*! \brief Reads the register 'PMU_RTC_IRQ_STATUS'. */
  201. U32 GH_PMU_RTC_get_IRQ_STATUS(void);
  202. /*! \brief Reads the bit group 'Gen' of register 'PMU_RTC_IRQ_STATUS'. */
  203. U8 GH_PMU_RTC_get_IRQ_STATUS_Gen(void);
  204. /*----------------------------------------------------------------------------*/
  205. /* register PMU_RTC_SEC_VALUE (read) */
  206. /*----------------------------------------------------------------------------*/
  207. /*! \brief Reads the register 'PMU_RTC_SEC_VALUE'. */
  208. U32 GH_PMU_RTC_get_SEC_VALUE(void);
  209. /*----------------------------------------------------------------------------*/
  210. /* register PMU_RTC_MIN_VALUE (read) */
  211. /*----------------------------------------------------------------------------*/
  212. /*! \brief Reads the register 'PMU_RTC_MIN_VALUE'. */
  213. U32 GH_PMU_RTC_get_MIN_VALUE(void);
  214. /*----------------------------------------------------------------------------*/
  215. /* register PMU_RTC_HOUR_VALUE (read) */
  216. /*----------------------------------------------------------------------------*/
  217. /*! \brief Reads the register 'PMU_RTC_HOUR_VALUE'. */
  218. U32 GH_PMU_RTC_get_HOUR_VALUE(void);
  219. /*----------------------------------------------------------------------------*/
  220. /* register PMU_RTC_DAY_L_VALUE (read) */
  221. /*----------------------------------------------------------------------------*/
  222. /*! \brief Reads the register 'PMU_RTC_DAY_L_VALUE'. */
  223. U32 GH_PMU_RTC_get_DAY_L_VALUE(void);
  224. /*----------------------------------------------------------------------------*/
  225. /* register PMU_RTC_DAY_H_VALUE (read) */
  226. /*----------------------------------------------------------------------------*/
  227. /*! \brief Reads the register 'PMU_RTC_DAY_H_VALUE'. */
  228. U32 GH_PMU_RTC_get_DAY_H_VALUE(void);
  229. /*----------------------------------------------------------------------------*/
  230. /* init function */
  231. /*----------------------------------------------------------------------------*/
  232. /*! \brief Initialises the registers and mirror variables. */
  233. void GH_PMU_RTC_init(void);
  234. #ifdef SRC_INLINE
  235. #define SRC_INC 1
  236. #include "gh_pmu_rtc.c"
  237. #undef SRC_INC
  238. #endif
  239. #ifdef __cplusplus
  240. }
  241. #endif
  242. #endif /* _GH_PMU_RTC_H */
  243. /*----------------------------------------------------------------------------*/
  244. /* end of file */
  245. /*----------------------------------------------------------------------------*/