m5272.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:27k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* m5272.h - Motorola MCF5272 CPU control registers */
  2. /* Copyright 1994-2001 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01a,20mar01,hjg  Created from m5206e.h
  7. */
  8. /*
  9. This file contains I/O addresses and related constants for the MCF5272
  10. */
  11. #ifndef __INCm5272h
  12. #define __INCm5272h
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /*
  17. Need to use a distinct cast macro in order to not conflict with other
  18. include files.
  19. */
  20. #ifdef _ASMLANGUAGE
  21. #define CAST_M5272(x)
  22. #else /* _ASMLANGUAGE */
  23. #define CAST_M5272(x) (x)
  24. #endif /* _ASMLANGUAGE */
  25. /* Size of internal SRAM */
  26. #define M5272_SRAM_SIZE 4096 /* size of internal SRAM */
  27. /* System Integration Module register addresses */
  28. #define M5272_SIM_MBAR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x000))
  29. #define M5272_SIM_SCR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x004))
  30. #define M5272_SIM_SPR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x006))
  31. #define M5272_SIM_PMR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x008))
  32. #define M5272_SIM_ALPR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x00e))
  33. #define M5272_SIM_DIR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x010))
  34. #define M5272_SIM_MBAR_BA (0xffff << 16) /* base address */
  35. #define M5272_SIM_MBAR_SC (1 << 4) /* set masks supervisor code */
  36. #define M5272_SIM_MBAR_SD (1 << 3) /* set masks supervisor data */
  37. #define M5272_SIM_MBAR_UC (1 << 2) /* set masks user code */
  38. #define M5272_SIM_MBAR_UD (1 << 1) /* set masks user data */
  39. #define M5272_SIM_MBAR_V (1 << 0) /* settings are valid */
  40. #define M5272_SIM_SCR_RSTSRC (3 << 12) /* reset source */
  41. #define M5272_SIM_SCR_Priority (1 << 8) /* select bus priority scheme */
  42. #define M5272_SIM_SCR_AR (1 << 7) /* assume request */
  43. #define M5272_SIM_SCR_SoftRST (1 << 6) /* reset on-chip peripherals */
  44. #define M5272_SIM_SCR_BusLock (1 << 3) /* lock ownership of the bus */
  45. #define M5272_SIM_SCR_HWR_128 (0x0) /* hw watchdog   128 clocks */
  46. #define M5272_SIM_SCR_HWR_256 (0x1) /* hw watchdog   256 clocks */
  47. #define M5272_SIM_SCR_HWR_512 (0x2) /* hw watchdog   512 clocks */
  48. #define M5272_SIM_SCR_HWR_1024 (0x3) /* hw watchdog  1024 clocks */
  49. #define M5272_SIM_SCR_HWR_2048 (0x4) /* hw watchdog  2048 clocks */
  50. #define M5272_SIM_SCR_HWR_4096 (0x5) /* hw watchdog  4096 clocks */
  51. #define M5272_SIM_SCR_HWR_8192 (0x6) /* hw watchdog  8192 clocks */
  52. #define M5272_SIM_SCR_HWR_16384 (0x7) /* hw watchdog 16384 clocks */
  53. #define M5272_SIM_SPR_ADC (1 << 15) /* addr decode conflict */
  54. #define M5272_SIM_SPR_WPV (1 << 14) /* wr protect violation */
  55. #define M5272_SIM_SPR_SMV (1 << 13) /* stopped module viol */
  56. #define M5272_SIM_SPR_PE (1 << 12) /* peripheral error */
  57. #define M5272_SIM_SPR_HWT (1 << 11) /* hw watchdog timer */
  58. #define M5272_SIM_SPR_RPV (1 << 10) /* read protect viol */
  59. #define M5272_SIM_SPR_EXT (1 << 9) /* extern. transf. err. */
  60. #define M5272_SIM_SPR_SUV (1 << 8) /* superv./user viol */
  61. #define M5272_SIM_SPR_ADCEN (1 << 7) /* addr decode conflict, excp */
  62. #define M5272_SIM_SPR_WPVEN (1 << 6) /* wr protect violation, excp */
  63. #define M5272_SIM_SPR_SMVEN (1 << 5) /* stopped module viol, excp */
  64. #define M5272_SIM_SPR_PEVEN (1 << 4) /* peripheral error, excp */
  65. #define M5272_SIM_SPR_HWTEN (1 << 3) /* hw watchdog timer, excp */
  66. #define M5272_SIM_SPR_RPVEN (1 << 2) /* read protect viol, excp */
  67. #define M5272_SIM_SPR_EXTEN (1 << 1) /* extern. transf. err., excp */
  68. #define M5272_SIM_SPR_SUVEN (1 << 0) /* superv./user viol, excp */
  69. #define M5272_SIM_PMR_BDMPDN (1 << 31) /* debug power-down enable */
  70. #define M5272_SIM_PMR_ENETPDN (1 << 26) /* ethernet power-down enable */
  71. #define M5272_SIM_PMR_PLIPDN (1 << 25) /* PLIC power-down enable */
  72. #define M5272_SIM_PMR_DRAMPDN (1 << 24) /* DRAM contr. pwrdwn enable */
  73. #define M5272_SIM_PMR_DMAPDN (1 << 23) /* DMA contr. pwrdwn enable */
  74. #define M5272_SIM_PMR_PWMPDN (1 << 22) /* PWM power-down enable */
  75. #define M5272_SIM_PMR_QSPIPDN (1 << 21) /* QSPI power-down enable */
  76. #define M5272_SIM_PMR_TIMERPDN (1 << 20) /* timer power-down enable */
  77. #define M5272_SIM_PMR_GPIOPDN (1 << 19) /* Parallel port pwrdwn enable*/
  78. #define M5272_SIM_PMR_USBPDN (1 << 18) /* USB power-down enable */
  79. #define M5272_SIM_PMR_UART1PDN (1 << 17) /* UART1 power-down enable */
  80. #define M5272_SIM_PMR_UART0PDN (1 << 16) /* UART0 power-down enable */ 
  81. #define M5272_SIM_PMR_USBWK (1 << 10) /* USB wakeup enable */ 
  82. #define M5272_SIM_PMR_UART1WK (1 << 9) /* UART1 wakeup enable */ 
  83. #define M5272_SIM_PMR_UART0WK (1 << 8) /* UART0 wakeup enable */ 
  84. #define M5272_SIM_PMR_MOS (1 << 5) /* main oscillator stop */ 
  85. #define M5272_SIM_PMR_SLPEN (1 << 4) /* sleep enable */ 
  86. #define M5272_SIM_DIR_VERSION (0xf << 28) /* version number */ 
  87. #define M5272_SIM_DIR_DSGNCNTR (0x3f << 22) /* design center */ 
  88. #define M5272_SIM_DIR_DEVNR (0x3ff << 12) /* device number */ 
  89. #define M5272_SIM_DIR_JEDEC (0xfff << 1) /* reduced Motorola-JEDEC-ID */ 
  90. /* Interrupt Controller Registers */
  91. #define M5272_SIM_ICR1(base) (CAST_M5272(volatile UINT32 *)((base) + 0x020))
  92. #define M5272_SIM_ICR2(base) (CAST_M5272(volatile UINT32 *)((base) + 0x024))
  93. #define M5272_SIM_ICR3(base) (CAST_M5272(volatile UINT32 *)((base) + 0x028))
  94. #define M5272_SIM_ICR4(base) (CAST_M5272(volatile UINT32 *)((base) + 0x02c))
  95. #define M5272_SIM_ISR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x030))
  96. #define M5272_SIM_PITR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x034))
  97. #define M5272_SIM_PIWR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x038))
  98. #define M5272_SIM_PIVR(base) (CAST_M5272(volatile UINT8  *)((base) + 0x03f))
  99. #define M5272_SIM_PITR_POS_EDGE (0x00000000) /* positive edge triggered */
  100. #define M5272_SIM_PITR_NEG_EDGE (0xf0000060) /* negative edge triggered */
  101. /* Chip Select Registers */
  102. #define M5272_CS_CSBR0(base) (CAST_M5272(volatile UINT32 *)((base) + 0x040))
  103. #define M5272_CS_CSOR0(base) (CAST_M5272(volatile UINT32 *)((base) + 0x044))
  104. #define M5272_CS_CSBR1(base) (CAST_M5272(volatile UINT32 *)((base) + 0x048))
  105. #define M5272_CS_CSOR1(base) (CAST_M5272(volatile UINT32 *)((base) + 0x04c))
  106. #define M5272_CS_CSBR2(base) (CAST_M5272(volatile UINT32 *)((base) + 0x050))
  107. #define M5272_CS_CSOR2(base) (CAST_M5272(volatile UINT32 *)((base) + 0x054))
  108. #define M5272_CS_CSBR3(base) (CAST_M5272(volatile UINT32 *)((base) + 0x058))
  109. #define M5272_CS_CSOR3(base) (CAST_M5272(volatile UINT32 *)((base) + 0x05c))
  110. #define M5272_CS_CSBR4(base) (CAST_M5272(volatile UINT32 *)((base) + 0x060))
  111. #define M5272_CS_CSOR4(base) (CAST_M5272(volatile UINT32 *)((base) + 0x064))
  112. #define M5272_CS_CSBR5(base) (CAST_M5272(volatile UINT32 *)((base) + 0x068))
  113. #define M5272_CS_CSOR5(base) (CAST_M5272(volatile UINT32 *)((base) + 0x06c))
  114. #define M5272_CS_CSBR6(base) (CAST_M5272(volatile UINT32 *)((base) + 0x070))
  115. #define M5272_CS_CSOR6(base) (CAST_M5272(volatile UINT32 *)((base) + 0x074))
  116. #define M5272_CS_CSBR7(base) (CAST_M5272(volatile UINT32 *)((base) + 0x078))
  117. #define M5272_CS_CSOR7(base) (CAST_M5272(volatile UINT32 *)((base) + 0x07c))
  118. #define M5272_CS_CSBR_BA (0xfffff << 12) /* base address */
  119. #define M5272_CS_CSBR_EBI (3 << 10) /* ext. bus interface modes */
  120. #define M5272_CS_CSBR_BW (3 << 8) /* bus width */
  121. #define M5272_CS_CSBR_SUPER (1 << 7) /* supervisor mode */
  122. #define M5272_CS_CSBR_TT (3 << 5) /* transfer type */
  123. #define M5272_CS_CSBR_TM (7 << 2) /* transfer modifier */
  124. #define M5272_CS_CSBR_CTM (1 << 1) /* compare TM */
  125. #define M5272_CS_CSBR_ENABLE (1 << 0) /* enable/disable chip select */
  126. #define M5272_CS_CSBR_BW_LONGW (0x0 << 8) /* bus width = 32 bit */
  127. #define M5272_CS_CSBR_BW_BYTE (0x1 << 8) /* bus width = 8 bit */
  128. #define M5272_CS_CSBR_BW_WORD (0x2 << 8) /* bus width = 16 bit */
  129. #define M5272_CS_CSBR_BW_LINE (0x3 << 8) /* bus width = cache line (32)*/
  130. #define M5272_CS_CSBR_EBI_1632 (0x0 << 10) /* 16/32 bit SRAM/ROM */
  131. #define M5272_CS_CSBR_EBI_SDRAM (0x1 << 10) /* SDRAM (CS7 only) */
  132. #define M5272_CS_CSBR_EBI_8 (0x3 << 10) /* 8 bit SRAM/ROM */
  133. #define M5272_CS_CSOR_BAM (0xfffff << 12) /* address mask */
  134. #define M5272_CS_CSOR_ASET (1 << 11) /* address setup enable */
  135. #define M5272_CS_CSOR_WRAH (1 << 10) /* write address hold enable */
  136. #define M5272_CS_CSOR_RDAH (1 << 9) /* read address hold enable */
  137. #define M5272_CS_CSOR_EXTBURST (1 << 8) /* enable extended burst */
  138. #define M5272_CS_CSOR_WS(a) (((a)&0x1f)<<2) /* wait state generator */
  139. #define M5272_CS_CSOR_RW (1 << 1) /* RW and MRW determine if */
  140. #define M5272_CS_CSOR_MRW (1 << 0) /* read only or write only  */
  141. #define M5272_CS_CSOR_BAM_32M (0xfe000000)
  142. #define M5272_CS_CSOR_BAM_16M (0xff000000)
  143. #define M5272_CS_CSOR_BAM_8M (0xff800000)
  144. #define M5272_CS_CSOR_BAM_4M (0xffc00000)
  145. #define M5272_CS_CSOR_BAM_2M (0xffe00000)
  146. #define M5272_CS_CSOR_BAM_1M (0xfff00000)
  147. #define M5272_CS_CSOR_BAM_512K (0xfff80000)
  148. #define M5272_CS_CSOR_BAM_256K (0xfffc0000)
  149. #define M5272_CS_CSOR_BAM_128K (0xfffe0000)
  150. #define M5272_CS_CSOR_BAM_64K (0xffff0000)
  151. #define M5272_CS_CSOR_BAM_32K (0xffff8000)
  152. #define M5272_CS_CSOR_BAM_16K (0xffffc000)
  153. #define M5272_CS_CSOR_BAM_8K (0xffffe000)
  154. #define M5272_CS_CSOR_BAM_4K (0xfffff000)
  155. /* Software Watchdog Registers */
  156. #define M5272_SIM_WRRR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x282))
  157. #define M5272_SIM_WIRR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x286))
  158. #define M5272_SIM_WCR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x28a))
  159. #define M5272_SIM_WER(base) (CAST_M5272(volatile UINT16 *)((base) + 0x28e))
  160. #define M5272_SIM_WRRR_REF (0x7fff << 1) /* reference value */ 
  161. #define M5272_SIM_WRRR_EN (1 << 0) /* enable watchdog */ 
  162. #define M5272_SIM_WIRR_REF (0x7fff << 1) /* reference value */ 
  163. #define M5272_SIM_WIRR_IEN (1 << 0) /* enable interrupt */ 
  164. #define M5272_SIM_WCR_COUNT (0xffff << 0) /* counter value */ 
  165. #define M5272_SIM_WER_WIE (1 << 0) /* watchdog interrupt event */ 
  166. /* GPIO Port Register Memory Map */
  167. #define M5272_GPIO_PACNT(base) (CAST_M5272(volatile UINT32 *)((base) + 0x080))
  168. #define M5272_GPIO_PADDR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x084))
  169. #define M5272_GPIO_PADAT(base) (CAST_M5272(volatile UINT16 *)((base) + 0x086))
  170. #define M5272_GPIO_PBCNT(base) (CAST_M5272(volatile UINT32 *)((base) + 0x088))
  171. #define M5272_GPIO_PBDDR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x08c))
  172. #define M5272_GPIO_PBDAT(base) (CAST_M5272(volatile UINT16 *)((base) + 0x08e))
  173. #define M5272_GPIO_PCDDR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x094))
  174. #define M5272_GPIO_PCDAT(base) (CAST_M5272(volatile UINT16 *)((base) + 0x096))
  175. #define M5272_GPIO_PDCNT(base) (CAST_M5272(volatile UINT32 *)((base) + 0x098))
  176. #define M5272_GPIO_PACNT_PACNT15 (3 << 30) /* configure pin M3 */ 
  177. #define M5272_GPIO_PACNT_PACNT14 (3 << 28) /* configure pin M2 */ 
  178. #define M5272_GPIO_PACNT_PACNT13 (3 << 26) /* configure pin L3 */ 
  179. #define M5272_GPIO_PACNT_PACNT12 (3 << 24) /* configure pin L2 */ 
  180. #define M5272_GPIO_PACNT_PACNT11 (3 << 22) /* configure pin L1 */ 
  181. #define M5272_GPIO_PACNT_PACNT10 (3 << 20) /* configure pin K5 */ 
  182. #define M5272_GPIO_PACNT_PACNT9 (3 << 18) /* configure pin J3 */ 
  183. #define M5272_GPIO_PACNT_PACNT8 (3 << 16) /* configure pin J2 */ 
  184. #define M5272_GPIO_PACNT_PACNT7 (3 << 14) /* configure pin P1 */ 
  185. #define M5272_GPIO_PACNT_PACNT6 (3 << 12) /* configure pin E1 */ 
  186. #define M5272_GPIO_PACNT_PACNT5 (3 << 10) /* configure pin E2 */ 
  187. #define M5272_GPIO_PACNT_PACNT4 (3 << 8) /* configure pin E3 */ 
  188. #define M5272_GPIO_PACNT_PACNT3 (3 << 6) /* configure pin E4 */ 
  189. #define M5272_GPIO_PACNT_PACNT2 (3 << 4) /* configure pin E5 */ 
  190. #define M5272_GPIO_PACNT_PACNT1 (3 << 2) /* configure pin D1 */ 
  191. #define M5272_GPIO_PACNT_PACNT0 (3 << 0) /* configure pin D2 */ 
  192. #define M5272_GPIO_PBCNT_PBCNT15 (3 << 30) /* configure pin P10 */ 
  193. #define M5272_GPIO_PBCNT_PBCNT14 (3 << 28) /* configure pin L9 */ 
  194. #define M5272_GPIO_PBCNT_PBCNT13 (3 << 26) /* configure pin M9 */ 
  195. #define M5272_GPIO_PBCNT_PBCNT12 (3 << 24) /* configure pin N9 */ 
  196. #define M5272_GPIO_PBCNT_PBCNT11 (3 << 22) /* configure pin P9 */ 
  197. #define M5272_GPIO_PBCNT_PBCNT10 (3 << 20) /* configure pin L8 */ 
  198. #define M5272_GPIO_PBCNT_PBCNT9 (3 << 18) /* configure pin M8 */ 
  199. #define M5272_GPIO_PBCNT_PBCNT8 (3 << 16) /* configure pin N8 */ 
  200. #define M5272_GPIO_PBCNT_PBCNT7 (3 << 14) /* configure pin M6 */ 
  201. #define M5272_GPIO_PBCNT_PBCNT6 (3 << 12) /* configure pin G4 */ 
  202. #define M5272_GPIO_PBCNT_PBCNT5 (3 << 10) /* configure pin F3 */ 
  203. #define M5272_GPIO_PBCNT_PBCNT4 (3 << 8) /* configure pin G3 */ 
  204. #define M5272_GPIO_PBCNT_PBCNT3 (3 << 6) /* configure pin H3 */ 
  205. #define M5272_GPIO_PBCNT_PBCNT2 (3 << 4) /* configure pin H2 */ 
  206. #define M5272_GPIO_PBCNT_PBCNT1 (3 << 2) /* configure pin H1 */ 
  207. #define M5272_GPIO_PBCNT_PBCNT0 (3 << 0) /* configure pin H4 */ 
  208. #define M5272_GPIO_PDCNT_PDCNT7 (3 << 14) /* configure pin K6 */ 
  209. #define M5272_GPIO_PDCNT_PDCNT6 (3 << 12) /* configure pin P5 */ 
  210. #define M5272_GPIO_PDCNT_PDCNT5 (3 << 10) /* configure pin P2 */ 
  211. #define M5272_GPIO_PDCNT_PDCNT4 (3 << 8) /* configure pin K1 */ 
  212. #define M5272_GPIO_PDCNT_PDCNT3 (3 << 6) /* configure pin K3 */ 
  213. #define M5272_GPIO_PDCNT_PDCNT2 (3 << 4) /* configure pin K2 */ 
  214. #define M5272_GPIO_PDCNT_PDCNT1 (3 << 2) /* configure pin K1 */ 
  215. #define M5272_GPIO_PDCNT_PDCNT0 (3 << 0) /* configure pin J4 */ 
  216. /* QSPI Module Memory Map */
  217. #define M5272_QSPI_QMR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0a0))
  218. #define M5272_QSPI_QDLYR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0a4))
  219. #define M5272_QSPI_QWR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0a8))
  220. #define M5272_QSPI_QIR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0ac))
  221. #define M5272_QSPI_QAR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0b0))
  222. #define M5272_QSPI_QDR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x0b4))
  223. /* PWM Module Memory Map */
  224. #define M5272_PWM_PWCR1(base) (CAST_M5272(volatile UINT8  *)((base) + 0x0c0))
  225. #define M5272_PWM_PWCR2(base) (CAST_M5272(volatile UINT8  *)((base) + 0x0c4))
  226. #define M5272_PWM_PWCR3(base) (CAST_M5272(volatile UINT8  *)((base) + 0x0c8))
  227. #define M5272_PWM_PWWD1(base) (CAST_M5272(volatile UINT8  *)((base) + 0x0d0))
  228. #define M5272_PWM_PWWD2(base) (CAST_M5272(volatile UINT8  *)((base) + 0x0d4))
  229. #define M5272_PWM_PWWD3(base) (CAST_M5272(volatile UINT8  *)((base) + 0x0d8))
  230. /* DMA Module Memory Map */
  231. #define M5272_DMA_DMR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x0e0))
  232. #define M5272_DMA_DIR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x0e6))
  233. #define M5272_DMA_DBCR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x0e8))
  234. #define M5272_DMA_DSAR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x0ec))
  235. #define M5272_DMA_DDAR(base) (CAST_M5272(volatile UINT32 *)((base) + 0x0f0))
  236. #define M5272_DMA_DMR_RESET (1 << 31) /* reset */ 
  237. #define M5272_DMA_DMR_EN (1 << 30) /* enable */ 
  238. #define M5272_DMA_DMR_RQM (3 << 18) /* request mode */ 
  239. #define M5272_DMA_DMR_DSTM (3 << 13) /* dest. addressing mode */ 
  240. #define M5272_DMA_DMR_DSTT (7 << 10) /* dest. addressing type */ 
  241. #define M5272_DMA_DMR_DSTS (3 << 8) /* dest. data transfer type */ 
  242. #define M5272_DMA_DMR_SRCM (1 << 5) /* source addressing mode */ 
  243. #define M5272_DMA_DMR_SRCT (7 << 2) /* source addressing type */ 
  244. #define M5272_DMA_DMR_SRCS (3 << 0) /* source data transfer type */ 
  245. #define M5272_DMA_DIR_INVEN (1 << 12) /* inval. combin. interrupt */ 
  246. #define M5272_DMA_DIR_ASCEN (1 << 11) /* addr. seq. compl. interr. */ 
  247. #define M5272_DMA_DIR_TEEN (1 << 9) /* Transfer error interrupt */ 
  248. #define M5272_DMA_DIR_TCEN (1 << 8) /* Transfer compl. interrupt */ 
  249. #define M5272_DMA_DIR_INV (1 << 4) /* invalid combination */ 
  250. #define M5272_DMA_DIR_ASC (1 << 3) /* addr. sequence complete */ 
  251. #define M5272_DMA_DIR_TE (1 << 1) /* transfer error */ 
  252. #define M5272_DMA_DIR_TC (1 << 0) /* transfer complete */ 
  253. /* UART 0 & 1 */
  254. #define M5272_UART_REG(base, offset, chan)
  255. ((base) + (offset) + ((chan) * 0x40))
  256. #define M5272_UART_UMR1(base, n)
  257. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x100, n))
  258. #define M5272_UART_UMR2(base, n)
  259. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x100, n))
  260. #define M5272_UART_USR(base, n)
  261. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x104, n))
  262. #define M5272_UART_UCSR(base, n)
  263. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x104, n))
  264. #define M5272_UART_UCR(base, n)
  265. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x108, n))
  266. #define M5272_UART_URB(base, n)
  267. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x10c, n))
  268. #define M5272_UART_UTB(base, n)
  269. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x10c, n))
  270. #define M5272_UART_UIPCR(base, n)
  271. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x110, n))
  272. #define M5272_UART_UACR(base, n)
  273. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x110, n))
  274. #define M5272_UART_UISR(base, n)
  275. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x114, n))
  276. #define M5272_UART_UIMR(base, n)
  277. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x114, n))
  278. #define M5272_UART_UDU(base, n)
  279. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x118, n))
  280. #define M5272_UART_UDL(base, n)
  281. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x11c, n))
  282. #define M5272_UART_UABU(base, n)
  283. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x120, n))
  284. #define M5272_UART_UABL(base, n)
  285. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x124, n))
  286. #define M5272_UART_UTF(base, n)
  287. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x128, n))
  288. #define M5272_UART_URF(base, n)
  289. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x12c, n))
  290. #define M5272_UART_UFPD(base, n)
  291. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x130, n))
  292. #define M5272_UART_UIP(base, n)
  293. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x134, n))
  294. #define M5272_UART_UOP1(base, n)
  295. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x138, n))
  296. #define M5272_UART_UOP0(base, n)
  297. (CAST_M5272(volatile UINT8 *) M5272_UART_REG((base), 0x13c, n))
  298. #define M5272_UART_UMR1_RxRTS (1 << 7) /* receiver request-to-send */ 
  299. #define M5272_UART_UMR1_RxIRQ_FFULL (1 << 6) /* rec. interr. sel. */ 
  300. #define M5272_UART_UMR1_ERR (1 << 5) /* error mode-to-send */ 
  301. #define M5272_UART_UMR1_PM (3 << 3) /* parity mode */ 
  302. #define M5272_UART_UMR1_PT (1 << 2) /* parity type */ 
  303. #define M5272_UART_UMR1_B_C (3 << 0) /* bits per character */ 
  304. #define M5272_UART_UMR2_CM (3 << 6) /* channel mode */ 
  305. #define M5272_UART_UMR2_TxRTS (1 << 5) /* transmitter ready-to-send */ 
  306. #define M5272_UART_UMR2_TxCTS (1 << 4) /* transmitter clear-to-send */ 
  307. #define M5272_UART_UMR2_SB (0xf << 0) /* stop-bit length control */ 
  308. #define M5272_UART_USR_RB (1 << 7) /* received break */ 
  309. #define M5272_UART_USR_FE (1 << 6) /* framing error */ 
  310. #define M5272_UART_USR_PE (1 << 5) /* parity error */ 
  311. #define M5272_UART_USR_OE (1 << 4) /* overrun error */ 
  312. #define M5272_UART_USR_TxEMP (1 << 3) /* transmitter empty */ 
  313. #define M5272_UART_USR_TxRDY (1 << 2) /* transmitter ready */ 
  314. #define M5272_UART_USR_FFULL (1 << 1) /* FIFO full */ 
  315. #define M5272_UART_USR_RxRDY (1 << 0) /* receiver ready */ 
  316. #define M5272_UART_UCSR_RCS (0xf << 4) /* receiver clock select */ 
  317. #define M5272_UART_UCSR_TCS (0xf << 0) /* transmitter clock select */ 
  318. #define M5272_UART_UCR_ENAB (1 << 7) /* enable autobaud */ 
  319. #define M5272_UART_UCR_MISC (7 << 4) /* misc field */ 
  320. #define M5272_UART_UCR_TC (3 << 2) /* TC field */ 
  321. #define M5272_UART_UCR_RC (3 << 0) /* RC field */ 
  322. #define M5272_UART_UIPCR_COS (1 << 4) /* change of state */ 
  323. #define M5272_UART_UIPCR_CTS (1 << 0) /* current state */ 
  324. #define M5272_UART_UACR_RTSL (3 << 1) /* /RTS level */ 
  325. #define M5272_UART_UACR_IEC (1 << 0) /* input enable control */ 
  326. #define M5272_UART_UISR_UIMR_COS (1 << 7) /* change of state */ 
  327. #define M5272_UART_UISR_UIMR_ABC (1 << 6) /* autobaud calc. */ 
  328. #define M5272_UART_UISR_UIMR_RxFIFO (1 << 5) /* rec. FIFO status */ 
  329. #define M5272_UART_UISR_UIMR_TxFIFO (1 << 4) /* trans. FIFO status */ 
  330. #define M5272_UART_UISR_UIMR_RxFTO (1 << 3) /* rec. FIFO timeout */ 
  331. #define M5272_UART_UISR_UIMR_DB (1 << 2) /* delta break */ 
  332. #define M5272_UART_UISR_UIMR_FFULL_RxRDY (1 << 1) /* FFULL/RxRDY*/ 
  333. #define M5272_UART_UISR_UIMR_TxRDY (1 << 0) /* transmitter ready */ 
  334. #define M5272_UART_UTF_TXS (3 << 6) /* transmitter status */ 
  335. #define M5272_UART_UTF_FULL (1 << 5) /* transmitter FIFO full */ 
  336. #define M5272_UART_UTF_TXB (0x1f << 0) /* transmitter buf data level */ 
  337. #define M5272_UART_URF_RXS (3 << 6) /* receiver status */ 
  338. #define M5272_UART_URF_FULL (1 << 5) /* receiver FIFO full */ 
  339. #define M5272_UART_URF_RXB (0x1f << 0) /* receiver buf data level */ 
  340. /* SDRAM Controller Memory Map */
  341. #define M5272_SDRAM_SDCR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x180))
  342. #define M5272_SDRAM_SDTR(base) (CAST_M5272(volatile UINT16 *)((base) + 0x184))
  343. /* SDCR - SDRAM Configuration register */
  344. #define M5272_SDRAM_SDCR_MCAS (3 << 13) /* Maximum CAS address */
  345. #define M5272_SDRAM_SDCR_MCAS_A7 (0 << 13)
  346. #define M5272_SDRAM_SDCR_MCAS_A8 (1 << 13)
  347. #define M5272_SDRAM_SDCR_MCAS_A9 (2 << 13)
  348. #define M5272_SDRAM_SDCR_MCAS_A10 (3 << 13)
  349. #define M5272_SDRAM_SDCR_BALOC (7 << 8) /* Bank address location */
  350. #define M5272_SDRAM_SDCR_BALOC_A20 (1 << 8) /* SDBA0 = A20, SDBA1 = A21 */
  351. #define M5272_SDRAM_SDCR_BALOC_A21 (2 << 8) /* SDBA0 = A21, SDBA1 = A22 */
  352. #define M5272_SDRAM_SDCR_BALOC_A22 (3 << 8) /* SDBA0 = A22, SDBA1 = A23 */
  353. #define M5272_SDRAM_SDCR_BALOC_A23 (4 << 8) /* SDBA0 = A23, SDBA1 = A24 */
  354. #define M5272_SDRAM_SDCR_BALOC_A24 (5 << 8) /* SDBA0 = A24, SDBA1 = A25 */
  355. #define M5272_SDRAM_SDCR_GSL (1 << 7) /* Go to sleep */
  356. #define M5272_SDRAM_SDCR_REG (1 << 4) /* Register read data */
  357. #define M5272_SDRAM_SDCR_INV (1 << 3) /* Invert clock */
  358. #define M5272_SDRAM_SDCR_SLEEP (1 << 2) /* Sleep mode */
  359. #define M5272_SDRAM_SDCR_ACT (1 << 1) /* Active */
  360. #define M5272_SDRAM_SDCR_INIT (1 << 0) /* Initialisation enable */
  361. /* SDTR - SDRAM Timing Register */
  362. #define M5272_SDRAM_SDTR_RTP 0xfc00 /* Refresh timing prescalar */
  363. #define M5272_SDRAM_SDTR_RTP_66 (61 << 10) /* 66MHz */
  364. #define M5272_SDRAM_SDTR_RTP_48 (43 << 10) /* 48MHz */
  365. #define M5272_SDRAM_SDTR_RTP_33 (29 << 10) /* 33MHz */
  366. #define M5272_SDRAM_SDTR_RTP_25 (22 << 10) /* 25MHz */
  367. #define M5272_SDRAM_SDTR_RTP_5 (4 << 10) /* 5MHz (emulator) */
  368. #define M5272_SDRAM_SDTR_RC (3 << 8) /* Refresh count */
  369. #define M5272_SDRAM_SDTR_RC_5 (0 << 8) /* 5 cycles */
  370. #define M5272_SDRAM_SDTR_RC_6 (1 << 8) /* 6 cycles */
  371. #define M5272_SDRAM_SDTR_RC_7 (2 << 8) /* 7 cycles */
  372. #define M5272_SDRAM_SDTR_RC_8 (3 << 8) /* 8 cycles */
  373. #define M5272_SDRAM_SDTR_RP (3 << 4) /* Precharge time */
  374. #define M5272_SDRAM_SDTR_RP_1 (0 << 4) /* 1 cycles */
  375. #define M5272_SDRAM_SDTR_RP_2 (1 << 4) /* 2 cycles */
  376. #define M5272_SDRAM_SDTR_RP_3 (2 << 4) /* 3 cycles */
  377. #define M5272_SDRAM_SDTR_RP_4 (3 << 4) /* 4 cycles */
  378. #define M5272_SDRAM_SDTR_RCD (3 << 2) /* RAS-CAS delay */
  379. #define M5272_SDRAM_SDTR_RCD_1 (0 << 2) /* 1 cycles */
  380. #define M5272_SDRAM_SDTR_RCD_2 (1 << 2) /* 2 cycles */
  381. #define M5272_SDRAM_SDTR_RCD_3 (2 << 2) /* 3 cycles */
  382. #define M5272_SDRAM_SDTR_RCD_4 (3 << 2) /* 4 cycles */
  383. #define M5272_SDRAM_SDTR_CLT (3 << 0) /* CAS latency */
  384. #define M5272_SDRAM_SDTR_CLT_2 (1 << 0) /* 2 cycles */
  385. /* Timers 0 and 1 */
  386. #define M5272_TIMER_REG(base, offset, timer)
  387. ((base) + ((timer) * 0x20) + (offset))
  388. #define M5272_TIMER_TMR(base, n)
  389. (CAST_M5272(volatile UINT16 *) M5272_TIMER_REG(base, 0x200, n))
  390. #define M5272_TIMER_TRR(base, n)
  391. (CAST_M5272(volatile UINT16 *) M5272_TIMER_REG(base, 0x204, n))
  392. #define M5272_TIMER_TCR(base, n)
  393. (CAST_M5272(volatile UINT16 *) M5272_TIMER_REG(base, 0x208, n))
  394. #define M5272_TIMER_TCN(base, n)
  395. (CAST_M5272(volatile UINT16 *) M5272_TIMER_REG(base, 0x20c, n))
  396. #define M5272_TIMER_TER(base, n)
  397. (CAST_M5272(volatile UINT16 *) M5272_TIMER_REG(base, 0x210, n))
  398. #define M5272_TIMER_TMR_PRESCALER (0xffff << 8) /* prescaler */ 
  399. #define M5272_TIMER_TMR_CE (3 << 6) /* capture edge */ 
  400. #define M5272_TIMER_TMR_OM (1 << 5) /* output mode */ 
  401. #define M5272_TIMER_TMR_ORI (1 << 4) /* output reference */ 
  402. #define M5272_TIMER_TMR_FRR (1 << 3) /* free run/restart */ 
  403. #define M5272_TIMER_TMR_CLK (3 << 1) /* input clock source */ 
  404. #define M5272_TIMER_TMR_RST (1 << 0) /* reset timer */ 
  405. #define M5272_TIMER_TER_REF (1 << 1) /* output reference event */ 
  406. #define M5272_TIMER_TER_CAP (1 << 0) /* capture event */ 
  407. /* PLIC Module Memory Map */
  408. #define M5272_PLIC_BASE(base) (CAST_M5272(volatile UINT32 *)((base) + 0x300))
  409. /* Ethernet Module Memory Map */
  410. #define M5272_FEC_BASE(base) (CAST_M5272(volatile UINT32 *)((base) + 0x840))
  411. /* USB Module Memory Map */
  412. #define M5272_USB_BASE(base) (CAST_M5272(volatile UINT32 *)((base) + 0x1000))
  413. /* ISR - Interrupt Source Register bit definitions */
  414. #define M5272_ISR_INT1 (1 << 31)
  415. #define M5272_ISR_INT2 (1 << 30)
  416. #define M5272_ISR_INT3 (1 << 29)
  417. #define M5272_ISR_INT4 (1 << 28)
  418. #define M5272_ISR_TMR1 (1 << 27)
  419. #define M5272_ISR_TMR2 (1 << 26)
  420. #define M5272_ISR_TMR3 (1 << 25)
  421. #define M5272_ISR_TMR4 (1 << 24)
  422. #define M5272_ISR_UART1 (1 << 23)
  423. #define M5272_ISR_UART2 (1 << 22)
  424. #define M5272_ISR_PLI_P (1 << 21)
  425. #define M5272_ISR_PLI_A (1 << 20)
  426. #define M5272_ISR_USB0 (1 << 19)
  427. #define M5272_ISR_USB1 (1 << 18)
  428. #define M5272_ISR_USB2 (1 << 17)
  429. #define M5272_ISR_USB3 (1 << 16)
  430. #define M5272_ISR_USB4 (1 << 15)
  431. #define M5272_ISR_USB5 (1 << 14)
  432. #define M5272_ISR_USB6 (1 << 13)
  433. #define M5272_ISR_USB7 (1 << 12)
  434. #define M5272_ISR_DMA (1 << 11)
  435. #define M5272_ISR_ERx (1 << 10)
  436. #define M5272_ISR_ETx (1 <<  9)
  437. #define M5272_ISR_ENTC (1 <<  8)
  438. #define M5272_ISR_QSPI (1 <<  7)
  439. #define M5272_ISR_INT5 (1 <<  6)
  440. #define M5272_ISR_INT6 (1 <<  5)
  441. #define M5272_ISR_SWTO (1 <<  4)
  442. /* Interrupt numbers on the 5272 are at fixed positions above
  443.    the base value (INT_NUM_BASE) defined in the BSP (config.h.)
  444.    INT_NUM_BASE must be a multiple of 32, and not less than 64.
  445. */
  446. #define INT_NUM_SPURIOUS    (INT_NUM_BASE+0x00)     /* reserved */
  447. #define INT_NUM_INT1        (INT_NUM_BASE+0x01)     /* external int 1 */
  448. #define INT_NUM_INT2        (INT_NUM_BASE+0x02)     /* external int 2 */
  449. #define INT_NUM_INT3        (INT_NUM_BASE+0x03)     /* external int 3 */
  450. #define INT_NUM_INT4        (INT_NUM_BASE+0x04)     /* external int 4 */
  451. #define INT_NUM_TMR1        (INT_NUM_BASE+0x05)     /* timer 1 */
  452. #define INT_NUM_TMR2        (INT_NUM_BASE+0x06)     /* timer 2 */
  453. #define INT_NUM_TMR3        (INT_NUM_BASE+0x07)     /* timer 3 */
  454. #define INT_NUM_TMR4        (INT_NUM_BASE+0x08)     /* timer 4 */
  455. #define INT_NUM_UART1       (INT_NUM_BASE+0x09)     /* uart 1 */
  456. #define INT_NUM_UART2       (INT_NUM_BASE+0x0a)     /* uart 2 */
  457. #define INT_NUM_PLIP        (INT_NUM_BASE+0x0b)     /* plic 2kHz periodic */
  458. #define INT_NUM_PLIA        (INT_NUM_BASE+0x0c)     /* plic async */
  459. #define INT_NUM_USB0        (INT_NUM_BASE+0x0d)     /* usb endpoint 0 */
  460. #define INT_NUM_USB1        (INT_NUM_BASE+0x0e)     /* usb endpoint 1 */
  461. #define INT_NUM_USB2        (INT_NUM_BASE+0x0f)     /* usb endpoint 2 */
  462. #define INT_NUM_USB3        (INT_NUM_BASE+0x10)     /* usb endpoint 3 */
  463. #define INT_NUM_USB4        (INT_NUM_BASE+0x11)     /* usb endpoint 4 */
  464. #define INT_NUM_USB5        (INT_NUM_BASE+0x12)     /* usb endpoint 5 */
  465. #define INT_NUM_USB6        (INT_NUM_BASE+0x13)     /* usb endpoint 6 */
  466. #define INT_NUM_USB7        (INT_NUM_BASE+0x14)     /* usb endpoint 7 */
  467. #define INT_NUM_DMA         (INT_NUM_BASE+0x15)     /* dma controller */
  468. #define INT_NUM_ERX         (INT_NUM_BASE+0x16)     /* ethernet receiver */
  469. #define INT_NUM_ETX         (INT_NUM_BASE+0x17)     /* ethernet transmitter */
  470. #define INT_NUM_ENTC        (INT_NUM_BASE+0x18)     /* ethernet module */
  471. #define INT_NUM_QSPI        (INT_NUM_BASE+0x19)     /* queued serial i'f */
  472. #define INT_NUM_INT5        (INT_NUM_BASE+0x1a)     /* external int 5 */
  473. #define INT_NUM_INT6        (INT_NUM_BASE+0x1b)     /* external int 6 */
  474. #define INT_NUM_SWTO        (INT_NUM_BASE+0x1c)     /* s/w watchdog */
  475. #define INT_NUM_RES1        (INT_NUM_BASE+0x1d)     /* reserved */
  476. #define INT_NUM_RES2        (INT_NUM_BASE+0x1e)     /* reserved */
  477. #define INT_NUM_RES3        (INT_NUM_BASE+0x1f)     /* reserved */
  478. #ifdef __cplusplus
  479. }
  480. #endif
  481. #endif /* __INCm5272h */