Subversion Repositories svnkaklik

Rev

Rev 410 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
484 kaklik 1
GAS LISTING /tmp/ccfEG7oP.s 			page 1
174 kaklik 2
 
3
 
4
   1               		.file	"I2CInterface.c"
484 kaklik 5
   2               	__SREG__ = 0x3f
6
   3               	__SP_H__ = 0x3e
7
   4               	__SP_L__ = 0x3d
8
   5               	__tmp_reg__ = 0
9
   6               	__zero_reg__ = 1
10
   7               		.global __do_copy_data
11
   8               		.global __do_clear_bss
12
   9               		.stabs	"/home/kaklik/projects/programy/C/avr/AVRcam/",100,0,2,.Ltext0
13
  10               		.stabs	"I2CInterface.c",100,0,2,.Ltext0
14
  11               		.text
15
  12               	.Ltext0:
16
  13               		.stabs	"gcc2_compiled.",60,0,0,0
17
  14               		.stabs	"int:t(0,1)=r(0,1);-32768;32767;",128,0,0,0
18
  15               		.stabs	"char:t(0,2)=@s8;r(0,2);0;255;",128,0,0,0
19
  16               		.stabs	"long int:t(0,3)=@s32;r(0,3);020000000000;017777777777;",128,0,0,0
20
  17               		.stabs	"unsigned int:t(0,4)=r(0,4);0;0177777;",128,0,0,0
21
  18               		.stabs	"long unsigned int:t(0,5)=@s32;r(0,5);0;037777777777;",128,0,0,0
22
  19               		.stabs	"long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;",128,0,0,
23
  20               		.stabs	"long long unsigned int:t(0,7)=@s64;r(0,7);0;01777777777777777777777;",128,0,0,0
24
  21               		.stabs	"short int:t(0,8)=r(0,8);-32768;32767;",128,0,0,0
25
  22               		.stabs	"short unsigned int:t(0,9)=r(0,9);0;0177777;",128,0,0,0
26
  23               		.stabs	"signed char:t(0,10)=@s8;r(0,10);-128;127;",128,0,0,0
27
  24               		.stabs	"unsigned char:t(0,11)=@s8;r(0,11);0;255;",128,0,0,0
28
  25               		.stabs	"float:t(0,12)=r(0,1);4;0;",128,0,0,0
29
  26               		.stabs	"double:t(0,13)=r(0,1);4;0;",128,0,0,0
30
  27               		.stabs	"long double:t(0,14)=r(0,1);4;0;",128,0,0,0
31
  28               		.stabs	"void:t(0,15)=(0,15)",128,0,0,0
32
  29               		.stabs	"/usr/lib/gcc/avr/4.2.1/../../../../avr/include/avr/io.h",130,0,0,0
33
  30               		.stabs	"/usr/lib/gcc/avr/4.2.1/../../../../avr/include/avr/sfr_defs.h",130,0,0,0
34
  31               		.stabs	"/usr/lib/gcc/avr/4.2.1/../../../../avr/include/inttypes.h",130,0,0,0
35
  32               		.stabs	"/usr/lib/gcc/avr/4.2.1/../../../../avr/include/stdint.h",130,0,0,0
36
  33               		.stabs	"int8_t:t(4,1)=(0,10)",128,0,116,0
37
  34               		.stabs	"uint8_t:t(4,2)=(0,11)",128,0,117,0
38
  35               		.stabs	"int16_t:t(4,3)=(0,1)",128,0,118,0
39
  36               		.stabs	"uint16_t:t(4,4)=(0,4)",128,0,119,0
40
  37               		.stabs	"int32_t:t(4,5)=(0,3)",128,0,120,0
41
  38               		.stabs	"uint32_t:t(4,6)=(0,5)",128,0,121,0
42
  39               		.stabs	"int64_t:t(4,7)=(0,6)",128,0,122,0
43
  40               		.stabs	"uint64_t:t(4,8)=(0,7)",128,0,123,0
44
  41               		.stabs	"intptr_t:t(4,9)=(4,3)",128,0,135,0
45
  42               		.stabs	"uintptr_t:t(4,10)=(4,4)",128,0,140,0
46
  43               		.stabs	"int_least8_t:t(4,11)=(4,1)",128,0,152,0
47
  44               		.stabs	"uint_least8_t:t(4,12)=(4,2)",128,0,157,0
48
  45               		.stabs	"int_least16_t:t(4,13)=(4,3)",128,0,162,0
49
  46               		.stabs	"uint_least16_t:t(4,14)=(4,4)",128,0,167,0
50
  47               		.stabs	"int_least32_t:t(4,15)=(4,5)",128,0,172,0
51
  48               		.stabs	"uint_least32_t:t(4,16)=(4,6)",128,0,177,0
52
  49               		.stabs	"int_least64_t:t(4,17)=(4,7)",128,0,182,0
53
  50               		.stabs	"uint_least64_t:t(4,18)=(4,8)",128,0,187,0
54
  51               		.stabs	"int_fast8_t:t(4,19)=(4,1)",128,0,200,0
55
  52               		.stabs	"uint_fast8_t:t(4,20)=(4,2)",128,0,205,0
56
  53               		.stabs	"int_fast16_t:t(4,21)=(4,3)",128,0,210,0
57
  54               		.stabs	"uint_fast16_t:t(4,22)=(4,4)",128,0,215,0
58
  55               		.stabs	"int_fast32_t:t(4,23)=(4,5)",128,0,220,0
59
  56               		.stabs	"uint_fast32_t:t(4,24)=(4,6)",128,0,225,0
60
  57               		.stabs	"int_fast64_t:t(4,25)=(4,7)",128,0,230,0
61
GAS LISTING /tmp/ccfEG7oP.s 			page 2
174 kaklik 62
 
63
 
484 kaklik 64
  58               		.stabs	"uint_fast64_t:t(4,26)=(4,8)",128,0,235,0
65
  59               		.stabs	"intmax_t:t(4,27)=(4,7)",128,0,249,0
66
  60               		.stabs	"uintmax_t:t(4,28)=(4,8)",128,0,254,0
67
  61               		.stabn	162,0,0,0
68
  62               		.stabs	"int_farptr_t:t(3,1)=(4,5)",128,0,76,0
69
  63               		.stabs	"uint_farptr_t:t(3,2)=(4,6)",128,0,80,0
70
  64               		.stabn	162,0,0,0
174 kaklik 71
  65               		.stabn	162,0,0,0
72
  66               		.stabn	162,0,0,0
484 kaklik 73
  67               		.stabs	"CamConfig.h",130,0,0,0
74
  68               		.stabs	"I2CInterface.h",130,0,0,0
75
  69               		.stabs	"CommonDefs.h",130,0,0,0
76
  70               		.stabs	"bool_t:t(7,1)=(0,11)",128,0,56,0
77
  71               		.stabn	162,0,0,0
78
  72               		.stabs	"i2cCmd_t:t(6,1)=(6,2)=s2configReg:(0,11),0,8;data:(0,11),8,8;;",128,0,53,0
79
  73               		.stabn	162,0,0,0
174 kaklik 80
  74               		.stabn	162,0,0,0
484 kaklik 81
  75               		.stabs	"I2CInt_init:F(0,15)",36,0,85,I2CInt_init
82
  76               	.global	I2CInt_init
83
  77               		.type	I2CInt_init, @function
84
  78               	I2CInt_init:
85
  79               		.stabd	46,0,0
174 kaklik 86
   1:I2CInterface.c **** /*
87
   2:I2CInterface.c ****     Copyright (C) 2004    John Orlando
88
   3:I2CInterface.c ****     
89
   4:I2CInterface.c ****    AVRcam: a small real-time image processing engine.
90
   5:I2CInterface.c **** 
91
   6:I2CInterface.c ****     This program is free software; you can redistribute it and/or
92
   7:I2CInterface.c ****     modify it under the terms of the GNU General Public
93
   8:I2CInterface.c ****     License as published by the Free Software Foundation; either
94
   9:I2CInterface.c ****     version 2 of the License, or (at your option) any later version.
95
  10:I2CInterface.c **** 
96
  11:I2CInterface.c ****     This program is distributed in the hope that it will be useful,
97
  12:I2CInterface.c ****     but WITHOUT ANY WARRANTY; without even the implied warranty of
98
  13:I2CInterface.c ****     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
99
  14:I2CInterface.c ****     General Public License for more details.
100
  15:I2CInterface.c **** 
101
  16:I2CInterface.c ****     You should have received a copy of the GNU General Public
102
  17:I2CInterface.c ****     License along with this program; if not, write to the Free Software
103
  18:I2CInterface.c ****     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
104
  19:I2CInterface.c **** 
105
  20:I2CInterface.c ****    For more information on the AVRcam, please contact:
106
  21:I2CInterface.c **** 
107
  22:I2CInterface.c ****    john@jrobot.net
108
  23:I2CInterface.c **** 
109
  24:I2CInterface.c ****    or go to www.jrobot.net for more details regarding the system.
110
  25:I2CInterface.c **** */
111
  26:I2CInterface.c **** /***********************************************************
112
  27:I2CInterface.c **** 	Module Name: I2CInterface.c
113
  28:I2CInterface.c **** 	Module Date: 4/10/2004
114
  29:I2CInterface.c **** 	Module Auth: John Orlando
115
  30:I2CInterface.c **** 	
116
  31:I2CInterface.c **** 	Description: This module is responsible for providing a
117
  32:I2CInterface.c **** 	low-level interface to the I2C hardware resident on the
118
  33:I2CInterface.c **** 	mega8 processor (also known as the Two-Wire Interface,
119
  34:I2CInterface.c **** 	or TWI).  The interface is needed to configure the
484 kaklik 120
  35:I2CInterface.c **** 	needed registers in the OV6620 camera.  This interface
121
GAS LISTING /tmp/ccfEG7oP.s 			page 3
174 kaklik 122
 
123
 
124
  36:I2CInterface.c **** 	is interrupt-driven based on the events that should
125
  37:I2CInterface.c **** 	occur upon successful writing of an I2C register.
126
  38:I2CInterface.c ****     
127
  39:I2CInterface.c ****     Revision History:
128
  40:I2CInterface.c ****     Date        Rel Ver.    Notes
129
  41:I2CInterface.c ****     4/10/2004      0.1     Module created
130
  42:I2CInterface.c ****     6/30/2004      1.0     Initial release for Circuit Cellar
131
  43:I2CInterface.c ****                            contest.
132
  44:I2CInterface.c **** 
133
  45:I2CInterface.c **** ***********************************************************/
134
  46:I2CInterface.c **** 
135
  47:I2CInterface.c **** /*	Includes */
136
  48:I2CInterface.c **** #include <avr/io.h>
137
  49:I2CInterface.c **** #include <util/twi.h>
138
  50:I2CInterface.c **** #include <avr/interrupt.h>
139
  51:I2CInterface.c **** #include "CamConfig.h"
140
  52:I2CInterface.c **** #include "CommonDefs.h"
141
  53:I2CInterface.c **** 
142
  54:I2CInterface.c **** /*  Local Variables */
143
  55:I2CInterface.c **** 
144
  56:I2CInterface.c **** /* These variables are used as storage space for the current
145
  57:I2CInterface.c ****    I2C command being sent over the interface.  They need to
146
  58:I2CInterface.c ****    be volatile since they are dealt with an the TWI ISR */
147
  59:I2CInterface.c **** volatile static unsigned char twi_address;
148
  60:I2CInterface.c **** volatile static unsigned char *twi_data;
149
  61:I2CInterface.c **** volatile static unsigned char twi_ddr;
150
  62:I2CInterface.c **** volatile static unsigned char twi_bytes;
151
  63:I2CInterface.c **** volatile static unsigned char status;
152
  64:I2CInterface.c **** volatile static unsigned char retry_cnt;
153
  65:I2CInterface.c **** 
154
  66:I2CInterface.c **** /* 	Local Structures and Typedefs */
155
  67:I2CInterface.c **** 
156
  68:I2CInterface.c **** /*  Extern Variables */
157
  69:I2CInterface.c **** 
158
  70:I2CInterface.c **** /*  Definitions */
159
  71:I2CInterface.c **** /* Bit definitions for the tw_status register */
160
  72:I2CInterface.c **** #define MAX_TWI_RETRIES 2
161
  73:I2CInterface.c **** #define BUSY 7
162
  74:I2CInterface.c **** 
163
  75:I2CInterface.c **** /***********************************************************
164
  76:I2CInterface.c **** 	Function Name: I2CInt_init
165
  77:I2CInterface.c **** 	Function Description: This function is responsible
166
  78:I2CInterface.c **** 	for setting up the registers needed for the TWI 
167
  79:I2CInterface.c **** 	interface
168
  80:I2CInterface.c **** 	
169
  81:I2CInterface.c **** 	Inputs:  none
170
  82:I2CInterface.c **** 	Outputs: none
171
  83:I2CInterface.c **** ***********************************************************/	
172
  84:I2CInterface.c **** void I2CInt_init(void)
173
  85:I2CInterface.c **** {
484 kaklik 174
  80               		.stabn	68,0,85,.LM0-.LFBB1
175
  81               	.LM0:
176
  82               	.LFBB1:
174 kaklik 177
  83               	/* prologue: frame size=0 */
178
  84               	/* prologue end (size=0) */
179
  86:I2CInterface.c **** 	TWSR = 0;
484 kaklik 180
  85               		.stabn	68,0,86,.LM1-.LFBB1
181
GAS LISTING /tmp/ccfEG7oP.s 			page 4
174 kaklik 182
 
183
 
184
  86               	.LM1:
185
  87 0000 11B8      		out 33-0x20,__zero_reg__
186
  87:I2CInterface.c ****     
187
  88:I2CInterface.c **** 	/* init the speed of the I2C interface, running at
188
  89:I2CInterface.c ****     100 Kbps */
189
  90:I2CInterface.c **** 	TWBR = (FOSC / I2C_SPEED - 16)/2;
484 kaklik 190
  88               		.stabn	68,0,90,.LM2-.LFBB1
174 kaklik 191
  89               	.LM2:
192
  90 0002 88E4      		ldi r24,lo8(72)
193
  91 0004 80B9      		out 32-0x20,r24
194
  92               	/* epilogue: frame size=0 */
195
  93 0006 0895      		ret
196
  94               	/* epilogue end (size=1) */
197
  95               	/* function I2CInt_init size 4 (3) */
198
  96               		.size	I2CInt_init, .-I2CInt_init
484 kaklik 199
  97               	.Lscope1:
200
  98               		.stabs	"",36,0,0,.Lscope1-.LFBB1
174 kaklik 201
  99               		.stabd	78,0,0
202
 100               		.stabs	"I2CInt_writeData:F(0,15)",36,0,108,I2CInt_writeData
203
 101               		.stabs	"address:P(0,11)",64,0,107,25
204
 102               		.stabs	"data:P(0,16)=*(0,11)",64,0,107,22
205
 103               		.stabs	"bytes:P(0,11)",64,0,107,20
206
 104               	.global	I2CInt_writeData
207
 105               		.type	I2CInt_writeData, @function
208
 106               	I2CInt_writeData:
209
 107               		.stabd	46,0,0
210
  91:I2CInterface.c **** }
211
  92:I2CInterface.c **** 
212
  93:I2CInterface.c **** /***********************************************************
213
  94:I2CInterface.c **** 	Function Name: I2CInt_writeData
214
  95:I2CInterface.c **** 	Function Description: This function is responsible for
215
  96:I2CInterface.c **** 	initiating the process of writing a sequence of bytes
216
  97:I2CInterface.c **** 	an I2C slave address.  This function will try to write
217
  98:I2CInterface.c **** 	the data three times before giving up.
218
  99:I2CInterface.c **** 	Inputs: address: the address of the I2C slave device
219
 100:I2CInterface.c **** 			data: a pointer to the data to be written 
220
 101:I2CInterface.c **** 				  to the slave...for camera interfacing,
221
 102:I2CInterface.c **** 				  the data follows a <register #><data>
222
 103:I2CInterface.c **** 				  format
223
 104:I2CInterface.c **** 			bytes: the number of bytes to write 
224
 105:I2CInterface.c **** 	Outputs: none
225
 106:I2CInterface.c **** ***********************************************************/
226
 107:I2CInterface.c **** void I2CInt_writeData(unsigned char address, unsigned char *data, unsigned char bytes)
227
 108:I2CInterface.c **** {
484 kaklik 228
 108               		.stabn	68,0,108,.LM3-.LFBB2
174 kaklik 229
 109               	.LM3:
484 kaklik 230
 110               	.LFBB2:
231
 111               	/* prologue: frame size=0 */
232
 112               	/* prologue end (size=0) */
233
 113 0008 982F      		mov r25,r24
234
 114               	.L5:
174 kaklik 235
 109:I2CInterface.c **** 	while(status & (1<<BUSY));		/* Bus is busy wait (or exit with error code) */
484 kaklik 236
 115               		.stabn	68,0,109,.LM4-.LFBB2
237
 116               	.LM4:
238
 117 000a 8091 0000 		lds r24,status
239
 118 000e 8823      		tst r24
240
 119 0010 04F0      		brlt .L5
241
GAS LISTING /tmp/ccfEG7oP.s 			page 5
174 kaklik 242
 
243
 
484 kaklik 244
 120               	.L9:
174 kaklik 245
 110:I2CInterface.c **** 	while(TWCR & (1<<TWSTO));
484 kaklik 246
 121               		.stabn	68,0,110,.LM5-.LFBB2
247
 122               	.LM5:
248
 123 0012 06B6      		in __tmp_reg__,86-0x20
249
 124 0014 04FC      		sbrc __tmp_reg__,4
250
 125 0016 00C0      		rjmp .L9
174 kaklik 251
 111:I2CInterface.c **** 	
252
 112:I2CInterface.c **** 	/* copy the needed data and state info to our local I2C command structure */
253
 113:I2CInterface.c **** 	twi_address = address;
484 kaklik 254
 126               		.stabn	68,0,113,.LM6-.LFBB2
255
 127               	.LM6:
256
 128 0018 9093 0000 		sts twi_address,r25
174 kaklik 257
 114:I2CInterface.c **** 	twi_data = data;
484 kaklik 258
 129               		.stabn	68,0,114,.LM7-.LFBB2
259
 130               	.LM7:
260
 131 001c 7093 0000 		sts (twi_data)+1,r23
261
 132 0020 6093 0000 		sts twi_data,r22
174 kaklik 262
 115:I2CInterface.c **** 	twi_bytes = bytes;
484 kaklik 263
 133               		.stabn	68,0,115,.LM8-.LFBB2
264
 134               	.LM8:
265
 135 0024 4093 0000 		sts twi_bytes,r20
174 kaklik 266
 116:I2CInterface.c **** 	twi_ddr = TW_WRITE;
484 kaklik 267
 136               		.stabn	68,0,116,.LM9-.LFBB2
268
 137               	.LM9:
269
 138 0028 1092 0000 		sts twi_ddr,__zero_reg__
174 kaklik 270
 117:I2CInterface.c **** 
271
 118:I2CInterface.c **** 	retry_cnt = 0;
484 kaklik 272
 139               		.stabn	68,0,118,.LM10-.LFBB2
273
 140               	.LM10:
274
 141 002c 1092 0000 		sts retry_cnt,__zero_reg__
174 kaklik 275
 119:I2CInterface.c **** 	
276
 120:I2CInterface.c **** 	/* Generate start condition, the remainder of the transfer is interrupt driven and
277
 121:I2CInterface.c **** 	   will be performed in the background */
278
 122:I2CInterface.c **** 	TWCR = (1<<TWINT)|(1<<TWSTA)|(1<<TWEN)|(1<<TWIE);
484 kaklik 279
 142               		.stabn	68,0,122,.LM11-.LFBB2
280
 143               	.LM11:
281
 144 0030 85EA      		ldi r24,lo8(-91)
282
 145 0032 86BF      		out 86-0x20,r24
174 kaklik 283
 123:I2CInterface.c **** 	
284
 124:I2CInterface.c **** 	status |= (1<<BUSY);
484 kaklik 285
 146               		.stabn	68,0,124,.LM12-.LFBB2
286
 147               	.LM12:
287
 148 0034 8091 0000 		lds r24,status
288
 149 0038 8068      		ori r24,lo8(-128)
289
 150 003a 8093 0000 		sts status,r24
290
 151               	/* epilogue: frame size=0 */
291
 152 003e 0895      		ret
292
 153               	/* epilogue end (size=1) */
293
 154               	/* function I2CInt_writeData size 28 (27) */
294
 155               		.size	I2CInt_writeData, .-I2CInt_writeData
295
 156               	.Lscope2:
296
 157               		.stabs	"",36,0,0,.Lscope2-.LFBB2
297
 158               		.stabd	78,0,0
298
 159               		.stabs	"I2CInt_readData:F(0,15)",36,0,138,I2CInt_readData
299
 160               		.stabs	"address:P(0,11)",64,0,137,25
300
 161               		.stabs	"data:P(0,16)",64,0,137,22
301
GAS LISTING /tmp/ccfEG7oP.s 			page 6
174 kaklik 302
 
303
 
484 kaklik 304
 162               		.stabs	"bytes:P(0,11)",64,0,137,20
305
 163               	.global	I2CInt_readData
306
 164               		.type	I2CInt_readData, @function
307
 165               	I2CInt_readData:
308
 166               		.stabd	46,0,0
174 kaklik 309
 125:I2CInterface.c **** }
310
 126:I2CInterface.c **** 
311
 127:I2CInterface.c **** /***********************************************************
312
 128:I2CInterface.c **** 	Function Name: I2CInt_readData
313
 129:I2CInterface.c **** 	Function Description: This funcion is responsible for
314
 130:I2CInterface.c **** 	reading the specified number of bytes from a slave
315
 131:I2CInterface.c **** 	device.
316
 132:I2CInterface.c **** 	Inputs:  address: the slave address to read from
317
 133:I2CInterface.c **** 			 data: a pointer to where the data will be stored
318
 134:I2CInterface.c **** 			 bytes: the number of bytes to read
319
 135:I2CInterface.c **** 	Outputs: none
320
 136:I2CInterface.c **** ***********************************************************/
321
 137:I2CInterface.c **** void I2CInt_readData(unsigned char address, unsigned char *data, unsigned char bytes)
322
 138:I2CInterface.c **** {
484 kaklik 323
 167               		.stabn	68,0,138,.LM13-.LFBB3
324
 168               	.LM13:
325
 169               	.LFBB3:
326
 170               	/* prologue: frame size=0 */
327
 171               	/* prologue end (size=0) */
328
 172 0040 982F      		mov r25,r24
329
 173               	.L15:
174 kaklik 330
 139:I2CInterface.c ****     /* Bus is busy wait (or exit with error code) */
331
 140:I2CInterface.c **** 	while(status & (1<<BUSY));									
484 kaklik 332
 174               		.stabn	68,0,140,.LM14-.LFBB3
333
 175               	.LM14:
334
 176 0042 8091 0000 		lds r24,status
335
 177 0046 8823      		tst r24
336
 178 0048 04F0      		brlt .L15
174 kaklik 337
 141:I2CInterface.c **** 
338
 142:I2CInterface.c **** 	twi_address = address;
484 kaklik 339
 179               		.stabn	68,0,142,.LM15-.LFBB3
340
 180               	.LM15:
341
 181 004a 9093 0000 		sts twi_address,r25
174 kaklik 342
 143:I2CInterface.c **** 	twi_data = data;
484 kaklik 343
 182               		.stabn	68,0,143,.LM16-.LFBB3
344
 183               	.LM16:
345
 184 004e 7093 0000 		sts (twi_data)+1,r23
346
 185 0052 6093 0000 		sts twi_data,r22
174 kaklik 347
 144:I2CInterface.c **** 	twi_bytes = bytes;
484 kaklik 348
 186               		.stabn	68,0,144,.LM17-.LFBB3
349
 187               	.LM17:
350
 188 0056 4093 0000 		sts twi_bytes,r20
174 kaklik 351
 145:I2CInterface.c **** 	twi_ddr = TW_READ;
484 kaklik 352
 189               		.stabn	68,0,145,.LM18-.LFBB3
353
 190               	.LM18:
354
 191 005a 81E0      		ldi r24,lo8(1)
355
 192 005c 8093 0000 		sts twi_ddr,r24
174 kaklik 356
 146:I2CInterface.c **** 
357
 147:I2CInterface.c **** 	retry_cnt = 0;
484 kaklik 358
 193               		.stabn	68,0,147,.LM19-.LFBB3
359
 194               	.LM19:
360
 195 0060 1092 0000 		sts retry_cnt,__zero_reg__
361
GAS LISTING /tmp/ccfEG7oP.s 			page 7
362
 
363
 
174 kaklik 364
 148:I2CInterface.c **** 	
365
 149:I2CInterface.c **** 	/* Generate start condition, the remainder of the transfer is interrupt driven and
366
 150:I2CInterface.c **** 	   will be performed in the background */
367
 151:I2CInterface.c **** 	TWCR = (1<<TWINT)|(1<<TWSTA)|(1<<TWEN)|(1<<TWIE);
484 kaklik 368
 196               		.stabn	68,0,151,.LM20-.LFBB3
369
 197               	.LM20:
370
 198 0064 85EA      		ldi r24,lo8(-91)
371
 199 0066 86BF      		out 86-0x20,r24
174 kaklik 372
 152:I2CInterface.c **** 	
373
 153:I2CInterface.c **** 	status |= (1<<BUSY);
484 kaklik 374
 200               		.stabn	68,0,153,.LM21-.LFBB3
375
 201               	.LM21:
376
 202 0068 8091 0000 		lds r24,status
377
 203 006c 8068      		ori r24,lo8(-128)
378
 204 006e 8093 0000 		sts status,r24
379
 205               	/* epilogue: frame size=0 */
380
 206 0072 0895      		ret
381
 207               	/* epilogue end (size=1) */
382
 208               	/* function I2CInt_readData size 26 (25) */
383
 209               		.size	I2CInt_readData, .-I2CInt_readData
384
 210               	.Lscope3:
385
 211               		.stabs	"",36,0,0,.Lscope3-.LFBB3
386
 212               		.stabd	78,0,0
387
 213               		.stabs	"I2CInt_isI2cBusy:F(7,1)",36,0,166,I2CInt_isI2cBusy
388
 214               	.global	I2CInt_isI2cBusy
389
 215               		.type	I2CInt_isI2cBusy, @function
390
 216               	I2CInt_isI2cBusy:
391
 217               		.stabd	46,0,0
174 kaklik 392
 154:I2CInterface.c **** }
393
 155:I2CInterface.c **** 
394
 156:I2CInterface.c **** /***********************************************************
395
 157:I2CInterface.c **** 	Function Name: I2CInt_isI2cBusy
396
 158:I2CInterface.c **** 	Function Description: This funcion is responsible for
397
 159:I2CInterface.c **** 	indicating if the I2C bus is currently busy to external
398
 160:I2CInterface.c **** 	modules.
399
 161:I2CInterface.c **** 	device.
400
 162:I2CInterface.c **** 	Inputs:  none
401
 163:I2CInterface.c **** 	Outputs: bool_t - indicating if bus is busy
402
 164:I2CInterface.c **** ***********************************************************/
403
 165:I2CInterface.c **** bool_t I2CInt_isI2cBusy(void)
404
 166:I2CInterface.c **** {
484 kaklik 405
 218               		.stabn	68,0,166,.LM22-.LFBB4
406
 219               	.LM22:
407
 220               	.LFBB4:
408
 221               	/* prologue: frame size=0 */
409
 222               	/* prologue end (size=0) */
174 kaklik 410
 167:I2CInterface.c **** 	bool_t retVal = FALSE;
411
 168:I2CInterface.c **** 	if ( (status & (1<<BUSY)) != 0)
484 kaklik 412
 223               		.stabn	68,0,168,.LM23-.LFBB4
413
 224               	.LM23:
414
 225 0074 8091 0000 		lds r24,status
415
 226 0078 881F      		rol r24
416
 227 007a 8827      		clr r24
417
 228 007c 881F      		rol r24
174 kaklik 418
 169:I2CInterface.c **** 	{
419
 170:I2CInterface.c **** 		retVal = TRUE;
420
 171:I2CInterface.c **** 	}
484 kaklik 421
GAS LISTING /tmp/ccfEG7oP.s 			page 8
422
 
423
 
174 kaklik 424
 172:I2CInterface.c **** 	
425
 173:I2CInterface.c **** 	return(retVal);
426
 174:I2CInterface.c **** }
484 kaklik 427
 229               		.stabn	68,0,174,.LM24-.LFBB4
428
 230               	.LM24:
429
 231 007e 9927      		clr r25
430
 232               	/* epilogue: frame size=0 */
431
 233 0080 0895      		ret
432
 234               	/* epilogue end (size=1) */
433
 235               	/* function I2CInt_isI2cBusy size 7 (6) */
434
 236               		.size	I2CInt_isI2cBusy, .-I2CInt_isI2cBusy
435
 237               	.Lscope4:
436
 238               		.stabs	"",36,0,0,.Lscope4-.LFBB4
437
 239               		.stabd	78,0,0
438
 240               		.stabs	"__vector_17:F(0,15)",36,0,185,__vector_17
439
 241               	.global	__vector_17
440
 242               		.type	__vector_17, @function
441
 243               	__vector_17:
442
 244               		.stabd	46,0,0
174 kaklik 443
 175:I2CInterface.c **** 
444
 176:I2CInterface.c **** /***********************************************************
445
 177:I2CInterface.c **** 	Function Name: <interrupt handler for I2C>
446
 178:I2CInterface.c **** 	Function Description: This function is responsible for
447
 179:I2CInterface.c **** 	implementing the control logic needed to perform a
448
 180:I2CInterface.c **** 	read or write operation with an I2C slave.
449
 181:I2CInterface.c **** 	Inputs:  none
450
 182:I2CInterface.c **** 	Outputs: none
451
 183:I2CInterface.c **** ***********************************************************/
452
 184:I2CInterface.c **** SIGNAL(SIG_2WIRE_SERIAL)
453
 185:I2CInterface.c **** {
484 kaklik 454
 245               		.stabn	68,0,185,.LM25-.LFBB5
455
 246               	.LM25:
456
 247               	.LFBB5:
457
 248               	/* prologue: frame size=0 */
458
 249 0082 1F92      		push __zero_reg__
459
 250 0084 0F92      		push __tmp_reg__
460
 251 0086 0FB6      		in __tmp_reg__,__SREG__
461
 252 0088 0F92      		push __tmp_reg__
462
 253 008a 1124      		clr __zero_reg__
463
 254 008c 8F93      		push r24
464
 255 008e 9F93      		push r25
465
 256 0090 AF93      		push r26
466
 257 0092 BF93      		push r27
467
 258 0094 EF93      		push r30
468
 259 0096 FF93      		push r31
469
 260               	/* prologue end (size=11) */
174 kaklik 470
 186:I2CInterface.c **** 	unsigned char TWI_status = TWSR & TW_STATUS_MASK;   /* grab just the status bits */
484 kaklik 471
 261               		.stabn	68,0,186,.LM26-.LFBB5
472
 262               	.LM26:
473
 263 0098 81B1      		in r24,33-0x20
174 kaklik 474
 187:I2CInterface.c **** 	
475
 188:I2CInterface.c ****     /* the entire I2C handler is state-based...determine
476
 189:I2CInterface.c ****     what needs to be done based on TWI_status */
477
 190:I2CInterface.c **** 	switch(TWI_status) 
484 kaklik 478
 264               		.stabn	68,0,190,.LM27-.LFBB5
479
 265               	.LM27:
480
 266 009a 9927      		clr r25
481
GAS LISTING /tmp/ccfEG7oP.s 			page 9
174 kaklik 482
 
483
 
484 kaklik 484
 267 009c AA27      		clr r26
485
 268 009e BB27      		clr r27
486
 269 00a0 887F      		andi r24,lo8(248)
487
 270 00a2 9070      		andi r25,hi8(248)
488
 271 00a4 A070      		andi r26,hlo8(248)
489
 272 00a6 B070      		andi r27,hhi8(248)
490
 273 00a8 FC01      		movw r30,r24
491
 274 00aa 3897      		sbiw r30,8
492
 275 00ac E135      		cpi r30,81
493
 276 00ae F105      		cpc r31,__zero_reg__
494
 277 00b0 00F0      		brlo .+2
495
 278 00b2 00C0      		rjmp .L42
496
 279               		.stabn	68,0,190,.LM28-.LFBB5
497
 280               	.LM28:
498
 281 00b4 E050      		subi r30,lo8(-(pm(.L33)))
499
 282 00b6 F040      		sbci r31,hi8(-(pm(.L33)))
500
 283 00b8 0994      		ijmp
174 kaklik 501
 284               		.data
502
 285               		.section .progmem.gcc_sw_table, "ax", @progbits
503
 286               		.p2align 1
484 kaklik 504
 287               	.L33:
505
 288               		.data
506
 289               		.section .progmem.gcc_sw_table, "ax", @progbits
507
 290               		.p2align 1
508
 291 0000 00C0      		rjmp .L25
509
 292 0002 00C0      		rjmp .L42
510
 293 0004 00C0      		rjmp .L42
511
 294 0006 00C0      		rjmp .L42
512
 295 0008 00C0      		rjmp .L42
513
 296 000a 00C0      		rjmp .L42
514
 297 000c 00C0      		rjmp .L42
515
 298 000e 00C0      		rjmp .L42
516
 299 0010 00C0      		rjmp .L25
517
 300 0012 00C0      		rjmp .L42
518
 301 0014 00C0      		rjmp .L42
519
 302 0016 00C0      		rjmp .L42
520
 303 0018 00C0      		rjmp .L42
521
 304 001a 00C0      		rjmp .L42
522
 305 001c 00C0      		rjmp .L42
523
 306 001e 00C0      		rjmp .L42
524
 307 0020 00C0      		rjmp .L26
525
 308 0022 00C0      		rjmp .L42
526
 309 0024 00C0      		rjmp .L42
527
 310 0026 00C0      		rjmp .L42
528
 311 0028 00C0      		rjmp .L42
529
 312 002a 00C0      		rjmp .L42
530
 313 002c 00C0      		rjmp .L42
531
 314 002e 00C0      		rjmp .L42
532
 315 0030 00C0      		rjmp .L27
533
 316 0032 00C0      		rjmp .L42
534
 317 0034 00C0      		rjmp .L42
535
 318 0036 00C0      		rjmp .L42
536
 319 0038 00C0      		rjmp .L42
537
 320 003a 00C0      		rjmp .L42
538
 321 003c 00C0      		rjmp .L42
539
 322 003e 00C0      		rjmp .L42
540
 323 0040 00C0      		rjmp .L28
541
GAS LISTING /tmp/ccfEG7oP.s 			page 10
174 kaklik 542
 
543
 
484 kaklik 544
 324 0042 00C0      		rjmp .L42
545
 325 0044 00C0      		rjmp .L42
546
 326 0046 00C0      		rjmp .L42
547
 327 0048 00C0      		rjmp .L42
548
 328 004a 00C0      		rjmp .L42
549
 329 004c 00C0      		rjmp .L42
550
 330 004e 00C0      		rjmp .L42
551
 331 0050 00C0      		rjmp .L29
552
 332 0052 00C0      		rjmp .L42
553
 333 0054 00C0      		rjmp .L42
554
 334 0056 00C0      		rjmp .L42
555
 335 0058 00C0      		rjmp .L42
556
 336 005a 00C0      		rjmp .L42
557
 337 005c 00C0      		rjmp .L42
558
 338 005e 00C0      		rjmp .L42
559
 339 0060 00C0      		rjmp .L42
560
 340 0062 00C0      		rjmp .L42
561
 341 0064 00C0      		rjmp .L42
562
 342 0066 00C0      		rjmp .L42
563
 343 0068 00C0      		rjmp .L42
564
 344 006a 00C0      		rjmp .L42
565
 345 006c 00C0      		rjmp .L42
566
 346 006e 00C0      		rjmp .L42
567
 347 0070 00C0      		rjmp .L30
568
 348 0072 00C0      		rjmp .L42
569
 349 0074 00C0      		rjmp .L42
570
 350 0076 00C0      		rjmp .L42
571
 351 0078 00C0      		rjmp .L42
572
 352 007a 00C0      		rjmp .L42
573
 353 007c 00C0      		rjmp .L42
574
 354 007e 00C0      		rjmp .L42
575
 355 0080 00C0      		rjmp .L27
576
 356 0082 00C0      		rjmp .L42
577
 357 0084 00C0      		rjmp .L42
578
 358 0086 00C0      		rjmp .L42
579
 359 0088 00C0      		rjmp .L42
580
 360 008a 00C0      		rjmp .L42
581
 361 008c 00C0      		rjmp .L42
582
 362 008e 00C0      		rjmp .L42
583
 363 0090 00C0      		rjmp .L31
584
 364 0092 00C0      		rjmp .L42
585
 365 0094 00C0      		rjmp .L42
586
 366 0096 00C0      		rjmp .L42
587
 367 0098 00C0      		rjmp .L42
588
 368 009a 00C0      		rjmp .L42
589
 369 009c 00C0      		rjmp .L42
590
 370 009e 00C0      		rjmp .L42
591
 371 00a0 00C0      		rjmp .L32
592
 372               		.text
593
 373               	.L25:
174 kaklik 594
 191:I2CInterface.c ****     {
595
 192:I2CInterface.c ****         case TW_START:									/* Start condition */
596
 193:I2CInterface.c ****         case TW_REP_START:								/* Repeated start condition */
597
 194:I2CInterface.c ****             if(retry_cnt > MAX_TWI_RETRIES) 
484 kaklik 598
 374               		.stabn	68,0,194,.LM29-.LFBB5
599
 375               	.LM29:
600
 376 00ba 8091 0000 		lds r24,retry_cnt
601
GAS LISTING /tmp/ccfEG7oP.s 			page 11
602
 
603
 
604
 377 00be 8330      		cpi r24,lo8(3)
605
 378 00c0 00F0      		brlo .L34
174 kaklik 606
 195:I2CInterface.c ****             {
607
 196:I2CInterface.c ****                 /* generate stop condition if we've reached our retry limit */
608
 197:I2CInterface.c ****                 TWCR |= (1<<TWINT)|(1<<TWSTO);					
484 kaklik 609
 379               		.stabn	68,0,197,.LM30-.LFBB5
610
 380               	.LM30:
611
 381 00c2 86B7      		in r24,86-0x20
612
 382 00c4 8069      		ori r24,lo8(-112)
613
 383 00c6 86BF      		out 86-0x20,r24
174 kaklik 614
 198:I2CInterface.c ****                 status &= ~(1<<BUSY);								
484 kaklik 615
 384               		.stabn	68,0,198,.LM31-.LFBB5
616
 385               	.LM31:
617
 386 00c8 8091 0000 		lds r24,status
618
 387 00cc 8F77      		andi r24,lo8(127)
619
 388 00ce 8093 0000 		sts status,r24
620
 389 00d2 00C0      		rjmp .L42
621
 390               	.L34:
174 kaklik 622
 199:I2CInterface.c ****                 return;												
623
 200:I2CInterface.c ****             }
624
 201:I2CInterface.c ****             /* indicate read or write */
625
 202:I2CInterface.c ****             TWDR = (twi_address<<1) + twi_ddr;	
484 kaklik 626
 391               		.stabn	68,0,202,.LM32-.LFBB5
627
 392               	.LM32:
628
 393 00d4 8091 0000 		lds r24,twi_address
629
 394 00d8 9091 0000 		lds r25,twi_ddr
630
 395 00dc 880F      		lsl r24
631
 396 00de 890F      		add r24,r25
632
 397 00e0 83B9      		out 35-0x20,r24
174 kaklik 633
 203:I2CInterface.c ****             /* TWSTA must be cleared...also clears TWINT */
634
 204:I2CInterface.c ****             TWCR &= ~(1<<TWSTA);
484 kaklik 635
 398               		.stabn	68,0,204,.LM33-.LFBB5
636
 399               	.LM33:
637
 400 00e2 86B7      		in r24,86-0x20
638
 401 00e4 8F7D      		andi r24,lo8(-33)
639
 402 00e6 86BF      		out 86-0x20,r24
640
 403 00e8 00C0      		rjmp .L42
641
 404               	.L26:
174 kaklik 642
 205:I2CInterface.c ****             break;
643
 206:I2CInterface.c **** 
644
 207:I2CInterface.c ****         case TW_MT_SLA_ACK:							/* Slave acknowledged address, */
645
 208:I2CInterface.c ****             retry_cnt = 0;					
484 kaklik 646
 405               		.stabn	68,0,208,.LM34-.LFBB5
647
 406               	.LM34:
648
 407 00ea 1092 0000 		sts retry_cnt,__zero_reg__
174 kaklik 649
 209:I2CInterface.c ****             /* tx the data, and increment the data pointer */
650
 210:I2CInterface.c ****             TWDR = *twi_data;										
484 kaklik 651
 408               		.stabn	68,0,210,.LM35-.LFBB5
652
 409               	.LM35:
653
 410 00ee E091 0000 		lds r30,twi_data
654
 411 00f2 F091 0000 		lds r31,(twi_data)+1
655
 412 00f6 8191      		ld r24,Z+
656
 413 00f8 83B9      		out 35-0x20,r24
174 kaklik 657
 211:I2CInterface.c ****             twi_data++;			
484 kaklik 658
 414               		.stabn	68,0,211,.LM36-.LFBB5
659
 415               	.LM36:
660
 416 00fa F093 0000 		sts (twi_data)+1,r31
661
GAS LISTING /tmp/ccfEG7oP.s 			page 12
662
 
663
 
664
 417 00fe E093 0000 		sts twi_data,r30
174 kaklik 665
 212:I2CInterface.c **** 
666
 213:I2CInterface.c ****             /* clear the int to continue */
667
 214:I2CInterface.c ****             TWCR |= (1<<TWINT);						
484 kaklik 668
 418               		.stabn	68,0,214,.LM37-.LFBB5
669
 419               	.LM37:
670
 420 0102 86B7      		in r24,86-0x20
671
 421 0104 8068      		ori r24,lo8(-128)
672
 422 0106 86BF      		out 86-0x20,r24
673
 423 0108 00C0      		rjmp .L42
674
 424               	.L27:
174 kaklik 675
 215:I2CInterface.c ****             break;
676
 216:I2CInterface.c **** 
677
 217:I2CInterface.c ****         case TW_MT_SLA_NACK:							/* Slave didn't acknowledge address, */
678
 218:I2CInterface.c ****         case TW_MR_SLA_NACK:
679
 219:I2CInterface.c ****             retry_cnt++;		
484 kaklik 680
 425               		.stabn	68,0,219,.LM38-.LFBB5
681
 426               	.LM38:
682
 427 010a 8091 0000 		lds r24,retry_cnt
683
 428 010e 8F5F      		subi r24,lo8(-(1))
684
 429 0110 8093 0000 		sts retry_cnt,r24
174 kaklik 685
 220:I2CInterface.c **** 
686
 221:I2CInterface.c ****             /* retry...*/
687
 222:I2CInterface.c ****             TWCR |= (1<<TWINT)|(1<<TWSTA)|(1<<TWSTO);	
484 kaklik 688
 430               		.stabn	68,0,222,.LM39-.LFBB5
689
 431               	.LM39:
690
 432 0114 86B7      		in r24,86-0x20
691
 433 0116 806B      		ori r24,lo8(-80)
692
 434 0118 86BF      		out 86-0x20,r24
693
 435 011a 00C0      		rjmp .L42
694
 436               	.L28:
174 kaklik 695
 223:I2CInterface.c ****             break;
696
 224:I2CInterface.c **** 
697
 225:I2CInterface.c ****         case TW_MT_DATA_ACK:							/* Slave Acknowledged data, */
698
 226:I2CInterface.c ****             if(--twi_bytes > 0) 
484 kaklik 699
 437               		.stabn	68,0,226,.LM40-.LFBB5
700
 438               	.LM40:
701
 439 011c 8091 0000 		lds r24,twi_bytes
702
 440 0120 8150      		subi r24,lo8(-(-1))
703
 441 0122 8093 0000 		sts twi_bytes,r24
704
 442 0126 8091 0000 		lds r24,twi_bytes
705
 443 012a 8823      		tst r24
706
 444 012c 01F0      		breq .L36
174 kaklik 707
 227:I2CInterface.c ****             {						
708
 228:I2CInterface.c ****                 /* more data to send, so send it */
709
 229:I2CInterface.c ****                 TWDR = *twi_data;									
484 kaklik 710
 445               		.stabn	68,0,229,.LM41-.LFBB5
711
 446               	.LM41:
712
 447 012e E091 0000 		lds r30,twi_data
713
 448 0132 F091 0000 		lds r31,(twi_data)+1
714
 449 0136 8191      		ld r24,Z+
715
 450 0138 83B9      		out 35-0x20,r24
174 kaklik 716
 230:I2CInterface.c ****                 twi_data++;											
484 kaklik 717
 451               		.stabn	68,0,230,.LM42-.LFBB5
718
 452               	.LM42:
719
 453 013a F093 0000 		sts (twi_data)+1,r31
720
 454 013e E093 0000 		sts twi_data,r30
721
GAS LISTING /tmp/ccfEG7oP.s 			page 13
174 kaklik 722
 
723
 
484 kaklik 724
 231:I2CInterface.c ****                 TWCR |= (1<<TWINT);								
725
 455               		.stabn	68,0,231,.LM43-.LFBB5
726
 456               	.LM43:
727
 457 0142 86B7      		in r24,86-0x20
728
 458 0144 8068      		ori r24,lo8(-128)
729
 459 0146 86BF      		out 86-0x20,r24
730
 460 0148 00C0      		rjmp .L42
731
 461               	.L36:
174 kaklik 732
 232:I2CInterface.c ****             }
733
 233:I2CInterface.c ****             else 
734
 234:I2CInterface.c ****             {
735
 235:I2CInterface.c ****                 /* generate the stop condition if needed */
736
 236:I2CInterface.c ****                 TWCR |= (1<<TWSTO)|(1<<TWINT);					
484 kaklik 737
 462               		.stabn	68,0,236,.LM44-.LFBB5
738
 463               	.LM44:
739
 464 014a 86B7      		in r24,86-0x20
740
 465 014c 8069      		ori r24,lo8(-112)
741
 466 014e 86BF      		out 86-0x20,r24
174 kaklik 742
 237:I2CInterface.c ****                 status &= ~(1<<BUSY);								
484 kaklik 743
 467               		.stabn	68,0,237,.LM45-.LFBB5
744
 468               	.LM45:
745
 469 0150 8091 0000 		lds r24,status
746
 470 0154 8F77      		andi r24,lo8(127)
747
 471 0156 8093 0000 		sts status,r24
748
 472 015a 00C0      		rjmp .L42
749
 473               	.L29:
174 kaklik 750
 238:I2CInterface.c ****             }
751
 239:I2CInterface.c ****             break;
752
 240:I2CInterface.c **** 
753
 241:I2CInterface.c ****         case TW_MT_DATA_NACK:							/* Slave didn't acknowledge data */
754
 242:I2CInterface.c ****             /* send the stop condition */
755
 243:I2CInterface.c ****             TWCR |= (1<<TWINT)|(1<<TWSTO);						
484 kaklik 756
 474               		.stabn	68,0,243,.LM46-.LFBB5
757
 475               	.LM46:
758
 476 015c 86B7      		in r24,86-0x20
759
 477 015e 8069      		ori r24,lo8(-112)
760
 478 0160 86BF      		out 86-0x20,r24
174 kaklik 761
 244:I2CInterface.c ****             status &= ~(1<<BUSY);									
484 kaklik 762
 479               		.stabn	68,0,244,.LM47-.LFBB5
763
 480               	.LM47:
764
 481 0162 8091 0000 		lds r24,status
765
 482 0166 8F77      		andi r24,lo8(127)
766
 483 0168 8093 0000 		sts status,r24
767
 484 016c 00C0      		rjmp .L42
768
 485               	.L30:
174 kaklik 769
 245:I2CInterface.c ****             break;
770
 246:I2CInterface.c **** 
771
 247:I2CInterface.c ****         case TW_MR_SLA_ACK:                             /* Slave acknowledged address */
772
 248:I2CInterface.c ****             if(--twi_bytes > 0) 
484 kaklik 773
 486               		.stabn	68,0,248,.LM48-.LFBB5
774
 487               	.LM48:
775
 488 016e 8091 0000 		lds r24,twi_bytes
776
 489 0172 8150      		subi r24,lo8(-(-1))
777
 490 0174 8093 0000 		sts twi_bytes,r24
778
 491 0178 8091 0000 		lds r24,twi_bytes
779
 492 017c 8823      		tst r24
780
 493 017e 01F0      		breq .L38
781
GAS LISTING /tmp/ccfEG7oP.s 			page 14
782
 
783
 
174 kaklik 784
 249:I2CInterface.c ****             {
785
 250:I2CInterface.c ****                 /* if there is more than one byte to read, acknowledge */
786
 251:I2CInterface.c ****                 TWCR |= (1<<TWEA)|(1<<TWINT);	
484 kaklik 787
 494               		.stabn	68,0,251,.LM49-.LFBB5
788
 495               	.LM49:
789
 496 0180 86B7      		in r24,86-0x20
790
 497 0182 806C      		ori r24,lo8(-64)
791
 498 0184 86BF      		out 86-0x20,r24
792
 499 0186 00C0      		rjmp .L42
793
 500               	.L38:
174 kaklik 794
 252:I2CInterface.c ****             }
795
 253:I2CInterface.c **** 			else
796
 254:I2CInterface.c ****             {
797
 255:I2CInterface.c ****                 /* no acknowledge */
798
 256:I2CInterface.c ****                 TWCR |= (1<<TWINT);					
484 kaklik 799
 501               		.stabn	68,0,256,.LM50-.LFBB5
800
 502               	.LM50:
801
 503 0188 86B7      		in r24,86-0x20
802
 504 018a 8068      		ori r24,lo8(-128)
803
 505 018c 86BF      		out 86-0x20,r24
804
 506 018e 00C0      		rjmp .L42
805
 507               	.L31:
174 kaklik 806
 257:I2CInterface.c ****             }
807
 258:I2CInterface.c ****             break;
808
 259:I2CInterface.c **** 
809
 260:I2CInterface.c ****         case TW_MR_DATA_ACK: 							/* Master acknowledged data */
810
 261:I2CInterface.c ****         
811
 262:I2CInterface.c ****             /* grab the received data */
812
 263:I2CInterface.c ****             *twi_data = TWDR;										
484 kaklik 813
 508               		.stabn	68,0,263,.LM51-.LFBB5
814
 509               	.LM51:
815
 510 0190 E091 0000 		lds r30,twi_data
816
 511 0194 F091 0000 		lds r31,(twi_data)+1
817
 512 0198 83B1      		in r24,35-0x20
818
 513 019a 8193      		st Z+,r24
174 kaklik 819
 264:I2CInterface.c ****             twi_data++;											
484 kaklik 820
 514               		.stabn	68,0,264,.LM52-.LFBB5
821
 515               	.LM52:
822
 516 019c F093 0000 		sts (twi_data)+1,r31
823
 517 01a0 E093 0000 		sts twi_data,r30
174 kaklik 824
 265:I2CInterface.c ****             if(--twi_bytes > 0) 
484 kaklik 825
 518               		.stabn	68,0,265,.LM53-.LFBB5
826
 519               	.LM53:
827
 520 01a4 8091 0000 		lds r24,twi_bytes
828
 521 01a8 8150      		subi r24,lo8(-(-1))
829
 522 01aa 8093 0000 		sts twi_bytes,r24
830
 523 01ae 8091 0000 		lds r24,twi_bytes
831
 524 01b2 8823      		tst r24
832
 525 01b4 01F0      		breq .L40
174 kaklik 833
 266:I2CInterface.c ****             {
834
 267:I2CInterface.c ****                 /* get the next data byte and ack */
835
 268:I2CInterface.c ****                 TWCR |= (1<<TWEA)|(1<<TWINT);	
484 kaklik 836
 526               		.stabn	68,0,268,.LM54-.LFBB5
837
 527               	.LM54:
838
 528 01b6 86B7      		in r24,86-0x20
839
 529 01b8 806C      		ori r24,lo8(-64)
840
 530 01ba 86BF      		out 86-0x20,r24
841
GAS LISTING /tmp/ccfEG7oP.s 			page 15
174 kaklik 842
 
843
 
484 kaklik 844
 531 01bc 00C0      		rjmp .L42
845
 532               	.L40:
174 kaklik 846
 269:I2CInterface.c ****             }
847
 270:I2CInterface.c ****             else
848
 271:I2CInterface.c ****             {
849
 272:I2CInterface.c ****                 /* clear out the enable acknowledge bit */
850
 273:I2CInterface.c ****                 TWCR &= ~(1<<TWEA);							
484 kaklik 851
 533               		.stabn	68,0,273,.LM55-.LFBB5
852
 534               	.LM55:
853
 535 01be 86B7      		in r24,86-0x20
854
 536 01c0 8F7B      		andi r24,lo8(-65)
855
 537 01c2 86BF      		out 86-0x20,r24
856
 538 01c4 00C0      		rjmp .L42
857
 539               	.L32:
174 kaklik 858
 274:I2CInterface.c ****             }
859
 275:I2CInterface.c ****             break;
860
 276:I2CInterface.c **** 
861
 277:I2CInterface.c ****         case TW_MR_DATA_NACK:						/* Master didn't acknowledge data -> end of read process */
862
 278:I2CInterface.c ****             /* read data, and generate the stop condition */
863
 279:I2CInterface.c ****             *twi_data = TWDR;										
484 kaklik 864
 540               		.stabn	68,0,279,.LM56-.LFBB5
865
 541               	.LM56:
866
 542 01c6 E091 0000 		lds r30,twi_data
867
 543 01ca F091 0000 		lds r31,(twi_data)+1
868
 544 01ce 83B1      		in r24,35-0x20
869
 545 01d0 8083      		st Z,r24
174 kaklik 870
 280:I2CInterface.c ****             TWCR |= (1<<TWSTO)|(1<<TWINT); 						
484 kaklik 871
 546               		.stabn	68,0,280,.LM57-.LFBB5
872
 547               	.LM57:
873
 548 01d2 86B7      		in r24,86-0x20
874
 549 01d4 8069      		ori r24,lo8(-112)
875
 550 01d6 86BF      		out 86-0x20,r24
174 kaklik 876
 281:I2CInterface.c ****             status &= ~(1<<BUSY);											
484 kaklik 877
 551               		.stabn	68,0,281,.LM58-.LFBB5
878
 552               	.LM58:
879
 553 01d8 8091 0000 		lds r24,status
880
 554 01dc 8F77      		andi r24,lo8(127)
881
 555 01de 8093 0000 		sts status,r24
882
 556               	.L42:
883
 557               	/* epilogue: frame size=0 */
884
 558 01e2 FF91      		pop r31
885
 559 01e4 EF91      		pop r30
886
 560 01e6 BF91      		pop r27
887
 561 01e8 AF91      		pop r26
888
 562 01ea 9F91      		pop r25
889
 563 01ec 8F91      		pop r24
890
 564 01ee 0F90      		pop __tmp_reg__
891
 565 01f0 0FBE      		out __SREG__,__tmp_reg__
892
 566 01f2 0F90      		pop __tmp_reg__
893
 567 01f4 1F90      		pop __zero_reg__
894
 568 01f6 1895      		reti
895
 569               	/* epilogue end (size=11) */
896
 570               	/* function __vector_17 size 268 (246) */
897
 571               		.size	__vector_17, .-__vector_17
898
 572               	.Lscope5:
899
 573               		.stabs	"",36,0,0,.Lscope5-.LFBB5
900
 574               		.stabd	78,0,0
901
GAS LISTING /tmp/ccfEG7oP.s 			page 16
174 kaklik 902
 
903
 
484 kaklik 904
 575               		.lcomm twi_address,1
905
 576               		.lcomm twi_data,2
906
 577               		.lcomm twi_ddr,1
907
 578               		.lcomm twi_bytes,1
908
 579               		.lcomm status,1
909
 580               		.lcomm retry_cnt,1
910
 581               		.stabs	"twi_address:S(0,17)=B(0,11)",40,0,59,twi_address
911
 582               		.stabs	"twi_data:S(0,18)=*(0,17)",40,0,60,twi_data
912
 583               		.stabs	"twi_ddr:S(0,17)",40,0,61,twi_ddr
913
 584               		.stabs	"twi_bytes:S(0,17)",40,0,62,twi_bytes
914
 585               		.stabs	"status:S(0,17)",40,0,63,status
915
 586               		.stabs	"retry_cnt:S(0,17)",40,0,64,retry_cnt
916
 587               		.stabs	"",100,0,0,.Letext0
917
 588               	.Letext0:
918
 589               	/* File "I2CInterface.c": code  333 = 0x014d ( 307), prologues  11, epilogues  15 */
919
GAS LISTING /tmp/ccfEG7oP.s 			page 17
174 kaklik 920
 
921
 
922
DEFINED SYMBOLS
923
                            *ABS*:00000000 I2CInterface.c
484 kaklik 924
     /tmp/ccfEG7oP.s:2      *ABS*:0000003f __SREG__
925
     /tmp/ccfEG7oP.s:3      *ABS*:0000003e __SP_H__
926
     /tmp/ccfEG7oP.s:4      *ABS*:0000003d __SP_L__
927
     /tmp/ccfEG7oP.s:5      *ABS*:00000000 __tmp_reg__
928
     /tmp/ccfEG7oP.s:6      *ABS*:00000001 __zero_reg__
929
     /tmp/ccfEG7oP.s:78     .text:00000000 I2CInt_init
930
     /tmp/ccfEG7oP.s:106    .text:00000008 I2CInt_writeData
931
     /tmp/ccfEG7oP.s:578    .bss:00000005 status
174 kaklik 932
                             .bss:00000000 twi_address
484 kaklik 933
     /tmp/ccfEG7oP.s:575    .bss:00000001 twi_data
934
     /tmp/ccfEG7oP.s:577    .bss:00000004 twi_bytes
935
     /tmp/ccfEG7oP.s:576    .bss:00000003 twi_ddr
936
     /tmp/ccfEG7oP.s:579    .bss:00000006 retry_cnt
937
     /tmp/ccfEG7oP.s:165    .text:00000040 I2CInt_readData
938
     /tmp/ccfEG7oP.s:216    .text:00000074 I2CInt_isI2cBusy
939
     /tmp/ccfEG7oP.s:243    .text:00000082 __vector_17
174 kaklik 940
 
941
UNDEFINED SYMBOLS
942
__do_copy_data
943
__do_clear_bss