dm36x.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2010-11-13 weety first version
  9. */
  10. #ifndef __DM36X_H__
  11. #define __DM36X_H__
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #include <rtthread.h>
  16. #include "psc.h"
  17. #include "irqs.h"
  18. #include "dm365_timer.h"
  19. /**
  20. * @addtogroup DM36X
  21. */
  22. /*@{*/
  23. /*
  24. * Base register addresses
  25. */
  26. #define DAVINCI_DMA_3PCC_BASE (0x01C00000)
  27. #define DAVINCI_DMA_3PTC0_BASE (0x01C10000)
  28. #define DAVINCI_DMA_3PTC1_BASE (0x01C10400)
  29. #define DAVINCI_I2C_BASE (0x01C21000)
  30. #define DAVINCI_TIMER0_BASE (0x01C21400)
  31. #define DAVINCI_TIMER1_BASE (0x01C21800)
  32. #define DAVINCI_WDOG_BASE (0x01C21C00)
  33. #define DAVINCI_PWM0_BASE (0x01C22000)
  34. #define DAVINCI_PWM1_BASE (0x01C22400)
  35. #define DAVINCI_PWM2_BASE (0x01C22800)
  36. #define DAVINCI_SYSTEM_MODULE_BASE (0x01C40000)
  37. #define DAVINCI_PLL_CNTRL0_BASE (0x01C40800)
  38. #define DAVINCI_PLL_CNTRL1_BASE (0x01C40C00)
  39. #define DAVINCI_PWR_SLEEP_CNTRL_BASE (0x01C41000)
  40. #define DAVINCI_SYSTEM_DFT_BASE (0x01C42000)
  41. #define DAVINCI_IEEE1394_BASE (0x01C60000)
  42. #define DAVINCI_USB_OTG_BASE (0x01C64000)
  43. #define DAVINCI_CFC_ATA_BASE (0x01C66000)
  44. #define DAVINCI_SPI_BASE (0x01C66800)
  45. #define DAVINCI_GPIO_BASE (0x01C67000)
  46. #define DAVINCI_UHPI_BASE (0x01C67800)
  47. #define DAVINCI_VPSS_REGS_BASE (0x01C70000)
  48. #define DAVINCI_EMAC_CNTRL_REGS_BASE (0x01C80000)
  49. #define DAVINCI_EMAC_WRAPPER_CNTRL_REGS_BASE (0x01C81000)
  50. #define DAVINCI_EMAC_WRAPPER_RAM_BASE (0x01C82000)
  51. #define DAVINCI_MDIO_CNTRL_REGS_BASE (0x01C84000)
  52. #define DAVINCI_IMCOP_BASE (0x01CC0000)
  53. #define DAVINCI_ASYNC_EMIF_CNTRL_BASE (0x01E00000)
  54. #define DAVINCI_VLYNQ_BASE (0x01E01000)
  55. #define DAVINCI_MCBSP_BASE (0x01E02000)
  56. #define DAVINCI_MMC_SD_BASE (0x01E10000)
  57. #define DAVINCI_MS_BASE (0x01E20000)
  58. #define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE (0x02000000)
  59. #define DAVINCI_ASYNC_EMIF_DATA_CE1_BASE (0x04000000)
  60. #define DAVINCI_ASYNC_EMIF_DATA_CE2_BASE (0x06000000)
  61. #define DAVINCI_ASYNC_EMIF_DATA_CE3_BASE (0x08000000)
  62. #define DAVINCI_VLYNQ_REMOTE_BASE (0x0C000000)
  63. /*
  64. * We can have multiple VLYNQ IPs in our system.
  65. * Define 'LOW_VLYNQ_CONTROL_BASE' with the VLYNQ
  66. * IP having lowest base address.
  67. * Define 'HIGH_VLYNQ_CONTROL_BASE' with the VLYNQ
  68. * IP having highest base address.
  69. * In case of only one VLYNQ IP, define only the
  70. * 'LOW_VLYNQ_CONTROL_BASE'.
  71. */
  72. #define LOW_VLYNQ_CONTROL_BASE DAVINCI_VLYNQ_BASE
  73. #define DM365_EMAC_BASE (0x01D07000)
  74. #define DM365_EMAC_CNTRL_OFFSET (0x0000)
  75. #define DM365_EMAC_CNTRL_MOD_OFFSET (0x3000)
  76. #define DM365_EMAC_CNTRL_RAM_OFFSET (0x1000)
  77. #define DM365_EMAC_MDIO_OFFSET (0x4000)
  78. #define DM365_EMAC_CNTRL_RAM_SIZE (0x2000)
  79. /*
  80. * Macro to access device power control
  81. */
  82. #define DAVINCI_VDD3P3V_PWDN (DAVINCI_SYSTEM_MODULE_BASE + 0x48)
  83. #define DAVINCI_VSCLKDIS (DAVINCI_SYSTEM_MODULE_BASE + 0x6c)
  84. /*
  85. * System module registers
  86. */
  87. #define PINMUX0 (DAVINCI_SYSTEM_MODULE_BASE + 0x00)
  88. #define PINMUX1 (DAVINCI_SYSTEM_MODULE_BASE + 0x04)
  89. #define PINMUX2 (DAVINCI_SYSTEM_MODULE_BASE + 0x08)
  90. #define PINMUX3 (DAVINCI_SYSTEM_MODULE_BASE + 0x0c)
  91. #define PINMUX4 (DAVINCI_SYSTEM_MODULE_BASE + 0x10)
  92. #define DM365_ARM_INTMUX (DAVINCI_SYSTEM_MODULE_BASE + 0x18)
  93. #define DM365_EDMA_EVTMUX (DAVINCI_SYSTEM_MODULE_BASE + 0x1C)
  94. #define DAVINCI_PUPDCTL1 (DAVINCI_SYSTEM_MODULE_BASE + 0x7C)
  95. #define ASYNC_EMIF_REVID 0x00
  96. #define ASYNC_EMIF_AWCCR 0x04
  97. #define ASYNC_EMIF_A1CR 0x10
  98. #define ASYNC_EMIF_A2CR 0x14
  99. #define ASYNC_EMIF_A3CR 0x18
  100. /*
  101. * Base register addresses common across DM355 and DM365
  102. */
  103. #define DM3XX_TIMER2_BASE (0x01C20800)
  104. #define DM3XX_REALTIME_BASE (0x01C20C00)
  105. #define DM3XX_PWM3_BASE (0x01C22C00)
  106. #define DM3XX_SPI_BASE (0x01C66000)
  107. #define DM3XX_SPI0_BASE DM3XX_SPI_BASE
  108. #define DM3XX_SPI1_BASE (0x01C66800)
  109. #define DM3XX_SPI2_BASE (0x01C67800)
  110. /*
  111. * DM365 base register address
  112. */
  113. #define DM365_DMA_3PTC2_BASE (0x01C10800)
  114. #define DM365_DMA_3PTC3_BASE (0x01C10C00)
  115. #define DM365_TIMER3_BASE (0x01C23800)
  116. #define DM365_ADCIF_BASE (0x01C23C00)
  117. #define DM365_SPI3_BASE (0x01C68000)
  118. #define DM365_SPI4_BASE (0x01C23000)
  119. #define DM365_RTC_BASE (0x01C69000)
  120. #define DM365_KEYSCAN_BASE (0x01C69400)
  121. #define DM365_UHPI_BASE (0x01C69800)
  122. #define DM365_IMCOP_BASE (0x01CA0000)
  123. #define DM365_MMC_SD1_BASE (0x01D00000)
  124. #define DM365_MCBSP_BASE (0x01D02000)
  125. #define DM365_UART1_BASE (0x01D06000)
  126. #define DM365_EMAC_CNTRL_BASE (0x01D07000)
  127. #define DM365_EMAC_WRAP_RAM_BASE (0x01D08000)
  128. #define DM365_EMAC_WRAP_CNTRL_BASE (0x01D0A000)
  129. #define DM365_EMAC_MDIO_BASE (0x01D0B000)
  130. #define DM365_VOICE_CODEC_BASE (0x01D0C000)
  131. #define DM365_ASYNC_EMIF_CNTRL_BASE (0x01D10000)
  132. #define DM365_MMC_SD0_BASE (0x01D11000)
  133. #define DM365_MS_BASE (0x01D20000)
  134. #define DM365_KALEIDO_BASE (0x01E00000)
  135. #define DAVINCI_UART0_BASE (0x01C20000)
  136. #define PSC_MDCTL_BASE (0x01c41a00)
  137. #define PSC_MDSTAT_BASE (0x01c41800)
  138. #define PSC_PTCMD (0x01c41120)
  139. #define PSC_PTSTAT (0x01c41128)
  140. #define DM365_EINT_ENABLE0 0x01c48018
  141. #define DM365_EINT_ENABLE1 0x01c4801c
  142. #define davinci_readb(a) (*(volatile unsigned char *)(a))
  143. #define davinci_readw(a) (*(volatile unsigned short *)(a))
  144. #define davinci_readl(a) (*(volatile unsigned int *)(a))
  145. #define davinci_writeb(v,a) (*(volatile unsigned char *)(a) = (v))
  146. #define davinci_writew(v,a) (*(volatile unsigned short *)(a) = (v))
  147. #define davinci_writel(v,a) (*(volatile unsigned int *)(a) = (v))
  148. #define readb(a) davinci_readb(a)
  149. #define readw(a) davinci_readw(a)
  150. #define readl(a) davinci_readl(a)
  151. #define write(v,a) davinci_writeb(v,a)
  152. #define writew(v,a) davinci_writew(v,a)
  153. #define writel(v,a) davinci_writel(v,a)
  154. /* define timer register struct*/
  155. typedef struct timer_regs_s {
  156. rt_uint32_t pid12; /* 0x0 */
  157. rt_uint32_t emumgt_clksped; /* 0x4 */
  158. rt_uint32_t gpint_en; /* 0x8 */
  159. rt_uint32_t gpdir_dat; /* 0xC */
  160. rt_uint32_t tim12; /* 0x10 */
  161. rt_uint32_t tim34; /* 0x14 */
  162. rt_uint32_t prd12; /* 0x18 */
  163. rt_uint32_t prd34; /* 0x1C */
  164. rt_uint32_t tcr; /* 0x20 */
  165. rt_uint32_t tgcr; /* 0x24 */
  166. rt_uint32_t wdtcr; /* 0x28 */
  167. rt_uint32_t tlgc; /* 0x2C */
  168. rt_uint32_t tlmr; /* 0x30 */
  169. } timer_regs_t;
  170. /*****************************/
  171. /* CPU Mode */
  172. /*****************************/
  173. #define USERMODE 0x10
  174. #define FIQMODE 0x11
  175. #define IRQMODE 0x12
  176. #define SVCMODE 0x13
  177. #define ABORTMODE 0x17
  178. #define UNDEFMODE 0x1b
  179. #define MODEMASK 0x1f
  180. #define NOINT 0xc0
  181. struct rt_hw_register
  182. {
  183. rt_uint32_t cpsr;
  184. rt_uint32_t r0;
  185. rt_uint32_t r1;
  186. rt_uint32_t r2;
  187. rt_uint32_t r3;
  188. rt_uint32_t r4;
  189. rt_uint32_t r5;
  190. rt_uint32_t r6;
  191. rt_uint32_t r7;
  192. rt_uint32_t r8;
  193. rt_uint32_t r9;
  194. rt_uint32_t r10;
  195. rt_uint32_t fp;
  196. rt_uint32_t ip;
  197. rt_uint32_t sp;
  198. rt_uint32_t lr;
  199. rt_uint32_t pc;
  200. };
  201. /*@}*/
  202. #ifdef __cplusplus
  203. }
  204. #endif
  205. #endif