1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-30 11:24:12 +01:00
Arduino/build/shared/lib/avrlib/buffer.lst
2005-08-25 21:06:28 +00:00

391 lines
16 KiB
Plaintext
Executable File

1 .file "buffer.c"
2 .arch atmega8
3 __SREG__ = 0x3f
4 __SP_H__ = 0x3e
5 __SP_L__ = 0x3d
6 __tmp_reg__ = 0
7 __zero_reg__ = 1
8 .global __do_copy_data
9 .global __do_clear_bss
12 .text
13 .Ltext0:
44 .global bufferInit
46 bufferInit:
1:../avrlib/buffer.c **** /*! \file buffer.c \brief Multipurpose byte buffer structure and methods. */
2:../avrlib/buffer.c **** //*****************************************************************************
3:../avrlib/buffer.c **** //
4:../avrlib/buffer.c **** // File Name : 'buffer.c'
5:../avrlib/buffer.c **** // Title : Multipurpose byte buffer structure and methods
6:../avrlib/buffer.c **** // Author : Pascal Stang - Copyright (C) 2001-2002
7:../avrlib/buffer.c **** // Created : 9/23/2001
8:../avrlib/buffer.c **** // Revised : 9/23/2001
9:../avrlib/buffer.c **** // Version : 1.0
10:../avrlib/buffer.c **** // Target MCU : any
11:../avrlib/buffer.c **** // Editor Tabs : 4
12:../avrlib/buffer.c **** //
13:../avrlib/buffer.c **** // This code is distributed under the GNU Public License
14:../avrlib/buffer.c **** // which can be found at http://www.gnu.org/licenses/gpl.txt
15:../avrlib/buffer.c **** //
16:../avrlib/buffer.c **** //*****************************************************************************
17:../avrlib/buffer.c ****
18:../avrlib/buffer.c **** #include "buffer.h"
19:../avrlib/buffer.c ****
20:../avrlib/buffer.c **** // global variables
21:../avrlib/buffer.c ****
22:../avrlib/buffer.c **** // initialization
23:../avrlib/buffer.c ****
24:../avrlib/buffer.c **** void bufferInit(cBuffer* buffer, unsigned char *start, unsigned short size)
25:../avrlib/buffer.c **** {
48 .LM1:
49 /* prologue: frame size=0 */
50 /* prologue end (size=0) */
51 0000 FC01 movw r30,r24
26:../avrlib/buffer.c **** // set start pointer of the buffer
27:../avrlib/buffer.c **** buffer->dataptr = start;
53 .LM2:
54 0002 6083 st Z,r22
55 0004 7183 std Z+1,r23
28:../avrlib/buffer.c **** buffer->size = size;
57 .LM3:
58 0006 4283 std Z+2,r20
59 0008 5383 std Z+3,r21
29:../avrlib/buffer.c **** // initialize index and length
30:../avrlib/buffer.c **** buffer->dataindex = 0;
61 .LM4:
62 000a 1682 std Z+6,__zero_reg__
63 000c 1782 std Z+7,__zero_reg__
31:../avrlib/buffer.c **** buffer->datalength = 0;
65 .LM5:
66 000e 1482 std Z+4,__zero_reg__
67 0010 1582 std Z+5,__zero_reg__
68 /* epilogue: frame size=0 */
69 0012 0895 ret
70 /* epilogue end (size=1) */
71 /* function bufferInit size 10 (9) */
73 .Lscope0:
77 .global bufferGetFromFront
79 bufferGetFromFront:
32:../avrlib/buffer.c **** }
33:../avrlib/buffer.c ****
34:../avrlib/buffer.c **** // access routines
35:../avrlib/buffer.c **** unsigned char bufferGetFromFront(cBuffer* buffer)
36:../avrlib/buffer.c **** {
81 .LM6:
82 /* prologue: frame size=0 */
83 0014 CF93 push r28
84 0016 DF93 push r29
85 /* prologue end (size=2) */
86 0018 EC01 movw r28,r24
37:../avrlib/buffer.c **** unsigned char data = 0;
88 .LM7:
89 001a E0E0 ldi r30,lo8(0)
38:../avrlib/buffer.c ****
39:../avrlib/buffer.c **** // check to see if there's data in the buffer
40:../avrlib/buffer.c **** if(buffer->datalength)
91 .LM8:
92 001c 2C81 ldd r18,Y+4
93 001e 3D81 ldd r19,Y+5
94 0020 2115 cp r18,__zero_reg__
95 0022 3105 cpc r19,__zero_reg__
96 0024 B1F0 breq .L3
41:../avrlib/buffer.c **** {
42:../avrlib/buffer.c **** // get the first character from buffer
43:../avrlib/buffer.c **** data = buffer->dataptr[buffer->dataindex];
98 .LM9:
99 0026 E881 ld r30,Y
100 0028 F981 ldd r31,Y+1
101 002a 8E81 ldd r24,Y+6
102 002c 9F81 ldd r25,Y+7
103 002e E80F add r30,r24
104 0030 F91F adc r31,r25
105 0032 E081 ld r30,Z
44:../avrlib/buffer.c **** // move index down and decrement length
45:../avrlib/buffer.c **** buffer->dataindex++;
107 .LM10:
108 0034 0196 adiw r24,1
109 0036 8E83 std Y+6,r24
110 0038 9F83 std Y+7,r25
46:../avrlib/buffer.c **** if(buffer->dataindex >= buffer->size)
112 .LM11:
113 003a 6A81 ldd r22,Y+2
114 003c 7B81 ldd r23,Y+3
115 003e 8617 cp r24,r22
116 0040 9707 cpc r25,r23
117 0042 18F0 brlo .L4
47:../avrlib/buffer.c **** {
48:../avrlib/buffer.c **** buffer->dataindex %= buffer->size;
119 .LM12:
120 0044 00D0 rcall __udivmodhi4
121 0046 8E83 std Y+6,r24
122 0048 9F83 std Y+7,r25
123 .L4:
49:../avrlib/buffer.c **** }
50:../avrlib/buffer.c **** buffer->datalength--;
125 .LM13:
126 004a 2150 subi r18,lo8(-(-1))
127 004c 3040 sbci r19,hi8(-(-1))
128 004e 2C83 std Y+4,r18
129 0050 3D83 std Y+5,r19
130 .L3:
51:../avrlib/buffer.c **** }
52:../avrlib/buffer.c **** // return
53:../avrlib/buffer.c **** return data;
54:../avrlib/buffer.c **** }
132 .LM14:
133 0052 8E2F mov r24,r30
134 0054 9927 clr r25
135 /* epilogue: frame size=0 */
136 0056 DF91 pop r29
137 0058 CF91 pop r28
138 005a 0895 ret
139 /* epilogue end (size=3) */
140 /* function bufferGetFromFront size 36 (31) */
145 .Lscope1:
150 .global bufferDumpFromFront
152 bufferDumpFromFront:
55:../avrlib/buffer.c ****
56:../avrlib/buffer.c **** void bufferDumpFromFront(cBuffer* buffer, unsigned short numbytes)
57:../avrlib/buffer.c **** {
154 .LM15:
155 /* prologue: frame size=0 */
156 005c CF93 push r28
157 005e DF93 push r29
158 /* prologue end (size=2) */
159 0060 FC01 movw r30,r24
160 0062 EB01 movw r28,r22
58:../avrlib/buffer.c **** // dump numbytes from the front of the buffer
59:../avrlib/buffer.c **** // are we dumping less than the entire buffer?
60:../avrlib/buffer.c **** if(numbytes < buffer->datalength)
162 .LM16:
163 0064 2481 ldd r18,Z+4
164 0066 3581 ldd r19,Z+5
165 0068 6217 cp r22,r18
166 006a 7307 cpc r23,r19
167 006c 98F4 brsh .L6
61:../avrlib/buffer.c **** {
62:../avrlib/buffer.c **** // move index down by numbytes and decrement length by numbytes
63:../avrlib/buffer.c **** buffer->dataindex += numbytes;
169 .LM17:
170 006e 8681 ldd r24,Z+6
171 0070 9781 ldd r25,Z+7
172 0072 860F add r24,r22
173 0074 971F adc r25,r23
174 0076 8683 std Z+6,r24
175 0078 9783 std Z+7,r25
64:../avrlib/buffer.c **** if(buffer->dataindex >= buffer->size)
177 .LM18:
178 007a 6281 ldd r22,Z+2
179 007c 7381 ldd r23,Z+3
180 007e 8617 cp r24,r22
181 0080 9707 cpc r25,r23
182 0082 18F0 brlo .L7
65:../avrlib/buffer.c **** {
66:../avrlib/buffer.c **** buffer->dataindex %= buffer->size;
184 .LM19:
185 0084 00D0 rcall __udivmodhi4
186 0086 8683 std Z+6,r24
187 0088 9783 std Z+7,r25
188 .L7:
67:../avrlib/buffer.c **** }
68:../avrlib/buffer.c **** buffer->datalength -= numbytes;
190 .LM20:
191 008a 2C1B sub r18,r28
192 008c 3D0B sbc r19,r29
193 008e 2483 std Z+4,r18
194 0090 3583 std Z+5,r19
195 0092 02C0 rjmp .L5
196 .L6:
69:../avrlib/buffer.c **** }
70:../avrlib/buffer.c **** else
71:../avrlib/buffer.c **** {
72:../avrlib/buffer.c **** // flush the whole buffer
73:../avrlib/buffer.c **** buffer->datalength = 0;
198 .LM21:
199 0094 1482 std Z+4,__zero_reg__
200 0096 1582 std Z+5,__zero_reg__
201 .L5:
202 /* epilogue: frame size=0 */
203 0098 DF91 pop r29
204 009a CF91 pop r28
205 009c 0895 ret
206 /* epilogue end (size=3) */
207 /* function bufferDumpFromFront size 33 (28) */
209 .Lscope2:
214 .global bufferGetAtIndex
216 bufferGetAtIndex:
74:../avrlib/buffer.c **** }
75:../avrlib/buffer.c **** }
76:../avrlib/buffer.c ****
77:../avrlib/buffer.c **** unsigned char bufferGetAtIndex(cBuffer* buffer, unsigned short index)
78:../avrlib/buffer.c **** {
218 .LM22:
219 /* prologue: frame size=0 */
220 /* prologue end (size=0) */
221 009e FC01 movw r30,r24
79:../avrlib/buffer.c **** // return character at index in buffer
80:../avrlib/buffer.c **** return buffer->dataptr[(buffer->dataindex+index)%(buffer->size)];
223 .LM23:
224 00a0 8681 ldd r24,Z+6
225 00a2 9781 ldd r25,Z+7
226 00a4 2281 ldd r18,Z+2
227 00a6 3381 ldd r19,Z+3
228 00a8 860F add r24,r22
229 00aa 971F adc r25,r23
230 00ac B901 movw r22,r18
231 00ae 00D0 rcall __udivmodhi4
232 00b0 0190 ld __tmp_reg__,Z+
233 00b2 F081 ld r31,Z
234 00b4 E02D mov r30,__tmp_reg__
235 00b6 E80F add r30,r24
236 00b8 F91F adc r31,r25
237 00ba 8081 ld r24,Z
81:../avrlib/buffer.c **** }
239 .LM24:
240 00bc 9927 clr r25
241 /* epilogue: frame size=0 */
242 00be 0895 ret
243 /* epilogue end (size=1) */
244 /* function bufferGetAtIndex size 17 (16) */
246 .Lscope3:
251 .global bufferAddToEnd
253 bufferAddToEnd:
82:../avrlib/buffer.c ****
83:../avrlib/buffer.c **** unsigned char bufferAddToEnd(cBuffer* buffer, unsigned char data)
84:../avrlib/buffer.c **** {
255 .LM25:
256 /* prologue: frame size=0 */
257 00c0 CF93 push r28
258 00c2 DF93 push r29
259 /* prologue end (size=2) */
260 00c4 EC01 movw r28,r24
261 00c6 462F mov r20,r22
85:../avrlib/buffer.c **** // make sure the buffer has room
86:../avrlib/buffer.c **** if(buffer->datalength < buffer->size)
263 .LM26:
264 00c8 2C81 ldd r18,Y+4
265 00ca 3D81 ldd r19,Y+5
266 00cc 6A81 ldd r22,Y+2
267 00ce 7B81 ldd r23,Y+3
268 00d0 2617 cp r18,r22
269 00d2 3707 cpc r19,r23
270 00d4 90F4 brsh .L11
87:../avrlib/buffer.c **** {
88:../avrlib/buffer.c **** // save data byte at end of buffer
89:../avrlib/buffer.c **** buffer->dataptr[(buffer->dataindex + buffer->datalength) % buffer->size] = data;
272 .LM27:
273 00d6 8E81 ldd r24,Y+6
274 00d8 9F81 ldd r25,Y+7
275 00da 820F add r24,r18
276 00dc 931F adc r25,r19
277 00de 00D0 rcall __udivmodhi4
278 00e0 E881 ld r30,Y
279 00e2 F981 ldd r31,Y+1
280 00e4 E80F add r30,r24
281 00e6 F91F adc r31,r25
282 00e8 4083 st Z,r20
90:../avrlib/buffer.c **** // increment the length
91:../avrlib/buffer.c **** buffer->datalength++;
284 .LM28:
285 00ea 8C81 ldd r24,Y+4
286 00ec 9D81 ldd r25,Y+5
287 00ee 0196 adiw r24,1
288 00f0 8C83 std Y+4,r24
289 00f2 9D83 std Y+5,r25
92:../avrlib/buffer.c **** // return success
93:../avrlib/buffer.c **** return -1;
291 .LM29:
292 00f4 8FEF ldi r24,lo8(255)
293 00f6 90E0 ldi r25,hi8(255)
294 00f8 02C0 rjmp .L10
295 .L11:
94:../avrlib/buffer.c **** }
95:../avrlib/buffer.c **** else return 0;
297 .LM30:
298 00fa 80E0 ldi r24,lo8(0)
299 00fc 90E0 ldi r25,hi8(0)
300 .L10:
301 /* epilogue: frame size=0 */
302 00fe DF91 pop r29
303 0100 CF91 pop r28
304 0102 0895 ret
305 /* epilogue end (size=3) */
306 /* function bufferAddToEnd size 34 (29) */
308 .Lscope4:
312 .global bufferIsNotFull
314 bufferIsNotFull:
96:../avrlib/buffer.c **** }
97:../avrlib/buffer.c ****
98:../avrlib/buffer.c **** unsigned char bufferIsNotFull(cBuffer* buffer)
99:../avrlib/buffer.c **** {
316 .LM31:
317 /* prologue: frame size=0 */
318 /* prologue end (size=0) */
319 0104 FC01 movw r30,r24
100:../avrlib/buffer.c **** // check to see if the buffer has room
101:../avrlib/buffer.c **** // return true if there is room
102:../avrlib/buffer.c **** return (buffer->datalength < buffer->size);
321 .LM32:
322 0106 40E0 ldi r20,lo8(0)
323 0108 50E0 ldi r21,hi8(0)
324 010a 2481 ldd r18,Z+4
325 010c 3581 ldd r19,Z+5
326 010e 8281 ldd r24,Z+2
327 0110 9381 ldd r25,Z+3
328 0112 2817 cp r18,r24
329 0114 3907 cpc r19,r25
330 0116 10F4 brsh .L14
332 .LM33:
333 0118 41E0 ldi r20,lo8(1)
334 011a 50E0 ldi r21,hi8(1)
335 .L14:
103:../avrlib/buffer.c **** }
337 .LM34:
338 011c CA01 movw r24,r20
339 /* epilogue: frame size=0 */
340 011e 0895 ret
341 /* epilogue end (size=1) */
342 /* function bufferIsNotFull size 14 (13) */
344 .Lscope5:
348 .global bufferFlush
350 bufferFlush:
104:../avrlib/buffer.c ****
105:../avrlib/buffer.c **** void bufferFlush(cBuffer* buffer)
106:../avrlib/buffer.c **** {
352 .LM35:
353 /* prologue: frame size=0 */
354 /* prologue end (size=0) */
107:../avrlib/buffer.c **** // flush contents of the buffer
108:../avrlib/buffer.c **** buffer->datalength = 0;
356 .LM36:
357 0120 FC01 movw r30,r24
358 0122 1482 std Z+4,__zero_reg__
359 0124 1582 std Z+5,__zero_reg__
360 /* epilogue: frame size=0 */
361 0126 0895 ret
362 /* epilogue end (size=1) */
363 /* function bufferFlush size 4 (3) */
365 .Lscope6:
367 .text
369 Letext:
370 /* File "../avrlib/buffer.c": code 148 = 0x0094 ( 129), prologues 6, epilogues 13 */
DEFINED SYMBOLS
*ABS*:00000000 buffer.c
*ABS*:0000003f __SREG__
*ABS*:0000003e __SP_H__
*ABS*:0000003d __SP_L__
*ABS*:00000000 __tmp_reg__
*ABS*:00000001 __zero_reg__
/var/tmp//ccWNR2QI.s:46 .text:00000000 bufferInit
/var/tmp//ccWNR2QI.s:79 .text:00000014 bufferGetFromFront
/var/tmp//ccWNR2QI.s:152 .text:0000005c bufferDumpFromFront
/var/tmp//ccWNR2QI.s:216 .text:0000009e bufferGetAtIndex
/var/tmp//ccWNR2QI.s:253 .text:000000c0 bufferAddToEnd
/var/tmp//ccWNR2QI.s:314 .text:00000104 bufferIsNotFull
/var/tmp//ccWNR2QI.s:350 .text:00000120 bufferFlush
/var/tmp//ccWNR2QI.s:369 .text:00000128 Letext
UNDEFINED SYMBOLS
__do_copy_data
__do_clear_bss
__udivmodhi4