?? asm.lst
字號:
1 # 1 "asm.S"
2 # 1 "<built-in>"
1 #include <avr/io.h>
0
0
1 /* Copyright (c) 2002,2003 Marek Michalkiewicz, Joerg Wunsch
2 All rights reserved.
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
6
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in
12 the documentation and/or other materials provided with the
13 distribution.
14
15 * Neither the name of the copyright holders nor the names of
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 POSSIBILITY OF SUCH DAMAGE. */
30
31 /* $Id: io.h,v 1.14 2004/11/24 18:57:36 troth Exp $ */
32
33 /** \defgroup avr_io AVR device-specific IO definitions
34 \code #include <avr/io.h> \endcode
35
36 This header file includes the apropriate IO definitions for the
37 device that has been specified by the <tt>-mmcu=</tt> compiler
38 command-line switch. This is done by diverting to the appropriate
39 file <tt><avr/io</tt><em>XXXX</em><tt>.h></tt> which should
40 never be included directly. Some register names common to all
41 AVR devices are defined directly within <tt><avr/io.h></tt>,
42 but most of the details come from the respective include file.
43
44 Note that this file always includes
45 \code #include <avr/sfr_defs.h> \endcode
46 See \ref avr_sfr for the details.
47
48 Included are definitions of the IO register set and their
49 respective bit values as specified in the Atmel documentation.
50 Note that Atmel is not very consistent in its naming conventions,
51 so even identical functions sometimes get different names on
52 different devices.
53
54 Also included are the specific names useable for interrupt
55 function definitions as documented
56 \ref avr_signames "here".
57
58 Finally, the following macros are defined:
59
60 - \b RAMEND
61 <br>
62 A constant describing the last on-chip RAM location.
63 <br>
64 - \b XRAMEND
65 <br>
66 A constant describing the last possible location in RAM.
67 This is equal to RAMEND for devices that do not allow for
68 external RAM.
69 <br>
70 - \b E2END
71 <br>
72 A constant describing the address of the last EEPROM cell.
73 <br>
74 - \b FLASHEND
75 <br>
76 A constant describing the last byte address in flash ROM.
77 <br>
78 - \b SPM_PAGESIZE
79 <br>
80 For devices with bootloader support, the flash pagesize
81 (in bytes) to be used for the \c SPM instruction. */
82
83 #ifndef _AVR_IO_H_
84 #define _AVR_IO_H_
85
86 #include <avr/sfr_defs.h>
1 /* Copyright (c) 2002, Marek Michalkiewicz <marekm@amelek.gda.pl>
2 All rights reserved.
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
6
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in
12 the documentation and/or other materials provided with the
13 distribution.
14
15 * Neither the name of the copyright holders nor the names of
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 POSSIBILITY OF SUCH DAMAGE. */
30
31 /* avr/sfr_defs.h - macros for accessing AVR special function registers */
32
33 /* $Id: sfr_defs.h,v 1.14.2.1 2005/01/07 19:25:25 arcanum Exp $ */
34
35 #ifndef _AVR_SFR_DEFS_H_
36 #define _AVR_SFR_DEFS_H_ 1
37
38 /** \defgroup avr_sfr_notes Additional notes from <avr/sfr_defs.h>
39 \ingroup avr_sfr
40
41 The \c <avr/sfr_defs.h> file is included by all of the \c <avr/ioXXXX.h>
42 files, which use macros defined here to make the special function register
43 definitions look like C variables or simple constants, depending on the
44 <tt>_SFR_ASM_COMPAT</tt> define. Some examples from \c <avr/iom128.h> to
45 show how to define such macros:
46
47 \code
48 #define PORTA _SFR_IO8(0x1b)
49 #define TCNT1 _SFR_IO16(0x2c)
50 #define PORTF _SFR_MEM8(0x61)
51 #define TCNT3 _SFR_MEM16(0x88)
52 \endcode
53
54 If \c _SFR_ASM_COMPAT is not defined, C programs can use names like
55 <tt>PORTA</tt> directly in C expressions (also on the left side of
56 assignment operators) and GCC will do the right thing (use short I/O
57 instructions if possible). The \c __SFR_OFFSET definition is not used in
58 any way in this case.
59
60 Define \c _SFR_ASM_COMPAT as 1 to make these names work as simple constants
61 (addresses of the I/O registers). This is necessary when included in
62 preprocessed assembler (*.S) source files, so it is done automatically if
63 \c __ASSEMBLER__ is defined. By default, all addresses are defined as if
64 they were memory addresses (used in \c lds/sts instructions). To use these
65 addresses in \c in/out instructions, you must subtract 0x20 from them.
66
67 For more backwards compatibility, insert the following at the start of your
68 old assembler source file:
69
70 \code
71 #define __SFR_OFFSET 0
72 \endcode
73
74 This automatically subtracts 0x20 from I/O space addresses, but it's a
75 hack, so it is recommended to change your source: wrap such addresses in
76 macros defined here, as shown below. After this is done, the
77 <tt>__SFR_OFFSET</tt> definition is no longer necessary and can be removed.
78
79 Real example - this code could be used in a boot loader that is portable
80 between devices with \c SPMCR at different addresses.
81
82 \verbatim
83 <avr/iom163.h>: #define SPMCR _SFR_IO8(0x37)
84 <avr/iom128.h>: #define SPMCR _SFR_MEM8(0x68)
85 \endverbatim
86
87 \code
87
88 /*
89 * Registers common to all AVR devices.
90 */
91
92 #if __AVR_ARCH__ != 1
93 /*
94 * AVR architecture 1 has no RAM, thus no stack pointer.
95 *
96 * All other archs do have a stack pointer. Some devices have only
97 * less than 256 bytes of possible RAM locations (128 Bytes of SRAM
98 * and no option for external RAM), thus SPH is officially "reserved"
99 * for them. We catch this case below after including the
100 * device-specific ioXXXX.h file, by examining XRAMEND, and
101 * #undef-ining SP and SPH in that case.
102 */
103 /* Stack Pointer */
104 #define SP _SFR_IO16(0x3D)
105 #define SPL _SFR_IO8(0x3D)
106 #define SPH _SFR_IO8(0x3E)
107 #endif /* #if __AVR_ARCH__ != 1 */
108
109 /* Status REGister */
110 #define SREG _SFR_IO8(0x3F)
111
112 /* Status Register - SREG */
113 #define SREG_I 7
114 #define SREG_T 6
115 #define SREG_H 5
116 #define SREG_S 4
117 #define SREG_V 3
118 #define SREG_N 2
119 #define SREG_Z 1
120 #define SREG_C 0
121
122 /* Pointer definition */
123 #if __AVR_ARCH__ != 1
124 /* avr1 has only the Z pointer */
125 #define XL r26
126 #define XH r27
127 #define YL r28
128 #define YH r29
129 #endif /* #if __AVR_ARCH__ != 1 */
130 #define ZL r30
131 #define ZH r31
132
133 /*
134 * Only few devices come without EEPROM. In order to assemble the
135 * EEPROM library components without defining a specific device, we
136 * keep the EEPROM-related definitions here, and catch the devices
137 * without EEPROM (E2END == 0) below. Obviously, the EEPROM library
138 * functions will not work for them. ;-)
139 */
140 /* EEPROM Control Register */
141 #define EECR _SFR_IO8(0x1C)
142
143 /* EEPROM Data Register */
144 #define EEDR _SFR_IO8(0x1D)
145
146 /* EEPROM Address Register */
147 #define EEAR _SFR_IO16(0x1E)
148 #define EEARL _SFR_IO8(0x1E)
149 #define EEARH _SFR_IO8(0x1F)
150
151 /* EEPROM Control Register */
152 #define EERIE 3
153 #define EEMWE 2
154 #define EEWE 1
155 #define EERE 0
156
157 #if defined (__AVR_AT94K__)
158 # include <avr/ioat94k.h>
159 #elif defined (__AVR_AT43USB320__)
160 # include <avr/io43u32x.h>
161 #elif defined (__AVR_AT43USB355__)
162 # include <avr/io43u35x.h>
163 #elif defined (__AVR_AT76C711__)
164 # include <avr/io76c711.h>
165 #elif defined (__AVR_AT86RF401__)
166 # include <avr/io86r401.h>
167 #elif defined (__AVR_ATmega128__)
168 # include <avr/iom128.h>
169 #elif defined (__AVR_AT90CAN128__)
170 # include <avr/iocan128.h>
171 #elif defined (__AVR_ATmega64__)
172 # include <avr/iom64.h>
173 #elif defined (__AVR_ATmega645__)
174 # include <avr/iom645.h>
175 #elif defined (__AVR_ATmega6450__)
176 # include <avr/iom6450.h>
177 #elif defined (__AVR_ATmega103__)
178 # include <avr/iom103.h>
179 #elif defined (__AVR_ATmega32__)
180 # include <avr/iom32.h>
1 /* Copyright (c) 2002, Steinar Haugen
2 All rights reserved.
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
6
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in
12 the documentation and/or other materials provided with the
13 distribution.
14
15 * Neither the name of the copyright holders nor the names of
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -