📄 eeprom.lst
字号:
1 .file "EEProm.c"
2 .arch atmega8
3 __SREG__ = 0x3f
4 __SP_H__ = 0x3e
5 __SP_L__ = 0x3d
6 __tmp_reg__ = 0
7 __zero_reg__ = 1
8 .global __do_copy_data
9 .global __do_clear_bss
11 .text
12 .Ltext0:
104 .global Write_EEProm_byte
106 Write_EEProm_byte:
1:driver/EEProm.c **** /********************************************
2:driver/EEProm.c **** 公司名称:
3:driver/EEProm.c **** 文 件 名:EEProm.c
4:driver/EEProm.c **** 版 本 号:
5:driver/EEProm.c **** 程序设计:
6:driver/EEProm.c **** 说 明:EEProm读写程序
7:driver/EEProm.c **** 完成日期:
8:driver/EEProm.c **** 修改日期:
9:driver/EEProm.c **** 功能摘要:
10:driver/EEProm.c **** **********************************************/
11:driver/EEProm.c **** #define _EEProm
12:driver/EEProm.c **** #include "includes.h"
13:driver/EEProm.c ****
14:driver/EEProm.c **** void Write_EEProm_byte(uchar *pwr_addr,uchar val);
15:driver/EEProm.c **** void Write_EEProm_word(uint *pwr_addr,uint val);
16:driver/EEProm.c **** void Write_EEProm_block(const void *prd_addr,void *pwr_addr,uchar size);
17:driver/EEProm.c **** uchar Read_EEProm_byte(const uchar *prd_addr);
18:driver/EEProm.c **** uint Read_EEProm_word(const uint *prd_addr);
19:driver/EEProm.c **** void Read_EEProm_block(void *pbuf,const void *prd_addr,uchar size);
20:driver/EEProm.c ****
21:driver/EEProm.c **** //---------------------------------------------------------------
22:driver/EEProm.c **** void Write_EEProm_byte(uchar *pwr_addr,uchar val)
23:driver/EEProm.c **** {
108 .LM1:
109 /* prologue: frame size=0 */
110 /* prologue end (size=0) */
111 0000 DC01 movw r26,r24
24:driver/EEProm.c **** while (!eeprom_is_ready())
25:driver/EEProm.c **** {
26:driver/EEProm.c **** wdt_reset();
113 .LM2:
114 0002 E19B sbis 60-0x20,1
115 0004 03C0 rjmp .L7
116 .L4:
118 .LM3:
119 /* #APP */
120 0006 A895 wdr
121 /* #NOAPP */
122 0008 E199 sbic 60-0x20,1
123 000a FDCF rjmp .L4
124 .L7:
125 .LBB2:
126 .LBB3:
128 .Ltext1:
1:C:/WinAVR/avr/include/avr/eeprom.h **** /* Copyright (c) 2002, 2003, 2004 Marek Michalkiewicz
2:C:/WinAVR/avr/include/avr/eeprom.h **** Copyright (c) 2005, 2006 Bjoern Haase
3:C:/WinAVR/avr/include/avr/eeprom.h **** All rights reserved.
4:C:/WinAVR/avr/include/avr/eeprom.h ****
5:C:/WinAVR/avr/include/avr/eeprom.h **** Redistribution and use in source and binary forms, with or without
6:C:/WinAVR/avr/include/avr/eeprom.h **** modification, are permitted provided that the following conditions are met:
7:C:/WinAVR/avr/include/avr/eeprom.h ****
8:C:/WinAVR/avr/include/avr/eeprom.h **** * Redistributions of source code must retain the above copyright
9:C:/WinAVR/avr/include/avr/eeprom.h **** notice, this list of conditions and the following disclaimer.
10:C:/WinAVR/avr/include/avr/eeprom.h ****
11:C:/WinAVR/avr/include/avr/eeprom.h **** * Redistributions in binary form must reproduce the above copyright
12:C:/WinAVR/avr/include/avr/eeprom.h **** notice, this list of conditions and the following disclaimer in
13:C:/WinAVR/avr/include/avr/eeprom.h **** the documentation and/or other materials provided with the
14:C:/WinAVR/avr/include/avr/eeprom.h **** distribution.
15:C:/WinAVR/avr/include/avr/eeprom.h ****
16:C:/WinAVR/avr/include/avr/eeprom.h **** * Neither the name of the copyright holders nor the names of
17:C:/WinAVR/avr/include/avr/eeprom.h **** contributors may be used to endorse or promote products derived
18:C:/WinAVR/avr/include/avr/eeprom.h **** from this software without specific prior written permission.
19:C:/WinAVR/avr/include/avr/eeprom.h ****
20:C:/WinAVR/avr/include/avr/eeprom.h **** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21:C:/WinAVR/avr/include/avr/eeprom.h **** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22:C:/WinAVR/avr/include/avr/eeprom.h **** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23:C:/WinAVR/avr/include/avr/eeprom.h **** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24:C:/WinAVR/avr/include/avr/eeprom.h **** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25:C:/WinAVR/avr/include/avr/eeprom.h **** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26:C:/WinAVR/avr/include/avr/eeprom.h **** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27:C:/WinAVR/avr/include/avr/eeprom.h **** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28:C:/WinAVR/avr/include/avr/eeprom.h **** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29:C:/WinAVR/avr/include/avr/eeprom.h **** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30:C:/WinAVR/avr/include/avr/eeprom.h **** POSSIBILITY OF SUCH DAMAGE. */
31:C:/WinAVR/avr/include/avr/eeprom.h ****
32:C:/WinAVR/avr/include/avr/eeprom.h **** /* $Id: eeprom.h,v 1.17.2.1 2006/02/26 21:51:04 aesok Exp $ */
33:C:/WinAVR/avr/include/avr/eeprom.h ****
34:C:/WinAVR/avr/include/avr/eeprom.h **** /*
35:C:/WinAVR/avr/include/avr/eeprom.h **** eeprom.h
36:C:/WinAVR/avr/include/avr/eeprom.h ****
37:C:/WinAVR/avr/include/avr/eeprom.h **** Contributors:
38:C:/WinAVR/avr/include/avr/eeprom.h **** Created by Marek Michalkiewicz <marekm@linux.org.pl>
39:C:/WinAVR/avr/include/avr/eeprom.h **** eeprom_write_word and eeprom_write_block added by Artur Lipowski
40:C:/WinAVR/avr/include/avr/eeprom.h **** <LAL@pro.onet.pl>
41:C:/WinAVR/avr/include/avr/eeprom.h **** Complete rewrite using the original interface by Bjoern Haase
42:C:/WinAVR/avr/include/avr/eeprom.h **** <bjoern.haase@de.bosch.com>.
43:C:/WinAVR/avr/include/avr/eeprom.h **** */
44:C:/WinAVR/avr/include/avr/eeprom.h ****
45:C:/WinAVR/avr/include/avr/eeprom.h **** #ifndef _EEPROM_H_
46:C:/WinAVR/avr/include/avr/eeprom.h **** #define _EEPROM_H_ 1
47:C:/WinAVR/avr/include/avr/eeprom.h ****
48:C:/WinAVR/avr/include/avr/eeprom.h **** #define __need_size_t
49:C:/WinAVR/avr/include/avr/eeprom.h **** #include <stddef.h>
50:C:/WinAVR/avr/include/avr/eeprom.h **** #include <inttypes.h>
51:C:/WinAVR/avr/include/avr/eeprom.h ****
52:C:/WinAVR/avr/include/avr/eeprom.h ****
53:C:/WinAVR/avr/include/avr/eeprom.h **** #ifdef __AVR_MEGA__
54:C:/WinAVR/avr/include/avr/eeprom.h **** #define XCALL "call"
55:C:/WinAVR/avr/include/avr/eeprom.h **** #else
56:C:/WinAVR/avr/include/avr/eeprom.h **** #define XCALL "rcall"
57:C:/WinAVR/avr/include/avr/eeprom.h **** #endif
58:C:/WinAVR/avr/include/avr/eeprom.h ****
59:C:/WinAVR/avr/include/avr/eeprom.h **** #include <avr/io.h>
60:C:/WinAVR/avr/include/avr/eeprom.h **** #ifndef __EEPROM_REG_LOCATIONS__
61:C:/WinAVR/avr/include/avr/eeprom.h **** /** \def __EEPROM_REG_LOCATIONS__
62:C:/WinAVR/avr/include/avr/eeprom.h **** \ingroup avr_eeprom
63:C:/WinAVR/avr/include/avr/eeprom.h **** In order to be able to work without a requiring a multilib
64:C:/WinAVR/avr/include/avr/eeprom.h **** approach for dealing with controllers having the EEPROM registers
65:C:/WinAVR/avr/include/avr/eeprom.h **** at different positions in memory space, the eeprom functions evaluate
66:C:/WinAVR/avr/include/avr/eeprom.h **** __EEPROM_REG_LOCATIONS__: It is assumed to be defined by
67:C:/WinAVR/avr/include/avr/eeprom.h **** the device io header and contains 6 uppercase hex digits encoding the
68:C:/WinAVR/avr/include/avr/eeprom.h **** addresses of EECR,EEDR and EEAR.
69:C:/WinAVR/avr/include/avr/eeprom.h **** First two letters: EECR address.
70:C:/WinAVR/avr/include/avr/eeprom.h **** Second two letters: EEDR address.
71:C:/WinAVR/avr/include/avr/eeprom.h **** Last two letters: EEAR address.
72:C:/WinAVR/avr/include/avr/eeprom.h **** The default 1C1D1E corresponds to the
73:C:/WinAVR/avr/include/avr/eeprom.h **** register location that is valid for most controllers. The value
74:C:/WinAVR/avr/include/avr/eeprom.h **** of this define symbol is used for appending it to the base name of the
75:C:/WinAVR/avr/include/avr/eeprom.h **** assembler functions. */
76:C:/WinAVR/avr/include/avr/eeprom.h **** #define __EEPROM_REG_LOCATIONS__ 1C1D1E
77:C:/WinAVR/avr/include/avr/eeprom.h **** #endif
78:C:/WinAVR/avr/include/avr/eeprom.h **** #define _STR2(EXP) _STR1(EXP)
79:C:/WinAVR/avr/include/avr/eeprom.h **** #define _STR1(EXP) #EXP
80:C:/WinAVR/avr/include/avr/eeprom.h **** #define _REG_LOCATION_SUFFIX _STR2(__EEPROM_REG_LOCATIONS__)
81:C:/WinAVR/avr/include/avr/eeprom.h ****
82:C:/WinAVR/avr/include/avr/eeprom.h **** #ifndef CR_TAB
83:C:/WinAVR/avr/include/avr/eeprom.h **** #define CR_TAB "\n\t"
84:C:/WinAVR/avr/include/avr/eeprom.h **** #endif
85:C:/WinAVR/avr/include/avr/eeprom.h ****
86:C:/WinAVR/avr/include/avr/eeprom.h ****
87:C:/WinAVR/avr/include/avr/eeprom.h **** /** \defgroup avr_eeprom <avr/eeprom.h>: EEPROM handling
88:C:/WinAVR/avr/include/avr/eeprom.h **** \code #include <avr/eeprom.h> \endcode
89:C:/WinAVR/avr/include/avr/eeprom.h ****
90:C:/WinAVR/avr/include/avr/eeprom.h **** This header file declares the interface to some simple library
91:C:/WinAVR/avr/include/avr/eeprom.h **** routines suitable for handling the data EEPROM contained in the
92:C:/WinAVR/avr/include/avr/eeprom.h **** AVR microcontrollers. The implementation uses a simple polled
93:C:/WinAVR/avr/include/avr/eeprom.h **** mode interface. Applications that require interrupt-controlled
94:C:/WinAVR/avr/include/avr/eeprom.h **** EEPROM access to ensure that no time will be wasted in spinloops
95:C:/WinAVR/avr/include/avr/eeprom.h **** will have to deploy their own implementation.
96:C:/WinAVR/avr/include/avr/eeprom.h ****
97:C:/WinAVR/avr/include/avr/eeprom.h **** \note All of the read/write functions first make sure the EEPROM
98:C:/WinAVR/avr/include/avr/eeprom.h **** is ready to be accessed. Since this may cause long delays if a
99:C:/WinAVR/avr/include/avr/eeprom.h **** write operation is still pending, time-critical applications
100:C:/WinAVR/avr/include/avr/eeprom.h **** should first poll the EEPROM e. g. using eeprom_is_ready() before
101:C:/WinAVR/avr/include/avr/eeprom.h **** attempting any actual I/O.
102:C:/WinAVR/avr/include/avr/eeprom.h ****
103:C:/WinAVR/avr/include/avr/eeprom.h **** \note This header file declares inline functions that call the
104:C:/WinAVR/avr/include/avr/eeprom.h **** assembler subroutines directly. This prevents that the compiler
105:C:/WinAVR/avr/include/avr/eeprom.h **** generates push/pops for the call-clobbered registers. This way
106:C:/WinAVR/avr/include/avr/eeprom.h **** also a specific calling convention could be used for the eeprom
107:C:/WinAVR/avr/include/avr/eeprom.h **** routines e.g. by passing values in __tmp_reg__, eeprom addresses in
108:C:/WinAVR/avr/include/avr/eeprom.h **** X and memory addresses in Z registers. Method is optimized for code
109:C:/WinAVR/avr/include/avr/eeprom.h **** size.
110:C:/WinAVR/avr/include/avr/eeprom.h ****
111:C:/WinAVR/avr/include/avr/eeprom.h **** \note Presently supported are two locations of the EEPROM register
112:C:/WinAVR/avr/include/avr/eeprom.h **** set: 0x1F,0x20,0x21 and 0x1C,0x1D,0x1E
113:C:/WinAVR/avr/include/avr/eeprom.h **** (see ::__EEPROM_REG_LOCATIONS__).
114:C:/WinAVR/avr/include/avr/eeprom.h ****
115:C:/WinAVR/avr/include/avr/eeprom.h **** \note As these functions modify IO registers, they are known to be
116:C:/WinAVR/avr/include/avr/eeprom.h **** non-reentrant. If any of these functions are used from both,
117:C:/WinAVR/avr/include/avr/eeprom.h **** standard and interrupt context, the applications must ensure
118:C:/WinAVR/avr/include/avr/eeprom.h **** proper protection (e.g. by disabling interrupts before accessing
119:C:/WinAVR/avr/include/avr/eeprom.h **** them).
120:C:/WinAVR/avr/include/avr/eeprom.h ****
121:C:/WinAVR/avr/include/avr/eeprom.h **** */
122:C:/WinAVR/avr/include/avr/eeprom.h ****
123:C:/WinAVR/avr/include/avr/eeprom.h ****
124:C:/WinAVR/avr/include/avr/eeprom.h **** /* forward declarations of the inline functions so that doxygen does
125:C:/WinAVR/avr/include/avr/eeprom.h **** not get confused by the attribute expression. */
126:C:/WinAVR/avr/include/avr/eeprom.h ****
127:C:/WinAVR/avr/include/avr/eeprom.h **** static inline uint8_t __attribute__ ((always_inline))
128:C:/WinAVR/avr/include/avr/eeprom.h **** eeprom_read_byte (const uint8_t *addr);
129:C:/WinAVR/avr/include/avr/eeprom.h ****
130:C:/WinAVR/avr/include/avr/eeprom.h **** static inline uint16_t __attribute__ ((always_inline))
131:C:/WinAVR/avr/include/avr/eeprom.h **** eeprom_read_word (const uint16_t *addr);
132:C:/WinAVR/avr/include/avr/eeprom.h ****
133:C:/WinAVR/avr/include/avr/eeprom.h **** static inline void __attribute__ ((always_inline))
134:C:/WinAVR/avr/include/avr/eeprom.h **** eeprom_read_block (void *pointer_ram,
135:C:/WinAVR/avr/include/avr/eeprom.h **** const void *pointer_eeprom,
136:C:/WinAVR/avr/include/avr/eeprom.h **** size_t size);
137:C:/WinAVR/avr/include/avr/eeprom.h ****
138:C:/WinAVR/avr/include/avr/eeprom.h **** static inline void __attribute__ ((always_inline))
139:C:/WinAVR/avr/include/avr/eeprom.h **** eeprom_write_byte (uint8_t *addr,uint8_t value);
140:C:/WinAVR/avr/include/avr/eeprom.h ****
141:C:/WinAVR/avr/include/avr/eeprom.h **** static inline void __attribute__ ((always_inline))
142:C:/WinAVR/avr/include/avr/eeprom.h **** eeprom_write_word (uint16_t *addr,uint16_t value);
143:C:/WinAVR/avr/include/avr/eeprom.h ****
144:C:/WinAVR/avr/include/avr/eeprom.h **** static inline void __attribute__ ((always_inline))
145:C:/WinAVR/avr/include/avr/eeprom.h **** eeprom_write_block (const void *pointer_ram,
146:C:/WinAVR/avr/include/avr/eeprom.h **** void *pointer_eeprom,
147:C:/WinAVR/avr/include/avr/eeprom.h **** size_t size);
148:C:/WinAVR/avr/include/avr/eeprom.h ****
149:C:/WinAVR/avr/include/avr/eeprom.h **** /** \name avr-libc declarations */
150:C:/WinAVR/avr/include/avr/eeprom.h ****
151:C:/WinAVR/avr/include/avr/eeprom.h **** /*@{*/
152:C:/WinAVR/avr/include/avr/eeprom.h ****
153:C:/WinAVR/avr/include/avr/eeprom.h **** /** \def EEMEM
154:C:/WinAVR/avr/include/avr/eeprom.h **** \ingroup avr_eeprom
155:C:/WinAVR/avr/include/avr/eeprom.h **** Attribute expression causing a variable to be allocated within the .eeprom
156:C:/WinAVR/avr/include/avr/eeprom.h **** section. */
157:C:/WinAVR/avr/include/avr/eeprom.h **** #define EEMEM __attribute__((section(".eeprom")))
158:C:/WinAVR/avr/include/avr/eeprom.h ****
159:C:/WinAVR/avr/include/avr/eeprom.h **** /** \def eeprom_is_ready
160:C:/WinAVR/avr/include/avr/eeprom.h **** \ingroup avr_eeprom
161:C:/WinAVR/avr/include/avr/eeprom.h **** \returns 1 if EEPROM is ready for a new read/write operation, 0 if not. */
162:C:/WinAVR/avr/include/avr/eeprom.h ****
163:C:/WinAVR/avr/include/avr/eeprom.h **** #if defined(__DOXYGEN__)
164:C:/WinAVR/avr/include/avr/eeprom.h **** # define eeprom_is_ready()
165:C:/WinAVR/avr/include/avr/eeprom.h **** #elif defined(EEWE)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -