📄 consol.lst
字号:
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 1 1 .file "consol.c" 2 .section .debug_abbrev,"",%progbits 3 .Ldebug_abbrev0: 4 .section .debug_info,"",%progbits 5 .Ldebug_info0: 6 .section .debug_line,"",%progbits 7 .Ldebug_line0: 8 0000 23010000 .text 8 02006E00 8 00000201 8 FB0E0A00 8 01010101 9 .Ltext0: 10 .global __umodsi3 11 .global __udivsi3 12 .section .rodata.str1.4,"aMS",%progbits,1 13 .align 2 14 .LC0: 15 0000 30313233 .ascii "0123456789abcdef\000" 15 34353637 15 38396162 15 63646566 15 00 16 0011 000000 .text 17 .align 2 18 .type printNum, %function 19 printNum: 20 .LFB2: 21 .file 1 "consol.c" 1:consol.c **** /******************************************************************************
2:consol.c **** *
3:consol.c **** * Copyright:
4:consol.c **** * (C) 2000 - 2005 Embedded Artists AB
5:consol.c **** *
6:consol.c **** * Description:
7:consol.c **** * Framework specific implementation of consol
8:consol.c **** *
9:consol.c **** *****************************************************************************/
10:consol.c ****
11:consol.c ****
12:consol.c **** /******************************************************************************
13:consol.c **** * Includes
14:consol.c **** *****************************************************************************/
15:consol.c ****
16:consol.c **** #include "lpc2xxx.h" /* LPC2xxx definitions */
17:consol.c **** #include <string.h>
18:consol.c **** #include <stdlib.h>
19:consol.c **** #include "config.h"
20:consol.c **** #include "consol.h"
21:consol.c **** #include "framework.h"
22:consol.c ****
23:consol.c **** #if (CONSOLE_API_PRINTF == 1) || (CONSOLE_API_SCANF == 1) //own simple printf() or scanf()
24:consol.c **** #include <stdarg.h>
25:consol.c **** #endif
26:consol.c ****
27:consol.c **** #define UART_DLL_VALUE (unsigned short)((PCLK / (CONSOL_BITRATE * 16.0)) + 0.5)
28:consol.c ****
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 2 29:consol.c **** #if (CONSOLE_API_SCANF == 1) //SIMPLE
30:consol.c **** #define __isalpha(c) (c >'9')
31:consol.c **** #define __isupper(c) !(c & 0x20)
32:consol.c **** #define __ishex(c) (((c >= '0')&&(c <= '9'))||((c >= 'A')&&(c <= 'F')))
33:consol.c **** #define __ascii2hex(c) ((c <= '9')? c-'0': c-'A'+10)
34:consol.c **** #endif
35:consol.c ****
36:consol.c **** /******************************************************************************
37:consol.c **** * Implementation of local functions
38:consol.c **** *****************************************************************************/
39:consol.c ****
40:consol.c **** #if (CONSOLE_API_PRINTF == 1) //OWN_PRINTF
41:consol.c **** /*****************************************************************************
42:consol.c **** *
43:consol.c **** * Description:
44:consol.c **** * Print a number.
45:consol.c **** *
46:consol.c **** * Params:
47:consol.c **** * [in] outputFnk - Output function where characters to be printed are
48:consol.c **** * sent
49:consol.c **** *
50:consol.c **** * Params (callback):
51:consol.c **** * ch - Character to be printed
52:consol.c **** * [in] number - Number to be printed
53:consol.c **** * [in] base - Base when printing number (2-16)
54:consol.c **** *
55:consol.c **** ****************************************************************************/
56:consol.c **** static void
57:consol.c **** printNum(void (*outputFnk) (char ch),
58:consol.c **** unsigned int number,
59:consol.c **** unsigned int base)
60:consol.c **** {
22 .loc 1 60 0 23 @ Function supports interworking. 24 @ args = 0, pretend = 0, frame = 52 25 @ frame_needed = 0, uses_anonymous_args = 0 26 .LVL0: 27 0000 F0402DE9 stmfd sp!, {r4, r5, r6, r7, lr} 28 .LCFI0: 29 0004 34D04DE2 sub sp, sp, #52 30 .LCFI1: 31 .LVL1: 32 .loc 1 60 0 33 0008 0070A0E1 mov r7, r0 34 000c 0140A0E1 mov r4, r1 35 0010 0260A0E1 mov r6, r2 61:consol.c **** char *p;
62:consol.c **** char buf[33];
63:consol.c **** char hexChars[] = "0123456789abcdef";
36 .loc 1 63 0 37 0014 23008DE2 add r0, sp, #35 38 .LVL2: 39 0018 60109FE5 ldr r1, .L11 40 .LVL3: 41 001c 1120A0E3 mov r2, #17 42 .LVL4: 43 0020 FEFFFFEB bl memcpyARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 3 44 0024 02508DE2 add r5, sp, #2 45 .LVL5: 46 .L2: 64:consol.c ****
65:consol.c **** p = buf;
66:consol.c ****
67:consol.c **** do {
68:consol.c **** *p++ = hexChars[number % base];
47 .loc 1 68 0 48 0028 0400A0E1 mov r0, r4 49 002c 0610A0E1 mov r1, r6 50 0030 FEFFFFEB bl __umodsi3 51 0034 34308DE2 add r3, sp, #52 52 0038 000083E0 add r0, r3, r0 53 003c 113050E5 ldrb r3, [r0, #-17] @ zero_extendqisi2 69:consol.c **** } while (number /= base);
54 .loc 1 69 0 55 0040 0610A0E1 mov r1, r6 56 0044 0400A0E1 mov r0, r4 57 .loc 1 68 0 58 0048 0130C5E4 strb r3, [r5], #1 59 .loc 1 69 0 60 004c FEFFFFEB bl __udivsi3 61 0050 004050E2 subs r4, r0, #0 62 0054 0800001A bne .L2 63 0058 0540A0E1 mov r4, r5 64 .LVL6: 65 .L4: 70:consol.c ****
71:consol.c **** do {
72:consol.c **** outputFnk(*--p);
66 .loc 1 72 0 67 005c 010074E5 ldrb r0, [r4, #-1]! @ zero_extendqisi2 68 0060 0FE0A0E1 mov lr, pc 69 0064 17FF2FE1 bx r7 73:consol.c **** } while (p > buf);
70 .loc 1 73 0 71 0068 02308DE2 add r3, sp, #2 72 006c 030054E1 cmp r4, r3 73 0070 1500008A bhi .L4 74:consol.c **** }
74 .loc 1 74 0 75 0074 34D08DE2 add sp, sp, #52 76 0078 F040BDE8 ldmfd sp!, {r4, r5, r6, r7, lr} 77 007c 1EFF2FE1 bx lr 78 .L12: 79 .align 2 80 .L11: 81 0080 00000000 .word .LC0 82 .LFE2: 83 .size printNum, .-printNum 84 .align 2 85 .type simplePrint, %function 86 simplePrint: 87 .LFB3: 75:consol.c ****
76:consol.c **** /*****************************************************************************
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 4 77:consol.c **** *
78:consol.c **** * Description:
79:consol.c **** * A simple implementation of printf that uses a minimum of stack space.
80:consol.c **** *
81:consol.c **** * Params:
82:consol.c **** * [in] outputFnk - Output function where characters to be printed are
83:consol.c **** * sent
84:consol.c **** *
85:consol.c **** * Params (callback):
86:consol.c **** * ch - Character to be printed
87:consol.c **** * [in] fmt - Format string that specifies what to be printed
88:consol.c **** * [in] ap - Structure that hold information about the variable
89:consol.c **** * number of parameters
90:consol.c **** *
91:consol.c **** ****************************************************************************/
92:consol.c **** static void
93:consol.c **** simplePrint(void (*outputFnk) (char ch),
94:consol.c **** const char * fmt,
95:consol.c **** va_list ap)
96:consol.c **** {
88 .loc 1 96 0 89 @ Function supports interworking. 90 @ args = 0, pretend = 0, frame = 0 91 @ frame_needed = 0, uses_anonymous_args = 0 92 .LVL7: 93 0084 F0402DE9 stmfd sp!, {r4, r5, r6, r7, lr} 94 .LCFI2: 95 .loc 1 96 0 96 0088 0060A0E1 mov r6, r0 97 008c 0170A0E1 mov r7, r1 98 0090 0250A0E1 mov r5, r2 99 0094 280000EA b .L57 100 .LVL8: 101 .L17: 97:consol.c **** char *p;
98:consol.c **** char ch;
99:consol.c **** unsigned long ul;
100:consol.c **** unsigned char lflag;
101:consol.c ****
102:consol.c **** for (;;)
103:consol.c **** {
104:consol.c **** while ((ch = *fmt++) != '%')
105:consol.c **** {
106:consol.c **** if (ch == '\0')
102 .loc 1 106 0 103 0098 000050E3 cmp r0, #0 104 009c 7D00000A beq .L43 105 .LVL9: 106 .L54: 107:consol.c **** return;
108:consol.c **** outputFnk(ch);
107 .loc 1 108 0 108 00a0 0FE0A0E1 mov lr, pc 109 00a4 16FF2FE1 bx r6 110 .LVL10: 111 .L57: 112 .loc 1 104 0ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 5 113 00a8 0100D7E4 ldrb r0, [r7], #1 @ zero_extendqisi2 114 .LVL11: 115 00ac 250050E3 cmp r0, #37 116 00b0 2400001A bne .L17 117 00b4 0030A0E3 mov r3, #0 118 .LVL12: 119 .L21: 109:consol.c **** }
110:consol.c **** lflag = 0;
111:consol.c ****
112:consol.c **** reswitch:
113:consol.c ****
114:consol.c **** switch (ch = *fmt++)
120 .loc 1 114 0 121 00b8 0140D7E4 ldrb r4, [r7], #1 @ zero_extendqisi2 122 .LVL13: 123 00bc 6F0054E3 cmp r4, #111 124 00c0 6200000A beq .L26 125 00c4 3B00008A bhi .L31 126 00c8 640054E3 cmp r4, #100 127 00cc 5500000A beq .L24 128 00d0 3800008A bhi .L32 129 00d4 000054E3 cmp r4, #0 130 00d8 7D00000A beq .L43 131 00dc 630054E3 cmp r4, #99 132 00e0 7700001A bne .L22 133 00e4 480000EA b .L23 134 .L32: 135 00e8 6C0054E3 cmp r4, #108 136 00ec 7700001A bne .L22 137 00f0 460000EA b .L25 138 .L31: 139 00f4 730054E3 cmp r4, #115 140 00f8 4D00000A beq .L28 141 00fc 4100008A bhi .L33 142 0100 700054E3 cmp r4, #112 143 0104 7700001A bne .L22 144 0108 6A0000EA b .L27 145 .L33: 146 010c 750054E3 cmp r4, #117 147 0110 6600000A beq .L29 148 0114 780054E3 cmp r4, #120 149 0118 7700001A bne .L22 150 011c 700000EA b .L30 151 .L25: 152 0120 0130A0E3 mov r3, #1 153 0124 2C0000EA b .L21 154 .L23: 155 .LVL14: 115:consol.c **** {
116:consol.c **** case '\0':
117:consol.c **** return;
118:consol.c ****
119:consol.c **** case 'l':
120:consol.c **** lflag = 1;
121:consol.c **** goto reswitch;
122:consol.c ****
ARM GAS /cygdrive/c/DOCUME~1/HOWARD~1/LOCALS~1/Temp/ccwlrNcM.s page 6 123:consol.c **** case 'c':
124:consol.c **** ch = va_arg(ap, unsigned int);
125:consol.c **** outputFnk(ch & 0x7f);
156 .loc 1 125 0 157 0128 000095E5 ldr r0, [r5, #0] 158 .LVL15: 159 012c 7F0000E2 and r0, r0, #127 160 0130 0FE0A0E1 mov lr, pc 161 0134 16FF2FE1 bx r6 162 .LVL16: 163 0138 740000EA b .L55 164 .LVL17: 165 .L28: 166 .LVL18: 126:consol.c **** break;
127:consol.c ****
128:consol.c **** case 's':
129:consol.c **** p = va_arg(ap, char *);
167 .loc 1 129 0 168 .LVL19: 169 013c 044095E4 ldr r4, [r5], #4 170 .LVL20: 171 0140 510000EA b .L34 172 .LVL21: 173 .L35: 130:consol.c **** while ((ch = *p++) != 0)
131:consol.c **** outputFnk(ch);
174 .loc 1 131 0 175 0144 0FE0A0E1 mov lr, pc 176 0148 16FF2FE1 bx r6 177 .LVL22: 178 .L34: 179 .loc 1 130 0 180 014c 0130D4E4 ldrb r3, [r4], #1 @ zero_extendqisi2 181 .LVL23: 182 0150 000053E2 subs r0, r3, #0 183 .LVL24: 184 0154 4F00001A bne .L35 185 .LVL25: 186 0158 280000EA b .L57 187 .LVL26: 188 .L24: 189 .LVL27: 132:consol.c **** break;
133:consol.c ****
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -