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