📄 uart.lst
字号:
250:/mnt/hgfs/boot/booter/source/uart.c **** break; 251:/mnt/hgfs/boot/booter/source/uart.c **** } 252:/mnt/hgfs/boot/booter/source/uart.c **** } 253:/mnt/hgfs/boot/booter/source/uart.c **** 254:/mnt/hgfs/boot/booter/source/uart.c **** /********************************************************************/ 255:/mnt/hgfs/boot/booter/source/uart.c **** void 256:/mnt/hgfs/boot/booter/source/uart.c **** uartInit (int uartNumber, int baud) 257:/mnt/hgfs/boot/booter/source/uart.c **** { 258:/mnt/hgfs/boot/booter/source/uart.c **** UART_t *p; 259:/mnt/hgfs/boot/booter/source/uart.c **** uint32 clkdiv; 260:/mnt/hgfs/boot/booter/source/uart.c **** phys_t physAddr; 261:/mnt/hgfs/boot/booter/source/uart.c **** 262:/mnt/hgfs/boot/booter/source/uart.c **** /* Make sure not in use already */GAS LISTING /tmp/cc4XVykA.s page 6 263:/mnt/hgfs/boot/booter/source/uart.c **** if ((uartNumber < 0) || (uartNumber >= MAX_UARTS)) 264:/mnt/hgfs/boot/booter/source/uart.c **** return; 265:/mnt/hgfs/boot/booter/source/uart.c **** 266:/mnt/hgfs/boot/booter/source/uart.c **** if (uarts[uartNumber].uart != NULL) 267:/mnt/hgfs/boot/booter/source/uart.c **** return; 268:/mnt/hgfs/boot/booter/source/uart.c **** 269:/mnt/hgfs/boot/booter/source/uart.c **** /* get the system parameter area */ 270:/mnt/hgfs/boot/booter/source/uart.c **** sys = (AU1X00_SYS *) 271:/mnt/hgfs/boot/booter/source/uart.c **** mapPhysicalAddress(SYS_PHYS_ADDR, sizeof(AU1X00_SYS), 0); 272:/mnt/hgfs/boot/booter/source/uart.c **** 273:/mnt/hgfs/boot/booter/source/uart.c **** /* Pointer to master structure */ 274:/mnt/hgfs/boot/booter/source/uart.c **** p = &uarts[uartNumber]; 275:/mnt/hgfs/boot/booter/source/uart.c **** p->uartNumber = uartNumber; 276:/mnt/hgfs/boot/booter/source/uart.c **** 277:/mnt/hgfs/boot/booter/source/uart.c **** #ifdef UART0_PHYS_ADDR 278:/mnt/hgfs/boot/booter/source/uart.c **** if (uartNumber == 0) 279:/mnt/hgfs/boot/booter/source/uart.c **** { 280:/mnt/hgfs/boot/booter/source/uart.c **** physAddr = UART0_PHYS_ADDR; 281:/mnt/hgfs/boot/booter/source/uart.c **** p->irq = IRQ_UART0; 282:/mnt/hgfs/boot/booter/source/uart.c **** } 283:/mnt/hgfs/boot/booter/source/uart.c **** #endif 284:/mnt/hgfs/boot/booter/source/uart.c **** #ifdef UART1_PHYS_ADDR 285:/mnt/hgfs/boot/booter/source/uart.c **** if (uartNumber == 1) 286:/mnt/hgfs/boot/booter/source/uart.c **** { 287:/mnt/hgfs/boot/booter/source/uart.c **** physAddr = UART1_PHYS_ADDR; 288:/mnt/hgfs/boot/booter/source/uart.c **** p->irq = IRQ_UART1; 289:/mnt/hgfs/boot/booter/source/uart.c **** } 290:/mnt/hgfs/boot/booter/source/uart.c **** #endif 291:/mnt/hgfs/boot/booter/source/uart.c **** #ifdef UART2_PHYS_ADDR 292:/mnt/hgfs/boot/booter/source/uart.c **** if (uartNumber == 2) 293:/mnt/hgfs/boot/booter/source/uart.c **** { 294:/mnt/hgfs/boot/booter/source/uart.c **** physAddr = UART2_PHYS_ADDR; 295:/mnt/hgfs/boot/booter/source/uart.c **** p->irq = IRQ_UART2; 296:/mnt/hgfs/boot/booter/source/uart.c **** } 297:/mnt/hgfs/boot/booter/source/uart.c **** #endif 298:/mnt/hgfs/boot/booter/source/uart.c **** #ifdef UART3_PHYS_ADDR 299:/mnt/hgfs/boot/booter/source/uart.c **** if (uartNumber == 3) 300:/mnt/hgfs/boot/booter/source/uart.c **** { 301:/mnt/hgfs/boot/booter/source/uart.c **** physAddr = UART3_PHYS_ADDR; 302:/mnt/hgfs/boot/booter/source/uart.c **** p->irq = IRQ_UART3; 303:/mnt/hgfs/boot/booter/source/uart.c **** } 304:/mnt/hgfs/boot/booter/source/uart.c **** #endif 305:/mnt/hgfs/boot/booter/source/uart.c **** 306:/mnt/hgfs/boot/booter/source/uart.c **** p->nextrx = p->lastrx = p->sizerx = 0; 307:/mnt/hgfs/boot/booter/source/uart.c **** p->nexttx = p->lasttx = p->sizetx = 0; 308:/mnt/hgfs/boot/booter/source/uart.c **** 309:/mnt/hgfs/boot/booter/source/uart.c **** /* Now map the peripheral */ 310:/mnt/hgfs/boot/booter/source/uart.c **** p->uart = (AU1X00_UART *)mapPhysicalAddress(physAddr, sizeof(AU1X00_UART), 0); 311:/mnt/hgfs/boot/booter/source/uart.c **** 312:/mnt/hgfs/boot/booter/source/uart.c **** p->uart->enable = UART_ENABLE_CE; 313:/mnt/hgfs/boot/booter/source/uart.c **** msdelay(100); 314:/mnt/hgfs/boot/booter/source/uart.c **** 315:/mnt/hgfs/boot/booter/source/uart.c **** p->uart->enable = UART_ENABLE_CE | UART_ENABLE_E; 316:/mnt/hgfs/boot/booter/source/uart.c **** msdelay(100); 317:/mnt/hgfs/boot/booter/source/uart.c **** 318:/mnt/hgfs/boot/booter/source/uart.c **** p->uart->fifoctrl = ( 0 319:/mnt/hgfs/boot/booter/source/uart.c **** | UART_FIFOCTRL_RFT_4GAS LISTING /tmp/cc4XVykA.s page 7 320:/mnt/hgfs/boot/booter/source/uart.c **** | UART_FIFOCTRL_TFT_12 321:/mnt/hgfs/boot/booter/source/uart.c **** /*| UART_FIFOCTRL_MS*/ 322:/mnt/hgfs/boot/booter/source/uart.c **** | UART_FIFOCTRL_TR 323:/mnt/hgfs/boot/booter/source/uart.c **** | UART_FIFOCTRL_RR 324:/mnt/hgfs/boot/booter/source/uart.c **** | UART_FIFOCTRL_FE 325:/mnt/hgfs/boot/booter/source/uart.c **** ) ; 326:/mnt/hgfs/boot/booter/source/uart.c **** 327:/mnt/hgfs/boot/booter/source/uart.c **** p->uart->mdmctrl = 0; 328:/mnt/hgfs/boot/booter/source/uart.c **** 329:/mnt/hgfs/boot/booter/source/uart.c **** /* 8N1 */ 330:/mnt/hgfs/boot/booter/source/uart.c **** p->uart->linectrl = UART_LINECTRL_WLS_8; 331:/mnt/hgfs/boot/booter/source/uart.c **** 332:/mnt/hgfs/boot/booter/source/uart.c **** // Equation: Baudrate = CPU / (SD * 2 * CLKDIV * 16) 333:/mnt/hgfs/boot/booter/source/uart.c **** clkdiv = (12000000 * (0x3F & sys->cpupll)) / (baud * ((sys->powerctrl & 0x03) + 2) * 2 * 16); 334:/mnt/hgfs/boot/booter/source/uart.c **** 335:/mnt/hgfs/boot/booter/source/uart.c **** p->uart->clkdiv = clkdiv; 336:/mnt/hgfs/boot/booter/source/uart.c **** msdelay(100); 337:/mnt/hgfs/boot/booter/source/uart.c **** 338:/mnt/hgfs/boot/booter/source/uart.c **** p->uart->linestat; 339:/mnt/hgfs/boot/booter/source/uart.c **** p->uart->intcause; 340:/mnt/hgfs/boot/booter/source/uart.c **** 341:/mnt/hgfs/boot/booter/source/uart.c **** p->uart->inten = ( 0 342:/mnt/hgfs/boot/booter/source/uart.c **** | UART_INTEN_MIE 343:/mnt/hgfs/boot/booter/source/uart.c **** | UART_INTEN_LIE 344:/mnt/hgfs/boot/booter/source/uart.c **** | UART_INTEN_TIE 345:/mnt/hgfs/boot/booter/source/uart.c **** | UART_INTEN_RIE 346:/mnt/hgfs/boot/booter/source/uart.c **** ) ; 347:/mnt/hgfs/boot/booter/source/uart.c **** 348:/mnt/hgfs/boot/booter/source/uart.c **** /* Hook interrupt */ 349:/mnt/hgfs/boot/booter/source/uart.c **** cpuIrqEnable(p->irq, 0, (void *)uartHandler, (void *)p); 350:/mnt/hgfs/boot/booter/source/uart.c **** 351:/mnt/hgfs/boot/booter/source/uart.c **** } 352:/mnt/hgfs/boot/booter/source/uart.c **** 353:/mnt/hgfs/boot/booter/source/uart.c **** /********************************************************************/ 354:/mnt/hgfs/boot/booter/source/uart.c **** 355:/mnt/hgfs/boot/booter/source/uart.c **** 356:/mnt/hgfs/boot/booter/source/uart.c **** 357:/mnt/hgfs/boot/booter/source/uart.c **** 358:/mnt/hgfs/boot/booter/source/uart.c **** 359:/mnt/hgfs/boot/booter/source/uart.c **** #else /* polled UART */ 360:/mnt/hgfs/boot/booter/source/uart.c **** typedef volatile struct UART_t 361:/mnt/hgfs/boot/booter/source/uart.c **** { 362:/mnt/hgfs/boot/booter/source/uart.c **** uint32 rxdata; 363:/mnt/hgfs/boot/booter/source/uart.c **** uint32 txdata; 364:/mnt/hgfs/boot/booter/source/uart.c **** uint32 inten; 365:/mnt/hgfs/boot/booter/source/uart.c **** uint32 incause; 366:/mnt/hgfs/boot/booter/source/uart.c **** uint32 fifoctrl; 367:/mnt/hgfs/boot/booter/source/uart.c **** uint32 linectrl; 368:/mnt/hgfs/boot/booter/source/uart.c **** uint32 mdmctrl; 369:/mnt/hgfs/boot/booter/source/uart.c **** uint32 linestat; 370:/mnt/hgfs/boot/booter/source/uart.c **** uint32 mdmstat; 371:/mnt/hgfs/boot/booter/source/uart.c **** uint32 autoflow; 372:/mnt/hgfs/boot/booter/source/uart.c **** uint32 clkdiv; 373:/mnt/hgfs/boot/booter/source/uart.c **** char buffer[212]; 374:/mnt/hgfs/boot/booter/source/uart.c **** uint32 enable; 375:/mnt/hgfs/boot/booter/source/uart.c **** } UART_t; 376:/mnt/hgfs/boot/booter/source/uart.c **** GAS LISTING /tmp/cc4XVykA.s page 8 377:/mnt/hgfs/boot/booter/source/uart.c **** #define AU1000_UART UART_t 378:/mnt/hgfs/boot/booter/source/uart.c **** /********************************************************************/ 379:/mnt/hgfs/boot/booter/source/uart.c **** void 380:/mnt/hgfs/boot/booter/source/uart.c **** uartInit (int uartNumber, int baud) 381:/mnt/hgfs/boot/booter/source/uart.c **** { 20 .loc 1 381 0 21 .frame $sp,40,$31 # vars= 0, regs= 5/0, args= 16, gp= 0 22 .mask 0x800f0000,-8 23 .fmask 0x00000000,0 24 .set noreorder 25 .set nomacro 26 27 0000 D8FFBD27 addiu $sp,$sp,-40 28 $LCFI0: 29 0004 1C00B3AF sw $19,28($sp) 30 $LCFI1: 31 0008 1000B0AF sw $16,16($sp) 32 $LCFI2: 33 000c 2198A000 move $19,$5 34 0010 21808000 move $16,$4 382:/mnt/hgfs/boot/booter/source/uart.c **** AU1000_UART *uart; 383:/mnt/hgfs/boot/booter/source/uart.c **** uint32 clkdiv; 384:/mnt/hgfs/boot/booter/source/uart.c **** 385:/mnt/hgfs/boot/booter/source/uart.c **** /* get the system parameter area */ 386:/mnt/hgfs/boot/booter/source/uart.c **** sys = (AU1X00_SYS *) 35 .loc 1 386 0 36 0014 14010624 li $6,276 # 0x114 37 0018 9011043C li $4,294649856 # 0x11900000 38 001c 21280000 move $5,$0 39 0020 21380000 move $7,$0 40 .loc 1 381 0 41 0024 1800B2AF sw $18,24($sp) 42 $LCFI3: 43 0028 1400B1AF sw $17,20($sp) 44 $LCFI4: 45 002c 2000BFAF sw $31,32($sp) 46 $LCFI5: 47 .loc 1 386 0 48 0030 0000000C jal mapPhysicalAddress 49 0034 0000123C lui $18,%hi(sys) 50 51 0038 21204000 move $4,$2 387:/mnt/hgfs/boot/booter/source/uart.c **** mapPhysicalAddress(SYS_PHYS_ADDR, sizeof(AU1X00_SYS), 0); 388:/mnt/hgfs/boot/booter/source/uart.c **** 389:/mnt/hgfs/boot/booter/source/uart.c **** switch (uartNumber) 390:/mnt/hgfs/boot/booter/source/uart.c **** { 391:/mnt/hgfs/boot/booter/source/uart.c **** #ifdef UART0_PHYS_ADDR 392:/mnt/hgfs/boot/booter/source/uart.c **** case 0: 393:/mnt/hgfs/boot/booter/source/uart.c **** uart = (AU1000_UART *)KSEG1(UART0_PHYS_ADDR); 52 .loc 1 393 0 53 003c 10B1113C li $17,-1324351488 # 0xffffffffb1100000 54 .loc 1 386 0 55 .loc 1 389 0 56 0040 0E000012 beq $16,$0,$L3 57 0044 000042AE sw $2,%lo(sys)($18) 58 59 0048 01000224 li $2,1 # 0x1GAS LISTING /tmp/cc4XVykA.s page 9 394:/mnt/hgfs/boot/booter/source/uart.c **** #if defined(AU1200) 395:/mnt/hgfs/boot/booter/source/uart.c **** sys->pinfunc &= ~SYS_PINFUNC_U0T; 396:/mnt/hgfs/boot/booter/source/uart.c **** sys->pinfunc |= SYS_PINFUNC_U0R; 397:/mnt/hgfs/boot/booter/source/uart.c **** #endif 398:/mnt/hgfs/boot/booter/source/uart.c **** break; 399:/mnt/hgfs/boot/booter/source/uart.c **** #endif 400:/mnt/hgfs/boot/booter/source/uart.c **** #ifdef UART1_PHYS_ADDR 401:/mnt/hgfs/boot/booter/source/uart.c **** case 1: 402:/mnt/hgfs/boot/booter/source/uart.c **** uart = (AU1000_UART *)KSEG1(UART1_PHYS_ADDR); 403:/mnt/hgfs/boot/booter/source/uart.c **** #if defined(AU1200) 404:/mnt/hgfs/boot/booter/source/uart.c **** sys->pinfunc &= ~SYS_PINFUNC_U1T; 405:/mnt/hgfs/boot/booter/source/uart.c **** sys->pinfunc |= SYS_PINFUNC_U1R; 406:/mnt/hgfs/boot/booter/source/uart.c **** #endif 407:/mnt/hgfs/boot/booter/source/uart.c **** break; 408:/mnt/hgfs/boot/booter/source/uart.c **** #endif 409:/mnt/hgfs/boot/booter/source/uart.c **** #ifdef UART2_PHYS_ADDR 410:/mnt/hgfs/boot/booter/source/uart.c **** case 2: uart = (AU1000_UART *)KSEG1(UART2_PHYS_ADDR); break; 411:/mnt/hgfs/boot/booter/source/uart.c **** #endif 412:/mnt/hgfs/boot/booter/source/uart.c **** #ifdef UART3_PHYS_ADDR 413:/mnt/hgfs/boot/booter/source/uart.c **** case 3: 414:/mnt/hgfs/boot/booter/source/uart.c **** uart = (AU1000_UART *)KSEG1(UART3_PHYS_ADDR); 415:/mnt/hgfs/boot/booter/source/uart.c **** sys->pinfunc &= ~SYS_PINFUNC_U3; 416:/mnt/hgfs/boot/booter/source/uart.c **** break; 417:/mnt/hgfs/boot/booter/source/uart.c **** #endif 418:/mnt/hgfs/boot/booter/source/uart.c **** default: 419:/mnt/hgfs/boot/booter/source/uart.c **** return; 420:/mnt/hgfs/boot/booter/source/uart.c **** } 421:/mnt/hgfs/boot/booter/source/uart.c **** 422:/mnt/hgfs/boot/booter/source/uart.c **** uart->enable = UART_ENABLE_CE; 423:/mnt/hgfs/boot/booter/source/uart.c **** msdelay(100); 424:/mnt/hgfs/boot/booter/source/uart.c **** 425:/mnt/hgfs/boot/booter/source/uart.c **** uart->enable = UART_ENABLE_CE | UART_ENABLE_E; 426:/mnt/hgfs/boot/booter/source/uart.c **** msdelay(100); 427:/mnt/hgfs/boot/booter/source/uart.c **** 428:/mnt/hgfs/boot/booter/source/uart.c **** uart->inten = 0; 429:/mnt/hgfs/boot/booter/source/uart.c **** 430:/mnt/hgfs/boot/booter/source/uart.c **** uart->fifoctrl = UART_FIFOCTRL_TR | UART_FIFOCTRL_RR; 431:/mnt/hgfs/boot/booter/source/uart.c **** 432:/mnt/hgfs/boot/booter/source/uart.c **** /* 8N1 */ 433:/mnt/hgfs/boot/booter/source/uart.c **** uart->linectrl = UART_LINECTRL_WLS_8; 434:/mnt/hgfs/boot/booter/source/uart.c **** 435:/mnt/hgfs/boot/booter/source/uart.c **** clkdiv = (12000000 * (0x3F & sys->cpupll)) / (baud * ((sys->powerctrl & 0x03) + 2) * 2 * 16); 436:/mnt/hgfs/boot/booter/source/uart.c **** uart->clkdiv = clkdiv; 437:/mnt/hgfs/boot/booter/source/uart.c **** msdelay(100); 438:/mnt/hgfs/boot/booter/source/uart.c **** 439:/mnt/hgfs/boot/booter/source/uart.c **** *((int*)0xAF000000) = *((int*)0xB1100100); 440:/mnt/hgfs/boot/booter/source/uart.c **** } 60 .loc 1 440 0 61 .loc 1 389 0 62 004c 39000216 bne $16,$2,$L8 63 0050 2000BF8F lw $31,32($sp) 64 65 .loc 1 404 0 66 0054 2C00828C lw $2,44($4) 67 0058 FFEF0324 li $3,-4097 # 0xffffffffffffefff 68 .loc 1 402 0 69 005c 20B1113C li $17,-1323302912 # 0xffffffffb1200000GAS LISTING /tmp/cc4XVykA.s page 10 70 .loc 1 404 0 71 0060 24104300 and $2,$2,$3 72 0064 2C0082AC sw $2,44($4) 73 .loc 1 405 0 74 0068 2C00838C lw $3,44($4) 75 006c 00086334 ori $3,$3,0x800 76 0070 2C0083AC sw $3,44($4) 77 .loc 1 422 0 78 0074 27000008 j $L7 79 0078 01000224 li $2,1 # 0x1 80 81 $L3: 82 .loc 1 395 0 83 007c 2C00438C lw $3,44($2) 84 0080 F7FF0224 li $2,-9 # 0xfffffffffffffff7 85 0084 24186200 and $3,$3,$2 86 0088 2C0083AC sw $3,44($4) 87 .loc 1 396 0 88 008c 2C00828C lw $2,44($4) 89 0090 00014234 ori $2,$2,0x100 90 0094 2C0082AC sw $2,44($4) 91 .loc 1 422 0 92 0098 01000224 li $2,1 # 0x1 93 $L7: 94 009c 000122AE sw $2,256($17) 95 .loc 1 423 0 96 00a0 64000424 li $4,100 # 0x64 97 .loc 1 425 0 98 .loc 1 423 0 99 00a4 0000000C jal msdelay 100 00a8 03001024 li $16,3 # 0x3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -