Blame | Last modification | View Log | Download
GAS LISTING /tmp/ccGIWzET.s page 1
1 .file "UartInterface.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
10 .stabs "/home/kaklik/projects/roboti/istrobot/2007/ATmega8/AVRcam/",100,0,2,.Ltext0
11 .stabs "UartInterface.c",100,0,2,.Ltext0
12 .text
13 .Ltext0:
14 .stabs "gcc2_compiled.",60,0,0,0
15 .stabs "int:t(0,1)=r(0,1);-32768;32767;",128,0,0,0
16 .stabs "char:t(0,2)=@s8;r(0,2);0;255;",128,0,0,0
17 .stabs "long int:t(0,3)=@s32;r(0,3);020000000000;017777777777;",128,0,0,0
18 .stabs "unsigned int:t(0,4)=r(0,4);0;0177777;",128,0,0,0
19 .stabs "long unsigned int:t(0,5)=@s32;r(0,5);0;037777777777;",128,0,0,0
20 .stabs "long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;",128,0,0,
21 .stabs "long long unsigned int:t(0,7)=@s64;r(0,7);0;01777777777777777777777;",128,0,0,0
22 .stabs "short int:t(0,8)=r(0,8);-32768;32767;",128,0,0,0
23 .stabs "short unsigned int:t(0,9)=r(0,9);0;0177777;",128,0,0,0
24 .stabs "signed char:t(0,10)=@s8;r(0,10);-128;127;",128,0,0,0
25 .stabs "unsigned char:t(0,11)=@s8;r(0,11);0;255;",128,0,0,0
26 .stabs "float:t(0,12)=r(0,1);4;0;",128,0,0,0
27 .stabs "double:t(0,13)=r(0,1);4;0;",128,0,0,0
28 .stabs "long double:t(0,14)=r(0,1);4;0;",128,0,0,0
29 .stabs "void:t(0,15)=(0,15)",128,0,0,0
30 .stabs "/usr/lib/gcc/avr/4.1.0/../../../../avr/include/avr/io.h",130,0,0,0
31 .stabs "/usr/lib/gcc/avr/4.1.0/../../../../avr/include/avr/sfr_defs.h",130,0,0,0
32 .stabs "/usr/lib/gcc/avr/4.1.0/../../../../avr/include/inttypes.h",130,0,0,0
33 .stabs "/usr/lib/gcc/avr/4.1.0/../../../../avr/include/stdint.h",130,0,0,0
34 .stabs "int8_t:t(4,1)=(0,10)",128,0,116,0
35 .stabs "uint8_t:t(4,2)=(0,11)",128,0,117,0
36 .stabs "int16_t:t(4,3)=(0,1)",128,0,118,0
37 .stabs "uint16_t:t(4,4)=(0,4)",128,0,119,0
38 .stabs "int32_t:t(4,5)=(0,3)",128,0,120,0
39 .stabs "uint32_t:t(4,6)=(0,5)",128,0,121,0
40 .stabs "int64_t:t(4,7)=(0,6)",128,0,122,0
41 .stabs "uint64_t:t(4,8)=(0,7)",128,0,123,0
42 .stabs "intptr_t:t(4,9)=(4,3)",128,0,135,0
43 .stabs "uintptr_t:t(4,10)=(4,4)",128,0,140,0
44 .stabs "int_least8_t:t(4,11)=(4,1)",128,0,152,0
45 .stabs "uint_least8_t:t(4,12)=(4,2)",128,0,157,0
46 .stabs "int_least16_t:t(4,13)=(4,3)",128,0,162,0
47 .stabs "uint_least16_t:t(4,14)=(4,4)",128,0,167,0
48 .stabs "int_least32_t:t(4,15)=(4,5)",128,0,172,0
49 .stabs "uint_least32_t:t(4,16)=(4,6)",128,0,177,0
50 .stabs "int_least64_t:t(4,17)=(4,7)",128,0,182,0
51 .stabs "uint_least64_t:t(4,18)=(4,8)",128,0,187,0
52 .stabs "int_fast8_t:t(4,19)=(4,1)",128,0,200,0
53 .stabs "uint_fast8_t:t(4,20)=(4,2)",128,0,205,0
54 .stabs "int_fast16_t:t(4,21)=(4,3)",128,0,210,0
55 .stabs "uint_fast16_t:t(4,22)=(4,4)",128,0,215,0
56 .stabs "int_fast32_t:t(4,23)=(4,5)",128,0,220,0
57 .stabs "uint_fast32_t:t(4,24)=(4,6)",128,0,225,0
GAS LISTING /tmp/ccGIWzET.s page 2
58 .stabs "int_fast64_t:t(4,25)=(4,7)",128,0,230,0
59 .stabs "uint_fast64_t:t(4,26)=(4,8)",128,0,235,0
60 .stabs "intmax_t:t(4,27)=(4,7)",128,0,249,0
61 .stabs "uintmax_t:t(4,28)=(4,8)",128,0,254,0
62 .stabn 162,0,0,0
63 .stabs "int_farptr_t:t(3,1)=(4,5)",128,0,76,0
64 .stabs "uint_farptr_t:t(3,2)=(4,6)",128,0,80,0
65 .stabn 162,0,0,0
66 .stabn 162,0,0,0
67 .stabn 162,0,0,0
68 .stabs "CommonDefs.h",130,0,0,0
69 .stabs "bool_t:t(5,1)=(0,11)",128,0,56,0
70 .stabn 162,0,0,0
71 .stabs "UartInt_init:F(0,15)",36,0,77,UartInt_init
72 .global UartInt_init
73 .type UartInt_init, @function
74 UartInt_init:
75 .stabd 46,0,0
1:UartInterface.c **** /*
2:UartInterface.c **** Copyright (C) 2004 John Orlando
3:UartInterface.c ****
4:UartInterface.c **** AVRcam: a small real-time image processing engine.
5:UartInterface.c ****
6:UartInterface.c **** This program is free software; you can redistribute it and/or
7:UartInterface.c **** modify it under the terms of the GNU General Public
8:UartInterface.c **** License as published by the Free Software Foundation; either
9:UartInterface.c **** version 2 of the License, or (at your option) any later version.
10:UartInterface.c ****
11:UartInterface.c **** This program is distributed in the hope that it will be useful,
12:UartInterface.c **** but WITHOUT ANY WARRANTY; without even the implied warranty of
13:UartInterface.c **** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14:UartInterface.c **** General Public License for more details.
15:UartInterface.c ****
16:UartInterface.c **** You should have received a copy of the GNU General Public
17:UartInterface.c **** License along with this program; if not, write to the Free Software
18:UartInterface.c **** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19:UartInterface.c ****
20:UartInterface.c **** For more information on the AVRcam, please contact:
21:UartInterface.c ****
22:UartInterface.c **** john@jrobot.net
23:UartInterface.c ****
24:UartInterface.c **** or go to www.jrobot.net for more details regarding the system.
25:UartInterface.c **** */
26:UartInterface.c **** /***********************************************************
27:UartInterface.c **** Module Name: UartInterface.c
28:UartInterface.c **** Module Date: 04/10/2004
29:UartInterface.c **** Module Auth: John Orlando
30:UartInterface.c ****
31:UartInterface.c **** Description: This module is responsible for providing an
32:UartInterface.c **** interface to the UART hardware available on the mega8.
33:UartInterface.c **** This interface is an interrupt-driven interface.
34:UartInterface.c ****
35:UartInterface.c **** Revision History:
36:UartInterface.c **** Date Rel Ver. Notes
37:UartInterface.c **** 4/10/2004 0.1 Module created
38:UartInterface.c **** 6/30/2004 1.0 Initial release for Circuit Cellar
39:UartInterface.c **** contest.
GAS LISTING /tmp/ccGIWzET.s page 3
40:UartInterface.c **** 11/15/2004 1.2 Updated UART baud rate regs so that
41:UartInterface.c **** it runs at 115.2 kbps when the input
42:UartInterface.c **** crystal is at 17.7 MHz (which is the
43:UartInterface.c **** speed of the OV6620's crystal).
44:UartInterface.c **** 1/16/2005 1.4 Moved the serial received ISR to
45:UartInterface.c **** this file, instead of having it
46:UartInterface.c **** in its own UartInterfaceAsm.S file
47:UartInterface.c **** written in assembly.
48:UartInterface.c **** ***********************************************************/
49:UartInterface.c ****
50:UartInterface.c **** /* Includes */
51:UartInterface.c **** #include <avr/io.h>
52:UartInterface.c **** #include <avr/interrupt.h>
53:UartInterface.c **** #include <avr/signal.h>
54:UartInterface.c **** #include "CommonDefs.h"
55:UartInterface.c **** #include "UartInterface.h"
56:UartInterface.c **** #include "UIMgr.h"
57:UartInterface.c **** #include "Executive.h"
58:UartInterface.c ****
59:UartInterface.c **** /* Local Variables */
60:UartInterface.c ****
61:UartInterface.c **** /* Local Structures and Typedefs */
62:UartInterface.c ****
63:UartInterface.c **** /* Extern Variables */
64:UartInterface.c ****
65:UartInterface.c **** /* Definitions */
66:UartInterface.c ****
67:UartInterface.c **** /***********************************************************
68:UartInterface.c **** Function Name: UartInt_init
69:UartInterface.c **** Function Description: This function is responsible for
70:UartInterface.c **** initializing the UART interface on the mega8. This
71:UartInterface.c **** interface is set to communicate at 115.2 Kbps, with an
72:UartInterface.c **** 8N1 protocol.
73:UartInterface.c **** Inputs: none
74:UartInterface.c **** Outputs: none
75:UartInterface.c **** ***********************************************************/
76:UartInterface.c **** void UartInt_init(void)
77:UartInterface.c **** {
76 .stabn 68,0,77,.LM0-UartInt_init
77 .LM0:
78 /* prologue: frame size=0 */
79 /* prologue end (size=0) */
78:UartInterface.c **** /* set up the baud rate registers so the UART will operate
79:UartInterface.c **** at 115.2 Kbps */
80:UartInterface.c **** UBRRH = 0x00;
80 .stabn 68,0,80,.LM1-UartInt_init
81 .LM1:
82 0000 10BC out 64-0x20,__zero_reg__
81:UartInterface.c ****
82:UartInterface.c **** #ifdef NO_CRYSTAL
83:UartInterface.c **** UBRRL = 18; /* 18 for double clocking at 115.2 kbps */
83 .stabn 68,0,83,.LM2-UartInt_init
84 .LM2:
85 0002 82E1 ldi r24,lo8(18)
86 0004 89B9 out 41-0x20,r24
84:UartInterface.c **** #else
85:UartInterface.c **** UBRRL = 0x08; /* for 16 MHz crystal at 115.2 kbps */
GAS LISTING /tmp/ccGIWzET.s page 4
86:UartInterface.c **** #endif
87:UartInterface.c ****
88:UartInterface.c **** /* enable the tx and rx capabilities of the UART...as well
89:UartInterface.c **** as the receive complete interrupt */
90:UartInterface.c **** UCSRB = (1<<RXCIE)|(1<<RXEN)|(1<<TXEN);
87 .stabn 68,0,90,.LM3-UartInt_init
88 .LM3:
89 0006 88E9 ldi r24,lo8(-104)
90 0008 8AB9 out 42-0x20,r24
91:UartInterface.c ****
92:UartInterface.c **** /* set up the control registers so the UART works at 8N1 */
93:UartInterface.c **** UCSRC = (1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0);
91 .stabn 68,0,93,.LM4-UartInt_init
92 .LM4:
93 000a 86E8 ldi r24,lo8(-122)
94 000c 80BD out 64-0x20,r24
94:UartInterface.c ****
95:UartInterface.c **** #ifdef NO_CRYSTAL
96:UartInterface.c **** /* set the baud rate to use the double-speed */
97:UartInterface.c **** UCSRA = (1<<U2X);
95 .stabn 68,0,97,.LM5-UartInt_init
96 .LM5:
97 000e 82E0 ldi r24,lo8(2)
98 0010 8BB9 out 43-0x20,r24
99 /* epilogue: frame size=0 */
100 0012 0895 ret
101 /* epilogue end (size=1) */
102 /* function UartInt_init size 10 (9) */
103 .size UartInt_init, .-UartInt_init
104 .Lscope0:
105 .stabs "",36,0,0,.Lscope0-UartInt_init
106 .stabd 78,0,0
107 .stabs "UartInt_txByte:F(0,15)",36,0,116,UartInt_txByte
108 .stabs "txByte:P(0,11)",64,0,115,24
109 .global UartInt_txByte
110 .type UartInt_txByte, @function
111 UartInt_txByte:
112 .stabd 46,0,0
98:UartInterface.c **** #endif
99:UartInterface.c ****
100:UartInterface.c **** }
101:UartInterface.c ****
102:UartInterface.c **** /***********************************************************
103:UartInterface.c **** Function Name: UartInt_txByte
104:UartInterface.c **** Function Description: This function is responsible for
105:UartInterface.c **** transmitting a single byte on the uart.
106:UartInterface.c **** Inputs: txByte - the byte to send
107:UartInterface.c **** Outputs: none
108:UartInterface.c **** NOTES: When the TX UDRE (data register empty) is set, there
109:UartInterface.c **** is puposefully no interrupt...thus, to send a string of
110:UartInterface.c **** data out, the calling routine needs to hold up the entire
111:UartInterface.c **** application while this takes place (or just send one
112:UartInterface.c **** byte at a time at strtegically timed intervals, like
113:UartInterface.c **** the stats data is sent out :-)
114:UartInterface.c **** ***********************************************************/
115:UartInterface.c **** void UartInt_txByte(unsigned char txByte)
116:UartInterface.c **** {
GAS LISTING /tmp/ccGIWzET.s page 5
113 .stabn 68,0,116,.LM6-UartInt_txByte
114 .LM6:
115 /* prologue: frame size=0 */
116 /* prologue end (size=0) */
117 .L5:
117:UartInterface.c **** /* Wait for empty transmit buffer */
118:UartInterface.c **** while ( !( UCSRA & (1<<UDRE)) );
118 .stabn 68,0,118,.LM7-UartInt_txByte
119 .LM7:
120 0014 5D9B sbis 43-0x20,5
121 0016 FECF rjmp .L5
119:UartInterface.c **** /* Put data into buffer, sends the data */
120:UartInterface.c **** UDR = txByte;
122 .stabn 68,0,120,.LM8-UartInt_txByte
123 .LM8:
124 0018 8CB9 out 44-0x20,r24
125 /* epilogue: frame size=0 */
126 001a 0895 ret
127 /* epilogue end (size=1) */
128 /* function UartInt_txByte size 4 (3) */
129 .size UartInt_txByte, .-UartInt_txByte
130 .Lscope1:
131 .stabs "",36,0,0,.Lscope1-UartInt_txByte
132 .stabd 78,0,0
133 .stabs "__vector_11:F(0,15)",36,0,139,__vector_11
134 .global __vector_11
135 .type __vector_11, @function
136 __vector_11:
137 .stabd 46,0,0
121:UartInterface.c **** }
122:UartInterface.c ****
123:UartInterface.c **** /***********************************************************
124:UartInterface.c **** Function Name: SIG_UART_RECV ISR
125:UartInterface.c **** Function Description: This function is responsible for
126:UartInterface.c **** handling the interrupt caused when a data byte is
127:UartInterface.c **** received by the UART.
128:UartInterface.c **** Inputs: none
129:UartInterface.c **** Outputs: none
130:UartInterface.c **** NOTES: This function was originally written in assembly,
131:UartInterface.c **** but moved over to C when the setting of the "T" bit at
132:UartInterface.c **** the end of the routine was no longer necessary (this
133:UartInterface.c **** theoretically allowed the AVRcam to respond to serial
134:UartInterface.c **** bytes in the middle of tracking or dumping a frame.
135:UartInterface.c **** But it wasn't really needed, and understanding the C
136:UartInterface.c **** is easier :-)
137:UartInterface.c **** ***********************************************************/
138:UartInterface.c **** SIGNAL(SIG_UART_RECV)
139:UartInterface.c **** {
138 .stabn 68,0,139,.LM9-__vector_11
139 .LM9:
140 /* prologue: frame size=0 */
141 001c 1F92 push __zero_reg__
142 001e 0F92 push __tmp_reg__
143 0020 0FB6 in __tmp_reg__,__SREG__
144 0022 0F92 push __tmp_reg__
145 0024 1124 clr __zero_reg__
146 0026 8F93 push r24
GAS LISTING /tmp/ccGIWzET.s page 6
147 0028 9F93 push r25
148 002a EF93 push r30
149 002c FF93 push r31
150 /* prologue end (size=9) */
140:UartInterface.c **** unsigned char tmpHead;
141:UartInterface.c **** /* read the data byte, put it in the serial queue, and
142:UartInterface.c **** post the event */
143:UartInterface.c ****
144:UartInterface.c **** UIMgr_rxFifo[UIMgr_rxFifoHead] = UDR;
151 .stabn 68,0,144,.LM10-__vector_11
152 .LM10:
153 002e 8091 0000 lds r24,UIMgr_rxFifoHead
154 0032 9CB1 in r25,44-0x20
155 0034 E0E0 ldi r30,lo8(UIMgr_rxFifo)
156 0036 F0E0 ldi r31,hi8(UIMgr_rxFifo)
157 0038 E80F add r30,r24
158 003a F11D adc r31,__zero_reg__
159 003c 9083 st Z,r25
145:UartInterface.c ****
146:UartInterface.c **** /* now move the head up */
147:UartInterface.c **** tmpHead = (UIMgr_rxFifoHead + 1) & (UI_MGR_RX_FIFO_MASK);
148:UartInterface.c **** UIMgr_rxFifoHead = tmpHead;
160 .stabn 68,0,148,.LM11-__vector_11
161 .LM11:
162 003e 8F5F subi r24,lo8(-(1))
163 0040 8F71 andi r24,lo8(31)
164 0042 8093 0000 sts UIMgr_rxFifoHead,r24
149:UartInterface.c ****
150:UartInterface.c **** /* write the serial received event to the event fifo */
151:UartInterface.c **** Exec_eventFifo[Exec_eventFifoHead] = EV_SERIAL_DATA_RECEIVED;
165 .stabn 68,0,151,.LM12-__vector_11
166 .LM12:
167 0046 8091 0000 lds r24,Exec_eventFifoHead
168 004a E0E0 ldi r30,lo8(Exec_eventFifo)
169 004c F0E0 ldi r31,hi8(Exec_eventFifo)
170 004e E80F add r30,r24
171 0050 F11D adc r31,__zero_reg__
172 0052 91E0 ldi r25,lo8(1)
173 0054 9083 st Z,r25
152:UartInterface.c ****
153:UartInterface.c **** /* now move the head up */
154:UartInterface.c **** tmpHead = (Exec_eventFifoHead + 1) & (EXEC_EVENT_FIFO_MASK);
155:UartInterface.c **** Exec_eventFifoHead = tmpHead;
174 .stabn 68,0,155,.LM13-__vector_11
175 .LM13:
176 0056 8F5F subi r24,lo8(-(1))
177 0058 8770 andi r24,lo8(7)
178 005a 8093 0000 sts Exec_eventFifoHead,r24
179 /* epilogue: frame size=0 */
180 005e FF91 pop r31
181 0060 EF91 pop r30
182 0062 9F91 pop r25
183 0064 8F91 pop r24
184 0066 0F90 pop __tmp_reg__
185 0068 0FBE out __SREG__,__tmp_reg__
186 006a 0F90 pop __tmp_reg__
187 006c 1F90 pop __zero_reg__
GAS LISTING /tmp/ccGIWzET.s page 7
188 006e 1895 reti
189 /* epilogue end (size=9) */
190 /* function __vector_11 size 42 (24) */
191 .size __vector_11, .-__vector_11
192 .Lscope2:
193 .stabs "",36,0,0,.Lscope2-__vector_11
194 .stabd 78,0,0
195 .stabs "",100,0,0,.Letext0
196 .Letext0:
197 /* File "UartInterface.c": code 56 = 0x0038 ( 36), prologues 9, epilogues 11 */
GAS LISTING /tmp/ccGIWzET.s page 8
DEFINED SYMBOLS
*ABS*:00000000 UartInterface.c
/tmp/ccGIWzET.s:3 *ABS*:0000003f __SREG__
/tmp/ccGIWzET.s:4 *ABS*:0000003e __SP_H__
/tmp/ccGIWzET.s:5 *ABS*:0000003d __SP_L__
/tmp/ccGIWzET.s:6 *ABS*:00000000 __tmp_reg__
/tmp/ccGIWzET.s:7 *ABS*:00000001 __zero_reg__
/tmp/ccGIWzET.s:74 .text:00000000 UartInt_init
/tmp/ccGIWzET.s:111 .text:00000014 UartInt_txByte
/tmp/ccGIWzET.s:136 .text:0000001c __vector_11
UNDEFINED SYMBOLS
__do_copy_data
__do_clear_bss
UIMgr_rxFifoHead
UIMgr_rxFifo
Exec_eventFifoHead
Exec_eventFifo