gh_pmu_rtc.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  1. /*!
  2. *******************************************************************************
  3. **
  4. ** \file gh_pmu_rtc.h
  5. **
  6. ** \brief PMU_RTC.
  7. **
  8. ** Copyright: 2012 - 2013 (C) GoKe Microelectronics ShangHai Branch
  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. /* check configuration */
  41. #ifndef GH_INLINE_LEVEL
  42. #error "GH_INLINE_LEVEL is not defined!"
  43. #endif
  44. #if GH_INLINE_LEVEL > 2
  45. #error "GH_INLINE_LEVEL must be set 0, 1 or 2!"
  46. #endif
  47. #ifndef GH_INLINE
  48. #error "GH_INLINE is not defined!"
  49. #endif
  50. /* disable inlining for debugging */
  51. #ifdef DEBUG
  52. #undef GH_INLINE_LEVEL
  53. #define GH_INLINE_LEVEL 0
  54. #endif
  55. /*----------------------------------------------------------------------------*/
  56. /* registers */
  57. /*----------------------------------------------------------------------------*/
  58. #define REG_PMU_RTC_SYS_CONFIG FIO_ADDRESS(PMU_RTC,0x90080000) /* read/write */
  59. #define REG_PMU_RTC_P_SCALER_DIV0 FIO_ADDRESS(PMU_RTC,0x90080004) /* read/write */
  60. #define REG_PMU_RTC_P_SCALER_DIV1 FIO_ADDRESS(PMU_RTC,0x90080008) /* read/write */
  61. #define REG_PMU_RTC_P_SCALER_DIV2 FIO_ADDRESS(PMU_RTC,0x9008000C) /* read/write */
  62. #define REG_PMU_RTC_P_SCALER_DIV3 FIO_ADDRESS(PMU_RTC,0x90080010) /* read/write */
  63. #define REG_PMU_RTC_PRE_LOAD_HOUR FIO_ADDRESS(PMU_RTC,0x90080014) /* write */
  64. #define REG_PMU_RTC_PRE_LOAD_MIN FIO_ADDRESS(PMU_RTC,0x90080018) /* write */
  65. #define REG_PMU_RTC_PRE_LOAD_SEC FIO_ADDRESS(PMU_RTC,0x9008001C) /* write */
  66. #define REG_PMU_RTC_IRQ_CLEAR FIO_ADDRESS(PMU_RTC,0x90080020) /* write */
  67. #define REG_PMU_RTC_PRE_LOAD_DAY_L FIO_ADDRESS(PMU_RTC,0x90080024) /* write */
  68. #define REG_PMU_RTC_PRE_LOAD_DAY_H FIO_ADDRESS(PMU_RTC,0x90080028) /* write */
  69. #define REG_PMU_RTC_IRQ_STATUS FIO_ADDRESS(PMU_RTC,0x90080068) /* read */
  70. #define REG_PMU_RTC_SEC_VALUE FIO_ADDRESS(PMU_RTC,0x9008006c) /* read */
  71. #define REG_PMU_RTC_MIN_VALUE FIO_ADDRESS(PMU_RTC,0x90080070) /* read */
  72. #define REG_PMU_RTC_HOUR_VALUE FIO_ADDRESS(PMU_RTC,0x90080074) /* read */
  73. #define REG_PMU_RTC_DAY_L_VALUE FIO_ADDRESS(PMU_RTC,0x90080078) /* read */
  74. #define REG_PMU_RTC_DAY_H_VALUE FIO_ADDRESS(PMU_RTC,0x9008007c) /* read */
  75. /*----------------------------------------------------------------------------*/
  76. /* bit group structures */
  77. /*----------------------------------------------------------------------------*/
  78. typedef union { /* PMU_RTC_SYS_CONFIG */
  79. U8 all;
  80. struct {
  81. U8 enable : 1;
  82. U8 : 2;
  83. U8 stop : 1;
  84. U8 pause : 1;
  85. U8 irq : 1;
  86. U8 : 2;
  87. } bitc;
  88. } GH_PMU_RTC_SYS_CONFIG_S;
  89. typedef union { /* PMU_RTC_IRQ_CLEAR */
  90. U8 all;
  91. struct {
  92. U8 clear : 1;
  93. U8 : 7;
  94. } bitc;
  95. } GH_PMU_RTC_IRQ_CLEAR_S;
  96. typedef union { /* PMU_RTC_IRQ_STATUS */
  97. U32 all;
  98. struct {
  99. U32 gen : 1;
  100. U32 : 31;
  101. } bitc;
  102. } GH_PMU_RTC_IRQ_STATUS_S;
  103. /*----------------------------------------------------------------------------*/
  104. /* mirror variables */
  105. /*----------------------------------------------------------------------------*/
  106. extern U8 m_pmu_rtc_pre_load_hour;
  107. extern U8 m_pmu_rtc_pre_load_min;
  108. extern U8 m_pmu_rtc_pre_load_sec;
  109. extern GH_PMU_RTC_IRQ_CLEAR_S m_pmu_rtc_irq_clear;
  110. extern U8 m_pmu_rtc_pre_load_day_l;
  111. extern U8 m_pmu_rtc_pre_load_day_h;
  112. #ifdef __cplusplus
  113. extern "C" {
  114. #endif
  115. /*----------------------------------------------------------------------------*/
  116. /* register PMU_RTC_SYS_CONFIG (read/write) */
  117. /*----------------------------------------------------------------------------*/
  118. #if GH_INLINE_LEVEL == 0
  119. /*! \brief Writes the register 'PMU_RTC_SYS_CONFIG'. */
  120. void GH_PMU_RTC_set_SYS_CONFIG(U8 data);
  121. /*! \brief Reads the register 'PMU_RTC_SYS_CONFIG'. */
  122. U8 GH_PMU_RTC_get_SYS_CONFIG(void);
  123. /*! \brief Writes the bit group 'Enable' of register 'PMU_RTC_SYS_CONFIG'. */
  124. void GH_PMU_RTC_set_SYS_CONFIG_Enable(U8 data);
  125. /*! \brief Reads the bit group 'Enable' of register 'PMU_RTC_SYS_CONFIG'. */
  126. U8 GH_PMU_RTC_get_SYS_CONFIG_Enable(void);
  127. /*! \brief Writes the bit group 'Stop' of register 'PMU_RTC_SYS_CONFIG'. */
  128. void GH_PMU_RTC_set_SYS_CONFIG_Stop(U8 data);
  129. /*! \brief Reads the bit group 'Stop' of register 'PMU_RTC_SYS_CONFIG'. */
  130. U8 GH_PMU_RTC_get_SYS_CONFIG_Stop(void);
  131. /*! \brief Writes the bit group 'Pause' of register 'PMU_RTC_SYS_CONFIG'. */
  132. void GH_PMU_RTC_set_SYS_CONFIG_Pause(U8 data);
  133. /*! \brief Reads the bit group 'Pause' of register 'PMU_RTC_SYS_CONFIG'. */
  134. U8 GH_PMU_RTC_get_SYS_CONFIG_Pause(void);
  135. /*! \brief Writes the bit group 'IRQ' of register 'PMU_RTC_SYS_CONFIG'. */
  136. void GH_PMU_RTC_set_SYS_CONFIG_IRQ(U8 data);
  137. /*! \brief Reads the bit group 'IRQ' of register 'PMU_RTC_SYS_CONFIG'. */
  138. U8 GH_PMU_RTC_get_SYS_CONFIG_IRQ(void);
  139. #else /* GH_INLINE_LEVEL == 0 */
  140. GH_INLINE void GH_PMU_RTC_set_SYS_CONFIG(U8 data)
  141. {
  142. *(volatile U8 *)REG_PMU_RTC_SYS_CONFIG = data;
  143. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  144. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_SYS_CONFIG] <-- 0x%08x\n",
  145. REG_PMU_RTC_SYS_CONFIG,data,data);
  146. #endif
  147. }
  148. GH_INLINE U8 GH_PMU_RTC_get_SYS_CONFIG(void)
  149. {
  150. U8 value = (*(volatile U8 *)REG_PMU_RTC_SYS_CONFIG);
  151. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  152. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_SYS_CONFIG] --> 0x%08x\n",
  153. REG_PMU_RTC_SYS_CONFIG,value);
  154. #endif
  155. return value;
  156. }
  157. GH_INLINE void GH_PMU_RTC_set_SYS_CONFIG_Enable(U8 data)
  158. {
  159. GH_PMU_RTC_SYS_CONFIG_S d;
  160. d.all = *(volatile U8 *)REG_PMU_RTC_SYS_CONFIG;
  161. d.bitc.enable = data;
  162. *(volatile U8 *)REG_PMU_RTC_SYS_CONFIG = d.all;
  163. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  164. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_SYS_CONFIG_Enable] <-- 0x%08x\n",
  165. REG_PMU_RTC_SYS_CONFIG,d.all,d.all);
  166. #endif
  167. }
  168. GH_INLINE U8 GH_PMU_RTC_get_SYS_CONFIG_Enable(void)
  169. {
  170. GH_PMU_RTC_SYS_CONFIG_S tmp_value;
  171. U8 value = (*(volatile U8 *)REG_PMU_RTC_SYS_CONFIG);
  172. tmp_value.all = value;
  173. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  174. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_SYS_CONFIG_Enable] --> 0x%08x\n",
  175. REG_PMU_RTC_SYS_CONFIG,value);
  176. #endif
  177. return tmp_value.bitc.enable;
  178. }
  179. GH_INLINE void GH_PMU_RTC_set_SYS_CONFIG_Stop(U8 data)
  180. {
  181. GH_PMU_RTC_SYS_CONFIG_S d;
  182. d.all = *(volatile U8 *)REG_PMU_RTC_SYS_CONFIG;
  183. d.bitc.stop = data;
  184. *(volatile U8 *)REG_PMU_RTC_SYS_CONFIG = d.all;
  185. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  186. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_SYS_CONFIG_Stop] <-- 0x%08x\n",
  187. REG_PMU_RTC_SYS_CONFIG,d.all,d.all);
  188. #endif
  189. }
  190. GH_INLINE U8 GH_PMU_RTC_get_SYS_CONFIG_Stop(void)
  191. {
  192. GH_PMU_RTC_SYS_CONFIG_S tmp_value;
  193. U8 value = (*(volatile U8 *)REG_PMU_RTC_SYS_CONFIG);
  194. tmp_value.all = value;
  195. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  196. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_SYS_CONFIG_Stop] --> 0x%08x\n",
  197. REG_PMU_RTC_SYS_CONFIG,value);
  198. #endif
  199. return tmp_value.bitc.stop;
  200. }
  201. GH_INLINE void GH_PMU_RTC_set_SYS_CONFIG_Pause(U8 data)
  202. {
  203. GH_PMU_RTC_SYS_CONFIG_S d;
  204. d.all = *(volatile U8 *)REG_PMU_RTC_SYS_CONFIG;
  205. d.bitc.pause = data;
  206. *(volatile U8 *)REG_PMU_RTC_SYS_CONFIG = d.all;
  207. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  208. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_SYS_CONFIG_Pause] <-- 0x%08x\n",
  209. REG_PMU_RTC_SYS_CONFIG,d.all,d.all);
  210. #endif
  211. }
  212. GH_INLINE U8 GH_PMU_RTC_get_SYS_CONFIG_Pause(void)
  213. {
  214. GH_PMU_RTC_SYS_CONFIG_S tmp_value;
  215. U8 value = (*(volatile U8 *)REG_PMU_RTC_SYS_CONFIG);
  216. tmp_value.all = value;
  217. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  218. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_SYS_CONFIG_Pause] --> 0x%08x\n",
  219. REG_PMU_RTC_SYS_CONFIG,value);
  220. #endif
  221. return tmp_value.bitc.pause;
  222. }
  223. GH_INLINE void GH_PMU_RTC_set_SYS_CONFIG_IRQ(U8 data)
  224. {
  225. GH_PMU_RTC_SYS_CONFIG_S d;
  226. d.all = *(volatile U8 *)REG_PMU_RTC_SYS_CONFIG;
  227. d.bitc.irq = data;
  228. *(volatile U8 *)REG_PMU_RTC_SYS_CONFIG = d.all;
  229. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  230. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_SYS_CONFIG_IRQ] <-- 0x%08x\n",
  231. REG_PMU_RTC_SYS_CONFIG,d.all,d.all);
  232. #endif
  233. }
  234. GH_INLINE U8 GH_PMU_RTC_get_SYS_CONFIG_IRQ(void)
  235. {
  236. GH_PMU_RTC_SYS_CONFIG_S tmp_value;
  237. U8 value = (*(volatile U8 *)REG_PMU_RTC_SYS_CONFIG);
  238. tmp_value.all = value;
  239. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  240. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_SYS_CONFIG_IRQ] --> 0x%08x\n",
  241. REG_PMU_RTC_SYS_CONFIG,value);
  242. #endif
  243. return tmp_value.bitc.irq;
  244. }
  245. #endif /* GH_INLINE_LEVEL == 0 */
  246. /*----------------------------------------------------------------------------*/
  247. /* register PMU_RTC_P_SCALER_DIV0 (read/write) */
  248. /*----------------------------------------------------------------------------*/
  249. #if GH_INLINE_LEVEL == 0
  250. /*! \brief Writes the register 'PMU_RTC_P_SCALER_DIV0'. */
  251. void GH_PMU_RTC_set_P_SCALER_DIV0(U8 data);
  252. /*! \brief Reads the register 'PMU_RTC_P_SCALER_DIV0'. */
  253. U8 GH_PMU_RTC_get_P_SCALER_DIV0(void);
  254. #else /* GH_INLINE_LEVEL == 0 */
  255. GH_INLINE void GH_PMU_RTC_set_P_SCALER_DIV0(U8 data)
  256. {
  257. *(volatile U8 *)REG_PMU_RTC_P_SCALER_DIV0 = data;
  258. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  259. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_P_SCALER_DIV0] <-- 0x%08x\n",
  260. REG_PMU_RTC_P_SCALER_DIV0,data,data);
  261. #endif
  262. }
  263. GH_INLINE U8 GH_PMU_RTC_get_P_SCALER_DIV0(void)
  264. {
  265. U8 value = (*(volatile U8 *)REG_PMU_RTC_P_SCALER_DIV0);
  266. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  267. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_P_SCALER_DIV0] --> 0x%08x\n",
  268. REG_PMU_RTC_P_SCALER_DIV0,value);
  269. #endif
  270. return value;
  271. }
  272. #endif /* GH_INLINE_LEVEL == 0 */
  273. /*----------------------------------------------------------------------------*/
  274. /* register PMU_RTC_P_SCALER_DIV1 (read/write) */
  275. /*----------------------------------------------------------------------------*/
  276. #if GH_INLINE_LEVEL == 0
  277. /*! \brief Writes the register 'PMU_RTC_P_SCALER_DIV1'. */
  278. void GH_PMU_RTC_set_P_SCALER_DIV1(U8 data);
  279. /*! \brief Reads the register 'PMU_RTC_P_SCALER_DIV1'. */
  280. U8 GH_PMU_RTC_get_P_SCALER_DIV1(void);
  281. #else /* GH_INLINE_LEVEL == 0 */
  282. GH_INLINE void GH_PMU_RTC_set_P_SCALER_DIV1(U8 data)
  283. {
  284. *(volatile U8 *)REG_PMU_RTC_P_SCALER_DIV1 = data;
  285. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  286. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_P_SCALER_DIV1] <-- 0x%08x\n",
  287. REG_PMU_RTC_P_SCALER_DIV1,data,data);
  288. #endif
  289. }
  290. GH_INLINE U8 GH_PMU_RTC_get_P_SCALER_DIV1(void)
  291. {
  292. U8 value = (*(volatile U8 *)REG_PMU_RTC_P_SCALER_DIV1);
  293. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  294. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_P_SCALER_DIV1] --> 0x%08x\n",
  295. REG_PMU_RTC_P_SCALER_DIV1,value);
  296. #endif
  297. return value;
  298. }
  299. #endif /* GH_INLINE_LEVEL == 0 */
  300. /*----------------------------------------------------------------------------*/
  301. /* register PMU_RTC_P_SCALER_DIV2 (read/write) */
  302. /*----------------------------------------------------------------------------*/
  303. #if GH_INLINE_LEVEL == 0
  304. /*! \brief Writes the register 'PMU_RTC_P_SCALER_DIV2'. */
  305. void GH_PMU_RTC_set_P_SCALER_DIV2(U8 data);
  306. /*! \brief Reads the register 'PMU_RTC_P_SCALER_DIV2'. */
  307. U8 GH_PMU_RTC_get_P_SCALER_DIV2(void);
  308. #else /* GH_INLINE_LEVEL == 0 */
  309. GH_INLINE void GH_PMU_RTC_set_P_SCALER_DIV2(U8 data)
  310. {
  311. *(volatile U8 *)REG_PMU_RTC_P_SCALER_DIV2 = data;
  312. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  313. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_P_SCALER_DIV2] <-- 0x%08x\n",
  314. REG_PMU_RTC_P_SCALER_DIV2,data,data);
  315. #endif
  316. }
  317. GH_INLINE U8 GH_PMU_RTC_get_P_SCALER_DIV2(void)
  318. {
  319. U8 value = (*(volatile U8 *)REG_PMU_RTC_P_SCALER_DIV2);
  320. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  321. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_P_SCALER_DIV2] --> 0x%08x\n",
  322. REG_PMU_RTC_P_SCALER_DIV2,value);
  323. #endif
  324. return value;
  325. }
  326. #endif /* GH_INLINE_LEVEL == 0 */
  327. /*----------------------------------------------------------------------------*/
  328. /* register PMU_RTC_P_SCALER_DIV3 (read/write) */
  329. /*----------------------------------------------------------------------------*/
  330. #if GH_INLINE_LEVEL == 0
  331. /*! \brief Writes the register 'PMU_RTC_P_SCALER_DIV3'. */
  332. void GH_PMU_RTC_set_P_SCALER_DIV3(U8 data);
  333. /*! \brief Reads the register 'PMU_RTC_P_SCALER_DIV3'. */
  334. U8 GH_PMU_RTC_get_P_SCALER_DIV3(void);
  335. #else /* GH_INLINE_LEVEL == 0 */
  336. GH_INLINE void GH_PMU_RTC_set_P_SCALER_DIV3(U8 data)
  337. {
  338. *(volatile U8 *)REG_PMU_RTC_P_SCALER_DIV3 = data;
  339. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  340. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_P_SCALER_DIV3] <-- 0x%08x\n",
  341. REG_PMU_RTC_P_SCALER_DIV3,data,data);
  342. #endif
  343. }
  344. GH_INLINE U8 GH_PMU_RTC_get_P_SCALER_DIV3(void)
  345. {
  346. U8 value = (*(volatile U8 *)REG_PMU_RTC_P_SCALER_DIV3);
  347. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  348. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_P_SCALER_DIV3] --> 0x%08x\n",
  349. REG_PMU_RTC_P_SCALER_DIV3,value);
  350. #endif
  351. return value;
  352. }
  353. #endif /* GH_INLINE_LEVEL == 0 */
  354. /*----------------------------------------------------------------------------*/
  355. /* register PMU_RTC_PRE_LOAD_HOUR (write) */
  356. /*----------------------------------------------------------------------------*/
  357. #if GH_INLINE_LEVEL < 2
  358. /*! \brief Writes the register 'PMU_RTC_PRE_LOAD_HOUR'. */
  359. void GH_PMU_RTC_set_PRE_LOAD_HOUR(U8 data);
  360. /*! \brief Reads the mirror variable of the register 'PMU_RTC_PRE_LOAD_HOUR'. */
  361. U8 GH_PMU_RTC_getm_PRE_LOAD_HOUR(void);
  362. #else /* GH_INLINE_LEVEL < 2 */
  363. GH_INLINE void GH_PMU_RTC_set_PRE_LOAD_HOUR(U8 data)
  364. {
  365. m_pmu_rtc_pre_load_hour = data;
  366. *(volatile U8 *)REG_PMU_RTC_PRE_LOAD_HOUR = data;
  367. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  368. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_PRE_LOAD_HOUR] <-- 0x%08x\n",
  369. REG_PMU_RTC_PRE_LOAD_HOUR,data,data);
  370. #endif
  371. }
  372. GH_INLINE U8 GH_PMU_RTC_getm_PRE_LOAD_HOUR(void)
  373. {
  374. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  375. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "[GH_PMU_RTC_getm_PRE_LOAD_HOUR] --> 0x%08x\n",
  376. m_pmu_rtc_pre_load_hour);
  377. #endif
  378. return m_pmu_rtc_pre_load_hour;
  379. }
  380. #endif /* GH_INLINE_LEVEL < 2 */
  381. /*----------------------------------------------------------------------------*/
  382. /* register PMU_RTC_PRE_LOAD_MIN (write) */
  383. /*----------------------------------------------------------------------------*/
  384. #if GH_INLINE_LEVEL < 2
  385. /*! \brief Writes the register 'PMU_RTC_PRE_LOAD_MIN'. */
  386. void GH_PMU_RTC_set_PRE_LOAD_MIN(U8 data);
  387. /*! \brief Reads the mirror variable of the register 'PMU_RTC_PRE_LOAD_MIN'. */
  388. U8 GH_PMU_RTC_getm_PRE_LOAD_MIN(void);
  389. #else /* GH_INLINE_LEVEL < 2 */
  390. GH_INLINE void GH_PMU_RTC_set_PRE_LOAD_MIN(U8 data)
  391. {
  392. m_pmu_rtc_pre_load_min = data;
  393. *(volatile U8 *)REG_PMU_RTC_PRE_LOAD_MIN = data;
  394. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  395. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_PRE_LOAD_MIN] <-- 0x%08x\n",
  396. REG_PMU_RTC_PRE_LOAD_MIN,data,data);
  397. #endif
  398. }
  399. GH_INLINE U8 GH_PMU_RTC_getm_PRE_LOAD_MIN(void)
  400. {
  401. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  402. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "[GH_PMU_RTC_getm_PRE_LOAD_MIN] --> 0x%08x\n",
  403. m_pmu_rtc_pre_load_min);
  404. #endif
  405. return m_pmu_rtc_pre_load_min;
  406. }
  407. #endif /* GH_INLINE_LEVEL < 2 */
  408. /*----------------------------------------------------------------------------*/
  409. /* register PMU_RTC_PRE_LOAD_SEC (write) */
  410. /*----------------------------------------------------------------------------*/
  411. #if GH_INLINE_LEVEL < 2
  412. /*! \brief Writes the register 'PMU_RTC_PRE_LOAD_SEC'. */
  413. void GH_PMU_RTC_set_PRE_LOAD_SEC(U8 data);
  414. /*! \brief Reads the mirror variable of the register 'PMU_RTC_PRE_LOAD_SEC'. */
  415. U8 GH_PMU_RTC_getm_PRE_LOAD_SEC(void);
  416. #else /* GH_INLINE_LEVEL < 2 */
  417. GH_INLINE void GH_PMU_RTC_set_PRE_LOAD_SEC(U8 data)
  418. {
  419. m_pmu_rtc_pre_load_sec = data;
  420. *(volatile U8 *)REG_PMU_RTC_PRE_LOAD_SEC = data;
  421. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  422. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_PRE_LOAD_SEC] <-- 0x%08x\n",
  423. REG_PMU_RTC_PRE_LOAD_SEC,data,data);
  424. #endif
  425. }
  426. GH_INLINE U8 GH_PMU_RTC_getm_PRE_LOAD_SEC(void)
  427. {
  428. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  429. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "[GH_PMU_RTC_getm_PRE_LOAD_SEC] --> 0x%08x\n",
  430. m_pmu_rtc_pre_load_sec);
  431. #endif
  432. return m_pmu_rtc_pre_load_sec;
  433. }
  434. #endif /* GH_INLINE_LEVEL < 2 */
  435. /*----------------------------------------------------------------------------*/
  436. /* register PMU_RTC_IRQ_CLEAR (write) */
  437. /*----------------------------------------------------------------------------*/
  438. #if GH_INLINE_LEVEL < 2
  439. /*! \brief Writes the register 'PMU_RTC_IRQ_CLEAR'. */
  440. void GH_PMU_RTC_set_IRQ_CLEAR(U8 data);
  441. /*! \brief Reads the mirror variable of the register 'PMU_RTC_IRQ_CLEAR'. */
  442. U8 GH_PMU_RTC_getm_IRQ_CLEAR(void);
  443. /*! \brief Writes the bit group 'Clear' of register 'PMU_RTC_IRQ_CLEAR'. */
  444. void GH_PMU_RTC_set_IRQ_CLEAR_Clear(U8 data);
  445. /*! \brief Reads the bit group 'Clear' from the mirror variable of register 'PMU_RTC_IRQ_CLEAR'. */
  446. U8 GH_PMU_RTC_getm_IRQ_CLEAR_Clear(void);
  447. #else /* GH_INLINE_LEVEL < 2 */
  448. GH_INLINE void GH_PMU_RTC_set_IRQ_CLEAR(U8 data)
  449. {
  450. m_pmu_rtc_irq_clear.all = data;
  451. *(volatile U8 *)REG_PMU_RTC_IRQ_CLEAR = data;
  452. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  453. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_IRQ_CLEAR] <-- 0x%08x\n",
  454. REG_PMU_RTC_IRQ_CLEAR,data,data);
  455. #endif
  456. }
  457. GH_INLINE U8 GH_PMU_RTC_getm_IRQ_CLEAR(void)
  458. {
  459. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  460. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "[GH_PMU_RTC_getm_IRQ_CLEAR] --> 0x%08x\n",
  461. m_pmu_rtc_irq_clear.all);
  462. #endif
  463. return m_pmu_rtc_irq_clear.all;
  464. }
  465. GH_INLINE void GH_PMU_RTC_set_IRQ_CLEAR_Clear(U8 data)
  466. {
  467. m_pmu_rtc_irq_clear.bitc.clear = data;
  468. *(volatile U8 *)REG_PMU_RTC_IRQ_CLEAR = m_pmu_rtc_irq_clear.all;
  469. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  470. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_IRQ_CLEAR_Clear] <-- 0x%08x\n",
  471. REG_PMU_RTC_IRQ_CLEAR,m_pmu_rtc_irq_clear.all,m_pmu_rtc_irq_clear.all);
  472. #endif
  473. }
  474. GH_INLINE U8 GH_PMU_RTC_getm_IRQ_CLEAR_Clear(void)
  475. {
  476. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  477. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "[GH_PMU_RTC_getm_IRQ_CLEAR_Clear] --> 0x%08x\n",
  478. m_pmu_rtc_irq_clear.bitc.clear);
  479. #endif
  480. return m_pmu_rtc_irq_clear.bitc.clear;
  481. }
  482. #endif /* GH_INLINE_LEVEL < 2 */
  483. /*----------------------------------------------------------------------------*/
  484. /* register PMU_RTC_PRE_LOAD_DAY_L (write) */
  485. /*----------------------------------------------------------------------------*/
  486. #if GH_INLINE_LEVEL < 2
  487. /*! \brief Writes the register 'PMU_RTC_PRE_LOAD_DAY_L'. */
  488. void GH_PMU_RTC_set_PRE_LOAD_DAY_L(U8 data);
  489. /*! \brief Reads the mirror variable of the register 'PMU_RTC_PRE_LOAD_DAY_L'. */
  490. U8 GH_PMU_RTC_getm_PRE_LOAD_DAY_L(void);
  491. #else /* GH_INLINE_LEVEL < 2 */
  492. GH_INLINE void GH_PMU_RTC_set_PRE_LOAD_DAY_L(U8 data)
  493. {
  494. m_pmu_rtc_pre_load_day_l = data;
  495. *(volatile U8 *)REG_PMU_RTC_PRE_LOAD_DAY_L = data;
  496. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  497. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_PRE_LOAD_DAY_L] <-- 0x%08x\n",
  498. REG_PMU_RTC_PRE_LOAD_DAY_L,data,data);
  499. #endif
  500. }
  501. GH_INLINE U8 GH_PMU_RTC_getm_PRE_LOAD_DAY_L(void)
  502. {
  503. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  504. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "[GH_PMU_RTC_getm_PRE_LOAD_DAY_L] --> 0x%08x\n",
  505. m_pmu_rtc_pre_load_day_l);
  506. #endif
  507. return m_pmu_rtc_pre_load_day_l;
  508. }
  509. #endif /* GH_INLINE_LEVEL < 2 */
  510. /*----------------------------------------------------------------------------*/
  511. /* register PMU_RTC_PRE_LOAD_DAY_H (write) */
  512. /*----------------------------------------------------------------------------*/
  513. #if GH_INLINE_LEVEL < 2
  514. /*! \brief Writes the register 'PMU_RTC_PRE_LOAD_DAY_H'. */
  515. void GH_PMU_RTC_set_PRE_LOAD_DAY_H(U8 data);
  516. /*! \brief Reads the mirror variable of the register 'PMU_RTC_PRE_LOAD_DAY_H'. */
  517. U8 GH_PMU_RTC_getm_PRE_LOAD_DAY_H(void);
  518. #else /* GH_INLINE_LEVEL < 2 */
  519. GH_INLINE void GH_PMU_RTC_set_PRE_LOAD_DAY_H(U8 data)
  520. {
  521. m_pmu_rtc_pre_load_day_h = data;
  522. *(volatile U8 *)REG_PMU_RTC_PRE_LOAD_DAY_H = data;
  523. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  524. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_PMU_RTC_set_PRE_LOAD_DAY_H] <-- 0x%08x\n",
  525. REG_PMU_RTC_PRE_LOAD_DAY_H,data,data);
  526. #endif
  527. }
  528. GH_INLINE U8 GH_PMU_RTC_getm_PRE_LOAD_DAY_H(void)
  529. {
  530. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  531. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "[GH_PMU_RTC_getm_PRE_LOAD_DAY_H] --> 0x%08x\n",
  532. m_pmu_rtc_pre_load_day_h);
  533. #endif
  534. return m_pmu_rtc_pre_load_day_h;
  535. }
  536. #endif /* GH_INLINE_LEVEL < 2 */
  537. /*----------------------------------------------------------------------------*/
  538. /* register PMU_RTC_IRQ_STATUS (read) */
  539. /*----------------------------------------------------------------------------*/
  540. #if GH_INLINE_LEVEL == 0
  541. /*! \brief Reads the register 'PMU_RTC_IRQ_STATUS'. */
  542. U32 GH_PMU_RTC_get_IRQ_STATUS(void);
  543. /*! \brief Reads the bit group 'Gen' of register 'PMU_RTC_IRQ_STATUS'. */
  544. U8 GH_PMU_RTC_get_IRQ_STATUS_Gen(void);
  545. #else /* GH_INLINE_LEVEL == 0 */
  546. GH_INLINE U32 GH_PMU_RTC_get_IRQ_STATUS(void)
  547. {
  548. U32 value = (*(volatile U32 *)REG_PMU_RTC_IRQ_STATUS);
  549. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  550. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_IRQ_STATUS] --> 0x%08x\n",
  551. REG_PMU_RTC_IRQ_STATUS,value);
  552. #endif
  553. return value;
  554. }
  555. GH_INLINE U8 GH_PMU_RTC_get_IRQ_STATUS_Gen(void)
  556. {
  557. GH_PMU_RTC_IRQ_STATUS_S tmp_value;
  558. U32 value = (*(volatile U32 *)REG_PMU_RTC_IRQ_STATUS);
  559. tmp_value.all = value;
  560. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  561. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_IRQ_STATUS_Gen] --> 0x%08x\n",
  562. REG_PMU_RTC_IRQ_STATUS,value);
  563. #endif
  564. return tmp_value.bitc.gen;
  565. }
  566. #endif /* GH_INLINE_LEVEL == 0 */
  567. /*----------------------------------------------------------------------------*/
  568. /* register PMU_RTC_SEC_VALUE (read) */
  569. /*----------------------------------------------------------------------------*/
  570. #if GH_INLINE_LEVEL == 0
  571. /*! \brief Reads the register 'PMU_RTC_SEC_VALUE'. */
  572. U32 GH_PMU_RTC_get_SEC_VALUE(void);
  573. #else /* GH_INLINE_LEVEL == 0 */
  574. GH_INLINE U32 GH_PMU_RTC_get_SEC_VALUE(void)
  575. {
  576. U32 value = (*(volatile U32 *)REG_PMU_RTC_SEC_VALUE);
  577. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  578. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_SEC_VALUE] --> 0x%08x\n",
  579. REG_PMU_RTC_SEC_VALUE,value);
  580. #endif
  581. return value;
  582. }
  583. #endif /* GH_INLINE_LEVEL == 0 */
  584. /*----------------------------------------------------------------------------*/
  585. /* register PMU_RTC_MIN_VALUE (read) */
  586. /*----------------------------------------------------------------------------*/
  587. #if GH_INLINE_LEVEL == 0
  588. /*! \brief Reads the register 'PMU_RTC_MIN_VALUE'. */
  589. U32 GH_PMU_RTC_get_MIN_VALUE(void);
  590. #else /* GH_INLINE_LEVEL == 0 */
  591. GH_INLINE U32 GH_PMU_RTC_get_MIN_VALUE(void)
  592. {
  593. U32 value = (*(volatile U32 *)REG_PMU_RTC_MIN_VALUE);
  594. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  595. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_MIN_VALUE] --> 0x%08x\n",
  596. REG_PMU_RTC_MIN_VALUE,value);
  597. #endif
  598. return value;
  599. }
  600. #endif /* GH_INLINE_LEVEL == 0 */
  601. /*----------------------------------------------------------------------------*/
  602. /* register PMU_RTC_HOUR_VALUE (read) */
  603. /*----------------------------------------------------------------------------*/
  604. #if GH_INLINE_LEVEL == 0
  605. /*! \brief Reads the register 'PMU_RTC_HOUR_VALUE'. */
  606. U32 GH_PMU_RTC_get_HOUR_VALUE(void);
  607. #else /* GH_INLINE_LEVEL == 0 */
  608. GH_INLINE U32 GH_PMU_RTC_get_HOUR_VALUE(void)
  609. {
  610. U32 value = (*(volatile U32 *)REG_PMU_RTC_HOUR_VALUE);
  611. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  612. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_HOUR_VALUE] --> 0x%08x\n",
  613. REG_PMU_RTC_HOUR_VALUE,value);
  614. #endif
  615. return value;
  616. }
  617. #endif /* GH_INLINE_LEVEL == 0 */
  618. /*----------------------------------------------------------------------------*/
  619. /* register PMU_RTC_DAY_L_VALUE (read) */
  620. /*----------------------------------------------------------------------------*/
  621. #if GH_INLINE_LEVEL == 0
  622. /*! \brief Reads the register 'PMU_RTC_DAY_L_VALUE'. */
  623. U32 GH_PMU_RTC_get_DAY_L_VALUE(void);
  624. #else /* GH_INLINE_LEVEL == 0 */
  625. GH_INLINE U32 GH_PMU_RTC_get_DAY_L_VALUE(void)
  626. {
  627. U32 value = (*(volatile U32 *)REG_PMU_RTC_DAY_L_VALUE);
  628. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  629. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_DAY_L_VALUE] --> 0x%08x\n",
  630. REG_PMU_RTC_DAY_L_VALUE,value);
  631. #endif
  632. return value;
  633. }
  634. #endif /* GH_INLINE_LEVEL == 0 */
  635. /*----------------------------------------------------------------------------*/
  636. /* register PMU_RTC_DAY_H_VALUE (read) */
  637. /*----------------------------------------------------------------------------*/
  638. #if GH_INLINE_LEVEL == 0
  639. /*! \brief Reads the register 'PMU_RTC_DAY_H_VALUE'. */
  640. U32 GH_PMU_RTC_get_DAY_H_VALUE(void);
  641. #else /* GH_INLINE_LEVEL == 0 */
  642. GH_INLINE U32 GH_PMU_RTC_get_DAY_H_VALUE(void)
  643. {
  644. U32 value = (*(volatile U32 *)REG_PMU_RTC_DAY_H_VALUE);
  645. #if GH_PMU_RTC_ENABLE_DEBUG_PRINT
  646. GH_PMU_RTC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_PMU_RTC_get_DAY_H_VALUE] --> 0x%08x\n",
  647. REG_PMU_RTC_DAY_H_VALUE,value);
  648. #endif
  649. return value;
  650. }
  651. #endif /* GH_INLINE_LEVEL == 0 */
  652. /*----------------------------------------------------------------------------*/
  653. /* init function */
  654. /*----------------------------------------------------------------------------*/
  655. /*! \brief Initialises the registers and mirror variables. */
  656. void GH_PMU_RTC_init(void);
  657. #ifdef __cplusplus
  658. }
  659. #endif
  660. #endif /* _GH_PMU_RTC_H */
  661. /*----------------------------------------------------------------------------*/
  662. /* end of file */
  663. /*----------------------------------------------------------------------------*/