gpt_lite.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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 _GPT_LITE_H_
  13. #define _GPT_LITE_H_
  14. // Auto generated by dtools(see dtools.txt for its version).
  15. // Don't edit it manually!
  16. #define REG_AP_GPT_LITE_BASE (0x04809000)
  17. #define REG_LPS_GPT_LITE_BASE (0x5150d000)
  18. typedef volatile struct
  19. {
  20. uint32_t cr; // 0x00000000
  21. uint32_t smcr; // 0x00000004
  22. uint32_t egr; // 0x00000008
  23. uint32_t ccmr_oc; // 0x0000000c
  24. uint32_t ccmr_ic; // 0x00000010
  25. uint32_t ccer; // 0x00000014
  26. uint32_t cnt; // 0x00000018
  27. uint32_t psc; // 0x0000001c
  28. uint32_t arr; // 0x00000020
  29. uint32_t timer_ccr1_ic; // 0x00000024
  30. uint32_t timer_ccr2_ic; // 0x00000028
  31. uint32_t timer_ccr1_oc; // 0x0000002c
  32. uint32_t timer_ccr2_oc; // 0x00000030
  33. uint32_t isr; // 0x00000034
  34. uint32_t irsr; // 0x00000038
  35. uint32_t mask; // 0x0000003c
  36. uint32_t clr; // 0x00000040
  37. } HWP_GPT_LITE_T;
  38. #define hwp_apGptLite ((HWP_GPT_LITE_T *)REG_ACCESS_ADDRESS(REG_AP_GPT_LITE_BASE))
  39. #define hwp_lpsGptLite ((HWP_GPT_LITE_T *)REG_ACCESS_ADDRESS(REG_LPS_GPT_LITE_BASE))
  40. // cr
  41. typedef union {
  42. uint32_t v;
  43. struct
  44. {
  45. uint32_t cen : 1; // [0]
  46. uint32_t ckd : 2; // [2:1]
  47. uint32_t udis : 1; // [3]
  48. uint32_t opm : 1; // [4]
  49. uint32_t dir : 1; // [5]
  50. uint32_t cms : 2; // [7:6]
  51. uint32_t arpe : 1; // [8]
  52. uint32_t tri : 3; // [11:9]
  53. uint32_t tri_cnt_en : 1; // [12]
  54. uint32_t __30_13 : 18; // [30:13]
  55. uint32_t refclk_sel : 1; // [31]
  56. } b;
  57. } REG_GPT_LITE_CR_T;
  58. // smcr
  59. typedef union {
  60. uint32_t v;
  61. struct
  62. {
  63. uint32_t sms : 3; // [2:0]
  64. uint32_t __31_3 : 29; // [31:3]
  65. } b;
  66. } REG_GPT_LITE_SMCR_T;
  67. // egr
  68. typedef union {
  69. uint32_t v;
  70. struct
  71. {
  72. uint32_t ug : 1; // [0], read only
  73. uint32_t __31_1 : 31; // [31:1]
  74. } b;
  75. } REG_GPT_LITE_EGR_T;
  76. // ccmr_oc
  77. typedef union {
  78. uint32_t v;
  79. struct
  80. {
  81. uint32_t cc1s : 2; // [1:0]
  82. uint32_t oc1fe : 1; // [2]
  83. uint32_t oc1pe : 1; // [3]
  84. uint32_t oc1m : 3; // [6:4]
  85. uint32_t oc1ce : 1; // [7]
  86. uint32_t cc2s : 2; // [9:8]
  87. uint32_t oc2fe : 1; // [10]
  88. uint32_t oc2pe : 1; // [11]
  89. uint32_t oc2m : 3; // [14:12]
  90. uint32_t oc2ce : 1; // [15]
  91. uint32_t __31_16 : 16; // [31:16]
  92. } b;
  93. } REG_GPT_LITE_CCMR_OC_T;
  94. // ccmr_ic
  95. typedef union {
  96. uint32_t v;
  97. struct
  98. {
  99. uint32_t ic1psc : 2; // [1:0]
  100. uint32_t ic1f : 4; // [5:2]
  101. uint32_t __7_6 : 2; // [7:6]
  102. uint32_t ic2psc : 2; // [9:8]
  103. uint32_t ic2f : 4; // [13:10]
  104. uint32_t __31_14 : 18; // [31:14]
  105. } b;
  106. } REG_GPT_LITE_CCMR_IC_T;
  107. // ccer
  108. typedef union {
  109. uint32_t v;
  110. struct
  111. {
  112. uint32_t cc1e : 1; // [0]
  113. uint32_t cc1p : 1; // [1]
  114. uint32_t cc2e : 1; // [2]
  115. uint32_t cc2p : 1; // [3]
  116. uint32_t __31_4 : 28; // [31:4]
  117. } b;
  118. } REG_GPT_LITE_CCER_T;
  119. // cnt
  120. typedef union {
  121. uint32_t v;
  122. struct
  123. {
  124. uint32_t cnt_value : 16; // [15:0], read only
  125. uint32_t __31_16 : 16; // [31:16]
  126. } b;
  127. } REG_GPT_LITE_CNT_T;
  128. // psc
  129. typedef union {
  130. uint32_t v;
  131. struct
  132. {
  133. uint32_t psc_value : 16; // [15:0]
  134. uint32_t __31_16 : 16; // [31:16]
  135. } b;
  136. } REG_GPT_LITE_PSC_T;
  137. // arr
  138. typedef union {
  139. uint32_t v;
  140. struct
  141. {
  142. uint32_t arr_value : 16; // [15:0]
  143. uint32_t __31_16 : 16; // [31:16]
  144. } b;
  145. } REG_GPT_LITE_ARR_T;
  146. // timer_ccr1_ic
  147. typedef union {
  148. uint32_t v;
  149. struct
  150. {
  151. uint32_t timer_ccr1_capture : 16; // [15:0], read only
  152. uint32_t __31_16 : 16; // [31:16]
  153. } b;
  154. } REG_GPT_LITE_TIMER_CCR1_IC_T;
  155. // timer_ccr2_ic
  156. typedef union {
  157. uint32_t v;
  158. struct
  159. {
  160. uint32_t timer_ccr2_capture : 16; // [15:0], read only
  161. uint32_t __31_16 : 16; // [31:16]
  162. } b;
  163. } REG_GPT_LITE_TIMER_CCR2_IC_T;
  164. // timer_ccr1_oc
  165. typedef union {
  166. uint32_t v;
  167. struct
  168. {
  169. uint32_t timer_ccr1_compare : 16; // [15:0]
  170. uint32_t __31_16 : 16; // [31:16]
  171. } b;
  172. } REG_GPT_LITE_TIMER_CCR1_OC_T;
  173. // timer_ccr2_oc
  174. typedef union {
  175. uint32_t v;
  176. struct
  177. {
  178. uint32_t timer_ccr2_compare : 16; // [15:0]
  179. uint32_t __31_16 : 16; // [31:16]
  180. } b;
  181. } REG_GPT_LITE_TIMER_CCR2_OC_T;
  182. // isr
  183. typedef union {
  184. uint32_t v;
  185. struct
  186. {
  187. uint32_t compare_int : 4; // [3:0], read only
  188. uint32_t __11_4 : 8; // [11:4]
  189. uint32_t capture_int : 4; // [15:12], read only
  190. uint32_t __29_16 : 14; // [29:16]
  191. uint32_t slave_trig : 1; // [30], read only
  192. uint32_t event_update : 1; // [31], read only
  193. } b;
  194. } REG_GPT_LITE_ISR_T;
  195. // irsr
  196. typedef union {
  197. uint32_t v;
  198. struct
  199. {
  200. uint32_t compare_int : 4; // [3:0], read only
  201. uint32_t __11_4 : 8; // [11:4]
  202. uint32_t capture_int : 4; // [15:12], read only
  203. uint32_t __29_16 : 14; // [29:16]
  204. uint32_t slave_trig : 1; // [30], read only
  205. uint32_t event_update : 1; // [31], read only
  206. } b;
  207. } REG_GPT_LITE_IRSR_T;
  208. // mask
  209. typedef union {
  210. uint32_t v;
  211. struct
  212. {
  213. uint32_t compare_int : 4; // [3:0]
  214. uint32_t __11_4 : 8; // [11:4]
  215. uint32_t capture_int : 4; // [15:12]
  216. uint32_t __29_16 : 14; // [29:16]
  217. uint32_t slave_trig : 1; // [30]
  218. uint32_t event_update : 1; // [31]
  219. } b;
  220. } REG_GPT_LITE_MASK_T;
  221. // clr
  222. typedef union {
  223. uint32_t v;
  224. struct
  225. {
  226. uint32_t compare_int : 4; // [3:0], read only
  227. uint32_t __11_4 : 8; // [11:4]
  228. uint32_t capture_int : 4; // [15:12], read only
  229. uint32_t __29_16 : 14; // [29:16]
  230. uint32_t slave_trig : 1; // [30], read only
  231. uint32_t event_update : 1; // [31], read only
  232. } b;
  233. } REG_GPT_LITE_CLR_T;
  234. // cr
  235. #define GPT_LITE_CEN (1 << 0)
  236. #define GPT_LITE_CKD(n) (((n)&0x3) << 1)
  237. #define GPT_LITE_UDIS (1 << 3)
  238. #define GPT_LITE_OPM (1 << 4)
  239. #define GPT_LITE_DIR (1 << 5)
  240. #define GPT_LITE_CMS(n) (((n)&0x3) << 6)
  241. #define GPT_LITE_ARPE (1 << 8)
  242. #define GPT_LITE_TRI(n) (((n)&0x7) << 9)
  243. #define GPT_LITE_TRI_CNT_EN (1 << 12)
  244. #define GPT_LITE_REFCLK_SEL (1 << 31)
  245. // smcr
  246. #define GPT_LITE_SMS(n) (((n)&0x7) << 0)
  247. // egr
  248. #define GPT_LITE_UG (1 << 0)
  249. // ccmr_oc
  250. #define GPT_LITE_CC1S(n) (((n)&0x3) << 0)
  251. #define GPT_LITE_OC1FE (1 << 2)
  252. #define GPT_LITE_OC1PE (1 << 3)
  253. #define GPT_LITE_OC1M(n) (((n)&0x7) << 4)
  254. #define GPT_LITE_OC1CE (1 << 7)
  255. #define GPT_LITE_CC2S(n) (((n)&0x3) << 8)
  256. #define GPT_LITE_OC2FE (1 << 10)
  257. #define GPT_LITE_OC2PE (1 << 11)
  258. #define GPT_LITE_OC2M(n) (((n)&0x7) << 12)
  259. #define GPT_LITE_OC2CE (1 << 15)
  260. // ccmr_ic
  261. #define GPT_LITE_IC1PSC(n) (((n)&0x3) << 0)
  262. #define GPT_LITE_IC1F(n) (((n)&0xf) << 2)
  263. #define GPT_LITE_IC2PSC(n) (((n)&0x3) << 8)
  264. #define GPT_LITE_IC2F(n) (((n)&0xf) << 10)
  265. // ccer
  266. #define GPT_LITE_CC1E (1 << 0)
  267. #define GPT_LITE_CC1P (1 << 1)
  268. #define GPT_LITE_CC2E (1 << 2)
  269. #define GPT_LITE_CC2P (1 << 3)
  270. // cnt
  271. #define GPT_LITE_CNT_VALUE(n) (((n)&0xffff) << 0)
  272. // psc
  273. #define GPT_LITE_PSC_VALUE(n) (((n)&0xffff) << 0)
  274. // arr
  275. #define GPT_LITE_ARR_VALUE(n) (((n)&0xffff) << 0)
  276. // timer_ccr1_ic
  277. #define GPT_LITE_TIMER_CCR1_CAPTURE(n) (((n)&0xffff) << 0)
  278. // timer_ccr2_ic
  279. #define GPT_LITE_TIMER_CCR2_CAPTURE(n) (((n)&0xffff) << 0)
  280. // timer_ccr1_oc
  281. #define GPT_LITE_TIMER_CCR1_COMPARE(n) (((n)&0xffff) << 0)
  282. // timer_ccr2_oc
  283. #define GPT_LITE_TIMER_CCR2_COMPARE(n) (((n)&0xffff) << 0)
  284. // isr
  285. #define GPT_LITE_COMPARE_INT(n) (((n)&0xf) << 0)
  286. #define GPT_LITE_CAPTURE_INT(n) (((n)&0xf) << 12)
  287. #define GPT_LITE_SLAVE_TRIG (1 << 30)
  288. #define GPT_LITE_EVENT_UPDATE (1 << 31)
  289. // irsr
  290. #define GPT_LITE_COMPARE_INT(n) (((n)&0xf) << 0)
  291. #define GPT_LITE_CAPTURE_INT(n) (((n)&0xf) << 12)
  292. #define GPT_LITE_SLAVE_TRIG (1 << 30)
  293. #define GPT_LITE_EVENT_UPDATE (1 << 31)
  294. // mask
  295. #define GPT_LITE_COMPARE_INT(n) (((n)&0xf) << 0)
  296. #define GPT_LITE_CAPTURE_INT(n) (((n)&0xf) << 12)
  297. #define GPT_LITE_SLAVE_TRIG (1 << 30)
  298. #define GPT_LITE_EVENT_UPDATE (1 << 31)
  299. // clr
  300. #define GPT_LITE_COMPARE_INT(n) (((n)&0xf) << 0)
  301. #define GPT_LITE_CAPTURE_INT(n) (((n)&0xf) << 12)
  302. #define GPT_LITE_SLAVE_TRIG (1 << 30)
  303. #define GPT_LITE_EVENT_UPDATE (1 << 31)
  304. #endif // _GPT_LITE_H_