med.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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 _MED_H_
  13. #define _MED_H_
  14. // Auto generated by dtools(see dtools.txt for its version).
  15. // Don't edit it manually!
  16. #define REG_MED_BASE (0x04000000)
  17. typedef volatile struct
  18. {
  19. uint32_t med_ch0_work_cfg; // 0x00000000
  20. uint32_t med_ch0_base_addr_cfg; // 0x00000004
  21. uint32_t med_ch0_addr_size_cfg; // 0x00000008
  22. uint32_t med_ch0_read_addr_remap; // 0x0000000c
  23. uint32_t __16[4]; // 0x00000010
  24. uint32_t med_ch1_work_cfg; // 0x00000020
  25. uint32_t med_ch1_base_addr_cfg; // 0x00000024
  26. uint32_t med_ch1_addr_size_cfg; // 0x00000028
  27. uint32_t med_ch1_read_addr_remap; // 0x0000002c
  28. uint32_t __48[4]; // 0x00000030
  29. uint32_t med_ch2_work_cfg; // 0x00000040
  30. uint32_t med_ch2_base_addr_cfg; // 0x00000044
  31. uint32_t med_ch2_addr_size_cfg; // 0x00000048
  32. uint32_t med_ch2_read_addr_remap; // 0x0000004c
  33. uint32_t __80[4]; // 0x00000050
  34. uint32_t med_ch3_work_cfg; // 0x00000060
  35. uint32_t med_ch3_base_addr_cfg; // 0x00000064
  36. uint32_t med_ch3_addr_size_cfg; // 0x00000068
  37. uint32_t med_ch3_read_addr_remap; // 0x0000006c
  38. uint32_t __112[32]; // 0x00000070
  39. uint32_t med_write_addr_remap; // 0x000000f0
  40. uint32_t med_write_base_addr_cfg; // 0x000000f4
  41. uint32_t med_write_addr_size_cfg; // 0x000000f8
  42. uint32_t __252[1]; // 0x000000fc
  43. uint32_t med_clr; // 0x00000100
  44. uint32_t med_work_mode; // 0x00000104
  45. uint32_t med_int_en; // 0x00000108
  46. uint32_t med_int_raw; // 0x0000010c
  47. uint32_t med_int_clear; // 0x00000110
  48. uint32_t med_error_addr; // 0x00000114
  49. uint32_t med_status0; // 0x00000118
  50. uint32_t med_status1; // 0x0000011c
  51. uint32_t med_status2; // 0x00000120
  52. uint32_t med_status3; // 0x00000124
  53. uint32_t med_soft_key; // 0x00000128
  54. } HWP_MED_T;
  55. #define hwp_med ((HWP_MED_T *)REG_ACCESS_ADDRESS(REG_MED_BASE))
  56. // med_ch0_work_cfg
  57. typedef union {
  58. uint32_t v;
  59. struct
  60. {
  61. uint32_t med_ch0_enable : 1; // [0]
  62. uint32_t __3_1 : 3; // [3:1]
  63. uint32_t med_ch0_bypass_en : 1; // [4]
  64. uint32_t __31_5 : 27; // [31:5]
  65. } b;
  66. } REG_MED_MED_CH0_WORK_CFG_T;
  67. // med_ch0_base_addr_cfg
  68. typedef union {
  69. uint32_t v;
  70. struct
  71. {
  72. uint32_t __4_0 : 5; // [4:0]
  73. uint32_t med_ch0_base_addr : 27; // [31:5]
  74. } b;
  75. } REG_MED_MED_CH0_BASE_ADDR_CFG_T;
  76. // med_ch0_addr_size_cfg
  77. typedef union {
  78. uint32_t v;
  79. struct
  80. {
  81. uint32_t __4_0 : 5; // [4:0]
  82. uint32_t med_ch0_addr_size : 19; // [23:5]
  83. uint32_t __31_24 : 8; // [31:24]
  84. } b;
  85. } REG_MED_MED_CH0_ADDR_SIZE_CFG_T;
  86. // med_ch0_read_addr_remap
  87. typedef union {
  88. uint32_t v;
  89. struct
  90. {
  91. uint32_t __4_0 : 5; // [4:0]
  92. uint32_t med_ch0_remap_read_addr : 27; // [31:5]
  93. } b;
  94. } REG_MED_MED_CH0_READ_ADDR_REMAP_T;
  95. // med_ch1_work_cfg
  96. typedef union {
  97. uint32_t v;
  98. struct
  99. {
  100. uint32_t med_ch1_enable : 1; // [0]
  101. uint32_t __3_1 : 3; // [3:1]
  102. uint32_t med_ch1_bypass_en : 1; // [4]
  103. uint32_t __31_5 : 27; // [31:5]
  104. } b;
  105. } REG_MED_MED_CH1_WORK_CFG_T;
  106. // med_ch1_base_addr_cfg
  107. typedef union {
  108. uint32_t v;
  109. struct
  110. {
  111. uint32_t __4_0 : 5; // [4:0]
  112. uint32_t med_ch1_base_addr : 27; // [31:5]
  113. } b;
  114. } REG_MED_MED_CH1_BASE_ADDR_CFG_T;
  115. // med_ch1_addr_size_cfg
  116. typedef union {
  117. uint32_t v;
  118. struct
  119. {
  120. uint32_t __4_0 : 5; // [4:0]
  121. uint32_t med_ch1_addr_size : 19; // [23:5]
  122. uint32_t __31_24 : 8; // [31:24]
  123. } b;
  124. } REG_MED_MED_CH1_ADDR_SIZE_CFG_T;
  125. // med_ch1_read_addr_remap
  126. typedef union {
  127. uint32_t v;
  128. struct
  129. {
  130. uint32_t __4_0 : 5; // [4:0]
  131. uint32_t med_ch1_remap_read_addr : 27; // [31:5]
  132. } b;
  133. } REG_MED_MED_CH1_READ_ADDR_REMAP_T;
  134. // med_ch2_work_cfg
  135. typedef union {
  136. uint32_t v;
  137. struct
  138. {
  139. uint32_t med_ch2_enable : 1; // [0]
  140. uint32_t __3_1 : 3; // [3:1]
  141. uint32_t med_ch2_bypass_en : 1; // [4]
  142. uint32_t __31_5 : 27; // [31:5]
  143. } b;
  144. } REG_MED_MED_CH2_WORK_CFG_T;
  145. // med_ch2_base_addr_cfg
  146. typedef union {
  147. uint32_t v;
  148. struct
  149. {
  150. uint32_t __4_0 : 5; // [4:0]
  151. uint32_t med_ch2_base_addr : 27; // [31:5]
  152. } b;
  153. } REG_MED_MED_CH2_BASE_ADDR_CFG_T;
  154. // med_ch2_addr_size_cfg
  155. typedef union {
  156. uint32_t v;
  157. struct
  158. {
  159. uint32_t __4_0 : 5; // [4:0]
  160. uint32_t med_ch2_addr_size : 19; // [23:5]
  161. uint32_t __31_24 : 8; // [31:24]
  162. } b;
  163. } REG_MED_MED_CH2_ADDR_SIZE_CFG_T;
  164. // med_ch2_read_addr_remap
  165. typedef union {
  166. uint32_t v;
  167. struct
  168. {
  169. uint32_t __4_0 : 5; // [4:0]
  170. uint32_t med_ch2_remap_read_addr : 27; // [31:5]
  171. } b;
  172. } REG_MED_MED_CH2_READ_ADDR_REMAP_T;
  173. // med_ch3_work_cfg
  174. typedef union {
  175. uint32_t v;
  176. struct
  177. {
  178. uint32_t med_ch3_enable : 1; // [0]
  179. uint32_t __3_1 : 3; // [3:1]
  180. uint32_t med_ch3_bypass_en : 1; // [4]
  181. uint32_t __31_5 : 27; // [31:5]
  182. } b;
  183. } REG_MED_MED_CH3_WORK_CFG_T;
  184. // med_ch3_base_addr_cfg
  185. typedef union {
  186. uint32_t v;
  187. struct
  188. {
  189. uint32_t __4_0 : 5; // [4:0]
  190. uint32_t med_ch3_base_addr : 27; // [31:5]
  191. } b;
  192. } REG_MED_MED_CH3_BASE_ADDR_CFG_T;
  193. // med_ch3_addr_size_cfg
  194. typedef union {
  195. uint32_t v;
  196. struct
  197. {
  198. uint32_t __4_0 : 5; // [4:0]
  199. uint32_t med_ch3_addr_size : 19; // [23:5]
  200. uint32_t __31_24 : 8; // [31:24]
  201. } b;
  202. } REG_MED_MED_CH3_ADDR_SIZE_CFG_T;
  203. // med_ch3_read_addr_remap
  204. typedef union {
  205. uint32_t v;
  206. struct
  207. {
  208. uint32_t __4_0 : 5; // [4:0]
  209. uint32_t med_ch3_remap_read_addr : 27; // [31:5]
  210. } b;
  211. } REG_MED_MED_CH3_READ_ADDR_REMAP_T;
  212. // med_write_addr_remap
  213. typedef union {
  214. uint32_t v;
  215. struct
  216. {
  217. uint32_t __4_0 : 5; // [4:0]
  218. uint32_t med_remap_write_addr : 27; // [31:5]
  219. } b;
  220. } REG_MED_MED_WRITE_ADDR_REMAP_T;
  221. // med_write_base_addr_cfg
  222. typedef union {
  223. uint32_t v;
  224. struct
  225. {
  226. uint32_t __4_0 : 5; // [4:0]
  227. uint32_t med_write_base_addr : 27; // [31:5]
  228. } b;
  229. } REG_MED_MED_WRITE_BASE_ADDR_CFG_T;
  230. // med_write_addr_size_cfg
  231. typedef union {
  232. uint32_t v;
  233. struct
  234. {
  235. uint32_t __4_0 : 5; // [4:0]
  236. uint32_t med_write_addr_size : 19; // [23:5]
  237. uint32_t __31_24 : 8; // [31:24]
  238. } b;
  239. } REG_MED_MED_WRITE_ADDR_SIZE_CFG_T;
  240. // med_clr
  241. typedef union {
  242. uint32_t v;
  243. struct
  244. {
  245. uint32_t med_read_ram_clr : 1; // [0], write clear
  246. uint32_t med_write_ram_clr : 1; // [1], write clear
  247. uint32_t __3_2 : 2; // [3:2]
  248. uint32_t med_simon_clr : 1; // [4], write clear
  249. uint32_t med_write_cnt_clr : 1; // [5], write clear
  250. uint32_t __31_6 : 26; // [31:6]
  251. } b;
  252. } REG_MED_MED_CLR_T;
  253. // med_work_mode
  254. typedef union {
  255. uint32_t v;
  256. struct
  257. {
  258. uint32_t med_key_iv_sel : 1; // [0]
  259. uint32_t __7_1 : 7; // [7:1]
  260. uint32_t med_bus_error_en : 1; // [8]
  261. uint32_t med_read_bus_error_en : 1; // [9]
  262. uint32_t med_write_bus_error_en : 1; // [10]
  263. uint32_t __15_11 : 5; // [15:11]
  264. uint32_t med_clk_force_on : 1; // [16]
  265. uint32_t __31_17 : 15; // [31:17]
  266. } b;
  267. } REG_MED_MED_WORK_MODE_T;
  268. // med_int_en
  269. typedef union {
  270. uint32_t v;
  271. struct
  272. {
  273. uint32_t med_wr_done_int_en : 1; // [0]
  274. uint32_t med_ch0_dis_addr_vld_int_en : 1; // [1]
  275. uint32_t med_ch1_dis_addr_vld_int_en : 1; // [2]
  276. uint32_t med_ch2_dis_addr_vld_int_en : 1; // [3]
  277. uint32_t med_ch3_dis_addr_vld_int_en : 1; // [4]
  278. uint32_t med_err_resp_int_en : 1; // [5]
  279. uint32_t med_addr_err_int_en : 1; // [6]
  280. uint32_t __31_7 : 25; // [31:7]
  281. } b;
  282. } REG_MED_MED_INT_EN_T;
  283. // med_int_raw
  284. typedef union {
  285. uint32_t v;
  286. struct
  287. {
  288. uint32_t med_wr_done_int_raw : 1; // [0], read only
  289. uint32_t med_ch0_dis_addr_vld_int_raw : 1; // [1], read only
  290. uint32_t med_ch1_dis_addr_vld_int_raw : 1; // [2], read only
  291. uint32_t med_ch2_dis_addr_vld_int_raw : 1; // [3], read only
  292. uint32_t med_ch3_dis_addr_vld_int_raw : 1; // [4], read only
  293. uint32_t med_err_resp_int_raw : 1; // [5], read only
  294. uint32_t med_addr_err_int_raw : 1; // [6], read only
  295. uint32_t __31_7 : 25; // [31:7]
  296. } b;
  297. } REG_MED_MED_INT_RAW_T;
  298. // med_int_clear
  299. typedef union {
  300. uint32_t v;
  301. struct
  302. {
  303. uint32_t med_wr_done_int_clr : 1; // [0], write clear
  304. uint32_t med_ch0_dis_addr_vld_int_clr : 1; // [1], write clear
  305. uint32_t med_ch1_dis_addr_vld_int_clr : 1; // [2], write clear
  306. uint32_t med_ch2_dis_addr_vld_int_clr : 1; // [3], write clear
  307. uint32_t med_ch3_dis_addr_vld_int_clr : 1; // [4], write clear
  308. uint32_t med_err_resp_int_clr : 1; // [5], write clear
  309. uint32_t med_addr_err_int_clr : 1; // [6], write clear
  310. uint32_t __31_7 : 25; // [31:7]
  311. } b;
  312. } REG_MED_MED_INT_CLEAR_T;
  313. // med_status0
  314. typedef union {
  315. uint32_t v;
  316. struct
  317. {
  318. uint32_t med_simon_odata_ready : 1; // [0], read only
  319. uint32_t med_mster_slv_hready : 1; // [1], read only
  320. uint32_t med_mster_ahb_hready : 1; // [2], read only
  321. uint32_t med_work_busy : 1; // [3], read only
  322. uint32_t med_rd_busy : 1; // [4], read only
  323. uint32_t med_wr_busy : 1; // [5], read only
  324. uint32_t __11_6 : 6; // [11:6]
  325. uint32_t med_write_word_cnt : 20; // [31:12], read only
  326. } b;
  327. } REG_MED_MED_STATUS0_T;
  328. // med_ch0_work_cfg
  329. #define MED_MED_CH0_ENABLE (1 << 0)
  330. #define MED_MED_CH0_BYPASS_EN (1 << 4)
  331. // med_ch0_base_addr_cfg
  332. #define MED_MED_CH0_BASE_ADDR(n) (((n)&0x7ffffff) << 5)
  333. // med_ch0_addr_size_cfg
  334. #define MED_MED_CH0_ADDR_SIZE(n) (((n)&0x7ffff) << 5)
  335. // med_ch0_read_addr_remap
  336. #define MED_MED_CH0_REMAP_READ_ADDR(n) (((n)&0x7ffffff) << 5)
  337. // med_ch1_work_cfg
  338. #define MED_MED_CH1_ENABLE (1 << 0)
  339. #define MED_MED_CH1_BYPASS_EN (1 << 4)
  340. // med_ch1_base_addr_cfg
  341. #define MED_MED_CH1_BASE_ADDR(n) (((n)&0x7ffffff) << 5)
  342. // med_ch1_addr_size_cfg
  343. #define MED_MED_CH1_ADDR_SIZE(n) (((n)&0x7ffff) << 5)
  344. // med_ch1_read_addr_remap
  345. #define MED_MED_CH1_REMAP_READ_ADDR(n) (((n)&0x7ffffff) << 5)
  346. // med_ch2_work_cfg
  347. #define MED_MED_CH2_ENABLE (1 << 0)
  348. #define MED_MED_CH2_BYPASS_EN (1 << 4)
  349. // med_ch2_base_addr_cfg
  350. #define MED_MED_CH2_BASE_ADDR(n) (((n)&0x7ffffff) << 5)
  351. // med_ch2_addr_size_cfg
  352. #define MED_MED_CH2_ADDR_SIZE(n) (((n)&0x7ffff) << 5)
  353. // med_ch2_read_addr_remap
  354. #define MED_MED_CH2_REMAP_READ_ADDR(n) (((n)&0x7ffffff) << 5)
  355. // med_ch3_work_cfg
  356. #define MED_MED_CH3_ENABLE (1 << 0)
  357. #define MED_MED_CH3_BYPASS_EN (1 << 4)
  358. // med_ch3_base_addr_cfg
  359. #define MED_MED_CH3_BASE_ADDR(n) (((n)&0x7ffffff) << 5)
  360. // med_ch3_addr_size_cfg
  361. #define MED_MED_CH3_ADDR_SIZE(n) (((n)&0x7ffff) << 5)
  362. // med_ch3_read_addr_remap
  363. #define MED_MED_CH3_REMAP_READ_ADDR(n) (((n)&0x7ffffff) << 5)
  364. // med_write_addr_remap
  365. #define MED_MED_REMAP_WRITE_ADDR(n) (((n)&0x7ffffff) << 5)
  366. // med_write_base_addr_cfg
  367. #define MED_MED_WRITE_BASE_ADDR(n) (((n)&0x7ffffff) << 5)
  368. // med_write_addr_size_cfg
  369. #define MED_MED_WRITE_ADDR_SIZE(n) (((n)&0x7ffff) << 5)
  370. // med_clr
  371. #define MED_MED_READ_RAM_CLR (1 << 0)
  372. #define MED_MED_WRITE_RAM_CLR (1 << 1)
  373. #define MED_MED_SIMON_CLR (1 << 4)
  374. #define MED_MED_WRITE_CNT_CLR (1 << 5)
  375. // med_work_mode
  376. #define MED_MED_KEY_IV_SEL (1 << 0)
  377. #define MED_MED_BUS_ERROR_EN (1 << 8)
  378. #define MED_MED_READ_BUS_ERROR_EN (1 << 9)
  379. #define MED_MED_WRITE_BUS_ERROR_EN (1 << 10)
  380. #define MED_MED_CLK_FORCE_ON (1 << 16)
  381. // med_int_en
  382. #define MED_MED_WR_DONE_INT_EN (1 << 0)
  383. #define MED_MED_CH0_DIS_ADDR_VLD_INT_EN (1 << 1)
  384. #define MED_MED_CH1_DIS_ADDR_VLD_INT_EN (1 << 2)
  385. #define MED_MED_CH2_DIS_ADDR_VLD_INT_EN (1 << 3)
  386. #define MED_MED_CH3_DIS_ADDR_VLD_INT_EN (1 << 4)
  387. #define MED_MED_ERR_RESP_INT_EN (1 << 5)
  388. #define MED_MED_ADDR_ERR_INT_EN (1 << 6)
  389. // med_int_raw
  390. #define MED_MED_WR_DONE_INT_RAW (1 << 0)
  391. #define MED_MED_CH0_DIS_ADDR_VLD_INT_RAW (1 << 1)
  392. #define MED_MED_CH1_DIS_ADDR_VLD_INT_RAW (1 << 2)
  393. #define MED_MED_CH2_DIS_ADDR_VLD_INT_RAW (1 << 3)
  394. #define MED_MED_CH3_DIS_ADDR_VLD_INT_RAW (1 << 4)
  395. #define MED_MED_ERR_RESP_INT_RAW (1 << 5)
  396. #define MED_MED_ADDR_ERR_INT_RAW (1 << 6)
  397. // med_int_clear
  398. #define MED_MED_WR_DONE_INT_CLR (1 << 0)
  399. #define MED_MED_CH0_DIS_ADDR_VLD_INT_CLR (1 << 1)
  400. #define MED_MED_CH1_DIS_ADDR_VLD_INT_CLR (1 << 2)
  401. #define MED_MED_CH2_DIS_ADDR_VLD_INT_CLR (1 << 3)
  402. #define MED_MED_CH3_DIS_ADDR_VLD_INT_CLR (1 << 4)
  403. #define MED_MED_ERR_RESP_INT_CLR (1 << 5)
  404. #define MED_MED_ADDR_ERR_INT_CLR (1 << 6)
  405. // med_status0
  406. #define MED_MED_SIMON_ODATA_READY (1 << 0)
  407. #define MED_MED_MSTER_SLV_HREADY (1 << 1)
  408. #define MED_MED_MSTER_AHB_HREADY (1 << 2)
  409. #define MED_MED_WORK_BUSY (1 << 3)
  410. #define MED_MED_RD_BUSY (1 << 4)
  411. #define MED_MED_WR_BUSY (1 << 5)
  412. #define MED_MED_WRITE_WORD_CNT(n) (((n)&0xfffff) << 12)
  413. #endif // _MED_H_