s3c2410.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. * (C) Copyright 2003
  3. * David Müller ELSOFT AG Switzerland. d.mueller@elsoft.ch
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /************************************************
  24. * NAME : s3c2410.h
  25. * Version : 31.3.2003
  26. *
  27. * Based on S3C2410X User's manual Rev 1.1
  28. ************************************************/
  29. #ifndef __S3C2410_H__
  30. #define __S3C2410_H__
  31. #define S3C24X0_UART_CHANNELS 3
  32. #define S3C24X0_SPI_CHANNELS 2
  33. /* S3C2410 only supports 512 Byte HW ECC */
  34. #define S3C2410_ECCSIZE 512
  35. #define S3C2410_ECCBYTES 3
  36. typedef enum {
  37. S3C24X0_UART0,
  38. S3C24X0_UART1,
  39. S3C24X0_UART2
  40. } S3C24X0_UARTS_NR;
  41. /* S3C2410 device base addresses */
  42. #define S3C24X0_MEMCTL_BASE 0x48000000
  43. #define S3C24X0_USB_HOST_BASE 0x49000000
  44. #define S3C24X0_INTERRUPT_BASE 0x4A000000
  45. #define S3C24X0_DMA_BASE 0x4B000000
  46. #define S3C24X0_CLOCK_POWER_BASE 0x4C000000
  47. #define S3C24X0_LCD_BASE 0x4D000000
  48. #define S3C2410_NAND_BASE 0x4E000000
  49. #define S3C24X0_UART_BASE 0x50000000
  50. #define S3C24X0_TIMER_BASE 0x51000000
  51. #define S3C24X0_USB_DEVICE_BASE 0x52000140
  52. #define S3C24X0_WATCHDOG_BASE 0x53000000
  53. #define S3C24X0_I2C_BASE 0x54000000
  54. #define S3C24X0_I2S_BASE 0x55000000
  55. #define S3C24X0_GPIO_BASE 0x56000000
  56. #define S3C24X0_RTC_BASE 0x57000000
  57. #define S3C2410_ADC_BASE 0x58000000
  58. #define S3C24X0_SPI_BASE 0x59000000
  59. #define S3C2410_SDI_BASE 0x5A000000
  60. /* include common stuff */
  61. #include <s3c24x0.h>
  62. static inline S3C24X0_MEMCTL * S3C24X0_GetBase_MEMCTL(void)
  63. {
  64. return (S3C24X0_MEMCTL * const)S3C24X0_MEMCTL_BASE;
  65. }
  66. static inline S3C24X0_USB_HOST * S3C24X0_GetBase_USB_HOST(void)
  67. {
  68. return (S3C24X0_USB_HOST * const)S3C24X0_USB_HOST_BASE;
  69. }
  70. static inline S3C24X0_INTERRUPT * S3C24X0_GetBase_INTERRUPT(void)
  71. {
  72. return (S3C24X0_INTERRUPT * const)S3C24X0_INTERRUPT_BASE;
  73. }
  74. static inline S3C24X0_DMAS * S3C24X0_GetBase_DMAS(void)
  75. {
  76. return (S3C24X0_DMAS * const)S3C24X0_DMA_BASE;
  77. }
  78. static inline S3C24X0_CLOCK_POWER * S3C24X0_GetBase_CLOCK_POWER(void)
  79. {
  80. return (S3C24X0_CLOCK_POWER * const)S3C24X0_CLOCK_POWER_BASE;
  81. }
  82. static inline S3C24X0_LCD * S3C24X0_GetBase_LCD(void)
  83. {
  84. return (S3C24X0_LCD * const)S3C24X0_LCD_BASE;
  85. }
  86. static inline S3C2410_NAND * S3C2410_GetBase_NAND(void)
  87. {
  88. return (S3C2410_NAND * const)S3C2410_NAND_BASE;
  89. }
  90. static inline S3C24X0_UART * S3C24X0_GetBase_UART(S3C24X0_UARTS_NR nr)
  91. {
  92. return (S3C24X0_UART * const)(S3C24X0_UART_BASE + (nr * 0x4000));
  93. }
  94. static inline S3C24X0_TIMERS * S3C24X0_GetBase_TIMERS(void)
  95. {
  96. return (S3C24X0_TIMERS * const)S3C24X0_TIMER_BASE;
  97. }
  98. static inline S3C24X0_USB_DEVICE * S3C24X0_GetBase_USB_DEVICE(void)
  99. {
  100. return (S3C24X0_USB_DEVICE * const)S3C24X0_USB_DEVICE_BASE;
  101. }
  102. static inline S3C24X0_WATCHDOG * S3C24X0_GetBase_WATCHDOG(void)
  103. {
  104. return (S3C24X0_WATCHDOG * const)S3C24X0_WATCHDOG_BASE;
  105. }
  106. static inline S3C24X0_I2C * S3C24X0_GetBase_I2C(void)
  107. {
  108. return (S3C24X0_I2C * const)S3C24X0_I2C_BASE;
  109. }
  110. static inline S3C24X0_I2S * S3C24X0_GetBase_I2S(void)
  111. {
  112. return (S3C24X0_I2S * const)S3C24X0_I2S_BASE;
  113. }
  114. static inline S3C24X0_GPIO * S3C24X0_GetBase_GPIO(void)
  115. {
  116. return (S3C24X0_GPIO * const)S3C24X0_GPIO_BASE;
  117. }
  118. static inline S3C24X0_RTC * S3C24X0_GetBase_RTC(void)
  119. {
  120. return (S3C24X0_RTC * const)S3C24X0_RTC_BASE;
  121. }
  122. static inline S3C2410_ADC * S3C2410_GetBase_ADC(void)
  123. {
  124. return (S3C2410_ADC * const)S3C2410_ADC_BASE;
  125. }
  126. static inline S3C24X0_SPI * S3C24X0_GetBase_SPI(void)
  127. {
  128. return (S3C24X0_SPI * const)S3C24X0_SPI_BASE;
  129. }
  130. static inline S3C2410_SDI * S3C2410_GetBase_SDI(void)
  131. {
  132. return (S3C2410_SDI * const)S3C2410_SDI_BASE;
  133. }
  134. /* ISR */
  135. #define pISR_RESET (*(unsigned *)(_ISR_STARTADDRESS+0x0))
  136. #define pISR_UNDEF (*(unsigned *)(_ISR_STARTADDRESS+0x4))
  137. #define pISR_SWI (*(unsigned *)(_ISR_STARTADDRESS+0x8))
  138. #define pISR_PABORT (*(unsigned *)(_ISR_STARTADDRESS+0xC))
  139. #define pISR_DABORT (*(unsigned *)(_ISR_STARTADDRESS+0x10))
  140. #define pISR_RESERVED (*(unsigned *)(_ISR_STARTADDRESS+0x14))
  141. #define pISR_IRQ (*(unsigned *)(_ISR_STARTADDRESS+0x18))
  142. #define pISR_FIQ (*(unsigned *)(_ISR_STARTADDRESS+0x1C))
  143. #define pISR_EINT0 (*(unsigned *)(_ISR_STARTADDRESS+0x20))
  144. #define pISR_EINT1 (*(unsigned *)(_ISR_STARTADDRESS+0x24))
  145. #define pISR_EINT2 (*(unsigned *)(_ISR_STARTADDRESS+0x28))
  146. #define pISR_EINT3 (*(unsigned *)(_ISR_STARTADDRESS+0x2C))
  147. #define pISR_EINT4_7 (*(unsigned *)(_ISR_STARTADDRESS+0x30))
  148. #define pISR_EINT8_23 (*(unsigned *)(_ISR_STARTADDRESS+0x34))
  149. #define pISR_BAT_FLT (*(unsigned *)(_ISR_STARTADDRESS+0x3C))
  150. #define pISR_TICK (*(unsigned *)(_ISR_STARTADDRESS+0x40))
  151. #define pISR_WDT (*(unsigned *)(_ISR_STARTADDRESS+0x44))
  152. #define pISR_TIMER0 (*(unsigned *)(_ISR_STARTADDRESS+0x48))
  153. #define pISR_TIMER1 (*(unsigned *)(_ISR_STARTADDRESS+0x4C))
  154. #define pISR_TIMER2 (*(unsigned *)(_ISR_STARTADDRESS+0x50))
  155. #define pISR_TIMER3 (*(unsigned *)(_ISR_STARTADDRESS+0x54))
  156. #define pISR_TIMER4 (*(unsigned *)(_ISR_STARTADDRESS+0x58))
  157. #define pISR_UART2 (*(unsigned *)(_ISR_STARTADDRESS+0x5C))
  158. #define pISR_NOTUSED (*(unsigned *)(_ISR_STARTADDRESS+0x60))
  159. #define pISR_DMA0 (*(unsigned *)(_ISR_STARTADDRESS+0x64))
  160. #define pISR_DMA1 (*(unsigned *)(_ISR_STARTADDRESS+0x68))
  161. #define pISR_DMA2 (*(unsigned *)(_ISR_STARTADDRESS+0x6C))
  162. #define pISR_DMA3 (*(unsigned *)(_ISR_STARTADDRESS+0x70))
  163. #define pISR_SDI (*(unsigned *)(_ISR_STARTADDRESS+0x74))
  164. #define pISR_SPI0 (*(unsigned *)(_ISR_STARTADDRESS+0x78))
  165. #define pISR_UART1 (*(unsigned *)(_ISR_STARTADDRESS+0x7C))
  166. #define pISR_USBD (*(unsigned *)(_ISR_STARTADDRESS+0x84))
  167. #define pISR_USBH (*(unsigned *)(_ISR_STARTADDRESS+0x88))
  168. #define pISR_IIC (*(unsigned *)(_ISR_STARTADDRESS+0x8C))
  169. #define pISR_UART0 (*(unsigned *)(_ISR_STARTADDRESS+0x90))
  170. #define pISR_SPI1 (*(unsigned *)(_ISR_STARTADDRESS+0x94))
  171. #define pISR_RTC (*(unsigned *)(_ISR_STARTADDRESS+0x98))
  172. #define pISR_ADC (*(unsigned *)(_ISR_STARTADDRESS+0xA0))
  173. /* PENDING BIT */
  174. #define BIT_EINT0 (0x1)
  175. #define BIT_EINT1 (0x1<<1)
  176. #define BIT_EINT2 (0x1<<2)
  177. #define BIT_EINT3 (0x1<<3)
  178. #define BIT_EINT4_7 (0x1<<4)
  179. #define BIT_EINT8_23 (0x1<<5)
  180. #define BIT_BAT_FLT (0x1<<7)
  181. #define BIT_TICK (0x1<<8)
  182. #define BIT_WDT (0x1<<9)
  183. #define BIT_TIMER0 (0x1<<10)
  184. #define BIT_TIMER1 (0x1<<11)
  185. #define BIT_TIMER2 (0x1<<12)
  186. #define BIT_TIMER3 (0x1<<13)
  187. #define BIT_TIMER4 (0x1<<14)
  188. #define BIT_UART2 (0x1<<15)
  189. #define BIT_LCD (0x1<<16)
  190. #define BIT_DMA0 (0x1<<17)
  191. #define BIT_DMA1 (0x1<<18)
  192. #define BIT_DMA2 (0x1<<19)
  193. #define BIT_DMA3 (0x1<<20)
  194. #define BIT_SDI (0x1<<21)
  195. #define BIT_SPI0 (0x1<<22)
  196. #define BIT_UART1 (0x1<<23)
  197. #define BIT_USBD (0x1<<25)
  198. #define BIT_USBH (0x1<<26)
  199. #define BIT_IIC (0x1<<27)
  200. #define BIT_UART0 (0x1<<28)
  201. #define BIT_SPI1 (0x1<<29)
  202. #define BIT_RTC (0x1<<30)
  203. #define BIT_ADC (0x1<<31)
  204. #define BIT_ALLMSK (0xFFFFFFFF)
  205. #define ClearPending(bit) {\
  206. rSRCPND = bit;\
  207. rINTPND = bit;\
  208. rINTPND;\
  209. }
  210. /* Wait until rINTPND is changed for the case that the ISR is very short. */
  211. #endif /*__S3C2410_H__*/