dm36x.h 7.6 KB

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