eeprom.h Source File

AVR Libc Home Page |  | 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 2211 2011-02-14 14:04:25Z aboyapati $ */
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_ATmega128RFA2__)
111 # define _EEPROM_SUFFIX _m128rfa2
112 #elif defined (__AVR_ATmega128RFR2__)
113 # define _EEPROM_SUFFIX _m128rfr2
114 #elif defined (__AVR_ATmega256RFA2__)
115 # define _EEPROM_SUFFIX _m256rfa2
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_ATmega64RFA2__)
141 # define _EEPROM_SUFFIX _m64rfa2
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_ATmega26HVG__)
291 # define _EEPROM_SUFFIX _m26hvg
292 #elif defined (__AVR_ATmega8__)
293 # define _EEPROM_SUFFIX _m8
294 #elif defined (__AVR_ATmega8A__)
295 # define _EEPROM_SUFFIX _m8a
296 #elif defined (__AVR_ATmega48__)
297 # define _EEPROM_SUFFIX _m48
298 #elif defined (__AVR_ATmega48A__)
299 # define _EEPROM_SUFFIX _m48a
300 #elif defined (__AVR_ATmega48HVF__)
301 # define _EEPROM_SUFFIX _m48hvf
302 #elif defined (__AVR_ATmega48PA__)
303 # define _EEPROM_SUFFIX _m48pa
304 #elif defined (__AVR_ATmega48P__)
305 # define _EEPROM_SUFFIX _m48p
306 #elif defined (__AVR_ATmega88__)
307 # define _EEPROM_SUFFIX _m88
308 #elif defined (__AVR_ATmega88A__)
309 # define _EEPROM_SUFFIX _m88a
310 #elif defined (__AVR_ATmega88P__)
311 # define _EEPROM_SUFFIX _m88p
312 #elif defined (__AVR_ATmega88PA__)
313 # define _EEPROM_SUFFIX _m88pa
314 #elif defined (__AVR_ATmega8515__)
315 # define _EEPROM_SUFFIX _m8515
316 #elif defined (__AVR_ATmega8535__)
317 # define _EEPROM_SUFFIX _m8535
318 #elif defined (__AVR_AT90S8535__)
319 # define _EEPROM_SUFFIX _8535
320 #elif defined (__AVR_AT90C8534__)
321 # define _EEPROM_SUFFIX _8534
322 #elif defined (__AVR_AT90S8515__)
323 # define _EEPROM_SUFFIX _8515
324 #elif defined (__AVR_AT90S4434__)
325 # define _EEPROM_SUFFIX _4434
326 #elif defined (__AVR_AT90S4433__)
327 # define _EEPROM_SUFFIX _4433
328 #elif defined (__AVR_AT90S4414__)
329 # define _EEPROM_SUFFIX _4414
330 #elif defined (__AVR_ATtiny22__)
331 # define _EEPROM_SUFFIX _tn22
332 #elif defined (__AVR_ATtiny26__)
333 # define _EEPROM_SUFFIX _tn26
334 #elif defined (__AVR_AT90S2343__)
335 # define _EEPROM_SUFFIX _2343
336 #elif defined (__AVR_AT90S2333__)
337 # define _EEPROM_SUFFIX _2333
338 #elif defined (__AVR_AT90S2323__)
339 # define _EEPROM_SUFFIX _2323
340 #elif defined (__AVR_AT90S2313__)
341 # define _EEPROM_SUFFIX _2313
342 #elif defined (__AVR_ATtiny2313__)
343 # define _EEPROM_SUFFIX _tn2313
344 #elif defined (__AVR_ATtiny2313A__)
345 # define _EEPROM_SUFFIX _tn2313a
346 #elif defined (__AVR_ATtiny4313__)
347 # define _EEPROM_SUFFIX _tn4313
348 #elif defined (__AVR_ATtiny13__)
349 # define _EEPROM_SUFFIX _tn13
350 #elif defined (__AVR_ATtiny13A__)
351 # define _EEPROM_SUFFIX _tn13a
352 #elif defined (__AVR_ATtiny25__)
353 # define _EEPROM_SUFFIX _tn25
354 #elif defined (__AVR_ATtiny45__)
355 # define _EEPROM_SUFFIX _tn45
356 #elif defined (__AVR_ATtiny85__)
357 # define _EEPROM_SUFFIX _tn85
358 #elif defined (__AVR_ATtiny24__)
359 # define _EEPROM_SUFFIX _tn24
360 #elif defined (__AVR_ATtiny24A__)
361 # define _EEPROM_SUFFIX _tn24a
362 #elif defined (__AVR_ATtiny44__)
363 # define _EEPROM_SUFFIX _tn44
364 #elif defined (__AVR_ATtiny44A__)
365 # define _EEPROM_SUFFIX _tn44a
366 #elif defined (__AVR_ATtiny84__)
367 # define _EEPROM_SUFFIX _tn84
368 #elif defined (__AVR_ATtiny84A__)
369 # define _EEPROM_SUFFIX _tn84a
370 #elif defined (__AVR_ATtiny841__)
371 # define _EEPROM_SUFFIX _tn841
372 #elif defined (__AVR_ATtiny261__)
373 # define _EEPROM_SUFFIX _tn261
374 #elif defined (__AVR_ATtiny261A__)
375 # define _EEPROM_SUFFIX _tn261a
376 #elif defined (__AVR_ATtiny461__)
377 # define _EEPROM_SUFFIX _tn461
378 #elif defined (__AVR_ATtiny461A__)
379 # define _EEPROM_SUFFIX _tn461a
380 #elif defined (__AVR_ATtiny861__)
381 # define _EEPROM_SUFFIX _tn861
382 #elif defined (__AVR_ATtiny861A__)
383 # define _EEPROM_SUFFIX _tn861a
384 #elif defined (__AVR_ATtiny43U__)
385 # define _EEPROM_SUFFIX _tn43u
386 #elif defined (__AVR_ATtiny48__)
387 # define _EEPROM_SUFFIX _tn48
388 #elif defined (__AVR_ATtiny828__)
389 # define _EEPROM_SUFFIX _tn828
390 #elif defined (__AVR_ATtiny88__)
391 # define _EEPROM_SUFFIX _tn88
392 #elif defined (__AVR_ATtiny87__)
393 # define _EEPROM_SUFFIX _tn87
394 #elif defined (__AVR_ATtiny167__)
395 # define _EEPROM_SUFFIX _tn167
396 #elif defined (__AVR_ATtiny1634__)
397 # define _EEPROM_SUFFIX _tn1634
398 #elif defined (__AVR_AT90SCR100__)
399 # define _EEPROM_SUFFIX _90scr100
400 #elif defined (__AVR_ATxmega16A4__)
401 # define _EEPROM_SUFFIX _x16a4
402 #elif defined (__AVR_ATxmega16A4U__)
403 # define _EEPROM_SUFFIX _x16a4u
404 #elif defined (__AVR_ATxmega16C4__)
405 # define _EEPROM_SUFFIX _x16c4
406 #elif defined (__AVR_ATxmega16D4__)
407 # define _EEPROM_SUFFIX _x16d4
408 #elif defined (__AVR_ATxmega32A4__)
409 # define _EEPROM_SUFFIX _x32a4
410 #elif defined (__AVR_ATxmega32A4U__)
411 # define _EEPROM_SUFFIX _x32a4u
412 #elif defined (__AVR_ATxmega32C4__)
413 # define _EEPROM_SUFFIX _x32c4
414 #elif defined (__AVR_ATxmega32D4__)
415 # define _EEPROM_SUFFIX _x32d4
416 #elif defined (__AVR_ATxmega32E5__)
417 # define _EEPROM_SUFFIX _x32e5
418 #elif defined (__AVR_ATxmega32X1__)
419 # define _EEPROM_SUFFIX _x32x1
420 #elif defined (__AVR_ATxmega64A1__)
421 # define _EEPROM_SUFFIX _x64a1
422 #elif defined (__AVR_ATxmega64A1U__)
423 # define _EEPROM_SUFFIX _x64a1u
424 #elif defined (__AVR_ATxmega64A3__)
425 # define _EEPROM_SUFFIX _x64a3
426 #elif defined (__AVR_ATxmega64A3U__)
427 # define _EEPROM_SUFFIX _x64a3u
428 #elif defined (__AVR_ATxmega64A4U__)
429 # define _EEPROM_SUFFIX _x64a4u
430 #elif defined (__AVR_ATxmega64B1__)
431 # define _EEPROM_SUFFIX _x64b1
432 #elif defined (__AVR_ATxmega64B3__)
433 # define _EEPROM_SUFFIX _x64b3
434 #elif defined (__AVR_ATxmega64C3__)
435 # define _EEPROM_SUFFIX _x64c3
436 #elif defined (__AVR_ATxmega64D3__)
437 # define _EEPROM_SUFFIX _x64d3
438 #elif defined (__AVR_ATxmega64D4__)
439 # define _EEPROM_SUFFIX _x64d4
440 #elif defined (__AVR_ATxmega128A1__)
441 # define _EEPROM_SUFFIX _x128a1
442 #elif defined (__AVR_ATxmega128A1U__)
443 # define _EEPROM_SUFFIX _x128a1u
444 #elif defined (__AVR_ATxmega128A4U__)
445 # define _EEPROM_SUFFIX _x128a4u
446 #elif defined (__AVR_ATxmega128A3__)
447 # define _EEPROM_SUFFIX _x128a3
448 #elif defined (__AVR_ATxmega128A3U__)
449 # define _EEPROM_SUFFIX _x128a3u
450 #elif defined (__AVR_ATxmega128B1__)
451 # define _EEPROM_SUFFIX _x128b1
452 #elif defined (__AVR_ATxmega128B3__)
453 # define _EEPROM_SUFFIX _x128b3
454 #elif defined (__AVR_ATxmega128C3__)
455 # define _EEPROM_SUFFIX _x128c3
456 #elif defined (__AVR_ATxmega128D3__)
457 # define _EEPROM_SUFFIX _x128d3
458 #elif defined (__AVR_ATxmega128D4__)
459 # define _EEPROM_SUFFIX _x128d4
460 #elif defined (__AVR_ATxmega192A3__)
461 # define _EEPROM_SUFFIX _x192a3
462 #elif defined (__AVR_ATxmega192A3U__)
463 # define _EEPROM_SUFFIX _x192a3u
464 #elif defined (__AVR_ATxmega192C3__)
465 # define _EEPROM_SUFFIX _x192c3
466 #elif defined (__AVR_ATxmega192D3__)
467 # define _EEPROM_SUFFIX _x192d3
468 #elif defined (__AVR_ATxmega256A3__)
469 # define _EEPROM_SUFFIX _x256a3
470 #elif defined (__AVR_ATxmega256A3U__)
471 # define _EEPROM_SUFFIX _x256a3u
472 #elif defined (__AVR_ATxmega256A3B__)
473 # define _EEPROM_SUFFIX _x256a3b
474 #elif defined (__AVR_ATxmega256A3BU__)
475 # define _EEPROM_SUFFIX _x256a3bu
476 #elif defined (__AVR_ATxmega256C3__)
477 # define _EEPROM_SUFFIX _x256c3
478 #elif defined (__AVR_ATxmega256D3__)
479 # define _EEPROM_SUFFIX _x256d3
480 #elif defined (__AVR_ATxmega384C3__)
481 # define _EEPROM_SUFFIX _x384c3
482 #elif defined (__AVR_ATxmega384D3__)
483 # define _EEPROM_SUFFIX _x384d3
484 #elif defined (__AVR_ATA5505__)
485 # define _EEPROM_SUFFIX _a5505
486 #elif defined (__AVR_ATA5272__)
487 # define _EEPROM_SUFFIX _a5272
488 #elif defined (__AVR_ATA6285__)
489 # define _EEPROM_SUFFIX _a6285
490 #elif defined (__AVR_ATA6286__)
491 # define _EEPROM_SUFFIX _a6286
492 #elif defined (__AVR_ATA6289__)
493 # define _EEPROM_SUFFIX _a6289
494 #elif defined (__AVR_ATA5790__)
495 # define _EEPROM_SUFFIX _a5790
496 #elif defined (__AVR_ATA5790N__)
497 # define _EEPROM_SUFFIX _a5790n
498 #elif defined (__AVR_ATA5795__)
499 # define _EEPROM_SUFFIX _a5795
500 #elif defined (__AVR_ATA5831__)
501 # define _EEPROM_SUFFIX _a5831
502 /* avr1: the following only supported for assembler programs */
503 #elif defined (__AVR_ATtiny28__)
504 # define _EEPROM_SUFFIX _tn28
505 #elif defined (__AVR_AT90S1200__)
506 # define _EEPROM_SUFFIX _1200
507 #elif defined (__AVR_ATtiny15__)
508 # define _EEPROM_SUFFIX _tn15
509 #elif defined (__AVR_ATtiny12__)
510 # define _EEPROM_SUFFIX _tn12
511 #elif defined (__AVR_ATtiny11__)
512 # define _EEPROM_SUFFIX _tn11
513 #else
514 # define _EEPROM_SUFFIX _UNKNOWN
515 #endif
516
517 #define _EEPROM_CONCAT1(s1, s2) s1 ## s2
518 #define _EEPROM_CONCAT2(s1, s2) _EEPROM_CONCAT1 (s1, s2)
519
520 #define eeprom_read_byte _EEPROM_CONCAT2 (__eerd_byte, _EEPROM_SUFFIX)
521 #define eeprom_read_word _EEPROM_CONCAT2 (__eerd_word, _EEPROM_SUFFIX)
522 #define eeprom_read_dword _EEPROM_CONCAT2 (__eerd_dword, _EEPROM_SUFFIX)
523 #define eeprom_read_float _EEPROM_CONCAT2 (__eerd_float, _EEPROM_SUFFIX)
524 #define eeprom_read_block _EEPROM_CONCAT2 (__eerd_block, _EEPROM_SUFFIX)
525
526 #define eeprom_write_byte _EEPROM_CONCAT2 (__eewr_byte, _EEPROM_SUFFIX)
527 #define eeprom_write_word _EEPROM_CONCAT2 (__eewr_word, _EEPROM_SUFFIX)
528 #define eeprom_write_dword _EEPROM_CONCAT2 (__eewr_dword, _EEPROM_SUFFIX)
529 #define eeprom_write_float _EEPROM_CONCAT2 (__eewr_float, _EEPROM_SUFFIX)
530 #define eeprom_write_block _EEPROM_CONCAT2 (__eewr_block, _EEPROM_SUFFIX)
531
532 #define eeprom_update_byte _EEPROM_CONCAT2 (__eeupd_byte, _EEPROM_SUFFIX)
533 #define eeprom_update_word _EEPROM_CONCAT2 (__eeupd_word, _EEPROM_SUFFIX)
534 #define eeprom_update_dword _EEPROM_CONCAT2 (__eeupd_dword, _EEPROM_SUFFIX)
535 #define eeprom_update_float _EEPROM_CONCAT2 (__eeupd_float, _EEPROM_SUFFIX)
536 #define eeprom_update_block _EEPROM_CONCAT2 (__eeupd_block, _EEPROM_SUFFIX)
537
538 #endif /* !__DOXYGEN__ */
539
540 #ifndef __ASSEMBLER__
541
542 #include <stddef.h> /* size_t */
543 #include <stdint.h>
544
545 /** \defgroup avr_eeprom <avr/eeprom.h>: EEPROM handling
546 \code #include <avr/eeprom.h> \endcode
547
548 This header file declares the interface to some simple library
549 routines suitable for handling the data EEPROM contained in the
550 AVR microcontrollers. The implementation uses a simple polled
551 mode interface. Applications that require interrupt-controlled
552 EEPROM access to ensure that no time will be wasted in spinloops
553 will have to deploy their own implementation.
554
555 \par Notes:
556
557 - In addition to the write functions there is a set of update ones.
558 This functions read each byte first and skip the burning if the
559 old value is the same with new. The scaning direction is from
560 high address to low, to obtain quick return in common cases.
561
562 - All of the read/write functions first make sure the EEPROM is
563 ready to be accessed. Since this may cause long delays if a
564 write operation is still pending, time-critical applications
565 should first poll the EEPROM e. g. using eeprom_is_ready() before
566 attempting any actual I/O. But this functions are not wait until
567 SELFPRGEN in SPMCSR becomes zero. Do this manually, if your
568 softwate contains the Flash burning.
569
570 - As these functions modify IO registers, they are known to be
571 non-reentrant. If any of these functions are used from both,
572 standard and interrupt context, the applications must ensure
573 proper protection (e.g. by disabling interrupts before accessing
574 them).
575
576 - All write functions force erase_and_write programming mode.
577
578 - For Xmega the EEPROM start address is 0, like other architectures.
579 The reading functions add the 0x2000 value to use EEPROM mapping into
580 data space.
581 */
582
583 #ifdef __cplusplus
584 extern "C" {
585 #endif
586
587 #ifndef __ATTR_PURE__
588 # ifdef __DOXYGEN__
589 # define __ATTR_PURE__
590 # else
591 # define __ATTR_PURE__ __attribute__((__pure__))
592 # endif
593 #endif
594
595 /** \def EEMEM
596 \ingroup avr_eeprom
597 Attribute expression causing a variable to be allocated within the
598 .eeprom section. */
599 #define EEMEM __attribute__((section(".eeprom")))
600
601 /** \def eeprom_is_ready
602 \ingroup avr_eeprom
603 \returns 1 if EEPROM is ready for a new read/write operation, 0 if not.
604 */
605 #if defined (__DOXYGEN__)
606 # define eeprom_is_ready()
607 #elif defined (__AVR_XMEGA__) && __AVR_XMEGA__
608 # define eeprom_is_ready() bit_is_clear (NVM_STATUS, NVM_NVMBUSY_bp)
609 #elif defined (DEECR)
610 # define eeprom_is_ready() bit_is_clear (DEECR, BSY)
611 #elif defined (EEPE)
612 # define eeprom_is_ready() bit_is_clear (EECR, EEPE)
613 #else
614 # define eeprom_is_ready() bit_is_clear (EECR, EEWE)
615 #endif
616
617
618 /** \def eeprom_busy_wait
619 \ingroup avr_eeprom
620 Loops until the eeprom is no longer busy.
621 \returns Nothing.
622 */
623 #define eeprom_busy_wait() do {} while (!eeprom_is_ready())
624
625
626 /** \ingroup avr_eeprom
627 Read one byte from EEPROM address \a __p.
628 */
629 uint8_t eeprom_read_byte (const uint8_t *__p) __ATTR_PURE__;
630
631 /** \ingroup avr_eeprom
632 Read one 16-bit word (little endian) from EEPROM address \a __p.
633 */
634 uint16_t eeprom_read_word (const uint16_t *__p) __ATTR_PURE__;
635
636 /** \ingroup avr_eeprom
637 Read one 32-bit double word (little endian) from EEPROM address \a __p.
638 */
639 uint32_t eeprom_read_dword (const uint32_t *__p) __ATTR_PURE__;
640
641 /** \ingroup avr_eeprom
642 Read one float value (little endian) from EEPROM address \a __p.
643 */
644 float eeprom_read_float (const float *__p) __ATTR_PURE__;
645
646 /** \ingroup avr_eeprom
647 Read a block of \a __n bytes from EEPROM address \a __src to SRAM
648 \a __dst.
649 */
650 void eeprom_read_block (void *__dst, const void *__src, size_t __n);
651
652
653 /** \ingroup avr_eeprom
654 Write a byte \a __value to EEPROM address \a __p.
655 */
656 void eeprom_write_byte (uint8_t *__p, uint8_t __value);
657
658 /** \ingroup avr_eeprom
659 Write a word \a __value to EEPROM address \a __p.
660 */
661 void eeprom_write_word (uint16_t *__p, uint16_t __value);
662
663 /** \ingroup avr_eeprom
664 Write a 32-bit double word \a __value to EEPROM address \a __p.
665 */
666 void eeprom_write_dword (uint32_t *__p, uint32_t __value);
667
668 /** \ingroup avr_eeprom
669 Write a float \a __value to EEPROM address \a __p.
670 */
671 void eeprom_write_float (float *__p, float __value);
672
673 /** \ingroup avr_eeprom
674 Write a block of \a __n bytes to EEPROM address \a __dst from \a __src.
675 \note The argument order is mismatch with common functions like strcpy().
676 */
677 void eeprom_write_block (const void *__src, void *__dst, size_t __n);
678
679
680 /** \ingroup avr_eeprom
681 Update a byte \a __value to EEPROM address \a __p.
682 */
683 void eeprom_update_byte (uint8_t *__p, uint8_t __value);
684
685 /** \ingroup avr_eeprom
686 Update a word \a __value to EEPROM address \a __p.
687 */
688 void eeprom_update_word (uint16_t *__p, uint16_t __value);
689
690 /** \ingroup avr_eeprom
691 Update a 32-bit double word \a __value to EEPROM address \a __p.
692 */
693 void eeprom_update_dword (uint32_t *__p, uint32_t __value);
694
695 /** \ingroup avr_eeprom
696 Update a float \a __value to EEPROM address \a __p.
697 */
698 void eeprom_update_float (float *__p, float __value);
699
700 /** \ingroup avr_eeprom
701 Update a block of \a __n bytes to EEPROM address \a __dst from \a __src.
702 \note The argument order is mismatch with common functions like strcpy().
703 */
704 void eeprom_update_block (const void *__src, void *__dst, size_t __n);
705
706
707 /** \name IAR C compatibility defines */
708 /*@{*/
709
710 /** \def _EEPUT
711 \ingroup avr_eeprom
712 Write a byte to EEPROM. Compatibility define for IAR C. */
713 #define _EEPUT(addr, val) eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))
714
715 /** \def __EEPUT
716 \ingroup avr_eeprom
717 Write a byte to EEPROM. Compatibility define for IAR C. */
718 #define __EEPUT(addr, val) eeprom_write_byte ((uint8_t *)(addr), (uint8_t)(val))
719
720 /** \def _EEGET
721 \ingroup avr_eeprom
722 Read a byte from EEPROM. Compatibility define for IAR C. */
723 #define _EEGET(var, addr) (var) = eeprom_read_byte ((const uint8_t *)(addr))
724
725 /** \def __EEGET
726 \ingroup avr_eeprom
727 Read a byte from EEPROM. Compatibility define for IAR C. */
728 #define __EEGET(var, addr) (var) = eeprom_read_byte ((const uint8_t *)(addr))
729
730 /*@}*/
731
732 #ifdef __cplusplus
733 }
734 #endif
735
736 #endif /* !__ASSEMBLER__ */
737 #endif /* E2END || defined(__DOXYGEN__) || defined(__COMPILING_AVR_LIBC__) */
738 #endif /* !_AVR_EEPROM_H_ */

Automatically generated by Doxygen 1.8.1.1 on Fri Aug 17 2012.