Subversion Repositories svnkaklik

Rev

Rev 151 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log

Rev 151 Rev 174
1
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s 			page 1
1
GAS LISTING /tmp/cckBHomO.s 			page 1
2
 
2
 
3
 
3
 
4
   1               	# 1 "CamInterfaceAsm.S"
4
   1               	# 1 "CamInterfaceAsm.S"
5
   2               	# 1 "<built-in>"
5
   2               	# 1 "<built-in>"
6
   1               	;
6
   1               	;
7
   0               	
7
   0               	
8
   0               	
8
   0               	
9
   2               	;    Copyright (C) 2004    John Orlando
9
   2               	;    Copyright (C) 2004    John Orlando
10
   3               	;    
10
   3               	;    
11
   4               	;   AVRcam: a small real-time image processing engine.
11
   4               	;   AVRcam: a small real-time image processing engine.
12
   5               	
12
   5               	
13
   6               	;    This program is free software; you can redistribute it and/or
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
14
   7               	;    modify it under the terms of the GNU General Public
15
   8               	;    License as published by the Free Software Foundation; either
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.
16
   9               	;    version 2 of the License, or (at your option) any later version.
17
  10               	
17
  10               	
18
  11               	;    This program is distributed in the hope that it will be useful,
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
19
  12               	;    but WITHOUT ANY WARRANTY; without even the implied warranty of
20
  13               	;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20
  13               	;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21
  14               	;    General Public License for more details.
21
  14               	;    General Public License for more details.
22
  15               	
22
  15               	
23
  16               	;    You should have received a copy of the GNU General Public
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
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
25
  18               	;    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
  19               	
26
  19               	
27
  20               	;   For more information on the AVRcam, please contact:
27
  20               	;   For more information on the AVRcam, please contact:
28
  21               	
28
  21               	
29
  22               	;   john@jrobot.net
29
  22               	;   john@jrobot.net
30
  23               	
30
  23               	
31
  24               	;   or go to www.jrobot.net for more details regarding the system.
31
  24               	;   or go to www.jrobot.net for more details regarding the system.
32
  25               	;**********************************************************************
32
  25               	;**********************************************************************
33
  26               	;       Module Name: CanInterfaceAsm.S
33
  26               	;       Module Name: CanInterfaceAsm.S
34
  27               	;       Module Date: 04/14/2004
34
  27               	;       Module Date: 04/14/2004
35
  28               	;       Module Auth: John Orlando
35
  28               	;       Module Auth: John Orlando
36
  29               	;
36
  29               	;
37
  30               	;       Description: This module provides the low-level interface
37
  30               	;       Description: This module provides the low-level interface
38
  31               	;       to the OV6620 camera hardware.  It is responsible for
38
  31               	;       to the OV6620 camera hardware.  It is responsible for
39
  32               	;   	acquiring each pixel block (R,G,B), performing the mapping
39
  32               	;   	acquiring each pixel block (R,G,B), performing the mapping
40
  33               	;       into an actual color (orange, purple, etc), run-length
40
  33               	;       into an actual color (orange, purple, etc), run-length
41
  34               	;       encoding the data, and storing the info off to the appropriate
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
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
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,
44
  37               	;       OV6620 is clocked off of the same crystal source as the mega8,
45
  38               	;       thus providing inherent synchronization between the two).
45
  38               	;       thus providing inherent synchronization between the two).
46
  39               	;
46
  39               	;
47
  40               	;       Revision History:
47
  40               	;       Revision History:
48
  41               	;       Date        Rel Ver.    Notes
48
  41               	;       Date        Rel Ver.    Notes
49
  42               	;       4/10/2004      0.1     Module created
49
  42               	;       4/10/2004      0.1     Module created
50
  43               	;       6/30/2004      1.0     Initial release for Circuit Cellar
50
  43               	;       6/30/2004      1.0     Initial release for Circuit Cellar
51
  44               	;                              contest.
51
  44               	;                              contest.
52
  45               	;       1/16/2005      1.4     Fixed issue with the TCCR1B register
52
  45               	;       1/16/2005      1.4     Fixed issue with the TCCR1B register
53
  46               	;                              where PCLK was getting routed to the
53
  46               	;                              where PCLK was getting routed to the
54
  47               	;                              timer1 even when it wasn't needed.
54
  47               	;                              timer1 even when it wasn't needed.
55
  48               	;                              This caused excessive counter overflow
55
  48               	;                              This caused excessive counter overflow
56
  49               	;                              interrupts, and caused problems.  Now,
56
  49               	;                              interrupts, and caused problems.  Now,
57
  50               	;                              the "PCLK" pipe feeds timer1 when needed,
57
  50               	;                              the "PCLK" pipe feeds timer1 when needed,
58
  51               	;                              and is turned off when it isn't needed.
58
  51               	;                              and is turned off when it isn't needed.
59
  52               	
59
  52               	
60
  53               	#include <avr/io.h>
60
  53               	#include <avr/io.h>
61
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s 			page 2
61
GAS LISTING /tmp/cckBHomO.s 			page 2
62
 
62
 
63
 
63
 
64
   1               	/* Copyright (c) 2002,2003 Marek Michalkiewicz, Joerg Wunsch
64
   1               	/* Copyright (c) 2002,2003,2005,2006, Marek Michalkiewicz, Joerg Wunsch
65
   2               	   All rights reserved.
65
   2               	   All rights reserved.
66
   3               	
66
   3               	
67
   4               	   Redistribution and use in source and binary forms, with or without
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:
68
   5               	   modification, are permitted provided that the following conditions are met:
69
   6               	
69
   6               	
70
   7               	   * Redistributions of source code must retain the above copyright
70
   7               	   * Redistributions of source code must retain the above copyright
71
   8               	     notice, this list of conditions and the following disclaimer.
71
   8               	     notice, this list of conditions and the following disclaimer.
-
 
72
   9               	
72
   9               	   * Redistributions in binary form must reproduce the above copyright
73
  10               	   * Redistributions in binary form must reproduce the above copyright
73
  10               	     notice, this list of conditions and the following disclaimer in
74
  11               	     notice, this list of conditions and the following disclaimer in
74
  11               	     the documentation and/or other materials provided with the
75
  12               	     the documentation and/or other materials provided with the
75
  12               	     distribution.
76
  13               	     distribution.
-
 
77
  14               	
-
 
78
  15               	   * Neither the name of the copyright holders nor the names of
-
 
79
  16               	     contributors may be used to endorse or promote products derived
-
 
80
  17               	     from this software without specific prior written permission.
76
  13               	
81
  18               	
77
  14               	  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
82
  19               	  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
83
  20               	  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
79
  16               	  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
84
  21               	  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
80
  17               	  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
85
  22               	  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
81
  18               	  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
86
  23               	  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
82
  19               	  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
87
  24               	  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
83
  20               	  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
88
  25               	  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
89
  26               	  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
85
  22               	  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
90
  27               	  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
91
  28               	  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
87
  24               	  POSSIBILITY OF SUCH DAMAGE. */
92
  29               	  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               	
93
  30               	
-
 
94
  31               	/* $Id: io.h,v 1.24.2.7 2006/04/19 16:53:25 aesok Exp $ */
-
 
95
  32               	
-
 
96
  33               	/** \defgroup avr_io <avr/io.h>: AVR device-specific IO definitions
-
 
97
  34               	    \code #include <avr/io.h> \endcode
-
 
98
  35               	
94
  31               	    This header file includes the apropriate IO definitions for the
99
  36               	    This header file includes the apropriate IO definitions for the
95
  32               	    device that has been specified by the <tt>-mmcu=</tt> compiler
100
  37               	    device that has been specified by the <tt>-mmcu=</tt> compiler
96
  33               	    command-line switch.  This is done by diverting to the appropriate
101
  38               	    command-line switch.  This is done by diverting to the appropriate
97
  34               	    file <tt>&lt;avr/io</tt><em>XXXX</em><tt>.h&gt;</tt> which should
102
  39               	    file <tt>&lt;avr/io</tt><em>XXXX</em><tt>.h&gt;</tt> which should
98
  35               	    never be included directly.  Some register names common to all
103
  40               	    never be included directly.  Some register names common to all
99
  36               	    AVR devices are defined directly within <tt>&lt;avr/io.h&gt;</tt>,
104
  41               	    AVR devices are defined directly within <tt>&lt;avr/io.h&gt;</tt>,
100
  37               	    but most of the details come from the respective include file.
105
  42               	    but most of the details come from the respective include file.
101
  38               	
106
  43               	
102
  39               	    Note that this file always includes
107
  44               	    Note that this file always includes
103
  40               	    \code #include <avr/sfr_defs.h> \endcode
108
  45               	    \code #include <avr/sfr_defs.h> \endcode
104
  41               	    See \ref avr_sfr for the details.
109
  46               	    See \ref avr_sfr for the details.
105
  42               	
110
  47               	
106
  43               	    Included are definitions of the IO register set and their
111
  48               	    Included are definitions of the IO register set and their
107
  44               	    respective bit values as specified in the Atmel documentation.
112
  49               	    respective bit values as specified in the Atmel documentation.
108
  45               	    Note that Atmel is not very consistent in its naming conventions,
113
  50               	    Note that Atmel is not very consistent in its naming conventions,
109
  46               	    so even identical functions sometimes get different names on
114
  51               	    so even identical functions sometimes get different names on
110
  47               	    different devices.
115
  52               	    different devices.
111
  48               	
116
  53               	
112
  49               	    Also included are the specific names useable for interrupt
117
  54               	    Also included are the specific names useable for interrupt
113
  50               	    function definitions as documented
118
  55               	    function definitions as documented
114
  51               	    \ref avr_signames "here".
119
  56               	    \ref avr_signames "here".
115
  52               	
120
  57               	
-
 
121
GAS LISTING /tmp/cckBHomO.s 			page 3
-
 
122
 
-
 
123
 
116
  53               	    Finally, the following macros are defined:
124
  58               	    Finally, the following macros are defined:
117
  54               	
125
  59               	
118
  55               	    - \b RAMEND
126
  60               	    - \b RAMEND
119
  56               	    <br>
127
  61               	    <br>
120
  57               	    A constant describing the last on-chip RAM location.
128
  62               	    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>
129
  63               	    <br>
125
  59               	    - \b XRAMEND
130
  64               	    - \b XRAMEND
126
  60               	    <br>
131
  65               	    <br>
127
  61               	    A constant describing the last possible location in RAM.
132
  66               	    A constant describing the last possible location in RAM.
128
  62               	    This is equal to RAMEND for devices that do not allow for
133
  67               	    This is equal to RAMEND for devices that do not allow for
129
  63               	    external RAM.
134
  68               	    external RAM.
130
  64               	    <br>
135
  69               	    <br>
131
  65               	    - \b E2END
136
  70               	    - \b E2END
132
  66               	    <br>
137
  71               	    <br>
133
  67               	    A constant describing the address of the last EEPROM cell.
138
  72               	    A constant describing the address of the last EEPROM cell.
134
  68               	    <br>
139
  73               	    <br>
135
  69               	    - \b FLASHEND
140
  74               	    - \b FLASHEND
136
  70               	    <br>
141
  75               	    <br>
137
  71               	    A constant describing the last byte address in flash ROM.
142
  76               	    A constant describing the last byte address in flash ROM.
138
  72               	    <br>
143
  77               	    <br>
139
  73               	    - \b SPM_PAGESIZE
144
  78               	    - \b SPM_PAGESIZE
140
  74               	    <br>
145
  79               	    <br>
141
  75               	    For devices with bootloader support, the flash pagesize
146
  80               	    For devices with bootloader support, the flash pagesize
142
  76               	    (in bytes) to be used for the \c SPM instruction. */
147
  81               	    (in bytes) to be used for the \c SPM instruction. */
143
  77               	
148
  82               	
144
  78               	#ifndef _AVR_IO_H_
149
  83               	#ifndef _AVR_IO_H_
145
  79               	#define _AVR_IO_H_
150
  84               	#define _AVR_IO_H_
146
  80               	
151
  85               	
147
  81               	#include <avr/sfr_defs.h>
152
  86               	#include <avr/sfr_defs.h>
148
   1               	/* Copyright (c) 2002, Marek Michalkiewicz <marekm@amelek.gda.pl>
153
   1               	/* Copyright (c) 2002, Marek Michalkiewicz <marekm@amelek.gda.pl>
149
   2               	   All rights reserved.
154
   2               	   All rights reserved.
150
   3               	
155
   3               	
151
   4               	   Redistribution and use in source and binary forms, with or without
156
   4               	   Redistribution and use in source and binary forms, with or without
152
   5               	   modification, are permitted provided that the following conditions are met:
157
   5               	   modification, are permitted provided that the following conditions are met:
153
   6               	
158
   6               	
154
   7               	   * Redistributions of source code must retain the above copyright
159
   7               	   * Redistributions of source code must retain the above copyright
155
   8               	     notice, this list of conditions and the following disclaimer.
160
   8               	     notice, this list of conditions and the following disclaimer.
-
 
161
   9               	
156
   9               	   * Redistributions in binary form must reproduce the above copyright
162
  10               	   * Redistributions in binary form must reproduce the above copyright
157
  10               	     notice, this list of conditions and the following disclaimer in
163
  11               	     notice, this list of conditions and the following disclaimer in
158
  11               	     the documentation and/or other materials provided with the
164
  12               	     the documentation and/or other materials provided with the
159
  12               	     distribution.
165
  13               	     distribution.
-
 
166
  14               	
-
 
167
  15               	   * Neither the name of the copyright holders nor the names of
-
 
168
  16               	     contributors may be used to endorse or promote products derived
-
 
169
  17               	     from this software without specific prior written permission.
160
  13               	
170
  18               	
161
  14               	   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
171
  19               	   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
172
  20               	   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
163
  16               	   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
173
  21               	   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
164
  17               	   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
174
  22               	   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
165
  18               	   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
175
  23               	   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
166
  19               	   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
176
  24               	   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
167
  20               	   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
177
  25               	   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
178
  26               	   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
169
  22               	   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
179
  27               	   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
180
  28               	   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
181
GAS LISTING /tmp/cckBHomO.s 			page 4
182
 
182
 
183
 
183
 
-
 
184
  29               	   POSSIBILITY OF SUCH DAMAGE.  */
-
 
185
  30               	
-
 
186
  31               	/* avr/sfr_defs.h - macros for accessing AVR special function registers */
-
 
187
  32               	
-
 
188
  33               	/* $Id: sfr_defs.h,v 1.16 2005/09/10 21:31:13 joerg_wunsch Exp $ */
-
 
189
  34               	
-
 
190
  35               	#ifndef _AVR_SFR_DEFS_H_
-
 
191
  36               	#define _AVR_SFR_DEFS_H_ 1
-
 
192
  37               	
-
 
193
  38               	/** \defgroup avr_sfr_notes Additional notes from <avr/sfr_defs.h>
184
  34               	    \ingroup avr_sfr
194
  39               	    \ingroup avr_sfr
185
  35               	
195
  40               	
186
  36               	   The \c <avr/sfr_defs.h> file is included by all of the \c <avr/ioXXXX.h>
196
  41               	   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
197
  42               	   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
198
  43               	   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
199
  44               	   <tt>_SFR_ASM_COMPAT</tt> define.  Some examples from \c <avr/iom128.h> to
190
  40               	   show how to define such macros:
200
  45               	   show how to define such macros:
191
  41               	
201
  46               	
192
  42               	\code
202
  47               	\code
193
  43               	#define PORTA _SFR_IO8(0x1b)
203
  48               	#define PORTA _SFR_IO8(0x1b)
194
  44               	#define TCNT1 _SFR_IO16(0x2c)
204
  49               	#define TCNT1 _SFR_IO16(0x2c)
195
  45               	#define PORTF _SFR_MEM8(0x61)
205
  50               	#define PORTF _SFR_MEM8(0x61)
196
  46               	#define TCNT3 _SFR_MEM16(0x88)
206
  51               	#define TCNT3 _SFR_MEM16(0x88)
197
  47               	\endcode
207
  52               	\endcode
198
  48               	
208
  53               	
199
  49               	   If \c _SFR_ASM_COMPAT is not defined, C programs can use names like
209
  54               	   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
210
  55               	   <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
211
  56               	   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
212
  57               	   instructions if possible).  The \c __SFR_OFFSET definition is not used in
203
  53               	   any way in this case.
213
  58               	   any way in this case.
204
  54               	
214
  59               	
205
  55               	   Define \c _SFR_ASM_COMPAT as 1 to make these names work as simple constants
215
  60               	   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
216
  61               	   (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
217
  62               	   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
218
  63               	   \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
219
  64               	   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.
220
  65               	   addresses in \c in/out instructions, you must subtract 0x20 from them.
211
  61               	
221
  66               	
212
  62               	   For more backwards compatibility, insert the following at the start of your
222
  67               	   For more backwards compatibility, insert the following at the start of your
213
  63               	   old assembler source file:
223
  68               	   old assembler source file:
214
  64               	
224
  69               	
215
  65               	\code
225
  70               	\code
216
  66               	#define __SFR_OFFSET 0
226
  71               	#define __SFR_OFFSET 0
217
  67               	\endcode
227
  72               	\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               	
228
  73               	
224
  74               	   Real example - this code could be used in a boot loader that is portable
229
  74               	   This automatically subtracts 0x20 from I/O space addresses, but it's a
225
  75               	   between devices with \c SPMCR at different addresses.
230
  75               	   hack, so it is recommended to change your source: wrap such addresses in
226
  76               	
231
  76               	   macros defined here, as shown below.  After this is done, the
-
 
232
  77               	   <tt>__SFR_OFFSET</tt> definition is no longer necessary and can be removed.
227
  77               	\verbatim
233
  78               	
228
  78               	<avr/iom163.h>: #define SPMCR _SFR_IO8(0x37)
234
  79               	   Real example - this code could be used in a boot loader that is portable
229
  79               	<avr/iom128.h>: #define SPMCR _SFR_MEM8(0x68)
235
  80               	   between devices with \c SPMCR at different addresses.
230
  80               	\endverbatim
-
 
231
  81               	
236
  81               	
232
  82               	\code
237
  82               	\verbatim
233
  82               	
-
 
234
  83               	/*
238
  83               	<avr/iom163.h>: #define SPMCR _SFR_IO8(0x37)
235
  84               	 * Registers common to all AVR devices.
239
  84               	<avr/iom128.h>: #define SPMCR _SFR_MEM8(0x68)
236
  85               	 */
240
  85               	\endverbatim
-
 
241
GAS LISTING /tmp/cckBHomO.s 			page 5
-
 
242
 
-
 
243
 
237
  86               	
244
  86               	
238
  87               	#if __AVR_ARCH__ != 1
245
  87               	\code
239
  88               	/*
246
  87               	
-
 
247
  88               	#ifndef __AVR_HAVE_MOVW__
240
  89               	 * AVR architecture 1 has no RAM, thus no stack pointer.
248
  89               	#  if  defined(__AVR_ENHANCED__) && __AVR_ENHANCED__
241
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s 			page 5
249
  90               	#   define __AVR_HAVE_MOVW__ 1
242
 
-
 
243
 
-
 
244
  90               	 *
250
  91               	#  endif
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
251
  92               	#endif
247
  93               	 * and no option for external RAM), thus SPH is officially "reserved"
252
  93               	
248
  94               	 * for them.  We catch this case below after including the
253
  94               	#ifndef __AVR_HAVE_LPMX__
249
  95               	 * device-specific ioXXXX.h file, by examining XRAMEND, and
254
  95               	# if  defined(__AVR_ENHANCED__) && __AVR_ENHANCED__
250
  96               	 * #undef-ining SP and SPH in that case.
255
  96               	#  define __AVR_HAVE_LPMX__ 1
251
  97               	 */
256
  97               	# endif
252
  98               	/* Stack Pointer */
257
  98               	#endif
253
  99               	#define SP        _SFR_IO16(0x3D)
258
  99               	
254
 100               	#define SPL       _SFR_IO8(0x3D)
259
 100               	/*
255
 101               	#define SPH       _SFR_IO8(0x3E)
260
 101               	 * Registers common to all AVR devices.
256
 102               	#endif /* #if __AVR_ARCH__ != 1 */
261
 102               	 */
257
 103               	
262
 103               	
258
 104               	/* Status REGister */
263
 104               	#if __AVR_ARCH__ != 1
259
 105               	#define SREG      _SFR_IO8(0x3F)
-
 
260
 106               	
264
 105               	/*
261
 107               	/* Status Register - SREG */
265
 106               	 * AVR architecture 1 has no RAM, thus no stack pointer.
262
 108               	#define    SREG_I       7
266
 107               	 *
263
 109               	#define    SREG_T       6
267
 108               	 * All other archs do have a stack pointer.  Some devices have only
264
 110               	#define    SREG_H       5
-
 
265
 111               	#define    SREG_S       4
268
 109               	 * less than 256 bytes of possible RAM locations (128 Bytes of SRAM
266
 112               	#define    SREG_V       3
269
 110               	 * and no option for external RAM), thus SPH is officially "reserved"
267
 113               	#define    SREG_N       2
270
 111               	 * for them.  We catch this case below after including the
268
 114               	#define    SREG_Z       1
271
 112               	 * device-specific ioXXXX.h file, by examining XRAMEND, and
269
 115               	#define    SREG_C       0
272
 113               	 * #undef-ining SP and SPH in that case.
270
 116               	
273
 114               	 */
271
 117               	/* Pointer definition */
274
 115               	/* Stack Pointer */
272
 118               	#if __AVR_ARCH__ != 1
-
 
273
 119               	/* avr1 has only the Z pointer */
-
 
274
 120               	#define    XL           r26
275
 116               	#define SP        _SFR_IO16(0x3D)
275
 121               	#define    XH           r27
276
 117               	#define SPL       _SFR_IO8(0x3D)
276
 122               	#define    YL           r28
277
 118               	#define SPH       _SFR_IO8(0x3E)
277
 123               	#define    YH           r29
278
 119               	#endif /* #if __AVR_ARCH__ != 1 */
278
 124               	#endif /* #if __AVR_ARCH__ != 1 */
279
 120               	
279
 125               	#define    ZL           r30
280
 121               	/* Status REGister */
280
 126               	#define    ZH           r31
281
 122               	#define SREG      _SFR_IO8(0x3F)
281
 127               	
282
 123               	
282
 128               	/*
283
 124               	/* Status Register - SREG */
283
 129               	 * Only few devices come without EEPROM.  In order to assemble the
284
 125               	#define    SREG_I       7
284
 130               	 * EEPROM library components without defining a specific device, we
285
 126               	#define    SREG_T       6
285
 131               	 * keep the EEPROM-related definitions here, and catch the devices
286
 127               	#define    SREG_H       5
286
 132               	 * without EEPROM (E2END == 0) below.  Obviously, the EEPROM library
287
 128               	#define    SREG_S       4
287
 133               	 * functions will not work for them. ;-)
288
 129               	#define    SREG_V       3
288
 134               	 */
289
 130               	#define    SREG_N       2
289
 135               	/* EEPROM Control Register */
290
 131               	#define    SREG_Z       1
290
 136               	#define EECR	_SFR_IO8(0x1C)
291
 132               	#define    SREG_C       0
291
 137               	
292
 133               	
292
 138               	/* EEPROM Data Register */
293
 134               	/* Pointer definition */
293
 139               	#define EEDR	_SFR_IO8(0x1D)
294
 135               	#if __AVR_ARCH__ != 1
294
 140               	
-
 
295
 141               	/* EEPROM Address Register */
295
 136               	/* avr1 has only the Z pointer */
296
 142               	#define EEAR	_SFR_IO16(0x1E)
296
 137               	#define    XL           r26
297
 143               	#define EEARL	_SFR_IO8(0x1E)
297
 138               	#define    XH           r27
298
 144               	#define EEARH	_SFR_IO8(0x1F)
298
 139               	#define    YL           r28
299
 145               	
299
 140               	#define    YH           r29
300
 146               	/* EEPROM Control Register */
300
 141               	#endif /* #if __AVR_ARCH__ != 1 */
301
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s 			page 6
301
GAS LISTING /tmp/cckBHomO.s 			page 6
302
 
302
 
303
 
303
 
304
 147               	#define    EERIE        3
304
 142               	#define    ZL           r30
305
 148               	#define    EEMWE        2
305
 143               	#define    ZH           r31
-
 
306
 144               	
-
 
307
 145               	/*
-
 
308
 146               	 * Only few devices come without EEPROM.  In order to assemble the
-
 
309
 147               	 * EEPROM library components without defining a specific device, we
-
 
310
 148               	 * keep the EEPROM-related definitions here.
306
 149               	#define    EEWE         1
311
 149               	 */
307
 150               	#define    EERE         0
312
 150               	#if defined(__COMPILING_AVR_LIBC__)
308
 151               	
313
 151               	
-
 
314
 152               	/* EEPROM Control Register */
-
 
315
 153               	#define EECR	_SFR_IO8(0x1C)
-
 
316
 154               	
-
 
317
 155               	/* EEPROM Data Register */
-
 
318
 156               	#define EEDR	_SFR_IO8(0x1D)
-
 
319
 157               	
-
 
320
 158               	/* EEPROM Address Register */
-
 
321
 159               	#define EEAR	_SFR_IO16(0x1E)
-
 
322
 160               	#define EEARL	_SFR_IO8(0x1E)
-
 
323
 161               	#define EEARH	_SFR_IO8(0x1F)
-
 
324
 162               	
-
 
325
 163               	/* EEPROM Control Register */
-
 
326
 164               	#define    EERIE        3
-
 
327
 165               	#define    EEMWE        2
-
 
328
 166               	#define    EEWE         1
-
 
329
 167               	#define    EERE         0
-
 
330
 168               	
-
 
331
 169               	#endif /* __COMPILING_AVR_LIBC__ */
-
 
332
 170               	
309
 152               	#if defined (__AVR_AT94K__)
333
 171               	#if defined (__AVR_AT94K__)
310
 153               	#  include <avr/ioat94k.h>
334
 172               	#  include <avr/ioat94k.h>
311
 154               	#elif defined (__AVR_AT43USB320__)
335
 173               	#elif defined (__AVR_AT43USB320__)
312
 155               	#  include <avr/io43u32x.h>
336
 174               	#  include <avr/io43u32x.h>
313
 156               	#elif defined (__AVR_AT43USB355__)
337
 175               	#elif defined (__AVR_AT43USB355__)
314
 157               	#  include <avr/io43u35x.h>
338
 176               	#  include <avr/io43u35x.h>
315
 158               	#elif defined (__AVR_AT76C711__)
339
 177               	#elif defined (__AVR_AT76C711__)
316
 159               	#  include <avr/io76c711.h>
340
 178               	#  include <avr/io76c711.h>
317
 160               	#elif defined (__AVR_AT86RF401__)
341
 179               	#elif defined (__AVR_AT86RF401__)
318
 161               	#  include <avr/io86r401.h>
342
 180               	#  include <avr/io86r401.h>
-
 
343
 181               	#elif defined (__AVR_AT90PWM2__)
-
 
344
 182               	#  include <avr/io90pwmx.h>
-
 
345
 183               	#elif defined (__AVR_AT90PWM3__)
-
 
346
 184               	#  include <avr/io90pwmx.h>
319
 162               	#elif defined (__AVR_ATmega128__)
347
 185               	#elif defined (__AVR_ATmega128__)
320
 163               	#  include <avr/iom128.h>
348
 186               	#  include <avr/iom128.h>
-
 
349
 187               	#elif defined (__AVR_ATmega1280__)
-
 
350
 188               	#  include <avr/iom1280.h>
-
 
351
 189               	#elif defined (__AVR_ATmega1281__)
-
 
352
 190               	#  include <avr/iom1281.h>
-
 
353
 191               	#elif defined (__AVR_AT90CAN32__)
-
 
354
 192               	#  include <avr/iocan32.h>
-
 
355
 193               	#elif defined (__AVR_AT90CAN64__)
-
 
356
 194               	#  include <avr/iocan64.h>
-
 
357
 195               	#elif defined (__AVR_AT90CAN128__)
-
 
358
 196               	#  include <avr/iocan128.h>
-
 
359
 197               	#elif defined (__AVR_AT90USB646__)
-
 
360
 198               	#  include <avr/iousb646.h>
-
 
361
GAS LISTING /tmp/cckBHomO.s 			page 7
-
 
362
 
-
 
363
 
-
 
364
 199               	#elif defined (__AVR_AT90USB647__)
-
 
365
 200               	#  include <avr/iousb647.h>
-
 
366
 201               	#elif defined (__AVR_AT90USB1286__)
-
 
367
 202               	#  include <avr/iousb1286.h>
-
 
368
 203               	#elif defined (__AVR_AT90USB1287__)
-
 
369
 204               	#  include <avr/iousb1287.h>
321
 164               	#elif defined (__AVR_ATmega64__)
370
 205               	#elif defined (__AVR_ATmega64__)
322
 165               	#  include <avr/iom64.h>
371
 206               	#  include <avr/iom64.h>
-
 
372
 207               	#elif defined (__AVR_ATmega640__)
-
 
373
 208               	#  include <avr/iom640.h>
-
 
374
 209               	#elif defined (__AVR_ATmega644__)
-
 
375
 210               	#  include <avr/iom644.h>
-
 
376
 211               	#elif defined (__AVR_ATmega644P__)
-
 
377
 212               	#  include <avr/iom644.h>
-
 
378
 213               	#elif defined (__AVR_ATmega645__)
-
 
379
 214               	#  include <avr/iom645.h>
-
 
380
 215               	#elif defined (__AVR_ATmega6450__)
-
 
381
 216               	#  include <avr/iom6450.h>
-
 
382
 217               	#elif defined (__AVR_ATmega649__)
-
 
383
 218               	#  include <avr/iom649.h>
-
 
384
 219               	#elif defined (__AVR_ATmega6490__)
-
 
385
 220               	#  include <avr/iom6490.h>
323
 166               	#elif defined (__AVR_ATmega103__)
386
 221               	#elif defined (__AVR_ATmega103__)
324
 167               	#  include <avr/iom103.h>
387
 222               	#  include <avr/iom103.h>
325
 168               	#elif defined (__AVR_ATmega32__)
388
 223               	#elif defined (__AVR_ATmega32__)
326
 169               	#  include <avr/iom32.h>
389
 224               	#  include <avr/iom32.h>
327
 170               	#elif defined (__AVR_ATmega323__)
390
 225               	#elif defined (__AVR_ATmega323__)
328
 171               	#  include <avr/iom323.h>
391
 226               	#  include <avr/iom323.h>
-
 
392
 227               	#elif defined (__AVR_ATmega324P__)
-
 
393
 228               	#  include <avr/iom324.h>
-
 
394
 229               	#elif defined (__AVR_ATmega325__)
-
 
395
 230               	#  include <avr/iom325.h>
-
 
396
 231               	#elif defined (__AVR_ATmega3250__)
-
 
397
 232               	#  include <avr/iom3250.h>
-
 
398
 233               	#elif defined (__AVR_ATmega329__)
-
 
399
 234               	#  include <avr/iom329.h>
-
 
400
 235               	#elif defined (__AVR_ATmega3290__)
-
 
401
 236               	#  include <avr/iom3290.h>
-
 
402
 237               	#elif defined (__AVR_ATmega406__)
-
 
403
 238               	#  include <avr/iom406.h>
329
 172               	#elif defined (__AVR_ATmega16__)
404
 239               	#elif defined (__AVR_ATmega16__)
330
 173               	#  include <avr/iom16.h>
405
 240               	#  include <avr/iom16.h>
331
 174               	#elif defined (__AVR_ATmega161__)
406
 241               	#elif defined (__AVR_ATmega161__)
332
 175               	#  include <avr/iom161.h>
407
 242               	#  include <avr/iom161.h>
333
 176               	#elif defined (__AVR_ATmega162__)
408
 243               	#elif defined (__AVR_ATmega162__)
334
 177               	#  include <avr/iom162.h>
409
 244               	#  include <avr/iom162.h>
335
 178               	#elif defined (__AVR_ATmega163__)
410
 245               	#elif defined (__AVR_ATmega163__)
336
 179               	#  include <avr/iom163.h>
411
 246               	#  include <avr/iom163.h>
-
 
412
 247               	#elif defined (__AVR_ATmega164P__)
-
 
413
 248               	#  include <avr/iom164.h>
-
 
414
 249               	#elif defined (__AVR_ATmega165__)
-
 
415
 250               	#  include <avr/iom165.h>
-
 
416
 251               	#elif defined (__AVR_ATmega168__)
-
 
417
 252               	#  include <avr/iom168.h>
337
 180               	#elif defined (__AVR_ATmega169__)
418
 253               	#elif defined (__AVR_ATmega169__)
338
 181               	#  include <avr/iom169.h>
419
 254               	#  include <avr/iom169.h>
339
 182               	#elif defined (__AVR_ATmega8__)
420
 255               	#elif defined (__AVR_ATmega8__)
-
 
421
GAS LISTING /tmp/cckBHomO.s 			page 8
-
 
422
 
-
 
423
 
340
 183               	#  include <avr/iom8.h>
424
 256               	#  include <avr/iom8.h>
341
   1               	/* Copyright (c) 2002, Marek Michalkiewicz
425
   1               	/* Copyright (c) 2002, Marek Michalkiewicz
342
   2               	   All rights reserved.
426
   2               	   All rights reserved.
343
   3               	
427
   3               	
344
   4               	   Redistribution and use in source and binary forms, with or without
428
   4               	   Redistribution and use in source and binary forms, with or without
345
   5               	   modification, are permitted provided that the following conditions are met:
429
   5               	   modification, are permitted provided that the following conditions are met:
346
   6               	
430
   6               	
347
   7               	   * Redistributions of source code must retain the above copyright
431
   7               	   * Redistributions of source code must retain the above copyright
348
   8               	     notice, this list of conditions and the following disclaimer.
432
   8               	     notice, this list of conditions and the following disclaimer.
-
 
433
   9               	
349
   9               	   * Redistributions in binary form must reproduce the above copyright
434
  10               	   * Redistributions in binary form must reproduce the above copyright
350
  10               	     notice, this list of conditions and the following disclaimer in
435
  11               	     notice, this list of conditions and the following disclaimer in
351
  11               	     the documentation and/or other materials provided with the
436
  12               	     the documentation and/or other materials provided with the
352
  12               	     distribution.
437
  13               	     distribution.
-
 
438
  14               	
-
 
439
  15               	   * Neither the name of the copyright holders nor the names of
-
 
440
  16               	     contributors may be used to endorse or promote products derived
-
 
441
  17               	     from this software without specific prior written permission.
353
  13               	
442
  18               	
354
  14               	  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
443
  19               	  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
444
  20               	  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
356
  16               	  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
445
  21               	  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
357
  17               	  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
446
  22               	  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
358
  18               	  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
447
  23               	  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
359
  19               	  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
448
  24               	  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
360
  20               	  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
449
  25               	  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
450
  26               	  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
365
  22               	  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
451
  27               	  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
452
  28               	  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
367
  24               	  POSSIBILITY OF SUCH DAMAGE. */
453
  29               	  POSSIBILITY OF SUCH DAMAGE. */
368
  25               	
454
  30               	
369
  26               	/* $Id: iom8.h,v 1.8 2003/02/17 09:57:28 marekm Exp $ */
455
  31               	/* $Id: iom8.h,v 1.13 2005/10/30 22:11:23 joerg_wunsch 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               	
456
  32               	
376
  33               	/* This file should only be included from <avr/io.h>, never directly. */
457
  33               	/* avr/iom8.h - definitions for ATmega8 */
377
  34               	
458
  34               	
378
  35               	#ifndef _AVR_IO_H_
459
  35               	#ifndef _AVR_IOM8_H_
-
 
460
  36               	#define _AVR_IOM8_H_ 1
-
 
461
  37               	
-
 
462
  38               	/* This file should only be included from <avr/io.h>, never directly. */
-
 
463
  39               	
-
 
464
  40               	#ifndef _AVR_IO_H_
379
  36               	#  error "Include <avr/io.h> instead of this file."
465
  41               	#  error "Include <avr/io.h> instead of this file."
380
  37               	#endif
466
  42               	#endif
381
  38               	
467
  43               	
382
  39               	#ifndef _AVR_IOXXX_H_
468
  44               	#ifndef _AVR_IOXXX_H_
383
  40               	#  define _AVR_IOXXX_H_ "iom8.h"
469
  45               	#  define _AVR_IOXXX_H_ "iom8.h"
384
  41               	#else
470
  46               	#else
385
  42               	#  error "Attempt to include more than one <avr/ioXXX.h> file."
471
  47               	#  error "Attempt to include more than one <avr/ioXXX.h> file."
386
  43               	#endif 
472
  48               	#endif 
387
  44               	
473
  49               	
388
  45               	/* I/O registers */
474
  50               	/* I/O registers */
389
  46               	
475
  51               	
390
  47               	/* TWI stands for "Two Wire Interface" or "TWI Was I2C(tm)" */
476
  52               	/* TWI stands for "Two Wire Interface" or "TWI Was I2C(tm)" */
391
  48               	#define TWBR	_SFR_IO8(0x00)
477
  53               	#define TWBR	_SFR_IO8(0x00)
392
  49               	#define TWSR	_SFR_IO8(0x01)
478
  54               	#define TWSR	_SFR_IO8(0x01)
393
  50               	#define TWAR	_SFR_IO8(0x02)
479
  55               	#define TWAR	_SFR_IO8(0x02)
394
  51               	#define TWDR	_SFR_IO8(0x03)
480
  56               	#define TWDR	_SFR_IO8(0x03)
-
 
481
GAS LISTING /tmp/cckBHomO.s 			page 9
-
 
482
 
-
 
483
 
395
  52               	
484
  57               	
396
  53               	/* ADC */
485
  58               	/* ADC */
397
  54               	#define ADCW	_SFR_IO16(0x04)
486
  59               	#define ADCW	_SFR_IO16(0x04)
398
  55               	#ifndef __ASSEMBLER__
487
  60               	#ifndef __ASSEMBLER__
399
  56               	#define ADC	_SFR_IO16(0x04)
488
  61               	#define ADC	_SFR_IO16(0x04)
400
  57               	#endif
489
  62               	#endif
401
  58               	#define ADCL	_SFR_IO8(0x04)
490
  63               	#define ADCL	_SFR_IO8(0x04)
402
  59               	#define ADCH	_SFR_IO8(0x05)
491
  64               	#define ADCH	_SFR_IO8(0x05)
403
  60               	#define ADCSR	_SFR_IO8(0x06)
492
  65               	#define ADCSR	_SFR_IO8(0x06)
404
  61               	#define ADCSRA	_SFR_IO8(0x06)  /* Changed in 2486H-AVR-09/02 */
493
  66               	#define ADCSRA	_SFR_IO8(0x06)  /* Changed in 2486H-AVR-09/02 */
405
  62               	#define ADMUX	_SFR_IO8(0x07)
494
  67               	#define ADMUX	_SFR_IO8(0x07)
406
  63               	
495
  68               	
407
  64               	/* analog comparator */
496
  69               	/* analog comparator */
408
  65               	#define ACSR	_SFR_IO8(0x08)
497
  70               	#define ACSR	_SFR_IO8(0x08)
409
  66               	
498
  71               	
410
  67               	/* USART */
499
  72               	/* USART */
411
  68               	#define UBRRL	_SFR_IO8(0x09)
500
  73               	#define UBRRL	_SFR_IO8(0x09)
412
  69               	#define UCSRB	_SFR_IO8(0x0A)
501
  74               	#define UCSRB	_SFR_IO8(0x0A)
413
  70               	#define UCSRA	_SFR_IO8(0x0B)
502
  75               	#define UCSRA	_SFR_IO8(0x0B)
414
  71               	#define UDR	_SFR_IO8(0x0C)
503
  76               	#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               	
504
  77               	
421
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s 			page 8
-
 
422
 
-
 
423
 
-
 
424
  78               	/* Port D */
505
  78               	/* SPI */
425
  79               	#define PIND	_SFR_IO8(0x10)
506
  79               	#define SPCR	_SFR_IO8(0x0D)
426
  80               	#define DDRD	_SFR_IO8(0x11)
507
  80               	#define SPSR	_SFR_IO8(0x0E)
427
  81               	#define PORTD	_SFR_IO8(0x12)
508
  81               	#define SPDR	_SFR_IO8(0x0F)
428
  82               	
509
  82               	
429
  83               	/* Port C */
510
  83               	/* Port D */
430
  84               	#define PINC	_SFR_IO8(0x13)
511
  84               	#define PIND	_SFR_IO8(0x10)
431
  85               	#define DDRC	_SFR_IO8(0x14)
512
  85               	#define DDRD	_SFR_IO8(0x11)
432
  86               	#define PORTC	_SFR_IO8(0x15)
513
  86               	#define PORTD	_SFR_IO8(0x12)
433
  87               	
514
  87               	
434
  88               	/* Port B */
515
  88               	/* Port C */
435
  89               	#define PINB	_SFR_IO8(0x16)
516
  89               	#define PINC	_SFR_IO8(0x13)
436
  90               	#define DDRB	_SFR_IO8(0x17)
517
  90               	#define DDRC	_SFR_IO8(0x14)
437
  91               	#define PORTB	_SFR_IO8(0x18)
518
  91               	#define PORTC	_SFR_IO8(0x15)
438
  92               	
519
  92               	
439
  93               	/* 0x1C..0x1F EEPROM */
520
  93               	/* Port B */
440
  94               	
521
  94               	#define PINB	_SFR_IO8(0x16)
441
  95               	#define UCSRC	_SFR_IO8(0x20)
522
  95               	#define DDRB	_SFR_IO8(0x17)
442
  96               	#define UBRRH	_SFR_IO8(0x20)
523
  96               	#define PORTB	_SFR_IO8(0x18)
443
  97               	
524
  97               	
444
  98               	#define WDTCR	_SFR_IO8(0x21)
525
  98               	/* EEPROM Control Register */
445
  99               	#define ASSR	_SFR_IO8(0x22)
526
  99               	#define EECR	_SFR_IO8(0x1C)
446
 100               	
527
 100               	
447
 101               	/* Timer 2 */
528
 101               	/* EEPROM Data Register */
448
 102               	#define OCR2	_SFR_IO8(0x23)
529
 102               	#define EEDR	_SFR_IO8(0x1D)
449
 103               	#define TCNT2	_SFR_IO8(0x24)
530
 103               	
450
 104               	#define TCCR2	_SFR_IO8(0x25)
531
 104               	/* EEPROM Address Register */
451
 105               	
532
 105               	#define EEAR	_SFR_IO16(0x1E)
452
 106               	/* Timer 1 */
533
 106               	#define EEARL	_SFR_IO8(0x1E)
453
 107               	#define ICR1	_SFR_IO16(0x26)
534
 107               	#define EEARH	_SFR_IO8(0x1F)
454
 108               	#define ICR1L	_SFR_IO8(0x26)
535
 108               	
455
 109               	#define ICR1H	_SFR_IO8(0x27)
536
 109               	#define UCSRC	_SFR_IO8(0x20)
456
 110               	#define OCR1B	_SFR_IO16(0x28)
537
 110               	#define UBRRH	_SFR_IO8(0x20)
457
 111               	#define OCR1BL	_SFR_IO8(0x28)
538
 111               	
458
 112               	#define OCR1BH	_SFR_IO8(0x29)
539
 112               	#define WDTCR	_SFR_IO8(0x21)
459
 113               	#define OCR1A	_SFR_IO16(0x2A)
540
 113               	#define ASSR	_SFR_IO8(0x22)
460
 114               	#define OCR1AL	_SFR_IO8(0x2A)
541
GAS LISTING /tmp/cckBHomO.s 			page 10
461
 115               	#define OCR1AH	_SFR_IO8(0x2B)
542
 
462
 116               	#define TCNT1	_SFR_IO16(0x2C)
543
 
463
 117               	#define TCNT1L	_SFR_IO8(0x2C)
544
 114               	
464
 118               	#define TCNT1H	_SFR_IO8(0x2D)
545
 115               	/* Timer 2 */
465
 119               	#define TCCR1B	_SFR_IO8(0x2E)
546
 116               	#define OCR2	_SFR_IO8(0x23)
466
 120               	#define TCCR1A	_SFR_IO8(0x2F)
547
 117               	#define TCNT2	_SFR_IO8(0x24)
467
 121               	
548
 118               	#define TCCR2	_SFR_IO8(0x25)
468
 122               	#define SFIOR	_SFR_IO8(0x30)
549
 119               	
469
 123               	
550
 120               	/* Timer 1 */
470
 124               	#define OSCCAL	_SFR_IO8(0x31)
551
 121               	#define ICR1	_SFR_IO16(0x26)
471
 125               	
552
 122               	#define ICR1L	_SFR_IO8(0x26)
472
 126               	/* Timer 0 */
553
 123               	#define ICR1H	_SFR_IO8(0x27)
473
 127               	#define TCNT0	_SFR_IO8(0x32)
554
 124               	#define OCR1B	_SFR_IO16(0x28)
474
 128               	#define TCCR0	_SFR_IO8(0x33)
555
 125               	#define OCR1BL	_SFR_IO8(0x28)
-
 
556
 126               	#define OCR1BH	_SFR_IO8(0x29)
-
 
557
 127               	#define OCR1A	_SFR_IO16(0x2A)
-
 
558
 128               	#define OCR1AL	_SFR_IO8(0x2A)
-
 
559
 129               	#define OCR1AH	_SFR_IO8(0x2B)
-
 
560
 130               	#define TCNT1	_SFR_IO16(0x2C)
-
 
561
 131               	#define TCNT1L	_SFR_IO8(0x2C)
-
 
562
 132               	#define TCNT1H	_SFR_IO8(0x2D)
-
 
563
 133               	#define TCCR1B	_SFR_IO8(0x2E)
-
 
564
 134               	#define TCCR1A	_SFR_IO8(0x2F)
-
 
565
 135               	
-
 
566
 136               	#define SFIOR	_SFR_IO8(0x30)
-
 
567
 137               	
-
 
568
 138               	#define OSCCAL	_SFR_IO8(0x31)
-
 
569
 139               	
-
 
570
 140               	/* Timer 0 */
-
 
571
 141               	#define TCNT0	_SFR_IO8(0x32)
-
 
572
 142               	#define TCCR0	_SFR_IO8(0x33)
-
 
573
 143               	
-
 
574
 144               	#define MCUCSR	_SFR_IO8(0x34)
-
 
575
 145               	#define MCUCR	_SFR_IO8(0x35)
-
 
576
 146               	
-
 
577
 147               	#define TWCR	_SFR_IO8(0x36)
-
 
578
 148               	
-
 
579
 149               	#define SPMCR	_SFR_IO8(0x37)
-
 
580
 150               	
-
 
581
 151               	#define TIFR	_SFR_IO8(0x38)
-
 
582
 152               	#define TIMSK	_SFR_IO8(0x39)
-
 
583
 153               	
-
 
584
 154               	#define GIFR	_SFR_IO8(0x3A)
-
 
585
 155               	#define GIMSK	_SFR_IO8(0x3B)
-
 
586
 156               	#define GICR	_SFR_IO8(0x3B)   /* Changed in 2486H-AVR-09/02 */
-
 
587
 157               	
-
 
588
 158               	/* 0x3C reserved (OCR0?) */
-
 
589
 159               	
-
 
590
 160               	/* 0x3D..0x3E SP */
-
 
591
 161               	
-
 
592
 162               	/* 0x3F SREG */
-
 
593
 163               	
-
 
594
 164               	/* Interrupt vectors */
-
 
595
 165               	
-
 
596
 166               	/* External Interrupt Request 0 */
-
 
597
 167               	#define INT0_vect			_VECTOR(1)
-
 
598
 168               	#define SIG_INTERRUPT0			_VECTOR(1)
-
 
599
 169               	
-
 
600
 170               	/* External Interrupt Request 1 */
-
 
601
GAS LISTING /tmp/cckBHomO.s 			page 11
-
 
602
 
-
 
603
 
-
 
604
 171               	#define INT1_vect			_VECTOR(2)
-
 
605
 172               	#define SIG_INTERRUPT1			_VECTOR(2)
-
 
606
 173               	
-
 
607
 174               	/* Timer/Counter2 Compare Match */
-
 
608
 175               	#define TIMER2_COMP_vect		_VECTOR(3)
-
 
609
 176               	#define SIG_OUTPUT_COMPARE2		_VECTOR(3)
-
 
610
 177               	
-
 
611
 178               	/* Timer/Counter2 Overflow */
-
 
612
 179               	#define TIMER2_OVF_vect			_VECTOR(4)
-
 
613
 180               	#define SIG_OVERFLOW2			_VECTOR(4)
-
 
614
 181               	
-
 
615
 182               	/* Timer/Counter1 Capture Event */
-
 
616
 183               	#define TIMER1_CAPT_vect		_VECTOR(5)
-
 
617
 184               	#define SIG_INPUT_CAPTURE1		_VECTOR(5)
-
 
618
 185               	
-
 
619
 186               	/* Timer/Counter1 Compare Match A */
-
 
620
 187               	#define TIMER1_COMPA_vect		_VECTOR(6)
-
 
621
 188               	#define SIG_OUTPUT_COMPARE1A		_VECTOR(6)
-
 
622
 189               	
-
 
623
 190               	/* Timer/Counter1 Compare Match B */
-
 
624
 191               	#define TIMER1_COMPB_vect		_VECTOR(7)
-
 
625
 192               	#define SIG_OUTPUT_COMPARE1B		_VECTOR(7)
-
 
626
 193               	
-
 
627
 194               	/* Timer/Counter1 Overflow */
-
 
628
 195               	#define TIMER1_OVF_vect			_VECTOR(8)
-
 
629
 196               	#define SIG_OVERFLOW1			_VECTOR(8)
-
 
630
 197               	
-
 
631
 198               	/* Timer/Counter0 Overflow */
-
 
632
 199               	#define TIMER0_OVF_vect			_VECTOR(9)
-
 
633
 200               	#define SIG_OVERFLOW0			_VECTOR(9)
-
 
634
 201               	
-
 
635
 202               	/* Serial Transfer Complete */
-
 
636
 203               	#define SPI_STC_vect			_VECTOR(10)
-
 
637
 204               	#define SIG_SPI				_VECTOR(10)
-
 
638
 205               	
-
 
639
 206               	/* USART, Rx Complete */
-
 
640
 207               	#define USART_RXC_vect			_VECTOR(11)
-
 
641
 208               	#define SIG_UART_RECV			_VECTOR(11)
-
 
642
 209               	
-
 
643
 210               	/* USART Data Register Empty */
-
 
644
 211               	#define USART_UDRE_vect			_VECTOR(12)
-
 
645
 212               	#define SIG_UART_DATA			_VECTOR(12)
-
 
646
 213               	
-
 
647
 214               	/* USART, Tx Complete */
-
 
648
 215               	#define USART_TXC_vect			_VECTOR(13)
-
 
649
 216               	#define SIG_UART_TRANS			_VECTOR(13)
-
 
650
 217               	
-
 
651
 218               	/* ADC Conversion Complete */
-
 
652
 219               	#define ADC_vect			_VECTOR(14)
-
 
653
 220               	#define SIG_ADC				_VECTOR(14)
-
 
654
 221               	
-
 
655
 222               	/* EEPROM Ready */
-
 
656
 223               	#define EE_RDY_vect			_VECTOR(15)
-
 
657
 224               	#define SIG_EEPROM_READY		_VECTOR(15)
-
 
658
 225               	
-
 
659
 226               	/* Analog Comparator */
-
 
660
 227               	#define ANA_COMP_vect			_VECTOR(16)
-
 
661
GAS LISTING /tmp/cckBHomO.s 			page 12
-
 
662
 
-
 
663
 
-
 
664
 228               	#define SIG_COMPARATOR			_VECTOR(16)
-
 
665
 229               	
-
 
666
 230               	/* 2-wire Serial Interface */
-
 
667
 231               	#define TWI_vect			_VECTOR(17)
-
 
668
 232               	#define SIG_2WIRE_SERIAL		_VECTOR(17)
-
 
669
 233               	
-
 
670
 234               	/* Store Program Memory Ready */
-
 
671
 235               	#define SPM_RDY_vect			_VECTOR(18)
-
 
672
 236               	#define SIG_SPM_READY			_VECTOR(18)
-
 
673
 237               	
-
 
674
 238               	#define _VECTORS_SIZE 38
-
 
675
 239               	
-
 
676
 240               	/* Bit numbers */
-
 
677
 241               	
-
 
678
 242               	/* GIMSK / GICR */
-
 
679
 243               	#define INT1	7
-
 
680
 244               	#define INT0	6
-
 
681
 245               	#define IVSEL	1
-
 
682
 246               	#define IVCE	0
-
 
683
 247               	
-
 
684
 248               	/* GIFR */
-
 
685
 249               	#define INTF1	7
-
 
686
 250               	#define INTF0	6
-
 
687
 251               	
-
 
688
 252               	/* TIMSK */
-
 
689
 253               	#define OCIE2	7
-
 
690
 254               	#define TOIE2	6
-
 
691
 255               	#define TICIE1	5
-
 
692
 256               	#define OCIE1A	4
-
 
693
 257               	#define OCIE1B	3
-
 
694
 257               	#elif defined (__AVR_ATmega48__)
-
 
695
 258               	#  include <avr/iom48.h>
-
 
696
 259               	#elif defined (__AVR_ATmega88__)
-
 
697
 260               	#  include <avr/iom88.h>
-
 
698
 261               	#elif defined (__AVR_ATmega8515__)
-
 
699
 262               	#  include <avr/iom8515.h>
-
 
700
 263               	#elif defined (__AVR_ATmega8535__)
-
 
701
 264               	#  include <avr/iom8535.h>
-
 
702
 265               	#elif defined (__AVR_AT90S8535__)
-
 
703
 266               	#  include <avr/io8535.h>
-
 
704
 267               	#elif defined (__AVR_AT90C8534__)
-
 
705
 268               	#  include <avr/io8534.h>
-
 
706
 269               	#elif defined (__AVR_AT90S8515__)
-
 
707
 270               	#  include <avr/io8515.h>
-
 
708
 271               	#elif defined (__AVR_AT90S4434__)
-
 
709
 272               	#  include <avr/io4434.h>
-
 
710
 273               	#elif defined (__AVR_AT90S4433__)
-
 
711
 274               	#  include <avr/io4433.h>
-
 
712
 275               	#elif defined (__AVR_AT90S4414__)
-
 
713
 276               	#  include <avr/io4414.h>
-
 
714
 277               	#elif defined (__AVR_ATtiny22__)
-
 
715
 278               	#  include <avr/iotn22.h>
-
 
716
 279               	#elif defined (__AVR_ATtiny26__)
-
 
717
 280               	#  include <avr/iotn26.h>
-
 
718
 281               	#elif defined (__AVR_AT90S2343__)
-
 
719
 282               	#  include <avr/io2343.h>
-
 
720
 283               	#elif defined (__AVR_AT90S2333__)
-
 
721
GAS LISTING /tmp/cckBHomO.s 			page 13
-
 
722
 
-
 
723
 
-
 
724
 284               	#  include <avr/io2333.h>
-
 
725
 285               	#elif defined (__AVR_AT90S2323__)
-
 
726
 286               	#  include <avr/io2323.h>
-
 
727
 287               	#elif defined (__AVR_AT90S2313__)
-
 
728
 288               	#  include <avr/io2313.h>
-
 
729
 289               	#elif defined (__AVR_ATtiny2313__)
-
 
730
 290               	#  include <avr/iotn2313.h>
-
 
731
 291               	#elif defined (__AVR_ATtiny13__)
-
 
732
 292               	#  include <avr/iotn13.h>
-
 
733
 293               	#elif defined (__AVR_ATtiny25__)
-
 
734
 294               	#  include <avr/iotn25.h>
-
 
735
 295               	#elif defined (__AVR_ATtiny45__)
-
 
736
 296               	#  include <avr/iotn45.h>
-
 
737
 297               	#elif defined (__AVR_ATtiny85__)
-
 
738
 298               	#  include <avr/iotn85.h>
-
 
739
 299               	#elif defined (__AVR_ATtiny24__)
-
 
740
 300               	#  include <avr/iotn24.h>
-
 
741
 301               	#elif defined (__AVR_ATtiny44__)
-
 
742
 302               	#  include <avr/iotn44.h>
-
 
743
 303               	#elif defined (__AVR_ATtiny84__)
-
 
744
 304               	#  include <avr/iotn84.h>
-
 
745
 305               	#elif defined (__AVR_ATtiny261__)
-
 
746
 306               	#  include <avr/iotn261.h>
-
 
747
 307               	#elif defined (__AVR_ATtiny461__)
-
 
748
 308               	#  include <avr/iotn461.h>
-
 
749
 309               	#elif defined (__AVR_ATtiny861__)
-
 
750
 310               	#  include <avr/iotn861.h>
-
 
751
 311               	/* avr1: the following only supported for assembler programs */
-
 
752
 312               	#elif defined (__AVR_ATtiny28__)
-
 
753
 313               	#  include <avr/iotn28.h>
-
 
754
 314               	#elif defined (__AVR_AT90S1200__)
-
 
755
 315               	#  include <avr/io1200.h>
-
 
756
 316               	#elif defined (__AVR_ATtiny15__)
-
 
757
 317               	#  include <avr/iotn15.h>
-
 
758
 318               	#elif defined (__AVR_ATtiny12__)
-
 
759
 319               	#  include <avr/iotn12.h>
-
 
760
 320               	#elif defined (__AVR_ATtiny11__)
-
 
761
 321               	#  include <avr/iotn11.h>
-
 
762
 322               	#else
-
 
763
 323               	#  if !defined(__COMPILING_AVR_LIBC__)
-
 
764
 324               	#    warning "device type not defined"
-
 
765
 325               	#  endif
-
 
766
 326               	#endif
-
 
767
 327               	
-
 
768
 328               	#include <avr/portpins.h>
-
 
769
   1               	/* Copyright (c) 2003  Theodore A. Roth
-
 
770
   2               	   All rights reserved.
-
 
771
   3               	
-
 
772
   4               	   Redistribution and use in source and binary forms, with or without
-
 
773
   5               	   modification, are permitted provided that the following conditions are met:
-
 
774
   6               	
-
 
775
   7               	   * Redistributions of source code must retain the above copyright
-
 
776
   8               	     notice, this list of conditions and the following disclaimer.
-
 
777
   9               	
-
 
778
  10               	   * Redistributions in binary form must reproduce the above copyright
-
 
779
  11               	     notice, this list of conditions and the following disclaimer in
-
 
780
  12               	     the documentation and/or other materials provided with the
-
 
781
GAS LISTING /tmp/cckBHomO.s 			page 14
-
 
782
 
-
 
783
 
-
 
784
  13               	     distribution.
-
 
785
  14               	
-
 
786
  15               	   * Neither the name of the copyright holders nor the names of
-
 
787
  16               	     contributors may be used to endorse or promote products derived
-
 
788
  17               	     from this software without specific prior written permission.
-
 
789
  18               	
-
 
790
  19               	  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-
 
791
  20               	  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-
 
792
  21               	  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-
 
793
  22               	  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-
 
794
  23               	  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-
 
795
  24               	  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-
 
796
  25               	  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-
 
797
  26               	  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-
 
798
  27               	  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-
 
799
  28               	  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-
 
800
  29               	  POSSIBILITY OF SUCH DAMAGE. */
-
 
801
  30               	
-
 
802
  31               	/* $Id: portpins.h,v 1.3.4.1 2006/03/10 16:22:38 aesok Exp $ */
-
 
803
  32               	
-
 
804
  33               	#ifndef _AVR_PORTPINS_H_
-
 
805
  34               	#define _AVR_PORTPINS_H_ 1
-
 
806
  35               	
-
 
807
  36               	/* This file should only be included from <avr/io.h>, never directly. */
-
 
808
  37               	
-
 
809
  38               	#ifndef _AVR_IO_H_
-
 
810
  39               	#  error "Include <avr/io.h> instead of this file."
-
 
811
  40               	#endif
-
 
812
  41               	
-
 
813
  42               	/* Define Generic PORTn, DDn, and PINn values. */
-
 
814
  43               	
-
 
815
  44               	/* Port Data Register (generic) */
-
 
816
  45               	#define    PORT7        7
-
 
817
  46               	#define    PORT6        6
-
 
818
  47               	#define    PORT5        5
-
 
819
  48               	#define    PORT4        4
-
 
820
  49               	#define    PORT3        3
-
 
821
  50               	#define    PORT2        2
-
 
822
  51               	#define    PORT1        1
-
 
823
  52               	#define    PORT0        0
-
 
824
  53               	
-
 
825
  54               	/* Port Data Direction Register (generic) */
-
 
826
  55               	#define    DD7          7
-
 
827
  56               	#define    DD6          6
-
 
828
  57               	#define    DD5          5
-
 
829
  58               	#define    DD4          4
-
 
830
  59               	#define    DD3          3
-
 
831
  60               	#define    DD2          2
-
 
832
  61               	#define    DD1          1
-
 
833
  62               	#define    DD0          0
-
 
834
  63               	
-
 
835
  64               	/* Port Input Pins (generic) */
-
 
836
  65               	#define    PIN7         7
-
 
837
  66               	#define    PIN6         6
-
 
838
  67               	#define    PIN5         5
-
 
839
  68               	#define    PIN4         4
-
 
840
  69               	#define    PIN3         3
-
 
841
GAS LISTING /tmp/cckBHomO.s 			page 15
-
 
842
 
-
 
843
 
-
 
844
  70               	#define    PIN2         2
-
 
845
  71               	#define    PIN1         1
-
 
846
  72               	#define    PIN0         0
-
 
847
  73               	
-
 
848
  74               	/* Define PORTxn values for all possible port pins. */
-
 
849
  75               	
-
 
850
  76               	/* PORT A */
-
 
851
  77               	
-
 
852
  78               	#if defined(PA0)
-
 
853
  79               	#  define PORTA0 PA0
-
 
854
  80               	#endif
-
 
855
  81               	#if defined(PA1)
-
 
856
  82               	#  define PORTA1 PA1
-
 
857
  83               	#endif
-
 
858
  84               	#if defined(PA2)
-
 
859
  85               	#  define PORTA2 PA2
-
 
860
  86               	#endif
-
 
861
  87               	#if defined(PA3)
-
 
862
  88               	#  define PORTA3 PA3
-
 
863
  89               	#endif
-
 
864
  90               	#if defined(PA4)
-
 
865
  91               	#  define PORTA4 PA4
-
 
866
  92               	#endif
-
 
867
  93               	#if defined(PA5)
-
 
868
  94               	#  define PORTA5 PA5
-
 
869
  95               	#endif
-
 
870
  96               	#if defined(PA6)
-
 
871
  97               	#  define PORTA6 PA6
-
 
872
  98               	#endif
-
 
873
  99               	#if defined(PA7)
-
 
874
 100               	#  define PORTA7 PA7
-
 
875
 101               	#endif
-
 
876
 102               	
-
 
877
 103               	/* PORT B */
-
 
878
 104               	
-
 
879
 105               	#if defined(PB0)
-
 
880
 106               	#  define PORTB0 PB0
-
 
881
 107               	#endif
-
 
882
 108               	#if defined(PB1)
-
 
883
 109               	#  define PORTB1 PB1
-
 
884
 110               	#endif
-
 
885
 111               	#if defined(PB2)
-
 
886
 112               	#  define PORTB2 PB2
-
 
887
 113               	#endif
-
 
888
 114               	#if defined(PB3)
-
 
889
 115               	#  define PORTB3 PB3
-
 
890
 116               	#endif
-
 
891
 117               	#if defined(PB4)
-
 
892
 118               	#  define PORTB4 PB4
-
 
893
 119               	#endif
-
 
894
 120               	#if defined(PB5)
-
 
895
 121               	#  define PORTB5 PB5
-
 
896
 122               	#endif
-
 
897
 123               	#if defined(PB6)
-
 
898
 124               	#  define PORTB6 PB6
-
 
899
 125               	#endif
-
 
900
 126               	#if defined(PB7)
-
 
901
GAS LISTING /tmp/cckBHomO.s 			page 16
-
 
902
 
-
 
903
 
-
 
904
 127               	#  define PORTB7 PB7
-
 
905
 128               	#endif
475
 129               	
906
 129               	
-
 
907
 130               	/* PORT C */
-
 
908
 131               	
-
 
909
 132               	#if defined(PC0)
476
 130               	#define MCUCSR	_SFR_IO8(0x34)
910
 133               	#  define PORTC0 PC0
-
 
911
 134               	#endif
-
 
912
 135               	#if defined(PC1)
-
 
913
 136               	#  define PORTC1 PC1
-
 
914
 137               	#endif
-
 
915
 138               	#if defined(PC2)
-
 
916
 139               	#  define PORTC2 PC2
-
 
917
 140               	#endif
-
 
918
 141               	#if defined(PC3)
-
 
919
 142               	#  define PORTC3 PC3
-
 
920
 143               	#endif
-
 
921
 144               	#if defined(PC4)
-
 
922
 145               	#  define PORTC4 PC4
-
 
923
 146               	#endif
-
 
924
 147               	#if defined(PC5)
477
 131               	#define MCUCR	_SFR_IO8(0x35)
925
 148               	#  define PORTC5 PC5
-
 
926
 149               	#endif
-
 
927
 150               	#if defined(PC6)
-
 
928
 151               	#  define PORTC6 PC6
-
 
929
 152               	#endif
-
 
930
 153               	#if defined(PC7)
-
 
931
 154               	#  define PORTC7 PC7
-
 
932
 155               	#endif
-
 
933
 156               	
-
 
934
 157               	/* PORT D */
478
 132               	
935
 158               	
-
 
936
 159               	#if defined(PD0)
-
 
937
 160               	#  define PORTD0 PD0
-
 
938
 161               	#endif
-
 
939
 162               	#if defined(PD1)
-
 
940
 163               	#  define PORTD1 PD1
-
 
941
 164               	#endif
-
 
942
 165               	#if defined(PD2)
-
 
943
 166               	#  define PORTD2 PD2
-
 
944
 167               	#endif
-
 
945
 168               	#if defined(PD3)
-
 
946
 169               	#  define PORTD3 PD3
-
 
947
 170               	#endif
-
 
948
 171               	#if defined(PD4)
-
 
949
 172               	#  define PORTD4 PD4
-
 
950
 173               	#endif
-
 
951
 174               	#if defined(PD5)
-
 
952
 175               	#  define PORTD5 PD5
-
 
953
 176               	#endif
-
 
954
 177               	#if defined(PD6)
479
 133               	#define TWCR	_SFR_IO8(0x36)
955
 178               	#  define PORTD6 PD6
-
 
956
 179               	#endif
-
 
957
 180               	#if defined(PD7)
-
 
958
 181               	#  define PORTD7 PD7
-
 
959
 182               	#endif
480
 134               	
960
 183               	
481
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s 			page 9
961
GAS LISTING /tmp/cckBHomO.s 			page 17
482
 
962
 
483
 
963
 
484
 135               	#define SPMCR	_SFR_IO8(0x37)
964
 184               	/* PORT E */
485
 136               	
965
 185               	
486
 137               	#define TIFR	_SFR_IO8(0x38)
966
 186               	#if defined(PE0)
487
 138               	#define TIMSK	_SFR_IO8(0x39)
967
 187               	#  define PORTE0 PE0
488
 139               	
968
 188               	#endif
489
 140               	#define GIFR	_SFR_IO8(0x3A)
969
 189               	#if defined(PE1)
490
 141               	#define GIMSK	_SFR_IO8(0x3B)
970
 190               	#  define PORTE1 PE1
491
 142               	#define GICR	_SFR_IO8(0x3B)   /* Changed in 2486H-AVR-09/02 */
971
 191               	#endif
492
 143               	
972
 192               	#if defined(PE2)
493
 144               	/* 0x3C reserved (OCR0?) */
973
 193               	#  define PORTE2 PE2
494
 145               	
974
 194               	#endif
495
 146               	/* 0x3D..0x3E SP */
975
 195               	#if defined(PE3)
496
 147               	
976
 196               	#  define PORTE3 PE3
497
 148               	/* 0x3F SREG */
977
 197               	#endif
498
 149               	
978
 198               	#if defined(PE4)
499
 150               	/* Interrupt vectors */
979
 199               	#  define PORTE4 PE4
500
 151               	
980
 200               	#endif
501
 152               	#define SIG_INTERRUPT0		_VECTOR(1)
981
 201               	#if defined(PE5)
502
 153               	#define SIG_INTERRUPT1		_VECTOR(2)
982
 202               	#  define PORTE5 PE5
503
 154               	#define SIG_OUTPUT_COMPARE2	_VECTOR(3)
983
 203               	#endif
504
 155               	#define SIG_OVERFLOW2		_VECTOR(4)
984
 204               	#if defined(PE6)
505
 156               	#define SIG_INPUT_CAPTURE1	_VECTOR(5)
985
 205               	#  define PORTE6 PE6
506
 157               	#define SIG_OUTPUT_COMPARE1A	_VECTOR(6)
986
 206               	#endif
507
 158               	#define SIG_OUTPUT_COMPARE1B	_VECTOR(7)
987
 207               	#if defined(PE7)
508
 159               	#define SIG_OVERFLOW1		_VECTOR(8)
988
 208               	#  define PORTE7 PE7
509
 160               	#define SIG_OVERFLOW0		_VECTOR(9)
989
 209               	#endif
510
 161               	#define SIG_SPI			_VECTOR(10)
990
 210               	
511
 162               	#define SIG_UART_RECV		_VECTOR(11)
991
 211               	/* PORT F */
512
 163               	#define SIG_UART_DATA		_VECTOR(12)
992
 212               	
513
 164               	#define SIG_UART_TRANS		_VECTOR(13)
993
 213               	#if defined(PF0)
514
 165               	#define SIG_ADC			_VECTOR(14)
994
 214               	#  define PORTF0 PF0
515
 166               	#define SIG_EEPROM_READY	_VECTOR(15)
995
 215               	#endif
516
 167               	#define SIG_COMPARATOR		_VECTOR(16)
996
 216               	#if defined(PF1)
517
 168               	#define SIG_2WIRE_SERIAL	_VECTOR(17)
997
 217               	#  define PORTF1 PF1
518
 169               	#define SIG_SPM_READY		_VECTOR(18)
998
 218               	#endif
519
 170               	
999
 219               	#if defined(PF2)
520
 171               	#define _VECTORS_SIZE 38
1000
 220               	#  define PORTF2 PF2
521
 172               	
1001
 221               	#endif
522
 173               	/* Bit numbers */
1002
 222               	#if defined(PF3)
523
 174               	
1003
 223               	#  define PORTF3 PF3
524
 175               	/* GIMSK / GICR */
1004
 224               	#endif
525
 176               	#define INT1	7
1005
 225               	#if defined(PF4)
526
 177               	#define INT0	6
1006
 226               	#  define PORTF4 PF4
527
 178               	#define IVSEL	1
1007
 227               	#endif
528
 179               	#define IVCE	0
1008
 228               	#if defined(PF5)
529
 180               	
1009
 229               	#  define PORTF5 PF5
530
 181               	/* GIFR */
1010
 230               	#endif
531
 182               	#define INTF1	7
1011
 231               	#if defined(PF6)
532
 183               	#define INTF0	6
1012
 232               	#  define PORTF6 PF6
533
 184               	
1013
 233               	#endif
534
 184               	#elif defined (__AVR_ATmega8515__)
1014
 234               	#if defined(PF7)
-
 
1015
 235               	#  define PORTF7 PF7
-
 
1016
 236               	#endif
-
 
1017
 237               	
-
 
1018
 238               	/* PORT G */
-
 
1019
 239               	
-
 
1020
 240               	#if defined(PG0)
-
 
1021
GAS LISTING /tmp/cckBHomO.s 			page 18
-
 
1022
 
-
 
1023
 
-
 
1024
 241               	#  define PORTG0 PG0
-
 
1025
 242               	#endif
-
 
1026
 243               	#if defined(PG1)
-
 
1027
 244               	#  define PORTG1 PG1
-
 
1028
 245               	#endif
-
 
1029
 246               	#if defined(PG2)
-
 
1030
 247               	#  define PORTG2 PG2
-
 
1031
 248               	#endif
-
 
1032
 249               	#if defined(PG3)
-
 
1033
 250               	#  define PORTG3 PG3
-
 
1034
 251               	#endif
-
 
1035
 252               	#if defined(PG4)
-
 
1036
 253               	#  define PORTG4 PG4
-
 
1037
 254               	#endif
-
 
1038
 255               	#if defined(PG5)
-
 
1039
 256               	#  define PORTG5 PG5
-
 
1040
 257               	#endif
-
 
1041
 258               	#if defined(PG6)
-
 
1042
 259               	#  define PORTG6 PG6
-
 
1043
 260               	#endif
-
 
1044
 261               	#if defined(PG7)
-
 
1045
 262               	#  define PORTG7 PG7
-
 
1046
 263               	#endif
-
 
1047
 264               	
-
 
1048
 265               	/* PORT H */
-
 
1049
 266               	
-
 
1050
 267               	#if defined(PH0)
-
 
1051
 268               	#  define PORTH0 PH0
-
 
1052
 269               	#endif
-
 
1053
 270               	#if defined(PH1)
-
 
1054
 271               	#  define PORTH1 PH1
-
 
1055
 272               	#endif
-
 
1056
 273               	#if defined(PH2)
-
 
1057
 274               	#  define PORTH2 PH2
-
 
1058
 275               	#endif
-
 
1059
 276               	#if defined(PH3)
-
 
1060
 277               	#  define PORTH3 PH3
-
 
1061
 278               	#endif
-
 
1062
 279               	#if defined(PH4)
-
 
1063
 280               	#  define PORTH4 PH4
-
 
1064
 281               	#endif
-
 
1065
 282               	#if defined(PH5)
-
 
1066
 283               	#  define PORTH5 PH5
-
 
1067
 284               	#endif
-
 
1068
 285               	#if defined(PH6)
-
 
1069
 286               	#  define PORTH6 PH6
-
 
1070
 287               	#endif
-
 
1071
 288               	#if defined(PH7)
-
 
1072
 289               	#  define PORTH7 PH7
-
 
1073
 290               	#endif
-
 
1074
 291               	
-
 
1075
 292               	/* PORT J */
-
 
1076
 293               	
-
 
1077
 294               	#if defined(PJ0)
-
 
1078
 295               	#  define PORTJ0 PJ0
-
 
1079
 296               	#endif
-
 
1080
 297               	#if defined(PJ1)
-
 
1081
GAS LISTING /tmp/cckBHomO.s 			page 19
-
 
1082
 
-
 
1083
 
-
 
1084
 298               	#  define PORTJ1 PJ1
-
 
1085
 299               	#endif
-
 
1086
 300               	#if defined(PJ2)
-
 
1087
 301               	#  define PORTJ2 PJ2
-
 
1088
 302               	#endif
-
 
1089
 303               	#if defined(PJ3)
-
 
1090
 304               	#  define PORTJ3 PJ3
-
 
1091
 305               	#endif
-
 
1092
 306               	#if defined(PJ4)
-
 
1093
 307               	#  define PORTJ4 PJ4
-
 
1094
 308               	#endif
-
 
1095
 309               	#if defined(PJ5)
-
 
1096
 310               	#  define PORTJ5 PJ5
-
 
1097
 311               	#endif
-
 
1098
 312               	#if defined(PJ6)
-
 
1099
 313               	#  define PORTJ6 PJ6
-
 
1100
 314               	#endif
-
 
1101
 315               	#if defined(PJ7)
-
 
1102
 316               	#  define PORTJ7 PJ7
-
 
1103
 317               	#endif
-
 
1104
 318               	
-
 
1105
 319               	/* PORT K */
-
 
1106
 320               	
-
 
1107
 321               	#if defined(PK0)
-
 
1108
 322               	#  define PORTK0 PK0
-
 
1109
 323               	#endif
-
 
1110
 324               	#if defined(PK1)
-
 
1111
 325               	#  define PORTK1 PK1
-
 
1112
 326               	#endif
-
 
1113
 327               	#if defined(PK2)
-
 
1114
 328               	#  define PORTK2 PK2
-
 
1115
 329               	#endif
-
 
1116
 329               	
-
 
1117
 330               	#if __AVR_ARCH__ != 1
-
 
1118
 331               	#  if XRAMEND < 0x100 && !defined(__COMPILING_AVR_LIBC__)
-
 
1119
 332               	#    undef SP
-
 
1120
 333               	#    define SP     _SFR_IO8(0x3D)
-
 
1121
 334               	#    undef SPH
-
 
1122
 335               	#  endif
-
 
1123
 336               	#endif
-
 
1124
 337               	
-
 
1125
 338               	#include <avr/version.h>
-
 
1126
   1               	/* Copyright (c) 2005, Joerg Wunsch                               -*- c -*-
-
 
1127
   2               	   All rights reserved.
-
 
1128
   3               	
-
 
1129
   4               	   Redistribution and use in source and binary forms, with or without
-
 
1130
   5               	   modification, are permitted provided that the following conditions are met:
-
 
1131
   6               	
-
 
1132
   7               	   * Redistributions of source code must retain the above copyright
-
 
1133
   8               	     notice, this list of conditions and the following disclaimer.
-
 
1134
   9               	
-
 
1135
  10               	   * Redistributions in binary form must reproduce the above copyright
-
 
1136
  11               	     notice, this list of conditions and the following disclaimer in
-
 
1137
  12               	     the documentation and/or other materials provided with the
-
 
1138
  13               	     distribution.
-
 
1139
  14               	
-
 
1140
  15               	   * Neither the name of the copyright holders nor the names of
-
 
1141
GAS LISTING /tmp/cckBHomO.s 			page 20
-
 
1142
 
-
 
1143
 
-
 
1144
  16               	     contributors may be used to endorse or promote products derived
-
 
1145
  17               	     from this software without specific prior written permission.
-
 
1146
  18               	
-
 
1147
  19               	  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-
 
1148
  20               	  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-
 
1149
  21               	  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-
 
1150
  22               	  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-
 
1151
  23               	  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-
 
1152
  24               	  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-
 
1153
  25               	  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-
 
1154
  26               	  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-
 
1155
  27               	  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-
 
1156
  28               	  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-
 
1157
  29               	  POSSIBILITY OF SUCH DAMAGE. */
-
 
1158
  30               	
-
 
1159
  31               	/* $Id: version.h.in,v 1.1 2005/09/12 20:18:12 joerg_wunsch Exp $ */
-
 
1160
  32               	
-
 
1161
  33               	/** \defgroup avr_version <avr/version.h>: avr-libc version macros
-
 
1162
  34               	    \code #include <avr/version.h> \endcode
-
 
1163
  35               	
-
 
1164
  36               	    This header file defines macros that contain version numbers and
-
 
1165
  37               	    strings describing the current version of avr-libc.
-
 
1166
  38               	
-
 
1167
  39               	    The version number itself basically consists of three pieces that
-
 
1168
  40               	    are separated by a dot: the major number, the minor number, and
-
 
1169
  41               	    the revision number.  For development versions (which use an odd
-
 
1170
  42               	    minor number), the string representation additionally gets the
-
 
1171
  43               	    date code (YYYYMMDD) appended.
-
 
1172
  44               	
-
 
1173
  45               	    This file will also be included by \c <avr/io.h>.  That way,
-
 
1174
  46               	    portable tests can be implemented using \c <avr/io.h> that can be
-
 
1175
  47               	    used in code that wants to remain backwards-compatible to library
-
 
1176
  48               	    versions prior to the date when the library version API had been
-
 
1177
  49               	    added, as referenced but undefined C preprocessor macros
-
 
1178
  50               	    automatically evaluate to 0.
-
 
1179
  51               	*/
-
 
1180
  52               	
-
 
1181
  53               	#ifndef _AVR_VERSION_H_
-
 
1182
  54               	#define _AVR_VERSION_H_
-
 
1183
  55               	
-
 
1184
  56               	/** \ingroup avr_version
-
 
1185
  57               	    String literal representation of the current library version. */
-
 
1186
  58               	#define __AVR_LIBC_VERSION_STRING__ "1.4.4"
-
 
1187
  59               	
-
 
1188
  60               	/** \ingroup avr_version
-
 
1189
  61               	    Numerical representation of the current library version.
-
 
1190
  62               	
-
 
1191
  63               	    In the numerical representation, the major number is multiplied by
-
 
1192
  64               	    10000, the minor number by 100, and all three parts are then
-
 
1193
  65               	    added.  It is intented to provide a monotonically increasing
-
 
1194
  66               	    numerical value that can easily be used in numerical checks.
-
 
1195
  67               	 */
-
 
1196
  68               	#define __AVR_LIBC_VERSION__        10404UL
-
 
1197
  69               	
-
 
1198
  70               	/** \ingroup avr_version
-
 
1199
  71               	    String literal representation of the release date. */
-
 
1200
  72               	#define __AVR_LIBC_DATE_STRING__    "20060420"
-
 
1201
GAS LISTING /tmp/cckBHomO.s 			page 21
-
 
1202
 
-
 
1203
 
-
 
1204
  73               	
-
 
1205
  74               	/** \ingroup avr_version
-
 
1206
  75               	    Numerical representation of the release date. */
-
 
1207
  76               	#define __AVR_LIBC_DATE_            20060420UL
-
 
1208
  77               	
-
 
1209
  78               	/** \ingroup avr_version
-
 
1210
  79               	    Library major version number. */
-
 
1211
  80               	#define __AVR_LIBC_MAJOR__          1
-
 
1212
  81               	
-
 
1213
  82               	/** \ingroup avr_version
-
 
1214
  83               	    Library minor version number. */
-
 
1215
  84               	#define __AVR_LIBC_MINOR__          4
-
 
1216
  85               	
-
 
1217
  86               	/** \ingroup avr_version
-
 
1218
  87               	    Library revision number. */
-
 
1219
  88               	#define __AVR_LIBC_REVISION__       4
-
 
1220
  89               	
-
 
1221
  90               	#endif /* _AVR_VERSION_H_ */
-
 
1222
  91               	...
-
 
1223
 339               	
535
  54               	#include "Events.h"
1224
  54               	#include "Events.h"
536
   1               	#ifndef EVENTS_H
1225
   1               	#ifndef EVENTS_H
537
   2               	#define EVENTS_H
1226
   2               	#define EVENTS_H
538
   3               	
1227
   3               	
539
   4               	/*
1228
   4               	/*
540
   5               	    Copyright (C) 2004    John Orlando
1229
   5               	    Copyright (C) 2004    John Orlando
541
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s 			page 10
-
 
542
 
-
 
543
 
-
 
544
   6               	    
1230
   6               	    
545
   7               	   AVRcam: a small real-time image processing engine.
1231
   7               	   AVRcam: a small real-time image processing engine.
546
   8               	
1232
   8               	
547
   9               	    This program is free software; you can redistribute it and/or
1233
   9               	    This program is free software; you can redistribute it and/or
548
  10               	    modify it under the terms of the GNU General Public
1234
  10               	    modify it under the terms of the GNU General Public
549
  11               	    License as published by the Free Software Foundation; either
1235
  11               	    License as published by the Free Software Foundation; either
550
  12               	    version 2 of the License, or (at your option) any later version.
1236
  12               	    version 2 of the License, or (at your option) any later version.
551
  13               	
1237
  13               	
552
  14               	    This program is distributed in the hope that it will be useful,
1238
  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
1239
  15               	    but WITHOUT ANY WARRANTY; without even the implied warranty of
554
  16               	    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1240
  16               	    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
555
  17               	    General Public License for more details.
1241
  17               	    General Public License for more details.
556
  18               	
1242
  18               	
557
  19               	    You should have received a copy of the GNU General Public
1243
  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
1244
  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
1245
  21               	    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
560
  22               	
1246
  22               	
561
  23               	   For more information on the AVRcam, please contact:
1247
  23               	   For more information on the AVRcam, please contact:
562
  24               	
1248
  24               	
563
  25               	   john@jrobot.net
1249
  25               	   john@jrobot.net
564
  26               	
1250
  26               	
565
  27               	   or go to www.jrobot.net for more details regarding the system.
1251
  27               	   or go to www.jrobot.net for more details regarding the system.
566
  28               	*/
1252
  28               	*/
567
  29               	/*********************************************************** 
1253
  29               	/*********************************************************** 
568
  30               		Module Name: Events.h
1254
  30               		Module Name: Events.h
569
  31               		Module Date: 05/23/2004
1255
  31               		Module Date: 05/23/2004
570
  32               		Module Auth: John Orlando
1256
  32               		Module Auth: John Orlando
571
  33               		
1257
  33               		
572
  34               		Description: This file provides the external interface
1258
  34               		Description: This file provides the external interface
573
  35               		to the events that can be published/processed in the
1259
  35               		to the events that can be published/processed in the
574
  36               		system.  It is specifically by itself (and nothing
1260
  36               		system.  It is specifically by itself (and nothing
-
 
1261
GAS LISTING /tmp/cckBHomO.s 			page 22
-
 
1262
 
-
 
1263
 
575
  37               		else should be defined in here) so that both .c and
1264
  37               		else should be defined in here) so that both .c and
576
  38               		.S (assembly) files can include this file without
1265
  38               		.S (assembly) files can include this file without
577
  39               		a problem.
1266
  39               		a problem.
578
  40               	    
1267
  40               	    
579
  41               	    Revision History:
1268
  41               	    Revision History:
580
  42               	    Date        Rel Ver.    Notes
1269
  42               	    Date        Rel Ver.    Notes
581
  43               	    4/10/2004      0.1     Module created
1270
  43               	    4/10/2004      0.1     Module created
582
  44               	    6/30/2004      1.0     Initial release for Circuit Cellar
1271
  44               	    6/30/2004      1.0     Initial release for Circuit Cellar
583
  45               	                           contest.
1272
  45               	                           contest.
584
  46               	    *******************************************************/
1273
  46               	    *******************************************************/
585
  47               	
1274
  47               	
586
  48               	/* Definitions */
1275
  48               	/* Definitions */
587
  49               	/* Originally, all events were passed in a bitmask...however,
1276
  49               	/* Originally, all events were passed in a bitmask...however,
588
  50               	an event FIFO was finally used, but the coding of the event
1277
  50               	an event FIFO was finally used, but the coding of the event
589
  51               	definitions were never translated back....doesn't make a
1278
  51               	definitions were never translated back....doesn't make a
590
  52               	difference, but looks a little weird */
1279
  52               	difference, but looks a little weird */
591
  53               	#define EV_SERIAL_DATA_RECEIVED		0x01
1280
  53               	#define EV_SERIAL_DATA_RECEIVED		0x01
592
  54               	#define EV_DUMP_FRAME				0x02
1281
  54               	#define EV_DUMP_FRAME				0x02
593
  55               	#define EV_PROCESS_FRAME_COMPLETE	0x04
1282
  55               	#define EV_PROCESS_FRAME_COMPLETE	0x04
594
  55               			
1283
  55               			
595
  56               			.extern fastEventBitmask    ; This is the flag used to indicate to the rest
1284
  56               			.extern fastEventBitmask    ; This is the flag used to indicate to the rest
596
  57               										; of the system that the line is complete
1285
  57               										; of the system that the line is complete
597
  58               									
1286
  58               									
598
  59               	#define HREF_INTERRUPT_ENABLE_MASK   0x80
1287
  59               	#define HREF_INTERRUPT_ENABLE_MASK   0x80
599
  60               	#define HREF_INTERRUPT_DISABLE_MASK  0x7F
1288
  60               	#define HREF_INTERRUPT_DISABLE_MASK  0x7F
600
  61               	#define ENABLE_PCLK_TIMER1_OVERFLOW_BITMASK  0x04
1289
  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
1290
  62               	#define DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK 0xFB
605
  63               	#define G_PORT						_SFR_IO_ADDR(PINC)  
1291
  63               	#define G_PORT						_SFR_IO_ADDR(PINC)  
606
  64               	#define RB_PORT						_SFR_IO_ADDR(PINB)  
1292
  64               	#define RB_PORT						_SFR_IO_ADDR(PINB)  
607
  65               	#define PIXEL_RUN_START_INITIAL     0x50     	; This value causes our pixel counter (TCNT1)
1293
  65               	#define PIXEL_RUN_START_INITIAL     0x50     	; This value causes our pixel counter (TCNT1)
608
  66               													; to overflow after 176 (horizontal) pixels
1294
  66               													; to overflow after 176 (horizontal) pixels
609
  67               	
1295
  67               	
610
  68               	#define RED_MEM_OFFSET				0x00
1296
  68               	#define RED_MEM_OFFSET				0x00
611
  69               	#define GREEN_MEM_OFFSET			0x10
1297
  69               	#define GREEN_MEM_OFFSET			0x10
612
  70               	#define BLUE_MEM_OFFSET				0x20
1298
  70               	#define BLUE_MEM_OFFSET				0x20
613
  71               	
1299
  71               	
614
  72               	; A pixelBlock is defined as a contiguous group of 4 pixels that are combined 
1300
  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
1301
  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
1302
  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
1303
  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
1304
  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
1305
  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
1306
  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
1307
  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
1308
  80               	; manually generated for now (though it will hopefully be modified over
623
  81               	; the serial interface eventually).
1309
  81               	; the serial interface eventually).
624
  82               	;
1310
  82               	;
625
  83               	; Here is a pixel block:
1311
  83               	; Here is a pixel block:
626
  84               	; ...G  G  G  G...  (row x)
1312
  84               	; ...G  G  G  G...  (row x)
627
  85               	; ...B  R  B  R...  (row x+1)
1313
  85               	; ...B  R  B  R...  (row x+1)
628
  86               	;    |  |  |  |--this is skipped 
1314
  86               	;    |  |  |  |--this is skipped 
629
  87               	;    |  |  |--this is skipped
1315
  87               	;    |  |  |--this is skipped
630
  88               	;    |  |--this is sampled
1316
  88               	;    |  |--this is sampled
631
  89               	;    |--this is sampled
1317
  89               	;    |--this is sampled
632
  90               	
1318
  90               	
633
  91               	; As pixel blocks are sampled, the red, green, and blue values are
1319
  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
1320
  92               	; used to index into their respective color maps.  The color maps
-
 
1321
GAS LISTING /tmp/cckBHomO.s 			page 23
-
 
1322
 
-
 
1323
 
635
  93               	; return values that can be logically ANDed together so that a 
1324
  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
1325
  94               	; particular RGB triplet will result in a single bit being set
637
  95               	; after the AND operation.  This single bit indicates which color
1326
  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
1327
  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
1328
  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.
1329
  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
1330
  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
1331
 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
1332
 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
1333
 102               	; more cycles, and only requires 48 bytes of precious RAM (16
645
 103               	; per color channel, since our resolution on each color channel
1334
 103               	; per color channel, since our resolution on each color channel
646
 104               	; is only 4-bits).  Not bad....for more information, see:
1335
 104               	; is only 4-bits).  Not bad....for more information, see:
647
 105               	; http://www.cs.cmu.edu/~trb/papers/wirevision00.pdf for more
1336
 105               	; http://www.cs.cmu.edu/~trb/papers/wirevision00.pdf for more
648
 106               	; information on this color segmentation technique.
1337
 106               	; information on this color segmentation technique.
649
 107               	
1338
 107               	
650
 108               	; One other note: this code does depend on the colorMap residing
1339
 108               	; One other note: this code does depend on the colorMap residing
651
 109               	; at a well-defined position in memory; specifically, it mus
1340
 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
1341
 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
1342
 111               	; map is set to 0x00.  Currently, the colorMap is forced to
654
 112               	; start at RAM location 0x300.  This could potentially be changed
1343
 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
1344
 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.
1345
 114               	; in to the colorMap look-up code below to make it work.
657
 115               	
1346
 115               	
658
 116               	
1347
 116               	
659
 117               	; These are the registers that will be used throughout this
1348
 117               	; These are the registers that will be used throughout this
660
 118               	; module for acquiring each line of pixel data
1349
 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
1350
 119               	pixelCount			= 16
665
 120               	pixelRunStart		= 17
1351
 120               	pixelRunStart		= 17
666
 121               	lastColor     		= 18
1352
 121               	lastColor     		= 18
667
 122               	tmp1				= 19	; be sure to not use tmp1 and color simultaneously
1353
 122               	tmp1				= 19	; be sure to not use tmp1 and color simultaneously
668
 123               	tmp2				= 20
1354
 123               	tmp2				= 20
669
 124               	color           	= 19
1355
 124               	color           	= 19
670
 125               	greenData       	= 20
1356
 125               	greenData       	= 20
671
 126               	blueData        	= 21
1357
 126               	blueData        	= 21
672
 127               	colorMapLow	  		= 22
1358
 127               	colorMapLow	  		= 22
673
 128               	colorMapHigh		= 23
1359
 128               	colorMapHigh		= 23
674
 129               	prevLineBuffLow  	= 22  	; overlaps with memLookupLow (but orthogonal)
1360
 129               	prevLineBuffLow  	= 22  	; overlaps with memLookupLow (but orthogonal)
675
 130               	prevLineBuffHigh	= 23	; overlaps with memLookupHigh (but orthogonal)
1361
 130               	prevLineBuffHigh	= 23	; overlaps with memLookupHigh (but orthogonal)
676
 131               	currLineBuffLow     = 24
1362
 131               	currLineBuffLow     = 24
677
 132               	currLineBuffHigh  	= 25
1363
 132               	currLineBuffHigh  	= 25
678
 133               	
1364
 133               	
679
 134               	        .section .text
1365
 134               	        .section .text
680
 135               	
1366
 135               	
681
 136               	; These are the global assembly function names that are accessed via other
1367
 136               	; These are the global assembly function names that are accessed via other
682
 137               	; C functions
1368
 137               	; C functions
683
 138               	        .global CamIntAsm_waitForNewTrackingFrame
1369
 138               	        .global CamIntAsm_waitForNewTrackingFrame
684
 139               			.global CamIntAsm_waitForNewDumpFrame
1370
 139               			.global CamIntAsm_waitForNewDumpFrame
685
 140               			.global CamIntAsm_acquireDumpLine
1371
 140               			.global CamIntAsm_acquireDumpLine
686
 141               			.global CamIntAsm_acquireTrackingLine
1372
 141               			.global CamIntAsm_acquireTrackingLine
687
 142               			.global SIG_INTERRUPT0
1373
 142               			.global SIG_INTERRUPT0
688
 143               			.global SIG_INTERRUPT1
1374
 143               			.global SIG_INTERRUPT1
689
 144               			.global SIG_OVERFLOW0
1375
 144               			.global SIG_OVERFLOW0
690
 145               			.global SIG_OVERFLOW1
1376
 145               			.global SIG_OVERFLOW1
691
 146               			
1377
 146               			
692
 147               	;*****************************************************************		
1378
 147               	;*****************************************************************		
693
 148               	;   	Function Name: CamIntAsm_waitForNewTrackingFrame
1379
 148               	;   	Function Name: CamIntAsm_waitForNewTrackingFrame
694
 149               	;       Function Description: This function is responsible for
1380
 149               	;       Function Description: This function is responsible for
-
 
1381
GAS LISTING /tmp/cckBHomO.s 			page 24
-
 
1382
 
-
 
1383
 
695
 150               	;       going to sleep until a new frame begins (indicated by
1384
 150               	;       going to sleep until a new frame begins (indicated by
696
 151               	;    	VSYNC transitioning from low to high.  This will wake
1385
 151               	;    	VSYNC transitioning from low to high.  This will wake
697
 152               	;       the "VSYNC sleep" up and allow it to continue with 
1386
 152               	;       the "VSYNC sleep" up and allow it to continue with 
698
 153               	;       the acquireLine function, where the system waits for
1387
 153               	;       the acquireLine function, where the system waits for
699
 154               	;       an "HREF sleep" that we use to synchronize with the
1388
 154               	;       an "HREF sleep" that we use to synchronize with the
700
 155               	;       data.  
1389
 155               	;       data.  
701
 156               	;       Inputs:  r25 - MSB of currentLineBuffer
1390
 156               	;       Inputs:  r25 - MSB of currentLineBuffer
702
 157               	;                r24 - LSB of currentLineBuffer
1391
 157               	;                r24 - LSB of currentLineBuffer
703
 158               	;				 r23 - MSB of colorMap
1392
 158               	;				 r23 - MSB of colorMap
704
 159               	; 				 r22 - LSB of colorMap
1393
 159               	; 				 r22 - LSB of colorMap
705
 160               	;       Outputs: none
1394
 160               	;       Outputs: none
706
 161               	;       NOTES: This function doesn't really return...it sorta just
1395
 161               	;       NOTES: This function doesn't really return...it sorta just
707
 162               	;       floats into the acquireLine function after the "VSYNC sleep"
1396
 162               	;       floats into the acquireLine function after the "VSYNC sleep"
708
 163               	;       is awoken, then begins processing the line data.  Once
1397
 163               	;       is awoken, then begins processing the line data.  Once
709
 164               	;		176 pixels are sampled (and the counter overflows), then
1398
 164               	;		176 pixels are sampled (and the counter overflows), then
710
 165               	;		an interrupt will occur, the 'T' bit in the SREG will be
1399
 165               	;		an interrupt will occur, the 'T' bit in the SREG will be
711
 166               	;		set, and the function will return.
1400
 166               	;		set, and the function will return.
712
 167               	;*****************************************************************
1401
 167               	;*****************************************************************
713
 168               			
1402
 168               			
714
 169               	CamIntAsm_waitForNewTrackingFrame:
1403
 169               	CamIntAsm_waitForNewTrackingFrame:
715
 170:CamInterfaceAsm.S **** 		sbi		_SFR_IO_ADDR(PORTD),PD6  ; For testing...
1404
 170:CamInterfaceAsm.S **** 		sbi		_SFR_IO_ADDR(PORTD),PD6  ; For testing...
716
 171:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6		
1405
 171:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6		
717
 172:CamInterfaceAsm.S **** 		sleep
1406
 172:CamInterfaceAsm.S **** 		sleep
718
 173               	
1407
 173               	
719
 174               	;*****************************************************************
1408
 174               	;*****************************************************************
720
 175               	; REMEMBER...everything from here on out is critically timed to be
1409
 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...
1410
 176               	; synchronized with the flow of pixel data from the camera...
725
 177               	;*****************************************************************
1411
 177               	;*****************************************************************
726
 178               	
1412
 178               	
727
 179               	CamIntAsm_acquireTrackingLine:
1413
 179               	CamIntAsm_acquireTrackingLine:
728
 180:CamInterfaceAsm.S **** 		brts	_cleanUp
1414
 180:CamInterfaceAsm.S **** 		brts	_cleanUp
729
 181               			;sbi		_SFR_IO_ADDR(PORTD),PD6 ; For testing...
1415
 181               			;sbi		_SFR_IO_ADDR(PORTD),PD6 ; For testing...
730
 182               			;cbi		_SFR_IO_ADDR(PORTD),PD6
1416
 182               			;cbi		_SFR_IO_ADDR(PORTD),PD6
731
 183               	        
1417
 183               	        
732
 184:CamInterfaceAsm.S ****         in      tmp1,_SFR_IO_ADDR(TCCR1B) ; Enable the PCLK line to actually
1418
 184:CamInterfaceAsm.S ****         in      tmp1,_SFR_IO_ADDR(TCCR1B) ; Enable the PCLK line to actually
733
 185:CamInterfaceAsm.S ****         ori     tmp1, 0x07                 ; feed Timer1
1419
 185:CamInterfaceAsm.S ****         ori     tmp1, 0x07                 ; feed Timer1
734
 186:CamInterfaceAsm.S ****         out     _SFR_IO_ADDR(TCCR1B),tmp1 
1420
 186:CamInterfaceAsm.S ****         out     _SFR_IO_ADDR(TCCR1B),tmp1 
735
 187               											; The line is about to start...		
1421
 187               											; The line is about to start...		
736
 188:CamInterfaceAsm.S **** 		ldi     pixelCount,0			; Initialize the RLE stats...
1422
 188:CamInterfaceAsm.S **** 		ldi     pixelCount,0			; Initialize the RLE stats...
737
 189:CamInterfaceAsm.S **** 		ldi		pixelRunStart,PIXEL_RUN_START_INITIAL  	; Remember, we always calculate
1423
 189:CamInterfaceAsm.S **** 		ldi		pixelRunStart,PIXEL_RUN_START_INITIAL  	; Remember, we always calculate
738
 190               															; the pixel run length as
1424
 190               															; the pixel run length as
739
 191               															; TCNT1L - pixelRunStart
1425
 191               															; TCNT1L - pixelRunStart
740
 192               			
1426
 192               			
741
 193:CamInterfaceAsm.S **** 		ldi		lastColor,0x00				; clear out the last color before we start
1427
 193:CamInterfaceAsm.S **** 		ldi		lastColor,0x00				; clear out the last color before we start
742
 194               			
1428
 194               			
743
 195:CamInterfaceAsm.S **** 		mov   	XH,currLineBuffHigh    	; Load the pointer to the current line
1429
 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		 
1430
 196:CamInterfaceAsm.S **** 		mov		XL,currLineBuffLow		; buffer into the X pointer regs		 
745
 197               			
1431
 197               			
746
 198:CamInterfaceAsm.S **** 		mov   	ZH,colorMapHigh      	; Load the pointers to the membership
1432
 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
1433
 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
1434
 200:CamInterfaceAsm.S **** 		mov 	YH,colorMapHigh	 		; as soon as we start reading data) to Z and Y
749
 201               			
1435
 201               			
750
 202:CamInterfaceAsm.S **** 		in		tmp1, _SFR_IO_ADDR(TIMSK)			; enable TIMER1 to start counting
1436
 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 
1437
 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
1438
 204:CamInterfaceAsm.S **** 		out		_SFR_IO_ADDR(TIMSK),tmp1			; overflow
753
 205               			
1439
 205               			
754
 206:CamInterfaceAsm.S **** 		ldi 	tmp1,PIXEL_RUN_START_INITIAL	; set up the TCNT1 to overflow (and
1440
 206:CamInterfaceAsm.S **** 		ldi 	tmp1,PIXEL_RUN_START_INITIAL	; set up the TCNT1 to overflow (and
-
 
1441
GAS LISTING /tmp/cckBHomO.s 			page 25
-
 
1442
 
-
 
1443
 
755
 207:CamInterfaceAsm.S **** 		ldi 	tmp2,0xFF 						; interrupts) after 176 pixels		
1444
 207:CamInterfaceAsm.S **** 		ldi 	tmp2,0xFF 						; interrupts) after 176 pixels		
756
 208:CamInterfaceAsm.S **** 		out 	_SFR_IO_ADDR(TCNT1H),tmp2		
1445
 208:CamInterfaceAsm.S **** 		out 	_SFR_IO_ADDR(TCNT1H),tmp2		
757
 209:CamInterfaceAsm.S **** 		out 	_SFR_IO_ADDR(TCNT1L),tmp1				
1446
 209:CamInterfaceAsm.S **** 		out 	_SFR_IO_ADDR(TCNT1L),tmp1				
758
 210               			
1447
 210               			
759
 211:CamInterfaceAsm.S **** 		mov		YL,colorMapLow		
1448
 211:CamInterfaceAsm.S **** 		mov		YL,colorMapLow		
760
 212               			
1449
 212               			
761
 213:CamInterfaceAsm.S **** 		in 		tmp1, _SFR_IO_ADDR(GICR)	; enable the HREF interrupt...remember, we
1450
 213:CamInterfaceAsm.S **** 		in 		tmp1, _SFR_IO_ADDR(GICR)	; enable the HREF interrupt...remember, we
762
 214               												; only use this interrupt to synchronize
1451
 214               												; only use this interrupt to synchronize
763
 215               												; the beginning of the line
1452
 215               												; the beginning of the line
764
 216:CamInterfaceAsm.S **** 		ori 	tmp1, HREF_INTERRUPT_ENABLE_MASK
1453
 216:CamInterfaceAsm.S **** 		ori 	tmp1, HREF_INTERRUPT_ENABLE_MASK
765
 217:CamInterfaceAsm.S **** 		out		_SFR_IO_ADDR(GICR), tmp1
1454
 217:CamInterfaceAsm.S **** 		out		_SFR_IO_ADDR(GICR), tmp1
766
 218               			
1455
 218               			
767
 219               	;*******************************************************************************************
1456
 219               	;*******************************************************************************************
768
 220               	;   Track Frame handler 
1457
 220               	;   Track Frame handler 
769
 221               	;*******************************************************************************************		
1458
 221               	;*******************************************************************************************		
770
 222               			
1459
 222               			
771
 223               	_trackFrame:		
1460
 223               	_trackFrame:		
772
 224:CamInterfaceAsm.S **** 		sbi		_SFR_IO_ADDR(PORTD),PD6
1461
 224:CamInterfaceAsm.S **** 		sbi		_SFR_IO_ADDR(PORTD),PD6
773
 225:CamInterfaceAsm.S **** 		sleep   ; ...And we wait...
1462
 225:CamInterfaceAsm.S **** 		sleep   ; ...And we wait...
774
 226               			
1463
 226               			
775
 227               		; Returning from the interrupt/sleep wakeup will consume
1464
 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)	
1465
 228               		; 14 clock cycles (7 to wakeup from idle sleep, 3 to vector, and 4 to return)	
777
 229               	
1466
 229               	
778
 230               		; Disable the HREF interrupt
1467
 230               		; Disable the HREF interrupt
779
 231:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6
1468
 231:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6
780
 232:CamInterfaceAsm.S **** 		in 		tmp1, _SFR_IO_ADDR(GICR)
1469
 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
1470
 233:CamInterfaceAsm.S **** 		andi 	tmp1, HREF_INTERRUPT_DISABLE_MASK
785
 234:CamInterfaceAsm.S **** 		out		_SFR_IO_ADDR(GICR), tmp1
1471
 234:CamInterfaceAsm.S **** 		out		_SFR_IO_ADDR(GICR), tmp1
786
 235               			
1472
 235               			
787
 236               		; A couple of NOPs are needed here to sync up the pixel data...the number (2)
1473
 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.
1474
 237               		; of NOPs was determined emperically by trial and error.
789
 238:CamInterfaceAsm.S **** 		nop
1475
 238:CamInterfaceAsm.S **** 		nop
790
 239:CamInterfaceAsm.S **** 		nop
1476
 239:CamInterfaceAsm.S **** 		nop
791
 240               	_acquirePixelBlock:							;							Clock Cycle Count
1477
 240               	_acquirePixelBlock:							;							Clock Cycle Count
792
 241:CamInterfaceAsm.S **** 		in		ZL,RB_PORT         			; sample the red value (PINB)		(1)
1478
 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)
1479
 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)
1480
 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)
1481
 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)
1482
 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)
1483
 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)
1484
 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)
1485
 248:CamInterfaceAsm.S **** 		and		color,greenData 			; mask memberships together			(1)
800
 249:CamInterfaceAsm.S **** 		and		color,blueData  			; to produce the final color		(1)
1486
 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)
1487
 250:CamInterfaceAsm.S **** 		brts    _cleanUpTrackingLine		; if some interrupt routine has		(1...not set)
802
 251               												; come in and set our T flag in 
1488
 251               												; come in and set our T flag in 
803
 252               												; SREG, then we need to hop out
1489
 252               												; SREG, then we need to hop out
804
 253               												; and blow away this frames data (common cleanup)									
1490
 253               												; and blow away this frames data (common cleanup)									
805
 254:CamInterfaceAsm.S **** 		cp		color,lastColor     		; check to see if the run continues	(1)
1491
 254:CamInterfaceAsm.S **** 		cp		color,lastColor     		; check to see if the run continues	(1)
806
 255:CamInterfaceAsm.S **** 		breq    _acquirePixelBlock  		;									(2...equal)
1492
 255:CamInterfaceAsm.S **** 		breq    _acquirePixelBlock  		;									(2...equal)
807
 256               												;									___________
1493
 256               												;									___________
808
 257               												;								16 clock cycles 		
1494
 257               												;								16 clock cycles 		
809
 258               												; (16 clock cycles = 1 uS = 1 pixelBlock time)
1495
 258               												; (16 clock cycles = 1 uS = 1 pixelBlock time)
810
 259               			
1496
 259               			
811
 260               			; Toggle the debug line to indicate a color change
1497
 260               			; Toggle the debug line to indicate a color change
812
 261:CamInterfaceAsm.S **** 		sbi     _SFR_IO_ADDR(PORTD),PD6
1498
 261:CamInterfaceAsm.S **** 		sbi     _SFR_IO_ADDR(PORTD),PD6
813
 262:CamInterfaceAsm.S **** 		nop
1499
 262:CamInterfaceAsm.S **** 		nop
814
 263:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6
1500
 263:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6
-
 
1501
GAS LISTING /tmp/cckBHomO.s 			page 26
-
 
1502
 
-
 
1503
 
815
 264               			
1504
 264               			
816
 265:CamInterfaceAsm.S **** 		mov		tmp2,pixelRunStart				; get the count value of the
1505
 265:CamInterfaceAsm.S **** 		mov		tmp2,pixelRunStart				; get the count value of the
817
 266               													; current pixel run
1506
 266               													; current pixel run
818
 267:CamInterfaceAsm.S **** 		in		pixelCount,_SFR_IO_ADDR(TCNT1L)	; get the current TCNT1 value 
1507
 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
1508
 268:CamInterfaceAsm.S **** 		mov   	pixelRunStart,pixelCount		; reload pixelRunStart for the
820
 269               													; next run
1509
 269               													; next run
821
 270:CamInterfaceAsm.S **** 		sub		pixelCount,tmp2     			; pixelCount = TCNT1L - pixelRunStart
1510
 270:CamInterfaceAsm.S **** 		sub		pixelCount,tmp2     			; pixelCount = TCNT1L - pixelRunStart
822
 271               											
1511
 271               											
823
 272:CamInterfaceAsm.S **** 		st		X+,lastColor			; record the color run in the current line buffer
1512
 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
1513
 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
1514
 274:CamInterfaceAsm.S **** 		mov		lastColor,color			; set lastColor so we can figure out when it changes
826
 275               			
1515
 275               			
827
 276:CamInterfaceAsm.S **** 		nop								; waste one more cycle for a total of 16
1516
 276:CamInterfaceAsm.S **** 		nop								; waste one more cycle for a total of 16
828
 277:CamInterfaceAsm.S **** 		rjmp	_acquirePixelBlock	
1517
 277:CamInterfaceAsm.S **** 		rjmp	_acquirePixelBlock	
829
 278               			
1518
 278               			
830
 279               	; _cleanUpTrackingLine is used to write the last run length block off to the currentLineBuffer so
1519
 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.
1520
 280               	; that all 176 pixels in the line are accounted for.
832
 281               	_cleanUpTrackingLine:		
1521
 281               	_cleanUpTrackingLine:		
833
 282:CamInterfaceAsm.S **** 		ldi		pixelCount,0xFF		; the length of the last run is ALWAYS 0xFF minus the last
1522
 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
1523
 283:CamInterfaceAsm.S **** 		sub		pixelCount,pixelRunStart  	; pixelRunStart
835
 284               			
1524
 284               			
836
 285:CamInterfaceAsm.S **** 		inc		pixelCount				; increment pixelCount since we actually need to account
1525
 285:CamInterfaceAsm.S **** 		inc		pixelCount				; increment pixelCount since we actually need to account
837
 286               											; for the overflow of TCNT1
1526
 286               											; for the overflow of TCNT1
838
 287               											
1527
 287               											
839
 288:CamInterfaceAsm.S **** 		st		X+,color				; record the color run in the current line buffer
1528
 288:CamInterfaceAsm.S **** 		st		X+,color				; record the color run in the current line buffer
840
 289:CamInterfaceAsm.S **** 		st		X,pixelCount		
1529
 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
1530
 290:CamInterfaceAsm.S **** 		rjmp	_cleanUp
845
 291               			
1531
 291               			
846
 292               	_cleanUpDumpLine:		
1532
 292               	_cleanUpDumpLine:		
847
 293               			; NOTE: If serial data is received, to interrupt the tracking of a line, we'll
1533
 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
1534
 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
1535
 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
1536
 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
1537
 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
1538
 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....
1539
 299               			; this loop, and only turn it on when we begin acquiring lines....
854
 300               	        ; NOT NEEDED FOR NOW...
1540
 300               	        ; NOT NEEDED FOR NOW...
855
 301               			;in		tmp1, _SFR_IO_ADDR(TIMSK)			; disable TIMER1 to stop counting
1541
 301               			;in		tmp1, _SFR_IO_ADDR(TIMSK)			; disable TIMER1 to stop counting
856
 302               			;andi	tmp1, DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK 	; external PCLK pulses
1542
 302               			;andi	tmp1, DISABLE_PCLK_TIMER1_OVERFLOW_BITMASK 	; external PCLK pulses
857
 303               			;out		_SFR_IO_ADDR(TIMSK),tmp1
1543
 303               			;out		_SFR_IO_ADDR(TIMSK),tmp1
858
 304               	
1544
 304               	
859
 305               	_cleanUp:
1545
 305               	_cleanUp:
860
 306               	        ; Disable the external clocking of the Timer1 counter 
1546
 306               	        ; Disable the external clocking of the Timer1 counter 
861
 307:CamInterfaceAsm.S ****         in      tmp1, _SFR_IO_ADDR(TCCR1B)
1547
 307:CamInterfaceAsm.S ****         in      tmp1, _SFR_IO_ADDR(TCCR1B)
862
 308:CamInterfaceAsm.S ****         andi    tmp1, 0xF8
1548
 308:CamInterfaceAsm.S ****         andi    tmp1, 0xF8
863
 309:CamInterfaceAsm.S ****         out     _SFR_IO_ADDR(TCCR1B),tmp1
1549
 309:CamInterfaceAsm.S ****         out     _SFR_IO_ADDR(TCCR1B),tmp1
864
 310               			
1550
 310               			
865
 311               			; Toggle the debug line to indicate the line is complete
1551
 311               			; Toggle the debug line to indicate the line is complete
866
 312:CamInterfaceAsm.S **** 		sbi     _SFR_IO_ADDR(PORTD),PD6
1552
 312:CamInterfaceAsm.S **** 		sbi     _SFR_IO_ADDR(PORTD),PD6
867
 313:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6
1553
 313:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6
868
 314:CamInterfaceAsm.S **** 		clt				; clear out the T bit since we have detected
1554
 314:CamInterfaceAsm.S **** 		clt				; clear out the T bit since we have detected
869
 315               							; the interruption and are exiting to handle it
1555
 315               							; the interruption and are exiting to handle it
870
 316               	_exit:
1556
 316               	_exit:
871
 317:CamInterfaceAsm.S **** 		ret
1557
 317:CamInterfaceAsm.S **** 		ret
872
 318               			
1558
 318               			
873
 319               	;*****************************************************************		
1559
 319               	;*****************************************************************		
874
 320               	;   	Function Name: CamIntAsm_waitForNewDumpFrame
1560
 320               	;   	Function Name: CamIntAsm_waitForNewDumpFrame
-
 
1561
GAS LISTING /tmp/cckBHomO.s 			page 27
-
 
1562
 
-
 
1563
 
875
 321               	;       Function Description: This function is responsible for
1564
 321               	;       Function Description: This function is responsible for
876
 322               	;       going to sleep until a new frame begins (indicated by
1565
 322               	;       going to sleep until a new frame begins (indicated by
877
 323               	;    	VSYNC transitioning from low to high.  This will wake
1566
 323               	;    	VSYNC transitioning from low to high.  This will wake
878
 324               	;       the "VSYNC sleep" up and allow it to continue with 
1567
 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.
1568
 325               	;       acquiring a line of pixel data to dump out to the UI.
880
 326               	;       Inputs:  r25 - MSB of currentLineBuffer
1569
 326               	;       Inputs:  r25 - MSB of currentLineBuffer
881
 327               	;                r24 - LSB of currentLineBuffer
1570
 327               	;                r24 - LSB of currentLineBuffer
882
 328               	;				 r23 - MSB of prevLineBuffer
1571
 328               	;				 r23 - MSB of prevLineBuffer
883
 329               	;				 r22 - LSB of prevLineBuffer
1572
 329               	;				 r22 - LSB of prevLineBuffer
884
 330               	;       Outputs: none
1573
 330               	;       Outputs: none
885
 331               	;       NOTES: This function doesn't really return...it sorta just
1574
 331               	;       NOTES: This function doesn't really return...it sorta just
886
 332               	;       floats into the acquireDumpLine function after the "VSYNC sleep"
1575
 332               	;       floats into the acquireDumpLine function after the "VSYNC sleep"
887
 333               	;       is awoken.
1576
 333               	;       is awoken.
888
 334               	;*****************************************************************		
1577
 334               	;*****************************************************************		
889
 335               	CamIntAsm_waitForNewDumpFrame:
1578
 335               	CamIntAsm_waitForNewDumpFrame:
890
 336:CamInterfaceAsm.S **** 		sbi		_SFR_IO_ADDR(PORTD),PD6  ; For testing...
1579
 336:CamInterfaceAsm.S **** 		sbi		_SFR_IO_ADDR(PORTD),PD6  ; For testing...
891
 337:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6
1580
 337:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6
892
 338:CamInterfaceAsm.S **** 		sleep
1581
 338:CamInterfaceAsm.S **** 		sleep
893
 339               	
1582
 339               	
894
 340               	;*****************************************************************
1583
 340               	;*****************************************************************
895
 341               	; REMEMBER...everything from here on out is critically timed to be
1584
 341               	; REMEMBER...everything from here on out is critically timed to be
896
 342               	; synchronized with the flow of pixel data from the camera...
1585
 342               	; synchronized with the flow of pixel data from the camera...
897
 343               	;*****************************************************************
1586
 343               	;*****************************************************************
898
 344               	
1587
 344               	
899
 345               	CamIntAsm_acquireDumpLine:
1588
 345               	CamIntAsm_acquireDumpLine:
900
 346:CamInterfaceAsm.S **** 		brts	_cleanUp
1589
 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...
1590
 347               			;sbi		_SFR_IO_ADDR(PORTD),PD6 ; For testing...
905
 348               			;cbi		_SFR_IO_ADDR(PORTD),PD6
1591
 348               			;cbi		_SFR_IO_ADDR(PORTD),PD6
906
 349               			
1592
 349               			
907
 350:CamInterfaceAsm.S **** 		mov   	XH,currLineBuffHigh    	; Load the pointer to the current line
1593
 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
1594
 351:CamInterfaceAsm.S **** 		mov		XL,currLineBuffLow		; buffer into the X pointer regs
909
 352               	
1595
 352               	
910
 353:CamInterfaceAsm.S **** 		mov		YH,prevLineBuffHigh		; Load the pointer to the previous line
1596
 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
1597
 354:CamInterfaceAsm.S **** 		mov		YL,prevLineBuffLow  	; buffer into the Y pointer regs
912
 355               			
1598
 355               			
913
 356:CamInterfaceAsm.S **** 		ldi 	tmp1,PIXEL_RUN_START_INITIAL	; set up the TCNT1 to overflow (and
1599
 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		
1600
 357:CamInterfaceAsm.S **** 		ldi 	tmp2,0xFF 						; interrupts) after 176 pixels		
915
 358:CamInterfaceAsm.S **** 		out 	_SFR_IO_ADDR(TCNT1H),tmp2		
1601
 358:CamInterfaceAsm.S **** 		out 	_SFR_IO_ADDR(TCNT1H),tmp2		
916
 359:CamInterfaceAsm.S **** 		out 	_SFR_IO_ADDR(TCNT1L),tmp1		
1602
 359:CamInterfaceAsm.S **** 		out 	_SFR_IO_ADDR(TCNT1L),tmp1		
917
 360               			
1603
 360               			
918
 361:CamInterfaceAsm.S ****         in      tmp1, _SFR_IO_ADDR(TCCR1B) ; Enable the PCLK line to actually
1604
 361:CamInterfaceAsm.S ****         in      tmp1, _SFR_IO_ADDR(TCCR1B) ; Enable the PCLK line to actually
919
 362:CamInterfaceAsm.S ****         ori     tmp1, 0x07                 ; feed Timer1
1605
 362:CamInterfaceAsm.S ****         ori     tmp1, 0x07                 ; feed Timer1
920
 363:CamInterfaceAsm.S ****         out     _SFR_IO_ADDR(TCCR1B),tmp1
1606
 363:CamInterfaceAsm.S ****         out     _SFR_IO_ADDR(TCCR1B),tmp1
921
 364:CamInterfaceAsm.S ****         nop
1607
 364:CamInterfaceAsm.S ****         nop
922
 365               	        
1608
 365               	        
923
 366:CamInterfaceAsm.S **** 		in		tmp1, _SFR_IO_ADDR(TIMSK)			; enable TIMER1 to start counting
1609
 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 
1610
 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			
1611
 368:CamInterfaceAsm.S **** 		out		_SFR_IO_ADDR(TIMSK),tmp1			; overflow			
926
 369               			
1612
 369               			
927
 370:CamInterfaceAsm.S **** 		in 		tmp1, _SFR_IO_ADDR(GICR)	; enable the HREF interrupt...remember, we
1613
 370:CamInterfaceAsm.S **** 		in 		tmp1, _SFR_IO_ADDR(GICR)	; enable the HREF interrupt...remember, we
928
 371               												; only use this interrupt to synchronize
1614
 371               												; only use this interrupt to synchronize
929
 372               												; the beginning of the line
1615
 372               												; the beginning of the line
930
 373:CamInterfaceAsm.S **** 		ori 	tmp1, HREF_INTERRUPT_ENABLE_MASK
1616
 373:CamInterfaceAsm.S **** 		ori 	tmp1, HREF_INTERRUPT_ENABLE_MASK
931
 374:CamInterfaceAsm.S **** 		out		_SFR_IO_ADDR(GICR), tmp1
1617
 374:CamInterfaceAsm.S **** 		out		_SFR_IO_ADDR(GICR), tmp1
932
 375               			
1618
 375               			
933
 376               	;*******************************************************************************************
1619
 376               	;*******************************************************************************************
934
 377               	;   Dump Frame handler 
1620
 377               	;   Dump Frame handler 
-
 
1621
GAS LISTING /tmp/cckBHomO.s 			page 28
-
 
1622
 
-
 
1623
 
935
 378               	;*******************************************************************************************		
1624
 378               	;*******************************************************************************************		
936
 379               			
1625
 379               			
937
 380               	_dumpFrame:		
1626
 380               	_dumpFrame:		
938
 381:CamInterfaceAsm.S **** 		sbi		_SFR_IO_ADDR(PORTD),PD6
1627
 381:CamInterfaceAsm.S **** 		sbi		_SFR_IO_ADDR(PORTD),PD6
939
 382:CamInterfaceAsm.S **** 		sleep   ; ...And we wait...
1628
 382:CamInterfaceAsm.S **** 		sleep   ; ...And we wait...
940
 383               	
1629
 383               	
941
 384:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6
1630
 384:CamInterfaceAsm.S **** 		cbi		_SFR_IO_ADDR(PORTD),PD6
942
 385:CamInterfaceAsm.S **** 		in 		tmp1, _SFR_IO_ADDR(GICR)			; disable the HREF interrupt
1631
 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
1632
 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
1633
 387:CamInterfaceAsm.S **** 		out		_SFR_IO_ADDR(GICR), tmp1			; while dumping the line
945
 388               		
1634
 388               		
946
 389:CamInterfaceAsm.S **** 		nop		; Remember...if we ever remove the "cbi" instruction above,
1635
 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
1636
 390               					; we need to add two more NOPs to cover this
948
 391               	    
1637
 391               	    
949
 392               	; Ok...the following loop needs to run in 8 clock cycles, so we can get every
1638
 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
1639
 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
1640
 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,
1641
 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
1642
 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
1643
 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
1644
 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 :-)  )
