Subversion Repositories svnkaklik

Compare Revisions

Regard whitespace Rev 173 → Rev 174

/programy/Atmel_C/AVRcam/UartInterface.lst
1,4 → 1,4
GAS LISTING /tmp/ccGIWzET.s page 1
GAS LISTING /tmp/ccKNlHA9.s page 1
 
 
1 .file "UartInterface.c"
10,7 → 10,7
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
10 .stabs "/home/kaklik/projects/programy/Atmel_C/AVRcam/",100,0,2,.Ltext0
11 .stabs "UartInterface.c",100,0,2,.Ltext0
12 .text
13 .Ltext0:
58,7 → 58,7
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
GAS LISTING /tmp/ccKNlHA9.s page 2
 
 
58 .stabs "int_fast64_t:t(4,25)=(4,7)",128,0,230,0
74,7 → 74,7
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
71 .stabs "UartInt_init:F(0,15)",36,0,76,UartInt_init
72 .global UartInt_init
73 .type UartInt_init, @function
74 UartInt_init:
118,7 → 118,7
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
GAS LISTING /tmp/ccKNlHA9.s page 3
 
 
40:UartInterface.c **** 11/15/2004 1.2 Updated UART baud rate regs so that
134,74 → 134,73
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
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 **** {
76 .stabn 68,0,76,.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
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-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
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-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
83:UartInterface.c **** #else
84:UartInterface.c **** UBRRL = 0x08; /* for 16 MHz crystal at 115.2 kbps */
85:UartInterface.c **** #endif
GAS LISTING /tmp/ccKNlHA9.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
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-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
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-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
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-UartInt_init
96 .LM5:
97 000e 82E0 ldi r24,lo8(2)
98 0010 8BB9 out 43-0x20,r24
213,48 → 212,48
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
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
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
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-UartInt_txByte
GAS LISTING /tmp/ccKNlHA9.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
116:UartInterface.c **** /* Wait for empty transmit buffer */
117:UartInterface.c **** while ( !( UCSRA & (1<<UDRE)) );
118 .stabn 68,0,117,.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
118:UartInterface.c **** /* Put data into buffer, sends the data */
119:UartInterface.c **** UDR = txByte;
122 .stabn 68,0,119,.LM8-UartInt_txByte
123 .LM8:
124 0018 8CB9 out 44-0x20,r24
125 /* epilogue: frame size=0 */
265,31 → 264,31
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
133 .stabs "__vector_11:F(0,15)",36,0,138,__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
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 **** {
138 .stabn 68,0,138,.LM9-__vector_11
139 .LM9:
140 /* prologue: frame size=0 */
141 001c 1F92 push __zero_reg__
298,19 → 297,19
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
GAS LISTING /tmp/ccKNlHA9.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
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;
151 .stabn 68,0,143,.LM10-__vector_11
152 .LM10:
153 002e 8091 0000 lds r24,UIMgr_rxFifoHead
154 0032 9CB1 in r25,44-0x20
319,19 → 318,19
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
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;
160 .stabn 68,0,147,.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
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;
165 .stabn 68,0,150,.LM12-__vector_11
166 .LM12:
167 0046 8091 0000 lds r24,Exec_eventFifoHead
168 004a E0E0 ldi r30,lo8(Exec_eventFifo)
340,11 → 339,11
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
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;
174 .stabn 68,0,154,.LM13-__vector_11
175 .LM13:
176 0056 8F5F subi r24,lo8(-(1))
177 0058 8770 andi r24,lo8(7)
358,10 → 357,10
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
GAS LISTING /tmp/ccKNlHA9.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
371,19 → 370,19
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
GAS LISTING /tmp/ccKNlHA9.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
/tmp/ccKNlHA9.s:3 *ABS*:0000003f __SREG__
/tmp/ccKNlHA9.s:4 *ABS*:0000003e __SP_H__
/tmp/ccKNlHA9.s:5 *ABS*:0000003d __SP_L__
/tmp/ccKNlHA9.s:6 *ABS*:00000000 __tmp_reg__
/tmp/ccKNlHA9.s:7 *ABS*:00000001 __zero_reg__
/tmp/ccKNlHA9.s:74 .text:00000000 UartInt_init
/tmp/ccKNlHA9.s:111 .text:00000014 UartInt_txByte
/tmp/ccKNlHA9.s:136 .text:0000001c __vector_11
 
UNDEFINED SYMBOLS
__do_copy_data