www.pudn.com > LPC1768_SD_Test.rar > serial.txt, change:2010-06-05,size:7462b


; generated by ARM C/C++ Compiler with , RVCT4.0 [Build 524] for uVision 
; commandline ArmCC [--debug -c --asm --interleave -o.\Obj\serial.o --depend=.\Obj\serial.d --device=DARMP1 --apcs=interwork -O0 -IC:\Keil\ARM\INC\NXP --omf_browse=.\Obj\serial.crf Serial.c] 
                          THUMB 
 
                          AREA ||.text||, CODE, READONLY, ALIGN=2 
 
                  SER_init PROC 
;;;25      *----------------------------------------------------------------------------*/ 
;;;26     void SER_init (int uart) { 
000000  b958              CBNZ     r0,|L1.26| 
;;;27     //LPC_UART_TypeDef *pUart; 
;;;28         
;;;29       if (uart == 0) {                               /* UART0 */ 
;;;30         LPC_PINCON->PINSEL0 |= (1 << 4);             /* Pin P0.2 used as TXD0 (Com0) */ 
000002  4929              LDR      r1,|L1.168| 
000004  6809              LDR      r1,[r1,#0] 
000006  f0410110          ORR      r1,r1,#0x10 
00000a  4a27              LDR      r2,|L1.168| 
00000c  6011              STR      r1,[r2,#0] 
;;;31         LPC_PINCON->PINSEL0 |= (1 << 6);             /* Pin P0.3 used as RXD0 (Com0) */ 
00000e  4611              MOV      r1,r2 
000010  6809              LDR      r1,[r1,#0] 
000012  f0410140          ORR      r1,r1,#0x40 
000016  6011              STR      r1,[r2,#0] 
000018  e00a              B        |L1.48| 
                  |L1.26| 
;;;32      
;;;33        // pUart = (LPC_UART_TypeDef *)LPC_UART0; 
;;;34       } else {                                       /* UART1 */ 
;;;35         LPC_PINCON->PINSEL4 |= (2 << 0);             /* Pin P2.0 used as TXD1 (Com1) */ 
00001a  4923              LDR      r1,|L1.168| 
00001c  6909              LDR      r1,[r1,#0x10] 
00001e  f0410102          ORR      r1,r1,#2 
000022  4a21              LDR      r2,|L1.168| 
000024  6111              STR      r1,[r2,#0x10] 
;;;36         LPC_PINCON->PINSEL4 |= (2 << 2);             /* Pin P2.1 used as RXD1 (Com1) */ 
000026  4611              MOV      r1,r2 
000028  6909              LDR      r1,[r1,#0x10] 
00002a  f0410108          ORR      r1,r1,#8 
00002e  6111              STR      r1,[r2,#0x10] 
                  |L1.48| 
;;;37      
;;;38        // pUart = (LPC_UART_TypeDef *)LPC_UART1; 
;;;39       } 
;;;40      
;;;41       LPC_UART0->LCR    = 0x83;                          /* 8 bits, no Parity, 1 Stop bit  */ 
000030  2183              MOVS     r1,#0x83 
000032  4a1e              LDR      r2,|L1.172| 
000034  7311              STRB     r1,[r2,#0xc] 
;;;42       LPC_UART0->DLL    = 6;                             /* 115200 Baud Rate @ 18.0 MHZ PCLK */ 
000036  2106              MOVS     r1,#6 
000038  7011              STRB     r1,[r2,#0] 
;;;43       LPC_UART0->FDR    = 0x85;                          /* FR = 1,627 DIVADDVAL = 5, MULVAL = 8 */ 
00003a  2185              MOVS     r1,#0x85 
00003c  4a1b              LDR      r2,|L1.172| 
00003e  3228              ADDS     r2,r2,#0x28 
000040  7011              STRB     r1,[r2,#0] 
;;;44       LPC_UART0->DLM    = 0;                             /* High divisor latch = 0         */ 
000042  2100              MOVS     r1,#0 
000044  4a19              LDR      r2,|L1.172| 
000046  7111              STRB     r1,[r2,#4] 
;;;45       LPC_UART0->LCR    = 0x03;                          /* DLAB = 0                       */ 
000048  2103              MOVS     r1,#3 
00004a  7311              STRB     r1,[r2,#0xc] 
;;;46     } 
00004c  4770              BX       lr 
;;;47      
                          ENDP 
 
                  SER_putChar PROC 
;;;51      *----------------------------------------------------------------------------*/ 
;;;52     int SER_putChar (int uart, int c) { 
00004e  4602              MOV      r2,r0 
;;;53       //LPC_UART_TypeDef *pUart; 
;;;54      
;;;55       //pUart = (uart == 0) ? (LPC_UART_TypeDef *)LPC_UART0 : (LPC_UART_TypeDef *)LPC_UART1; 
;;;56       while (!(LPC_UART0->LSR & 0x20)); 
000050  bf00              NOP       
                  |L1.82| 
000052  4816              LDR      r0,|L1.172| 
000054  7d00              LDRB     r0,[r0,#0x14] 
000056  f0100f20          TST      r0,#0x20 
00005a  d0fa              BEQ      |L1.82| 
;;;57       return (LPC_UART0->THR = c); 
00005c  b2c8              UXTB     r0,r1 
00005e  4b13              LDR      r3,|L1.172| 
000060  7018              STRB     r0,[r3,#0] 
;;;58     } 
000062  4770              BX       lr 
;;;59      
                          ENDP 
 
                  SER_getChar PROC 
;;;63      *----------------------------------------------------------------------------*/ 
;;;64     int SER_getChar (int uart) { 
000064  4601              MOV      r1,r0 
;;;65      // LPC_UART_TypeDef *pUart; 
;;;66      
;;;67       //pUart = (uart == 0) ? (LPC_UART_TypeDef *)LPC_UART0 : (LPC_UART_TypeDef *)LPC_UART1; 
;;;68       while (!(LPC_UART0->LSR & 0x01)); 
000066  bf00              NOP       
                  |L1.104| 
000068  4810              LDR      r0,|L1.172| 
00006a  7d00              LDRB     r0,[r0,#0x14] 
00006c  f0100f01          TST      r0,#1 
000070  d0fa              BEQ      |L1.104| 
;;;69       return (LPC_UART0->RBR); 
000072  480e              LDR      r0,|L1.172| 
000074  7800              LDRB     r0,[r0,#0] 
;;;70     } 
000076  4770              BX       lr 
;;;71      
                          ENDP 
 
                  SER_getChar_nb PROC 
;;;75      *----------------------------------------------------------------------------*/ 
;;;76     int SER_getChar_nb (int uart) { 
000078  4601              MOV      r1,r0 
;;;77       //LPC_UART_TypeDef *pUart; 
;;;78      
;;;79      // pUart = (uart == 0) ? (LPC_UART_TypeDef *)LPC_UART0 : (LPC_UART_TypeDef *)LPC_UART1; 
;;;80       if (LPC_UART0->LSR & 0x01) 
00007a  480c              LDR      r0,|L1.172| 
00007c  7d00              LDRB     r0,[r0,#0x14] 
00007e  f0100f01          TST      r0,#1 
000082  d002              BEQ      |L1.138| 
;;;81         return (LPC_UART0->RBR); 
000084  4809              LDR      r0,|L1.172| 
000086  7800              LDRB     r0,[r0,#0] 
                  |L1.136| 
;;;82       else 
;;;83         return 0; 
;;;84     } 
000088  4770              BX       lr 
                  |L1.138| 
00008a  2000              MOVS     r0,#0                 ;83 
00008c  e7fc              B        |L1.136| 
;;;85      
                          ENDP 
 
                  SER_putString PROC 
;;;89      *----------------------------------------------------------------------------*/ 
;;;90     void SER_putString (int uart, unsigned char *s) { 
00008e  b530              PUSH     {r4,r5,lr} 
000090  4605              MOV      r5,r0 
000092  460c              MOV      r4,r1 
;;;91      
;;;92       while (*s != 0) { 
000094  e004              B        |L1.160| 
                  |L1.150| 
;;;93        SER_putChar(uart, *s++); 
000096  f8141b01          LDRB     r1,[r4],#1 
00009a  4628              MOV      r0,r5 
00009c  f7fffffe          BL       SER_putChar 
                  |L1.160| 
0000a0  7820              LDRB     r0,[r4,#0]            ;92 
0000a2  2800              CMP      r0,#0                 ;92 
0000a4  d1f7              BNE      |L1.150| 
;;;94       } 
;;;95     } 
0000a6  bd30              POP      {r4,r5,pc} 
                          ENDP 
 
                  |L1.168| 
                          DCD      0x4002c000 
                  |L1.172| 
                          DCD      0x4000c000