csr.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. //--------------------------------------------------------------------------------
  2. // Auto-generated by Migen (f4fcd10) & LiteX (1425a68d) on 2019-11-12 19:41:49
  3. //--------------------------------------------------------------------------------
  4. #ifndef __GENERATED_CSR_H
  5. #define __GENERATED_CSR_H
  6. #include <stdint.h>
  7. #ifdef CSR_ACCESSORS_DEFINED
  8. extern void csr_writeb(uint8_t value, unsigned long addr);
  9. extern uint8_t csr_readb(unsigned long addr);
  10. extern void csr_writew(uint16_t value, unsigned long addr);
  11. extern uint16_t csr_readw(unsigned long addr);
  12. extern void csr_writel(uint32_t value, unsigned long addr);
  13. extern uint32_t csr_readl(unsigned long addr);
  14. #else /* ! CSR_ACCESSORS_DEFINED */
  15. #include <hw/common.h>
  16. #endif /* ! CSR_ACCESSORS_DEFINED */
  17. /* ctrl */
  18. #define CSR_CTRL_BASE 0xe0000000L
  19. #define CSR_CTRL_RESET_ADDR 0xe0000000L
  20. #define CSR_CTRL_RESET_SIZE 1
  21. static inline unsigned char ctrl_reset_read(void) {
  22. unsigned char r = csr_readl(0xe0000000L);
  23. return r;
  24. }
  25. static inline void ctrl_reset_write(unsigned char value) {
  26. csr_writel(value, 0xe0000000L);
  27. }
  28. #define CSR_CTRL_SCRATCH_ADDR 0xe0000004L
  29. #define CSR_CTRL_SCRATCH_SIZE 4
  30. static inline unsigned int ctrl_scratch_read(void) {
  31. unsigned int r = csr_readl(0xe0000004L);
  32. r <<= 8;
  33. r |= csr_readl(0xe0000008L);
  34. r <<= 8;
  35. r |= csr_readl(0xe000000cL);
  36. r <<= 8;
  37. r |= csr_readl(0xe0000010L);
  38. return r;
  39. }
  40. static inline void ctrl_scratch_write(unsigned int value) {
  41. csr_writel(value >> 24, 0xe0000004L);
  42. csr_writel(value >> 16, 0xe0000008L);
  43. csr_writel(value >> 8, 0xe000000cL);
  44. csr_writel(value, 0xe0000010L);
  45. }
  46. #define CSR_CTRL_BUS_ERRORS_ADDR 0xe0000014L
  47. #define CSR_CTRL_BUS_ERRORS_SIZE 4
  48. static inline unsigned int ctrl_bus_errors_read(void) {
  49. unsigned int r = csr_readl(0xe0000014L);
  50. r <<= 8;
  51. r |= csr_readl(0xe0000018L);
  52. r <<= 8;
  53. r |= csr_readl(0xe000001cL);
  54. r <<= 8;
  55. r |= csr_readl(0xe0000020L);
  56. return r;
  57. }
  58. /* messible */
  59. #define CSR_MESSIBLE_BASE 0xe0008000L
  60. #define CSR_MESSIBLE_IN_ADDR 0xe0008000L
  61. #define CSR_MESSIBLE_IN_SIZE 1
  62. static inline unsigned char messible_in_read(void) {
  63. unsigned char r = csr_readl(0xe0008000L);
  64. return r;
  65. }
  66. static inline void messible_in_write(unsigned char value) {
  67. csr_writel(value, 0xe0008000L);
  68. }
  69. #define CSR_MESSIBLE_OUT_ADDR 0xe0008004L
  70. #define CSR_MESSIBLE_OUT_SIZE 1
  71. static inline unsigned char messible_out_read(void) {
  72. unsigned char r = csr_readl(0xe0008004L);
  73. return r;
  74. }
  75. #define CSR_MESSIBLE_STATUS_ADDR 0xe0008008L
  76. #define CSR_MESSIBLE_STATUS_SIZE 1
  77. static inline unsigned char messible_status_read(void) {
  78. unsigned char r = csr_readl(0xe0008008L);
  79. return r;
  80. }
  81. #define CSR_MESSIBLE_STATUS_FULL_OFFSET 0
  82. #define CSR_MESSIBLE_STATUS_FULL_SIZE 1
  83. #define CSR_MESSIBLE_STATUS_HAVE_OFFSET 1
  84. #define CSR_MESSIBLE_STATUS_HAVE_SIZE 1
  85. /* picorvspi */
  86. #define CSR_PICORVSPI_BASE 0xe0005000L
  87. #define CSR_PICORVSPI_CFG1_ADDR 0xe0005000L
  88. #define CSR_PICORVSPI_CFG1_SIZE 1
  89. static inline unsigned char picorvspi_cfg1_read(void) {
  90. unsigned char r = csr_readl(0xe0005000L);
  91. return r;
  92. }
  93. static inline void picorvspi_cfg1_write(unsigned char value) {
  94. csr_writel(value, 0xe0005000L);
  95. }
  96. #define CSR_PICORVSPI_CFG1_BB_OUT_OFFSET 0
  97. #define CSR_PICORVSPI_CFG1_BB_OUT_SIZE 4
  98. #define CSR_PICORVSPI_CFG1_BB_CLK_OFFSET 4
  99. #define CSR_PICORVSPI_CFG1_BB_CLK_SIZE 1
  100. #define CSR_PICORVSPI_CFG1_BB_CS_OFFSET 5
  101. #define CSR_PICORVSPI_CFG1_BB_CS_SIZE 1
  102. #define CSR_PICORVSPI_CFG2_ADDR 0xe0005004L
  103. #define CSR_PICORVSPI_CFG2_SIZE 1
  104. static inline unsigned char picorvspi_cfg2_read(void) {
  105. unsigned char r = csr_readl(0xe0005004L);
  106. return r;
  107. }
  108. static inline void picorvspi_cfg2_write(unsigned char value) {
  109. csr_writel(value, 0xe0005004L);
  110. }
  111. #define CSR_PICORVSPI_CFG2_BB_OE_OFFSET 0
  112. #define CSR_PICORVSPI_CFG2_BB_OE_SIZE 4
  113. #define CSR_PICORVSPI_CFG3_ADDR 0xe0005008L
  114. #define CSR_PICORVSPI_CFG3_SIZE 1
  115. static inline unsigned char picorvspi_cfg3_read(void) {
  116. unsigned char r = csr_readl(0xe0005008L);
  117. return r;
  118. }
  119. static inline void picorvspi_cfg3_write(unsigned char value) {
  120. csr_writel(value, 0xe0005008L);
  121. }
  122. #define CSR_PICORVSPI_CFG3_RLAT_OFFSET 0
  123. #define CSR_PICORVSPI_CFG3_RLAT_SIZE 4
  124. #define CSR_PICORVSPI_CFG3_CRM_OFFSET 4
  125. #define CSR_PICORVSPI_CFG3_CRM_SIZE 1
  126. #define CSR_PICORVSPI_CFG3_QSPI_OFFSET 5
  127. #define CSR_PICORVSPI_CFG3_QSPI_SIZE 1
  128. #define CSR_PICORVSPI_CFG3_DDR_OFFSET 6
  129. #define CSR_PICORVSPI_CFG3_DDR_SIZE 1
  130. #define CSR_PICORVSPI_CFG4_ADDR 0xe000500cL
  131. #define CSR_PICORVSPI_CFG4_SIZE 1
  132. static inline unsigned char picorvspi_cfg4_read(void) {
  133. unsigned char r = csr_readl(0xe000500cL);
  134. return r;
  135. }
  136. static inline void picorvspi_cfg4_write(unsigned char value) {
  137. csr_writel(value, 0xe000500cL);
  138. }
  139. #define CSR_PICORVSPI_CFG4_MEMIO_OFFSET 7
  140. #define CSR_PICORVSPI_CFG4_MEMIO_SIZE 1
  141. #define CSR_PICORVSPI_STAT1_ADDR 0xe0005010L
  142. #define CSR_PICORVSPI_STAT1_SIZE 1
  143. static inline unsigned char picorvspi_stat1_read(void) {
  144. unsigned char r = csr_readl(0xe0005010L);
  145. return r;
  146. }
  147. #define CSR_PICORVSPI_STAT1_BB_IN_OFFSET 0
  148. #define CSR_PICORVSPI_STAT1_BB_IN_SIZE 4
  149. #define CSR_PICORVSPI_STAT2_ADDR 0xe0005014L
  150. #define CSR_PICORVSPI_STAT2_SIZE 1
  151. static inline unsigned char picorvspi_stat2_read(void) {
  152. unsigned char r = csr_readl(0xe0005014L);
  153. return r;
  154. }
  155. #define CSR_PICORVSPI_STAT3_ADDR 0xe0005018L
  156. #define CSR_PICORVSPI_STAT3_SIZE 1
  157. static inline unsigned char picorvspi_stat3_read(void) {
  158. unsigned char r = csr_readl(0xe0005018L);
  159. return r;
  160. }
  161. #define CSR_PICORVSPI_STAT4_ADDR 0xe000501cL
  162. #define CSR_PICORVSPI_STAT4_SIZE 1
  163. static inline unsigned char picorvspi_stat4_read(void) {
  164. unsigned char r = csr_readl(0xe000501cL);
  165. return r;
  166. }
  167. /* reboot */
  168. #define CSR_REBOOT_BASE 0xe0006000L
  169. #define CSR_REBOOT_CTRL_ADDR 0xe0006000L
  170. #define CSR_REBOOT_CTRL_SIZE 1
  171. static inline unsigned char reboot_ctrl_read(void) {
  172. unsigned char r = csr_readl(0xe0006000L);
  173. return r;
  174. }
  175. static inline void reboot_ctrl_write(unsigned char value) {
  176. csr_writel(value, 0xe0006000L);
  177. }
  178. #define CSR_REBOOT_CTRL_IMAGE_OFFSET 0
  179. #define CSR_REBOOT_CTRL_IMAGE_SIZE 2
  180. #define CSR_REBOOT_CTRL_KEY_OFFSET 2
  181. #define CSR_REBOOT_CTRL_KEY_SIZE 6
  182. #define CSR_REBOOT_ADDR_ADDR 0xe0006004L
  183. #define CSR_REBOOT_ADDR_SIZE 4
  184. static inline unsigned int reboot_addr_read(void) {
  185. unsigned int r = csr_readl(0xe0006004L);
  186. r <<= 8;
  187. r |= csr_readl(0xe0006008L);
  188. r <<= 8;
  189. r |= csr_readl(0xe000600cL);
  190. r <<= 8;
  191. r |= csr_readl(0xe0006010L);
  192. return r;
  193. }
  194. static inline void reboot_addr_write(unsigned int value) {
  195. csr_writel(value >> 24, 0xe0006004L);
  196. csr_writel(value >> 16, 0xe0006008L);
  197. csr_writel(value >> 8, 0xe000600cL);
  198. csr_writel(value, 0xe0006010L);
  199. }
  200. /* rgb */
  201. #define CSR_RGB_BASE 0xe0006800L
  202. #define CSR_RGB_DAT_ADDR 0xe0006800L
  203. #define CSR_RGB_DAT_SIZE 1
  204. static inline unsigned char rgb_dat_read(void) {
  205. unsigned char r = csr_readl(0xe0006800L);
  206. return r;
  207. }
  208. static inline void rgb_dat_write(unsigned char value) {
  209. csr_writel(value, 0xe0006800L);
  210. }
  211. #define CSR_RGB_ADDR_ADDR 0xe0006804L
  212. #define CSR_RGB_ADDR_SIZE 1
  213. static inline unsigned char rgb_addr_read(void) {
  214. unsigned char r = csr_readl(0xe0006804L);
  215. return r;
  216. }
  217. static inline void rgb_addr_write(unsigned char value) {
  218. csr_writel(value, 0xe0006804L);
  219. }
  220. #define CSR_RGB_CTRL_ADDR 0xe0006808L
  221. #define CSR_RGB_CTRL_SIZE 1
  222. static inline unsigned char rgb_ctrl_read(void) {
  223. unsigned char r = csr_readl(0xe0006808L);
  224. return r;
  225. }
  226. static inline void rgb_ctrl_write(unsigned char value) {
  227. csr_writel(value, 0xe0006808L);
  228. }
  229. #define CSR_RGB_CTRL_EXE_OFFSET 0
  230. #define CSR_RGB_CTRL_EXE_SIZE 1
  231. #define CSR_RGB_CTRL_CURREN_OFFSET 1
  232. #define CSR_RGB_CTRL_CURREN_SIZE 1
  233. #define CSR_RGB_CTRL_RGBLEDEN_OFFSET 2
  234. #define CSR_RGB_CTRL_RGBLEDEN_SIZE 1
  235. #define CSR_RGB_CTRL_RRAW_OFFSET 3
  236. #define CSR_RGB_CTRL_RRAW_SIZE 1
  237. #define CSR_RGB_CTRL_GRAW_OFFSET 4
  238. #define CSR_RGB_CTRL_GRAW_SIZE 1
  239. #define CSR_RGB_CTRL_BRAW_OFFSET 5
  240. #define CSR_RGB_CTRL_BRAW_SIZE 1
  241. #define CSR_RGB_RAW_ADDR 0xe000680cL
  242. #define CSR_RGB_RAW_SIZE 1
  243. static inline unsigned char rgb_raw_read(void) {
  244. unsigned char r = csr_readl(0xe000680cL);
  245. return r;
  246. }
  247. static inline void rgb_raw_write(unsigned char value) {
  248. csr_writel(value, 0xe000680cL);
  249. }
  250. #define CSR_RGB_RAW_R_OFFSET 0
  251. #define CSR_RGB_RAW_R_SIZE 1
  252. #define CSR_RGB_RAW_G_OFFSET 1
  253. #define CSR_RGB_RAW_G_SIZE 1
  254. #define CSR_RGB_RAW_B_OFFSET 2
  255. #define CSR_RGB_RAW_B_SIZE 1
  256. /* timer0 */
  257. #define CSR_TIMER0_BASE 0xe0002800L
  258. #define CSR_TIMER0_LOAD_ADDR 0xe0002800L
  259. #define CSR_TIMER0_LOAD_SIZE 4
  260. static inline unsigned int timer0_load_read(void) {
  261. unsigned int r = csr_readl(0xe0002800L);
  262. r <<= 8;
  263. r |= csr_readl(0xe0002804L);
  264. r <<= 8;
  265. r |= csr_readl(0xe0002808L);
  266. r <<= 8;
  267. r |= csr_readl(0xe000280cL);
  268. return r;
  269. }
  270. static inline void timer0_load_write(unsigned int value) {
  271. csr_writel(value >> 24, 0xe0002800L);
  272. csr_writel(value >> 16, 0xe0002804L);
  273. csr_writel(value >> 8, 0xe0002808L);
  274. csr_writel(value, 0xe000280cL);
  275. }
  276. #define CSR_TIMER0_RELOAD_ADDR 0xe0002810L
  277. #define CSR_TIMER0_RELOAD_SIZE 4
  278. static inline unsigned int timer0_reload_read(void) {
  279. unsigned int r = csr_readl(0xe0002810L);
  280. r <<= 8;
  281. r |= csr_readl(0xe0002814L);
  282. r <<= 8;
  283. r |= csr_readl(0xe0002818L);
  284. r <<= 8;
  285. r |= csr_readl(0xe000281cL);
  286. return r;
  287. }
  288. static inline void timer0_reload_write(unsigned int value) {
  289. csr_writel(value >> 24, 0xe0002810L);
  290. csr_writel(value >> 16, 0xe0002814L);
  291. csr_writel(value >> 8, 0xe0002818L);
  292. csr_writel(value, 0xe000281cL);
  293. }
  294. #define CSR_TIMER0_EN_ADDR 0xe0002820L
  295. #define CSR_TIMER0_EN_SIZE 1
  296. static inline unsigned char timer0_en_read(void) {
  297. unsigned char r = csr_readl(0xe0002820L);
  298. return r;
  299. }
  300. static inline void timer0_en_write(unsigned char value) {
  301. csr_writel(value, 0xe0002820L);
  302. }
  303. #define CSR_TIMER0_UPDATE_VALUE_ADDR 0xe0002824L
  304. #define CSR_TIMER0_UPDATE_VALUE_SIZE 1
  305. static inline unsigned char timer0_update_value_read(void) {
  306. unsigned char r = csr_readl(0xe0002824L);
  307. return r;
  308. }
  309. static inline void timer0_update_value_write(unsigned char value) {
  310. csr_writel(value, 0xe0002824L);
  311. }
  312. #define CSR_TIMER0_VALUE_ADDR 0xe0002828L
  313. #define CSR_TIMER0_VALUE_SIZE 4
  314. static inline unsigned int timer0_value_read(void) {
  315. unsigned int r = csr_readl(0xe0002828L);
  316. r <<= 8;
  317. r |= csr_readl(0xe000282cL);
  318. r <<= 8;
  319. r |= csr_readl(0xe0002830L);
  320. r <<= 8;
  321. r |= csr_readl(0xe0002834L);
  322. return r;
  323. }
  324. #define CSR_TIMER0_EV_STATUS_ADDR 0xe0002838L
  325. #define CSR_TIMER0_EV_STATUS_SIZE 1
  326. static inline unsigned char timer0_ev_status_read(void) {
  327. unsigned char r = csr_readl(0xe0002838L);
  328. return r;
  329. }
  330. static inline void timer0_ev_status_write(unsigned char value) {
  331. csr_writel(value, 0xe0002838L);
  332. }
  333. #define CSR_TIMER0_EV_PENDING_ADDR 0xe000283cL
  334. #define CSR_TIMER0_EV_PENDING_SIZE 1
  335. static inline unsigned char timer0_ev_pending_read(void) {
  336. unsigned char r = csr_readl(0xe000283cL);
  337. return r;
  338. }
  339. static inline void timer0_ev_pending_write(unsigned char value) {
  340. csr_writel(value, 0xe000283cL);
  341. }
  342. #define CSR_TIMER0_EV_ENABLE_ADDR 0xe0002840L
  343. #define CSR_TIMER0_EV_ENABLE_SIZE 1
  344. static inline unsigned char timer0_ev_enable_read(void) {
  345. unsigned char r = csr_readl(0xe0002840L);
  346. return r;
  347. }
  348. static inline void timer0_ev_enable_write(unsigned char value) {
  349. csr_writel(value, 0xe0002840L);
  350. }
  351. /* touch */
  352. #define CSR_TOUCH_BASE 0xe0005800L
  353. #define CSR_TOUCH_O_ADDR 0xe0005800L
  354. #define CSR_TOUCH_O_SIZE 1
  355. static inline unsigned char touch_o_read(void) {
  356. unsigned char r = csr_readl(0xe0005800L);
  357. return r;
  358. }
  359. static inline void touch_o_write(unsigned char value) {
  360. csr_writel(value, 0xe0005800L);
  361. }
  362. #define CSR_TOUCH_O_O_OFFSET 0
  363. #define CSR_TOUCH_O_O_SIZE 4
  364. #define CSR_TOUCH_OE_ADDR 0xe0005804L
  365. #define CSR_TOUCH_OE_SIZE 1
  366. static inline unsigned char touch_oe_read(void) {
  367. unsigned char r = csr_readl(0xe0005804L);
  368. return r;
  369. }
  370. static inline void touch_oe_write(unsigned char value) {
  371. csr_writel(value, 0xe0005804L);
  372. }
  373. #define CSR_TOUCH_OE_OE_OFFSET 0
  374. #define CSR_TOUCH_OE_OE_SIZE 4
  375. #define CSR_TOUCH_I_ADDR 0xe0005808L
  376. #define CSR_TOUCH_I_SIZE 1
  377. static inline unsigned char touch_i_read(void) {
  378. unsigned char r = csr_readl(0xe0005808L);
  379. return r;
  380. }
  381. #define CSR_TOUCH_I_I_OFFSET 0
  382. #define CSR_TOUCH_I_I_SIZE 4
  383. /* usb */
  384. #define CSR_USB_BASE 0xe0004800L
  385. #define CSR_USB_PULLUP_OUT_ADDR 0xe0004800L
  386. #define CSR_USB_PULLUP_OUT_SIZE 1
  387. static inline unsigned char usb_pullup_out_read(void) {
  388. unsigned char r = csr_readl(0xe0004800L);
  389. return r;
  390. }
  391. static inline void usb_pullup_out_write(unsigned char value) {
  392. csr_writel(value, 0xe0004800L);
  393. }
  394. #define CSR_USB_ADDRESS_ADDR 0xe0004804L
  395. #define CSR_USB_ADDRESS_SIZE 1
  396. static inline unsigned char usb_address_read(void) {
  397. unsigned char r = csr_readl(0xe0004804L);
  398. return r;
  399. }
  400. static inline void usb_address_write(unsigned char value) {
  401. csr_writel(value, 0xe0004804L);
  402. }
  403. #define CSR_USB_ADDRESS_ADDR_OFFSET 0
  404. #define CSR_USB_ADDRESS_ADDR_SIZE 7
  405. #define CSR_USB_NEXT_EV_ADDR 0xe0004808L
  406. #define CSR_USB_NEXT_EV_SIZE 1
  407. static inline unsigned char usb_next_ev_read(void) {
  408. unsigned char r = csr_readl(0xe0004808L);
  409. return r;
  410. }
  411. #define CSR_USB_NEXT_EV_IN_OFFSET 0
  412. #define CSR_USB_NEXT_EV_IN_SIZE 1
  413. #define CSR_USB_NEXT_EV_OUT_OFFSET 1
  414. #define CSR_USB_NEXT_EV_OUT_SIZE 1
  415. #define CSR_USB_NEXT_EV_SETUP_OFFSET 2
  416. #define CSR_USB_NEXT_EV_SETUP_SIZE 1
  417. #define CSR_USB_NEXT_EV_RESET_OFFSET 3
  418. #define CSR_USB_NEXT_EV_RESET_SIZE 1
  419. #define CSR_USB_SETUP_DATA_ADDR 0xe000480cL
  420. #define CSR_USB_SETUP_DATA_SIZE 1
  421. static inline unsigned char usb_setup_data_read(void) {
  422. unsigned char r = csr_readl(0xe000480cL);
  423. return r;
  424. }
  425. #define CSR_USB_SETUP_DATA_DATA_OFFSET 0
  426. #define CSR_USB_SETUP_DATA_DATA_SIZE 8
  427. #define CSR_USB_SETUP_CTRL_ADDR 0xe0004810L
  428. #define CSR_USB_SETUP_CTRL_SIZE 1
  429. static inline unsigned char usb_setup_ctrl_read(void) {
  430. unsigned char r = csr_readl(0xe0004810L);
  431. return r;
  432. }
  433. static inline void usb_setup_ctrl_write(unsigned char value) {
  434. csr_writel(value, 0xe0004810L);
  435. }
  436. #define CSR_USB_SETUP_CTRL_RESET_OFFSET 5
  437. #define CSR_USB_SETUP_CTRL_RESET_SIZE 1
  438. #define CSR_USB_SETUP_STATUS_ADDR 0xe0004814L
  439. #define CSR_USB_SETUP_STATUS_SIZE 1
  440. static inline unsigned char usb_setup_status_read(void) {
  441. unsigned char r = csr_readl(0xe0004814L);
  442. return r;
  443. }
  444. #define CSR_USB_SETUP_STATUS_EPNO_OFFSET 0
  445. #define CSR_USB_SETUP_STATUS_EPNO_SIZE 4
  446. #define CSR_USB_SETUP_STATUS_HAVE_OFFSET 4
  447. #define CSR_USB_SETUP_STATUS_HAVE_SIZE 1
  448. #define CSR_USB_SETUP_STATUS_PEND_OFFSET 5
  449. #define CSR_USB_SETUP_STATUS_PEND_SIZE 1
  450. #define CSR_USB_SETUP_STATUS_IS_IN_OFFSET 6
  451. #define CSR_USB_SETUP_STATUS_IS_IN_SIZE 1
  452. #define CSR_USB_SETUP_STATUS_DATA_OFFSET 7
  453. #define CSR_USB_SETUP_STATUS_DATA_SIZE 1
  454. #define CSR_USB_SETUP_EV_STATUS_ADDR 0xe0004818L
  455. #define CSR_USB_SETUP_EV_STATUS_SIZE 1
  456. static inline unsigned char usb_setup_ev_status_read(void) {
  457. unsigned char r = csr_readl(0xe0004818L);
  458. return r;
  459. }
  460. static inline void usb_setup_ev_status_write(unsigned char value) {
  461. csr_writel(value, 0xe0004818L);
  462. }
  463. #define CSR_USB_SETUP_EV_PENDING_ADDR 0xe000481cL
  464. #define CSR_USB_SETUP_EV_PENDING_SIZE 1
  465. static inline unsigned char usb_setup_ev_pending_read(void) {
  466. unsigned char r = csr_readl(0xe000481cL);
  467. return r;
  468. }
  469. static inline void usb_setup_ev_pending_write(unsigned char value) {
  470. csr_writel(value, 0xe000481cL);
  471. }
  472. #define CSR_USB_SETUP_EV_ENABLE_ADDR 0xe0004820L
  473. #define CSR_USB_SETUP_EV_ENABLE_SIZE 1
  474. static inline unsigned char usb_setup_ev_enable_read(void) {
  475. unsigned char r = csr_readl(0xe0004820L);
  476. return r;
  477. }
  478. static inline void usb_setup_ev_enable_write(unsigned char value) {
  479. csr_writel(value, 0xe0004820L);
  480. }
  481. #define CSR_USB_IN_DATA_ADDR 0xe0004824L
  482. #define CSR_USB_IN_DATA_SIZE 1
  483. static inline unsigned char usb_in_data_read(void) {
  484. unsigned char r = csr_readl(0xe0004824L);
  485. return r;
  486. }
  487. static inline void usb_in_data_write(unsigned char value) {
  488. csr_writel(value, 0xe0004824L);
  489. }
  490. #define CSR_USB_IN_DATA_DATA_OFFSET 0
  491. #define CSR_USB_IN_DATA_DATA_SIZE 8
  492. #define CSR_USB_IN_CTRL_ADDR 0xe0004828L
  493. #define CSR_USB_IN_CTRL_SIZE 1
  494. static inline unsigned char usb_in_ctrl_read(void) {
  495. unsigned char r = csr_readl(0xe0004828L);
  496. return r;
  497. }
  498. static inline void usb_in_ctrl_write(unsigned char value) {
  499. csr_writel(value, 0xe0004828L);
  500. }
  501. #define CSR_USB_IN_CTRL_EPNO_OFFSET 0
  502. #define CSR_USB_IN_CTRL_EPNO_SIZE 4
  503. #define CSR_USB_IN_CTRL_RESET_OFFSET 5
  504. #define CSR_USB_IN_CTRL_RESET_SIZE 1
  505. #define CSR_USB_IN_CTRL_STALL_OFFSET 6
  506. #define CSR_USB_IN_CTRL_STALL_SIZE 1
  507. #define CSR_USB_IN_STATUS_ADDR 0xe000482cL
  508. #define CSR_USB_IN_STATUS_SIZE 1
  509. static inline unsigned char usb_in_status_read(void) {
  510. unsigned char r = csr_readl(0xe000482cL);
  511. return r;
  512. }
  513. #define CSR_USB_IN_STATUS_IDLE_OFFSET 0
  514. #define CSR_USB_IN_STATUS_IDLE_SIZE 1
  515. #define CSR_USB_IN_STATUS_HAVE_OFFSET 4
  516. #define CSR_USB_IN_STATUS_HAVE_SIZE 1
  517. #define CSR_USB_IN_STATUS_PEND_OFFSET 5
  518. #define CSR_USB_IN_STATUS_PEND_SIZE 1
  519. #define CSR_USB_IN_EV_STATUS_ADDR 0xe0004830L
  520. #define CSR_USB_IN_EV_STATUS_SIZE 1
  521. static inline unsigned char usb_in_ev_status_read(void) {
  522. unsigned char r = csr_readl(0xe0004830L);
  523. return r;
  524. }
  525. static inline void usb_in_ev_status_write(unsigned char value) {
  526. csr_writel(value, 0xe0004830L);
  527. }
  528. #define CSR_USB_IN_EV_PENDING_ADDR 0xe0004834L
  529. #define CSR_USB_IN_EV_PENDING_SIZE 1
  530. static inline unsigned char usb_in_ev_pending_read(void) {
  531. unsigned char r = csr_readl(0xe0004834L);
  532. return r;
  533. }
  534. static inline void usb_in_ev_pending_write(unsigned char value) {
  535. csr_writel(value, 0xe0004834L);
  536. }
  537. #define CSR_USB_IN_EV_ENABLE_ADDR 0xe0004838L
  538. #define CSR_USB_IN_EV_ENABLE_SIZE 1
  539. static inline unsigned char usb_in_ev_enable_read(void) {
  540. unsigned char r = csr_readl(0xe0004838L);
  541. return r;
  542. }
  543. static inline void usb_in_ev_enable_write(unsigned char value) {
  544. csr_writel(value, 0xe0004838L);
  545. }
  546. #define CSR_USB_OUT_DATA_ADDR 0xe000483cL
  547. #define CSR_USB_OUT_DATA_SIZE 1
  548. static inline unsigned char usb_out_data_read(void) {
  549. unsigned char r = csr_readl(0xe000483cL);
  550. return r;
  551. }
  552. #define CSR_USB_OUT_DATA_DATA_OFFSET 0
  553. #define CSR_USB_OUT_DATA_DATA_SIZE 8
  554. #define CSR_USB_OUT_CTRL_ADDR 0xe0004840L
  555. #define CSR_USB_OUT_CTRL_SIZE 1
  556. static inline unsigned char usb_out_ctrl_read(void) {
  557. unsigned char r = csr_readl(0xe0004840L);
  558. return r;
  559. }
  560. static inline void usb_out_ctrl_write(unsigned char value) {
  561. csr_writel(value, 0xe0004840L);
  562. }
  563. #define CSR_USB_OUT_CTRL_EPNO_OFFSET 0
  564. #define CSR_USB_OUT_CTRL_EPNO_SIZE 4
  565. #define CSR_USB_OUT_CTRL_ENABLE_OFFSET 4
  566. #define CSR_USB_OUT_CTRL_ENABLE_SIZE 1
  567. #define CSR_USB_OUT_CTRL_RESET_OFFSET 5
  568. #define CSR_USB_OUT_CTRL_RESET_SIZE 1
  569. #define CSR_USB_OUT_CTRL_STALL_OFFSET 6
  570. #define CSR_USB_OUT_CTRL_STALL_SIZE 1
  571. #define CSR_USB_OUT_STATUS_ADDR 0xe0004844L
  572. #define CSR_USB_OUT_STATUS_SIZE 1
  573. static inline unsigned char usb_out_status_read(void) {
  574. unsigned char r = csr_readl(0xe0004844L);
  575. return r;
  576. }
  577. #define CSR_USB_OUT_STATUS_EPNO_OFFSET 0
  578. #define CSR_USB_OUT_STATUS_EPNO_SIZE 4
  579. #define CSR_USB_OUT_STATUS_HAVE_OFFSET 4
  580. #define CSR_USB_OUT_STATUS_HAVE_SIZE 1
  581. #define CSR_USB_OUT_STATUS_PEND_OFFSET 5
  582. #define CSR_USB_OUT_STATUS_PEND_SIZE 1
  583. #define CSR_USB_OUT_EV_STATUS_ADDR 0xe0004848L
  584. #define CSR_USB_OUT_EV_STATUS_SIZE 1
  585. static inline unsigned char usb_out_ev_status_read(void) {
  586. unsigned char r = csr_readl(0xe0004848L);
  587. return r;
  588. }
  589. static inline void usb_out_ev_status_write(unsigned char value) {
  590. csr_writel(value, 0xe0004848L);
  591. }
  592. #define CSR_USB_OUT_EV_PENDING_ADDR 0xe000484cL
  593. #define CSR_USB_OUT_EV_PENDING_SIZE 1
  594. static inline unsigned char usb_out_ev_pending_read(void) {
  595. unsigned char r = csr_readl(0xe000484cL);
  596. return r;
  597. }
  598. static inline void usb_out_ev_pending_write(unsigned char value) {
  599. csr_writel(value, 0xe000484cL);
  600. }
  601. #define CSR_USB_OUT_EV_ENABLE_ADDR 0xe0004850L
  602. #define CSR_USB_OUT_EV_ENABLE_SIZE 1
  603. static inline unsigned char usb_out_ev_enable_read(void) {
  604. unsigned char r = csr_readl(0xe0004850L);
  605. return r;
  606. }
  607. static inline void usb_out_ev_enable_write(unsigned char value) {
  608. csr_writel(value, 0xe0004850L);
  609. }
  610. #define CSR_USB_OUT_ENABLE_STATUS_ADDR 0xe0004854L
  611. #define CSR_USB_OUT_ENABLE_STATUS_SIZE 1
  612. static inline unsigned char usb_out_enable_status_read(void) {
  613. unsigned char r = csr_readl(0xe0004854L);
  614. return r;
  615. }
  616. #define CSR_USB_OUT_STALL_STATUS_ADDR 0xe0004858L
  617. #define CSR_USB_OUT_STALL_STATUS_SIZE 1
  618. static inline unsigned char usb_out_stall_status_read(void) {
  619. unsigned char r = csr_readl(0xe0004858L);
  620. return r;
  621. }
  622. /* version */
  623. #define CSR_VERSION_BASE 0xe0007000L
  624. #define CSR_VERSION_MAJOR_ADDR 0xe0007000L
  625. #define CSR_VERSION_MAJOR_SIZE 1
  626. static inline unsigned char version_major_read(void) {
  627. unsigned char r = csr_readl(0xe0007000L);
  628. return r;
  629. }
  630. #define CSR_VERSION_MINOR_ADDR 0xe0007004L
  631. #define CSR_VERSION_MINOR_SIZE 1
  632. static inline unsigned char version_minor_read(void) {
  633. unsigned char r = csr_readl(0xe0007004L);
  634. return r;
  635. }
  636. #define CSR_VERSION_REVISION_ADDR 0xe0007008L
  637. #define CSR_VERSION_REVISION_SIZE 1
  638. static inline unsigned char version_revision_read(void) {
  639. unsigned char r = csr_readl(0xe0007008L);
  640. return r;
  641. }
  642. #define CSR_VERSION_GITREV_ADDR 0xe000700cL
  643. #define CSR_VERSION_GITREV_SIZE 4
  644. static inline unsigned int version_gitrev_read(void) {
  645. unsigned int r = csr_readl(0xe000700cL);
  646. r <<= 8;
  647. r |= csr_readl(0xe0007010L);
  648. r <<= 8;
  649. r |= csr_readl(0xe0007014L);
  650. r <<= 8;
  651. r |= csr_readl(0xe0007018L);
  652. return r;
  653. }
  654. #define CSR_VERSION_GITEXTRA_ADDR 0xe000701cL
  655. #define CSR_VERSION_GITEXTRA_SIZE 2
  656. static inline unsigned short int version_gitextra_read(void) {
  657. unsigned short int r = csr_readl(0xe000701cL);
  658. r <<= 8;
  659. r |= csr_readl(0xe0007020L);
  660. return r;
  661. }
  662. #define CSR_VERSION_DIRTY_ADDR 0xe0007024L
  663. #define CSR_VERSION_DIRTY_SIZE 1
  664. static inline unsigned char version_dirty_read(void) {
  665. unsigned char r = csr_readl(0xe0007024L);
  666. return r;
  667. }
  668. #define CSR_VERSION_DIRTY_DIRTY_OFFSET 0
  669. #define CSR_VERSION_DIRTY_DIRTY_SIZE 1
  670. #define CSR_VERSION_MODEL_ADDR 0xe0007028L
  671. #define CSR_VERSION_MODEL_SIZE 1
  672. static inline unsigned char version_model_read(void) {
  673. unsigned char r = csr_readl(0xe0007028L);
  674. return r;
  675. }
  676. #define CSR_VERSION_MODEL_MODEL_OFFSET 0
  677. #define CSR_VERSION_MODEL_MODEL_SIZE 8
  678. #define CSR_VERSION_SEED_ADDR 0xe000702cL
  679. #define CSR_VERSION_SEED_SIZE 4
  680. static inline unsigned int version_seed_read(void) {
  681. unsigned int r = csr_readl(0xe000702cL);
  682. r <<= 8;
  683. r |= csr_readl(0xe0007030L);
  684. r <<= 8;
  685. r |= csr_readl(0xe0007034L);
  686. r <<= 8;
  687. r |= csr_readl(0xe0007038L);
  688. return r;
  689. }
  690. /* constants */
  691. #define TIMER0_INTERRUPT 2
  692. static inline int timer0_interrupt_read(void) {
  693. return 2;
  694. }
  695. #define USB_INTERRUPT 3
  696. static inline int usb_interrupt_read(void) {
  697. return 3;
  698. }
  699. #define CONFIG_BITSTREAM_SYNC_HEADER1 2123999870
  700. static inline int config_bitstream_sync_header1_read(void) {
  701. return 2123999870;
  702. }
  703. #define CONFIG_BITSTREAM_SYNC_HEADER2 2125109630
  704. static inline int config_bitstream_sync_header2_read(void) {
  705. return 2125109630;
  706. }
  707. #define CONFIG_CLOCK_FREQUENCY 12000000
  708. static inline int config_clock_frequency_read(void) {
  709. return 12000000;
  710. }
  711. #define CONFIG_CPU_RESET_ADDR 0
  712. static inline int config_cpu_reset_addr_read(void) {
  713. return 0;
  714. }
  715. #define CONFIG_CPU_TYPE "VEXRISCV"
  716. static inline const char * config_cpu_type_read(void) {
  717. return "VEXRISCV";
  718. }
  719. #define CONFIG_CPU_TYPE_VEXRISCV 1
  720. static inline int config_cpu_type_vexriscv_read(void) {
  721. return 1;
  722. }
  723. #define CONFIG_CPU_VARIANT "MIN"
  724. static inline const char * config_cpu_variant_read(void) {
  725. return "MIN";
  726. }
  727. #define CONFIG_CPU_VARIANT_MIN 1
  728. static inline int config_cpu_variant_min_read(void) {
  729. return 1;
  730. }
  731. #define CONFIG_CSR_ALIGNMENT 32
  732. static inline int config_csr_alignment_read(void) {
  733. return 32;
  734. }
  735. #define CONFIG_CSR_DATA_WIDTH 8
  736. static inline int config_csr_data_width_read(void) {
  737. return 8;
  738. }
  739. #endif