Rev 410 | Blame | Compare with Previous | Last modification | View Log | Download
GAS LISTING /tmp/ccfEG7oP.s page 11 .file "I2CInterface.c"2 __SREG__ = 0x3f3 __SP_H__ = 0x3e4 __SP_L__ = 0x3d5 __tmp_reg__ = 06 __zero_reg__ = 17 .global __do_copy_data8 .global __do_clear_bss9 .stabs "/home/kaklik/projects/programy/C/avr/AVRcam/",100,0,2,.Ltext010 .stabs "I2CInterface.c",100,0,2,.Ltext011 .text12 .Ltext0:13 .stabs "gcc2_compiled.",60,0,0,014 .stabs "int:t(0,1)=r(0,1);-32768;32767;",128,0,0,015 .stabs "char:t(0,2)=@s8;r(0,2);0;255;",128,0,0,016 .stabs "long int:t(0,3)=@s32;r(0,3);020000000000;017777777777;",128,0,0,017 .stabs "unsigned int:t(0,4)=r(0,4);0;0177777;",128,0,0,018 .stabs "long unsigned int:t(0,5)=@s32;r(0,5);0;037777777777;",128,0,0,019 .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,021 .stabs "short int:t(0,8)=r(0,8);-32768;32767;",128,0,0,022 .stabs "short unsigned int:t(0,9)=r(0,9);0;0177777;",128,0,0,023 .stabs "signed char:t(0,10)=@s8;r(0,10);-128;127;",128,0,0,024 .stabs "unsigned char:t(0,11)=@s8;r(0,11);0;255;",128,0,0,025 .stabs "float:t(0,12)=r(0,1);4;0;",128,0,0,026 .stabs "double:t(0,13)=r(0,1);4;0;",128,0,0,027 .stabs "long double:t(0,14)=r(0,1);4;0;",128,0,0,028 .stabs "void:t(0,15)=(0,15)",128,0,0,029 .stabs "/usr/lib/gcc/avr/4.2.1/../../../../avr/include/avr/io.h",130,0,0,030 .stabs "/usr/lib/gcc/avr/4.2.1/../../../../avr/include/avr/sfr_defs.h",130,0,0,031 .stabs "/usr/lib/gcc/avr/4.2.1/../../../../avr/include/inttypes.h",130,0,0,032 .stabs "/usr/lib/gcc/avr/4.2.1/../../../../avr/include/stdint.h",130,0,0,033 .stabs "int8_t:t(4,1)=(0,10)",128,0,116,034 .stabs "uint8_t:t(4,2)=(0,11)",128,0,117,035 .stabs "int16_t:t(4,3)=(0,1)",128,0,118,036 .stabs "uint16_t:t(4,4)=(0,4)",128,0,119,037 .stabs "int32_t:t(4,5)=(0,3)",128,0,120,038 .stabs "uint32_t:t(4,6)=(0,5)",128,0,121,039 .stabs "int64_t:t(4,7)=(0,6)",128,0,122,040 .stabs "uint64_t:t(4,8)=(0,7)",128,0,123,041 .stabs "intptr_t:t(4,9)=(4,3)",128,0,135,042 .stabs "uintptr_t:t(4,10)=(4,4)",128,0,140,043 .stabs "int_least8_t:t(4,11)=(4,1)",128,0,152,044 .stabs "uint_least8_t:t(4,12)=(4,2)",128,0,157,045 .stabs "int_least16_t:t(4,13)=(4,3)",128,0,162,046 .stabs "uint_least16_t:t(4,14)=(4,4)",128,0,167,047 .stabs "int_least32_t:t(4,15)=(4,5)",128,0,172,048 .stabs "uint_least32_t:t(4,16)=(4,6)",128,0,177,049 .stabs "int_least64_t:t(4,17)=(4,7)",128,0,182,050 .stabs "uint_least64_t:t(4,18)=(4,8)",128,0,187,051 .stabs "int_fast8_t:t(4,19)=(4,1)",128,0,200,052 .stabs "uint_fast8_t:t(4,20)=(4,2)",128,0,205,053 .stabs "int_fast16_t:t(4,21)=(4,3)",128,0,210,054 .stabs "uint_fast16_t:t(4,22)=(4,4)",128,0,215,055 .stabs "int_fast32_t:t(4,23)=(4,5)",128,0,220,056 .stabs "uint_fast32_t:t(4,24)=(4,6)",128,0,225,057 .stabs "int_fast64_t:t(4,25)=(4,7)",128,0,230,0GAS LISTING /tmp/ccfEG7oP.s page 258 .stabs "uint_fast64_t:t(4,26)=(4,8)",128,0,235,059 .stabs "intmax_t:t(4,27)=(4,7)",128,0,249,060 .stabs "uintmax_t:t(4,28)=(4,8)",128,0,254,061 .stabn 162,0,0,062 .stabs "int_farptr_t:t(3,1)=(4,5)",128,0,76,063 .stabs "uint_farptr_t:t(3,2)=(4,6)",128,0,80,064 .stabn 162,0,0,065 .stabn 162,0,0,066 .stabn 162,0,0,067 .stabs "CamConfig.h",130,0,0,068 .stabs "I2CInterface.h",130,0,0,069 .stabs "CommonDefs.h",130,0,0,070 .stabs "bool_t:t(7,1)=(0,11)",128,0,56,071 .stabn 162,0,0,072 .stabs "i2cCmd_t:t(6,1)=(6,2)=s2configReg:(0,11),0,8;data:(0,11),8,8;;",128,0,53,073 .stabn 162,0,0,074 .stabn 162,0,0,075 .stabs "I2CInt_init:F(0,15)",36,0,85,I2CInt_init76 .global I2CInt_init77 .type I2CInt_init, @function78 I2CInt_init:79 .stabd 46,0,01:I2CInterface.c **** /*2:I2CInterface.c **** Copyright (C) 2004 John Orlando3:I2CInterface.c ****4:I2CInterface.c **** AVRcam: a small real-time image processing engine.5:I2CInterface.c ****6:I2CInterface.c **** This program is free software; you can redistribute it and/or7:I2CInterface.c **** modify it under the terms of the GNU General Public8:I2CInterface.c **** License as published by the Free Software Foundation; either9:I2CInterface.c **** version 2 of the License, or (at your option) any later version.10:I2CInterface.c ****11:I2CInterface.c **** This program is distributed in the hope that it will be useful,12:I2CInterface.c **** but WITHOUT ANY WARRANTY; without even the implied warranty of13:I2CInterface.c **** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU14:I2CInterface.c **** General Public License for more details.15:I2CInterface.c ****16:I2CInterface.c **** You should have received a copy of the GNU General Public17:I2CInterface.c **** License along with this program; if not, write to the Free Software18:I2CInterface.c **** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19:I2CInterface.c ****20:I2CInterface.c **** For more information on the AVRcam, please contact:21:I2CInterface.c ****22:I2CInterface.c **** john@jrobot.net23:I2CInterface.c ****24:I2CInterface.c **** or go to www.jrobot.net for more details regarding the system.25:I2CInterface.c **** */26:I2CInterface.c **** /***********************************************************27:I2CInterface.c **** Module Name: I2CInterface.c28:I2CInterface.c **** Module Date: 4/10/200429:I2CInterface.c **** Module Auth: John Orlando30:I2CInterface.c ****31:I2CInterface.c **** Description: This module is responsible for providing a32:I2CInterface.c **** low-level interface to the I2C hardware resident on the33:I2CInterface.c **** mega8 processor (also known as the Two-Wire Interface,34:I2CInterface.c **** or TWI). The interface is needed to configure the35:I2CInterface.c **** needed registers in the OV6620 camera. This interfaceGAS LISTING /tmp/ccfEG7oP.s page 336:I2CInterface.c **** is interrupt-driven based on the events that should37:I2CInterface.c **** occur upon successful writing of an I2C register.38:I2CInterface.c ****39:I2CInterface.c **** Revision History:40:I2CInterface.c **** Date Rel Ver. Notes41:I2CInterface.c **** 4/10/2004 0.1 Module created42:I2CInterface.c **** 6/30/2004 1.0 Initial release for Circuit Cellar43:I2CInterface.c **** contest.44:I2CInterface.c ****45:I2CInterface.c **** ***********************************************************/46:I2CInterface.c ****47:I2CInterface.c **** /* Includes */48:I2CInterface.c **** #include <avr/io.h>49:I2CInterface.c **** #include <util/twi.h>50:I2CInterface.c **** #include <avr/interrupt.h>51:I2CInterface.c **** #include "CamConfig.h"52:I2CInterface.c **** #include "CommonDefs.h"53:I2CInterface.c ****54:I2CInterface.c **** /* Local Variables */55:I2CInterface.c ****56:I2CInterface.c **** /* These variables are used as storage space for the current57:I2CInterface.c **** I2C command being sent over the interface. They need to58:I2CInterface.c **** be volatile since they are dealt with an the TWI ISR */59:I2CInterface.c **** volatile static unsigned char twi_address;60:I2CInterface.c **** volatile static unsigned char *twi_data;61:I2CInterface.c **** volatile static unsigned char twi_ddr;62:I2CInterface.c **** volatile static unsigned char twi_bytes;63:I2CInterface.c **** volatile static unsigned char status;64:I2CInterface.c **** volatile static unsigned char retry_cnt;65:I2CInterface.c ****66:I2CInterface.c **** /* Local Structures and Typedefs */67:I2CInterface.c ****68:I2CInterface.c **** /* Extern Variables */69:I2CInterface.c ****70:I2CInterface.c **** /* Definitions */71:I2CInterface.c **** /* Bit definitions for the tw_status register */72:I2CInterface.c **** #define MAX_TWI_RETRIES 273:I2CInterface.c **** #define BUSY 774:I2CInterface.c ****75:I2CInterface.c **** /***********************************************************76:I2CInterface.c **** Function Name: I2CInt_init77:I2CInterface.c **** Function Description: This function is responsible78:I2CInterface.c **** for setting up the registers needed for the TWI79:I2CInterface.c **** interface80:I2CInterface.c ****81:I2CInterface.c **** Inputs: none82:I2CInterface.c **** Outputs: none83:I2CInterface.c **** ***********************************************************/84:I2CInterface.c **** void I2CInt_init(void)85:I2CInterface.c **** {80 .stabn 68,0,85,.LM0-.LFBB181 .LM0:82 .LFBB1:83 /* prologue: frame size=0 */84 /* prologue end (size=0) */86:I2CInterface.c **** TWSR = 0;85 .stabn 68,0,86,.LM1-.LFBB1GAS LISTING /tmp/ccfEG7oP.s page 486 .LM1:87 0000 11B8 out 33-0x20,__zero_reg__87:I2CInterface.c ****88:I2CInterface.c **** /* init the speed of the I2C interface, running at89:I2CInterface.c **** 100 Kbps */90:I2CInterface.c **** TWBR = (FOSC / I2C_SPEED - 16)/2;88 .stabn 68,0,90,.LM2-.LFBB189 .LM2:90 0002 88E4 ldi r24,lo8(72)91 0004 80B9 out 32-0x20,r2492 /* epilogue: frame size=0 */93 0006 0895 ret94 /* epilogue end (size=1) */95 /* function I2CInt_init size 4 (3) */96 .size I2CInt_init, .-I2CInt_init97 .Lscope1:98 .stabs "",36,0,0,.Lscope1-.LFBB199 .stabd 78,0,0100 .stabs "I2CInt_writeData:F(0,15)",36,0,108,I2CInt_writeData101 .stabs "address:P(0,11)",64,0,107,25102 .stabs "data:P(0,16)=*(0,11)",64,0,107,22103 .stabs "bytes:P(0,11)",64,0,107,20104 .global I2CInt_writeData105 .type I2CInt_writeData, @function106 I2CInt_writeData:107 .stabd 46,0,091:I2CInterface.c **** }92:I2CInterface.c ****93:I2CInterface.c **** /***********************************************************94:I2CInterface.c **** Function Name: I2CInt_writeData95:I2CInterface.c **** Function Description: This function is responsible for96:I2CInterface.c **** initiating the process of writing a sequence of bytes97:I2CInterface.c **** an I2C slave address. This function will try to write98:I2CInterface.c **** the data three times before giving up.99:I2CInterface.c **** Inputs: address: the address of the I2C slave device100:I2CInterface.c **** data: a pointer to the data to be written101:I2CInterface.c **** to the slave...for camera interfacing,102:I2CInterface.c **** the data follows a <register #><data>103:I2CInterface.c **** format104:I2CInterface.c **** bytes: the number of bytes to write105:I2CInterface.c **** Outputs: none106:I2CInterface.c **** ***********************************************************/107:I2CInterface.c **** void I2CInt_writeData(unsigned char address, unsigned char *data, unsigned char bytes)108:I2CInterface.c **** {108 .stabn 68,0,108,.LM3-.LFBB2109 .LM3:110 .LFBB2:111 /* prologue: frame size=0 */112 /* prologue end (size=0) */113 0008 982F mov r25,r24114 .L5:109:I2CInterface.c **** while(status & (1<<BUSY)); /* Bus is busy wait (or exit with error code) */115 .stabn 68,0,109,.LM4-.LFBB2116 .LM4:117 000a 8091 0000 lds r24,status118 000e 8823 tst r24119 0010 04F0 brlt .L5GAS LISTING /tmp/ccfEG7oP.s page 5120 .L9:110:I2CInterface.c **** while(TWCR & (1<<TWSTO));121 .stabn 68,0,110,.LM5-.LFBB2122 .LM5:123 0012 06B6 in __tmp_reg__,86-0x20124 0014 04FC sbrc __tmp_reg__,4125 0016 00C0 rjmp .L9111:I2CInterface.c ****112:I2CInterface.c **** /* copy the needed data and state info to our local I2C command structure */113:I2CInterface.c **** twi_address = address;126 .stabn 68,0,113,.LM6-.LFBB2127 .LM6:128 0018 9093 0000 sts twi_address,r25114:I2CInterface.c **** twi_data = data;129 .stabn 68,0,114,.LM7-.LFBB2130 .LM7:131 001c 7093 0000 sts (twi_data)+1,r23132 0020 6093 0000 sts twi_data,r22115:I2CInterface.c **** twi_bytes = bytes;133 .stabn 68,0,115,.LM8-.LFBB2134 .LM8:135 0024 4093 0000 sts twi_bytes,r20116:I2CInterface.c **** twi_ddr = TW_WRITE;136 .stabn 68,0,116,.LM9-.LFBB2137 .LM9:138 0028 1092 0000 sts twi_ddr,__zero_reg__117:I2CInterface.c ****118:I2CInterface.c **** retry_cnt = 0;139 .stabn 68,0,118,.LM10-.LFBB2140 .LM10:141 002c 1092 0000 sts retry_cnt,__zero_reg__119:I2CInterface.c ****120:I2CInterface.c **** /* Generate start condition, the remainder of the transfer is interrupt driven and121:I2CInterface.c **** will be performed in the background */122:I2CInterface.c **** TWCR = (1<<TWINT)|(1<<TWSTA)|(1<<TWEN)|(1<<TWIE);142 .stabn 68,0,122,.LM11-.LFBB2143 .LM11:144 0030 85EA ldi r24,lo8(-91)145 0032 86BF out 86-0x20,r24123:I2CInterface.c ****124:I2CInterface.c **** status |= (1<<BUSY);146 .stabn 68,0,124,.LM12-.LFBB2147 .LM12:148 0034 8091 0000 lds r24,status149 0038 8068 ori r24,lo8(-128)150 003a 8093 0000 sts status,r24151 /* epilogue: frame size=0 */152 003e 0895 ret153 /* epilogue end (size=1) */154 /* function I2CInt_writeData size 28 (27) */155 .size I2CInt_writeData, .-I2CInt_writeData156 .Lscope2:157 .stabs "",36,0,0,.Lscope2-.LFBB2158 .stabd 78,0,0159 .stabs "I2CInt_readData:F(0,15)",36,0,138,I2CInt_readData160 .stabs "address:P(0,11)",64,0,137,25161 .stabs "data:P(0,16)",64,0,137,22GAS LISTING /tmp/ccfEG7oP.s page 6162 .stabs "bytes:P(0,11)",64,0,137,20163 .global I2CInt_readData164 .type I2CInt_readData, @function165 I2CInt_readData:166 .stabd 46,0,0125:I2CInterface.c **** }126:I2CInterface.c ****127:I2CInterface.c **** /***********************************************************128:I2CInterface.c **** Function Name: I2CInt_readData129:I2CInterface.c **** Function Description: This funcion is responsible for130:I2CInterface.c **** reading the specified number of bytes from a slave131:I2CInterface.c **** device.132:I2CInterface.c **** Inputs: address: the slave address to read from133:I2CInterface.c **** data: a pointer to where the data will be stored134:I2CInterface.c **** bytes: the number of bytes to read135:I2CInterface.c **** Outputs: none136:I2CInterface.c **** ***********************************************************/137:I2CInterface.c **** void I2CInt_readData(unsigned char address, unsigned char *data, unsigned char bytes)138:I2CInterface.c **** {167 .stabn 68,0,138,.LM13-.LFBB3168 .LM13:169 .LFBB3:170 /* prologue: frame size=0 */171 /* prologue end (size=0) */172 0040 982F mov r25,r24173 .L15:139:I2CInterface.c **** /* Bus is busy wait (or exit with error code) */140:I2CInterface.c **** while(status & (1<<BUSY));174 .stabn 68,0,140,.LM14-.LFBB3175 .LM14:176 0042 8091 0000 lds r24,status177 0046 8823 tst r24178 0048 04F0 brlt .L15141:I2CInterface.c ****142:I2CInterface.c **** twi_address = address;179 .stabn 68,0,142,.LM15-.LFBB3180 .LM15:181 004a 9093 0000 sts twi_address,r25143:I2CInterface.c **** twi_data = data;182 .stabn 68,0,143,.LM16-.LFBB3183 .LM16:184 004e 7093 0000 sts (twi_data)+1,r23185 0052 6093 0000 sts twi_data,r22144:I2CInterface.c **** twi_bytes = bytes;186 .stabn 68,0,144,.LM17-.LFBB3187 .LM17:188 0056 4093 0000 sts twi_bytes,r20145:I2CInterface.c **** twi_ddr = TW_READ;189 .stabn 68,0,145,.LM18-.LFBB3190 .LM18:191 005a 81E0 ldi r24,lo8(1)192 005c 8093 0000 sts twi_ddr,r24146:I2CInterface.c ****147:I2CInterface.c **** retry_cnt = 0;193 .stabn 68,0,147,.LM19-.LFBB3194 .LM19:195 0060 1092 0000 sts retry_cnt,__zero_reg__GAS LISTING /tmp/ccfEG7oP.s page 7148:I2CInterface.c ****149:I2CInterface.c **** /* Generate start condition, the remainder of the transfer is interrupt driven and150:I2CInterface.c **** will be performed in the background */151:I2CInterface.c **** TWCR = (1<<TWINT)|(1<<TWSTA)|(1<<TWEN)|(1<<TWIE);196 .stabn 68,0,151,.LM20-.LFBB3197 .LM20:198 0064 85EA ldi r24,lo8(-91)199 0066 86BF out 86-0x20,r24152:I2CInterface.c ****153:I2CInterface.c **** status |= (1<<BUSY);200 .stabn 68,0,153,.LM21-.LFBB3201 .LM21:202 0068 8091 0000 lds r24,status203 006c 8068 ori r24,lo8(-128)204 006e 8093 0000 sts status,r24205 /* epilogue: frame size=0 */206 0072 0895 ret207 /* epilogue end (size=1) */208 /* function I2CInt_readData size 26 (25) */209 .size I2CInt_readData, .-I2CInt_readData210 .Lscope3:211 .stabs "",36,0,0,.Lscope3-.LFBB3212 .stabd 78,0,0213 .stabs "I2CInt_isI2cBusy:F(7,1)",36,0,166,I2CInt_isI2cBusy214 .global I2CInt_isI2cBusy215 .type I2CInt_isI2cBusy, @function216 I2CInt_isI2cBusy:217 .stabd 46,0,0154:I2CInterface.c **** }155:I2CInterface.c ****156:I2CInterface.c **** /***********************************************************157:I2CInterface.c **** Function Name: I2CInt_isI2cBusy158:I2CInterface.c **** Function Description: This funcion is responsible for159:I2CInterface.c **** indicating if the I2C bus is currently busy to external160:I2CInterface.c **** modules.161:I2CInterface.c **** device.162:I2CInterface.c **** Inputs: none163:I2CInterface.c **** Outputs: bool_t - indicating if bus is busy164:I2CInterface.c **** ***********************************************************/165:I2CInterface.c **** bool_t I2CInt_isI2cBusy(void)166:I2CInterface.c **** {218 .stabn 68,0,166,.LM22-.LFBB4219 .LM22:220 .LFBB4:221 /* prologue: frame size=0 */222 /* prologue end (size=0) */167:I2CInterface.c **** bool_t retVal = FALSE;168:I2CInterface.c **** if ( (status & (1<<BUSY)) != 0)223 .stabn 68,0,168,.LM23-.LFBB4224 .LM23:225 0074 8091 0000 lds r24,status226 0078 881F rol r24227 007a 8827 clr r24228 007c 881F rol r24169:I2CInterface.c **** {170:I2CInterface.c **** retVal = TRUE;171:I2CInterface.c **** }GAS LISTING /tmp/ccfEG7oP.s page 8172:I2CInterface.c ****173:I2CInterface.c **** return(retVal);174:I2CInterface.c **** }229 .stabn 68,0,174,.LM24-.LFBB4230 .LM24:231 007e 9927 clr r25232 /* epilogue: frame size=0 */233 0080 0895 ret234 /* epilogue end (size=1) */235 /* function I2CInt_isI2cBusy size 7 (6) */236 .size I2CInt_isI2cBusy, .-I2CInt_isI2cBusy237 .Lscope4:238 .stabs "",36,0,0,.Lscope4-.LFBB4239 .stabd 78,0,0240 .stabs "__vector_17:F(0,15)",36,0,185,__vector_17241 .global __vector_17242 .type __vector_17, @function243 __vector_17:244 .stabd 46,0,0175:I2CInterface.c ****176:I2CInterface.c **** /***********************************************************177:I2CInterface.c **** Function Name: <interrupt handler for I2C>178:I2CInterface.c **** Function Description: This function is responsible for179:I2CInterface.c **** implementing the control logic needed to perform a180:I2CInterface.c **** read or write operation with an I2C slave.181:I2CInterface.c **** Inputs: none182:I2CInterface.c **** Outputs: none183:I2CInterface.c **** ***********************************************************/184:I2CInterface.c **** SIGNAL(SIG_2WIRE_SERIAL)185:I2CInterface.c **** {245 .stabn 68,0,185,.LM25-.LFBB5246 .LM25:247 .LFBB5:248 /* prologue: frame size=0 */249 0082 1F92 push __zero_reg__250 0084 0F92 push __tmp_reg__251 0086 0FB6 in __tmp_reg__,__SREG__252 0088 0F92 push __tmp_reg__253 008a 1124 clr __zero_reg__254 008c 8F93 push r24255 008e 9F93 push r25256 0090 AF93 push r26257 0092 BF93 push r27258 0094 EF93 push r30259 0096 FF93 push r31260 /* prologue end (size=11) */186:I2CInterface.c **** unsigned char TWI_status = TWSR & TW_STATUS_MASK; /* grab just the status bits */261 .stabn 68,0,186,.LM26-.LFBB5262 .LM26:263 0098 81B1 in r24,33-0x20187:I2CInterface.c ****188:I2CInterface.c **** /* the entire I2C handler is state-based...determine189:I2CInterface.c **** what needs to be done based on TWI_status */190:I2CInterface.c **** switch(TWI_status)264 .stabn 68,0,190,.LM27-.LFBB5265 .LM27:266 009a 9927 clr r25GAS LISTING /tmp/ccfEG7oP.s page 9267 009c AA27 clr r26268 009e BB27 clr r27269 00a0 887F andi r24,lo8(248)270 00a2 9070 andi r25,hi8(248)271 00a4 A070 andi r26,hlo8(248)272 00a6 B070 andi r27,hhi8(248)273 00a8 FC01 movw r30,r24274 00aa 3897 sbiw r30,8275 00ac E135 cpi r30,81276 00ae F105 cpc r31,__zero_reg__277 00b0 00F0 brlo .+2278 00b2 00C0 rjmp .L42279 .stabn 68,0,190,.LM28-.LFBB5280 .LM28:281 00b4 E050 subi r30,lo8(-(pm(.L33)))282 00b6 F040 sbci r31,hi8(-(pm(.L33)))283 00b8 0994 ijmp284 .data285 .section .progmem.gcc_sw_table, "ax", @progbits286 .p2align 1287 .L33:288 .data289 .section .progmem.gcc_sw_table, "ax", @progbits290 .p2align 1291 0000 00C0 rjmp .L25292 0002 00C0 rjmp .L42293 0004 00C0 rjmp .L42294 0006 00C0 rjmp .L42295 0008 00C0 rjmp .L42296 000a 00C0 rjmp .L42297 000c 00C0 rjmp .L42298 000e 00C0 rjmp .L42299 0010 00C0 rjmp .L25300 0012 00C0 rjmp .L42301 0014 00C0 rjmp .L42302 0016 00C0 rjmp .L42303 0018 00C0 rjmp .L42304 001a 00C0 rjmp .L42305 001c 00C0 rjmp .L42306 001e 00C0 rjmp .L42307 0020 00C0 rjmp .L26308 0022 00C0 rjmp .L42309 0024 00C0 rjmp .L42310 0026 00C0 rjmp .L42311 0028 00C0 rjmp .L42312 002a 00C0 rjmp .L42313 002c 00C0 rjmp .L42314 002e 00C0 rjmp .L42315 0030 00C0 rjmp .L27316 0032 00C0 rjmp .L42317 0034 00C0 rjmp .L42318 0036 00C0 rjmp .L42319 0038 00C0 rjmp .L42320 003a 00C0 rjmp .L42321 003c 00C0 rjmp .L42322 003e 00C0 rjmp .L42323 0040 00C0 rjmp .L28GAS LISTING /tmp/ccfEG7oP.s page 10324 0042 00C0 rjmp .L42325 0044 00C0 rjmp .L42326 0046 00C0 rjmp .L42327 0048 00C0 rjmp .L42328 004a 00C0 rjmp .L42329 004c 00C0 rjmp .L42330 004e 00C0 rjmp .L42331 0050 00C0 rjmp .L29332 0052 00C0 rjmp .L42333 0054 00C0 rjmp .L42334 0056 00C0 rjmp .L42335 0058 00C0 rjmp .L42336 005a 00C0 rjmp .L42337 005c 00C0 rjmp .L42338 005e 00C0 rjmp .L42339 0060 00C0 rjmp .L42340 0062 00C0 rjmp .L42341 0064 00C0 rjmp .L42342 0066 00C0 rjmp .L42343 0068 00C0 rjmp .L42344 006a 00C0 rjmp .L42345 006c 00C0 rjmp .L42346 006e 00C0 rjmp .L42347 0070 00C0 rjmp .L30348 0072 00C0 rjmp .L42349 0074 00C0 rjmp .L42350 0076 00C0 rjmp .L42351 0078 00C0 rjmp .L42352 007a 00C0 rjmp .L42353 007c 00C0 rjmp .L42354 007e 00C0 rjmp .L42355 0080 00C0 rjmp .L27356 0082 00C0 rjmp .L42357 0084 00C0 rjmp .L42358 0086 00C0 rjmp .L42359 0088 00C0 rjmp .L42360 008a 00C0 rjmp .L42361 008c 00C0 rjmp .L42362 008e 00C0 rjmp .L42363 0090 00C0 rjmp .L31364 0092 00C0 rjmp .L42365 0094 00C0 rjmp .L42366 0096 00C0 rjmp .L42367 0098 00C0 rjmp .L42368 009a 00C0 rjmp .L42369 009c 00C0 rjmp .L42370 009e 00C0 rjmp .L42371 00a0 00C0 rjmp .L32372 .text373 .L25:191:I2CInterface.c **** {192:I2CInterface.c **** case TW_START: /* Start condition */193:I2CInterface.c **** case TW_REP_START: /* Repeated start condition */194:I2CInterface.c **** if(retry_cnt > MAX_TWI_RETRIES)374 .stabn 68,0,194,.LM29-.LFBB5375 .LM29:376 00ba 8091 0000 lds r24,retry_cntGAS LISTING /tmp/ccfEG7oP.s page 11377 00be 8330 cpi r24,lo8(3)378 00c0 00F0 brlo .L34195:I2CInterface.c **** {196:I2CInterface.c **** /* generate stop condition if we've reached our retry limit */197:I2CInterface.c **** TWCR |= (1<<TWINT)|(1<<TWSTO);379 .stabn 68,0,197,.LM30-.LFBB5380 .LM30:381 00c2 86B7 in r24,86-0x20382 00c4 8069 ori r24,lo8(-112)383 00c6 86BF out 86-0x20,r24198:I2CInterface.c **** status &= ~(1<<BUSY);384 .stabn 68,0,198,.LM31-.LFBB5385 .LM31:386 00c8 8091 0000 lds r24,status387 00cc 8F77 andi r24,lo8(127)388 00ce 8093 0000 sts status,r24389 00d2 00C0 rjmp .L42390 .L34:199:I2CInterface.c **** return;200:I2CInterface.c **** }201:I2CInterface.c **** /* indicate read or write */202:I2CInterface.c **** TWDR = (twi_address<<1) + twi_ddr;391 .stabn 68,0,202,.LM32-.LFBB5392 .LM32:393 00d4 8091 0000 lds r24,twi_address394 00d8 9091 0000 lds r25,twi_ddr395 00dc 880F lsl r24396 00de 890F add r24,r25397 00e0 83B9 out 35-0x20,r24203:I2CInterface.c **** /* TWSTA must be cleared...also clears TWINT */204:I2CInterface.c **** TWCR &= ~(1<<TWSTA);398 .stabn 68,0,204,.LM33-.LFBB5399 .LM33:400 00e2 86B7 in r24,86-0x20401 00e4 8F7D andi r24,lo8(-33)402 00e6 86BF out 86-0x20,r24403 00e8 00C0 rjmp .L42404 .L26:205:I2CInterface.c **** break;206:I2CInterface.c ****207:I2CInterface.c **** case TW_MT_SLA_ACK: /* Slave acknowledged address, */208:I2CInterface.c **** retry_cnt = 0;405 .stabn 68,0,208,.LM34-.LFBB5406 .LM34:407 00ea 1092 0000 sts retry_cnt,__zero_reg__209:I2CInterface.c **** /* tx the data, and increment the data pointer */210:I2CInterface.c **** TWDR = *twi_data;408 .stabn 68,0,210,.LM35-.LFBB5409 .LM35:410 00ee E091 0000 lds r30,twi_data411 00f2 F091 0000 lds r31,(twi_data)+1412 00f6 8191 ld r24,Z+413 00f8 83B9 out 35-0x20,r24211:I2CInterface.c **** twi_data++;414 .stabn 68,0,211,.LM36-.LFBB5415 .LM36:416 00fa F093 0000 sts (twi_data)+1,r31GAS LISTING /tmp/ccfEG7oP.s page 12417 00fe E093 0000 sts twi_data,r30212:I2CInterface.c ****213:I2CInterface.c **** /* clear the int to continue */214:I2CInterface.c **** TWCR |= (1<<TWINT);418 .stabn 68,0,214,.LM37-.LFBB5419 .LM37:420 0102 86B7 in r24,86-0x20421 0104 8068 ori r24,lo8(-128)422 0106 86BF out 86-0x20,r24423 0108 00C0 rjmp .L42424 .L27:215:I2CInterface.c **** break;216:I2CInterface.c ****217:I2CInterface.c **** case TW_MT_SLA_NACK: /* Slave didn't acknowledge address, */218:I2CInterface.c **** case TW_MR_SLA_NACK:219:I2CInterface.c **** retry_cnt++;425 .stabn 68,0,219,.LM38-.LFBB5426 .LM38:427 010a 8091 0000 lds r24,retry_cnt428 010e 8F5F subi r24,lo8(-(1))429 0110 8093 0000 sts retry_cnt,r24220:I2CInterface.c ****221:I2CInterface.c **** /* retry...*/222:I2CInterface.c **** TWCR |= (1<<TWINT)|(1<<TWSTA)|(1<<TWSTO);430 .stabn 68,0,222,.LM39-.LFBB5431 .LM39:432 0114 86B7 in r24,86-0x20433 0116 806B ori r24,lo8(-80)434 0118 86BF out 86-0x20,r24435 011a 00C0 rjmp .L42436 .L28:223:I2CInterface.c **** break;224:I2CInterface.c ****225:I2CInterface.c **** case TW_MT_DATA_ACK: /* Slave Acknowledged data, */226:I2CInterface.c **** if(--twi_bytes > 0)437 .stabn 68,0,226,.LM40-.LFBB5438 .LM40:439 011c 8091 0000 lds r24,twi_bytes440 0120 8150 subi r24,lo8(-(-1))441 0122 8093 0000 sts twi_bytes,r24442 0126 8091 0000 lds r24,twi_bytes443 012a 8823 tst r24444 012c 01F0 breq .L36227:I2CInterface.c **** {228:I2CInterface.c **** /* more data to send, so send it */229:I2CInterface.c **** TWDR = *twi_data;445 .stabn 68,0,229,.LM41-.LFBB5446 .LM41:447 012e E091 0000 lds r30,twi_data448 0132 F091 0000 lds r31,(twi_data)+1449 0136 8191 ld r24,Z+450 0138 83B9 out 35-0x20,r24230:I2CInterface.c **** twi_data++;451 .stabn 68,0,230,.LM42-.LFBB5452 .LM42:453 013a F093 0000 sts (twi_data)+1,r31454 013e E093 0000 sts twi_data,r30GAS LISTING /tmp/ccfEG7oP.s page 13231:I2CInterface.c **** TWCR |= (1<<TWINT);455 .stabn 68,0,231,.LM43-.LFBB5456 .LM43:457 0142 86B7 in r24,86-0x20458 0144 8068 ori r24,lo8(-128)459 0146 86BF out 86-0x20,r24460 0148 00C0 rjmp .L42461 .L36:232:I2CInterface.c **** }233:I2CInterface.c **** else234:I2CInterface.c **** {235:I2CInterface.c **** /* generate the stop condition if needed */236:I2CInterface.c **** TWCR |= (1<<TWSTO)|(1<<TWINT);462 .stabn 68,0,236,.LM44-.LFBB5463 .LM44:464 014a 86B7 in r24,86-0x20465 014c 8069 ori r24,lo8(-112)466 014e 86BF out 86-0x20,r24237:I2CInterface.c **** status &= ~(1<<BUSY);467 .stabn 68,0,237,.LM45-.LFBB5468 .LM45:469 0150 8091 0000 lds r24,status470 0154 8F77 andi r24,lo8(127)471 0156 8093 0000 sts status,r24472 015a 00C0 rjmp .L42473 .L29:238:I2CInterface.c **** }239:I2CInterface.c **** break;240:I2CInterface.c ****241:I2CInterface.c **** case TW_MT_DATA_NACK: /* Slave didn't acknowledge data */242:I2CInterface.c **** /* send the stop condition */243:I2CInterface.c **** TWCR |= (1<<TWINT)|(1<<TWSTO);474 .stabn 68,0,243,.LM46-.LFBB5475 .LM46:476 015c 86B7 in r24,86-0x20477 015e 8069 ori r24,lo8(-112)478 0160 86BF out 86-0x20,r24244:I2CInterface.c **** status &= ~(1<<BUSY);479 .stabn 68,0,244,.LM47-.LFBB5480 .LM47:481 0162 8091 0000 lds r24,status482 0166 8F77 andi r24,lo8(127)483 0168 8093 0000 sts status,r24484 016c 00C0 rjmp .L42485 .L30:245:I2CInterface.c **** break;246:I2CInterface.c ****247:I2CInterface.c **** case TW_MR_SLA_ACK: /* Slave acknowledged address */248:I2CInterface.c **** if(--twi_bytes > 0)486 .stabn 68,0,248,.LM48-.LFBB5487 .LM48:488 016e 8091 0000 lds r24,twi_bytes489 0172 8150 subi r24,lo8(-(-1))490 0174 8093 0000 sts twi_bytes,r24491 0178 8091 0000 lds r24,twi_bytes492 017c 8823 tst r24493 017e 01F0 breq .L38GAS LISTING /tmp/ccfEG7oP.s page 14249:I2CInterface.c **** {250:I2CInterface.c **** /* if there is more than one byte to read, acknowledge */251:I2CInterface.c **** TWCR |= (1<<TWEA)|(1<<TWINT);494 .stabn 68,0,251,.LM49-.LFBB5495 .LM49:496 0180 86B7 in r24,86-0x20497 0182 806C ori r24,lo8(-64)498 0184 86BF out 86-0x20,r24499 0186 00C0 rjmp .L42500 .L38:252:I2CInterface.c **** }253:I2CInterface.c **** else254:I2CInterface.c **** {255:I2CInterface.c **** /* no acknowledge */256:I2CInterface.c **** TWCR |= (1<<TWINT);501 .stabn 68,0,256,.LM50-.LFBB5502 .LM50:503 0188 86B7 in r24,86-0x20504 018a 8068 ori r24,lo8(-128)505 018c 86BF out 86-0x20,r24506 018e 00C0 rjmp .L42507 .L31:257:I2CInterface.c **** }258:I2CInterface.c **** break;259:I2CInterface.c ****260:I2CInterface.c **** case TW_MR_DATA_ACK: /* Master acknowledged data */261:I2CInterface.c ****262:I2CInterface.c **** /* grab the received data */263:I2CInterface.c **** *twi_data = TWDR;508 .stabn 68,0,263,.LM51-.LFBB5509 .LM51:510 0190 E091 0000 lds r30,twi_data511 0194 F091 0000 lds r31,(twi_data)+1512 0198 83B1 in r24,35-0x20513 019a 8193 st Z+,r24264:I2CInterface.c **** twi_data++;514 .stabn 68,0,264,.LM52-.LFBB5515 .LM52:516 019c F093 0000 sts (twi_data)+1,r31517 01a0 E093 0000 sts twi_data,r30265:I2CInterface.c **** if(--twi_bytes > 0)518 .stabn 68,0,265,.LM53-.LFBB5519 .LM53:520 01a4 8091 0000 lds r24,twi_bytes521 01a8 8150 subi r24,lo8(-(-1))522 01aa 8093 0000 sts twi_bytes,r24523 01ae 8091 0000 lds r24,twi_bytes524 01b2 8823 tst r24525 01b4 01F0 breq .L40266:I2CInterface.c **** {267:I2CInterface.c **** /* get the next data byte and ack */268:I2CInterface.c **** TWCR |= (1<<TWEA)|(1<<TWINT);526 .stabn 68,0,268,.LM54-.LFBB5527 .LM54:528 01b6 86B7 in r24,86-0x20529 01b8 806C ori r24,lo8(-64)530 01ba 86BF out 86-0x20,r24GAS LISTING /tmp/ccfEG7oP.s page 15531 01bc 00C0 rjmp .L42532 .L40:269:I2CInterface.c **** }270:I2CInterface.c **** else271:I2CInterface.c **** {272:I2CInterface.c **** /* clear out the enable acknowledge bit */273:I2CInterface.c **** TWCR &= ~(1<<TWEA);533 .stabn 68,0,273,.LM55-.LFBB5534 .LM55:535 01be 86B7 in r24,86-0x20536 01c0 8F7B andi r24,lo8(-65)537 01c2 86BF out 86-0x20,r24538 01c4 00C0 rjmp .L42539 .L32:274:I2CInterface.c **** }275:I2CInterface.c **** break;276:I2CInterface.c ****277:I2CInterface.c **** case TW_MR_DATA_NACK: /* Master didn't acknowledge data -> end of read process */278:I2CInterface.c **** /* read data, and generate the stop condition */279:I2CInterface.c **** *twi_data = TWDR;540 .stabn 68,0,279,.LM56-.LFBB5541 .LM56:542 01c6 E091 0000 lds r30,twi_data543 01ca F091 0000 lds r31,(twi_data)+1544 01ce 83B1 in r24,35-0x20545 01d0 8083 st Z,r24280:I2CInterface.c **** TWCR |= (1<<TWSTO)|(1<<TWINT);546 .stabn 68,0,280,.LM57-.LFBB5547 .LM57:548 01d2 86B7 in r24,86-0x20549 01d4 8069 ori r24,lo8(-112)550 01d6 86BF out 86-0x20,r24281:I2CInterface.c **** status &= ~(1<<BUSY);551 .stabn 68,0,281,.LM58-.LFBB5552 .LM58:553 01d8 8091 0000 lds r24,status554 01dc 8F77 andi r24,lo8(127)555 01de 8093 0000 sts status,r24556 .L42:557 /* epilogue: frame size=0 */558 01e2 FF91 pop r31559 01e4 EF91 pop r30560 01e6 BF91 pop r27561 01e8 AF91 pop r26562 01ea 9F91 pop r25563 01ec 8F91 pop r24564 01ee 0F90 pop __tmp_reg__565 01f0 0FBE out __SREG__,__tmp_reg__566 01f2 0F90 pop __tmp_reg__567 01f4 1F90 pop __zero_reg__568 01f6 1895 reti569 /* epilogue end (size=11) */570 /* function __vector_17 size 268 (246) */571 .size __vector_17, .-__vector_17572 .Lscope5:573 .stabs "",36,0,0,.Lscope5-.LFBB5574 .stabd 78,0,0GAS LISTING /tmp/ccfEG7oP.s page 16575 .lcomm twi_address,1576 .lcomm twi_data,2577 .lcomm twi_ddr,1578 .lcomm twi_bytes,1579 .lcomm status,1580 .lcomm retry_cnt,1581 .stabs "twi_address:S(0,17)=B(0,11)",40,0,59,twi_address582 .stabs "twi_data:S(0,18)=*(0,17)",40,0,60,twi_data583 .stabs "twi_ddr:S(0,17)",40,0,61,twi_ddr584 .stabs "twi_bytes:S(0,17)",40,0,62,twi_bytes585 .stabs "status:S(0,17)",40,0,63,status586 .stabs "retry_cnt:S(0,17)",40,0,64,retry_cnt587 .stabs "",100,0,0,.Letext0588 .Letext0:589 /* File "I2CInterface.c": code 333 = 0x014d ( 307), prologues 11, epilogues 15 */GAS LISTING /tmp/ccfEG7oP.s page 17DEFINED SYMBOLS*ABS*:00000000 I2CInterface.c/tmp/ccfEG7oP.s:2 *ABS*:0000003f __SREG__/tmp/ccfEG7oP.s:3 *ABS*:0000003e __SP_H__/tmp/ccfEG7oP.s:4 *ABS*:0000003d __SP_L__/tmp/ccfEG7oP.s:5 *ABS*:00000000 __tmp_reg__/tmp/ccfEG7oP.s:6 *ABS*:00000001 __zero_reg__/tmp/ccfEG7oP.s:78 .text:00000000 I2CInt_init/tmp/ccfEG7oP.s:106 .text:00000008 I2CInt_writeData/tmp/ccfEG7oP.s:578 .bss:00000005 status.bss:00000000 twi_address/tmp/ccfEG7oP.s:575 .bss:00000001 twi_data/tmp/ccfEG7oP.s:577 .bss:00000004 twi_bytes/tmp/ccfEG7oP.s:576 .bss:00000003 twi_ddr/tmp/ccfEG7oP.s:579 .bss:00000006 retry_cnt/tmp/ccfEG7oP.s:165 .text:00000040 I2CInt_readData/tmp/ccfEG7oP.s:216 .text:00000074 I2CInt_isI2cBusy/tmp/ccfEG7oP.s:243 .text:00000082 __vector_17UNDEFINED SYMBOLS__do_copy_data__do_clear_bss