rtc_timer.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _RTC_TIMER_H_
  13. #define _RTC_TIMER_H_
  14. // Auto generated by dtools(see dtools.txt for its version).
  15. // Don't edit it manually!
  16. #define REG_RTC_TIMER_BASE (0x51708000)
  17. typedef volatile struct
  18. {
  19. uint32_t ctrl; // 0x00000000
  20. uint32_t cur_val_l; // 0x00000004
  21. uint32_t cur_val_m; // 0x00000008
  22. uint32_t cur_val_h; // 0x0000000c
  23. uint32_t alarm_val_l; // 0x00000010
  24. uint32_t alarm_val_m; // 0x00000014
  25. uint32_t alarm_val_h; // 0x00000018
  26. uint32_t load_val_l; // 0x0000001c
  27. uint32_t load_val_m; // 0x00000020
  28. uint32_t load_val_h; // 0x00000024
  29. uint32_t int_mask; // 0x00000028
  30. uint32_t int_clr; // 0x0000002c
  31. uint32_t int_status; // 0x00000030
  32. uint32_t int_cause; // 0x00000034
  33. } HWP_RTC_TIMER_T;
  34. #define hwp_rtcTimer ((HWP_RTC_TIMER_T *)REG_ACCESS_ADDRESS(REG_RTC_TIMER_BASE))
  35. // ctrl
  36. typedef union {
  37. uint32_t v;
  38. struct
  39. {
  40. uint32_t timer_enable : 1; // [0]
  41. uint32_t alarm_enable : 1; // [1]
  42. uint32_t wrap_int_enable : 1; // [2]
  43. uint32_t read_lock : 1; // [3], write clear
  44. uint32_t data_valid : 1; // [4], read only
  45. uint32_t data_valid_clr : 1; // [5], write clear
  46. uint32_t load_value : 1; // [6], write clear
  47. uint32_t __31_7 : 25; // [31:7]
  48. } b;
  49. } REG_RTC_TIMER_CTRL_T;
  50. // cur_val_l
  51. typedef union {
  52. uint32_t v;
  53. struct
  54. {
  55. uint32_t data : 16; // [15:0], read only
  56. uint32_t __31_16 : 16; // [31:16]
  57. } b;
  58. } REG_RTC_TIMER_CUR_VAL_L_T;
  59. // cur_val_m
  60. typedef union {
  61. uint32_t v;
  62. struct
  63. {
  64. uint32_t data : 16; // [15:0], read only
  65. uint32_t __31_16 : 16; // [31:16]
  66. } b;
  67. } REG_RTC_TIMER_CUR_VAL_M_T;
  68. // cur_val_h
  69. typedef union {
  70. uint32_t v;
  71. struct
  72. {
  73. uint32_t data : 16; // [15:0], read only
  74. uint32_t __31_16 : 16; // [31:16]
  75. } b;
  76. } REG_RTC_TIMER_CUR_VAL_H_T;
  77. // alarm_val_l
  78. typedef union {
  79. uint32_t v;
  80. struct
  81. {
  82. uint32_t data : 16; // [15:0]
  83. uint32_t __31_16 : 16; // [31:16]
  84. } b;
  85. } REG_RTC_TIMER_ALARM_VAL_L_T;
  86. // alarm_val_m
  87. typedef union {
  88. uint32_t v;
  89. struct
  90. {
  91. uint32_t data : 16; // [15:0]
  92. uint32_t __31_16 : 16; // [31:16]
  93. } b;
  94. } REG_RTC_TIMER_ALARM_VAL_M_T;
  95. // alarm_val_h
  96. typedef union {
  97. uint32_t v;
  98. struct
  99. {
  100. uint32_t data : 16; // [15:0]
  101. uint32_t __31_16 : 16; // [31:16]
  102. } b;
  103. } REG_RTC_TIMER_ALARM_VAL_H_T;
  104. // load_val_l
  105. typedef union {
  106. uint32_t v;
  107. struct
  108. {
  109. uint32_t data : 16; // [15:0]
  110. uint32_t __31_16 : 16; // [31:16]
  111. } b;
  112. } REG_RTC_TIMER_LOAD_VAL_L_T;
  113. // load_val_m
  114. typedef union {
  115. uint32_t v;
  116. struct
  117. {
  118. uint32_t data : 16; // [15:0]
  119. uint32_t __31_16 : 16; // [31:16]
  120. } b;
  121. } REG_RTC_TIMER_LOAD_VAL_M_T;
  122. // load_val_h
  123. typedef union {
  124. uint32_t v;
  125. struct
  126. {
  127. uint32_t data : 16; // [15:0]
  128. uint32_t __31_16 : 16; // [31:16]
  129. } b;
  130. } REG_RTC_TIMER_LOAD_VAL_H_T;
  131. // int_mask
  132. typedef union {
  133. uint32_t v;
  134. struct
  135. {
  136. uint32_t wrap : 1; // [0]
  137. uint32_t alarm : 1; // [1]
  138. uint32_t __31_2 : 30; // [31:2]
  139. } b;
  140. } REG_RTC_TIMER_INT_MASK_T;
  141. // int_clr
  142. typedef union {
  143. uint32_t v;
  144. struct
  145. {
  146. uint32_t wrap : 1; // [0], write clear
  147. uint32_t alarm : 1; // [1], write clear
  148. uint32_t __31_2 : 30; // [31:2]
  149. } b;
  150. } REG_RTC_TIMER_INT_CLR_T;
  151. // int_status
  152. typedef union {
  153. uint32_t v;
  154. struct
  155. {
  156. uint32_t wrap : 1; // [0], read only
  157. uint32_t alarm : 1; // [1], read only
  158. uint32_t __31_2 : 30; // [31:2]
  159. } b;
  160. } REG_RTC_TIMER_INT_STATUS_T;
  161. // int_cause
  162. typedef union {
  163. uint32_t v;
  164. struct
  165. {
  166. uint32_t wrap : 1; // [0], read only
  167. uint32_t alarm : 1; // [1], read only
  168. uint32_t __31_2 : 30; // [31:2]
  169. } b;
  170. } REG_RTC_TIMER_INT_CAUSE_T;
  171. // ctrl
  172. #define RTC_TIMER_TIMER_ENABLE (1 << 0)
  173. #define RTC_TIMER_ALARM_ENABLE (1 << 1)
  174. #define RTC_TIMER_WRAP_INT_ENABLE (1 << 2)
  175. #define RTC_TIMER_READ_LOCK (1 << 3)
  176. #define RTC_TIMER_DATA_VALID (1 << 4)
  177. #define RTC_TIMER_DATA_VALID_CLR (1 << 5)
  178. #define RTC_TIMER_LOAD_VALUE (1 << 6)
  179. // cur_val_l
  180. #define RTC_TIMER_DATA(n) (((n)&0xffff) << 0)
  181. // cur_val_m
  182. #define RTC_TIMER_DATA(n) (((n)&0xffff) << 0)
  183. // cur_val_h
  184. #define RTC_TIMER_DATA(n) (((n)&0xffff) << 0)
  185. // alarm_val_l
  186. #define RTC_TIMER_DATA(n) (((n)&0xffff) << 0)
  187. // alarm_val_m
  188. #define RTC_TIMER_DATA(n) (((n)&0xffff) << 0)
  189. // alarm_val_h
  190. #define RTC_TIMER_DATA(n) (((n)&0xffff) << 0)
  191. // load_val_l
  192. #define RTC_TIMER_DATA(n) (((n)&0xffff) << 0)
  193. // load_val_m
  194. #define RTC_TIMER_DATA(n) (((n)&0xffff) << 0)
  195. // load_val_h
  196. #define RTC_TIMER_DATA(n) (((n)&0xffff) << 0)
  197. // int_mask
  198. #define RTC_TIMER_WRAP (1 << 0)
  199. #define RTC_TIMER_ALARM (1 << 1)
  200. // int_clr
  201. #define RTC_TIMER_WRAP (1 << 0)
  202. #define RTC_TIMER_ALARM (1 << 1)
  203. // int_status
  204. #define RTC_TIMER_WRAP (1 << 0)
  205. #define RTC_TIMER_ALARM (1 << 1)
  206. // int_cause
  207. #define RTC_TIMER_WRAP (1 << 0)
  208. #define RTC_TIMER_ALARM (1 << 1)
  209. #endif // _RTC_TIMER_H_