avr-libc: eedef.h Source File

avr-libc 2.0.0 Standard C library for AVR-GCC |

## AVR Libc Home Page |  | ## AVR Libc Development Pages
## Main Page | ## User Manual | ## Library Reference | ## FAQ | ## Example Projects

eedef.h
1 /* Copyright (c) 2009 Dmitry Xmelkov
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 * Neither the name of the copyright holders nor the names of
14 contributors may be used to endorse or promote products derived
15 from this software without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 POSSIBILITY OF SUCH DAMAGE. */
28
29 /* $Id$ */
30
31 #ifndef _EEDEF_H_
32 #define _EEDEF_H_ 1
33
34 #ifndef __DOXYGEN__
35
36 /* EEPROM address arg for a set of byte/word/dword functions and for
37 the internal eeprom_read_blraw(). */
38 #define addr_lo r24
39 #define addr_hi r25
40
41 /* Number of bytes arg for all block read/write functions, include
42 internal. */
43 #define n_lo r20
44 #define n_hi r21
45
46 #if __AVR_XMEGA__
47
48 # define NVM_BASE NVM_ADDR0
49
50 #if defined(NVMCTRL_CTRLA)
51 # undef NVM_BASE
52 # define NVM_BASE NVMCTRL_CTRLA
53
54 # define NVM_ADDR0 NVMCTRL_ADDR0
55 # define NVM_ADDR1 NVMCTRL_ADDR1
56 # define NVM_DATA0 NVMCTRL_DATA0
57 # define NVM_DATA1 NVMCTRL_DATA1
58 # define NVM_NVMBUSY_bp NVMCTRL_EEBUSY_bp
59 # define NVM_STATUS NVMCTRL_STATUS
60 # define NVM_CTRLA NVMCTRL_CTRLA
61 # define NVM_CTRLB NVMCTRL_CTRLB
62 # ifndef CCP_SPM_gc
63 # define CCP_SPM_gc (0x9D)
64 # endif
65 # ifndef NVMCTRL_CMD_PAGEERASEWRITE_gc
66 # define NVMCTRL_CMD_PAGEERASEWRITE_gc 3
67 # endif
68 #endif
69 #else
70
71 # if !defined (EECR) && defined (DEECR) /* AT86RF401 */
72 # define EECR DEECR
73 # define EEARL DEEAR
74 # define EEDR DEEDR
75 # endif
76
77 # if !defined (EERE) && defined (EER) /* AT86RF401 */
78 # define EERE EER
79 # endif
80
81 # if !defined (EEWE) && defined (EEPE) /* A part of Mega and Tiny */
82 # define EEWE EEPE
83 # endif
84 # if !defined (EEWE) && defined (EEL) /* AT86RF401 */
85 # define EEWE EEL
86 # endif
87
88 # if !defined (EEMWE) && defined (EEMPE) /* A part of Mega and Tiny */
89 # define EEMWE EEMPE
90 # endif
91 # if !defined (EEMWE) && defined (EEU) /* AT86RF401 */
92 # define EEMWE EEU
93 # endif
94
95 # if !_SFR_IO_REG_P (EECR) \
96 || !_SFR_IO_REG_P (EEDR) \
97 || !_SFR_IO_REG_P (EEARL) \
98 || (defined (EEARH) && !_SFR_IO_REG_P (EEARH))
99 # error
100 # endif
101
102 #endif /* !__AVR_XMEGA__ */
103 #endif /* !__DOXYGEN__ */
104 #endif /* !_EEDEF_H_ */