amt630h.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. /***********************************************************************
  2. Copyright (c)2020 Arkmicro Technologies Inc. All Rights Reserved
  3. Filename: amt630h.h
  4. Version : 1.0
  5. Date : 2020.04.08
  6. Author : Sim. Huang
  7. History :
  8. ************************************************************************/
  9. #ifndef _AMT630H_H_
  10. #define _AMT630H_H_
  11. #include <stdint.h>
  12. #include <string.h>
  13. //change the Assemble logic valuable VECTOR_ENABLE //in file Boot.s
  14. #define CLK_24MHZ 24000000
  15. /*@}*/
  16. /* ************************************************************************** */
  17. /* BASE ADDRESS DEFINITIONS FOR AMT630H */
  18. /* ************************************************************************** */
  19. /** \addtogroup AMT630H_base Peripheral Base Address Definitions */
  20. /*@{*/
  21. #define REGS_SYSCTL_BASE (0x60000000U)
  22. #define REGS_SPI0_BASE (0x60100000U)
  23. #define REGS_SPI1_BASE (0x60200000U)
  24. #define REGS_IIC0_BASE (0x60300000U)
  25. #define REGS_IIC1_BASE (0x60400000U)
  26. #define REGS_UART0_BASE (0x60500000U)
  27. #define REGS_UART1_BASE (0x60600000U)
  28. #define REGS_UART2_BASE (0x60700000U)
  29. #define REGS_UART3_BASE (0x60800000U)
  30. #define REGS_GPIO_BASE (0x60900000U)
  31. #define REGS_TIMER_BASE (0x60a00000U)
  32. #define REGS_PWM_BASE (0x60b00000U)
  33. #define REGS_WDT_BASE (0x60c00000U)
  34. #define REGS_I2S_BASE (0x60d00000U)
  35. #define REGS_RTC_BASE (0x61000000U)
  36. #define REGS_ADC_BASE (0x61100000U)
  37. #define REGS_RCRT_BASE (0x61200000U)
  38. #define REGS_AES_BASE (0x61300000U)
  39. #define REGS_AIC_BASE (0x61400000U)
  40. #define REGS_CAN0_BASE (0x61500000U)
  41. #define REGS_CAN1_BASE (0x61600000U)
  42. #define REGS_DMAC_BASE (0x70100000U)
  43. #define REGS_GPU_BASE (0x70200000U)
  44. #define REGS_USB_BASE (0x70300000U)
  45. #define REGS_SDMMC0_BASE (0X70400000U)
  46. #define REGS_ITU_BASE (0X70600000U)
  47. #define REGS_LCD_BASE (0X71000000U)
  48. #define REGS_PXP_BASE (0X71100000U)
  49. #define REGS_ROTATE_BASE (0X71207000U)
  50. #define REGS_JPG_BASE (0X71208000U)
  51. #define REGS_DDRC_BASE (0X71300000U)
  52. #define SYS_IO_DRIVER00 0xe0
  53. #define SYS_IO_DRIVER01 0xe4
  54. #define SYS_IO_DRIVER02 0xe8
  55. #define SYS_IO_DRIVER03 0xec
  56. #define SYS_IO_DRIVER04 0xf0
  57. #define SYS_IO_DRIVER05 0xf4
  58. #define SYS_IO_DRIVER06 0xf8
  59. #define SYS_IO_DRIVER07 0xfc
  60. /* register base address */
  61. #define SDHC0_BASE 0x70400000
  62. #define USB_BASE 0x70300000//0x700C0000
  63. #define SSI1_BASE 0x60200000//0x48002000
  64. #define SSI0_BASE 0x60100000
  65. #define GPIO_BASE 0x60900000//0x40409000
  66. #define SYS_BASE 0x60000000//0x40408000
  67. #define TIMER_BASE 0x60a00000//0x40405000
  68. #define WDT_BASE 0x60c00000//0x40404000
  69. #define RTC_BASE 0x61000000//0x40406000
  70. #define UART0_BASE 0x60500000//0x4040B000
  71. //uart
  72. #define UART_BASE UART0_BASE
  73. #define rUART_DR *((volatile unsigned int *)(UART_BASE + 0x00))
  74. #define rUART_RSR *((volatile unsigned int *)(UART_BASE + 0x04))
  75. #define rUART_FR *((volatile unsigned int *)(UART_BASE + 0x18))
  76. #define rUART_ILPR *((volatile unsigned int *)(UART_BASE + 0x20))
  77. #define rUART_IBRD *((volatile unsigned int *)(UART_BASE + 0x24))
  78. #define rUART_FBRD *((volatile unsigned int *)(UART_BASE + 0x28))
  79. #define rUART_LCR_H *((volatile unsigned int *)(UART_BASE + 0x2C))
  80. #define rUART_CR *((volatile unsigned int *)(UART_BASE + 0x30))
  81. #define rUART_IFLS *((volatile unsigned int *)(UART_BASE + 0x34))
  82. #define rUART_IMSC *((volatile unsigned int *)(UART_BASE + 0x38))
  83. #define rUART_RIS *((volatile unsigned int *)(UART_BASE + 0x3C))
  84. #define rUART_MIS *((volatile unsigned int *)(UART_BASE + 0x40))
  85. #define rUART_ICR *((volatile unsigned int *)(UART_BASE + 0x44))
  86. #define rUART_DMACR *((volatile unsigned int *)(UART_BASE + 0x48))
  87. /***************************************************************
  88. AHB slave interface registers definition
  89. ****************************************************************/
  90. /* AHB system */
  91. #define rSYS_BOOT_SAMPLE *((volatile unsigned int *)(SYS_BASE+0x0))
  92. #define rSYS_BUS_CLK_SEL *((volatile unsigned int *)(SYS_BASE+0x40))
  93. #define rSYS_PLLRFCK_CTL *((volatile unsigned int *)(SYS_BASE+0x44))
  94. #define rSYS_SDMMC_CLK_CFG *((volatile unsigned int *)(SYS_BASE+0x48))
  95. #define rSYS_VOU_CLK_CFG *((volatile unsigned int *)(SYS_BASE+0x4c))
  96. #define rSYS_PER_CLK_EN *((volatile unsigned int *)(SYS_BASE+0x50))
  97. #define rSYS_LCD_CLK_CFG *((volatile unsigned int *)(SYS_BASE+0x54))
  98. #define rSYS_SD_CLK_CFG *((volatile unsigned int *)(SYS_BASE+0x58))
  99. #define rSYS_SOFT_RST *((volatile unsigned int *)(SYS_BASE+0x5c))
  100. #define rSYS_SOFT1_RST *((volatile unsigned int *)(SYS_BASE+0x60))
  101. #define rSYS_SSP_CLK_CFG *((volatile unsigned int *)(SYS_BASE+0x64))
  102. #define rSYS_TIMER_CLK_CFG *((volatile unsigned int *)(SYS_BASE+0x68))
  103. #define rSYS_I2S_NCO_CFG *((volatile unsigned int *)(SYS_BASE+0x6c))
  104. #define rSYS_DDRCTL_CFG *((volatile unsigned int *)(SYS_BASE+0x70))
  105. #define rSYS_DDRCTL1_CFG *((volatile unsigned int *)(SYS_BASE+0x74))
  106. #define rSYS_PERCTL_CFG *((volatile unsigned int *)(SYS_BASE+0x78))
  107. #define rSYS_TIMER1_CLK_CFG *((volatile unsigned int *)(SYS_BASE+0x7c))
  108. #define rSYS_ANA_CFG *((volatile unsigned int *)(SYS_BASE+0x80))
  109. #define rSYS_ANA1_CFG *((volatile unsigned int *)(SYS_BASE+0x84))
  110. #define rSYS_CPUPLL_CFG *((volatile unsigned int *)(SYS_BASE+0x88))
  111. #define rSYS_SYSPLL_CFG *((volatile unsigned int *)(SYS_BASE+0x8c))
  112. #define rSYS_ANA2_CFG *((volatile unsigned int *)(SYS_BASE+0x98))
  113. #define rSYS_ANA3_CFG *((volatile unsigned int *)(SYS_BASE+0x9c))
  114. #define rSYS_PAD_CTRL00 *((volatile unsigned int *)(SYS_BASE+0x30*4))
  115. #define rSYS_PAD_CTRL01 *((volatile unsigned int *)(SYS_BASE+0x31*4))
  116. #define rSYS_PAD_CTRL02 *((volatile unsigned int *)(SYS_BASE+0x32*4))
  117. #define rSYS_PAD_CTRL03 *((volatile unsigned int *)(SYS_BASE+0x33*4))
  118. #define rSYS_PAD_CTRL04 *((volatile unsigned int *)(SYS_BASE+0x34*4))
  119. #define rSYS_PAD_CTRL05 *((volatile unsigned int *)(SYS_BASE+0xD4))
  120. #define rSYS_PAD_CTRL06 *((volatile unsigned int *)(SYS_BASE+0x36*4))
  121. #define rSYS_PAD_CTRL07 *((volatile unsigned int *)(SYS_BASE+0x37*4))
  122. #define rSYS_IO_DRIVER00 *((volatile unsigned int *)(SYS_BASE+0x38*4))
  123. #define rSYS_IO_DRIVER01 *((volatile unsigned int *)(SYS_BASE+0x39*4))
  124. #define rSYS_IO_DRIVER02 *((volatile unsigned int *)(SYS_BASE+0x3A*4))
  125. #define rSYS_IO_DRIVER03 *((volatile unsigned int *)(SYS_BASE+0x3B*4))
  126. #define rSYS_IO_DRIVER04 *((volatile unsigned int *)(SYS_BASE+0x3C*4))
  127. #define rSYS_IO_DRIVER05 *((volatile unsigned int *)(SYS_BASE+0x3D*4))
  128. #define rSYS_IO_DRIVER06 *((volatile unsigned int *)(SYS_BASE+0x3E*4))
  129. #define rSYS_IO_DRIVER07 *((volatile unsigned int *)(SYS_BASE+0x3F*4))
  130. /* Timer */
  131. #define rTIMER0_LOAD_COUNT (*(volatile unsigned int *)(TIMER_BASE + 0x00))
  132. #define rTIMER0_CURRENT_VALUE (*(volatile unsigned int *)(TIMER_BASE + 0x04))
  133. #define rTIMER0_CONTROL (*(volatile unsigned int *)(TIMER_BASE + 0x08))
  134. #define rTIMER0_EOI (*(volatile unsigned int *)(TIMER_BASE + 0x0C))
  135. #define rTIMER0_INT_STATUS (*(volatile unsigned int *)(TIMER_BASE + 0x10))
  136. /* WDT */
  137. #define rWDT_CR (*(volatile unsigned int *)(WDT_BASE + 0x00))
  138. #define rWDT_PSR (*(volatile unsigned int *)(WDT_BASE + 0x04))
  139. #define rWDT_LDR (*(volatile unsigned int *)(WDT_BASE + 0x08))
  140. #define rWDT_VLR (*(volatile unsigned int *)(WDT_BASE + 0x0C))
  141. #define rWDT_ISR (*(volatile unsigned int *)(WDT_BASE + 0x10))
  142. #define rWDT_RCR (*(volatile unsigned int *)(WDT_BASE + 0x14))
  143. #define rWDT_TMR (*(volatile unsigned int *)(WDT_BASE + 0x18))
  144. #define rWDT_TCR (*(volatile unsigned int *)(WDT_BASE + 0x1C))
  145. /* RTC */
  146. #define rRTC_CTL (*(volatile unsigned int *)(RTC_BASE + 0x00)) /*control register*/
  147. #define rRTC_ANAWEN (*(volatile unsigned int *)(RTC_BASE + 0x04)) /*analog block write enable register*/
  148. #define rRTC_ANACTL (*(volatile unsigned int *)(RTC_BASE + 0x08)) /*analog block control register*/
  149. #define rRTC_IM (*(volatile unsigned int *)(RTC_BASE + 0x0C)) /*interrupt mode register*/
  150. #define rRTC_STA (*(volatile unsigned int *)(RTC_BASE + 0x10)) /*rtc status register*/
  151. #define rRTC_ALMDAT (*(volatile unsigned int *)(RTC_BASE + 0x14)) /*alarm data register*/
  152. #define rRTC_DONT (*(volatile unsigned int *)(RTC_BASE + 0x18)) /*delay on timer register*/
  153. #define rRTC_RAM (*(volatile unsigned int *)(RTC_BASE + 0x1C)) /*ram bit register*/
  154. #define rRTC_CNTL (*(volatile unsigned int *)(RTC_BASE + 0x20)) /*rtc counter register*/
  155. #define rRTC_CNTH (*(volatile unsigned int *)(RTC_BASE + 0x24)) /*rtc sec counter register*/
  156. /* UART0 */
  157. #define rUART0_DR (*(volatile unsigned int *)(UART0_BASE + 0x00))
  158. #define rUART0_RSR (*(volatile unsigned int *)(UART0_BASE + 0x04))
  159. #define rUART0_FR (*(volatile unsigned int *)(UART0_BASE + 0x18))
  160. #define rUART0_ILPR (*(volatile unsigned int *)(UART0_BASE + 0x20))
  161. #define rUART0_IBRD (*(volatile unsigned int *)(UART0_BASE + 0x24))
  162. #define rUART0_FBRD (*(volatile unsigned int *)(UART0_BASE + 0x28))
  163. #define rUART0_LCR_H (*(volatile unsigned int *)(UART0_BASE + 0x2C))
  164. #define rUART0_CR (*(volatile unsigned int *)(UART0_BASE + 0x30))
  165. #define rUART0_IFLS (*(volatile unsigned int *)(UART0_BASE + 0x34))
  166. #define rUART0_IMSC (*(volatile unsigned int *)(UART0_BASE + 0x38))
  167. #define rUART0_RIS (*(volatile unsigned int *)(UART0_BASE + 0x3C))
  168. #define rUART0_MIS (*(volatile unsigned int *)(UART0_BASE + 0x40))
  169. #define rUART0_ICR (*(volatile unsigned int *)(UART0_BASE + 0x44))
  170. #define rUART0_DMACR (*(volatile unsigned int *)(UART0_BASE + 0x48))
  171. /* SSI */
  172. #define rSPI_CONTROLREG (*(volatile unsigned int *)(SSI1_BASE + 0x08))
  173. #define rSPI_CONFIGREG (*(volatile unsigned int *)(SSI1_BASE + 0x0C))
  174. #define rSPI_INTREG (*(volatile unsigned int *)(SSI1_BASE + 0x10))
  175. #define rSPI_DMAREG (*(volatile unsigned int *)(SSI1_BASE + 0x14))
  176. #define rSPI_STATUSREG (*(volatile unsigned int *)(SSI1_BASE + 0x18))
  177. #define rSPI_PERIODREG (*(volatile unsigned int *)(SSI1_BASE + 0x1C))
  178. #define rSPI_TESTREG (*(volatile unsigned int *)(SSI1_BASE + 0x20))
  179. #define rSPI_MSGREG (*(volatile unsigned int *)(SSI1_BASE + 0x40))
  180. #define rSPI_RXDATA (*(volatile unsigned int *)(SSI1_BASE + 0x50))
  181. #define rSPI_TXDATA (*(volatile unsigned int *)(SSI1_BASE + 0x460))
  182. #define rSPI_TXFIFO (SSI_BASE + 0x460)
  183. #define rSPI_RXFIFO (SSI_BASE + 0x50)
  184. /* SSI0 */
  185. #define rSPI_CTLR0 (*(volatile unsigned int *)(SSI0_BASE + 0x00))
  186. #define rSPI_CTLR1 (*(volatile unsigned int *)(SSI0_BASE + 0x04))
  187. #define rSPI_SSIENR (*(volatile unsigned int *)(SSI0_BASE + 0x08))
  188. #define rSPI_MWCR (*(volatile unsigned int *)(SSI0_BASE + 0x0c))
  189. #define rSPI_SER (*(volatile unsigned int *)(SSI0_BASE + 0x10))
  190. #define rSPI_BAUDR (*(volatile unsigned int *)(SSI0_BASE + 0x14))
  191. #define rSPI_TXFTLR (*(volatile unsigned int *)(SSI0_BASE + 0x18))
  192. #define rSPI_RXFTLR (*(volatile unsigned int *)(SSI0_BASE + 0x1C))
  193. #define rSPI_TXFLR (*(volatile unsigned int *)(SSI0_BASE + 0x20))
  194. #define rSPI_RXFLR (*(volatile unsigned int *)(SSI0_BASE + 0x24))
  195. #define rSPI_SR (*(volatile unsigned int *)(SSI0_BASE + 0x28))
  196. #define rSPI_IMR (*(volatile unsigned int *)(SSI0_BASE + 0x2C))
  197. #define rSPI_ISR (*(volatile unsigned int *)(SSI0_BASE + 0x30))
  198. #define rSPI_RISR (*(volatile unsigned int *)(SSI0_BASE + 0x34))
  199. #define rSPI_TXOICR (*(volatile unsigned int *)(SSI0_BASE + 0x38))
  200. #define rSPI_RXOICR (*(volatile unsigned int *)(SSI0_BASE + 0x3C))
  201. #define rSPI_RXUICR (*(volatile unsigned int *)(SSI0_BASE + 0x40))
  202. #define rSPI_MSTICR (*(volatile unsigned int *)(SSI0_BASE + 0x44))
  203. #define rSPI_ICR (*(volatile unsigned int *)(SSI0_BASE + 0x48))
  204. #define rSPI_DMACR (*(volatile unsigned int *)(SSI0_BASE + 0x4C))
  205. #define rSPI_DMATDLR (*(volatile unsigned int *)(SSI0_BASE + 0x50))
  206. #define rSPI_DMARDLR (*(volatile unsigned int *)(SSI0_BASE + 0x54))
  207. #define rSPI_IDR (*(volatile unsigned int *)(SSI0_BASE + 0x58))
  208. #define rSPI_SSI_COMP_VERSION (*(volatile unsigned int *)(SSI0_BASE + 0x5C))
  209. #define rSPI_DR (*(volatile unsigned int *)(SSI0_BASE + 0x60))
  210. #define SPI_DR (SSI0_BASE + 0x60)
  211. #define rSPI_RX_SAMPLE_DLY (*(volatile unsigned int *)(SSI0_BASE + 0xf0))
  212. #define rSPI_SPI_CTRLR0 (*(volatile unsigned int *)(SSI0_BASE + 0xf4))
  213. //#define rSPI_RSVD_1 (*(volatile unsigned int *)(SSI0_BASE + 0xf8))
  214. //#define rSPI_RSVD_1 (*(volatile unsigned int *)(SSI0_BASE + 0xfC))
  215. /* GPIO */
  216. #define rGPIO_PA_MOD (*(volatile unsigned int *)(GPIO_BASE + 0x00))
  217. #define rGPIO_PA_RDATA (*(volatile unsigned int *)(GPIO_BASE + 0x04))
  218. #define rGPIO_PA_INTEN (*(volatile unsigned int *)(GPIO_BASE + 0x08))
  219. #define rGPIO_PA_LEVEL (*(volatile unsigned int *)(GPIO_BASE + 0x0C))
  220. #define rGPIO_PA_PEND (*(volatile unsigned int *)(GPIO_BASE + 0x10))
  221. #define rGPIO_PB_MOD (*(volatile unsigned int *)(GPIO_BASE + 0x20))
  222. #define rGPIO_PB_RDATA (*(volatile unsigned int *)(GPIO_BASE + 0x24))
  223. #define rGPIO_PB_INTEN (*(volatile unsigned int *)(GPIO_BASE + 0x28))
  224. #define rGPIO_PB_LEVEL (*(volatile unsigned int *)(GPIO_BASE + 0x2C))
  225. #define rGPIO_PB_PEND (*(volatile unsigned int *)(GPIO_BASE + 0x30))
  226. #define rGPIO_PC_MOD (*(volatile unsigned int *)(GPIO_BASE + 0x40))
  227. #define rGPIO_PC_RDATA (*(volatile unsigned int *)(GPIO_BASE + 0x44))
  228. #define rGPIO_PC_INTEN (*(volatile unsigned int *)(GPIO_BASE + 0x48))
  229. #define rGPIO_PC_LEVEL (*(volatile unsigned int *)(GPIO_BASE + 0x4C))
  230. #define rGPIO_PC_PEND (*(volatile unsigned int *)(GPIO_BASE + 0x50))
  231. #define rGPIO_PD_MOD (*(volatile unsigned int *)(GPIO_BASE + 0x60))
  232. #define rGPIO_PD_RDATA (*(volatile unsigned int *)(GPIO_BASE + 0x64))
  233. #define rGPIO_PD_INTEN (*(volatile unsigned int *)(GPIO_BASE + 0x68))
  234. #define rGPIO_PD_LEVEL (*(volatile unsigned int *)(GPIO_BASE + 0x6C))
  235. #define rGPIO_PD_PEND (*(volatile unsigned int *)(GPIO_BASE + 0x70))
  236. //DDR Reg
  237. #define DDR_BASE 0x71300000
  238. #define MEM_STA_REG *(volatile unsigned int *)(DDR_BASE + 0x00)
  239. #define MEM_CMD_REG *(volatile unsigned int *)(DDR_BASE + 0x04)
  240. #define DIR_CMD_REG *(volatile unsigned int *)(DDR_BASE + 0x08)
  241. #define MEM_CFG_REG *(volatile unsigned int *)(DDR_BASE + 0x0C)
  242. #define REF_PRD_REG *(volatile unsigned int *)(DDR_BASE + 0x10)
  243. #define TCAS_REG *(volatile unsigned int *)(DDR_BASE + 0x14)
  244. #define TDQSS_REG *(volatile unsigned int *)(DDR_BASE + 0x18)
  245. #define TMRD_REG *(volatile unsigned int *)(DDR_BASE + 0x1C)
  246. #define TRAS_REG *(volatile unsigned int *)(DDR_BASE + 0x20)
  247. #define TRC_REG *(volatile unsigned int *)(DDR_BASE + 0x24)
  248. #define TRCD_REG *(volatile unsigned int *)(DDR_BASE + 0x28)
  249. #define TRFC_REG *(volatile unsigned int *)(DDR_BASE + 0x2C)
  250. #define TRP_REG *(volatile unsigned int *)(DDR_BASE + 0x30)
  251. #define TRRD_REG *(volatile unsigned int *)(DDR_BASE + 0x34)
  252. #define TWR_REG *(volatile unsigned int *)(DDR_BASE + 0x38)
  253. #define TWTR_REG *(volatile unsigned int *)(DDR_BASE + 0x3C)
  254. #define TXP_REG *(volatile unsigned int *)(DDR_BASE + 0x40)
  255. #define TXSR_REG *(volatile unsigned int *)(DDR_BASE + 0x44)
  256. #define TESR_REG *(volatile unsigned int *)(DDR_BASE + 0x48)
  257. #define MEM_CFG2_REG *(volatile unsigned int *)(DDR_BASE + 0x4C)
  258. #define CHIP_CFG_REG *(volatile unsigned int *)(DDR_BASE + 0x200)
  259. #define FEA_CTL_REG *(volatile unsigned int *)(DDR_BASE + 0x30C)
  260. typedef enum IRQn
  261. {
  262. LCD_IRQn = 0, /**< 0 AMT630H LCD Interrupt ID */
  263. JPG_IRQn = 1, /**< 1 AMT630H Jpeg Decoder Interrupt (JPG) */
  264. GPU_IRQn = 2, /**< 2 AMT630H GPU Interrupt (GPU) */
  265. USB_IRQn = 3, /**< 3 AMT630H USB Controller Interrupt (USB) */
  266. PXP_IRQn = 4, /**< 4 AMT630H PXP Interrupt (PXP) */
  267. DMA_IRQn = 5, /**< 5 AMT630H DMA Controller Interrupt (DMAC) */
  268. SDMMC0_IRQn = 6, /**< 6 AMT630H SDMMC 0 Controller Interrupt (SDMMC0) */
  269. SPI0_IRQn = 7, /**< 7 AMT630H SPI 0 Controller Interrupt (SPI0) */
  270. SPI1_IRQn = 8, /**< 8 AMT630H SPI 1 Controller Interrupt (SPI1) */
  271. I2C0_IRQn = 9, /**< 9 AMT630H I2C0 Controller Interrupt (I2C0) */
  272. I2C1_IRQn = 10, /**< 10 AMT630H I2C1 Controller Interrupt (I2C1) */
  273. UART0_IRQn = 11, /**< 11 AMT630H UART 0 Controller Interrupt (UART0) */
  274. UART1_IRQn = 12, /**< 12 AMT630H UART 1 Controller Interrupt (UART1) */
  275. UART2_IRQn = 13, /**< 13 AMT630H UART 2 Controller Interrupt (UART2) */
  276. UART3_IRQn = 14, /**< 14 AMT630H UART 3 Controller Interrupt (UART3) */
  277. GPIOA_IRQn = 15, /**< 15 AMT630H GPIO0~31 Controller Interrupt (GPIOA) */
  278. GPIOB_IRQn = 16, /**< 16 AMT630H GPIO32~63 Controller Interrupt (GPIOB) */
  279. GPIOC_IRQn = 17, /**< 17 AMT630H GPIO64~95 Controller Interrupt (GPIOC) */
  280. GPIOD_IRQn = 18, /**< 18 AMT630H GPIO96~127 Controller Interrupt (GPIOD) */
  281. TIMER0_IRQn = 19, /**< 19 AMT630H Timer 0 Interrupt (TIMER0) */
  282. TIMER1_IRQn = 20, /**< 20 AMT630H Timer 1 Interrupt (TIMER1) */
  283. TIMER2_IRQn = 21, /**< 21 AMT630H Timer 2 Interrupt (TIMER2) */
  284. TIMER3_IRQn = 22, /**< 22 AMT630H Timer 3 Interrupt (TIMER3) */
  285. ITU_IRQn = 23, /**< 23 AMT630H ITU Controller Interrupt (ITU) */
  286. WDT_IRQn = 24, /**< 24 AMT630H Watchdog timer Interrupt (WDT) */
  287. RTC_I2S_IRQn = 25, /**< 25 AMT630H I2S Interrupt (I2S) */
  288. RTC_ALM_IRQn = 26, /**< 26 AMT630H RTC Controller Alarm Interrupt (RTCA) */
  289. RTC_PRD_IRQn = 27, /**< 27 AMT630H RTC Controller Period Interrupt (RTCP) */
  290. ADC_IRQn = 28, /**< 28 AMT630H ADC controller Interrupt (ADC) */
  291. RCRT_IRQn = 29, /**< 29 */
  292. CAN0_IRQn = 30, /**< 30 AMT630H CAN0 Controller Interrupt (CAN0) */
  293. CAN1_IRQn = 31, /**< 31 AMT630H CAN1 Controller Interrupt (CAN1) */
  294. MAX_IRQ_NUM = 32 /**< Number of peripheral IDs */
  295. } IRQn_Type;
  296. #define MMU_ENABLE
  297. #define LOADER_OFFSET 0x0
  298. #define LOADER_MAX_SIZE 0x4000
  299. #define STEPLDRA_OFFSET 0x4000
  300. #define STEPLDRB_OFFSET 0x20000
  301. #define STEPLDR_MAX_SIZE 0x18000//0x14000
  302. #define SYSINFOA_OFFSET 0x3c000
  303. #define SYSINFOB_OFFSET 0x3e000
  304. #define SYSINFO_MAX_SIZE 0x1000
  305. #define IMAGE_OFFSET 0x40000
  306. #define IMAGE_READ_SIZE 0x10000
  307. #define LOADER_FILE_NAME "spildr.bin"
  308. #define STEPLDR_FILE_NAME "stepldr.bin"
  309. #define APP_FILE_NAME "update.bin"
  310. #define IMAGE_ENTRY 0x20000000
  311. typedef struct {
  312. unsigned int magic;
  313. unsigned int offset;
  314. unsigned int size;
  315. } UpFileInfo;
  316. typedef struct {
  317. unsigned int magic;
  318. unsigned int filenum;
  319. unsigned int size;
  320. unsigned int checksum;
  321. unsigned int reserved1;
  322. unsigned int reserved2;
  323. UpFileInfo files[];
  324. } UpFileHeader;
  325. #define ENOENT 2 /* No such file or directory */
  326. #define EIO 5 /* I/O error */
  327. #define ENXIO 6 /* No such device or address */
  328. #define ENOMEM 12 /* Out of memory */
  329. #define ENODEV 19 /* No such device */
  330. #define EINVAL 22 /* Invalid argument */
  331. #define EFBIG 27 /* File too large */
  332. #define ENOSPC 28 /* No space left on device */
  333. #define ENOTCONN 107 /* Transport endpoint is not connected */
  334. #define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1))
  335. #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
  336. //typedef unsigned long uintptr_t;
  337. #define PAD_COUNT(s, pad) (((s) - 1) / (pad) + 1)
  338. #define PAD_SIZE(s, pad) (PAD_COUNT(s, pad) * pad)
  339. #define ALLOC_ALIGN_BUFFER_PAD(type, name, size, align, pad) \
  340. char __##name[ROUND(PAD_SIZE((size) * sizeof(type), pad), align) \
  341. + (align - 1)]; \
  342. \
  343. type *name = (type *)ALIGN((uintptr_t)__##name, align)
  344. #define ALLOC_ALIGN_BUFFER(type, name, size, align) \
  345. ALLOC_ALIGN_BUFFER_PAD(type, name, size, align, 1)
  346. #define ALLOC_CACHE_ALIGN_BUFFER_PAD(type, name, size, pad) \
  347. ALLOC_ALIGN_BUFFER_PAD(type, name, size, ARCH_DMA_MINALIGN, pad)
  348. #define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) \
  349. ALLOC_ALIGN_BUFFER(type, name, size, ARCH_DMA_MINALIGN)
  350. #define reg32_read(addr) *((volatile uint32_t *)(addr))
  351. #define reg32_write(addr,val) *((volatile uint32_t *)(addr)) = (val)
  352. #define readl(a) reg32_read(a)
  353. #define writel(v, a) reg32_write(a, v)
  354. #endif // _AMT630H_H_