csr.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. #ifndef __GENERATED_CSR_H
  2. #define __GENERATED_CSR_H
  3. #include <hw/common.h>
  4. /* ddrphy */
  5. #define CSR_DDRPHY_BASE 0xe0008800
  6. #define CSR_DDRPHY_DLY_SEL_ADDR 0xe0008800
  7. #define CSR_DDRPHY_DLY_SEL_SIZE 1
  8. static inline unsigned char ddrphy_dly_sel_read(void) {
  9. unsigned char r = MMPTR(0xe0008800);
  10. return r;
  11. }
  12. static inline void ddrphy_dly_sel_write(unsigned char value) {
  13. MMPTR(0xe0008800) = value;
  14. }
  15. #define CSR_DDRPHY_RDLY_DQ_RST_ADDR 0xe0008804
  16. #define CSR_DDRPHY_RDLY_DQ_RST_SIZE 1
  17. static inline unsigned char ddrphy_rdly_dq_rst_read(void) {
  18. unsigned char r = MMPTR(0xe0008804);
  19. return r;
  20. }
  21. static inline void ddrphy_rdly_dq_rst_write(unsigned char value) {
  22. MMPTR(0xe0008804) = value;
  23. }
  24. #define CSR_DDRPHY_RDLY_DQ_INC_ADDR 0xe0008808
  25. #define CSR_DDRPHY_RDLY_DQ_INC_SIZE 1
  26. static inline unsigned char ddrphy_rdly_dq_inc_read(void) {
  27. unsigned char r = MMPTR(0xe0008808);
  28. return r;
  29. }
  30. static inline void ddrphy_rdly_dq_inc_write(unsigned char value) {
  31. MMPTR(0xe0008808) = value;
  32. }
  33. #define CSR_DDRPHY_RDLY_DQ_BITSLIP_ADDR 0xe000880c
  34. #define CSR_DDRPHY_RDLY_DQ_BITSLIP_SIZE 1
  35. static inline unsigned char ddrphy_rdly_dq_bitslip_read(void) {
  36. unsigned char r = MMPTR(0xe000880c);
  37. return r;
  38. }
  39. static inline void ddrphy_rdly_dq_bitslip_write(unsigned char value) {
  40. MMPTR(0xe000880c) = value;
  41. }
  42. /* ethmac */
  43. #define CSR_ETHMAC_BASE 0xe000f800
  44. #define CSR_ETHMAC_SRAM_WRITER_SLOT_ADDR 0xe000f800
  45. #define CSR_ETHMAC_SRAM_WRITER_SLOT_SIZE 1
  46. static inline unsigned char ethmac_sram_writer_slot_read(void) {
  47. unsigned char r = MMPTR(0xe000f800);
  48. return r;
  49. }
  50. #define CSR_ETHMAC_SRAM_WRITER_LENGTH_ADDR 0xe000f804
  51. #define CSR_ETHMAC_SRAM_WRITER_LENGTH_SIZE 4
  52. static inline unsigned int ethmac_sram_writer_length_read(void) {
  53. unsigned int r = MMPTR(0xe000f804);
  54. r <<= 8;
  55. r |= MMPTR(0xe000f808);
  56. r <<= 8;
  57. r |= MMPTR(0xe000f80c);
  58. r <<= 8;
  59. r |= MMPTR(0xe000f810);
  60. return r;
  61. }
  62. #define CSR_ETHMAC_SRAM_WRITER_EV_STATUS_ADDR 0xe000f814
  63. #define CSR_ETHMAC_SRAM_WRITER_EV_STATUS_SIZE 1
  64. static inline unsigned char ethmac_sram_writer_ev_status_read(void) {
  65. unsigned char r = MMPTR(0xe000f814);
  66. return r;
  67. }
  68. static inline void ethmac_sram_writer_ev_status_write(unsigned char value) {
  69. MMPTR(0xe000f814) = value;
  70. }
  71. #define CSR_ETHMAC_SRAM_WRITER_EV_PENDING_ADDR 0xe000f818
  72. #define CSR_ETHMAC_SRAM_WRITER_EV_PENDING_SIZE 1
  73. static inline unsigned char ethmac_sram_writer_ev_pending_read(void) {
  74. unsigned char r = MMPTR(0xe000f818);
  75. return r;
  76. }
  77. static inline void ethmac_sram_writer_ev_pending_write(unsigned char value) {
  78. MMPTR(0xe000f818) = value;
  79. }
  80. #define CSR_ETHMAC_SRAM_WRITER_EV_ENABLE_ADDR 0xe000f81c
  81. #define CSR_ETHMAC_SRAM_WRITER_EV_ENABLE_SIZE 1
  82. static inline unsigned char ethmac_sram_writer_ev_enable_read(void) {
  83. unsigned char r = MMPTR(0xe000f81c);
  84. return r;
  85. }
  86. static inline void ethmac_sram_writer_ev_enable_write(unsigned char value) {
  87. MMPTR(0xe000f81c) = value;
  88. }
  89. #define CSR_ETHMAC_SRAM_READER_START_ADDR 0xe000f820
  90. #define CSR_ETHMAC_SRAM_READER_START_SIZE 1
  91. static inline unsigned char ethmac_sram_reader_start_read(void) {
  92. unsigned char r = MMPTR(0xe000f820);
  93. return r;
  94. }
  95. static inline void ethmac_sram_reader_start_write(unsigned char value) {
  96. MMPTR(0xe000f820) = value;
  97. }
  98. #define CSR_ETHMAC_SRAM_READER_READY_ADDR 0xe000f824
  99. #define CSR_ETHMAC_SRAM_READER_READY_SIZE 1
  100. static inline unsigned char ethmac_sram_reader_ready_read(void) {
  101. unsigned char r = MMPTR(0xe000f824);
  102. return r;
  103. }
  104. #define CSR_ETHMAC_SRAM_READER_SLOT_ADDR 0xe000f828
  105. #define CSR_ETHMAC_SRAM_READER_SLOT_SIZE 1
  106. static inline unsigned char ethmac_sram_reader_slot_read(void) {
  107. unsigned char r = MMPTR(0xe000f828);
  108. return r;
  109. }
  110. static inline void ethmac_sram_reader_slot_write(unsigned char value) {
  111. MMPTR(0xe000f828) = value;
  112. }
  113. #define CSR_ETHMAC_SRAM_READER_LENGTH_ADDR 0xe000f82c
  114. #define CSR_ETHMAC_SRAM_READER_LENGTH_SIZE 2
  115. static inline unsigned short int ethmac_sram_reader_length_read(void) {
  116. unsigned short int r = MMPTR(0xe000f82c);
  117. r <<= 8;
  118. r |= MMPTR(0xe000f830);
  119. return r;
  120. }
  121. static inline void ethmac_sram_reader_length_write(unsigned short int value) {
  122. MMPTR(0xe000f82c) = value >> 8;
  123. MMPTR(0xe000f830) = value;
  124. }
  125. #define CSR_ETHMAC_SRAM_READER_EV_STATUS_ADDR 0xe000f834
  126. #define CSR_ETHMAC_SRAM_READER_EV_STATUS_SIZE 1
  127. static inline unsigned char ethmac_sram_reader_ev_status_read(void) {
  128. unsigned char r = MMPTR(0xe000f834);
  129. return r;
  130. }
  131. static inline void ethmac_sram_reader_ev_status_write(unsigned char value) {
  132. MMPTR(0xe000f834) = value;
  133. }
  134. #define CSR_ETHMAC_SRAM_READER_EV_PENDING_ADDR 0xe000f838
  135. #define CSR_ETHMAC_SRAM_READER_EV_PENDING_SIZE 1
  136. static inline unsigned char ethmac_sram_reader_ev_pending_read(void) {
  137. unsigned char r = MMPTR(0xe000f838);
  138. return r;
  139. }
  140. static inline void ethmac_sram_reader_ev_pending_write(unsigned char value) {
  141. MMPTR(0xe000f838) = value;
  142. }
  143. #define CSR_ETHMAC_SRAM_READER_EV_ENABLE_ADDR 0xe000f83c
  144. #define CSR_ETHMAC_SRAM_READER_EV_ENABLE_SIZE 1
  145. static inline unsigned char ethmac_sram_reader_ev_enable_read(void) {
  146. unsigned char r = MMPTR(0xe000f83c);
  147. return r;
  148. }
  149. static inline void ethmac_sram_reader_ev_enable_write(unsigned char value) {
  150. MMPTR(0xe000f83c) = value;
  151. }
  152. #define CSR_ETHMAC_PREAMBLE_CRC_ADDR 0xe000f840
  153. #define CSR_ETHMAC_PREAMBLE_CRC_SIZE 1
  154. static inline unsigned char ethmac_preamble_crc_read(void) {
  155. unsigned char r = MMPTR(0xe000f840);
  156. return r;
  157. }
  158. /* ethphy */
  159. #define CSR_ETHPHY_BASE 0xe000f000
  160. #define CSR_ETHPHY_CRG_RESET_ADDR 0xe000f000
  161. #define CSR_ETHPHY_CRG_RESET_SIZE 1
  162. static inline unsigned char ethphy_crg_reset_read(void) {
  163. unsigned char r = MMPTR(0xe000f000);
  164. return r;
  165. }
  166. static inline void ethphy_crg_reset_write(unsigned char value) {
  167. MMPTR(0xe000f000) = value;
  168. }
  169. #define CSR_ETHPHY_MDIO_W_ADDR 0xe000f004
  170. #define CSR_ETHPHY_MDIO_W_SIZE 1
  171. static inline unsigned char ethphy_mdio_w_read(void) {
  172. unsigned char r = MMPTR(0xe000f004);
  173. return r;
  174. }
  175. static inline void ethphy_mdio_w_write(unsigned char value) {
  176. MMPTR(0xe000f004) = value;
  177. }
  178. #define CSR_ETHPHY_MDIO_R_ADDR 0xe000f008
  179. #define CSR_ETHPHY_MDIO_R_SIZE 1
  180. static inline unsigned char ethphy_mdio_r_read(void) {
  181. unsigned char r = MMPTR(0xe000f008);
  182. return r;
  183. }
  184. /* sdram */
  185. #define CSR_SDRAM_BASE 0xe0004000
  186. #define CSR_SDRAM_DFII_CONTROL_ADDR 0xe0004000
  187. #define CSR_SDRAM_DFII_CONTROL_SIZE 1
  188. static inline unsigned char sdram_dfii_control_read(void) {
  189. unsigned char r = MMPTR(0xe0004000);
  190. return r;
  191. }
  192. static inline void sdram_dfii_control_write(unsigned char value) {
  193. MMPTR(0xe0004000) = value;
  194. }
  195. #define CSR_SDRAM_DFII_PI0_COMMAND_ADDR 0xe0004004
  196. #define CSR_SDRAM_DFII_PI0_COMMAND_SIZE 1
  197. static inline unsigned char sdram_dfii_pi0_command_read(void) {
  198. unsigned char r = MMPTR(0xe0004004);
  199. return r;
  200. }
  201. static inline void sdram_dfii_pi0_command_write(unsigned char value) {
  202. MMPTR(0xe0004004) = value;
  203. }
  204. #define CSR_SDRAM_DFII_PI0_COMMAND_ISSUE_ADDR 0xe0004008
  205. #define CSR_SDRAM_DFII_PI0_COMMAND_ISSUE_SIZE 1
  206. static inline unsigned char sdram_dfii_pi0_command_issue_read(void) {
  207. unsigned char r = MMPTR(0xe0004008);
  208. return r;
  209. }
  210. static inline void sdram_dfii_pi0_command_issue_write(unsigned char value) {
  211. MMPTR(0xe0004008) = value;
  212. }
  213. #define CSR_SDRAM_DFII_PI0_ADDRESS_ADDR 0xe000400c
  214. #define CSR_SDRAM_DFII_PI0_ADDRESS_SIZE 2
  215. static inline unsigned short int sdram_dfii_pi0_address_read(void) {
  216. unsigned short int r = MMPTR(0xe000400c);
  217. r <<= 8;
  218. r |= MMPTR(0xe0004010);
  219. return r;
  220. }
  221. static inline void sdram_dfii_pi0_address_write(unsigned short int value) {
  222. MMPTR(0xe000400c) = value >> 8;
  223. MMPTR(0xe0004010) = value;
  224. }
  225. #define CSR_SDRAM_DFII_PI0_BADDRESS_ADDR 0xe0004014
  226. #define CSR_SDRAM_DFII_PI0_BADDRESS_SIZE 1
  227. static inline unsigned char sdram_dfii_pi0_baddress_read(void) {
  228. unsigned char r = MMPTR(0xe0004014);
  229. return r;
  230. }
  231. static inline void sdram_dfii_pi0_baddress_write(unsigned char value) {
  232. MMPTR(0xe0004014) = value;
  233. }
  234. #define CSR_SDRAM_DFII_PI0_WRDATA_ADDR 0xe0004018
  235. #define CSR_SDRAM_DFII_PI0_WRDATA_SIZE 4
  236. static inline unsigned int sdram_dfii_pi0_wrdata_read(void) {
  237. unsigned int r = MMPTR(0xe0004018);
  238. r <<= 8;
  239. r |= MMPTR(0xe000401c);
  240. r <<= 8;
  241. r |= MMPTR(0xe0004020);
  242. r <<= 8;
  243. r |= MMPTR(0xe0004024);
  244. return r;
  245. }
  246. static inline void sdram_dfii_pi0_wrdata_write(unsigned int value) {
  247. MMPTR(0xe0004018) = value >> 24;
  248. MMPTR(0xe000401c) = value >> 16;
  249. MMPTR(0xe0004020) = value >> 8;
  250. MMPTR(0xe0004024) = value;
  251. }
  252. #define CSR_SDRAM_DFII_PI0_RDDATA_ADDR 0xe0004028
  253. #define CSR_SDRAM_DFII_PI0_RDDATA_SIZE 4
  254. static inline unsigned int sdram_dfii_pi0_rddata_read(void) {
  255. unsigned int r = MMPTR(0xe0004028);
  256. r <<= 8;
  257. r |= MMPTR(0xe000402c);
  258. r <<= 8;
  259. r |= MMPTR(0xe0004030);
  260. r <<= 8;
  261. r |= MMPTR(0xe0004034);
  262. return r;
  263. }
  264. #define CSR_SDRAM_DFII_PI1_COMMAND_ADDR 0xe0004038
  265. #define CSR_SDRAM_DFII_PI1_COMMAND_SIZE 1
  266. static inline unsigned char sdram_dfii_pi1_command_read(void) {
  267. unsigned char r = MMPTR(0xe0004038);
  268. return r;
  269. }
  270. static inline void sdram_dfii_pi1_command_write(unsigned char value) {
  271. MMPTR(0xe0004038) = value;
  272. }
  273. #define CSR_SDRAM_DFII_PI1_COMMAND_ISSUE_ADDR 0xe000403c
  274. #define CSR_SDRAM_DFII_PI1_COMMAND_ISSUE_SIZE 1
  275. static inline unsigned char sdram_dfii_pi1_command_issue_read(void) {
  276. unsigned char r = MMPTR(0xe000403c);
  277. return r;
  278. }
  279. static inline void sdram_dfii_pi1_command_issue_write(unsigned char value) {
  280. MMPTR(0xe000403c) = value;
  281. }
  282. #define CSR_SDRAM_DFII_PI1_ADDRESS_ADDR 0xe0004040
  283. #define CSR_SDRAM_DFII_PI1_ADDRESS_SIZE 2
  284. static inline unsigned short int sdram_dfii_pi1_address_read(void) {
  285. unsigned short int r = MMPTR(0xe0004040);
  286. r <<= 8;
  287. r |= MMPTR(0xe0004044);
  288. return r;
  289. }
  290. static inline void sdram_dfii_pi1_address_write(unsigned short int value) {
  291. MMPTR(0xe0004040) = value >> 8;
  292. MMPTR(0xe0004044) = value;
  293. }
  294. #define CSR_SDRAM_DFII_PI1_BADDRESS_ADDR 0xe0004048
  295. #define CSR_SDRAM_DFII_PI1_BADDRESS_SIZE 1
  296. static inline unsigned char sdram_dfii_pi1_baddress_read(void) {
  297. unsigned char r = MMPTR(0xe0004048);
  298. return r;
  299. }
  300. static inline void sdram_dfii_pi1_baddress_write(unsigned char value) {
  301. MMPTR(0xe0004048) = value;
  302. }
  303. #define CSR_SDRAM_DFII_PI1_WRDATA_ADDR 0xe000404c
  304. #define CSR_SDRAM_DFII_PI1_WRDATA_SIZE 4
  305. static inline unsigned int sdram_dfii_pi1_wrdata_read(void) {
  306. unsigned int r = MMPTR(0xe000404c);
  307. r <<= 8;
  308. r |= MMPTR(0xe0004050);
  309. r <<= 8;
  310. r |= MMPTR(0xe0004054);
  311. r <<= 8;
  312. r |= MMPTR(0xe0004058);
  313. return r;
  314. }
  315. static inline void sdram_dfii_pi1_wrdata_write(unsigned int value) {
  316. MMPTR(0xe000404c) = value >> 24;
  317. MMPTR(0xe0004050) = value >> 16;
  318. MMPTR(0xe0004054) = value >> 8;
  319. MMPTR(0xe0004058) = value;
  320. }
  321. #define CSR_SDRAM_DFII_PI1_RDDATA_ADDR 0xe000405c
  322. #define CSR_SDRAM_DFII_PI1_RDDATA_SIZE 4
  323. static inline unsigned int sdram_dfii_pi1_rddata_read(void) {
  324. unsigned int r = MMPTR(0xe000405c);
  325. r <<= 8;
  326. r |= MMPTR(0xe0004060);
  327. r <<= 8;
  328. r |= MMPTR(0xe0004064);
  329. r <<= 8;
  330. r |= MMPTR(0xe0004068);
  331. return r;
  332. }
  333. #define CSR_SDRAM_DFII_PI2_COMMAND_ADDR 0xe000406c
  334. #define CSR_SDRAM_DFII_PI2_COMMAND_SIZE 1
  335. static inline unsigned char sdram_dfii_pi2_command_read(void) {
  336. unsigned char r = MMPTR(0xe000406c);
  337. return r;
  338. }
  339. static inline void sdram_dfii_pi2_command_write(unsigned char value) {
  340. MMPTR(0xe000406c) = value;
  341. }
  342. #define CSR_SDRAM_DFII_PI2_COMMAND_ISSUE_ADDR 0xe0004070
  343. #define CSR_SDRAM_DFII_PI2_COMMAND_ISSUE_SIZE 1
  344. static inline unsigned char sdram_dfii_pi2_command_issue_read(void) {
  345. unsigned char r = MMPTR(0xe0004070);
  346. return r;
  347. }
  348. static inline void sdram_dfii_pi2_command_issue_write(unsigned char value) {
  349. MMPTR(0xe0004070) = value;
  350. }
  351. #define CSR_SDRAM_DFII_PI2_ADDRESS_ADDR 0xe0004074
  352. #define CSR_SDRAM_DFII_PI2_ADDRESS_SIZE 2
  353. static inline unsigned short int sdram_dfii_pi2_address_read(void) {
  354. unsigned short int r = MMPTR(0xe0004074);
  355. r <<= 8;
  356. r |= MMPTR(0xe0004078);
  357. return r;
  358. }
  359. static inline void sdram_dfii_pi2_address_write(unsigned short int value) {
  360. MMPTR(0xe0004074) = value >> 8;
  361. MMPTR(0xe0004078) = value;
  362. }
  363. #define CSR_SDRAM_DFII_PI2_BADDRESS_ADDR 0xe000407c
  364. #define CSR_SDRAM_DFII_PI2_BADDRESS_SIZE 1
  365. static inline unsigned char sdram_dfii_pi2_baddress_read(void) {
  366. unsigned char r = MMPTR(0xe000407c);
  367. return r;
  368. }
  369. static inline void sdram_dfii_pi2_baddress_write(unsigned char value) {
  370. MMPTR(0xe000407c) = value;
  371. }
  372. #define CSR_SDRAM_DFII_PI2_WRDATA_ADDR 0xe0004080
  373. #define CSR_SDRAM_DFII_PI2_WRDATA_SIZE 4
  374. static inline unsigned int sdram_dfii_pi2_wrdata_read(void) {
  375. unsigned int r = MMPTR(0xe0004080);
  376. r <<= 8;
  377. r |= MMPTR(0xe0004084);
  378. r <<= 8;
  379. r |= MMPTR(0xe0004088);
  380. r <<= 8;
  381. r |= MMPTR(0xe000408c);
  382. return r;
  383. }
  384. static inline void sdram_dfii_pi2_wrdata_write(unsigned int value) {
  385. MMPTR(0xe0004080) = value >> 24;
  386. MMPTR(0xe0004084) = value >> 16;
  387. MMPTR(0xe0004088) = value >> 8;
  388. MMPTR(0xe000408c) = value;
  389. }
  390. #define CSR_SDRAM_DFII_PI2_RDDATA_ADDR 0xe0004090
  391. #define CSR_SDRAM_DFII_PI2_RDDATA_SIZE 4
  392. static inline unsigned int sdram_dfii_pi2_rddata_read(void) {
  393. unsigned int r = MMPTR(0xe0004090);
  394. r <<= 8;
  395. r |= MMPTR(0xe0004094);
  396. r <<= 8;
  397. r |= MMPTR(0xe0004098);
  398. r <<= 8;
  399. r |= MMPTR(0xe000409c);
  400. return r;
  401. }
  402. #define CSR_SDRAM_DFII_PI3_COMMAND_ADDR 0xe00040a0
  403. #define CSR_SDRAM_DFII_PI3_COMMAND_SIZE 1
  404. static inline unsigned char sdram_dfii_pi3_command_read(void) {
  405. unsigned char r = MMPTR(0xe00040a0);
  406. return r;
  407. }
  408. static inline void sdram_dfii_pi3_command_write(unsigned char value) {
  409. MMPTR(0xe00040a0) = value;
  410. }
  411. #define CSR_SDRAM_DFII_PI3_COMMAND_ISSUE_ADDR 0xe00040a4
  412. #define CSR_SDRAM_DFII_PI3_COMMAND_ISSUE_SIZE 1
  413. static inline unsigned char sdram_dfii_pi3_command_issue_read(void) {
  414. unsigned char r = MMPTR(0xe00040a4);
  415. return r;
  416. }
  417. static inline void sdram_dfii_pi3_command_issue_write(unsigned char value) {
  418. MMPTR(0xe00040a4) = value;
  419. }
  420. #define CSR_SDRAM_DFII_PI3_ADDRESS_ADDR 0xe00040a8
  421. #define CSR_SDRAM_DFII_PI3_ADDRESS_SIZE 2
  422. static inline unsigned short int sdram_dfii_pi3_address_read(void) {
  423. unsigned short int r = MMPTR(0xe00040a8);
  424. r <<= 8;
  425. r |= MMPTR(0xe00040ac);
  426. return r;
  427. }
  428. static inline void sdram_dfii_pi3_address_write(unsigned short int value) {
  429. MMPTR(0xe00040a8) = value >> 8;
  430. MMPTR(0xe00040ac) = value;
  431. }
  432. #define CSR_SDRAM_DFII_PI3_BADDRESS_ADDR 0xe00040b0
  433. #define CSR_SDRAM_DFII_PI3_BADDRESS_SIZE 1
  434. static inline unsigned char sdram_dfii_pi3_baddress_read(void) {
  435. unsigned char r = MMPTR(0xe00040b0);
  436. return r;
  437. }
  438. static inline void sdram_dfii_pi3_baddress_write(unsigned char value) {
  439. MMPTR(0xe00040b0) = value;
  440. }
  441. #define CSR_SDRAM_DFII_PI3_WRDATA_ADDR 0xe00040b4
  442. #define CSR_SDRAM_DFII_PI3_WRDATA_SIZE 4
  443. static inline unsigned int sdram_dfii_pi3_wrdata_read(void) {
  444. unsigned int r = MMPTR(0xe00040b4);
  445. r <<= 8;
  446. r |= MMPTR(0xe00040b8);
  447. r <<= 8;
  448. r |= MMPTR(0xe00040bc);
  449. r <<= 8;
  450. r |= MMPTR(0xe00040c0);
  451. return r;
  452. }
  453. static inline void sdram_dfii_pi3_wrdata_write(unsigned int value) {
  454. MMPTR(0xe00040b4) = value >> 24;
  455. MMPTR(0xe00040b8) = value >> 16;
  456. MMPTR(0xe00040bc) = value >> 8;
  457. MMPTR(0xe00040c0) = value;
  458. }
  459. #define CSR_SDRAM_DFII_PI3_RDDATA_ADDR 0xe00040c4
  460. #define CSR_SDRAM_DFII_PI3_RDDATA_SIZE 4
  461. static inline unsigned int sdram_dfii_pi3_rddata_read(void) {
  462. unsigned int r = MMPTR(0xe00040c4);
  463. r <<= 8;
  464. r |= MMPTR(0xe00040c8);
  465. r <<= 8;
  466. r |= MMPTR(0xe00040cc);
  467. r <<= 8;
  468. r |= MMPTR(0xe00040d0);
  469. return r;
  470. }
  471. /* timer0 */
  472. #define CSR_TIMER0_BASE 0xe0002000
  473. #define CSR_TIMER0_LOAD_ADDR 0xe0002000
  474. #define CSR_TIMER0_LOAD_SIZE 4
  475. static inline unsigned int timer0_load_read(void) {
  476. unsigned int r = MMPTR(0xe0002000);
  477. r <<= 8;
  478. r |= MMPTR(0xe0002004);
  479. r <<= 8;
  480. r |= MMPTR(0xe0002008);
  481. r <<= 8;
  482. r |= MMPTR(0xe000200c);
  483. return r;
  484. }
  485. static inline void timer0_load_write(unsigned int value) {
  486. MMPTR(0xe0002000) = value >> 24;
  487. MMPTR(0xe0002004) = value >> 16;
  488. MMPTR(0xe0002008) = value >> 8;
  489. MMPTR(0xe000200c) = value;
  490. }
  491. #define CSR_TIMER0_RELOAD_ADDR 0xe0002010
  492. #define CSR_TIMER0_RELOAD_SIZE 4
  493. static inline unsigned int timer0_reload_read(void) {
  494. unsigned int r = MMPTR(0xe0002010);
  495. r <<= 8;
  496. r |= MMPTR(0xe0002014);
  497. r <<= 8;
  498. r |= MMPTR(0xe0002018);
  499. r <<= 8;
  500. r |= MMPTR(0xe000201c);
  501. return r;
  502. }
  503. static inline void timer0_reload_write(unsigned int value) {
  504. MMPTR(0xe0002010) = value >> 24;
  505. MMPTR(0xe0002014) = value >> 16;
  506. MMPTR(0xe0002018) = value >> 8;
  507. MMPTR(0xe000201c) = value;
  508. }
  509. #define CSR_TIMER0_EN_ADDR 0xe0002020
  510. #define CSR_TIMER0_EN_SIZE 1
  511. static inline unsigned char timer0_en_read(void) {
  512. unsigned char r = MMPTR(0xe0002020);
  513. return r;
  514. }
  515. static inline void timer0_en_write(unsigned char value) {
  516. MMPTR(0xe0002020) = value;
  517. }
  518. #define CSR_TIMER0_UPDATE_VALUE_ADDR 0xe0002024
  519. #define CSR_TIMER0_UPDATE_VALUE_SIZE 1
  520. static inline unsigned char timer0_update_value_read(void) {
  521. unsigned char r = MMPTR(0xe0002024);
  522. return r;
  523. }
  524. static inline void timer0_update_value_write(unsigned char value) {
  525. MMPTR(0xe0002024) = value;
  526. }
  527. #define CSR_TIMER0_VALUE_ADDR 0xe0002028
  528. #define CSR_TIMER0_VALUE_SIZE 4
  529. static inline unsigned int timer0_value_read(void) {
  530. unsigned int r = MMPTR(0xe0002028);
  531. r <<= 8;
  532. r |= MMPTR(0xe000202c);
  533. r <<= 8;
  534. r |= MMPTR(0xe0002030);
  535. r <<= 8;
  536. r |= MMPTR(0xe0002034);
  537. return r;
  538. }
  539. #define CSR_TIMER0_EV_STATUS_ADDR 0xe0002038
  540. #define CSR_TIMER0_EV_STATUS_SIZE 1
  541. static inline unsigned char timer0_ev_status_read(void) {
  542. unsigned char r = MMPTR(0xe0002038);
  543. return r;
  544. }
  545. static inline void timer0_ev_status_write(unsigned char value) {
  546. MMPTR(0xe0002038) = value;
  547. }
  548. #define CSR_TIMER0_EV_PENDING_ADDR 0xe000203c
  549. #define CSR_TIMER0_EV_PENDING_SIZE 1
  550. static inline unsigned char timer0_ev_pending_read(void) {
  551. unsigned char r = MMPTR(0xe000203c);
  552. return r;
  553. }
  554. static inline void timer0_ev_pending_write(unsigned char value) {
  555. MMPTR(0xe000203c) = value;
  556. }
  557. #define CSR_TIMER0_EV_ENABLE_ADDR 0xe0002040
  558. #define CSR_TIMER0_EV_ENABLE_SIZE 1
  559. static inline unsigned char timer0_ev_enable_read(void) {
  560. unsigned char r = MMPTR(0xe0002040);
  561. return r;
  562. }
  563. static inline void timer0_ev_enable_write(unsigned char value) {
  564. MMPTR(0xe0002040) = value;
  565. }
  566. /* uart */
  567. #define CSR_UART_BASE 0xe0001000
  568. #define CSR_UART_RXTX_ADDR 0xe0001000
  569. #define CSR_UART_RXTX_SIZE 1
  570. static inline unsigned char uart_rxtx_read(void) {
  571. unsigned char r = MMPTR(0xe0001000);
  572. return r;
  573. }
  574. static inline void uart_rxtx_write(unsigned char value) {
  575. MMPTR(0xe0001000) = value;
  576. }
  577. #define CSR_UART_TXFULL_ADDR 0xe0001004
  578. #define CSR_UART_TXFULL_SIZE 1
  579. static inline unsigned char uart_txfull_read(void) {
  580. unsigned char r = MMPTR(0xe0001004);
  581. return r;
  582. }
  583. #define CSR_UART_RXEMPTY_ADDR 0xe0001008
  584. #define CSR_UART_RXEMPTY_SIZE 1
  585. static inline unsigned char uart_rxempty_read(void) {
  586. unsigned char r = MMPTR(0xe0001008);
  587. return r;
  588. }
  589. #define CSR_UART_EV_STATUS_ADDR 0xe000100c
  590. #define CSR_UART_EV_STATUS_SIZE 1
  591. static inline unsigned char uart_ev_status_read(void) {
  592. unsigned char r = MMPTR(0xe000100c);
  593. return r;
  594. }
  595. static inline void uart_ev_status_write(unsigned char value) {
  596. MMPTR(0xe000100c) = value;
  597. }
  598. #define CSR_UART_EV_PENDING_ADDR 0xe0001010
  599. #define CSR_UART_EV_PENDING_SIZE 1
  600. static inline unsigned char uart_ev_pending_read(void) {
  601. unsigned char r = MMPTR(0xe0001010);
  602. return r;
  603. }
  604. static inline void uart_ev_pending_write(unsigned char value) {
  605. MMPTR(0xe0001010) = value;
  606. }
  607. #define CSR_UART_EV_ENABLE_ADDR 0xe0001014
  608. #define CSR_UART_EV_ENABLE_SIZE 1
  609. static inline unsigned char uart_ev_enable_read(void) {
  610. unsigned char r = MMPTR(0xe0001014);
  611. return r;
  612. }
  613. static inline void uart_ev_enable_write(unsigned char value) {
  614. MMPTR(0xe0001014) = value;
  615. }
  616. /* uart_phy */
  617. #define CSR_UART_PHY_BASE 0xe0000800
  618. #define CSR_UART_PHY_TUNING_WORD_ADDR 0xe0000800
  619. #define CSR_UART_PHY_TUNING_WORD_SIZE 4
  620. static inline unsigned int uart_phy_tuning_word_read(void) {
  621. unsigned int r = MMPTR(0xe0000800);
  622. r <<= 8;
  623. r |= MMPTR(0xe0000804);
  624. r <<= 8;
  625. r |= MMPTR(0xe0000808);
  626. r <<= 8;
  627. r |= MMPTR(0xe000080c);
  628. return r;
  629. }
  630. static inline void uart_phy_tuning_word_write(unsigned int value) {
  631. MMPTR(0xe0000800) = value >> 24;
  632. MMPTR(0xe0000804) = value >> 16;
  633. MMPTR(0xe0000808) = value >> 8;
  634. MMPTR(0xe000080c) = value;
  635. }
  636. /* constants */
  637. #define UART_INTERRUPT 0
  638. #define TIMER0_INTERRUPT 1
  639. #define ETHMAC_INTERRUPT 2
  640. #define SYSTEM_CLOCK_FREQUENCY 100000000
  641. #define A7DDRPHY_BITSLIP 2
  642. #define A7DDRPHY_DELAY 6
  643. #define L2_SIZE 8192
  644. #endif