151 |
kaklik |
1 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 1
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
1 # 1 "CamInterfaceAsm.S"
|
|
|
5 |
2 # 1 "<built-in>"
|
|
|
6 |
1 ;
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
2 ; Copyright (C) 2004 John Orlando
|
|
|
10 |
3 ;
|
|
|
11 |
4 ; AVRcam: a small real-time image processing engine.
|
|
|
12 |
5
|
|
|
13 |
6 ; This program is free software; you can redistribute it and/or
|
|
|
14 |
7 ; modify it under the terms of the GNU General Public
|
|
|
15 |
8 ; License as published by the Free Software Foundation; either
|
|
|
16 |
9 ; version 2 of the License, or (at your option) any later version.
|
|
|
17 |
10
|
|
|
18 |
11 ; This program is distributed in the hope that it will be useful,
|
|
|
19 |
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
20 |
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
21 |
14 ; General Public License for more details.
|
|
|
22 |
15
|
|
|
23 |
16 ; You should have received a copy of the GNU General Public
|
|
|
24 |
17 ; License along with this program; if not, write to the Free Software
|
|
|
25 |
18 ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
26 |
19
|
|
|
27 |
20 ; For more information on the AVRcam, please contact:
|
|
|
28 |
21
|
|
|
29 |
22 ; john@jrobot.net
|
|
|
30 |
23
|
|
|
31 |
24 ; or go to www.jrobot.net for more details regarding the system.
|
|
|
32 |
25 ;**********************************************************************
|
|
|
33 |
26 ; Module Name: CanInterfaceAsm.S
|
|
|
34 |
27 ; Module Date: 04/14/2004
|
|
|
35 |
28 ; Module Auth: John Orlando
|
|
|
36 |
29 ;
|
|
|
37 |
30 ; Description: This module provides the low-level interface
|
|
|
38 |
31 ; to the OV6620 camera hardware. It is responsible for
|
|
|
39 |
32 ; acquiring each pixel block (R,G,B), performing the mapping
|
|
|
40 |
33 ; into an actual color (orange, purple, etc), run-length
|
|
|
41 |
34 ; encoding the data, and storing the info off to the appropriate
|
|
|
42 |
35 ; line buffer. This routine is synchronized with the pixel data
|
|
|
43 |
36 ; so that no polling of the camera data needs to be done (the
|
|
|
44 |
37 ; OV6620 is clocked off of the same crystal source as the mega8,
|
|
|
45 |
38 ; thus providing inherent synchronization between the two).
|
|
|
46 |
39 ;
|
|
|
47 |
40 ; Revision History:
|
|
|
48 |
41 ; Date Rel Ver. Notes
|
|
|
49 |
42 ; 4/10/2004 0.1 Module created
|
|
|
50 |
43 ; 6/30/2004 1.0 Initial release for Circuit Cellar
|
|
|
51 |
44 ; contest.
|
|
|
52 |
45 ; 1/16/2005 1.4 Fixed issue with the TCCR1B register
|
|
|
53 |
46 ; where PCLK was getting routed to the
|
|
|
54 |
47 ; timer1 even when it wasn't needed.
|
|
|
55 |
48 ; This caused excessive counter overflow
|
|
|
56 |
49 ; interrupts, and caused problems. Now,
|
|
|
57 |
50 ; the "PCLK" pipe feeds timer1 when needed,
|
|
|
58 |
51 ; and is turned off when it isn't needed.
|
|
|
59 |
52
|
|
|
60 |
53 #include <avr/io.h>
|
|
|
61 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 2
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
1 /* Copyright (c) 2002,2003 Marek Michalkiewicz, Joerg Wunsch
|
|
|
65 |
2 All rights reserved.
|
|
|
66 |
3
|
|
|
67 |
4 Redistribution and use in source and binary forms, with or without
|
|
|
68 |
5 modification, are permitted provided that the following conditions are met:
|
|
|
69 |
6
|
|
|
70 |
7 * Redistributions of source code must retain the above copyright
|
|
|
71 |
8 notice, this list of conditions and the following disclaimer.
|
|
|
72 |
9 * Redistributions in binary form must reproduce the above copyright
|
|
|
73 |
10 notice, this list of conditions and the following disclaimer in
|
|
|
74 |
11 the documentation and/or other materials provided with the
|
|
|
75 |
12 distribution.
|
|
|
76 |
13
|
|
|
77 |
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
78 |
15 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
79 |
16 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
80 |
17 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
81 |
18 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
82 |
19 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
83 |
20 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
84 |
21 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
85 |
22 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
86 |
23 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
87 |
24 POSSIBILITY OF SUCH DAMAGE. */
|
|
|
88 |
25
|
|
|
89 |
26 /* $Id: io.h,v 1.10 2003/02/28 23:03:40 marekm Exp $ */
|
|
|
90 |
27
|
|
|
91 |
28 /** \defgroup avr_io AVR device-specific IO definitions
|
|
|
92 |
29 \code #include <avr/io.h> \endcode
|
|
|
93 |
30
|
|
|
94 |
31 This header file includes the apropriate IO definitions for the
|
|
|
95 |
32 device that has been specified by the <tt>-mmcu=</tt> compiler
|
|
|
96 |
33 command-line switch. This is done by diverting to the appropriate
|
|
|
97 |
34 file <tt><avr/io</tt><em>XXXX</em><tt>.h></tt> which should
|
|
|
98 |
35 never be included directly. Some register names common to all
|
|
|
99 |
36 AVR devices are defined directly within <tt><avr/io.h></tt>,
|
|
|
100 |
37 but most of the details come from the respective include file.
|
|
|
101 |
38
|
|
|
102 |
39 Note that this file always includes
|
|
|
103 |
40 \code #include <avr/sfr_defs.h> \endcode
|
|
|
104 |
41 See \ref avr_sfr for the details.
|
|
|
105 |
42
|
|
|
106 |
43 Included are definitions of the IO register set and their
|
|
|
107 |
44 respective bit values as specified in the Atmel documentation.
|
|
|
108 |
45 Note that Atmel is not very consistent in its naming conventions,
|
|
|
109 |
46 so even identical functions sometimes get different names on
|
|
|
110 |
47 different devices.
|
|
|
111 |
48
|
|
|
112 |
49 Also included are the specific names useable for interrupt
|
|
|
113 |
50 function definitions as documented
|
|
|
114 |
51 \ref avr_signames "here".
|
|
|
115 |
52
|
|
|
116 |
53 Finally, the following macros are defined:
|
|
|
117 |
54
|
|
|
118 |
55 - \b RAMEND
|
|
|
119 |
56 <br>
|
|
|
120 |
57 A constant describing the last on-chip RAM location.
|
|
|
121 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 3
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
58 <br>
|
|
|
125 |
59 - \b XRAMEND
|
|
|
126 |
60 <br>
|
|
|
127 |
61 A constant describing the last possible location in RAM.
|
|
|
128 |
62 This is equal to RAMEND for devices that do not allow for
|
|
|
129 |
63 external RAM.
|
|
|
130 |
64 <br>
|
|
|
131 |
65 - \b E2END
|
|
|
132 |
66 <br>
|
|
|
133 |
67 A constant describing the address of the last EEPROM cell.
|
|
|
134 |
68 <br>
|
|
|
135 |
69 - \b FLASHEND
|
|
|
136 |
70 <br>
|
|
|
137 |
71 A constant describing the last byte address in flash ROM.
|
|
|
138 |
72 <br>
|
|
|
139 |
73 - \b SPM_PAGESIZE
|
|
|
140 |
74 <br>
|
|
|
141 |
75 For devices with bootloader support, the flash pagesize
|
|
|
142 |
76 (in bytes) to be used for the \c SPM instruction. */
|
|
|
143 |
77
|
|
|
144 |
78 #ifndef _AVR_IO_H_
|
|
|
145 |
79 #define _AVR_IO_H_
|
|
|
146 |
80
|
|
|
147 |
81 #include <avr/sfr_defs.h>
|
|
|
148 |
1 /* Copyright (c) 2002, Marek Michalkiewicz <marekm@amelek.gda.pl>
|
|
|
149 |
2 All rights reserved.
|
|
|
150 |
3
|
|
|
151 |
4 Redistribution and use in source and binary forms, with or without
|
|
|
152 |
5 modification, are permitted provided that the following conditions are met:
|
|
|
153 |
6
|
|
|
154 |
7 * Redistributions of source code must retain the above copyright
|
|
|
155 |
8 notice, this list of conditions and the following disclaimer.
|
|
|
156 |
9 * Redistributions in binary form must reproduce the above copyright
|
|
|
157 |
10 notice, this list of conditions and the following disclaimer in
|
|
|
158 |
11 the documentation and/or other materials provided with the
|
|
|
159 |
12 distribution.
|
|
|
160 |
13
|
|
|
161 |
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
162 |
15 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
163 |
16 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
164 |
17 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
165 |
18 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
166 |
19 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
167 |
20 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
168 |
21 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
169 |
22 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
170 |
23 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
171 |
24 POSSIBILITY OF SUCH DAMAGE. */
|
|
|
172 |
25
|
|
|
173 |
26 /* avr/sfr_defs.h - macros for accessing AVR special function registers */
|
|
|
174 |
27
|
|
|
175 |
28 /* $Id: sfr_defs.h,v 1.10 2003/08/11 21:42:13 troth Exp $ */
|
|
|
176 |
29
|
|
|
177 |
30 #ifndef _AVR_SFR_DEFS_H_
|
|
|
178 |
31 #define _AVR_SFR_DEFS_H_ 1
|
|
|
179 |
32
|
|
|
180 |
33 /** \defgroup avr_sfr_notes Additional notes from <avr/sfr_defs.h>
|
|
|
181 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 4
|
|
|
182 |
|
|
|
183 |
|
|
|
184 |
34 \ingroup avr_sfr
|
|
|
185 |
35
|
|
|
186 |
36 The \c <avr/sfr_defs.h> file is included by all of the \c <avr/ioXXXX.h>
|
|
|
187 |
37 files, which use macros defined here to make the special function register
|
|
|
188 |
38 definitions look like C variables or simple constants, depending on the
|
|
|
189 |
39 <tt>_SFR_ASM_COMPAT</tt> define. Some examples from \c <avr/iom128.h> to
|
|
|
190 |
40 show how to define such macros:
|
|
|
191 |
41
|
|
|
192 |
42 \code
|
|
|
193 |
43 #define PORTA _SFR_IO8(0x1b)
|
|
|
194 |
44 #define TCNT1 _SFR_IO16(0x2c)
|
|
|
195 |
45 #define PORTF _SFR_MEM8(0x61)
|
|
|
196 |
46 #define TCNT3 _SFR_MEM16(0x88)
|
|
|
197 |
47 \endcode
|
|
|
198 |
48
|
|
|
199 |
49 If \c _SFR_ASM_COMPAT is not defined, C programs can use names like
|
|
|
200 |
50 <tt>PORTA</tt> directly in C expressions (also on the left side of
|
|
|
201 |
51 assignment operators) and GCC will do the right thing (use short I/O
|
|
|
202 |
52 instructions if possible). The \c __SFR_OFFSET definition is not used in
|
|
|
203 |
53 any way in this case.
|
|
|
204 |
54
|
|
|
205 |
55 Define \c _SFR_ASM_COMPAT as 1 to make these names work as simple constants
|
|
|
206 |
56 (addresses of the I/O registers). This is necessary when included in
|
|
|
207 |
57 preprocessed assembler (*.S) source files, so it is done automatically if
|
|
|
208 |
58 \c __ASSEMBLER__ is defined. By default, all addresses are defined as if
|
|
|
209 |
59 they were memory addresses (used in \c lds/sts instructions). To use these
|
|
|
210 |
60 addresses in \c in/out instructions, you must subtract 0x20 from them.
|
|
|
211 |
61
|
|
|
212 |
62 For more backwards compatibility, insert the following at the start of your
|
|
|
213 |
63 old assembler source file:
|
|
|
214 |
64
|
|
|
215 |
65 \code
|
|
|
216 |
66 #define __SFR_OFFSET 0
|
|
|
217 |
67 \endcode
|
|
|
218 |
68
|
|
|
219 |
69 This automatically subtracts 0x20 from I/O space addresses, but it's a
|
|
|
220 |
70 hack, so it is recommended to change your source: wrap such addresses in
|
|
|
221 |
71 macros defined here, as shown below. After this is done, the
|
|
|
222 |
72 <tt>__SFR_OFFSET</tt> definition is no longer necessary and can be removed.
|
|
|
223 |
73
|
|
|
224 |
74 Real example - this code could be used in a boot loader that is portable
|
|
|
225 |
75 between devices with \c SPMCR at different addresses.
|
|
|
226 |
76
|
|
|
227 |
77 \verbatim
|
|
|
228 |
78 <avr/iom163.h>: #define SPMCR _SFR_IO8(0x37)
|
|
|
229 |
79 <avr/iom128.h>: #define SPMCR _SFR_MEM8(0x68)
|
|
|
230 |
80 \endverbatim
|
|
|
231 |
81
|
|
|
232 |
82 \code
|
|
|
233 |
82
|
|
|
234 |
83 /*
|
|
|
235 |
84 * Registers common to all AVR devices.
|
|
|
236 |
85 */
|
|
|
237 |
86
|
|
|
238 |
87 #if __AVR_ARCH__ != 1
|
|
|
239 |
88 /*
|
|
|
240 |
89 * AVR architecture 1 has no RAM, thus no stack pointer.
|
|
|
241 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 5
|
|
|
242 |
|
|
|
243 |
|
|
|
244 |
90 *
|
|
|
245 |
91 * All other archs do have a stack pointer. Some devices have only
|
|
|
246 |
92 * less than 256 bytes of possible RAM locations (128 Bytes of SRAM
|
|
|
247 |
93 * and no option for external RAM), thus SPH is officially "reserved"
|
|
|
248 |
94 * for them. We catch this case below after including the
|
|
|
249 |
95 * device-specific ioXXXX.h file, by examining XRAMEND, and
|
|
|
250 |
96 * #undef-ining SP and SPH in that case.
|
|
|
251 |
97 */
|
|
|
252 |
98 /* Stack Pointer */
|
|
|
253 |
99 #define SP _SFR_IO16(0x3D)
|
|
|
254 |
100 #define SPL _SFR_IO8(0x3D)
|
|
|
255 |
101 #define SPH _SFR_IO8(0x3E)
|
|
|
256 |
102 #endif /* #if __AVR_ARCH__ != 1 */
|
|
|
257 |
103
|
|
|
258 |
104 /* Status REGister */
|
|
|
259 |
105 #define SREG _SFR_IO8(0x3F)
|
|
|
260 |
106
|
|
|
261 |
107 /* Status Register - SREG */
|
|
|
262 |
108 #define SREG_I 7
|
|
|
263 |
109 #define SREG_T 6
|
|
|
264 |
110 #define SREG_H 5
|
|
|
265 |
111 #define SREG_S 4
|
|
|
266 |
112 #define SREG_V 3
|
|
|
267 |
113 #define SREG_N 2
|
|
|
268 |
114 #define SREG_Z 1
|
|
|
269 |
115 #define SREG_C 0
|
|
|
270 |
116
|
|
|
271 |
117 /* Pointer definition */
|
|
|
272 |
118 #if __AVR_ARCH__ != 1
|
|
|
273 |
119 /* avr1 has only the Z pointer */
|
|
|
274 |
120 #define XL r26
|
|
|
275 |
121 #define XH r27
|
|
|
276 |
122 #define YL r28
|
|
|
277 |
123 #define YH r29
|
|
|
278 |
124 #endif /* #if __AVR_ARCH__ != 1 */
|
|
|
279 |
125 #define ZL r30
|
|
|
280 |
126 #define ZH r31
|
|
|
281 |
127
|
|
|
282 |
128 /*
|
|
|
283 |
129 * Only few devices come without EEPROM. In order to assemble the
|
|
|
284 |
130 * EEPROM library components without defining a specific device, we
|
|
|
285 |
131 * keep the EEPROM-related definitions here, and catch the devices
|
|
|
286 |
132 * without EEPROM (E2END == 0) below. Obviously, the EEPROM library
|
|
|
287 |
133 * functions will not work for them. ;-)
|
|
|
288 |
134 */
|
|
|
289 |
135 /* EEPROM Control Register */
|
|
|
290 |
136 #define EECR _SFR_IO8(0x1C)
|
|
|
291 |
137
|
|
|
292 |
138 /* EEPROM Data Register */
|
|
|
293 |
139 #define EEDR _SFR_IO8(0x1D)
|
|
|
294 |
140
|
|
|
295 |
141 /* EEPROM Address Register */
|
|
|
296 |
142 #define EEAR _SFR_IO16(0x1E)
|
|
|
297 |
143 #define EEARL _SFR_IO8(0x1E)
|
|
|
298 |
144 #define EEARH _SFR_IO8(0x1F)
|
|
|
299 |
145
|
|
|
300 |
146 /* EEPROM Control Register */
|
|
|
301 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 6
|
|
|
302 |
|
|
|
303 |
|
|
|
304 |
147 #define EERIE 3
|
|
|
305 |
148 #define EEMWE 2
|
|
|
306 |
149 #define EEWE 1
|
|
|
307 |
150 #define EERE 0
|
|
|
308 |
151
|
|
|
309 |
152 #if defined (__AVR_AT94K__)
|
|
|
310 |
153 # include <avr/ioat94k.h>
|
|
|
311 |
154 #elif defined (__AVR_AT43USB320__)
|
|
|
312 |
155 # include <avr/io43u32x.h>
|
|
|
313 |
156 #elif defined (__AVR_AT43USB355__)
|
|
|
314 |
157 # include <avr/io43u35x.h>
|
|
|
315 |
158 #elif defined (__AVR_AT76C711__)
|
|
|
316 |
159 # include <avr/io76c711.h>
|
|
|
317 |
160 #elif defined (__AVR_AT86RF401__)
|
|
|
318 |
161 # include <avr/io86r401.h>
|
|
|
319 |
162 #elif defined (__AVR_ATmega128__)
|
|
|
320 |
163 # include <avr/iom128.h>
|
|
|
321 |
164 #elif defined (__AVR_ATmega64__)
|
|
|
322 |
165 # include <avr/iom64.h>
|
|
|
323 |
166 #elif defined (__AVR_ATmega103__)
|
|
|
324 |
167 # include <avr/iom103.h>
|
|
|
325 |
168 #elif defined (__AVR_ATmega32__)
|
|
|
326 |
169 # include <avr/iom32.h>
|
|
|
327 |
170 #elif defined (__AVR_ATmega323__)
|
|
|
328 |
171 # include <avr/iom323.h>
|
|
|
329 |
172 #elif defined (__AVR_ATmega16__)
|
|
|
330 |
173 # include <avr/iom16.h>
|
|
|
331 |
174 #elif defined (__AVR_ATmega161__)
|
|
|
332 |
175 # include <avr/iom161.h>
|
|
|
333 |
176 #elif defined (__AVR_ATmega162__)
|
|
|
334 |
177 # include <avr/iom162.h>
|
|
|
335 |
178 #elif defined (__AVR_ATmega163__)
|
|
|
336 |
179 # include <avr/iom163.h>
|
|
|
337 |
180 #elif defined (__AVR_ATmega169__)
|
|
|
338 |
181 # include <avr/iom169.h>
|
|
|
339 |
182 #elif defined (__AVR_ATmega8__)
|
|
|
340 |
183 # include <avr/iom8.h>
|
|
|
341 |
1 /* Copyright (c) 2002, Marek Michalkiewicz
|
|
|
342 |
2 All rights reserved.
|
|
|
343 |
3
|
|
|
344 |
4 Redistribution and use in source and binary forms, with or without
|
|
|
345 |
5 modification, are permitted provided that the following conditions are met:
|
|
|
346 |
6
|
|
|
347 |
7 * Redistributions of source code must retain the above copyright
|
|
|
348 |
8 notice, this list of conditions and the following disclaimer.
|
|
|
349 |
9 * Redistributions in binary form must reproduce the above copyright
|
|
|
350 |
10 notice, this list of conditions and the following disclaimer in
|
|
|
351 |
11 the documentation and/or other materials provided with the
|
|
|
352 |
12 distribution.
|
|
|
353 |
13
|
|
|
354 |
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
355 |
15 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
356 |
16 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
357 |
17 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
358 |
18 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
359 |
19 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
360 |
20 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
361 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 7
|
|
|
362 |
|
|
|
363 |
|
|
|
364 |
21 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
365 |
22 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
366 |
23 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
367 |
24 POSSIBILITY OF SUCH DAMAGE. */
|
|
|
368 |
25
|
|
|
369 |
26 /* $Id: iom8.h,v 1.8 2003/02/17 09:57:28 marekm Exp $ */
|
|
|
370 |
27
|
|
|
371 |
28 /* avr/iom8.h - definitions for ATmega8 */
|
|
|
372 |
29
|
|
|
373 |
30 #ifndef _AVR_IOM8_H_
|
|
|
374 |
31 #define _AVR_IOM8_H_ 1
|
|
|
375 |
32
|
|
|
376 |
33 /* This file should only be included from <avr/io.h>, never directly. */
|
|
|
377 |
34
|
|
|
378 |
35 #ifndef _AVR_IO_H_
|
|
|
379 |
36 # error "Include <avr/io.h> instead of this file."
|
|
|
380 |
37 #endif
|
|
|
381 |
38
|
|
|
382 |
39 #ifndef _AVR_IOXXX_H_
|
|
|
383 |
40 # define _AVR_IOXXX_H_ "iom8.h"
|
|
|
384 |
41 #else
|
|
|
385 |
42 # error "Attempt to include more than one <avr/ioXXX.h> file."
|
|
|
386 |
43 #endif
|
|
|
387 |
44
|
|
|
388 |
45 /* I/O registers */
|
|
|
389 |
46
|
|
|
390 |
47 /* TWI stands for "Two Wire Interface" or "TWI Was I2C(tm)" */
|
|
|
391 |
48 #define TWBR _SFR_IO8(0x00)
|
|
|
392 |
49 #define TWSR _SFR_IO8(0x01)
|
|
|
393 |
50 #define TWAR _SFR_IO8(0x02)
|
|
|
394 |
51 #define TWDR _SFR_IO8(0x03)
|
|
|
395 |
52
|
|
|
396 |
53 /* ADC */
|
|
|
397 |
54 #define ADCW _SFR_IO16(0x04)
|
|
|
398 |
55 #ifndef __ASSEMBLER__
|
|
|
399 |
56 #define ADC _SFR_IO16(0x04)
|
|
|
400 |
57 #endif
|
|
|
401 |
58 #define ADCL _SFR_IO8(0x04)
|
|
|
402 |
59 #define ADCH _SFR_IO8(0x05)
|
|
|
403 |
60 #define ADCSR _SFR_IO8(0x06)
|
|
|
404 |
61 #define ADCSRA _SFR_IO8(0x06) /* Changed in 2486H-AVR-09/02 */
|
|
|
405 |
62 #define ADMUX _SFR_IO8(0x07)
|
|
|
406 |
63
|
|
|
407 |
64 /* analog comparator */
|
|
|
408 |
65 #define ACSR _SFR_IO8(0x08)
|
|
|
409 |
66
|
|
|
410 |
67 /* USART */
|
|
|
411 |
68 #define UBRRL _SFR_IO8(0x09)
|
|
|
412 |
69 #define UCSRB _SFR_IO8(0x0A)
|
|
|
413 |
70 #define UCSRA _SFR_IO8(0x0B)
|
|
|
414 |
71 #define UDR _SFR_IO8(0x0C)
|
|
|
415 |
72
|
|
|
416 |
73 /* SPI */
|
|
|
417 |
74 #define SPCR _SFR_IO8(0x0D)
|
|
|
418 |
75 #define SPSR _SFR_IO8(0x0E)
|
|
|
419 |
76 #define SPDR _SFR_IO8(0x0F)
|
|
|
420 |
77
|
|
|
421 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 8
|
|
|
422 |
|
|
|
423 |
|
|
|
424 |
78 /* Port D */
|
|
|
425 |
79 #define PIND _SFR_IO8(0x10)
|
|
|
426 |
80 #define DDRD _SFR_IO8(0x11)
|
|
|
427 |
81 #define PORTD _SFR_IO8(0x12)
|
|
|
428 |
82
|
|
|
429 |
83 /* Port C */
|
|
|
430 |
84 #define PINC _SFR_IO8(0x13)
|
|
|
431 |
85 #define DDRC _SFR_IO8(0x14)
|
|
|
432 |
86 #define PORTC _SFR_IO8(0x15)
|
|
|
433 |
87
|
|
|
434 |
88 /* Port B */
|
|
|
435 |
89 #define PINB _SFR_IO8(0x16)
|
|
|
436 |
90 #define DDRB _SFR_IO8(0x17)
|
|
|
437 |
91 #define PORTB _SFR_IO8(0x18)
|
|
|
438 |
92
|
|
|
439 |
93 /* 0x1C..0x1F EEPROM */
|
|
|
440 |
94
|
|
|
441 |
95 #define UCSRC _SFR_IO8(0x20)
|
|
|
442 |
96 #define UBRRH _SFR_IO8(0x20)
|
|
|
443 |
97
|
|
|
444 |
98 #define WDTCR _SFR_IO8(0x21)
|
|
|
445 |
99 #define ASSR _SFR_IO8(0x22)
|
|
|
446 |
100
|
|
|
447 |
101 /* Timer 2 */
|
|
|
448 |
102 #define OCR2 _SFR_IO8(0x23)
|
|
|
449 |
103 #define TCNT2 _SFR_IO8(0x24)
|
|
|
450 |
104 #define TCCR2 _SFR_IO8(0x25)
|
|
|
451 |
105
|
|
|
452 |
106 /* Timer 1 */
|
|
|
453 |
107 #define ICR1 _SFR_IO16(0x26)
|
|
|
454 |
108 #define ICR1L _SFR_IO8(0x26)
|
|
|
455 |
109 #define ICR1H _SFR_IO8(0x27)
|
|
|
456 |
110 #define OCR1B _SFR_IO16(0x28)
|
|
|
457 |
111 #define OCR1BL _SFR_IO8(0x28)
|
|
|
458 |
112 #define OCR1BH _SFR_IO8(0x29)
|
|
|
459 |
113 #define OCR1A _SFR_IO16(0x2A)
|
|
|
460 |
114 #define OCR1AL _SFR_IO8(0x2A)
|
|
|
461 |
115 #define OCR1AH _SFR_IO8(0x2B)
|
|
|
462 |
116 #define TCNT1 _SFR_IO16(0x2C)
|
|
|
463 |
117 #define TCNT1L _SFR_IO8(0x2C)
|
|
|
464 |
118 #define TCNT1H _SFR_IO8(0x2D)
|
|
|
465 |
119 #define TCCR1B _SFR_IO8(0x2E)
|
|
|
466 |
120 #define TCCR1A _SFR_IO8(0x2F)
|
|
|
467 |
121
|
|
|
468 |
122 #define SFIOR _SFR_IO8(0x30)
|
|
|
469 |
123
|
|
|
470 |
124 #define OSCCAL _SFR_IO8(0x31)
|
|
|
471 |
125
|
|
|
472 |
126 /* Timer 0 */
|
|
|
473 |
127 #define TCNT0 _SFR_IO8(0x32)
|
|
|
474 |
128 #define TCCR0 _SFR_IO8(0x33)
|
|
|
475 |
129
|
|
|
476 |
130 #define MCUCSR _SFR_IO8(0x34)
|
|
|
477 |
131 #define MCUCR _SFR_IO8(0x35)
|
|
|
478 |
132
|
|
|
479 |
133 #define TWCR _SFR_IO8(0x36)
|
|
|
480 |
134
|
|
|
481 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 9
|
|
|
482 |
|
|
|
483 |
|
|
|
484 |
135 #define SPMCR _SFR_IO8(0x37)
|
|
|
485 |
136
|
|
|
486 |
137 #define TIFR _SFR_IO8(0x38)
|
|
|
487 |
138 #define TIMSK _SFR_IO8(0x39)
|
|
|
488 |
139
|
|
|
489 |
140 #define GIFR _SFR_IO8(0x3A)
|
|
|
490 |
141 #define GIMSK _SFR_IO8(0x3B)
|
|
|
491 |
142 #define GICR _SFR_IO8(0x3B) /* Changed in 2486H-AVR-09/02 */
|
|
|
492 |
143
|
|
|
493 |
144 /* 0x3C reserved (OCR0?) */
|
|
|
494 |
145
|
|
|
495 |
146 /* 0x3D..0x3E SP */
|
|
|
496 |
147
|
|
|
497 |
148 /* 0x3F SREG */
|
|
|
498 |
149
|
|
|
499 |
150 /* Interrupt vectors */
|
|
|
500 |
151
|
|
|
501 |
152 #define SIG_INTERRUPT0 _VECTOR(1)
|
|
|
502 |
153 #define SIG_INTERRUPT1 _VECTOR(2)
|
|
|
503 |
154 #define SIG_OUTPUT_COMPARE2 _VECTOR(3)
|
|
|
504 |
155 #define SIG_OVERFLOW2 _VECTOR(4)
|
|
|
505 |
156 #define SIG_INPUT_CAPTURE1 _VECTOR(5)
|
|
|
506 |
157 #define SIG_OUTPUT_COMPARE1A _VECTOR(6)
|
|
|
507 |
158 #define SIG_OUTPUT_COMPARE1B _VECTOR(7)
|
|
|
508 |
159 #define SIG_OVERFLOW1 _VECTOR(8)
|
|
|
509 |
160 #define SIG_OVERFLOW0 _VECTOR(9)
|
|
|
510 |
161 #define SIG_SPI _VECTOR(10)
|
|
|
511 |
162 #define SIG_UART_RECV _VECTOR(11)
|
|
|
512 |
163 #define SIG_UART_DATA _VECTOR(12)
|
|
|
513 |
164 #define SIG_UART_TRANS _VECTOR(13)
|
|
|
514 |
165 #define SIG_ADC _VECTOR(14)
|
|
|
515 |
166 #define SIG_EEPROM_READY _VECTOR(15)
|
|
|
516 |
167 #define SIG_COMPARATOR _VECTOR(16)
|
|
|
517 |
168 #define SIG_2WIRE_SERIAL _VECTOR(17)
|
|
|
518 |
169 #define SIG_SPM_READY _VECTOR(18)
|
|
|
519 |
170
|
|
|
520 |
171 #define _VECTORS_SIZE 38
|
|
|
521 |
172
|
|
|
522 |
173 /* Bit numbers */
|
|
|
523 |
174
|
|
|
524 |
175 /* GIMSK / GICR */
|
|
|
525 |
176 #define INT1 7
|
|
|
526 |
177 #define INT0 6
|
|
|
527 |
178 #define IVSEL 1
|
|
|
528 |
179 #define IVCE 0
|
|
|
529 |
180
|
|
|
530 |
181 /* GIFR */
|
|
|
531 |
182 #define INTF1 7
|
|
|
532 |
183 #define INTF0 6
|
|
|
533 |
184
|
|
|
534 |
184 #elif defined (__AVR_ATmega8515__)
|
|
|
535 |
54 #include "Events.h"
|
|
|
536 |
1 #ifndef EVENTS_H
|
|
|
537 |
2 #define EVENTS_H
|
|
|
538 |
3
|
|
|
539 |
4 /*
|
|
|
540 |
5 Copyright (C) 2004 John Orlando
|
|
|
541 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 10
|
|
|
542 |
|
|
|
543 |
|
|
|
544 |
6
|
|
|
545 |
7 AVRcam: a small real-time image processing engine.
|
|
|
546 |
8
|
|
|
547 |
9 This program is free software; you can redistribute it and/or
|
|
|
548 |
10 modify it under the terms of the GNU General Public
|
|
|
549 |
11 License as published by the Free Software Foundation; either
|
|
|
550 |
12 version 2 of the License, or (at your option) any later version.
|
|
|
551 |
13
|
|
|
552 |
14 This program is distributed in the hope that it will be useful,
|
|
|
553 |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
554 |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
555 |
17 General Public License for more details.
|
|
|
556 |
18
|
|
|
557 |
19 You should have received a copy of the GNU General Public
|
|
|
558 |
20 License along with this program; if not, write to the Free Software
|
|
|
559 |
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
560 |
22
|
|
|
561 |
23 For more information on the AVRcam, please contact:
|
|
|
562 |
24
|
|
|
563 |
25 john@jrobot.net
|
|
|
564 |
26
|
|
|
565 |
27 or go to www.jrobot.net for more details regarding the system.
|
|
|
566 |
28 */
|
|
|
567 |
29 /***********************************************************
|
|
|
568 |
30 Module Name: Events.h
|
|
|
569 |
31 Module Date: 05/23/2004
|
|
|
570 |
32 Module Auth: John Orlando
|
|
|
571 |
33
|
|
|
572 |
34 Description: This file provides the external interface
|
|
|
573 |
35 to the events that can be published/processed in the
|
|
|
574 |
36 system. It is specifically by itself (and nothing
|
|
|
575 |
37 else should be defined in here) so that both .c and
|
|
|
576 |
38 .S (assembly) files can include this file without
|
|
|
577 |
39 a problem.
|
|
|
578 |
40
|
|
|
579 |
41 Revision History:
|
|
|
580 |
42 Date Rel Ver. Notes
|
|
|
581 |
43 4/10/2004 0.1 Module created
|
|
|
582 |
44 6/30/2004 1.0 Initial release for Circuit Cellar
|
|
|
583 |
45 contest.
|
|
|
584 |
46 *******************************************************/
|
|
|
585 |
47
|
|
|
586 |
48 /* Definitions */
|
|
|
587 |
49 /* Originally, all events were passed in a bitmask...however,
|
|
|
588 |
50 an event FIFO was finally used, but the coding of the event
|
|
|
589 |
51 definitions were never translated back....doesn't make a
|
|
|
590 |
52 difference, but looks a little weird */
|
|
|
591 |
53 #define EV_SERIAL_DATA_RECEIVED 0x01
|
|
|
592 |
54 #define EV_DUMP_FRAME 0x02
|
|
|
593 |
55 #define EV_PROCESS_FRAME_COMPLETE 0x04
|
|
|
594 |
55
|
|
|
595 |
56 .extern fastEventBitmask ; This is the flag used to indicate to the rest
|
|
|
596 |
57 ; of the system that the line is complete
|
|
|
597 |
58
|
|
|
598 |
59 #define HREF_INTERRUPT_ENABLE_MASK 0x80
|
|
|
599 |
60 #define HREF_INTERRUPT_DISABLE_MASK 0x7F
|
|
|
600 |
61 #define ENABLE_PCLK_TIMER1_OVERFLOW_BITMASK 0x04
|
|
|
601 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 11
|
|
|
602 |
|
|
|
603 |
|
|
|
604 |
62 #define DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK 0xFB
|
|
|
605 |
63 #define G_PORT _SFR_IO_ADDR(PINC)
|
|
|
606 |
64 #define RB_PORT _SFR_IO_ADDR(PINB)
|
|
|
607 |
65 #define PIXEL_RUN_START_INITIAL 0x50 ; This value causes our pixel counter (TCNT1)
|
|
|
608 |
66 ; to overflow after 176 (horizontal) pixels
|
|
|
609 |
67
|
|
|
610 |
68 #define RED_MEM_OFFSET 0x00
|
|
|
611 |
69 #define GREEN_MEM_OFFSET 0x10
|
|
|
612 |
70 #define BLUE_MEM_OFFSET 0x20
|
|
|
613 |
71
|
|
|
614 |
72 ; A pixelBlock is defined as a contiguous group of 4 pixels that are combined
|
|
|
615 |
73 ; together to form a specific color. Typically, this is formed by sampling a
|
|
|
616 |
74 ; a green value, followed by a red and blue value (since we are dealing
|
|
|
617 |
75 ; with Bayer color data). We could optionally sample a second green with
|
|
|
618 |
76 ; the red and average the greens, because the eye is more sensitive to
|
|
|
619 |
77 ; green, but for speed we don't do this. These three values (RGB) are then
|
|
|
620 |
78 ; used as indices into the color membership lookup table (memLookup) to
|
|
|
621 |
79 ; determine which color the pixelBlock maps into. The memLookup table is
|
|
|
622 |
80 ; manually generated for now (though it will hopefully be modified over
|
|
|
623 |
81 ; the serial interface eventually).
|
|
|
624 |
82 ;
|
|
|
625 |
83 ; Here is a pixel block:
|
|
|
626 |
84 ; ...G G G G... (row x)
|
|
|
627 |
85 ; ...B R B R... (row x+1)
|
|
|
628 |
86 ; | | | |--this is skipped
|
|
|
629 |
87 ; | | |--this is skipped
|
|
|
630 |
88 ; | |--this is sampled
|
|
|
631 |
89 ; |--this is sampled
|
|
|
632 |
90
|
|
|
633 |
91 ; As pixel blocks are sampled, the red, green, and blue values are
|
|
|
634 |
92 ; used to index into their respective color maps. The color maps
|
|
|
635 |
93 ; return values that can be logically ANDed together so that a
|
|
|
636 |
94 ; particular RGB triplet will result in a single bit being set
|
|
|
637 |
95 ; after the AND operation. This single bit indicates which color
|
|
|
638 |
96 ; the RGB triplet represents. It is also possible for no bits to
|
|
|
639 |
97 ; be set after the AND process, indicating that the RGB triplet
|
|
|
640 |
98 ; does not map to any of the colors configured in the color map.
|
|
|
641 |
99 ; This isn't quite as fast as a pure RGB lookup table, but
|
|
|
642 |
100 ; it then again it doesn't require 2^12 (4-bits for each color
|
|
|
643 |
101 ; channel) bytes to store the lookup table. It takes just a few
|
|
|
644 |
102 ; more cycles, and only requires 48 bytes of precious RAM (16
|
|
|
645 |
103 ; per color channel, since our resolution on each color channel
|
|
|
646 |
104 ; is only 4-bits). Not bad....for more information, see:
|
|
|
647 |
105 ; http://www.cs.cmu.edu/~trb/papers/wirevision00.pdf for more
|
|
|
648 |
106 ; information on this color segmentation technique.
|
|
|
649 |
107
|
|
|
650 |
108 ; One other note: this code does depend on the colorMap residing
|
|
|
651 |
109 ; at a well-defined position in memory; specifically, it mus
|
|
|
652 |
110 ; start at a 256-byte boundary so that the lowest byte in the
|
|
|
653 |
111 ; map is set to 0x00. Currently, the colorMap is forced to
|
|
|
654 |
112 ; start at RAM location 0x300. This could potentially be changed
|
|
|
655 |
113 ; by the developer if needed, but offsets would have to be added
|
|
|
656 |
114 ; in to the colorMap look-up code below to make it work.
|
|
|
657 |
115
|
|
|
658 |
116
|
|
|
659 |
117 ; These are the registers that will be used throughout this
|
|
|
660 |
118 ; module for acquiring each line of pixel data
|
|
|
661 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 12
|
|
|
662 |
|
|
|
663 |
|
|
|
664 |
119 pixelCount = 16
|
|
|
665 |
120 pixelRunStart = 17
|
|
|
666 |
121 lastColor = 18
|
|
|
667 |
122 tmp1 = 19 ; be sure to not use tmp1 and color simultaneously
|
|
|
668 |
123 tmp2 = 20
|
|
|
669 |
124 color = 19
|
|
|
670 |
125 greenData = 20
|
|
|
671 |
126 blueData = 21
|
|
|
672 |
127 colorMapLow = 22
|
|
|
673 |
128 colorMapHigh = 23
|
|
|
674 |
129 prevLineBuffLow = 22 ; overlaps with memLookupLow (but orthogonal)
|
|
|
675 |
130 prevLineBuffHigh = 23 ; overlaps with memLookupHigh (but orthogonal)
|
|
|
676 |
131 currLineBuffLow = 24
|
|
|
677 |
132 currLineBuffHigh = 25
|
|
|
678 |
133
|
|
|
679 |
134 .section .text
|
|
|
680 |
135
|
|
|
681 |
136 ; These are the global assembly function names that are accessed via other
|
|
|
682 |
137 ; C functions
|
|
|
683 |
138 .global CamIntAsm_waitForNewTrackingFrame
|
|
|
684 |
139 .global CamIntAsm_waitForNewDumpFrame
|
|
|
685 |
140 .global CamIntAsm_acquireDumpLine
|
|
|
686 |
141 .global CamIntAsm_acquireTrackingLine
|
|
|
687 |
142 .global SIG_INTERRUPT0
|
|
|
688 |
143 .global SIG_INTERRUPT1
|
|
|
689 |
144 .global SIG_OVERFLOW0
|
|
|
690 |
145 .global SIG_OVERFLOW1
|
|
|
691 |
146
|
|
|
692 |
147 ;*****************************************************************
|
|
|
693 |
148 ; Function Name: CamIntAsm_waitForNewTrackingFrame
|
|
|
694 |
149 ; Function Description: This function is responsible for
|
|
|
695 |
150 ; going to sleep until a new frame begins (indicated by
|
|
|
696 |
151 ; VSYNC transitioning from low to high. This will wake
|
|
|
697 |
152 ; the "VSYNC sleep" up and allow it to continue with
|
|
|
698 |
153 ; the acquireLine function, where the system waits for
|
|
|
699 |
154 ; an "HREF sleep" that we use to synchronize with the
|
|
|
700 |
155 ; data.
|
|
|
701 |
156 ; Inputs: r25 - MSB of currentLineBuffer
|
|
|
702 |
157 ; r24 - LSB of currentLineBuffer
|
|
|
703 |
158 ; r23 - MSB of colorMap
|
|
|
704 |
159 ; r22 - LSB of colorMap
|
|
|
705 |
160 ; Outputs: none
|
|
|
706 |
161 ; NOTES: This function doesn't really return...it sorta just
|
|
|
707 |
162 ; floats into the acquireLine function after the "VSYNC sleep"
|
|
|
708 |
163 ; is awoken, then begins processing the line data. Once
|
|
|
709 |
164 ; 176 pixels are sampled (and the counter overflows), then
|
|
|
710 |
165 ; an interrupt will occur, the 'T' bit in the SREG will be
|
|
|
711 |
166 ; set, and the function will return.
|
|
|
712 |
167 ;*****************************************************************
|
|
|
713 |
168
|
|
|
714 |
169 CamIntAsm_waitForNewTrackingFrame:
|
|
|
715 |
170:CamInterfaceAsm.S **** sbi _SFR_IO_ADDR(PORTD),PD6 ; For testing...
|
|
|
716 |
171:CamInterfaceAsm.S **** cbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
717 |
172:CamInterfaceAsm.S **** sleep
|
|
|
718 |
173
|
|
|
719 |
174 ;*****************************************************************
|
|
|
720 |
175 ; REMEMBER...everything from here on out is critically timed to be
|
|
|
721 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 13
|
|
|
722 |
|
|
|
723 |
|
|
|
724 |
176 ; synchronized with the flow of pixel data from the camera...
|
|
|
725 |
177 ;*****************************************************************
|
|
|
726 |
178
|
|
|
727 |
179 CamIntAsm_acquireTrackingLine:
|
|
|
728 |
180:CamInterfaceAsm.S **** brts _cleanUp
|
|
|
729 |
181 ;sbi _SFR_IO_ADDR(PORTD),PD6 ; For testing...
|
|
|
730 |
182 ;cbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
731 |
183
|
|
|
732 |
184:CamInterfaceAsm.S **** in tmp1,_SFR_IO_ADDR(TCCR1B) ; Enable the PCLK line to actually
|
|
|
733 |
185:CamInterfaceAsm.S **** ori tmp1, 0x07 ; feed Timer1
|
|
|
734 |
186:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TCCR1B),tmp1
|
|
|
735 |
187 ; The line is about to start...
|
|
|
736 |
188:CamInterfaceAsm.S **** ldi pixelCount,0 ; Initialize the RLE stats...
|
|
|
737 |
189:CamInterfaceAsm.S **** ldi pixelRunStart,PIXEL_RUN_START_INITIAL ; Remember, we always calculate
|
|
|
738 |
190 ; the pixel run length as
|
|
|
739 |
191 ; TCNT1L - pixelRunStart
|
|
|
740 |
192
|
|
|
741 |
193:CamInterfaceAsm.S **** ldi lastColor,0x00 ; clear out the last color before we start
|
|
|
742 |
194
|
|
|
743 |
195:CamInterfaceAsm.S **** mov XH,currLineBuffHigh ; Load the pointer to the current line
|
|
|
744 |
196:CamInterfaceAsm.S **** mov XL,currLineBuffLow ; buffer into the X pointer regs
|
|
|
745 |
197
|
|
|
746 |
198:CamInterfaceAsm.S **** mov ZH,colorMapHigh ; Load the pointers to the membership
|
|
|
747 |
199:CamInterfaceAsm.S **** mov ZL,colorMapLow ; lookup tables (ZL and YL will be overwritten
|
|
|
748 |
200:CamInterfaceAsm.S **** mov YH,colorMapHigh ; as soon as we start reading data) to Z and Y
|
|
|
749 |
201
|
|
|
750 |
202:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(TIMSK) ; enable TIMER1 to start counting
|
|
|
751 |
203:CamInterfaceAsm.S **** ori tmp1, ENABLE_PCLK_TIMER1_OVERFLOW_BITMASK ; external PCLK pulses and interrupt on
|
|
|
752 |
204:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TIMSK),tmp1 ; overflow
|
|
|
753 |
205
|
|
|
754 |
206:CamInterfaceAsm.S **** ldi tmp1,PIXEL_RUN_START_INITIAL ; set up the TCNT1 to overflow (and
|
|
|
755 |
207:CamInterfaceAsm.S **** ldi tmp2,0xFF ; interrupts) after 176 pixels
|
|
|
756 |
208:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TCNT1H),tmp2
|
|
|
757 |
209:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TCNT1L),tmp1
|
|
|
758 |
210
|
|
|
759 |
211:CamInterfaceAsm.S **** mov YL,colorMapLow
|
|
|
760 |
212
|
|
|
761 |
213:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(GICR) ; enable the HREF interrupt...remember, we
|
|
|
762 |
214 ; only use this interrupt to synchronize
|
|
|
763 |
215 ; the beginning of the line
|
|
|
764 |
216:CamInterfaceAsm.S **** ori tmp1, HREF_INTERRUPT_ENABLE_MASK
|
|
|
765 |
217:CamInterfaceAsm.S **** out _SFR_IO_ADDR(GICR), tmp1
|
|
|
766 |
218
|
|
|
767 |
219 ;*******************************************************************************************
|
|
|
768 |
220 ; Track Frame handler
|
|
|
769 |
221 ;*******************************************************************************************
|
|
|
770 |
222
|
|
|
771 |
223 _trackFrame:
|
|
|
772 |
224:CamInterfaceAsm.S **** sbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
773 |
225:CamInterfaceAsm.S **** sleep ; ...And we wait...
|
|
|
774 |
226
|
|
|
775 |
227 ; Returning from the interrupt/sleep wakeup will consume
|
|
|
776 |
228 ; 14 clock cycles (7 to wakeup from idle sleep, 3 to vector, and 4 to return)
|
|
|
777 |
229
|
|
|
778 |
230 ; Disable the HREF interrupt
|
|
|
779 |
231:CamInterfaceAsm.S **** cbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
780 |
232:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(GICR)
|
|
|
781 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 14
|
|
|
782 |
|
|
|
783 |
|
|
|
784 |
233:CamInterfaceAsm.S **** andi tmp1, HREF_INTERRUPT_DISABLE_MASK
|
|
|
785 |
234:CamInterfaceAsm.S **** out _SFR_IO_ADDR(GICR), tmp1
|
|
|
786 |
235
|
|
|
787 |
236 ; A couple of NOPs are needed here to sync up the pixel data...the number (2)
|
|
|
788 |
237 ; of NOPs was determined emperically by trial and error.
|
|
|
789 |
238:CamInterfaceAsm.S **** nop
|
|
|
790 |
239:CamInterfaceAsm.S **** nop
|
|
|
791 |
240 _acquirePixelBlock: ; Clock Cycle Count
|
|
|
792 |
241:CamInterfaceAsm.S **** in ZL,RB_PORT ; sample the red value (PINB) (1)
|
|
|
793 |
242:CamInterfaceAsm.S **** in YL,G_PORT ; sample the green value (PINC) (1)
|
|
|
794 |
243:CamInterfaceAsm.S **** andi YL,0x0F ; clear the high nibble (1)
|
|
|
795 |
244:CamInterfaceAsm.S **** ldd color,Z+RED_MEM_OFFSET ; lookup the red membership (2)
|
|
|
796 |
245:CamInterfaceAsm.S **** in ZL,RB_PORT ; sample the blue value (PINB) (1)
|
|
|
797 |
246:CamInterfaceAsm.S **** ldd greenData,Y+GREEN_MEM_OFFSET; lookup the green membership (2)
|
|
|
798 |
247:CamInterfaceAsm.S **** ldd blueData,Z+BLUE_MEM_OFFSET ; lookup the blue membership (2)
|
|
|
799 |
248:CamInterfaceAsm.S **** and color,greenData ; mask memberships together (1)
|
|
|
800 |
249:CamInterfaceAsm.S **** and color,blueData ; to produce the final color (1)
|
|
|
801 |
250:CamInterfaceAsm.S **** brts _cleanUpTrackingLine ; if some interrupt routine has (1...not set)
|
|
|
802 |
251 ; come in and set our T flag in
|
|
|
803 |
252 ; SREG, then we need to hop out
|
|
|
804 |
253 ; and blow away this frames data (common cleanup)
|
|
|
805 |
254:CamInterfaceAsm.S **** cp color,lastColor ; check to see if the run continues (1)
|
|
|
806 |
255:CamInterfaceAsm.S **** breq _acquirePixelBlock ; (2...equal)
|
|
|
807 |
256 ; ___________
|
|
|
808 |
257 ; 16 clock cycles
|
|
|
809 |
258 ; (16 clock cycles = 1 uS = 1 pixelBlock time)
|
|
|
810 |
259
|
|
|
811 |
260 ; Toggle the debug line to indicate a color change
|
|
|
812 |
261:CamInterfaceAsm.S **** sbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
813 |
262:CamInterfaceAsm.S **** nop
|
|
|
814 |
263:CamInterfaceAsm.S **** cbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
815 |
264
|
|
|
816 |
265:CamInterfaceAsm.S **** mov tmp2,pixelRunStart ; get the count value of the
|
|
|
817 |
266 ; current pixel run
|
|
|
818 |
267:CamInterfaceAsm.S **** in pixelCount,_SFR_IO_ADDR(TCNT1L) ; get the current TCNT1 value
|
|
|
819 |
268:CamInterfaceAsm.S **** mov pixelRunStart,pixelCount ; reload pixelRunStart for the
|
|
|
820 |
269 ; next run
|
|
|
821 |
270:CamInterfaceAsm.S **** sub pixelCount,tmp2 ; pixelCount = TCNT1L - pixelRunStart
|
|
|
822 |
271
|
|
|
823 |
272:CamInterfaceAsm.S **** st X+,lastColor ; record the color run in the current line buffer
|
|
|
824 |
273:CamInterfaceAsm.S **** st X+,pixelCount ; with its length
|
|
|
825 |
274:CamInterfaceAsm.S **** mov lastColor,color ; set lastColor so we can figure out when it changes
|
|
|
826 |
275
|
|
|
827 |
276:CamInterfaceAsm.S **** nop ; waste one more cycle for a total of 16
|
|
|
828 |
277:CamInterfaceAsm.S **** rjmp _acquirePixelBlock
|
|
|
829 |
278
|
|
|
830 |
279 ; _cleanUpTrackingLine is used to write the last run length block off to the currentLineBuffer so
|
|
|
831 |
280 ; that all 176 pixels in the line are accounted for.
|
|
|
832 |
281 _cleanUpTrackingLine:
|
|
|
833 |
282:CamInterfaceAsm.S **** ldi pixelCount,0xFF ; the length of the last run is ALWAYS 0xFF minus the last
|
|
|
834 |
283:CamInterfaceAsm.S **** sub pixelCount,pixelRunStart ; pixelRunStart
|
|
|
835 |
284
|
|
|
836 |
285:CamInterfaceAsm.S **** inc pixelCount ; increment pixelCount since we actually need to account
|
|
|
837 |
286 ; for the overflow of TCNT1
|
|
|
838 |
287
|
|
|
839 |
288:CamInterfaceAsm.S **** st X+,color ; record the color run in the current line buffer
|
|
|
840 |
289:CamInterfaceAsm.S **** st X,pixelCount
|
|
|
841 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 15
|
|
|
842 |
|
|
|
843 |
|
|
|
844 |
290:CamInterfaceAsm.S **** rjmp _cleanUp
|
|
|
845 |
291
|
|
|
846 |
292 _cleanUpDumpLine:
|
|
|
847 |
293 ; NOTE: If serial data is received, to interrupt the tracking of a line, we'll
|
|
|
848 |
294 ; get a EV_SERIAL_DATA_RECEIVED event, and the T bit set so we will end the
|
|
|
849 |
295 ; line's processing...however, the PCLK will keep on ticking for the rest of
|
|
|
850 |
296 ; the frame/line, which will cause the TCNT to eventually overflow and
|
|
|
851 |
297 ; interrupt us, generating a EV_ACQUIRE_LINE_COMPLETE event. We don't want
|
|
|
852 |
298 ; this, so we need to actually turn off the PCLK counting each time we exit
|
|
|
853 |
299 ; this loop, and only turn it on when we begin acquiring lines....
|
|
|
854 |
300 ; NOT NEEDED FOR NOW...
|
|
|
855 |
301 ;in tmp1, _SFR_IO_ADDR(TIMSK) ; disable TIMER1 to stop counting
|
|
|
856 |
302 ;andi tmp1, DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK ; external PCLK pulses
|
|
|
857 |
303 ;out _SFR_IO_ADDR(TIMSK),tmp1
|
|
|
858 |
304
|
|
|
859 |
305 _cleanUp:
|
|
|
860 |
306 ; Disable the external clocking of the Timer1 counter
|
|
|
861 |
307:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(TCCR1B)
|
|
|
862 |
308:CamInterfaceAsm.S **** andi tmp1, 0xF8
|
|
|
863 |
309:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TCCR1B),tmp1
|
|
|
864 |
310
|
|
|
865 |
311 ; Toggle the debug line to indicate the line is complete
|
|
|
866 |
312:CamInterfaceAsm.S **** sbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
867 |
313:CamInterfaceAsm.S **** cbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
868 |
314:CamInterfaceAsm.S **** clt ; clear out the T bit since we have detected
|
|
|
869 |
315 ; the interruption and are exiting to handle it
|
|
|
870 |
316 _exit:
|
|
|
871 |
317:CamInterfaceAsm.S **** ret
|
|
|
872 |
318
|
|
|
873 |
319 ;*****************************************************************
|
|
|
874 |
320 ; Function Name: CamIntAsm_waitForNewDumpFrame
|
|
|
875 |
321 ; Function Description: This function is responsible for
|
|
|
876 |
322 ; going to sleep until a new frame begins (indicated by
|
|
|
877 |
323 ; VSYNC transitioning from low to high. This will wake
|
|
|
878 |
324 ; the "VSYNC sleep" up and allow it to continue with
|
|
|
879 |
325 ; acquiring a line of pixel data to dump out to the UI.
|
|
|
880 |
326 ; Inputs: r25 - MSB of currentLineBuffer
|
|
|
881 |
327 ; r24 - LSB of currentLineBuffer
|
|
|
882 |
328 ; r23 - MSB of prevLineBuffer
|
|
|
883 |
329 ; r22 - LSB of prevLineBuffer
|
|
|
884 |
330 ; Outputs: none
|
|
|
885 |
331 ; NOTES: This function doesn't really return...it sorta just
|
|
|
886 |
332 ; floats into the acquireDumpLine function after the "VSYNC sleep"
|
|
|
887 |
333 ; is awoken.
|
|
|
888 |
334 ;*****************************************************************
|
|
|
889 |
335 CamIntAsm_waitForNewDumpFrame:
|
|
|
890 |
336:CamInterfaceAsm.S **** sbi _SFR_IO_ADDR(PORTD),PD6 ; For testing...
|
|
|
891 |
337:CamInterfaceAsm.S **** cbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
892 |
338:CamInterfaceAsm.S **** sleep
|
|
|
893 |
339
|
|
|
894 |
340 ;*****************************************************************
|
|
|
895 |
341 ; REMEMBER...everything from here on out is critically timed to be
|
|
|
896 |
342 ; synchronized with the flow of pixel data from the camera...
|
|
|
897 |
343 ;*****************************************************************
|
|
|
898 |
344
|
|
|
899 |
345 CamIntAsm_acquireDumpLine:
|
|
|
900 |
346:CamInterfaceAsm.S **** brts _cleanUp
|
|
|
901 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 16
|
|
|
902 |
|
|
|
903 |
|
|
|
904 |
347 ;sbi _SFR_IO_ADDR(PORTD),PD6 ; For testing...
|
|
|
905 |
348 ;cbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
906 |
349
|
|
|
907 |
350:CamInterfaceAsm.S **** mov XH,currLineBuffHigh ; Load the pointer to the current line
|
|
|
908 |
351:CamInterfaceAsm.S **** mov XL,currLineBuffLow ; buffer into the X pointer regs
|
|
|
909 |
352
|
|
|
910 |
353:CamInterfaceAsm.S **** mov YH,prevLineBuffHigh ; Load the pointer to the previous line
|
|
|
911 |
354:CamInterfaceAsm.S **** mov YL,prevLineBuffLow ; buffer into the Y pointer regs
|
|
|
912 |
355
|
|
|
913 |
356:CamInterfaceAsm.S **** ldi tmp1,PIXEL_RUN_START_INITIAL ; set up the TCNT1 to overflow (and
|
|
|
914 |
357:CamInterfaceAsm.S **** ldi tmp2,0xFF ; interrupts) after 176 pixels
|
|
|
915 |
358:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TCNT1H),tmp2
|
|
|
916 |
359:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TCNT1L),tmp1
|
|
|
917 |
360
|
|
|
918 |
361:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(TCCR1B) ; Enable the PCLK line to actually
|
|
|
919 |
362:CamInterfaceAsm.S **** ori tmp1, 0x07 ; feed Timer1
|
|
|
920 |
363:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TCCR1B),tmp1
|
|
|
921 |
364:CamInterfaceAsm.S **** nop
|
|
|
922 |
365
|
|
|
923 |
366:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(TIMSK) ; enable TIMER1 to start counting
|
|
|
924 |
367:CamInterfaceAsm.S **** ori tmp1, ENABLE_PCLK_TIMER1_OVERFLOW_BITMASK ; external PCLK pulses and interrupt on
|
|
|
925 |
368:CamInterfaceAsm.S **** out _SFR_IO_ADDR(TIMSK),tmp1 ; overflow
|
|
|
926 |
369
|
|
|
927 |
370:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(GICR) ; enable the HREF interrupt...remember, we
|
|
|
928 |
371 ; only use this interrupt to synchronize
|
|
|
929 |
372 ; the beginning of the line
|
|
|
930 |
373:CamInterfaceAsm.S **** ori tmp1, HREF_INTERRUPT_ENABLE_MASK
|
|
|
931 |
374:CamInterfaceAsm.S **** out _SFR_IO_ADDR(GICR), tmp1
|
|
|
932 |
375
|
|
|
933 |
376 ;*******************************************************************************************
|
|
|
934 |
377 ; Dump Frame handler
|
|
|
935 |
378 ;*******************************************************************************************
|
|
|
936 |
379
|
|
|
937 |
380 _dumpFrame:
|
|
|
938 |
381:CamInterfaceAsm.S **** sbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
939 |
382:CamInterfaceAsm.S **** sleep ; ...And we wait...
|
|
|
940 |
383
|
|
|
941 |
384:CamInterfaceAsm.S **** cbi _SFR_IO_ADDR(PORTD),PD6
|
|
|
942 |
385:CamInterfaceAsm.S **** in tmp1, _SFR_IO_ADDR(GICR) ; disable the HREF interrupt
|
|
|
943 |
386:CamInterfaceAsm.S **** andi tmp1, HREF_INTERRUPT_DISABLE_MASK ; so we don't get interrupted
|
|
|
944 |
387:CamInterfaceAsm.S **** out _SFR_IO_ADDR(GICR), tmp1 ; while dumping the line
|
|
|
945 |
388
|
|
|
946 |
389:CamInterfaceAsm.S **** nop ; Remember...if we ever remove the "cbi" instruction above,
|
|
|
947 |
390 ; we need to add two more NOPs to cover this
|
|
|
948 |
391
|
|
|
949 |
392 ; Ok...the following loop needs to run in 8 clock cycles, so we can get every
|
|
|
950 |
393 ; pixel in the line...this shouldn't be a problem, since the PCLK timing was
|
|
|
951 |
394 ; reduced by a factor of 2 whenever we go to dump a line (this is to give us
|
|
|
952 |
395 ; enough time to do the sampling and storing of the pixel data). In addition,
|
|
|
953 |
396 ; it is assumed that we will have to do some minor processing on the data right
|
|
|
954 |
397 ; before we send it out, like mask off the top 4-bits of each, and then pack both
|
|
|
955 |
398 ; low nibbles into a single byte for transmission...we just don't have time to
|
|
|
956 |
399 ; do that here (only 8 instruction cycles :-) )
|
|
|
957 |
400 _sampleDumpPixel:
|
|
|
958 |
401:CamInterfaceAsm.S **** in tmp1,G_PORT ; sample the G value (1)
|
|
|
959 |
402:CamInterfaceAsm.S **** in tmp2,RB_PORT ; sample the R/B value (1)
|
|
|
960 |
403:CamInterfaceAsm.S **** st X+,tmp1 ; store to the currLineBuff and inc ptrs(2)
|
|
|
961 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 17
|
|
|
962 |
|
|
|
963 |
|
|
|
964 |
404:CamInterfaceAsm.S **** st Y+,tmp2 ; store to the prevLineBuff and inc ptrs(2)
|
|
|
965 |
405:CamInterfaceAsm.S **** brtc _sampleDumpPixel ; loop back unless flag is set (2...if not set)
|
|
|
966 |
406 ; ___________
|
|
|
967 |
407 ; 8 cycles normally
|
|
|
968 |
408
|
|
|
969 |
409 ; if we make it here, it means the T flag is set, and we must have been interrupted
|
|
|
970 |
410 ; so we need to exit (what if we were interrupted for serial? should we disable it?)
|
|
|
971 |
411:CamInterfaceAsm.S **** rjmp _cleanUpDumpLine
|
|
|
972 |
412
|
|
|
973 |
413 ;***********************************************************
|
|
|
974 |
414 ; Function Name: <interrupt handler for External Interrupt0>
|
|
|
975 |
415 ; Function Description: This function is responsible
|
|
|
976 |
416 ; for handling a rising edge on the Ext Interrupt 0. This
|
|
|
977 |
417 ; routine simply returns, since we just want to wake up
|
|
|
978 |
418 ; whenever the VSYNC transitions (meaning the start of a new
|
|
|
979 |
419 ; frame).
|
|
|
980 |
420 ; Inputs: none
|
|
|
981 |
421 ; Outputs: none
|
|
|
982 |
422 ;***********************************************************
|
|
|
983 |
423 SIG_INTERRUPT0:
|
|
|
984 |
424 ; This will wake us up when VSYNC transitions high...we just want to return
|
|
|
985 |
425:CamInterfaceAsm.S **** reti
|
|
|
986 |
426
|
|
|
987 |
427 ;***********************************************************
|
|
|
988 |
428 ; Function Name: <interrupt handler for External Interrupt1>
|
|
|
989 |
429 ; Function Description: This function is responsible
|
|
|
990 |
430 ; for handling a falling edge on the Ext Interrupt 1. This
|
|
|
991 |
431 ; routine simply returns, since we just want to wake up
|
|
|
992 |
432 ; whenever the HREF transitions (meaning the pixels
|
|
|
993 |
433 ; are starting after VSYNC transitioned, and we need to
|
|
|
994 |
434 ; start acquiring the pixel blocks
|
|
|
995 |
435 ; Inputs: none
|
|
|
996 |
436 ; Outputs: none
|
|
|
997 |
437 ;***********************************************************
|
|
|
998 |
438 SIG_INTERRUPT1:
|
|
|
999 |
439 ; This will wake us up when HREF transitions high...we just want to return
|
|
|
1000 |
440:CamInterfaceAsm.S **** reti
|
|
|
1001 |
441
|
|
|
1002 |
442 ;***********************************************************
|
|
|
1003 |
443 ; Function Name: <interrupt handler for Timer0 overflow>
|
|
|
1004 |
444 ; Function Description: This function is responsible
|
|
|
1005 |
445 ; for handling the Timer0 overflow (hooked up to indicate
|
|
|
1006 |
446 ; when we have reached the number of HREFs required in a
|
|
|
1007 |
447 ; single frame). We set the T flag in the SREG to
|
|
|
1008 |
448 ; indicate to the _acquirePixelBlock routine that it needs
|
|
|
1009 |
449 ; to exit, and then set the appropriate action to take in
|
|
|
1010 |
450 ; the eventList of the Executive module.
|
|
|
1011 |
451 ; Inputs: none
|
|
|
1012 |
452 ; Outputs: none
|
|
|
1013 |
453 ; Note: Originally, the HREF pulses were also going to
|
|
|
1014 |
454 ; be counted by a hardware counter, but it didn't end up
|
|
|
1015 |
455 ; being necessary
|
|
|
1016 |
456 ;***********************************************************
|
|
|
1017 |
457 ;SIG_OVERFLOW0:
|
|
|
1018 |
458 ; set ; set the T bit in SREG
|
|
|
1019 |
459 ; lds tmp1,eventBitmask
|
|
|
1020 |
460 ; ori tmp1,EV_ACQUIRE_FRAME_COMPLETE
|
|
|
1021 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 18
|
|
|
1022 |
|
|
|
1023 |
|
|
|
1024 |
461 ; sts eventBitmask,tmp1
|
|
|
1025 |
462 ; reti
|
|
|
1026 |
463
|
|
|
1027 |
464 ;***********************************************************
|
|
|
1028 |
465 ; Function Name: <interrupt handler for Timer1 overflow>
|
|
|
1029 |
466 ; Function Description: This function is responsible
|
|
|
1030 |
467 ; for handling the Timer1 overflow (hooked up to indicate
|
|
|
1031 |
468 ; when we have reached the end of a line of pixel data,
|
|
|
1032 |
469 ; since PCLK is hooked up to overflow TCNT1 after 176
|
|
|
1033 |
470 ; pixels). This routine generates an acquire line complete
|
|
|
1034 |
471 ; event in the fastEventBitmask, which is streamlined for
|
|
|
1035 |
472 ; efficiency reasons.
|
|
|
1036 |
473 ;***********************************************************
|
|
|
1037 |
474 SIG_OVERFLOW1:
|
|
|
1038 |
475:CamInterfaceAsm.S **** lds tmp1,fastEventBitmask ; set a flag indicating
|
|
|
1039 |
476:CamInterfaceAsm.S **** ori tmp1,FEV_ACQUIRE_LINE_COMPLETE ; a line is complete
|
|
|
1040 |
477:CamInterfaceAsm.S **** sts fastEventBitmask,tmp1
|
|
|
1041 |
478:CamInterfaceAsm.S **** set ; set the T bit in SREG
|
|
|
1042 |
479 ;sbi _SFR_IO_ADDR(PORTD),PD6 ; For testing...
|
|
|
1043 |
480 ;cbi _SFR_IO_ADDR(PORTD),PD6 ; For testing...
|
|
|
1044 |
481
|
|
|
1045 |
482:CamInterfaceAsm.S **** reti
|
|
|
1046 |
483
|
|
|
1047 |
484 ; This is the default handler for all interrupts that don't
|
|
|
1048 |
485 ; have handler routines specified for them.
|
|
|
1049 |
486 .global __vector_default
|
|
|
1050 |
487 __vector_default:
|
|
|
1051 |
488:CamInterfaceAsm.S **** reti
|
|
|
1052 |
489
|
|
|
1053 |
490 .end
|
|
|
1054 |
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s page 19
|
|
|
1055 |
|
|
|
1056 |
|
|
|
1057 |
DEFINED SYMBOLS
|
|
|
1058 |
*ABS*:00000000 CamInterfaceAsm.S
|
|
|
1059 |
*ABS*:00000000 Events.h
|
|
|
1060 |
*ABS*:00000000 CamInterfaceAsm.S
|
|
|
1061 |
*ABS*:00000000 C:/WinAVR/avr/include/avr/io.h
|
|
|
1062 |
*ABS*:00000000 C:/WinAVR/avr/include/avr/iom8.h
|
|
|
1063 |
*ABS*:00000000 C:/WinAVR/avr/include/avr/io.h
|
|
|
1064 |
*ABS*:00000000 C:/WinAVR/avr/include/avr/sfr_defs.h
|
|
|
1065 |
*ABS*:00000000 C:/WinAVR/avr/include/avr/io.h
|
|
|
1066 |
*ABS*:00000000 CamInterfaceAsm.S
|
|
|
1067 |
*ABS*:00000000 <command line>
|
|
|
1068 |
*ABS*:00000000 <built-in>
|
|
|
1069 |
*ABS*:00000000 CamInterfaceAsm.S
|
|
|
1070 |
*ABS*:00000010 pixelCount
|
|
|
1071 |
*ABS*:00000011 pixelRunStart
|
|
|
1072 |
*ABS*:00000012 lastColor
|
|
|
1073 |
*ABS*:00000013 tmp1
|
|
|
1074 |
*ABS*:00000014 tmp2
|
|
|
1075 |
*ABS*:00000013 color
|
|
|
1076 |
*ABS*:00000014 greenData
|
|
|
1077 |
*ABS*:00000015 blueData
|
|
|
1078 |
*ABS*:00000016 colorMapLow
|
|
|
1079 |
*ABS*:00000017 colorMapHigh
|
|
|
1080 |
*ABS*:00000016 prevLineBuffLow
|
|
|
1081 |
*ABS*:00000017 prevLineBuffHigh
|
|
|
1082 |
*ABS*:00000018 currLineBuffLow
|
|
|
1083 |
*ABS*:00000019 currLineBuffHigh
|
|
|
1084 |
CamInterfaceAsm.S:169 .text:00000000 CamIntAsm_waitForNewTrackingFrame
|
|
|
1085 |
CamInterfaceAsm.S:335 .text:0000008e CamIntAsm_waitForNewDumpFrame
|
|
|
1086 |
CamInterfaceAsm.S:345 .text:00000094 CamIntAsm_acquireDumpLine
|
|
|
1087 |
CamInterfaceAsm.S:179 .text:00000006 CamIntAsm_acquireTrackingLine
|
|
|
1088 |
CamInterfaceAsm.S:423 .text:000000d4 __vector_1
|
|
|
1089 |
CamInterfaceAsm.S:438 .text:000000d6 __vector_2
|
|
|
1090 |
CamInterfaceAsm.S:474 .text:000000d8 __vector_8
|
|
|
1091 |
CamInterfaceAsm.S:305 .text:00000080 _cleanUp
|
|
|
1092 |
CamInterfaceAsm.S:223 .text:00000034 _trackFrame
|
|
|
1093 |
CamInterfaceAsm.S:240 .text:00000044 _acquirePixelBlock
|
|
|
1094 |
CamInterfaceAsm.S:281 .text:00000074 _cleanUpTrackingLine
|
|
|
1095 |
CamInterfaceAsm.S:292 .text:00000080 _cleanUpDumpLine
|
|
|
1096 |
CamInterfaceAsm.S:316 .text:0000008c _exit
|
|
|
1097 |
CamInterfaceAsm.S:380 .text:000000ba _dumpFrame
|
|
|
1098 |
CamInterfaceAsm.S:400 .text:000000c8 _sampleDumpPixel
|
|
|
1099 |
CamInterfaceAsm.S:487 .text:000000e6 __vector_default
|
|
|
1100 |
|
|
|
1101 |
UNDEFINED SYMBOLS
|
|
|
1102 |
__vector_9
|
|
|
1103 |
fastEventBitmask
|