⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 printf_p.lst

📁 LPC2294开发板资源,包括源代码,BOOTLOAER,SCH,PCB和器件清单
💻 LST
📖 第 1 页 / 共 4 页
字号:
   1              		.file	"printf_P.c"
   9              	.Ltext0:
  10              		.align	2
  11              		.global	PAD_0
  13              	PAD_0:
  14              	.LFB5:
  15              		.file 1 "printf_P.c"
   1:printf_P.c    **** /* 
   2:printf_P.c    **** Copyright (C) 1993 Free Software Foundation
   3:printf_P.c    **** 
   4:printf_P.c    **** This file is part of the GNU IO Library.  This library is free
   5:printf_P.c    **** software; you can redistribute it and/or modify it under the
   6:printf_P.c    **** terms of the GNU General Public License as published by the
   7:printf_P.c    **** Free Software Foundation; either version 2, or (at your option)
   8:printf_P.c    **** any later version.
   9:printf_P.c    **** 
  10:printf_P.c    **** This library is distributed in the hope that it will be useful,
  11:printf_P.c    **** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12:printf_P.c    **** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13:printf_P.c    **** GNU General Public License for more details.
  14:printf_P.c    **** 
  15:printf_P.c    **** You should have received a copy of the GNU General Public License
  16:printf_P.c    **** along with this library; see the file COPYING.  If not, write to the Free
  17:printf_P.c    **** Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18:printf_P.c    **** 
  19:printf_P.c    **** As a special exception, if you link this library with files
  20:printf_P.c    **** compiled with a GNU compiler to produce an executable, this does not cause
  21:printf_P.c    **** the resulting executable to be covered by the GNU General Public License.
  22:printf_P.c    **** This exception does not however invalidate any other reasons why
  23:printf_P.c    **** the executable file might be covered by the GNU General Public License. */
  24:printf_P.c    **** 
  25:printf_P.c    **** /*
  26:printf_P.c    ****  * Copyright (c) 1990 Regents of the University of California.
  27:printf_P.c    ****  * All rights reserved.
  28:printf_P.c    ****  *
  29:printf_P.c    ****  * Redistribution and use in source and binary forms, with or without
  30:printf_P.c    ****  * modification, are permitted provided that the following conditions
  31:printf_P.c    ****  * are met:
  32:printf_P.c    ****  * 1. Redistributions of source code must retain the above copyright
  33:printf_P.c    ****  *    notice, this list of conditions and the following disclaimer.
  34:printf_P.c    ****  * 2. Redistributions in binary form must reproduce the above copyright
  35:printf_P.c    ****  *    notice, this list of conditions and the following disclaimer in the
  36:printf_P.c    ****  *    documentation and/or other materials provided with the distribution.
  37:printf_P.c    ****  * 3. [rescinded 22 July 1999]
  38:printf_P.c    ****  * 4. Neither the name of the University nor the names of its contributors
  39:printf_P.c    ****  *    may be used to endorse or promote products derived from this software
  40:printf_P.c    ****  *    without specific prior written permission.
  41:printf_P.c    ****  *
  42:printf_P.c    ****  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  43:printf_P.c    ****  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  44:printf_P.c    ****  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  45:printf_P.c    ****  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  46:printf_P.c    ****  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  47:printf_P.c    ****  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  48:printf_P.c    ****  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  49:printf_P.c    ****  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  50:printf_P.c    ****  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  51:printf_P.c    ****  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  52:printf_P.c    ****  * SUCH DAMAGE.
  53:printf_P.c    ****  */
  54:printf_P.c    **** 
  55:printf_P.c    **** /* * ****************************************************************************
  56:printf_P.c    ****  This file is a patched version of printf called _printf_P
  57:printf_P.c    ****  It is made to work with avr-gcc for Atmel AVR MCUs.
  58:printf_P.c    ****  There are some differences from standard printf:
  59:printf_P.c    ****  	1. There is no floating point support (with fp the code is about 8K!)
  60:printf_P.c    ****  	2. Return type is void
  61:printf_P.c    ****  	3. Format string must be in program memory (by using macro printf this is
  62:printf_P.c    ****  	   done automaticaly)
  63:printf_P.c    ****  	4. %n is not implemented (just remove the comment around it if you need it)
  64:printf_P.c    ****  	5. If LIGHTPRINTF is defined, the code is about 550 bytes smaller and the
  65:printf_P.c    ****  	   folowing specifiers are disabled :
  66:printf_P.c    ****  		space # * . - + p s o O
  67:printf_P.c    **** 	6. A function void uart_sendchar(char c) is used for output. The UART must
  68:printf_P.c    **** 		be initialized before using printf.
  69:printf_P.c    **** 
  70:printf_P.c    ****  Alexander Popov
  71:printf_P.c    ****  sasho@vip.orbitel.bg
  72:printf_P.c    **** ******************************************************************************
  73:printf_P.c    ****  Changed file to work with LPC - ARM.
  74:printf_P.c    ****  Ingo Busker 
  75:printf_P.c    ****  busker@mikrocontroller.com   02.2005
  76:printf_P.c    **** ******************************************************************************/ 
  77:printf_P.c    ****  
  78:printf_P.c    **** 
  79:printf_P.c    **** /*
  80:printf_P.c    ****  * Actual printf innards.
  81:printf_P.c    ****  *
  82:printf_P.c    ****  * This code is large and complicated...
  83:printf_P.c    ****  */
  84:printf_P.c    **** 
  85:printf_P.c    **** #include <string.h>
  86:printf_P.c    **** #ifdef __STDC__
  87:printf_P.c    **** #include <stdarg.h>
  88:printf_P.c    **** #else
  89:printf_P.c    **** #include <varargs.h>
  90:printf_P.c    **** #endif
  91:printf_P.c    **** 
  92:printf_P.c    **** #include "uart.h"
  93:printf_P.c    **** 
  94:printf_P.c    **** 
  95:printf_P.c    **** //#define LIGHTPRINTF
  96:printf_P.c    **** 
  97:printf_P.c    **** void PRINT(const char * ptr, unsigned int len) {
  98:printf_P.c    **** 	for(;len;len--) 
  99:printf_P.c    **** 		uart0Putch(*ptr++);
 100:printf_P.c    **** }
 101:printf_P.c    ****   
 102:printf_P.c    **** void PRINTP(const char * ptr, unsigned int len) {
 103:printf_P.c    **** 	for(;len;len--) 
 104:printf_P.c    **** 		uart_sendchar(*ptr++);
 105:printf_P.c    **** }
 106:printf_P.c    **** 
 107:printf_P.c    **** void PAD_SP(signed char howmany) {
 108:printf_P.c    **** 	for(;howmany>0;howmany--)
 109:printf_P.c    **** 		uart_sendchar(' ');
 110:printf_P.c    **** }
 111:printf_P.c    **** 
 112:printf_P.c    **** void PAD_0(signed char howmany) {
  16              	@ args = 0, pretend = 0, frame = 0
  17              		@ frame_needed = 0, uses_anonymous_args = 0
  18              	.LVL0:
  19              		stmfd	sp!, {r4, lr}
  20 0000 10402DE9 	.LCFI0:
  21              		and	r4, r0, #255
  22 0004 FF4000E2 		.loc 1 113 0
 113:printf_P.c    **** 	for(;howmany>0;howmany--)
  23              	, r4, asl #24
  24 0008 043CA0E1 		cmp	r3, #0
  25 000c 000053E3 		ldmlefd	sp!, {r4, pc}
  26 0010 1080BDD8 	.LVL1:
  27              	.L5:
  28              		.loc 1 114 0
 114:printf_P.c    **** 		uart_sendchar('0');
  29              	0, #48
  30 0014 3000A0E3 		bl	uart_sendchar
  31 0018 FEFFFFEB 		.loc 1 113 0
  32              		sub	r3, r4, #1
  33 001c 013044E2 		ands	r4, r3, #255
  34 0020 FF4013E2 		bne	.L5
  35 0024 FAFFFF1A 		ldmfd	sp!, {r4, pc}
  36 0028 1080BDE8 	.LFE5:
  38              		.align	2
  39              		.global	PAD_SP
  41              	PAD_SP:
  42              	.LFB4:
  43              		.loc 1 107 0
  44              		@ args = 0, pretend = 0, frame = 0
  45              		@ frame_needed = 0, uses_anonymous_args = 0
  46              	.LVL2:
  47              		stmfd	sp!, {r4, lr}
  48 002c 10402DE9 	.LCFI1:
  49              		and	r4, r0, #255
  50 0030 FF4000E2 		.loc 1 108 0
  51              		mov	r3, r4, asl #24
  52 0034 043CA0E1 		cmp	r3, #0
  53 0038 000053E3 		ldmlefd	sp!, {r4, pc}
  54 003c 1080BDD8 	.LVL3:
  55              	.L11:
  56              		.loc 1 109 0
  57              		mov	r0, #32
  58 0040 2000A0E3 		bl	uart_sendchar
  59 0044 FEFFFFEB 		.loc 1 108 0
  60              		sub	r3, r4, #1
  61 0048 013044E2 		ands	r4, r3, #255
  62 004c FF4013E2 		bne	.L11
  63 0050 FAFFFF1A 		ldmfd	sp!, {r4, pc}
  64 0054 1080BDE8 	.LFE4:
  66              		.align	2
  67              		.global	PRINTP
  69              	PRINTP:
  70              	.LFB3:
  71              		.loc 1 102 0
  72              		@ args = 0, pretend = 0, frame = 0
  73              		@ frame_needed = 0, uses_anonymous_args = 0
  74              	.LVL4:
  75              		stmfd	sp!, {r4, r5, lr}
  76 0058 30402DE9 	.LCFI2:
  77              		mov	r5, r0
  78 005c 0050A0E1 		.loc 1 103 0
  79              		subs	r4, r1, #0
  80 0060 004051E2 		ldmeqfd	sp!, {r4, r5, pc}
  81 0064 3080BD08 	.LVL5:
  82              	.L17:
  83              		.loc 1 104 0
  84              		ldrb	r0, [r5], #1	@ zero_extendqisi2
  85 0068 0100D5E4 		bl	uart_sendchar
  86 006c FEFFFFEB 		.loc 1 103 0
  87              		subs	r4, r4, #1
  88 0070 014054E2 		bne	.L17
  89 0074 FBFFFF1A 		ldmfd	sp!, {r4, r5, pc}
  90 0078 3080BDE8 	.LFE3:
  92              		.align	2
  93              		.global	PRINT
  95              	PRINT:
  96              	.LFB2:
  97              		.loc 1 97 0
  98              		@ args = 0, pretend = 0, frame = 0
  99              		@ frame_needed = 0, uses_anonymous_args = 0
 100              	.LVL6:
 101              		stmfd	sp!, {r4, r5, lr}
 102 007c 30402DE9 	.LCFI3:
 103              		mov	r5, r0
 104 0080 0050A0E1 		.loc 1 98 0
 105              		subs	r4, r1, #0
 106 0084 004051E2 		ldmeqfd	sp!, {r4, r5, pc}
 107 0088 3080BD08 	.LVL7:
 108              	.L23:
 109              		.loc 1 99 0
 110              		ldrb	r0, [r5], #1	@ zero_extendqisi2
 111 008c 0100D5E4 		bl	uart0Putch
 112 0090 FEFFFFEB 		.loc 1 98 0
 113              		subs	r4, r4, #1
 114 0094 014054E2 		bne	.L23
 115 0098 FBFFFF1A 		ldmfd	sp!, {r4, r5, pc}
 116 009c 3080BDE8 	.LFE2:
 118              		.global	__umodsi3
 119              		.global	__udivsi3
 120              		.align	2
 121              		.global	_printf_P
 123              	_printf_P:
 124              	.LFB6:
 125              		.loc 1 138 0
 115:printf_P.c    **** }
 116:printf_P.c    **** 
 117:printf_P.c    **** #define	BUF		40
 118:printf_P.c    **** 
 119:printf_P.c    **** /*
 120:printf_P.c    ****  * Macros for converting digits to letters and vice versa
 121:printf_P.c    ****  */
 122:printf_P.c    **** #define	to_digit(c)	((c) - '0')
 123:printf_P.c    **** #define  is_digit(c)	((c)<='9' && (c)>='0')
 124:printf_P.c    **** #define	to_char(n)	((n) + '0')
 125:printf_P.c    **** 
 126:printf_P.c    **** /*
 127:printf_P.c    ****  * Flags used during conversion.
 128:printf_P.c    ****  */
 129:printf_P.c    **** #define	LONGINT		0x01		/* long integer */
 130:printf_P.c    **** #define	LONGDBL		0x02		/* long double; unimplemented */
 131:printf_P.c    **** #define	SHORTINT		0x04		/* short integer */
 132:printf_P.c    **** #define	ALT			0x08		/* alternate form */
 133:printf_P.c    **** #define	LADJUST		0x10		/* left adjustment */
 134:printf_P.c    **** #define	ZEROPAD		0x20		/* zero (as opposed to blank) pad */
 135:printf_P.c    **** #define	HEXPREFIX	0x40		/* add 0x or 0X prefix */
 136:printf_P.c    **** 
 137:printf_P.c    **** void _printf_P (char const *fmt0, ...)      /* Works with string from FLASH */
 138:printf_P.c    **** {
 126              	sp!, {r0, r1, r2, r3}
 127              	.LCFI4:
 128              		stmfd	sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
 129              	.LCFI5:
 130 00a0 0F002DE9 		sub	sp, sp, #68
 131              	.LCFI6:
 132 00a4 F04F2DE9 		.loc 1 164 0
 133              		add	r3, sp, #108
 134 00a8 44D04DE2 		str	r3, [sp, #64]
 135              	.LVL9:
 139:printf_P.c    ****  	va_list ap;
 140:printf_P.c    **** 	register const char *fmt; /* format string */
 141:printf_P.c    **** 	register char ch;	/* character from fmt */
 142:printf_P.c    **** 	register int n;		/* handy integer (short term usage) */
 143:printf_P.c    **** 	register char *cp;	/* handy char pointer (short term usage) */
 144:printf_P.c    **** 	const char *fmark;	/* for remembering a place in fmt */
 145:printf_P.c    **** 	register unsigned char flags;	/* flags as above */
 146:printf_P.c    **** 	signed char width;		/* width from format (%8d), or 0 */
 147:printf_P.c    **** 	signed char prec;		/* precision from format (%.3d), or -1 */
 148:printf_P.c    **** 	char sign;				/* sign prefix (' ', '+', '-', or \0) */
 149:printf_P.c    **** 	unsigned long _ulong=0;	/* integer arguments %[diouxX] */
 150:printf_P.c    **** #define OCT 8
 151:printf_P.c    **** #define DEC 10
 152:printf_P.c    **** #define HEX 16
 153:printf_P.c    **** 	unsigned char base;		/* base for [diouxX] conversion */
 154:printf_P.c    **** 	signed char dprec;		/* a copy of prec if [diouxX], 0 otherwise */
 155:printf_P.c    **** 	signed char dpad;			/* extra 0 padding needed for integers */
 156:printf_P.c    **** 	signed char fieldsz;		/* field size expanded by sign, dpad etc */
 157:printf_P.c    **** 	/* The initialization of 'size' is to suppress a warning that
 158:printf_P.c    **** 	   'size' might be used unitialized.  It seems gcc can't
 159:printf_P.c    **** 	   quite grok this spaghetti code ... */
 160:printf_P.c    **** 	signed char size = 0;		/* size of converted field or string */
 161:printf_P.c    **** 	char buf[BUF];		/* space for %c, %[diouxX], %[eEfgG] */
 162:printf_P.c    **** 	char ox[2];			/* space for 0x hex-prefix */
 163:printf_P.c    **** 
 164:printf_P.c    **** 	va_start(ap, fmt0);
 136              	sp, #104]
 137 00ac 6C308DE2 	.LVL10:
 138 00b0 40308DE5 		mov	r8, #0
 139              	.LVL11:
 140 00b4 68509DE5 	.LVL12:
 141              	.L169:
 142 00b8 0080A0E3 		.loc 1 172 0
 143              		ldrb	r4, [r5, #0]	@ zero_extendqisi2
 144              	.LVL13:
 145              		cmp	r4, #0
 165:printf_P.c    **** 	
 166:printf_P.c    **** 	fmt = fmt0;
 167:printf_P.c    **** 
 168:printf_P.c    **** 	/*
 169:printf_P.c    **** 	 * Scan the format for conversions (`%' character).
 170:printf_P.c    **** 	 */
 171:printf_P.c    **** 	for (;;) {
 172:printf_P.c    **** 		for (fmark = fmt; (ch = (*fmt)) != '\0' && ch != '%'; fmt++)
 146              		cmp	r4, #37
 147 00bc 0040D5E5 		beq	.L27
 148              		mov	r6, r5
 149 00c0 000054E3 	.LVL14:
 150 00c4 0800000A 	.L30:
 151 00c8 250054E3 		ldrb	r4, [r6, #1]!	@ zero_extendqisi2
 152 00cc 0600000A 		cmp	r4, #0
 153 00d0 0560A0E1 		beq	.L31
 154              		cmp	r4, #37
 155              		beq	.L31
 156 00d4 0140F6E5 		b	.L30
 157 00d8 000054E3 	.LVL15:
 158 00dc 0300000A 	.L27:
 159 00e0 250054E3 		mov	r6, r5
 160 00e4 0100000A 	.LVL16:
 161 00e8 F9FFFFEA 	.L31:
 162              		.loc 1 174 0
 163              		subs	r1, r6, r5
 164 00ec 0560A0E1 	.LVL17:
 165              		.loc 1 175 0
 166              		movne	r0, r5
 173:printf_P.c    **** 			/* void */;
 174:printf_P.c    **** 		if ((n = fmt - fmark) != 0) {
 167              	.L33:
 168 00f0 051056E0 		.loc 1 177 0
 169              		cmp	r4, #0
 175:printf_P.c    **** 			PRINTP(fmark, n);
 170              	q	.L151
 171 00f4 0500A011 		.loc 1 179 0
 172 00f8 FEFFFF1B 		add	r5, r6, #1
 173              		.loc 1 185 0
 174              		mov	r2, #0
 176:printf_P.c    **** 		}
 177:printf_P.c    **** 		if (ch == '\0')
 175              		r2, [sp, #63]
 176 00fc 000054E3 		mov	r9, #0
 177 0100 8C01000A 		mov	r6, r9

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -