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