systimer_struct.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. /** Copyright 2021 Espressif Systems (Shanghai) PTE LTD
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #pragma once
  16. #include <stdint.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /** Configuration Register */
  21. /** Type of conf register
  22. * SYSTIMER_CONF.
  23. */
  24. typedef union {
  25. struct {
  26. /** systimer_clk_fo : R/W; bitpos: [0]; default: 0;
  27. * systimer clock force on
  28. */
  29. uint32_t systimer_clk_fo: 1;
  30. uint32_t reserved_1: 21;
  31. /** target2_work_en : R/W; bitpos: [22]; default: 0;
  32. * target2 work enable
  33. */
  34. uint32_t target2_work_en: 1;
  35. /** target1_work_en : R/W; bitpos: [23]; default: 0;
  36. * target1 work enable
  37. */
  38. uint32_t target1_work_en: 1;
  39. /** target0_work_en : R/W; bitpos: [24]; default: 0;
  40. * target0 work enable
  41. */
  42. uint32_t target0_work_en: 1;
  43. /** timer_unit1_core1_stall_en : R/W; bitpos: [25]; default: 1;
  44. * If timer unit1 is stalled when core1 stalled
  45. */
  46. uint32_t timer_unit1_core1_stall_en: 1;
  47. /** timer_unit1_core0_stall_en : R/W; bitpos: [26]; default: 1;
  48. * If timer unit1 is stalled when core0 stalled
  49. */
  50. uint32_t timer_unit1_core0_stall_en: 1;
  51. /** timer_unit0_core1_stall_en : R/W; bitpos: [27]; default: 0;
  52. * If timer unit0 is stalled when core1 stalled
  53. */
  54. uint32_t timer_unit0_core1_stall_en: 1;
  55. /** timer_unit0_core0_stall_en : R/W; bitpos: [28]; default: 0;
  56. * If timer unit0 is stalled when core0 stalled
  57. */
  58. uint32_t timer_unit0_core0_stall_en: 1;
  59. /** timer_unit1_work_en : R/W; bitpos: [29]; default: 0;
  60. * timer unit1 work enable
  61. */
  62. uint32_t timer_unit1_work_en: 1;
  63. /** timer_unit0_work_en : R/W; bitpos: [30]; default: 1;
  64. * timer unit0 work enable
  65. */
  66. uint32_t timer_unit0_work_en: 1;
  67. /** clk_en : R/W; bitpos: [31]; default: 0;
  68. * register file clk gating
  69. */
  70. uint32_t clk_en: 1;
  71. };
  72. uint32_t val;
  73. } systimer_conf_reg_t;
  74. /** Type of unit_op register
  75. * SYSTIMER_UNIT_OP.
  76. */
  77. typedef union {
  78. struct {
  79. uint32_t reserved_0: 29;
  80. /** timer_unit_value_valid : R/SS/WTC; bitpos: [29]; default: 0;
  81. * reg_timer_unit0_value_valid
  82. */
  83. uint32_t timer_unit_value_valid: 1;
  84. /** timer_unit_update : WT; bitpos: [30]; default: 0;
  85. * update timer_unit0
  86. */
  87. uint32_t timer_unit_update: 1;
  88. uint32_t reserved31: 1;
  89. };
  90. uint32_t val;
  91. } systimer_unit_op_reg_t;
  92. /** Type of unit_load register
  93. * SYSTIMER_UNIT_LOAD
  94. */
  95. typedef struct {
  96. union {
  97. struct {
  98. /** timer_unit_load_hi : R/W; bitpos: [19:0]; default: 0;
  99. * timer unit load high 32 bit
  100. */
  101. uint32_t timer_unit_load_hi: 20;
  102. uint32_t reserved20: 12;
  103. };
  104. uint32_t val;
  105. } hi;
  106. union {
  107. struct {
  108. /** timer_unit_load_lo : R/W; bitpos: [31:0]; default: 0;
  109. * timer unit load low 32 bit
  110. */
  111. uint32_t timer_unit_load_lo: 32;
  112. };
  113. uint32_t val;
  114. } lo;
  115. } systimer_unit_load_val_reg_t;
  116. /** Type of target register
  117. * SYSTIMER_TARGET.
  118. */
  119. typedef struct {
  120. union {
  121. struct {
  122. /** timer_target_hi : R/W; bitpos: [19:0]; default: 0;
  123. * timer target high 32 bit
  124. */
  125. uint32_t timer_target_hi: 20;
  126. uint32_t reserved20: 12;
  127. };
  128. uint32_t val;
  129. } hi;
  130. union {
  131. struct {
  132. /** timer_target_lo : R/W; bitpos: [31:0]; default: 0;
  133. * timer target low 32 bit
  134. */
  135. uint32_t timer_target_lo: 32;
  136. };
  137. uint32_t val;
  138. } lo;
  139. } systimer_target_val_reg_t;
  140. /** Type of target_conf register
  141. * SYSTIMER_TARGET_CONF.
  142. */
  143. typedef union {
  144. struct {
  145. /** target_period : R/W; bitpos: [25:0]; default: 0;
  146. * target period
  147. */
  148. uint32_t target_period: 26;
  149. uint32_t reserved_26: 4;
  150. /** target_period_mode : R/W; bitpos: [30]; default: 0;
  151. * Set target to period mode
  152. */
  153. uint32_t target_period_mode: 1;
  154. /** target_timer_unit_sel : R/W; bitpos: [31]; default: 0;
  155. * select which unit to compare
  156. */
  157. uint32_t target_timer_unit_sel: 1;
  158. };
  159. uint32_t val;
  160. } systimer_target_conf_reg_t;
  161. /** Type of unit_value_hi register
  162. * SYSTIMER_UNIT_VALUE_HI.
  163. */
  164. typedef struct {
  165. union {
  166. struct {
  167. /** timer_unit_value_hi : RO; bitpos: [19:0]; default: 0;
  168. * timer read value high 20bit
  169. */
  170. uint32_t timer_unit_value_hi: 20;
  171. uint32_t reserved20: 12;
  172. };
  173. uint32_t val;
  174. } hi;
  175. union {
  176. struct {
  177. /** timer_unit_value_lo : RO; bitpos: [31:0]; default: 0;
  178. * timer read value low 32bit
  179. */
  180. uint32_t timer_unit_value_lo: 32;
  181. };
  182. uint32_t val;
  183. } lo;
  184. } systimer_unit_value_reg_t;
  185. /** Type of comp_load register
  186. * SYSTIMER_COMP_LOAD.
  187. */
  188. typedef union {
  189. struct {
  190. /** timer_comp_load : WT; bitpos: [0]; default: 0;
  191. * timer comp load value
  192. */
  193. uint32_t timer_comp_load: 1;
  194. uint32_t reserved1: 31;
  195. };
  196. uint32_t val;
  197. } systimer_comp_load_reg_t;
  198. /** Type of unit_load register
  199. * SYSTIMER_UNIT_LOAD.
  200. */
  201. typedef union {
  202. struct {
  203. /** timer_unit_load : WT; bitpos: [0]; default: 0;
  204. * timer unit load value
  205. */
  206. uint32_t timer_unit_load: 1;
  207. uint32_t reserved1: 31;
  208. };
  209. uint32_t val;
  210. } systimer_unit_load_reg_t;
  211. /** Interrupt Register */
  212. /** Type of int_ena register
  213. * SYSTIMER_INT_ENA.
  214. */
  215. typedef union {
  216. struct {
  217. /** target0_int_ena : R/W; bitpos: [0]; default: 0;
  218. * interupt0 enable
  219. */
  220. uint32_t target0_int_ena: 1;
  221. /** target1_int_ena : R/W; bitpos: [1]; default: 0;
  222. * interupt1 enable
  223. */
  224. uint32_t target1_int_ena: 1;
  225. /** target2_int_ena : R/W; bitpos: [2]; default: 0;
  226. * interupt2 enable
  227. */
  228. uint32_t target2_int_ena: 1;
  229. uint32_t reserved3: 29;
  230. };
  231. uint32_t val;
  232. } systimer_int_ena_reg_t;
  233. /** Type of int_raw register
  234. * SYSTIMER_INT_RAW.
  235. */
  236. typedef union {
  237. struct {
  238. /** target0_int_raw : R/WTC/SS; bitpos: [0]; default: 0;
  239. * interupt0 raw
  240. */
  241. uint32_t target0_int_raw: 1;
  242. /** target1_int_raw : R/WTC/SS; bitpos: [1]; default: 0;
  243. * interupt1 raw
  244. */
  245. uint32_t target1_int_raw: 1;
  246. /** target2_int_raw : R/WTC/SS; bitpos: [2]; default: 0;
  247. * interupt2 raw
  248. */
  249. uint32_t target2_int_raw: 1;
  250. uint32_t reserved3: 29;
  251. };
  252. uint32_t val;
  253. } systimer_int_raw_reg_t;
  254. /** Type of int_clr register
  255. * SYSTIMER_INT_CLR.
  256. */
  257. typedef union {
  258. struct {
  259. /** target0_int_clr : WT; bitpos: [0]; default: 0;
  260. * interupt0 clear
  261. */
  262. uint32_t target0_int_clr: 1;
  263. /** target1_int_clr : WT; bitpos: [1]; default: 0;
  264. * interupt1 clear
  265. */
  266. uint32_t target1_int_clr: 1;
  267. /** target2_int_clr : WT; bitpos: [2]; default: 0;
  268. * interupt2 clear
  269. */
  270. uint32_t target2_int_clr: 1;
  271. uint32_t reserved3: 29;
  272. };
  273. uint32_t val;
  274. } systimer_int_clr_reg_t;
  275. /** Type of int_st register
  276. * SYSTIMER_INT_ST.
  277. */
  278. typedef union {
  279. struct {
  280. /** target0_int_st : RO; bitpos: [0]; default: 0;
  281. * reg_target0_int_st
  282. */
  283. uint32_t target0_int_st: 1;
  284. /** target1_int_st : RO; bitpos: [1]; default: 0;
  285. * reg_target1_int_st
  286. */
  287. uint32_t target1_int_st: 1;
  288. /** target2_int_st : RO; bitpos: [2]; default: 0;
  289. * reg_target2_int_st
  290. */
  291. uint32_t target2_int_st: 1;
  292. uint32_t reserved3: 29;
  293. };
  294. uint32_t val;
  295. } systimer_int_st_reg_t;
  296. /** Version Register */
  297. /** Type of date register
  298. * SYSTIMER_DATE.
  299. */
  300. typedef union {
  301. struct {
  302. /** date : R/W; bitpos: [31:0]; default: 33579377;
  303. * reg_date
  304. */
  305. uint32_t date: 32;
  306. };
  307. uint32_t val;
  308. } systimer_date_reg_t;
  309. typedef struct {
  310. volatile systimer_conf_reg_t conf;
  311. volatile systimer_unit_op_reg_t unit_op[2];
  312. volatile systimer_unit_load_val_reg_t unit_load_val[2];
  313. volatile systimer_target_val_reg_t target_val[3];
  314. volatile systimer_target_conf_reg_t target_conf[3];
  315. volatile systimer_unit_value_reg_t unit_val[2];
  316. volatile systimer_comp_load_reg_t comp_load[3];
  317. volatile systimer_unit_load_reg_t unit_load[2];
  318. volatile systimer_int_ena_reg_t int_ena;
  319. volatile systimer_int_raw_reg_t int_raw;
  320. volatile systimer_int_clr_reg_t int_clr;
  321. volatile systimer_int_st_reg_t int_st;
  322. uint32_t reserved_074;
  323. uint32_t reserved_078;
  324. uint32_t reserved_07c;
  325. uint32_t reserved_080;
  326. uint32_t reserved_084;
  327. uint32_t reserved_088;
  328. uint32_t reserved_08c;
  329. uint32_t reserved_090;
  330. uint32_t reserved_094;
  331. uint32_t reserved_098;
  332. uint32_t reserved_09c;
  333. uint32_t reserved_0a0;
  334. uint32_t reserved_0a4;
  335. uint32_t reserved_0a8;
  336. uint32_t reserved_0ac;
  337. uint32_t reserved_0b0;
  338. uint32_t reserved_0b4;
  339. uint32_t reserved_0b8;
  340. uint32_t reserved_0bc;
  341. uint32_t reserved_0c0;
  342. uint32_t reserved_0c4;
  343. uint32_t reserved_0c8;
  344. uint32_t reserved_0cc;
  345. uint32_t reserved_0d0;
  346. uint32_t reserved_0d4;
  347. uint32_t reserved_0d8;
  348. uint32_t reserved_0dc;
  349. uint32_t reserved_0e0;
  350. uint32_t reserved_0e4;
  351. uint32_t reserved_0e8;
  352. uint32_t reserved_0ec;
  353. uint32_t reserved_0f0;
  354. uint32_t reserved_0f4;
  355. uint32_t reserved_0f8;
  356. volatile systimer_date_reg_t date;
  357. } systimer_dev_t;
  358. extern systimer_dev_t SYSTIMER;
  359. #ifdef __cplusplus
  360. }
  361. #endif