AVR Libc Home Page AVRs AVR Libc Development Pages
Main Page User Manual Library Reference FAQ Alphabetical Index Example Projects

eeprom.h
1 /* Copyright (c) 2002, 2003, 2004, 2007 Marek Michalkiewicz
2  Copyright (c) 2005, 2006 Bjoern Haase
3  Copyright (c) 2008 Atmel Corporation
4  Copyright (c) 2008 Wouter van Gulik
5  Copyright (c) 2009 Dmitry Xmelkov
6  All rights reserved.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  * Redistributions of source code must retain the above copyright
12  notice, this list of conditions and the following disclaimer.
13  * Redistributions in binary form must reproduce the above copyright
14  notice, this list of conditions and the following disclaimer in
15  the documentation and/or other materials provided with the
16  distribution.
17  * Neither the name of the copyright holders nor the names of
18  contributors may be used to endorse or promote products derived
19  from this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  POSSIBILITY OF SUCH DAMAGE. */
32 
33 /* $Id: eeprom.h 2416 2014-03-31 16:29:39Z pitchumani $ */
34 
35 #ifndef _AVR_EEPROM_H_
36 #define _AVR_EEPROM_H_ 1
37 
38 #include <avr/io.h>
39 
40 #if !E2END && !defined(__DOXYGEN__) && !defined(__COMPILING_AVR_LIBC__)
41 # warning "Device does not have EEPROM available."
42 #else
43 
44 #ifndef __DOXYGEN__
45 
46 #if defined (__AVR_AT94K__)
47 # define _EEPROM_SUFFIX _at94k
48 #elif defined (__AVR_AT43USB320__)
49 # define _EEPROM_SUFFIX _43u320
50 #elif defined (__AVR_AT43USB355__)
51 # define _EEPROM_SUFFIX _43u355
52 #elif defined (__AVR_AT76C711__)
53 # define _EEPROM_SUFFIX _76c711
54 #elif defined (__AVR_AT86RF401__)
55 # define _EEPROM_SUFFIX _86r401
56 #elif defined (__AVR_AT90PWM1__)
57 # define _EEPROM_SUFFIX _90pwm1
58 #elif defined (__AVR_AT90PWM2__)
59 # define _EEPROM_SUFFIX _90pwm2
60 #elif defined (__AVR_AT90PWM2B__)
61 # define _EEPROM_SUFFIX _90pwm2b
62 #elif defined (__AVR_AT90PWM3__)
63 # define _EEPROM_SUFFIX _90pwm3
64 #elif defined (__AVR_AT90PWM3B__)
65 # define _EEPROM_SUFFIX _90pwm3b
66 #elif defined (__AVR_AT90PWM216__)
67 # define _EEPROM_SUFFIX _90pwm216
68 #elif defined (__AVR_AT90PWM316__)
69 # define _EEPROM_SUFFIX _90pwm316
70 #elif defined (__AVR_AT90PWM161__)
71 # define _EEPROM_SUFFIX _90pwm161
72 #elif defined (__AVR_AT90PWM81__)
73 # define _EEPROM_SUFFIX _90pwm81
74 #elif defined (__AVR_ATmega16M1__)
75 # define _EEPROM_SUFFIX _m16m1
76 #elif defined (__AVR_ATmega8U2__)
77 # define _EEPROM_SUFFIX _m8u2
78 #elif defined (__AVR_ATmega16U2__)
79 # define _EEPROM_SUFFIX _m16u2
80 #elif defined (__AVR_ATmega16U4__)
81 # define _EEPROM_SUFFIX _m16u4
82 #elif defined (__AVR_ATmega32C1__)
83 # define _EEPROM_SUFFIX _m32c1
84 #elif defined (__AVR_ATmega32M1__)
85 # define _EEPROM_SUFFIX _m32m1
86 #elif defined (__AVR_ATmega32U2__)
87 # define _EEPROM_SUFFIX _m32u2
88 #elif defined (__AVR_ATmega32U4__)
89 # define _EEPROM_SUFFIX _m32u4
90 #elif defined (__AVR_ATmega32U6__)
91 # define _EEPROM_SUFFIX _m32u6
92 #elif defined (__AVR_ATmega64C1__)
93 # define _EEPROM_SUFFIX _m64c1
94 #elif defined (__AVR_ATmega64M1__)
95 # define _EEPROM_SUFFIX _m64m1
96 #elif defined (__AVR_ATmega128__)
97 # define _EEPROM_SUFFIX _m128
98 #elif defined (__AVR_ATmega128A__)
99 # define _EEPROM_SUFFIX _m128a
100 #elif defined (__AVR_ATmega1280__)
101 # define _EEPROM_SUFFIX _m1280
102 #elif defined (__AVR_ATmega1281__)
103 # define _EEPROM_SUFFIX _m1281
104 #elif defined (__AVR_ATmega1284__)
105 # define _EEPROM_SUFFIX _m1284
106 #elif defined (__AVR_ATmega1284P__)
107 # define _EEPROM_SUFFIX _m1284p
108 #elif defined (__AVR_ATmega128RFA1__)
109 # define _EEPROM_SUFFIX _m128rfa1
110 #elif defined (__AVR_ATmega1284RFR2__)
111 # define _EEPROM_SUFFIX _m1284rfr2
112 #elif defined (__AVR_ATmega128RFR2__)
113 # define _EEPROM_SUFFIX _m128rfr2
114 #elif defined (__AVR_ATmega2564RFR2__)
115 # define _EEPROM_SUFFIX _m2564rfr2
116 #elif defined (__AVR_ATmega256RFR2__)
117 # define _EEPROM_SUFFIX _m256rfr2
118 #elif defined (__AVR_ATmega2560__)
119 # define _EEPROM_SUFFIX _m2560
120 #elif defined (__AVR_ATmega2561__)
121 # define _EEPROM_SUFFIX _m2561
122 #elif defined (__AVR_AT90CAN32__)
123 # define _EEPROM_SUFFIX _can32
124 #elif defined (__AVR_AT90CAN64__)
125 # define _EEPROM_SUFFIX _can64
126 #elif defined (__AVR_AT90CAN128__)
127 # define _EEPROM_SUFFIX _can128
128 #elif defined (__AVR_AT90USB82__)
129 # define _EEPROM_SUFFIX _usb82
130 #elif defined (__AVR_AT90USB162__)
131 # define _EEPROM_SUFFIX _usb162
132 #elif defined (__AVR_AT90USB646__)
133 # define _EEPROM_SUFFIX _usb646
134 #elif defined (__AVR_AT90USB647__)
135 # define _EEPROM_SUFFIX _usb647
136 #elif defined (__AVR_AT90USB1286__)
137 # define _EEPROM_SUFFIX _usb1286
138 #elif defined (__AVR_AT90USB1287__)
139 # define _EEPROM_SUFFIX _usb1287
140 #elif defined (__AVR_ATmega644RFR2__)
141 # define _EEPROM_SUFFIX _m644rfr2
142 #elif defined (__AVR_ATmega64RFR2__)
143 # define _EEPROM_SUFFIX _m64rfr2
144 #elif defined (__AVR_ATmega64__)
145 # define _EEPROM_SUFFIX _m64
146 #elif defined (__AVR_ATmega64A__)
147 # define _EEPROM_SUFFIX _m64a
148 #elif defined (__AVR_ATmega640__)
149 # define _EEPROM_SUFFIX _m640
150 #elif defined (__AVR_ATmega644__)
151 # define _EEPROM_SUFFIX _m644
152 #elif defined (__AVR_ATmega644A__)
153 # define _EEPROM_SUFFIX _m644a
154 #elif defined (__AVR_ATmega644P__)
155 # define _EEPROM_SUFFIX _m644p
156 #elif defined (__AVR_ATmega644PA__)
157 # define _EEPROM_SUFFIX _m644pa
158 #elif defined (__AVR_ATmega645__)
159 # define _EEPROM_SUFFIX _m645
160 #elif defined (__AVR_ATmega645A__)
161 # define _EEPROM_SUFFIX _m645a
162 #elif defined (__AVR_ATmega645P__)
163 # define _EEPROM_SUFFIX _m645p
164 #elif defined (__AVR_ATmega6450__)
165 # define _EEPROM_SUFFIX _m6450
166 #elif defined (__AVR_ATmega6450A__)
167 # define _EEPROM_SUFFIX _m6450a
168 #elif defined (__AVR_ATmega6450P__)
169 # define _EEPROM_SUFFIX _m6450p
170 #elif defined (__AVR_ATmega649__)
171 # define _EEPROM_SUFFIX _m649
172 #elif defined (__AVR_ATmega649A__)
173 # define _EEPROM_SUFFIX _m649a
174 #elif defined (__AVR_ATmega649P__)
175 # define _EEPROM_SUFFIX _m649p
176 #elif defined (__AVR_ATmega6490__)
177 # define _EEPROM_SUFFIX _m6490
178 #elif defined (__AVR_ATmega6490A__)
179 # define _EEPROM_SUFFIX _m6490a
180 #elif defined (__AVR_ATmega6490P__)
181 # define _EEPROM_SUFFIX _m6490p
182 #elif defined (__AVR_ATmega103__)
183 # define _EEPROM_SUFFIX _m103
184 #elif defined (__AVR_ATmega32__)
185 # define _EEPROM_SUFFIX _m32
186 #elif defined (__AVR_ATmega32A__)
187 # define _EEPROM_SUFFIX _m32a
188 #elif defined (__AVR_ATmega323__)
189 # define _EEPROM_SUFFIX _m323
190 #elif defined (__AVR_ATmega324A__)
191 # define _EEPROM_SUFFIX _m324a
192 #elif defined (__AVR_ATmega324P__)
193 # define _EEPROM_SUFFIX _m324p
194 #elif defined (__AVR_ATmega324PA__)
195 # define _EEPROM_SUFFIX _m324pa
196 #elif defined (__AVR_ATmega325__)
197 # define _EEPROM_SUFFIX _m325
198 #elif defined (__AVR_ATmega325A__)
199 # define _EEPROM_SUFFIX _m325a
200 #elif defined (__AVR_ATmega325P__)
201 # define _EEPROM_SUFFIX _m325p
202 #elif defined (__AVR_ATmega325PA__)
203 # define _EEPROM_SUFFIX _m325pa
204 #elif defined (__AVR_ATmega3250__)
205 # define _EEPROM_SUFFIX _m3250
206 #elif defined (__AVR_ATmega3250A__)
207 # define _EEPROM_SUFFIX _m3250a
208 #elif defined (__AVR_ATmega3250P__)
209 # define _EEPROM_SUFFIX _m3250p
210 #elif defined (__AVR_ATmega3250PA__)
211 # define _EEPROM_SUFFIX _m3250pa
212 #elif defined (__AVR_ATmega328__)
213 # define _EEPROM_SUFFIX _m328
214 #elif defined (__AVR_ATmega328P__)
215 # define _EEPROM_SUFFIX _m328p
216 #elif defined (__AVR_ATmega329__)
217 # define _EEPROM_SUFFIX _m329
218 #elif defined (__AVR_ATmega329A__)
219 # define _EEPROM_SUFFIX _m329a
220 #elif defined (__AVR_ATmega329P__)
221 # define _EEPROM_SUFFIX _m329p
222 #elif defined (__AVR_ATmega329PA__)
223 # define _EEPROM_SUFFIX _m329pa
224 #elif defined (__AVR_ATmega3290__)
225 # define _EEPROM_SUFFIX _m3290
226 #elif defined (__AVR_ATmega3290A__)
227 # define _EEPROM_SUFFIX _m3290a
228 #elif defined (__AVR_ATmega3290P__)
229 # define _EEPROM_SUFFIX _m3290p
230 #elif defined (__AVR_ATmega3290PA__)
231 # define _EEPROM_SUFFIX _m3290pa
232 #elif defined (__AVR_ATmega32HVB__)
233 # define _EEPROM_SUFFIX _m32hvb
234 #elif defined (__AVR_ATmega32HVBREVB__)
235 # define _EEPROM_SUFFIX _m32hvbrevb
236 #elif defined (__AVR_ATmega64HVE__)
237 # define _EEPROM_SUFFIX _m64hve
238 #elif defined (__AVR_ATmega406__)
239 # define _EEPROM_SUFFIX _m406
240 #elif defined (__AVR_ATmega16__)
241 # define _EEPROM_SUFFIX _m16
242 #elif defined (__AVR_ATmega16A__)
243 # define _EEPROM_SUFFIX _m16a
244 #elif defined (__AVR_ATmega161__)
245 # define _EEPROM_SUFFIX _m161
246 #elif defined (__AVR_ATmega162__)
247 # define _EEPROM_SUFFIX _m162
248 #elif defined (__AVR_ATmega163__)
249 # define _EEPROM_SUFFIX _m163
250 #elif defined (__AVR_ATmega164__)
251 # define _EEPROM_SUFFIX _m164
252 #elif defined (__AVR_ATmega164P__)
253 # define _EEPROM_SUFFIX _m164p
254 #elif defined (__AVR_ATmega164PA__)
255 # define _EEPROM_SUFFIX _m164pa
256 #elif defined (__AVR_ATmega165__)
257 # define _EEPROM_SUFFIX _m165
258 #elif defined (__AVR_ATmega165A__)
259 # define _EEPROM_SUFFIX _m165a
260 #elif defined (__AVR_ATmega165P__)
261 # define _EEPROM_SUFFIX _m165p
262 #elif defined (__AVR_ATmega165PA__)
263 # define _EEPROM_SUFFIX _m165pa
264 #elif defined (__AVR_ATmega168__)
265 # define _EEPROM_SUFFIX _m168
266 #elif defined (__AVR_ATmega168A__)
267 # define _EEPROM_SUFFIX _m168a
268 #elif defined (__AVR_ATmega168P__)
269 # define _EEPROM_SUFFIX _m168p
270 #elif defined (__AVR_ATmega168PA__)
271 # define _EEPROM_SUFFIX _m168pa
272 #elif defined (__AVR_ATmega169__)
273 # define _EEPROM_SUFFIX _m169
274 #elif defined (__AVR_ATmega169A__)
275 # define _EEPROM_SUFFIX _m169a
276 #elif defined (__AVR_ATmega169P__)
277 # define _EEPROM_SUFFIX _m169p
278 #elif defined (__AVR_ATmega169PA__)
279 # define _EEPROM_SUFFIX _m169pa
280 #elif defined (__AVR_ATmega8HVA__)
281 # define _EEPROM_SUFFIX _m8hva
282 #elif defined (__AVR_ATmega16HVA__)
283 # define _EEPROM_SUFFIX _m16hva
284 #elif defined (__AVR_ATmega16HVA2__)
285 # define _EEPROM_SUFFIX _m16hva2
286 #elif defined (__AVR_ATmega16HVB__)
287 # define _EEPROM_SUFFIX _m16hvb
288 #elif defined (__AVR_ATmega16HVBREVB__)
289 # define _EEPROM_SUFFIX _m16hvbrevb
290 #elif defined (__AVR_ATmega8__)
291 # define _EEPROM_SUFFIX _m8
292 #elif defined (__AVR_ATmega8A__)
293 # define _EEPROM_SUFFIX _m8a
294 #elif defined (__AVR_ATmega48__)
295 # define _EEPROM_SUFFIX _m48
296 #elif defined (__AVR_ATmega48A__)
297 # define _EEPROM_SUFFIX _m48a
298 #elif defined (__AVR_ATmega48PA__)
299 # define _EEPROM_SUFFIX _m48pa
300 #elif defined (__AVR_ATmega48P__)
301 # define _EEPROM_SUFFIX _m48p
302 #elif defined (__AVR_ATmega88__)
303 # define _EEPROM_SUFFIX _m88
304 #elif defined (__AVR_ATmega88A__)
305 # define _EEPROM_SUFFIX _m88a
306 #elif defined (__AVR_ATmega88P__)
307 # define _EEPROM_SUFFIX _m88p
308 #elif defined (__AVR_ATmega88PA__)
309 # define _EEPROM_SUFFIX _m88pa
310 #elif defined (__AVR_ATmega8515__)
311 # define _EEPROM_SUFFIX _m8515
312 #elif defined (__AVR_ATmega8535__)
313 # define _EEPROM_SUFFIX _m8535
314 #elif defined (__AVR_AT90S8535__)
315 # define _EEPROM_SUFFIX _8535
316 #elif defined (__AVR_AT90C8534__)
317 # define _EEPROM_SUFFIX _8534
318 #elif defined (__AVR_AT90S8515__)
319 # define _EEPROM_SUFFIX _8515
320 #elif defined (__AVR_AT90S4434__)
321 # define _EEPROM_SUFFIX _4434
322 #elif defined (__AVR_AT90S4433__)
323 # define _EEPROM_SUFFIX _4433
324 #elif defined (__AVR_AT90S4414__)
325 # define _EEPROM_SUFFIX _4414
326 #elif defined (__AVR_ATtiny22__)
327 # define _EEPROM_SUFFIX _tn22
328 #elif defined (__AVR_ATtiny26__)
329 # define _EEPROM_SUFFIX _tn26
330 #elif defined (__AVR_AT90S2343__)
331 # define _EEPROM_SUFFIX _2343
332 #elif defined (__AVR_AT90S2333__)
333 # define _EEPROM_SUFFIX _2333
334 #elif defined (__AVR_AT90S2323__)
335 # define _EEPROM_SUFFIX _2323
336 #elif defined (__AVR_AT90S2313__)
337 # define _EEPROM_SUFFIX _2313
338 #elif defined (__AVR_ATtiny2313__)
339 # define _EEPROM_SUFFIX _tn2313
340 #elif defined (__AVR_ATtiny2313A__)
341 # define _EEPROM_SUFFIX _tn2313a
342 #elif defined (__AVR_ATtiny4313__)
343 # define _EEPROM_SUFFIX _tn4313
344 #elif defined (__AVR_ATtiny13__)
345 # define _EEPROM_SUFFIX _tn13
346 #elif defined (__AVR_ATtiny13A__)
347 # define _EEPROM_SUFFIX _tn13a
348 #elif defined (__AVR_ATtiny25__)
349 # define _EEPROM_SUFFIX _tn25
350 #elif defined (__AVR_ATtiny45__)
351 # define _EEPROM_SUFFIX _tn45
352 #elif defined (__AVR_ATtiny85__)
353 # define _EEPROM_SUFFIX _tn85
354 #elif defined (__AVR_ATtiny24__)
355 # define _EEPROM_SUFFIX _tn24
356 #elif defined (__AVR_ATtiny24A__)
357 # define _EEPROM_SUFFIX _tn24a
358 #elif defined (__AVR_ATtiny44__)
359 # define _EEPROM_SUFFIX _tn44
360 #elif defined (__AVR_ATtiny44A__)
361 # define _EEPROM_SUFFIX _tn44a
362 #elif defined (__AVR_ATtiny84__)
363 # define _EEPROM_SUFFIX _tn84
364 #elif defined (__AVR_ATtiny84A__)
365 # define _EEPROM_SUFFIX _tn84a
366 #elif defined (__AVR_ATtiny261__)
367 # define _EEPROM_SUFFIX _tn261
368 #elif defined (__AVR_ATtiny261A__)
369 # define _EEPROM_SUFFIX _tn261a
370 #elif defined (__AVR_ATtiny461__)
371 # define _EEPROM_SUFFIX _tn461
372 #elif defined (__AVR_ATtiny461A__)
373 # define _EEPROM_SUFFIX _tn461a
374 #elif defined (__AVR_ATtiny861__)
375 # define _EEPROM_SUFFIX _tn861
376 #elif defined (__AVR_ATtiny861A__)
377 # define _EEPROM_SUFFIX _tn861a
378 #elif defined (__AVR_ATtiny43U__)
379 # define _EEPROM_SUFFIX _tn43u
380 #elif defined (__AVR_ATtiny48__)
381 # define _EEPROM_SUFFIX _tn48
382 #elif defined (__AVR_ATtiny828__)
383 # define _EEPROM_SUFFIX _tn828
384 #elif defined (__AVR_ATtiny88__)
385 # define _EEPROM_SUFFIX _tn88
386 #elif defined (__AVR_ATtiny87__)
387 # define _EEPROM_SUFFIX _tn87
388 #elif defined (__AVR_ATtiny167__)
389 # define _EEPROM_SUFFIX _tn167
390 #elif defined (__AVR_ATtiny1634__)
391 # define _EEPROM_SUFFIX _tn1634
392 #elif defined (__AVR_AT90SCR100__)
393 # define _EEPROM_SUFFIX _90scr100
394 #elif defined (__AVR_ATxmega16A4__)
395 # define _EEPROM_SUFFIX _x16a4
396 #elif defined (__AVR_ATxmega16A4U__)
397 # define _EEPROM_SUFFIX _x16a4u
398 #elif defined (__AVR_ATxmega16C4__)
399 # define _EEPROM_SUFFIX _x16c4
400 #elif defined (__AVR_ATxmega16D4__)
401 # define _EEPROM_SUFFIX _x16d4
402 #elif defined (__AVR_ATxmega32A4__)
403 # define _EEPROM_SUFFIX _x32a4
404 #elif defined (__AVR_ATxmega32A4U__)
405 # define _EEPROM_SUFFIX _x32a4u
406 #elif defined (__AVR_ATxmega32C4__)
407 # define _EEPROM_SUFFIX _x32c4
408 #elif defined (__AVR_ATxmega32D4__)
409 # define _EEPROM_SUFFIX _x32d4
410 #elif defined (__AVR_ATxmega64A1__)
411 # define _EEPROM_SUFFIX _x64a1
412 #elif defined (__AVR_ATxmega64A1U__)
413 # define _EEPROM_SUFFIX _x64a1u
414 #elif defined (__AVR_ATxmega64A3__)
415 # define _EEPROM_SUFFIX _x64a3
416 #elif defined (__AVR_ATxmega64A3U__)
417 # define _EEPROM_SUFFIX _x64a3u
418 #elif defined (__AVR_ATxmega64A4U__)
419 # define _EEPROM_SUFFIX _x64a4u
420 #elif defined (__AVR_ATxmega64B1__)
421 # define _EEPROM_SUFFIX _x64b1
422 #elif defined (__AVR_ATxmega64B3__)
423 # define _EEPROM_SUFFIX _x64b3
424 #elif defined (__AVR_ATxmega64C3__)
425 # define _EEPROM_SUFFIX _x64c3
426 #elif defined (__AVR_ATxmega64D3__)
427 # define _EEPROM_SUFFIX _x64d3
428 #elif defined (__AVR_ATxmega64D4__)
429 # define _EEPROM_SUFFIX _x64d4
430 #elif defined (__AVR_ATxmega128A1__)
431 # define _EEPROM_SUFFIX _x128a1
432 #elif defined (__AVR_ATxmega128A1U__)
433 # define _EEPROM_SUFFIX _x128a1u
434 #elif defined (__AVR_ATxmega128A4U__)
435 # define _EEPROM_SUFFIX _x128a4u
436 #elif defined (__AVR_ATxmega128A3__)
437 # define _EEPROM_SUFFIX _x128a3
438 #elif defined (__AVR_ATxmega128A3U__)
439 # define _EEPROM_SUFFIX _x128a3u
440 #elif defined (__AVR_ATxmega128B1__)
441 # define _EEPROM_SUFFIX _x128b1
442 #elif defined (__AVR_ATxmega128B3__)
443 # define _EEPROM_SUFFIX _x128b3
444 #elif defined (__AVR_ATxmega128C3__)
445 # define _EEPROM_SUFFIX _x128c3
446 #elif defined (__AVR_ATxmega128D3__)
447 # define _EEPROM_SUFFIX _x128d3
448 #elif defined (__AVR_ATxmega128D4__)
449 # define _EEPROM_SUFFIX _x128d4
450 #elif defined (__AVR_ATxmega192A3__)
451 # define _EEPROM_SUFFIX _x192a3
452 #elif defined (__AVR_ATxmega192A3U__)
453 # define _EEPROM_SUFFIX _x192a3u
454 #elif defined (__AVR_ATxmega192C3__)
455 # define _EEPROM_SUFFIX _x192c3
456 #elif defined (__AVR_ATxmega192D3__)
457 # define _EEPROM_SUFFIX _x192d3
458 #elif defined (__AVR_ATxmega256A3__)
459 # define _EEPROM_SUFFIX _x256a3
460 #elif defined (__AVR_ATxmega256A3U__)
461 # define _EEPROM_SUFFIX _x256a3u
462 #elif defined (__AVR_ATxmega256A3B__)
463 # define _EEPROM_SUFFIX _x256a3b
464 #elif defined (__AVR_ATxmega256A3BU__)
465 # define _EEPROM_SUFFIX _x256a3bu
466 #elif defined (__AVR_ATxmega256C3__)
467 # define _EEPROM_SUFFIX _x256c3
468 #elif defined (__AVR_ATxmega256D3__)
469 # define _EEPROM_SUFFIX _x256d3
470 #elif defined (__AVR_ATxmega384C3__)
471 # define _EEPROM_SUFFIX _x384c3
472 #elif defined (__AVR_ATxmega384D3__)
473 # define _EEPROM_SUFFIX _x384d3
474 #elif defined (__AVR_ATA5505__)
475 # define _EEPROM_SUFFIX _a5505
476 #elif defined (__AVR_ATA5272__)
477 # define _EEPROM_SUFFIX _a5272
478 #elif defined (__AVR_ATA6285__)
479 # define _EEPROM_SUFFIX _a6285
480 #elif defined (__AVR_ATA6286__)
481 # define _EEPROM_SUFFIX _a6286
482 #elif defined (__AVR_ATA6289__)
483 # define _EEPROM_SUFFIX _a6289
484 #elif defined (__AVR_ATA5790__)
485 # define _EEPROM_SUFFIX _a5790
486 #elif defined (__AVR_ATA5795__)
487 # define _EEPROM_SUFFIX _a5795
488 /* avr1: the following only supported for assembler programs */
489 #elif defined (__AVR_ATtiny28__)
490 # define _EEPROM_SUFFIX _tn28
491 #elif defined (__AVR_AT90S1200__)
492 # define _EEPROM_SUFFIX _1200
493 #elif defined (__AVR_ATtiny15__)
494 # define _EEPROM_SUFFIX _tn15
495 #elif defined (__AVR_ATtiny12__)
496 # define _EEPROM_SUFFIX _tn12
497 #elif defined (__AVR_ATtiny11__)
498 # define _EEPROM_SUFFIX _tn11
499 #else
500 # define _EEPROM_SUFFIX _UNKNOWN
501 #endif
502 
503 #define _EEPROM_CONCAT1(s1, s2) s1 ## s2
504 #define _EEPROM_CONCAT2(s1, s2) _EEPROM_CONCAT1 (s1, s2)
505 
506 #define eeprom_read_byte _EEPROM_CONCAT2 (__eerd_byte, _EEPROM_SUFFIX)
507 #define eeprom_read_word _EEPROM_CONCAT2 (__eerd_word, _EEPROM_SUFFIX)
508 #define eeprom_read_dword _EEPROM_CONCAT2 (__eerd_dword, _EEPROM_SUFFIX)
509 #define eeprom_read_float _EEPROM_CONCAT2 (__eerd_float, _EEPROM_SUFFIX)
510 #define eeprom_read_block _EEPROM_CONCAT2 (__eerd_block, _EEPROM_SUFFIX)
511 
512 #define eeprom_write_byte _EEPROM_CONCAT2 (__eewr_byte, _EEPROM_SUFFIX)
513 #define eeprom_write_word _EEPROM_CONCAT2 (__eewr_word, _EEPROM_SUFFIX)
514 #define eeprom_write_dword _EEPROM_CONCAT2 (__eewr_dword, _EEPROM_SUFFIX)
515 #define eeprom_write_float _EEPROM_CONCAT2 (__eewr_float, _EEPROM_SUFFIX)
516 #define eeprom_write_block _EEPROM_CONCAT2 (__eewr_block, _EEPROM_SUFFIX)
517 
518 #define eeprom_update_byte _EEPROM_CONCAT2 (__eeupd_byte, _EEPROM_SUFFIX)
519 #define eeprom_update_word _EEPROM_CONCAT2 (__eeupd_word, _EEPROM_SUFFIX)
520 #define eeprom_update_dword _EEPROM_CONCAT2 (__eeupd_dword, _EEPROM_SUFFIX)
521 #define eeprom_update_float _EEPROM_CONCAT2 (__eeupd_float, _EEPROM_SUFFIX)
522 #define eeprom_update_block _EEPROM_CONCAT2 (__eeupd_block, _EEPROM_SUFFIX)
523 
524 #endif /* !__DOXYGEN__ */
525 
526 #ifndef __ASSEMBLER__
527 
528 #include <stddef.h> /* size_t */
529 #include <stdint.h>
530 
531 /** \defgroup avr_eeprom <avr/eeprom.h>: EEPROM handling
532  \code #include <avr/eeprom.h> \endcode
533 
534  This header file declares the interface to some simple library
535  routines suitable for handling the data EEPROM contained in the
536  AVR microcontrollers. The implementation uses a simple polled
537  mode interface. Applications that require interrupt-controlled
538  EEPROM access to ensure that no time will be wasted in spinloops
539  will have to deploy their own implementation.
540 
541  \par Notes:
542 
543  - In addition to the write functions there is a set of update ones.
544  This functions read each byte first and skip the burning if the
545  old value is the same with new. The scaning direction is from
546  high address to low, to obtain quick return in common cases.
547 
548  - All of the read/write functions first make sure the EEPROM is
549  ready to be accessed. Since this may cause long delays if a
550  write operation is still pending, time-critical applications
551  should first poll the EEPROM e. g. using eeprom_is_ready() before
552  attempting any actual I/O. But this functions are not wait until
553  SELFPRGEN in SPMCSR becomes zero. Do this manually, if your
554  softwate contains the Flash burning.
555 
556  - As these functions modify IO registers, they are known to be
557  non-reentrant. If any of these functions are used from both,
558  standard and interrupt context, the applications must ensure
559  proper protection (e.g. by disabling interrupts before accessing
560  them).
561 
562  - All write functions force erase_and_write programming mode.
563 
564  - For Xmega the EEPROM start address is 0, like other architectures.
565  The reading functions add the 0x2000 value to use EEPROM mapping into
566  data space.
567  */
568 
569 #ifdef __cplusplus
570 extern "C" {
571 #endif
572 
573 #ifndef __ATTR_PURE__
574 # ifdef __DOXYGEN__
575 # define __ATTR_PURE__
576 # else
577 # define __ATTR_PURE__ __attribute__((__pure__))
578 # endif
579 #endif
580 
581 /** \def EEMEM
582  \ingroup avr_eeprom
583  Attribute expression causing a variable to be allocated within the
584  .eeprom section. */
585 #define EEMEM __attribute__((section(".eeprom")))
586 
587 /** \def eeprom_is_ready
588  \ingroup avr_eeprom
589  \returns 1 if EEPROM is ready for a new read/write operation, 0 if not.
590  */
591 #if defined (__DOXYGEN__)
592 # define eeprom_is_ready()
593 #elif defined (__AVR_XMEGA__) && __AVR_XMEGA__
594 # define eeprom_is_ready() bit_is_clear (NVM_STATUS, NVM_NVMBUSY_bp)
595 #elif defined (DEECR)
596 # define eeprom_is_ready() bit_is_clear (DEECR, BSY)
597 #elif defined (EEPE)
598 # define eeprom_is_ready() bit_is_clear (EECR, EEPE)
599 #else
600 # define eeprom_is_ready() bit_is_clear (EECR, EEWE)
601 #endif
602 
603 
604 /** \def eeprom_busy_wait
605  \ingroup avr_eeprom
606  Loops until the eeprom is no longer busy.
607  \returns Nothing.
608  */
609 #define eeprom_busy_wait() do {} while (!eeprom_is_ready())
610 
611 
612 /** \ingroup avr_eeprom
613  Read one byte from EEPROM address \a __p.
614  */
615 uint8_t eeprom_read_byte (const uint8_t *__p) __ATTR_PURE__;
616 
617 /** \ingroup avr_eeprom
618  Read one 16-bit word (little endian) from EEPROM address \a __p.
619  */
620 uint16_t eeprom_read_word (const uint16_t *__p) __ATTR_PURE__;
621 
622 /** \ingroup avr_eeprom
623  Read one 32-bit double word (little endian) from EEPROM address \a __p.
624  */
625 uint32_t eeprom_read_dword (const uint32_t *__p) __ATTR_PURE__;
626 
627 /** \ingroup avr_eeprom
628  Read one float value (little endian) from EEPROM address \a __p.
629  */
630 float eeprom_read_float (const float *__p) __ATTR_PURE__;
631 
632 /** \ingroup avr_eeprom
633  Read a block of \a __n bytes from EEPROM address \a __src to SRAM
634  \a __dst.
635  */
636 void eeprom_read_block (void *__dst, const void *__src, size_t __n);
637 
638 
639 /** \ingroup avr_eeprom
640  Write a byte \a __value to EEPROM address \a __p.
641  */
642 void eeprom_write_byte (uint8_t *__p, uint8_t __value);
643 
644 /** \ingroup avr_eeprom
645  Write a word \a __value to EEPROM address \a __p.
646  */
647 void eeprom_write_word (uint16_t *__p, uint16_t __value);
648 
649 /** \ingroup avr_eeprom
650  Write a 32-bit double word \a __value to EEPROM address \a __p.
651  */
652 void eeprom_write_dword (uint32_t *__p, uint32_t __value);
653 
654 /** \ingroup avr_eeprom
655  Write a float \a __value to EEPROM address \a __p.
656  */
657 void eeprom_write_float (float *__p, float __value);
658 
659 /** \ingroup avr_eeprom
660  Write a block of \a __n bytes to EEPROM address \a __dst from \a __src.
661  \note The argument order is mismatch with common functions like strcpy().
662  */
663 void eeprom_write_block (const void *__src, void *__dst, size_t __n);
664 
665 
666 /** \ingroup avr_eeprom
667  Update a byte \a __value to EEPROM address \a __p.
668  */
669 void eeprom_update_byte (uint8_t *__p, uint8_t __value);
670 
671 /** \ingroup avr_eeprom
672  Update a word \a __value to EEPROM address \a __p.
673  */
674 void eeprom_update_word (uint16_t *__p, uint16_t __value);
675 
676 /** \ingroup avr_eeprom
677  Update a 32-bit double word \a __value to EEPROM address \a __p.
678  */
679 void eeprom_update_dword (uint32_t *__p, uint32_t __value);
680 
681 /** \ingroup avr_eeprom
682  Update a float \a __value to EEPROM address \a __p.
683  */
684 void eeprom_update_float (float *__p, float __value);
685 
686 /** \ingroup avr_eeprom
687  Update a block of \a __n bytes to EEPROM address \a __dst from \a __src.
688  \note The argument order is mismatch with common functions like strcpy().
689  */
690 void eeprom_update_block (const void *__src, void *__dst, size_t __n);
691 
692 
693 /** \name IAR C compatibility defines */
694 /*@{*/
695 
696 /** \def _EEPUT
697  \ingroup avr_eeprom
698  Write a byte to EEPROM. Compatibility define for IAR C. */
699 #define _EEPUT(addr, val) eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))
700 
701 /** \def __EEPUT
702  \ingroup avr_eeprom
703  Write a byte to EEPROM. Compatibility define for IAR C. */
704 #define __EEPUT(addr, val) eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))
705 
706 /** \def _EEGET
707  \ingroup avr_eeprom
708  Read a byte from EEPROM. Compatibility define for IAR C. */
709 #define _EEGET(var, addr) (var) = eeprom_read_byte ((const uint8_t *)(addr))
710 
711 /** \def __EEGET
712  \ingroup avr_eeprom
713  Read a byte from EEPROM. Compatibility define for IAR C. */
714 #define __EEGET(var, addr) (var) = eeprom_read_byte ((const uint8_t *)(addr))
715 
716 /*@}*/
717 
718 #ifdef __cplusplus
719 }
720 #endif
721 
722 #endif /* !__ASSEMBLER__ */
723 #endif /* E2END || defined(__DOXYGEN__) || defined(__COMPILING_AVR_LIBC__) */
724 #endif /* !_AVR_EEPROM_H_ */
void eeprom_update_block(const void *__src, void *__dst, size_t __n)
void eeprom_write_block(const void *__src, void *__dst, size_t __n)
void eeprom_update_word(uint16_t *__p, uint16_t __value)
void eeprom_write_byte(uint8_t *__p, uint8_t __value)
void eeprom_read_block(void *__dst, const void *__src, size_t __n)
void eeprom_write_dword(uint32_t *__p, uint32_t __value)
float eeprom_read_float(const float *__p) __ATTR_PURE__
void eeprom_update_dword(uint32_t *__p, uint32_t __value)
void eeprom_write_float(float *__p, float __value)
void eeprom_update_byte(uint8_t *__p, uint8_t __value)
unsigned char uint8_t
Definition: stdint.h:80
unsigned long int uint32_t
Definition: stdint.h:100
uint32_t eeprom_read_dword(const uint32_t *__p) __ATTR_PURE__
void eeprom_write_word(uint16_t *__p, uint16_t __value)
void eeprom_update_float(float *__p, float __value)
uint8_t eeprom_read_byte(const uint8_t *__p) __ATTR_PURE__
uint16_t eeprom_read_word(const uint16_t *__p) __ATTR_PURE__
unsigned int uint16_t
Definition: stdint.h:90

Automatically generated by Doxygen 1.8.7 on Tue Aug 12 2014.