1645
 399               	; do that here (only 8 instruction cycles :-)  )
957
 400               	_sampleDumpPixel:
1646
 400               	_sampleDumpPixel:
958
 401:CamInterfaceAsm.S **** 		in		tmp1,G_PORT				; sample the G value					(1)
1647
 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)
1648
 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)
1649
 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)
1650
 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)
1651
 405:CamInterfaceAsm.S **** 		brtc	_sampleDumpPixel		; loop back unless flag is set			(2...if not set)
966
 406               											;									___________
1652
 406               											;									___________
967
 407               											;									8 cycles normally
1653
 407               											;									8 cycles normally
968
 408               																				
1654
 408               																				
969
 409               			; if we make it here, it means the T flag is set, and we must have been interrupted
1655
 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?)
1656
 410               			; so we need to exit (what if we were interrupted for serial? should we disable it?)
971
 411:CamInterfaceAsm.S **** 		rjmp	_cleanUpDumpLine
1657
 411:CamInterfaceAsm.S **** 		rjmp	_cleanUpDumpLine
972
 412               	
1658
 412               	
973
 413               	;***********************************************************
1659
 413               	;***********************************************************
974
 414               	;	Function Name: <interrupt handler for External Interrupt0> 
1660
 414               	;	Function Name: <interrupt handler for External Interrupt0> 
975
 415               	;	Function Description: This function is responsible
1661
 415               	;	Function Description: This function is responsible
976
 416               	;	for handling a rising edge on the Ext Interrupt 0.  This
1662
 416               	;	for handling a rising edge on the Ext Interrupt 0.  This
977
 417               	;	routine simply returns, since we just want to wake up
1663
 417               	;	routine simply returns, since we just want to wake up
978
 418               	;	whenever the VSYNC transitions (meaning the start of a new
1664
 418               	;	whenever the VSYNC transitions (meaning the start of a new
979
 419               	;	frame).
1665
 419               	;	frame).
980
 420               	;	Inputs:  none
1666
 420               	;	Inputs:  none
981
 421               	;	Outputs: none
1667
 421               	;	Outputs: none
982
 422               	;***********************************************************
1668
 422               	;***********************************************************
983
 423               	SIG_INTERRUPT0:
1669
 423               	SIG_INTERRUPT0:
984
 424               	; This will wake us up when VSYNC transitions high...we just want to return
1670
 424               	; This will wake us up when VSYNC transitions high...we just want to return
985
 425:CamInterfaceAsm.S **** 		reti
1671
 425:CamInterfaceAsm.S **** 		reti
986
 426               			
1672
 426               			
987
 427               	;***********************************************************
1673
 427               	;***********************************************************
988
 428               	;	Function Name: <interrupt handler for External Interrupt1> 
1674
 428               	;	Function Name: <interrupt handler for External Interrupt1> 
989
 429               	;	Function Description: This function is responsible
1675
 429               	;	Function Description: This function is responsible
990
 430               	;	for handling a falling edge on the Ext Interrupt 1.  This
1676
 430               	;	for handling a falling edge on the Ext Interrupt 1.  This
991
 431               	;	routine simply returns, since we just want to wake up
1677
 431               	;	routine simply returns, since we just want to wake up
992
 432               	;	whenever the HREF transitions (meaning the pixels 
1678
 432               	;	whenever the HREF transitions (meaning the pixels 
993
 433               	;	are starting after VSYNC transitioned, and we need to
1679
 433               	;	are starting after VSYNC transitioned, and we need to
994
 434               	; 	start acquiring the pixel blocks
1680
 434               	; 	start acquiring the pixel blocks
-
 
1681
GAS LISTING /tmp/cckBHomO.s 			page 29
-
 
1682
 
-
 
1683
 
995
 435               	;	Inputs:  none
1684
 435               	;	Inputs:  none
996
 436               	;	Outputs: none
1685
 436               	;	Outputs: none
997
 437               	;***********************************************************	
1686
 437               	;***********************************************************	
998
 438               	SIG_INTERRUPT1:
1687
 438               	SIG_INTERRUPT1:
999
 439               	; This will wake us up when HREF transitions high...we just want to return
1688
 439               	; This will wake us up when HREF transitions high...we just want to return
1000
 440:CamInterfaceAsm.S **** 		reti
1689
 440:CamInterfaceAsm.S **** 		reti
1001
 441               			
1690
 441               			
1002
 442               	;***********************************************************
1691
 442               	;***********************************************************
1003
 443               	;	Function Name: <interrupt handler for Timer0 overflow>
1692
 443               	;	Function Name: <interrupt handler for Timer0 overflow>
1004
 444               	;	Function Description: This function is responsible
1693
 444               	;	Function Description: This function is responsible
1005
 445               	;	for handling the Timer0 overflow (hooked up to indicate
1694
 445               	;	for handling the Timer0 overflow (hooked up to indicate
1006
 446               	;	when we have reached the number of HREFs required in a
1695
 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
1696
 447               	;	single frame).  We set the T flag in the SREG to
1008
 448               	;	indicate to the _acquirePixelBlock routine that it needs
1697
 448               	;	indicate to the _acquirePixelBlock routine that it needs
1009
 449               	;	to exit, and then set the appropriate action to take in
1698
 449               	;	to exit, and then set the appropriate action to take in
1010
 450               	;	the eventList of the Executive module.
1699
 450               	;	the eventList of the Executive module.
1011
 451               	;	Inputs:  none
1700
 451               	;	Inputs:  none
1012
 452               	;	Outputs: none
1701
 452               	;	Outputs: none
1013
 453               	;   Note: Originally, the HREF pulses were also going to
1702
 453               	;   Note: Originally, the HREF pulses were also going to
1014
 454               	;   be counted by a hardware counter, but it didn't end up
1703
 454               	;   be counted by a hardware counter, but it didn't end up
1015
 455               	;   being necessary
1704
 455               	;   being necessary
1016
 456               	;***********************************************************
1705
 456               	;***********************************************************
1017
 457               	;SIG_OVERFLOW0:
1706
 457               	;SIG_OVERFLOW0:
1018
 458               	;		set				; set the T bit in SREG
1707
 458               	;		set				; set the T bit in SREG
1019
 459               	;		lds		tmp1,eventBitmask
1708
 459               	;		lds		tmp1,eventBitmask
1020
 460               	;		ori		tmp1,EV_ACQUIRE_FRAME_COMPLETE
1709
 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
1710
 461               	;		sts		eventBitmask,tmp1
1025
 462               	;		reti
1711
 462               	;		reti
1026
 463               			
1712
 463               			
1027
 464               	;***********************************************************
1713
 464               	;***********************************************************
1028
 465               	;	Function Name: <interrupt handler for Timer1 overflow>
1714
 465               	;	Function Name: <interrupt handler for Timer1 overflow>
1029
 466               	;	Function Description: This function is responsible
1715
 466               	;	Function Description: This function is responsible
1030
 467               	;	for handling the Timer1 overflow (hooked up to indicate
1716
 467               	;	for handling the Timer1 overflow (hooked up to indicate
1031
 468               	;	when we have reached the end of a line of pixel data,
1717
 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 
1718
 469               	;	since PCLK is hooked up to overflow TCNT1 after 176 
1033
 470               	;	pixels).  This routine generates an acquire line complete
1719
 470               	;	pixels).  This routine generates an acquire line complete
1034
 471               	;	event in the fastEventBitmask, which is streamlined for
1720
 471               	;	event in the fastEventBitmask, which is streamlined for
1035
 472               	;	efficiency reasons.
1721
 472               	;	efficiency reasons.
1036
 473               	;***********************************************************
1722
 473               	;***********************************************************
1037
 474               	SIG_OVERFLOW1:				
1723
 474               	SIG_OVERFLOW1:				
1038
 475:CamInterfaceAsm.S **** 		lds		tmp1,fastEventBitmask   		; set a flag indicating
1724
 475:CamInterfaceAsm.S **** 		lds		tmp1,fastEventBitmask   		; set a flag indicating
1039
 476:CamInterfaceAsm.S **** 		ori		tmp1,FEV_ACQUIRE_LINE_COMPLETE	; a line is complete
1725
 476:CamInterfaceAsm.S **** 		ori		tmp1,FEV_ACQUIRE_LINE_COMPLETE	; a line is complete
1040
 477:CamInterfaceAsm.S **** 		sts		fastEventBitmask,tmp1
1726
 477:CamInterfaceAsm.S **** 		sts		fastEventBitmask,tmp1
1041
 478:CamInterfaceAsm.S **** 		set		; set the T bit in SREG 
1727
 478:CamInterfaceAsm.S **** 		set		; set the T bit in SREG 
1042
 479               			;sbi		_SFR_IO_ADDR(PORTD),PD6 ; For testing...
1728
 479               			;sbi		_SFR_IO_ADDR(PORTD),PD6 ; For testing...
1043
 480               			;cbi		_SFR_IO_ADDR(PORTD),PD6 ; For testing...
1729
 480               			;cbi		_SFR_IO_ADDR(PORTD),PD6 ; For testing...
1044
 481               	
1730
 481               	
1045
 482:CamInterfaceAsm.S **** 		reti
1731
 482:CamInterfaceAsm.S **** 		reti
1046
 483               	
1732
 483               	
1047
 484               	; This is the default handler for all interrupts that don't
1733
 484               	; This is the default handler for all interrupts that don't
1048
 485               	; have handler routines specified for them.
1734
 485               	; have handler routines specified for them.
1049
 486               	        .global __vector_default              
1735
 486               	        .global __vector_default              
1050
 487               	__vector_default:
1736
 487               	__vector_default:
1051
 488:CamInterfaceAsm.S ****         reti
1737
 488:CamInterfaceAsm.S ****         reti
1052
 489               	
1738
 489               	
1053
 490               	        .end
1739
 490               	        .end
1054
GAS LISTING C:\DOCUME~1\John\LOCALS~1\Temp/ccIlaaaa.s 			page 19
1740
GAS LISTING /tmp/cckBHomO.s 			page 30
1055
 
1741
 
1056
 
1742
 
1057
DEFINED SYMBOLS
1743
DEFINED SYMBOLS
1058
                            *ABS*:00000000 CamInterfaceAsm.S
1744
                            *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
1745
   CamInterfaceAsm.S:119    *ABS*:00000010 pixelCount
1071
                            *ABS*:00000011 pixelRunStart
1746
   CamInterfaceAsm.S:120    *ABS*:00000011 pixelRunStart
1072
                            *ABS*:00000012 lastColor
1747
   CamInterfaceAsm.S:121    *ABS*:00000012 lastColor
1073
                            *ABS*:00000013 tmp1
1748
   CamInterfaceAsm.S:122    *ABS*:00000013 tmp1
1074
                            *ABS*:00000014 tmp2
1749
   CamInterfaceAsm.S:123    *ABS*:00000014 tmp2
1075
                            *ABS*:00000013 color
1750
   CamInterfaceAsm.S:124    *ABS*:00000013 color
1076
                            *ABS*:00000014 greenData
1751
   CamInterfaceAsm.S:125    *ABS*:00000014 greenData
1077
                            *ABS*:00000015 blueData
1752
   CamInterfaceAsm.S:126    *ABS*:00000015 blueData
1078
                            *ABS*:00000016 colorMapLow
1753
   CamInterfaceAsm.S:127    *ABS*:00000016 colorMapLow
1079
                            *ABS*:00000017 colorMapHigh
1754
   CamInterfaceAsm.S:128    *ABS*:00000017 colorMapHigh
1080
                            *ABS*:00000016 prevLineBuffLow
1755
   CamInterfaceAsm.S:129    *ABS*:00000016 prevLineBuffLow
1081
                            *ABS*:00000017 prevLineBuffHigh
1756
   CamInterfaceAsm.S:130    *ABS*:00000017 prevLineBuffHigh
1082
                            *ABS*:00000018 currLineBuffLow
1757
   CamInterfaceAsm.S:131    *ABS*:00000018 currLineBuffLow
1083
                            *ABS*:00000019 currLineBuffHigh
1758
   CamInterfaceAsm.S:132    *ABS*:00000019 currLineBuffHigh
1084
   CamInterfaceAsm.S:169    .text:00000000 CamIntAsm_waitForNewTrackingFrame
1759
   CamInterfaceAsm.S:169    .text:00000000 CamIntAsm_waitForNewTrackingFrame
1085
   CamInterfaceAsm.S:335    .text:0000008e CamIntAsm_waitForNewDumpFrame
1760
   CamInterfaceAsm.S:335    .text:0000008e CamIntAsm_waitForNewDumpFrame
1086
   CamInterfaceAsm.S:345    .text:00000094 CamIntAsm_acquireDumpLine
1761
   CamInterfaceAsm.S:345    .text:00000094 CamIntAsm_acquireDumpLine
1087
   CamInterfaceAsm.S:179    .text:00000006 CamIntAsm_acquireTrackingLine
1762
   CamInterfaceAsm.S:179    .text:00000006 CamIntAsm_acquireTrackingLine
1088
   CamInterfaceAsm.S:423    .text:000000d4 __vector_1
1763
   CamInterfaceAsm.S:423    .text:000000d4 __vector_1
1089
   CamInterfaceAsm.S:438    .text:000000d6 __vector_2
1764
   CamInterfaceAsm.S:438    .text:000000d6 __vector_2
1090
   CamInterfaceAsm.S:474    .text:000000d8 __vector_8
1765
   CamInterfaceAsm.S:474    .text:000000d8 __vector_8
1091
   CamInterfaceAsm.S:305    .text:00000080 _cleanUp
1766
   CamInterfaceAsm.S:305    .text:00000080 _cleanUp
1092
   CamInterfaceAsm.S:223    .text:00000034 _trackFrame
1767
   CamInterfaceAsm.S:223    .text:00000034 _trackFrame
1093
   CamInterfaceAsm.S:240    .text:00000044 _acquirePixelBlock
1768
   CamInterfaceAsm.S:240    .text:00000044 _acquirePixelBlock
1094
   CamInterfaceAsm.S:281    .text:00000074 _cleanUpTrackingLine
1769
   CamInterfaceAsm.S:281    .text:00000074 _cleanUpTrackingLine
1095
   CamInterfaceAsm.S:292    .text:00000080 _cleanUpDumpLine
1770
   CamInterfaceAsm.S:292    .text:00000080 _cleanUpDumpLine
1096
   CamInterfaceAsm.S:316    .text:0000008c _exit
1771
   CamInterfaceAsm.S:316    .text:0000008c _exit
1097
   CamInterfaceAsm.S:380    .text:000000ba _dumpFrame
1772
   CamInterfaceAsm.S:380    .text:000000ba _dumpFrame
1098
   CamInterfaceAsm.S:400    .text:000000c8 _sampleDumpPixel
1773
   CamInterfaceAsm.S:400    .text:000000c8 _sampleDumpPixel
1099
   CamInterfaceAsm.S:487    .text:000000e6 __vector_default
1774
   CamInterfaceAsm.S:487    .text:000000e6 __vector_default
1100
 
1775
 
1101
UNDEFINED SYMBOLS
1776
UNDEFINED SYMBOLS
1102
__vector_9
1777
__vector_9
1103
fastEventBitmask
1778
fastEventBitmask