1 /* 2 * Copyright (c) 2006-2018, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 */ 9 #ifndef __SEP4020_H 10 #define __SEP4020_H 11 12 #include <rtthread.h> 13 14 /*Core definations*/ 15 #define SVCMODE 16 #define Mode_USR 0x10 17 #define Mode_FIQ 0x11 18 #define Mode_IRQ 0x12 19 #define Mode_SVC 0x13 20 #define Mode_ABT 0x17 21 #define Mode_UND 0x1B 22 #define Mode_SYS 0x1F 23 24 25 26 /* 27 * 各模块寄存器基值 28 */ 29 30 #define ESRAM_BASE 0x04000000 31 #define INTC_BASE 0x10000000 32 #define PMU_BASE 0x10001000 33 #define RTC_BASE 0x10002000 34 #define WD_BASE 0x10002000 35 #define TIMER_BASE 0x10003000 36 #define PWM_BASE 0x10004000 37 #define UART0_BASE 0X10005000 38 #define UART1_BASE 0X10006000 39 #define UART2_BASE 0X10007000 40 #define UART3_BASE 0X10008000 41 #define SSI_BASE 0X10009000 42 #define I2S_BASE 0x1000A000 43 #define MMC_BASE 0x1000B000 44 #define SD_BASE 0x1000B000 45 #define SMC0_BASE 0x1000C000 46 #define SMC1_BASE 0x1000D000 47 #define USBD_BASE 0x1000E000 48 #define GPIO_BASE 0x1000F000 49 #define EMI_BASE 0x11000000 50 #define DMAC_BASE 0x11001000 51 #define LCDC_BASE 0x11002000 52 #define MAC_BASE 0x11003000 53 #define AMBA_BASE 0x11005000 54 55 56 /* 57 * INTC模块 58 * 基址: 0x10000000 59 */ 60 61 #define INTC_IER (INTC_BASE+0X000) /* IRQ中断允许寄存器 */ 62 #define INTC_IMR (INTC_BASE+0X008) /* IRQ中断屏蔽寄存器 */ 63 #define INTC_IFR (INTC_BASE+0X010) /* IRQ软件强制中断寄存器 */ 64 #define INTC_IRSR (INTC_BASE+0X018) /* IRQ未处理中断状态寄存器 */ 65 #define INTC_ISR (INTC_BASE+0X020) /* IRQ中断状态寄存器 */ 66 #define INTC_IMSR (INTC_BASE+0X028) /* IRQ屏蔽中断状态寄存器 */ 67 #define INTC_IFSR (INTC_BASE+0X030) /* IRQ中断最终状态寄存器 */ 68 #define INTC_FIER (INTC_BASE+0X0C0) /* FIQ中断允许寄存器 */ 69 #define INTC_FIMR (INTC_BASE+0X0C4) /* FIQ中断屏蔽寄存器 */ 70 #define INTC_FIFR (INTC_BASE+0X0C8) /* FIQ软件强制中断寄存器 */ 71 #define INTC_FIRSR (INTC_BASE+0X0CC) /* FIQ未处理中断状态寄存器 */ 72 #define INTC_FISR (INTC_BASE+0X0D0) /* FIQ中断状态寄存器 */ 73 #define INTC_FIFSR (INTC_BASE+0X0D4) /* FIQ中断最终状态寄存器 */ 74 #define INTC_IPLR (INTC_BASE+0X0D8) /* IRQ中断优先级寄存器 */ 75 #define INTC_ICR1 (INTC_BASE+0X0DC) /* IRQ内部中断优先级控制寄存器1 */ 76 #define INTC_ICR2 (INTC_BASE+0X0E0) /* IRQ内部中断优先级控制寄存器2 */ 77 #define INTC_EXICR1 (INTC_BASE+0X0E4) /* IRQ外部中断优先级控制寄存器1 */ 78 #define INTC_EXICR2 (INTC_BASE+0X0E8) /* IRQ外部中断优先级控制寄存器2 */ 79 80 81 /* 82 * PMU模块 83 * 基址: 0x10001000 84 */ 85 86 #define PMU_PLTR (PMU_BASE+0X000) /* PLL的稳定过渡时间 */ 87 #define PMU_PMCR (PMU_BASE+0X004) /* 系统主时钟PLL的控制寄存器 */ 88 #define PMU_PUCR (PMU_BASE+0X008) /* USB时钟PLL的控制寄存器 */ 89 #define PMU_PCSR (PMU_BASE+0X00C) /* 内部模块时钟源供给的控制寄存器 */ 90 #define PMU_PDSLOW (PMU_BASE+0X010) /* SLOW状态下时钟的分频因子 */ 91 #define PMU_PMDR (PMU_BASE+0X014) /* 芯片工作模式寄存器 */ 92 #define PMU_RCTR (PMU_BASE+0X018) /* Reset控制寄存器 */ 93 #define PMU_CLRWAKUP (PMU_BASE+0X01C) /* WakeUp清除寄存器 */ 94 95 96 /* 97 * RTC模块 98 * 基址: 0x10002000 99 */ 100 101 #define RTC_STA_YMD (RTC_BASE+0X000) /* 年, 月, 日计数寄存器 */ 102 #define RTC_STA_HMS (RTC_BASE+0X004) /* 小时, 分钟, 秒寄存器 */ 103 #define RTC_ALARM_ALL (RTC_BASE+0X008) /* 定时月, 日, 时, 分寄存器 */ 104 #define RTC_CTR (RTC_BASE+0X00C) /* 控制寄存器 */ 105 #define RTC_INT_EN (RTC_BASE+0X010) /* 中断使能寄存器 */ 106 #define RTC_INT_STS (RTC_BASE+0X014) /* 中断状态寄存器 */ 107 #define RTC_SAMP (RTC_BASE+0X018) /* 采样周期寄存器 */ 108 #define RTC_WD_CNT (RTC_BASE+0X01C) /* Watch-Dog计数值寄存器 */ 109 #define RTC_WD_SEV (RTC_BASE+0X020) /* Watch-Dog服务寄存器 */ 110 #define RTC_CONFIG_CHECK (RTC_BASE+0X024) /* 配置时间确认寄存器 (在配置时间之前先写0xaaaaaaaa) */ 111 #define RTC_KEY0 (RTC_BASE+0X02C) /* 密钥寄存器 */ 112 113 /* 114 * TIMER模块 115 * 基址: 0x10003000 116 */ 117 118 #define TIMER_T1LCR (TIMER_BASE+0X000) /* 通道1加载计数寄存器 */ 119 #define TIMER_T1CCR (TIMER_BASE+0X004) /* 通道1当前计数值寄存器 */ 120 #define TIMER_T1CR (TIMER_BASE+0X008) /* 通道1控制寄存器 */ 121 #define TIMER_T1ISCR (TIMER_BASE+0X00C) /* 通道1中断状态清除寄存器 */ 122 #define TIMER_T1IMSR (TIMER_BASE+0X010) /* 通道1中断屏蔽状态寄存器 */ 123 #define TIMER_T2LCR (TIMER_BASE+0X020) /* 通道2加载计数寄存器 */ 124 #define TIMER_T2CCR (TIMER_BASE+0X024) /* 通道2当前计数值寄存器 */ 125 #define TIMER_T2CR (TIMER_BASE+0X028) /* 通道2控制寄存器 */ 126 #define TIMER_T2ISCR (TIMER_BASE+0X02C) /* 通道2中断状态清除寄存器 */ 127 #define TIMER_T2IMSR (TIMER_BASE+0X030) /* 通道2中断屏蔽状态寄存器 */ 128 #define TIMER_T3LCR (TIMER_BASE+0X040) /* 通道3加载计数寄存器 */ 129 #define TIMER_T3CCR (TIMER_BASE+0X044) /* 通道3当前计数值寄存器 */ 130 #define TIMER_T3CR (TIMER_BASE+0X048) /* 通道3控制寄存器 */ 131 #define TIMER_T3ISCR (TIMER_BASE+0X04C) /* 通道3中断状态清除寄存器 */ 132 #define TIMER_T3IMSR (TIMER_BASE+0X050) /* 通道3中断屏蔽状态寄存器 */ 133 #define TIMER_T3CAPR (TIMER_BASE+0X054) /* 通道3捕获寄存器 */ 134 #define TIMER_T4LCR (TIMER_BASE+0X060) /* 通道4加载计数寄存器 */ 135 #define TIMER_T4CCR (TIMER_BASE+0X064) /* 通道4当前计数值寄存器 */ 136 #define TIMER_T4CR (TIMER_BASE+0X068) /* 通道4控制寄存器 */ 137 #define TIMER_T4ISCR (TIMER_BASE+0X06C) /* 通道4中断状态清除寄存器 */ 138 #define TIMER_T4IMSR (TIMER_BASE+0X070) /* 通道4中断屏蔽状态寄存器 */ 139 #define TIMER_T4CAPR (TIMER_BASE+0X074) /* 通道4捕获寄存器 */ 140 #define TIMER_T5LCR (TIMER_BASE+0X080) /* 通道5加载计数寄存器 */ 141 #define TIMER_T5CCR (TIMER_BASE+0X084) /* 通道5当前计数值寄存器 */ 142 #define TIMER_T5CR (TIMER_BASE+0X088) /* 通道5控制寄存器 */ 143 #define TIMER_T5ISCR (TIMER_BASE+0X08C) /* 通道5中断状态清除寄存器 */ 144 #define TIMER_T5IMSR (TIMER_BASE+0X090) /* 通道5中断屏蔽状态寄存器 */ 145 #define TIMER_T5CAPR (TIMER_BASE+0X094) /* 通道5捕获寄存器 */ 146 #define TIMER_T6LCR (TIMER_BASE+0X0A0) /* 通道6加载计数寄存器 */ 147 #define TIMER_T6CCR (TIMER_BASE+0X0A4) /* 通道6当前计数值寄存器 */ 148 #define TIMER_T6CR (TIMER_BASE+0X0A8) /* 通道6控制寄存器 */ 149 #define TIMER_T6ISCR (TIMER_BASE+0X0AC) /* 通道6中断状态清除寄存器 */ 150 #define TIMER_T6IMSR (TIMER_BASE+0X0B0) /* 通道6中断屏蔽状态寄存器 */ 151 #define TIMER_T6CAPR (TIMER_BASE+0X0B4) /* 通道6捕获寄存器 */ 152 #define TIMER_T7LCR (TIMER_BASE+0X0C0) /* 通道7加载计数寄存器 */ 153 #define TIMER_T7CCR (TIMER_BASE+0X0C4) /* 通道7当前计数值寄存器 */ 154 #define TIMER_T7CR (TIMER_BASE+0X0C8) /* 通道7控制寄存器 */ 155 #define TIMER_T7ISCR (TIMER_BASE+0X0CC) /* 通道7中断状态清除寄存器 */ 156 #define TIMER_T7IMSR (TIMER_BASE+0X0D0) /* 通道7中断屏蔽状态寄存器 */ 157 #define TIMER_T8LCR (TIMER_BASE+0X0E0) /* 通道8加载计数寄存器 */ 158 #define TIMER_T8CCR (TIMER_BASE+0X0E4) /* 通道8当前计数值寄存器 */ 159 #define TIMER_T8CR (TIMER_BASE+0X0E8) /* 通道8控制寄存器 */ 160 #define TIMER_T8ISCR (TIMER_BASE+0X0EC) /* 通道8中断状态清除寄存器 */ 161 #define TIMER_T8IMSR (TIMER_BASE+0X0F0) /* 通道8中断屏蔽状态寄存器 */ 162 #define TIMER_T9LCR (TIMER_BASE+0X100) /* 通道9加载计数寄存器 */ 163 #define TIMER_T9CCR (TIMER_BASE+0X104) /* 通道9当前计数值寄存器 */ 164 #define TIMER_T9CR (TIMER_BASE+0X108) /* 通道9控制寄存器 */ 165 #define TIMER_T9ISCR (TIMER_BASE+0X10C) /* 通道9中断状态清除寄存器 */ 166 #define TIMER_T9IMSR (TIMER_BASE+0X110) /* 通道9中断屏蔽状态寄存器 */ 167 #define TIMER_T10LCR (TIMER_BASE+0X120) /* 通道10加载计数寄存器 */ 168 #define TIMER_T10CCR (TIMER_BASE+0X124) /* 通道10当前计数值寄存器 */ 169 #define TIMER_T10CR (TIMER_BASE+0X128) /* 通道10控制寄存器 */ 170 #define TIMER_T10ISCR (TIMER_BASE+0X12C) /* 通道10中断状态清除寄存器 */ 171 #define TIMER_T10IMSR (TIMER_BASE+0X130) /* 通道10中断屏蔽状态寄存器 */ 172 #define TIMER_TIMSR (TIMER_BASE+0X140) /* TIMER中断屏蔽状态寄存器 */ 173 #define TIMER_TISCR (TIMER_BASE+0X144) /* TIMER中断状态清除寄存器 */ 174 #define TIMER_TISR (TIMER_BASE+0X148) /* TIMER中断状态寄存器 */ 175 176 177 178 /* 179 * PWM模块 180 * 基址: 0x10004000 181 */ 182 183 #define PWM0_CTRL (PWM_BASE+0X000) /* PWM0控制寄存器 */ 184 #define PWM0_DIV (PWM_BASE+0X004) /* PWM0分频寄存器 */ 185 #define PWM0_PERIOD (PWM_BASE+0X008) /* PWM0周期寄存器 */ 186 #define PWM0_DATA (PWM_BASE+0X00C) /* PWM0数据寄存器 */ 187 #define PWM0_CNT (PWM_BASE+0X010) /* PWM0计数寄存器 */ 188 #define PWM0_STATUS (PWM_BASE+0X014) /* PWM0状态寄存器 */ 189 #define PWM1_CTRL (PWM_BASE+0X020) /* PWM1控制寄存器 */ 190 #define PWM1_DIV (PWM_BASE+0X024) /* PWM1分频寄存器 */ 191 #define PWM1_PERIOD (PWM_BASE+0X028) /* PWM1周期寄存器 */ 192 #define PWM1_DATA (PWM_BASE+0X02C) /* PWM1数据寄存器 */ 193 #define PWM1_CNT (PWM_BASE+0X030) /* PWM1计数寄存器 */ 194 #define PWM1_STATUS (PWM_BASE+0X034) /* PWM1状态寄存器 */ 195 #define PWM2_CTRL (PWM_BASE+0X040) /* PWM2控制寄存器 */ 196 #define PWM2_DIV (PWM_BASE+0X044) /* PWM2分频寄存器 */ 197 #define PWM2_PERIOD (PWM_BASE+0X048) /* PWM2周期寄存器 */ 198 #define PWM2_DATA (PWM_BASE+0X04C) /* PWM2数据寄存器 */ 199 #define PWM2_CNT (PWM_BASE+0X050) /* PWM2计数寄存器 */ 200 #define PWM2_STATUS (PWM_BASE+0X054) /* PWM2状态寄存器 */ 201 #define PWM3_CTRL (PWM_BASE+0X060) /* PWM3控制寄存器 */ 202 #define PWM3_DIV (PWM_BASE+0X064) /* PWM3分频寄存器 */ 203 #define PWM3_PERIOD (PWM_BASE+0X068) /* PWM3周期寄存器 */ 204 #define PWM3_DATA (PWM_BASE+0X06C) /* PWM3数据寄存器 */ 205 #define PWM3_CNT (PWM_BASE+0X070) /* PWM3计数寄存器 */ 206 #define PWM3_STATUS (PWM_BASE+0X074) /* PWM3状态寄存器 */ 207 #define PWM_INTMASK (PWM_BASE+0X080) /* PWM中断屏蔽寄存器 */ 208 #define PWM_INT (PWM_BASE+0X084) /* PWM中断寄存器 */ 209 #define PWM_ENABLE (PWM_BASE+0X088) /* PWM使能寄存器 */ 210 211 212 /* 213 * UART0模块 214 * 基址: 0x10005000 215 */ 216 217 #define UART0_DLBL (UART0_BASE+0X000) /* 波特率设置低八位寄存器 */ 218 #define UART0_RXFIFO (UART0_BASE+0X000) /* 接收FIFO */ 219 #define UART0_TXFIFO (UART0_BASE+0X000) /* 发送FIFO */ 220 #define UART0_DLBH (UART0_BASE+0X004) /* 波特率设置高八位寄存器 */ 221 #define UART0_IER (UART0_BASE+0X004) /* 中断使能寄存器 */ 222 #define UART0_IIR (UART0_BASE+0X008) /* 中断识别寄存器 */ 223 #define UART0_FCR (UART0_BASE+0X008) /* FIFO控制寄存器 */ 224 #define UART0_LCR (UART0_BASE+0X00C) /* 行控制寄存器 */ 225 #define UART0_MCR (UART0_BASE+0X010) /* Modem控制寄存器 */ 226 #define UART0_LSR (UART0_BASE+0X014) /* 行状态寄存器 */ 227 #define UART0_MSR (UART0_BASE+0X018) /* Modem状态寄存器 */ 228 229 230 /* 231 * UART1模块 232 * 基址: 0x10006000 233 */ 234 235 #define UART1_DLBL (UART1_BASE+0X000) /* 波特率设置低八位寄存器 */ 236 #define UART1_RXFIFO (UART1_BASE+0X000) /* 接收FIFO */ 237 #define UART1_TXFIFO (UART1_BASE+0X000) /* 发送FIFO */ 238 #define UART1_DLBH (UART1_BASE+0X004) /* 波特率设置高八位寄存器 */ 239 #define UART1_IER (UART1_BASE+0X004) /* 中断使能寄存器 */ 240 #define UART1_IIR (UART1_BASE+0X008) /* 中断识别寄存器 */ 241 #define UART1_FCR (UART1_BASE+0X008) /* FIFO控制寄存器 */ 242 #define UART1_LCR (UART1_BASE+0X00C) /* 行控制寄存器 */ 243 #define UART1_MCR (UART1_BASE+0X010) /* Modem控制寄存器 */ 244 #define UART1_LSR (UART1_BASE+0X014) /* 行状态寄存器 */ 245 #define UART1_MSR (UART1_BASE+0X018) /* Modem状态寄存器 */ 246 247 248 /* 249 * UART2模块 250 * 基址: 0x10007000 251 */ 252 253 #define UART2_DLBL (UART2_BASE+0X000) /* 波特率设置低八位寄存器 */ 254 #define UART2_RXFIFO (UART2_BASE+0X000) /* 接收FIFO */ 255 #define UART2_TXFIFO (UART2_BASE+0X000) /* 发送FIFO */ 256 #define UART2_DLBH (UART2_BASE+0X004) /* 波特率设置高八位寄存器 */ 257 #define UART2_IER (UART2_BASE+0X004) /* 中断使能寄存器 */ 258 #define UART2_IIR (UART2_BASE+0X008) /* 中断识别寄存器 */ 259 #define UART2_FCR (UART2_BASE+0X008) /* FIFO控制寄存器 */ 260 #define UART2_LCR (UART2_BASE+0X00C) /* 行控制寄存器 */ 261 #define UART2_MCR (UART2_BASE+0X010) /* Modem控制寄存器 */ 262 #define UART2_LSR (UART2_BASE+0X014) /* 行状态寄存器 */ 263 #define UART2_MSR (UART2_BASE+0X018) /* Modem状态寄存器 */ 264 265 266 /* 267 * UART3模块 268 * 基址: 0x10008000 269 */ 270 271 #define UART3_DLBL (UART3_BASE+0X000) /* 波特率设置低八位寄存器 */ 272 #define UART3_RXFIFO (UART3_BASE+0X000) /* 接收FIFO */ 273 #define UART3_TXFIFO (UART3_BASE+0X000) /* 发送FIFO */ 274 #define UART3_DLBH (UART3_BASE+0X004) /* 波特率设置高八位寄存器 */ 275 #define UART3_IER (UART3_BASE+0X004) /* 中断使能寄存器 */ 276 #define UART3_IIR (UART3_BASE+0X008) /* 中断识别寄存器 */ 277 #define UART3_FCR (UART3_BASE+0X008) /* FIFO控制寄存器 */ 278 #define UART3_LCR (UART3_BASE+0X00C) /* 行控制寄存器 */ 279 #define UART3_MCR (UART3_BASE+0X010) /* Modem控制寄存器 */ 280 #define UART3_LSR (UART3_BASE+0X014) /* 行状态寄存器 */ 281 #define UART3_MSR (UART3_BASE+0X018) /* Modem状态寄存器 */ 282 283 284 /* 285 * SSI模块 286 * 基址: 0x10009000 287 */ 288 289 #define SSI_CONTROL0 (SSI_BASE+0X000) /* 控制寄存器0 */ 290 #define SSI_CONTROL1 (SSI_BASE+0X004) /* 控制寄存器1 */ 291 #define SSI_SSIENR (SSI_BASE+0X008) /* SSI使能寄存器 */ 292 #define SSI_MWCR (SSI_BASE+0X00C) /* Microwire控制寄存器 */ 293 #define SSI_SER (SSI_BASE+0X010) /* 从设备使能寄存器 */ 294 #define SSI_BAUDR (SSI_BASE+0X014) /* 波特率设置寄存器 */ 295 #define SSI_TXFTLR (SSI_BASE+0X018) /* 发送FIFO阈值寄存器 */ 296 #define SSI_RXFTLR (SSI_BASE+0X01C) /* 接收FIFO阈值寄存器 */ 297 #define SSI_TXFLR (SSI_BASE+0X020) /* 发送FIFO状态寄存器 */ 298 #define SSI_RXFLR (SSI_BASE+0X024) /* 接收FIFO状态寄存器 */ 299 #define SSI_SR (SSI_BASE+0X028) /* 状态寄存器 */ 300 #define SSI_IMR (SSI_BASE+0X02C) /* 中断屏蔽寄存器 */ 301 #define SSI_ISR (SSI_BASE+0X030) /* 中断最终状态寄存器 */ 302 #define SSI_RISR (SSI_BASE+0X034) /* 中断原始状态寄存器 */ 303 #define SSI_TXOICR (SSI_BASE+0X038) /* 发送FIFO上溢中断清除寄存器 */ 304 #define SSI_RXOICR (SSI_BASE+0X03C) /* 接收FIFO上溢中断清除寄存器 */ 305 #define SSI_RXUICR (SSI_BASE+0X040) /* 接收FIFO下溢中断清除寄存器 */ 306 #define SSI_ICR (SSI_BASE+0X02C) /* 中断清除寄存器 */ 307 #define SSI_DMACR (SSI_BASE+0X04C) /* DMA控制寄存器 */ 308 #define SSI_DMATDLR (SSI_BASE+0X050) /* DMA发送状态寄存器 */ 309 #define SSI_DMARDLR (SSI_BASE+0X054) /* DMA接收状态寄存器 */ 310 #define SSI_DR (SSI_BASE+0X060) /* 数据寄存器 */ 311 312 313 /* 314 * I2S模块 315 * 基址: 0x1000A000 316 */ 317 318 #define I2S_CTRL (I2S_BASE+0X000) /* I2S控制寄存器 */ 319 #define I2S_DATA (I2S_BASE+0X004) /* I2S数据寄存器 */ 320 #define I2S_INT (I2S_BASE+0X008) /* I2S中断寄存器 */ 321 #define I2S_STATUS (I2S_BASE+0X00C) /* I2S状态寄存器 */ 322 323 324 /* 325 * SD模块 326 * 基址: 0x1000B000 327 */ 328 329 #define SDC_CLOCK_CONTROL (SD_BASE+0x00) /* SDIO时钟控制寄存器 */ 330 #define SDC_SOFTWARE_RESET (SD_BASE+0X04) /* SDIO软件复位寄存器 */ 331 #define SDC_ARGUMENT (SD_BASE+0X08) /* SDIO命令参数寄存器 */ 332 #define SDC_COMMAND (SD_BASE+0X0C) /* SDIO命令控制寄存器 */ 333 #define SDC_BLOCK_SIZE (SD_BASE+0X10) /* SDIO数据块长度寄存器 */ 334 #define SDC_BLOCK_COUNT (SD_BASE+0X14) /* SDIO数据块数目寄存器 */ 335 #define SDC_TRANSFER_MODE (SD_BASE+0X18) /* SDIO传输模式选择寄存器 */ 336 #define SDC_RESPONSE0 (SD_BASE+0X1c) /* SDIO响应寄存器0 */ 337 #define SDC_RESPONSE1 (SD_BASE+0X20) /* SDIO响应寄存器1 */ 338 #define SDC_RESPONSE2 (SD_BASE+0X24) /* SDIO响应寄存器2 */ 339 #define SDC_RESPONSE3 (SD_BASE+0X28) /* SDIO响应寄存器3 */ 340 #define SDC_READ_TIMEOUT_CONTROL (SD_BASE+0X2c) /* SDIO读超时控制寄存器 */ 341 #define SDC_INTERRUPT_STATUS (SD_BASE+0X30) /* SDIO中断状态寄存器 */ 342 #define SDC_INTERRUPT_STATUS_MASK (SD_BASE+0X34) /* SDIO中断状态屏蔽寄存器 */ 343 #define SDC_READ_BUFER_ACCESS (SD_BASE+0X38) /* SDIO接收FIFO */ 344 #define SDC_WRITE_BUFER_ACCESS (SD_BASE+0X3c) /* SDIO发送FIFO */ 345 346 347 348 /* 349 * SMC0模块 350 * 基址: 0x1000C000 351 */ 352 353 #define SMC0_CTRL (SMC0_BASE+0X000) /* SMC0控制寄存器 */ 354 #define SMC0_INT (SMC0_BASE+0X004) /* SMC0中断寄存器 */ 355 #define SMC0_FD (SMC0_BASE+0X008) /* SMC0基本单元时间寄存器 */ 356 #define SMC0_CT (SMC0_BASE+0X00C) /* SMC0字符传输时间寄存器 */ 357 #define SMC0_BT (SMC0_BASE+0X010) /* SMC0块传输时间寄存器 */ 358 359 360 361 /* 362 * SMC1模块 363 * 基址: 0x1000D000 364 */ 365 366 #define SMC1_CTRL (SMC1_BASE+0X000) /* SMC1控制寄存器 */ 367 #define SMC1_INT (SMC1_BASE+0X004) /* SMC1中断寄存器 */ 368 #define SMC1_FD (SMC1_BASE+0X008) /* SMC1基本单元时间寄存器 */ 369 #define SMC1_CT (SMC1_BASE+0X00C) /* SMC1字符传输时间寄存器 */ 370 #define SMC1_BT (SMC1_BASE+0X010) /* SMC1块传输时间寄存器 */ 371 372 373 374 /* 375 * USBD模块 376 * 基址: 0x1000E000 377 */ 378 379 #define USBD_PROTOCOLINTR (USBD_BASE+0X000) /* USB协议中断寄存器 */ 380 #define USBD_INTRMASK (USBD_BASE+0X004) /* USB中断屏蔽寄存器 */ 381 #define USBD_INTRCTRL (USBD_BASE+0X008) /* USB中断类型控制寄存器 */ 382 #define USBD_EPINFO (USBD_BASE+0X00C) /* USB活动端点状态寄存器 */ 383 #define USBD_BCONFIGURATIONVALUE (USBD_BASE+0X010) /* SET_CCONFIGURATION记录 */ 384 #define USBD_BMATTRIBUTES (USBD_BASE+0X014) /* 当前配置属性寄存器 */ 385 #define USBD_DEVSPEED (USBD_BASE+0X018) /* 当前设备工作速度寄存器 */ 386 #define USBD_FRAMENUMBER (USBD_BASE+0X01C) /* 记录当前SOF包内的帧号 */ 387 #define USBD_EPTRANSACTIONS0 (USBD_BASE+0X020) /* 记录下次要求的传输次数 */ 388 #define USBD_EPTRANSACTIONS1 (USBD_BASE+0X024) /* 记录下次要求的传输次数 */ 389 #define USBD_APPIFUPDATE (USBD_BASE+0X028) /* 接口号快速更新寄存器 */ 390 #define USBD_CFGINTERFACE0 (USBD_BASE+0X02C) /* 记录接口的值 */ 391 #define USBD_CFGINTERFACE1 (USBD_BASE+0X030) /* 记录接口的值 */ 392 #define USBD_CFGINTERFACE2 (USBD_BASE+0X034) /* 记录接口的值 */ 393 #define USBD_CFGINTERFACE3 (USBD_BASE+0X038) /* 记录接口的值 */ 394 #define USBD_CFGINTERFACE4 (USBD_BASE+0X03C) /* 记录接口的值 */ 395 #define USBD_CFGINTERFACE5 (USBD_BASE+0X040) /* 记录接口的值 */ 396 #define USBD_CFGINTERFACE6 (USBD_BASE+0X044) /* 记录接口的值 */ 397 #define USBD_CFGINTERFACE7 (USBD_BASE+0X048) /* 记录接口的值 */ 398 #define USBD_CFGINTERFACE8 (USBD_BASE+0X04C) /* 记录接口的值 */ 399 #define USBD_CFGINTERFACE9 (USBD_BASE+0X050) /* 记录接口的值 */ 400 #define USBD_CFGINTERFACE10 (USBD_BASE+0X054) /* 记录接口的值 */ 401 #define USBD_CFGINTERFACE11 (USBD_BASE+0X058) /* 记录接口的值 */ 402 #define USBD_CFGINTERFACE12 (USBD_BASE+0X05C) /* 记录接口的值 */ 403 #define USBD_CFGINTERFACE13 (USBD_BASE+0X060) /* 记录接口的值 */ 404 #define USBD_CFGINTERFACE14 (USBD_BASE+0X064) /* 记录接口的值 */ 405 #define USBD_CFGINTERFACE15 (USBD_BASE+0X068) /* 记录接口的值 */ 406 #define USBD_CFGINTERFACE16 (USBD_BASE+0X06C) /* 记录接口的值 */ 407 #define USBD_CFGINTERFACE17 (USBD_BASE+0X070) /* 记录接口的值 */ 408 #define USBD_CFGINTERFACE18 (USBD_BASE+0X074) /* 记录接口的值 */ 409 #define USBD_CFGINTERFACE19 (USBD_BASE+0X078) /* 记录接口的值 */ 410 #define USBD_CFGINTERFACE20 (USBD_BASE+0X07C) /* 记录接口的值 */ 411 #define USBD_CFGINTERFACE21 (USBD_BASE+0X080) /* 记录接口的值 */ 412 #define USBD_CFGINTERFACE22 (USBD_BASE+0X084) /* 记录接口的值 */ 413 #define USBD_CFGINTERFACE23 (USBD_BASE+0X088) /* 记录接口的值 */ 414 #define USBD_CFGINTERFACE24 (USBD_BASE+0X08C) /* 记录接口的值 */ 415 #define USBD_CFGINTERFACE25 (USBD_BASE+0X090) /* 记录接口的值 */ 416 #define USBD_CFGINTERFACE26 (USBD_BASE+0X094) /* 记录接口的值 */ 417 #define USBD_CFGINTERFACE27 (USBD_BASE+0X098) /* 记录接口的值 */ 418 #define USBD_CFGINTERFACE28 (USBD_BASE+0X09C) /* 记录接口的值 */ 419 #define USBD_CFGINTERFACE29 (USBD_BASE+0X0A0) /* 记录接口的值 */ 420 #define USBD_CFGINTERFACE30 (USBD_BASE+0X0A4) /* 记录接口的值 */ 421 #define USBD_CFGINTERFACE31 (USBD_BASE+0X0A8) /* 记录接口的值 */ 422 #define USBD_PKTPASSEDCTRL (USBD_BASE+0X0AC) /* 记录成功接收的包数 */ 423 #define USBD_PKTDROPPEDCTRL (USBD_BASE+0X0B0) /* 记录丢失的包数 */ 424 #define USBD_CRCERRCTRL (USBD_BASE+0X0B4) /* 记录CRC错误的包数 */ 425 #define USBD_BITSTUFFERRCTRL (USBD_BASE+0X0B8) /* 记录位填充错误的包数 */ 426 #define USBD_PIDERRCTRL (USBD_BASE+0X0BC) /* 记录PID错误的包数 */ 427 #define USBD_FRAMINGERRCTL (USBD_BASE+0X0C0) /* 记录有SYNC和EOP的包数 */ 428 #define USBD_TXPKTCTRL (USBD_BASE+0X0C4) /* 记录发送包的数量 */ 429 #define USBD_STATCTRLOV (USBD_BASE+0X0C8) /* 记录统计寄存器溢出情况 */ 430 #define USBD_TXLENGTH (USBD_BASE+0X0CC) /* 记录每次IN传输事务包长度 */ 431 #define USBD_RXLENGTH (USBD_BASE+0X0D0) /* 记录OUT传输事务包长度 */ 432 #define USBD_RESUME (USBD_BASE+0X0D4) /* USB唤醒寄存器 */ 433 #define USBD_READFLAG (USBD_BASE+0X0D8) /* 读异步状态寄存器标志 */ 434 #define USBD_RECEIVETYPE (USBD_BASE+0X0DC) /* 传输状态寄存器 */ 435 #define USBD_APPLOCK (USBD_BASE+0X0E0) /* 锁信号寄存器 */ 436 #define USBD_EP0OUTADDR (USBD_BASE+0X100) /* 端点0端点号和方向 */ 437 #define USBD_EP0OUTBMATTR (USBD_BASE+0X104) /* 端点0类型寄存器 */ 438 #define USBD_EP0OUTMAXPKTSIZE (USBD_BASE+0X108) /* 端点0最大包尺寸寄存器 */ 439 #define USBD_EP0OUTIFNUM (USBD_BASE+0X10C) /* 端点0接口号寄存器 */ 440 #define USBD_EP0OUTSTAT (USBD_BASE+0X110) /* 端点0状态寄存器 */ 441 #define USBD_EP0OUTBMREQTYPE (USBD_BASE+0X114) /* 端点0 SETUP事务请求类 */ 442 #define USBD_EP0OUTBREQUEST (USBD_BASE+0X118) /* 端点0 SETUP事务请求内容 */ 443 #define USBD_EP0OUTWVALUE (USBD_BASE+0X11C) /* 端点0 SETUP事务请求值 */ 444 #define USBD_EP0OUTWINDEX (USBD_BASE+0X120) /* 端点0 SETUP事务请求索引 */ 445 #define USBD_EP0OUTWLENGTH (USBD_BASE+0X120) /* 端点0 SETUP事务请求长度 */ 446 #define USBD_EP0OUTSYNCHFRAME (USBD_BASE+0X128) /* 端点0同步包帧号 */ 447 #define USBD_EP1OUTADDR (USBD_BASE+0X12C) /* 端点1输出端点号和方向 */ 448 #define USBD_EP1OUTBMATTR (USBD_BASE+0X130) /* 端点1输出类型寄存器 */ 449 #define USBD_EP1OUTMAXPKTSIZE (USBD_BASE+0X134) /* 端点1输出最大包尺寸寄存器 */ 450 #define USBD_EP1OUTIFNUM (USBD_BASE+0X138) /* 端点1输出接口号寄存器 */ 451 #define USBD_EP1OUTSTAT (USBD_BASE+0X13C) /* 端点1输出状态寄存器 */ 452 #define USBD_EP1OUTBMREQTYPE (USBD_BASE+0X140) /* 端点1输出SETUP事务请求类型 */ 453 #define USBD_EP1OUTBREQUEST (USBD_BASE+0X144) /* 端点1输出SETUP事务请求内容 */ 454 #define USBD_EP1OUTWVALUE (USBD_BASE+0X148) /* 端点1输出SETUP事务请求值 */ 455 #define USBD_EP1OUTWINDX (USBD_BASE+0X14C) /* 端点1输出SETUP事务请求索引 */ 456 #define USBD_EP1OUTWLENGH (USBD_BASE+0X150) /* 端点1输出SETUP事务请求域长度 */ 457 #define USBD_EP1OUTSYNCHFRAME (USBD_BASE+0X154) /* 端点1输出同步包帧号 */ 458 #define USBD_EP1INADDR (USBD_BASE+0X158) /* 端点1输入端点号和方向 */ 459 #define USBD_EP1INBMATTR (USBD_BASE+0X15C) /* 端点1输入类型寄存器 */ 460 #define USBD_EP1INMAXPKTSIZE (USBD_BASE+0X160) /* 端点1输入最大包尺寸寄存器 */ 461 #define USBD_EP1INIFNUM (USBD_BASE+0X164) /* 端点1输入接口号寄存器 */ 462 #define USBD_EP1INSTAT (USBD_BASE+0X168) /* 端点1输入状态寄存器 */ 463 #define USBD_EP1INBMREQTYPE (USBD_BASE+0X16C) /* 端点1输入SETUP事务请求类型 */ 464 #define USBD_EP1INBREQUEST (USBD_BASE+0X170) /* 端点1输入SETUP事务请求内容 */ 465 #define USBD_EP1INWVALUE (USBD_BASE+0X174) /* 端点1输入SETUP事务请求值 */ 466 #define USBD_EP1INWINDEX (USBD_BASE+0X178) /* 端点1输入SETUP事务请求索引 */ 467 #define USBD_EP1INWLENGTH (USBD_BASE+0X17C) /* 端点1输入SETUP事务请求域长度 */ 468 #define USBD_EP1INSYNCHFRAME (USBD_BASE+0X180) /* 端点1输入同步包帧号 */ 469 #define USBD_EP2OUTADDR (USBD_BASE+0X184) /* 端点2输出端点号和方向 */ 470 #define USBD_EP2OUTBMATTR (USBD_BASE+0X188) /* 端点2输出类型寄存器 */ 471 #define USBD_EP2OUTMAXPKTSIZE (USBD_BASE+0X18C) /* 端点2输出最大包尺寸寄存器 */ 472 #define USBD_EP2OUTIFNUM (USBD_BASE+0X190) /* 端点2输出接口号寄存器 */ 473 #define USBD_EP2OUTSTAT (USBD_BASE+0X194) /* 端点2输出状态寄存器 */ 474 #define USBD_EP2OUTBMREQTYPE (USBD_BASE+0X198) /* 端点2输出SETUP事务请求类型 */ 475 #define USBD_EP2OUTBREQUEST (USBD_BASE+0X19C) /* 端点2输出SETUP事务请求内容 */ 476 #define USBD_EP2OUTWVALUE (USBD_BASE+0X1A0) /* 端点2输出SETUP事务请求值 */ 477 #define USBD_EP2OUTWINDEX (USBD_BASE+0X1A4) /* 端点2输出SETUP事务请求索引 */ 478 #define USBD_EP2OUTWLENGTH (USBD_BASE+0X1A8) /* 端点2输出SETUP事务请求域长度 */ 479 #define USBD_EP2OUTSYNCHFRAME (USBD_BASE+0X1AC) /* 端点2输出同步包帧号 */ 480 #define USBD_EP2INADDR (USBD_BASE+0X1B0) /* 端点2输入端点号和方向 */ 481 #define USBD_EP2INBMATTR (USBD_BASE+0X1B4) /* 端点2输入类型寄存器 */ 482 #define USBD_EP2INMAXPKTSIZE (USBD_BASE+0X1B8) /* 端点2输入最大包尺寸寄存器 */ 483 #define USBD_EP2INIFNUM (USBD_BASE+0X1BC) /* 端点2输入接口号寄存器 */ 484 #define USBD_EP2INSTAT (USBD_BASE+0X1C0) /* 端点2输入状态寄存器 */ 485 #define USBD_EP2INBMREQTYPE (USBD_BASE+0X1C4) /* 端点2输入SETUP事务请求类型 */ 486 #define USBD_EP2INBREQUEST (USBD_BASE+0X1C8) /* 端点2输入SETUP事务请求内容 */ 487 #define USBD_EP2INWVALUE (USBD_BASE+0X1CC) /* 端点2输入SETUP事务请求值 */ 488 #define USBD_EP2INWINDEX (USBD_BASE+0X1D0) /* 端点2输入SETUP事务请求索引 */ 489 #define USBD_EP2INWLENGTH (USBD_BASE+0X1D4) /* 端点2输入SETUP事务请求域长度 */ 490 #define USBD_EP2INSYNCHFRAME (USBD_BASE+0X1D8) /* 端点2输入同步包帧号 */ 491 #define USBD_RXFIFO (USBD_BASE+0X200) /* 接受FIFO */ 492 #define USBD_TXFIFO (USBD_BASE+0X300) /* 发送FIFO */ 493 494 495 /* 496 * GPIO模块 497 * 基址: 0x1000F000 498 */ 499 500 #define GPIO_DBCLK_DIV (GPIO_BASE+0X000) /* 去毛刺采用时钟分频比配置寄存器 */ 501 #define GPIO_PORTA_DIR (GPIO_BASE+0X004) /* A组端口输入输出方向配置寄存器 */ 502 #define GPIO_PORTA_SEL (GPIO_BASE+0X008) /* A组端口通用用途选择配置寄存器 */ 503 #define GPIO_PORTA_INCTL (GPIO_BASE+0X00C) /* A组端口通用用途输入时类型配置寄存器 */ 504 #define GPIO_PORTA_INTRCTL (GPIO_BASE+0X010) /* A组端口中断触发类型配置寄存器 */ 505 #define GPIO_PORTA_INTRCLR (GPIO_BASE+0X014) /* A组端口通用用途中断清除配置寄存器 */ 506 #define GPIO_PORTA_DATA (GPIO_BASE+0X018) /* A组端口通用用途数据配置寄存器 */ 507 #define GPIO_PORTB_DIR (GPIO_BASE+0X01C) /* B组端口输入输出方向配置寄存器 */ 508 #define GPIO_PORTB_SEL (GPIO_BASE+0X020) /* B组端口通用用途选择配置寄存器 */ 509 #define GPIO_PORTB_DATA (GPIO_BASE+0X024) /* B组端口通用用途数据配置寄存器 */ 510 #define GPIO_PORTC_DIR (GPIO_BASE+0X028) /* C组端口输入输出方向配置寄存器 */ 511 #define GPIO_PORTC_SEL (GPIO_BASE+0X02C) /* C组端口通用用途选择配置寄存器 */ 512 #define GPIO_PORTC_DATA (GPIO_BASE+0X030) /* C组端口通用用途数据配置寄存器 */ 513 #define GPIO_PORTD_DIR (GPIO_BASE+0X034) /* D组端口输入输出方向配置寄存器 */ 514 #define GPIO_PORTD_SEL (GPIO_BASE+0X038) /* D组端口通用用途选择配置寄存器 */ 515 #define GPIO_PORTD_SPECII (GPIO_BASE+0X03C) /* D组端口专用用途2选择配置寄存器 */ 516 #define GPIO_PORTD_DATA (GPIO_BASE+0X040) /* D组端口通用用途数据配置寄存器 */ 517 #define GPIO_PORTE_DIR (GPIO_BASE+0X044) /* E组端口输入输出方向配置寄存器 */ 518 #define GPIO_PORTE_SEL (GPIO_BASE+0X048) /* E组端口通用用途选择配置寄存器 */ 519 #define GPIO_PORTE_DATA (GPIO_BASE+0X04C) /* E组端口通用用途数据配置寄存器 */ 520 #define GPIO_PORTF_DIR (GPIO_BASE+0X050) /* F组端口输入输出方向配置寄存器 */ 521 #define GPIO_PORTF_SEL (GPIO_BASE+0X054) /* F组端口通用用途选择配置寄存器 */ 522 #define GPIO_PORTF_INCTL (GPIO_BASE+0X058) /* F组端口通用用途输入时类型配置寄存器 */ 523 #define GPIO_PORTF_INTRCTL (GPIO_BASE+0X05C) /* F组端口中断触发类型配置寄存器 */ 524 #define GPIO_PORTF_INTRCLR (GPIO_BASE+0X060) /* F组端口通用用途中断清除配置寄存器 */ 525 #define GPIO_PORTF_DATA (GPIO_BASE+0X064) /* F组端口通用用途数据配置寄存器 */ 526 #define GPIO_PORTG_DIR (GPIO_BASE+0X068) /* G组端口输入输出方向配置寄存器 */ 527 #define GPIO_PORTG_SEL (GPIO_BASE+0X06C) /* G组端口通用用途选择配置寄存器 */ 528 #define GPIO_PORTG_DATA (GPIO_BASE+0X070) /* G组端口通用用途数据配置寄存器 */ 529 #define GPIO_PORTH_DIR (GPIO_BASE+0X07C) /* H组端口输入输出方向配置寄存器 */ 530 #define GPIO_PORTH_SEL (GPIO_BASE+0X078) /* H组端口通用用途选择配置寄存器 */ 531 #define GPIO_PORTH_DATA (GPIO_BASE+0X07C) /* H组端口通用用途数据配置寄存器 */ 532 #define GPIO_PORTI_DIR (GPIO_BASE+0X080) /* I组端口输入输出方向配置寄存器 */ 533 #define GPIO_PORTI_SEL (GPIO_BASE+0X084) /* I组端口通用用途选择配置寄存器 */ 534 #define GPIO_PORTI_DATA (GPIO_BASE+0X088) /* I组端口通用用途数据配置寄存器 */ 535 536 537 538 /* 539 * EMI模块 540 * 基址: 0x11000000 541 */ 542 543 #define EMI_CSACONF (EMI_BASE+0X000) /* CSA参数配置寄存器 */ 544 #define EMI_CSBCONF (EMI_BASE+0X004) /* CSB参数配置寄存器 */ 545 #define EMI_CSCCONF (EMI_BASE+0X008) /* CSC参数配置寄存器 */ 546 #define EMI_CSDCONF (EMI_BASE+0X00C) /* CSD参数配置寄存器 */ 547 #define EMI_CSECONF (EMI_BASE+0X010) /* CSE参数配置寄存器 */ 548 #define EMI_CSFCONF (EMI_BASE+0X014) /* CSF参数配置寄存器 */ 549 #define EMI_SDCONF1 (EMI_BASE+0X018) /* SDRAM时序配置寄存器1 */ 550 #define EMI_SDCONF2 (EMI_BASE+0X01C) /* SDRAM时序配置寄存器2, SDRAM初始化用到的配置信息 */ 551 #define EMI_REMAPCONF (EMI_BASE+0X020) /* 片选空间及地址映射REMAP配置寄存器 */ 552 #define EMI_NAND_ADDR1 (EMI_BASE+0X100) /* NAND FLASH的地址寄存器1 */ 553 #define EMI_NAND_COM (EMI_BASE+0X104) /* NAND FLASH的控制字寄存器 */ 554 #define EMI_NAND_STA (EMI_BASE+0X10C) /* NAND FLASH的状态寄存器 */ 555 #define EMI_ERR_ADDR1 (EMI_BASE+0X110) /* 读操作出错的地址寄存器1 */ 556 #define EMI_ERR_ADDR2 (EMI_BASE+0X114) /* 读操作出错的地址寄存器2 */ 557 #define EMI_NAND_CONF1 (EMI_BASE+0X118) /* NAND FLASH的配置器存器1 */ 558 #define EMI_NAND_INTR (EMI_BASE+0X11C) /* NAND FLASH中断寄存器 */ 559 #define EMI_NAND_ECC (EMI_BASE+0X120) /* ECC校验完成寄存器 */ 560 #define EMI_NAND_IDLE (EMI_BASE+0X124) /* NAND FLASH空闲寄存器 */ 561 #define EMI_NAND_CONF2 (EMI_BASE+0X128) /* NAND FLASH的配置器存器2 */ 562 #define EMI_NAND_ADDR2 (EMI_BASE+0X12C) /* NAND FLASH的地址寄存器2 */ 563 #define EMI_NAND_DATA (EMI_BASE+0X200) /* NAND FLASH的数据寄存器 */ 564 565 566 /* 567 * DMAC模块 568 * 基址: 0x11001000 569 */ 570 571 #define DMAC_INTSTATUS (DMAC_BASE+0X020) /* DAMC中断状态寄存器。 */ 572 #define DMAC_INTTCSTATUS (DMAC_BASE+0X050) /* DMAC传输完成中断状态寄存器 */ 573 #define DMAC_INTTCCLEAR (DMAC_BASE+0X060) /* DMAC传输完成中断状态清除寄存器 */ 574 #define DMAC_INTERRORSTATUS (DMAC_BASE+0X080) /* DMAC传输错误中断状态寄存器 */ 575 #define DMAC_INTINTERRCLR (DMAC_BASE+0X090) /* DMAC传输错误中断状态清除寄存器 */ 576 #define DMAC_ENBLDCHNS (DMAC_BASE+0X0B0) /* DMAC通道使能状态寄存器 */ 577 #define DMAC_C0SRCADDR (DMAC_BASE+0X000) /* DMAC道0源地址寄存器 */ 578 #define DMAC_C0DESTADD (DMAC_BASE+0X004) /* DMAC道0目的地址寄存器 */ 579 #define DMAC_C0CONTROL (DMAC_BASE+0X00C) /* DMAC道0控制寄存器 */ 580 #define DMAC_C0CONFIGURATION (DMAC_BASE+0X010) /* DMAC道0配置寄存器 */ 581 #define DMAC_C0DESCRIPTOR (DMAC_BASE+0X01C) /* DMAC道0链表地址寄存器 */ 582 #define DMAC_C1SRCADDR (DMAC_BASE+0X100) /* DMAC道1源地址寄存器 */ 583 #define DMAC_C1DESTADDR (DMAC_BASE+0X104) /* DMAC道1目的地址寄存器 */ 584 #define DMAC_C1CONTROL (DMAC_BASE+0X10C) /* DMAC道1控制寄存器 */ 585 #define DMAC_C1CONFIGURATION (DMAC_BASE+0X110) /* DMAC道1配置寄存器 */ 586 #define DMAC_C1DESCRIPTOR (DMAC_BASE+0X114) /* DMAC道1链表地址寄存器 */ 587 #define DMAC_C2SRCADDR (DMAC_BASE+0X200) /* DMAC道2源地址寄存器 */ 588 #define DMAC_C2DESTADDR (DMAC_BASE+0X204) /* DMAC道2目的地址寄存器 */ 589 #define DMAC_C2CONTROL (DMAC_BASE+0X20C) /* DMAC道2控制寄存器 */ 590 #define DMAC_C2CONFIGURATION (DMAC_BASE+0X210) /* DMAC道2配置寄存器 */ 591 #define DMAC_C2DESCRIPTOR (DMAC_BASE+0X214) /* DMAC道2链表地址寄存器 */ 592 #define DMAC_C3SRCADDR (DMAC_BASE+0X300) /* DMAC道3源地址寄存器 */ 593 #define DMAC_C3DESTADDR (DMAC_BASE+0X304) /* DMAC道3目的地址寄存器 */ 594 #define DMAC_C3CONTROL (DMAC_BASE+0X30C) /* DMAC道3控制寄存器 */ 595 #define DMAC_C3CONFIGURATION (DMAC_BASE+0X310) /* DMAC道3配置寄存器 */ 596 #define DMAC_C3DESCRIPTOR (DMAC_BASE+0X314) /* DMAC道3链表地址寄存器 */ 597 #define DMAC_C4SRCADDR (DMAC_BASE+0X400) /* DMAC道4源地址寄存器 */ 598 #define DMAC_C4DESTADDR (DMAC_BASE+0X404) /* DMAC道4目的地址寄存器 */ 599 #define DMAC_C4CONTROL (DMAC_BASE+0X40C) /* DMAC道4控制寄存器 */ 600 #define DMAC_C4CONFIGURATION (DMAC_BASE+0X410) /* DMAC道4配置寄存器 */ 601 #define DMAC_C4DESCRIPTOR (DMAC_BASE+0X414) /* DMAC道4链表地址寄存器 */ 602 #define DMAC_C5SRCADDR (DMAC_BASE+0X500) /* DMAC道5源地址寄存器 */ 603 #define DMAC_C5DESTADDR (DMAC_BASE+0X504) /* DMAC道5目的地址寄存器 */ 604 #define DMAC_C5CONTROL (DMAC_BASE+0X50C) /* DMAC道5控制寄存器 */ 605 #define DMAC_C5CONFIGURATION (DMAC_BASE+0X510) /* DMAC道5配置寄存器 */ 606 #define DMAC_C5DESCRIPTOR (DMAC_BASE+0X514) /* DMAC道5链表地址寄存器 */ 607 608 609 /* 610 * LCDC模块 611 * 基址: 0x11002000 612 */ 613 614 #define LCDC_SSA (LCDC_BASE+0X000) /* 屏幕起始地址寄存器 */ 615 #define LCDC_SIZE (LCDC_BASE+0X004) /* 屏幕尺寸寄存器 */ 616 #define LCDC_PCR (LCDC_BASE+0X008) /* 面板配置寄存器 */ 617 #define LCDC_HCR (LCDC_BASE+0X00C) /* 水平配置寄存器 */ 618 #define LCDC_VCR (LCDC_BASE+0X010) /* 垂直配置寄存器 */ 619 #define LCDC_PWMR (LCDC_BASE+0X014) /* PWM对比度控制寄存器 */ 620 #define LCDC_LECR (LCDC_BASE+0X018) /* 使能控制寄存器 */ 621 #define LCDC_DMACR (LCDC_BASE+0X01C) /* DMA控制寄存器 */ 622 #define LCDC_LCDISREN (LCDC_BASE+0X020) /* 中断使能寄存器 */ 623 #define LCDC_LCDISR (LCDC_BASE+0X024) /* 中断状态寄存器 */ 624 #define LCDC_LGPMR (LCDC_BASE+0X040) /* 灰度调色映射寄存器组 (16个32bit寄存器) */ 625 626 627 /* 628 * MAC模块 629 * 基址: 0x11003000 630 */ 631 632 #define MAC_CTRL (MAC_BASE+0X000) /* MAC控制寄存器 */ 633 #define MAC_INTSRC (MAC_BASE+0X004) /* MAC中断源寄存器 */ 634 #define MAC_INTMASK (MAC_BASE+0X008) /* MAC中断屏蔽寄存器 */ 635 #define MAC_IPGT (MAC_BASE+0X00C) /* 连续帧间隔寄存器 */ 636 #define MAC_IPGR1 (MAC_BASE+0X010) /* 等待窗口寄存器 */ 637 #define MAC_IPGR2 (MAC_BASE+0X014) /* 等待窗口寄存器 */ 638 #define MAC_PACKETLEN (MAC_BASE+0X018) /* 帧长度寄存器 */ 639 #define MAC_COLLCONF (MAC_BASE+0X01C) /* 碰撞重发寄存器 */ 640 #define MAC_TXBD_NUM (MAC_BASE+0X020) /* 发送描述符寄存器 */ 641 #define MAC_FLOWCTRL (MAC_BASE+0X024) /* 流控寄存器 */ 642 #define MAC_MII_CTRL (MAC_BASE+0X028) /* PHY控制寄存器 */ 643 #define MAC_MII_CMD (MAC_BASE+0X02C) /* PHY命令寄存器 */ 644 #define MAC_MII_ADDRESS (MAC_BASE+0X030) /* PHY地址寄存器 */ 645 #define MAC_MII_TXDATA (MAC_BASE+0X034) /* PHY写数据寄存器 */ 646 #define MAC_MII_RXDATA (MAC_BASE+0X038) /* PHY读数据寄存器 */ 647 #define MAC_MII_STATUS (MAC_BASE+0X03C) /* PHY状态寄存器 */ 648 #define MAC_ADDR0 (MAC_BASE+0X040) /* MAC地址寄存器 */ 649 #define MAC_ADDR1 (MAC_BASE+0X044) /* MAC地址寄存器 */ 650 #define MAC_HASH0 (MAC_BASE+0X048) /* MAC HASH寄存器 */ 651 #define MAC_HASH1 (MAC_BASE+0X04C) /* MAC HASH寄存器 */ 652 #define MAC_TXPAUSE (MAC_BASE+0X050) /* MAC控制帧寄存器 */ 653 #define MAC_TX_BD (MAC_BASE+0X400) 654 #define MAC_RX_BD (MAC_BASE+0X600) 655 656 657 /* 658 ************************************** 659 * Error Codes: 660 * IF SUCCESS RETURN 0, ELSE RETURN OTHER ERROR CODE, 661 * parameter error return (-33)/E_PAR, 662 * hardware error reture (-99)/E_HA 663 ************************************** 664 */ 665 666 #define E_OK 0 /* Normal completion */ 667 #define E_SYS (-5) /* System error */ 668 #define E_NOMEM (-10) /* Insufficient memory */ 669 #define E_NOSPT (-17) /* Feature not supported */ 670 #define E_INOSPT (-18) /* Feature not supported by ITRON/FILE specification */ 671 #define E_RSFN (-20) /* Reserved function code number */ 672 #define E_RSATR (-24) /* Reserved attribute */ 673 #define E_PAR (-33) /* Parameter error */ 674 #define E_ID (-35) /* Invalid ID number */ 675 #define E_NOEXS (-52) /* Object does not exist */ 676 #define E_OBJ (-63) /* Invalid object state */ 677 #define E_MACV (-65) /* Memory access disabled or memory access violation */ 678 #define E_OACV (-66) /* Object access violation */ 679 #define E_CTX (-69) /* Context error */ 680 #define E_QOVR (-73) /* Queuing or nesting overflow */ 681 #define E_DLT (-81) /* Object being waited for was deleted */ 682 #define E_TMOUT (-85) /* Polling failure or timeout exceeded */ 683 #define E_RLWAI (-86) /* WAIT state was forcibly released */ 684 685 #define E_HA (-99) /* HARD WARE ERROR */ 686 687 688 /* 689 ************************************** 690 * PMU 模块时钟 691 ************************************** 692 */ 693 694 #define CLK_SGPT (1 << 16) 695 #define CLK_SI2S (1 << 15) 696 #define CLK_SSMC (1 << 14) 697 #define CLK_SMAC (1 << 13) 698 #define CLK_SUSB (1 << 12) 699 #define CLK_SUART3 (1 << 11) 700 #define CLK_SUART2 (1 << 10) 701 #define CLK_SUART1 (1 << 9) 702 #define CLK_SUART0 (1 << 8) 703 #define CLK_SSSI (1 << 7) 704 #define CLK_SAC97 (1 << 6) 705 #define CLK_SMMCSD (1 << 5) 706 #define CLK_SEMI (1 << 4) 707 #define CLK_SDMAC (1 << 3) 708 #define CLK_SPWM (1 << 2) 709 #define CLK_SLCDC (1 << 1) 710 #define CLK_SESRAM (1) 711 712 713 /*Interrupt Sources*/ 714 715 716 #define INTSRC_RTC 31 717 #define INTSRC_DMAC 30 718 #define INTSRC_EMI 29 719 #define INTSRC_MAC 28 720 #define INTSRC_TIMER1 27 721 #define INTSRC_TIMER2 26 722 #define INTSRC_TIMER3 25 723 #define INTSRC_UART0 24 724 #define INTSRC_UART1 23 725 #define INTSRC_UART2 22 726 #define INTSRC_UART3 21 727 #define INTSRC_PWM 20 728 #define INTSRC_LCDC 19 729 #define INTSRC_I2S 18 730 #define INTSRC_SSI 17 731 732 #define INTSRC_USB 15 733 #define INTSRC_SMC0 14 734 #define INTSRC_SMC1 13 735 #define INTSRC_SDIO 12 736 #define INTSRC_EXINT10 11 737 #define INTSRC_EXINT9 10 738 #define INTSRC_EXINT8 9 739 #define INTSRC_EXINT7 8 740 #define INTSRC_EXINT6 7 741 #define INTSRC_EXINT5 6 742 #define INTSRC_EXINT4 5 743 #define INTSRC_EXINT3 4 744 #define INTSRC_EXINT2 3 745 #define INTSRC_EXINT1 2 746 #define INTSRC_EXINT0 1 747 #define INTSRC_NULL 0 748 749 750 /*Sereral useful macros*/ 751 #define set_plevel(plevel) *(RP)INTC_IPLR = plevel //设置普通中断的优先级门限,只有优先级大于此值的中断才能通过 752 #define set_int_force(intnum) *(RP)INTC_IFR = (1 << intnum) //置1后,软件强制该位对应的中断源发出中断信号 753 #define enable_irq(intnum) *(RP)INTC_IER |= (1 << intnum) //置1后,允许中断源的IRQ 中断信号 754 #define disable_irq( intnum) *(RP)INTC_IER &= ~(1<< intnum) //置0后,不允许中断源的IRQ 中断信号 755 #define mask_irq(intnum) *(RP)INTC_IMR |= (1 << intnum) //置1后,屏蔽对应的IRQ 中断信号 756 #define unmask_irq(intnum) *(RP)INTC_IMR &= ~(1 << intnum) //置0后,通过对应的IRQ 中断信号 757 #define mask_all_irq() *(RP)INTC_IMR = 0xFFFFFFFF //屏蔽对应的IRQ 中断信号 758 #define unmask_all_irq() *(RP)INTC_IMR = 0x00000000 //通过对应的IRQ 中断信号 759 #define enable_all_irq() *(RP)INTC_IER = 0XFFFFFFFF //允许中断源的IRQ 中断信号 760 #define disable_all_irq() *(RP)INTC_IER = 0X00000000 //不允许中断源的IRQ 中断信号 761 #define InitInt() do{mask_all_irq(); enable_all_irq();}while(0) 762 763 /* 764 ************************************** 765 * 所有程序中用到的Typedef 766 ************************************** 767 */ 768 769 typedef char S8; /* signed 8-bit integer */ 770 typedef short S16; /* signed 16-bit integer */ 771 typedef long S32; /* signed 32-bit integer */ 772 typedef unsigned char U8; /* unsigned 8-bit integer */ 773 typedef unsigned short U16; /* unsigned 16-bit integer */ 774 typedef unsigned long U32; /* unsigned 32-bit integer */ 775 776 typedef volatile U32 * RP; 777 typedef volatile U16 * RP16; 778 typedef volatile U8 * RP8; 779 780 typedef void *VP; /* pointer to an unpredictable data type */ 781 typedef void (*FP)(); /* program start address */ 782 783 #ifndef _BOOL_TYPE_ 784 #define _BOOL_TYPE_ 785 typedef int BOOL; /* Boolean value. TRUE (1) or FALSE (0). */ 786 #endif 787 788 typedef int ER; /* Error code. A signed integer. */ 789 790 /** 791 * IO definitions 792 * 793 * define access restrictions to peripheral registers 794 */ 795 796 #define __I volatile const /*!< defines 'read only' permissions */ 797 #define __O volatile /*!< defines 'write only' permissions */ 798 #define __IO volatile /*!< defines 'read / write' permissions */ 799 #define __iomem volatile 800 801 802 /*Macros for debug*/ 803 804 #define EOUT(fmt,...) \ 805 do \ 806 { \ 807 rt_kprintf("EOUT:(%s:%i) ",__FILE__,__LINE__); \ 808 rt_kprintf(fmt,##__VA_ARGS__); \ 809 }while(0) 810 811 #define RT_DEBUG 812 #ifdef RT_DEBUG 813 #define DBOUT(fmt,...) \ 814 do \ 815 { \ 816 rt_kprintf("DBOUT:(%s:%i) ",__FILE__,__LINE__); \ 817 rt_kprintf(fmt,##__VA_ARGS__); \ 818 }while(0) 819 #else 820 #define DBOUT(fmt,...) \ 821 do{}while(0) 822 #endif 823 824 #ifdef RT_DEBUG 825 #define ASSERT(arg) \ 826 if((arg) == 0) \ 827 { \ 828 while(1) \ 829 { \ 830 rt_kprintf("have a assert failure\n"); \ 831 } \ 832 } 833 #else 834 #define ASSERT(arg) \ 835 do \ 836 { \ 837 }while(0) 838 #endif 839 840 841 #define write_reg(reg,value) \ 842 do \ 843 { \ 844 *(RP)(reg) = value; \ 845 }while(0) 846 847 #define read_reg(reg) (*(RP)reg) 848 849 850 struct rt_hw_register 851 { 852 rt_uint32_t r0; 853 rt_uint32_t r1; 854 rt_uint32_t r2; 855 rt_uint32_t r3; 856 rt_uint32_t r4; 857 rt_uint32_t r5; 858 rt_uint32_t r6; 859 rt_uint32_t r7; 860 rt_uint32_t r8; 861 rt_uint32_t r9; 862 rt_uint32_t r10; 863 rt_uint32_t fp; 864 rt_uint32_t ip; 865 rt_uint32_t sp; 866 rt_uint32_t lr; 867 rt_uint32_t pc; 868 rt_uint32_t cpsr; 869 rt_uint32_t ORIG_r0; 870 }; 871 872 873 /*@}*/ 874 875 #endif 876