Blame | Last modification | View Log | Download
GAS LISTING /tmp/ccGIWzET.s page 11 .file "UartInterface.c"2 .arch atmega83 __SREG__ = 0x3f4 __SP_H__ = 0x3e5 __SP_L__ = 0x3d6 __tmp_reg__ = 07 __zero_reg__ = 18 .global __do_copy_data9 .global __do_clear_bss10 .stabs "/home/kaklik/projects/roboti/istrobot/2007/ATmega8/AVRcam/",100,0,2,.Ltext011 .stabs "UartInterface.c",100,0,2,.Ltext012 .text13 .Ltext0:14 .stabs "gcc2_compiled.",60,0,0,015 .stabs "int:t(0,1)=r(0,1);-32768;32767;",128,0,0,016 .stabs "char:t(0,2)=@s8;r(0,2);0;255;",128,0,0,017 .stabs "long int:t(0,3)=@s32;r(0,3);020000000000;017777777777;",128,0,0,018 .stabs "unsigned int:t(0,4)=r(0,4);0;0177777;",128,0,0,019 .stabs "long unsigned int:t(0,5)=@s32;r(0,5);0;037777777777;",128,0,0,020 .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,022 .stabs "short int:t(0,8)=r(0,8);-32768;32767;",128,0,0,023 .stabs "short unsigned int:t(0,9)=r(0,9);0;0177777;",128,0,0,024 .stabs "signed char:t(0,10)=@s8;r(0,10);-128;127;",128,0,0,025 .stabs "unsigned char:t(0,11)=@s8;r(0,11);0;255;",128,0,0,026 .stabs "float:t(0,12)=r(0,1);4;0;",128,0,0,027 .stabs "double:t(0,13)=r(0,1);4;0;",128,0,0,028 .stabs "long double:t(0,14)=r(0,1);4;0;",128,0,0,029 .stabs "void:t(0,15)=(0,15)",128,0,0,030 .stabs "/usr/lib/gcc/avr/4.1.0/../../../../avr/include/avr/io.h",130,0,0,031 .stabs "/usr/lib/gcc/avr/4.1.0/../../../../avr/include/avr/sfr_defs.h",130,0,0,032 .stabs "/usr/lib/gcc/avr/4.1.0/../../../../avr/include/inttypes.h",130,0,0,033 .stabs "/usr/lib/gcc/avr/4.1.0/../../../../avr/include/stdint.h",130,0,0,034 .stabs "int8_t:t(4,1)=(0,10)",128,0,116,035 .stabs "uint8_t:t(4,2)=(0,11)",128,0,117,036 .stabs "int16_t:t(4,3)=(0,1)",128,0,118,037 .stabs "uint16_t:t(4,4)=(0,4)",128,0,119,038 .stabs "int32_t:t(4,5)=(0,3)",128,0,120,039 .stabs "uint32_t:t(4,6)=(0,5)",128,0,121,040 .stabs "int64_t:t(4,7)=(0,6)",128,0,122,041 .stabs "uint64_t:t(4,8)=(0,7)",128,0,123,042 .stabs "intptr_t:t(4,9)=(4,3)",128,0,135,043 .stabs "uintptr_t:t(4,10)=(4,4)",128,0,140,044 .stabs "int_least8_t:t(4,11)=(4,1)",128,0,152,045 .stabs "uint_least8_t:t(4,12)=(4,2)",128,0,157,046 .stabs "int_least16_t:t(4,13)=(4,3)",128,0,162,047 .stabs "uint_least16_t:t(4,14)=(4,4)",128,0,167,048 .stabs "int_least32_t:t(4,15)=(4,5)",128,0,172,049 .stabs "uint_least32_t:t(4,16)=(4,6)",128,0,177,050 .stabs "int_least64_t:t(4,17)=(4,7)",128,0,182,051 .stabs "uint_least64_t:t(4,18)=(4,8)",128,0,187,052 .stabs "int_fast8_t:t(4,19)=(4,1)",128,0,200,053 .stabs "uint_fast8_t:t(4,20)=(4,2)",128,0,205,054 .stabs "int_fast16_t:t(4,21)=(4,3)",128,0,210,055 .stabs "uint_fast16_t:t(4,22)=(4,4)",128,0,215,056 .stabs "int_fast32_t:t(4,23)=(4,5)",128,0,220,057 .stabs "uint_fast32_t:t(4,24)=(4,6)",128,0,225,0GAS LISTING /tmp/ccGIWzET.s page 258 .stabs "int_fast64_t:t(4,25)=(4,7)",128,0,230,059 .stabs "uint_fast64_t:t(4,26)=(4,8)",128,0,235,060 .stabs "intmax_t:t(4,27)=(4,7)",128,0,249,061 .stabs "uintmax_t:t(4,28)=(4,8)",128,0,254,062 .stabn 162,0,0,063 .stabs "int_farptr_t:t(3,1)=(4,5)",128,0,76,064 .stabs "uint_farptr_t:t(3,2)=(4,6)",128,0,80,065 .stabn 162,0,0,066 .stabn 162,0,0,067 .stabn 162,0,0,068 .stabs "CommonDefs.h",130,0,0,069 .stabs "bool_t:t(5,1)=(0,11)",128,0,56,070 .stabn 162,0,0,071 .stabs "UartInt_init:F(0,15)",36,0,77,UartInt_init72 .global UartInt_init73 .type UartInt_init, @function74 UartInt_init:75 .stabd 46,0,01:UartInterface.c **** /*2:UartInterface.c **** Copyright (C) 2004 John Orlando3: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/or7:UartInterface.c **** modify it under the terms of the GNU General Public8:UartInterface.c **** License as published by the Free Software Foundation; either9: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 of13:UartInterface.c **** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU14:UartInterface.c **** General Public License for more details.15:UartInterface.c ****16:UartInterface.c **** You should have received a copy of the GNU General Public17:UartInterface.c **** License along with this program; if not, write to the Free Software18:UartInterface.c **** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19:UartInterface.c ****20:UartInterface.c **** For more information on the AVRcam, please contact:21:UartInterface.c ****22:UartInterface.c **** john@jrobot.net23: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.c28:UartInterface.c **** Module Date: 04/10/200429:UartInterface.c **** Module Auth: John Orlando30:UartInterface.c ****31:UartInterface.c **** Description: This module is responsible for providing an32: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. Notes37:UartInterface.c **** 4/10/2004 0.1 Module created38:UartInterface.c **** 6/30/2004 1.0 Initial release for Circuit Cellar39:UartInterface.c **** contest.GAS LISTING /tmp/ccGIWzET.s page 340:UartInterface.c **** 11/15/2004 1.2 Updated UART baud rate regs so that41:UartInterface.c **** it runs at 115.2 kbps when the input42:UartInterface.c **** crystal is at 17.7 MHz (which is the43:UartInterface.c **** speed of the OV6620's crystal).44:UartInterface.c **** 1/16/2005 1.4 Moved the serial received ISR to45:UartInterface.c **** this file, instead of having it46:UartInterface.c **** in its own UartInterfaceAsm.S file47: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_init69:UartInterface.c **** Function Description: This function is responsible for70:UartInterface.c **** initializing the UART interface on the mega8. This71:UartInterface.c **** interface is set to communicate at 115.2 Kbps, with an72:UartInterface.c **** 8N1 protocol.73:UartInterface.c **** Inputs: none74:UartInterface.c **** Outputs: none75:UartInterface.c **** ***********************************************************/76:UartInterface.c **** void UartInt_init(void)77:UartInterface.c **** {76 .stabn 68,0,77,.LM0-UartInt_init77 .LM0:78 /* prologue: frame size=0 */79 /* prologue end (size=0) */78:UartInterface.c **** /* set up the baud rate registers so the UART will operate79:UartInterface.c **** at 115.2 Kbps */80:UartInterface.c **** UBRRH = 0x00;80 .stabn 68,0,80,.LM1-UartInt_init81 .LM1:82 0000 10BC out 64-0x20,__zero_reg__81:UartInterface.c ****82:UartInterface.c **** #ifdef NO_CRYSTAL83:UartInterface.c **** UBRRL = 18; /* 18 for double clocking at 115.2 kbps */83 .stabn 68,0,83,.LM2-UartInt_init84 .LM2:85 0002 82E1 ldi r24,lo8(18)86 0004 89B9 out 41-0x20,r2484:UartInterface.c **** #else85:UartInterface.c **** UBRRL = 0x08; /* for 16 MHz crystal at 115.2 kbps */GAS LISTING /tmp/ccGIWzET.s page 486:UartInterface.c **** #endif87:UartInterface.c ****88:UartInterface.c **** /* enable the tx and rx capabilities of the UART...as well89:UartInterface.c **** as the receive complete interrupt */90:UartInterface.c **** UCSRB = (1<<RXCIE)|(1<<RXEN)|(1<<TXEN);87 .stabn 68,0,90,.LM3-UartInt_init88 .LM3:89 0006 88E9 ldi r24,lo8(-104)90 0008 8AB9 out 42-0x20,r2491: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_init92 .LM4:93 000a 86E8 ldi r24,lo8(-122)94 000c 80BD out 64-0x20,r2494:UartInterface.c ****95:UartInterface.c **** #ifdef NO_CRYSTAL96:UartInterface.c **** /* set the baud rate to use the double-speed */97:UartInterface.c **** UCSRA = (1<<U2X);95 .stabn 68,0,97,.LM5-UartInt_init96 .LM5:97 000e 82E0 ldi r24,lo8(2)98 0010 8BB9 out 43-0x20,r2499 /* epilogue: frame size=0 */100 0012 0895 ret101 /* epilogue end (size=1) */102 /* function UartInt_init size 10 (9) */103 .size UartInt_init, .-UartInt_init104 .Lscope0:105 .stabs "",36,0,0,.Lscope0-UartInt_init106 .stabd 78,0,0107 .stabs "UartInt_txByte:F(0,15)",36,0,116,UartInt_txByte108 .stabs "txByte:P(0,11)",64,0,115,24109 .global UartInt_txByte110 .type UartInt_txByte, @function111 UartInt_txByte:112 .stabd 46,0,098:UartInterface.c **** #endif99:UartInterface.c ****100:UartInterface.c **** }101:UartInterface.c ****102:UartInterface.c **** /***********************************************************103:UartInterface.c **** Function Name: UartInt_txByte104:UartInterface.c **** Function Description: This function is responsible for105:UartInterface.c **** transmitting a single byte on the uart.106:UartInterface.c **** Inputs: txByte - the byte to send107:UartInterface.c **** Outputs: none108:UartInterface.c **** NOTES: When the TX UDRE (data register empty) is set, there109:UartInterface.c **** is puposefully no interrupt...thus, to send a string of110:UartInterface.c **** data out, the calling routine needs to hold up the entire111:UartInterface.c **** application while this takes place (or just send one112:UartInterface.c **** byte at a time at strtegically timed intervals, like113: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 5113 .stabn 68,0,116,.LM6-UartInt_txByte114 .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_txByte119 .LM7:120 0014 5D9B sbis 43-0x20,5121 0016 FECF rjmp .L5119:UartInterface.c **** /* Put data into buffer, sends the data */120:UartInterface.c **** UDR = txByte;122 .stabn 68,0,120,.LM8-UartInt_txByte123 .LM8:124 0018 8CB9 out 44-0x20,r24125 /* epilogue: frame size=0 */126 001a 0895 ret127 /* epilogue end (size=1) */128 /* function UartInt_txByte size 4 (3) */129 .size UartInt_txByte, .-UartInt_txByte130 .Lscope1:131 .stabs "",36,0,0,.Lscope1-UartInt_txByte132 .stabd 78,0,0133 .stabs "__vector_11:F(0,15)",36,0,139,__vector_11134 .global __vector_11135 .type __vector_11, @function136 __vector_11:137 .stabd 46,0,0121:UartInterface.c **** }122:UartInterface.c ****123:UartInterface.c **** /***********************************************************124:UartInterface.c **** Function Name: SIG_UART_RECV ISR125:UartInterface.c **** Function Description: This function is responsible for126:UartInterface.c **** handling the interrupt caused when a data byte is127:UartInterface.c **** received by the UART.128:UartInterface.c **** Inputs: none129:UartInterface.c **** Outputs: none130: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 at132:UartInterface.c **** the end of the routine was no longer necessary (this133:UartInterface.c **** theoretically allowed the AVRcam to respond to serial134:UartInterface.c **** bytes in the middle of tracking or dumping a frame.135:UartInterface.c **** But it wasn't really needed, and understanding the C136:UartInterface.c **** is easier :-)137:UartInterface.c **** ***********************************************************/138:UartInterface.c **** SIGNAL(SIG_UART_RECV)139:UartInterface.c **** {138 .stabn 68,0,139,.LM9-__vector_11139 .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 r24GAS LISTING /tmp/ccGIWzET.s page 6147 0028 9F93 push r25148 002a EF93 push r30149 002c FF93 push r31150 /* prologue end (size=9) */140:UartInterface.c **** unsigned char tmpHead;141:UartInterface.c **** /* read the data byte, put it in the serial queue, and142:UartInterface.c **** post the event */143:UartInterface.c ****144:UartInterface.c **** UIMgr_rxFifo[UIMgr_rxFifoHead] = UDR;151 .stabn 68,0,144,.LM10-__vector_11152 .LM10:153 002e 8091 0000 lds r24,UIMgr_rxFifoHead154 0032 9CB1 in r25,44-0x20155 0034 E0E0 ldi r30,lo8(UIMgr_rxFifo)156 0036 F0E0 ldi r31,hi8(UIMgr_rxFifo)157 0038 E80F add r30,r24158 003a F11D adc r31,__zero_reg__159 003c 9083 st Z,r25145: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_11161 .LM11:162 003e 8F5F subi r24,lo8(-(1))163 0040 8F71 andi r24,lo8(31)164 0042 8093 0000 sts UIMgr_rxFifoHead,r24149: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_11166 .LM12:167 0046 8091 0000 lds r24,Exec_eventFifoHead168 004a E0E0 ldi r30,lo8(Exec_eventFifo)169 004c F0E0 ldi r31,hi8(Exec_eventFifo)170 004e E80F add r30,r24171 0050 F11D adc r31,__zero_reg__172 0052 91E0 ldi r25,lo8(1)173 0054 9083 st Z,r25152: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_11175 .LM13:176 0056 8F5F subi r24,lo8(-(1))177 0058 8770 andi r24,lo8(7)178 005a 8093 0000 sts Exec_eventFifoHead,r24179 /* epilogue: frame size=0 */180 005e FF91 pop r31181 0060 EF91 pop r30182 0062 9F91 pop r25183 0064 8F91 pop r24184 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 7188 006e 1895 reti189 /* epilogue end (size=9) */190 /* function __vector_11 size 42 (24) */191 .size __vector_11, .-__vector_11192 .Lscope2:193 .stabs "",36,0,0,.Lscope2-__vector_11194 .stabd 78,0,0195 .stabs "",100,0,0,.Letext0196 .Letext0:197 /* File "UartInterface.c": code 56 = 0x0038 ( 36), prologues 9, epilogues 11 */GAS LISTING /tmp/ccGIWzET.s page 8DEFINED 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_11UNDEFINED SYMBOLS__do_copy_data__do_clear_bssUIMgr_rxFifoHeadUIMgr_rxFifoExec_eventFifoHeadExec_eventFifo