📄 eeprom.lst
字号:
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)
166:C:/WinAVR/avr/include/avr/eeprom.h **** # define eeprom_is_ready() bit_is_clear(EECR, EEWE)
167:C:/WinAVR/avr/include/avr/eeprom.h **** #elif defined(EEPE)
168:C:/WinAVR/avr/include/avr/eeprom.h **** # define eeprom_is_ready() bit_is_clear(EECR, EEPE)
169:C:/WinAVR/avr/include/avr/eeprom.h **** #elif defined(DEECR) && defined(EEL)
170:C:/WinAVR/avr/include/avr/eeprom.h **** # define eeprom_is_ready() bit_is_clear(DEECR, EEL)
171:C:/WinAVR/avr/include/avr/eeprom.h **** #else
172:C:/WinAVR/avr/include/avr/eeprom.h **** # error "No write enable bit known for this device's EEPROM."
173:C:/WinAVR/avr/include/avr/eeprom.h **** #endif
174:C:/WinAVR/avr/include/avr/eeprom.h ****
175:C:/WinAVR/avr/include/avr/eeprom.h **** /** \def eeprom_busy_wait
176:C:/WinAVR/avr/include/avr/eeprom.h **** \ingroup avr_eeprom
177:C:/WinAVR/avr/include/avr/eeprom.h ****
178:C:/WinAVR/avr/include/avr/eeprom.h **** Loops until the eeprom is no longer busy.
179:C:/WinAVR/avr/include/avr/eeprom.h ****
180:C:/WinAVR/avr/include/avr/eeprom.h **** \returns Nothing. */
181:C:/WinAVR/avr/include/avr/eeprom.h ****
182:C:/WinAVR/avr/include/avr/eeprom.h **** #define eeprom_busy_wait() do {} while (!eeprom_is_ready())
183:C:/WinAVR/avr/include/avr/eeprom.h ****
184:C:/WinAVR/avr/include/avr/eeprom.h ****
185:C:/WinAVR/avr/include/avr/eeprom.h **** /** \ingroup avr_eeprom
186:C:/WinAVR/avr/include/avr/eeprom.h **** Read one byte from EEPROM address \c addr. */
187:C:/WinAVR/avr/include/avr/eeprom.h ****
188:C:/WinAVR/avr/include/avr/eeprom.h **** uint8_t
189:C:/WinAVR/avr/include/avr/eeprom.h **** eeprom_read_byte (const uint8_t *addr)
190:C:/WinAVR/avr/include/avr/eeprom.h **** {
116 .LM4:
117 001c 82E4 ldi r24,lo8(578)
118 001e 92E0 ldi r25,hi8(578)
119 0020 9B83 std Y+3,r25
120 0022 8A83 std Y+2,r24
121 .LBB3:
191:C:/WinAVR/avr/include/avr/eeprom.h **** uint8_t result;
192:C:/WinAVR/avr/include/avr/eeprom.h **** asm volatile
123 .LM5:
124 0024 AA81 ldd r26,Y+2
125 0026 BB81 ldd r27,Y+3
126 /* #APP */
127 0028 0E94 0000 call __eeprom_read_byte_1C1D1E
128 002c 802D mov r24,__tmp_reg__
129 /* #NOAPP */
130 002e BB83 std Y+3,r27
131 0030 AA83 std Y+2,r26
132 0032 8E83 std Y+6,r24
133 0034 8E81 ldd r24,Y+6
134 0036 9927 clr r25
135 0038 9D83 std Y+5,r25
136 003a 8C83 std Y+4,r24
137 .LBE3:
138 .LBE2:
140 .LM6:
141 003c 8C81 ldd r24,Y+4
142 003e 8983 std Y+1,r24
143 .L6:
145 .Ltext2:
39:eeprom.c **** aa=eeprom_read_byte(578); //读取EEPROM 0地址的内容到aa中
40:eeprom.c **** eeprom_busy_wait(); //等待EEPROM读写就绪
147 .LM7:
148 0040 8091 3C00 lds r24,60
149 0044 9927 clr r25
150 0046 8270 andi r24,lo8(2)
151 0048 9070 andi r25,hi8(2)
152 004a 0097 sbiw r24,0
153 004c 09F0 breq .L7
154 004e F8CF rjmp .L6
155 .L7:
41:eeprom.c **** //PORTB=~aa;
42:eeprom.c **** aa++;
157 .LM8:
158 0050 8981 ldd r24,Y+1
159 0052 8F5F subi r24,lo8(-(1))
160 0054 8983 std Y+1,r24
161 .L9:
43:eeprom.c **** eeprom_busy_wait(); //等待EEPROM读写就绪
163 .LM9:
164 0056 8091 3C00 lds r24,60
165 005a 9927 clr r25
166 005c 8270 andi r24,lo8(2)
167 005e 9070 andi r25,hi8(2)
168 0060 0097 sbiw r24,0
169 0062 09F0 breq .L10
170 0064 F8CF rjmp .L9
171 .L10:
172 .LBB4:
174 .Ltext3:
193:C:/WinAVR/avr/include/avr/eeprom.h **** ( XCALL " __eeprom_read_byte_" _REG_LOCATION_SUFFIX CR_TAB
194:C:/WinAVR/avr/include/avr/eeprom.h **** "mov %1,__tmp_reg__"
195:C:/WinAVR/avr/include/avr/eeprom.h **** : "+x" (addr),
196:C:/WinAVR/avr/include/avr/eeprom.h **** "=r" (result)
197:C:/WinAVR/avr/include/avr/eeprom.h **** : );
198:C:/WinAVR/avr/include/avr/eeprom.h **** return result;
199:C:/WinAVR/avr/include/avr/eeprom.h **** }
200:C:/WinAVR/avr/include/avr/eeprom.h ****
201:C:/WinAVR/avr/include/avr/eeprom.h **** /** \ingroup avr_eeprom
202:C:/WinAVR/avr/include/avr/eeprom.h **** Read one 16-bit word (little endian) from EEPROM address \c addr. */
203:C:/WinAVR/avr/include/avr/eeprom.h **** uint16_t
204:C:/WinAVR/avr/include/avr/eeprom.h **** eeprom_read_word (const uint16_t *addr)
205:C:/WinAVR/avr/include/avr/eeprom.h **** {
206:C:/WinAVR/avr/include/avr/eeprom.h **** uint16_t result;
207:C:/WinAVR/avr/include/avr/eeprom.h ****
208:C:/WinAVR/avr/include/avr/eeprom.h **** asm (
209:C:/WinAVR/avr/include/avr/eeprom.h **** XCALL " __eeprom_read_word_" _REG_LOCATION_SUFFIX CR_TAB
210:C:/WinAVR/avr/include/avr/eeprom.h **** : "+x" (addr),
211:C:/WinAVR/avr/include/avr/eeprom.h **** "=z" (result)
212:C:/WinAVR/avr/include/avr/eeprom.h **** : );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -