📄 serial.lst
字号:
ARM COMPILER V2.42, Serial 20/12/05 21:08:43 PAGE 1
ARM COMPILER V2.42, COMPILATION OF MODULE Serial
OBJECT MODULE PLACED IN Serial.OBJ
COMPILER INVOKED BY: d:\Keil\ARM\BIN\CA.exe Serial.c THUMB OPTIMIZE(7,SPEED) DEBUG PRINT(.\PHY\SERIAL.LST) TABS(4)
stmt level source
1 /******************************************************************************/
2 /* This file is part of the uVision/ARM development tools */
3 /* Copyright KEIL ELEKTRONIK GmbH 2002-2004 */
4 /******************************************************************************/
5 /* */
6 /* SERIAL.C: Low Level Serial Routines */
7 /* */
8 /******************************************************************************/
9
10 #include <LPC22xx.H> /* LPC21xx definitions */
11
12 #define CR 0x0D
13
14
15 void init_serial (void) { /* Initialize Serial Interface */
16 1 PINSEL0 = 0x00050000; /* Enable RxD1 and TxD1 */
17 1 U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
18 1 U1DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */
19 1 U1LCR = 0x03; /* DLAB = 0 */
20 1 }
21
22
23 int putchar (int ch) { /* Write character to Serial Port */
24 1
25 1 if (ch == '\n') {
26 2 while (!(U1LSR & 0x20));
27 2 U1THR = CR; /* output CR */
28 2 }
29 1 while (!(U1LSR & 0x20));
30 1 return (U1THR = ch);
31 1 }
32
33
34 int getchar (void) { /* Read character from Serial Port */
35 1
36 1 while (!(U1LSR & 0x01));
37 1
38 1 return (U1RBR);
39 1 }
ARM COMPILER V2.42, Serial 20/12/05 21:08:43 PAGE 2
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** PUBLICS:
PUBLIC init_serial?T
PUBLIC putchar?T
PUBLIC getchar?T
*** CODE SEGMENT '?PR?init_serial?T?Serial':
16: PINSEL0 = 0x00050000; /* Enable RxD1 and TxD1 */
00000000 4800 LDR R1,=0x50000
00000002 4800 LDR R0,=0xE002C000
00000004 6001 STR R1,[R0,#0x0]
17: U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
00000006 2183 MOV R1,#0x83
00000008 4800 LDR R0,=0xE001000C
0000000A 7001 STRB R1,[R0,#0x0]
18: U1DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */
0000000C 2161 MOV R1,#0x61
0000000E 4800 LDR R0,=0xE0010000
00000010 7001 STRB R1,[R0,#0x0]
19: U1LCR = 0x03; /* DLAB = 0 */
00000012 2103 MOV R1,#0x3
00000014 4800 LDR R0,=0xE001000C
00000016 7001 STRB R1,[R0,#0x0]
20: }
00000018 4770 BX R14
0000001A ENDP ; 'init_serial?T'
*** CODE SEGMENT '?PR?putchar?T?Serial':
23: int putchar (int ch) { /* Write character to Serial Port */
00000000 1C01 MOV R1,R0 ; ch
00000002 ---- Variable 'ch' assigned to Register 'R1' ----
25: if (ch == '\n') {
00000002 1C08 MOV R0,R1 ; ch
00000004 280A CMP R0,#0xA ; ch
00000006 D107 BNE L_9 ; T=0x00000018
26: while (!(U1LSR & 0x20));
00000008 L_2:
00000008 4800 LDR R0,=0xE0010014
0000000A 7800 LDRB R0,[R0,#0x0]
0000000C 2220 MOV R2,#0x20
0000000E 4210 TST R0,R2
00000010 D0FA BEQ L_2 ; T=0x00000008
27: U1THR = CR; /* output CR */
00000012 220D MOV R2,#0xD
00000014 4800 LDR R0,=0xE0010000
00000016 7002 STRB R2,[R0,#0x0]
29: while (!(U1LSR & 0x20));
00000018 L_9:
00000018 L_6:
00000018 4800 LDR R0,=0xE0010014
0000001A 7800 LDRB R0,[R0,#0x0]
0000001C 2220 MOV R2,#0x20
0000001E 4210 TST R0,R2
00000020 D0FA BEQ L_6 ; T=0x00000018
30: return (U1THR = ch);
00000022 1C08 MOV R0,R1 ; ch
00000024 0600 LSL R0,R0,#0x18 ; ch
00000026 0E00 LSR R0,R0,#0x18
00000028 4800 LDR R1,=0xE0010000
0000002A 7008 STRB R0,[R1,#0x0]
0000002C 0600 LSL R0,R0,#0x18
0000002E 0E00 LSR R0,R0,#0x18
31: }
00000030 4770 BX R14
00000032 ENDP ; 'putchar?T'
ARM COMPILER V2.42, Serial 20/12/05 21:08:43 PAGE 3
*** CODE SEGMENT '?PR?getchar?T?Serial':
36: while (!(U1LSR & 0x01));
00000000 L_11:
00000000 4800 LDR R0,=0xE0010014
00000002 7800 LDRB R0,[R0,#0x0]
00000004 2101 MOV R1,#0x1
00000006 4208 TST R0,R1
00000008 D0FA BEQ L_11 ; T=0x00000000
38: return (U1RBR);
0000000A 4800 LDR R0,=0xE0010000
0000000C 7800 LDRB R0,[R0,#0x0]
39: }
0000000E 4770 BX R14
00000010 ENDP ; 'getchar?T'
Module Information Static
----------------------------------
code size = ------
data size = ------
const size = ------
End of Module Information.
ARM COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -