AVR-LibC
2.2.0
Standard C library for AVR-GCC
AVR-LibC Documentation
AVR-LibC Development Pages
Main Page
User Manual
Library Reference
FAQ
Example Projects
File List
Loading...
Searching...
No Matches
libc
misc
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
# if NVMCTRL_CMD_gm == 0x7F
67
# if defined (__AVR_AVR16EA28__) || defined (__AVR_AVR16EA32__) || defined (__AVR_AVR16EA48__) || \
68
defined (__AVR_AVR16EB14__) || defined (__AVR_AVR16EB20__) || defined (__AVR_AVR16EB28__) || \
69
defined (__AVR_AVR16EB32__) || defined (__AVR_AVR32EA28__) || defined (__AVR_AVR32EA32__) || \
70
defined (__AVR_AVR32EA48__) || defined (__AVR_AVR64EA28__) || defined (__AVR_AVR64EA32__) || \
71
defined (__AVR_AVR64EA48__)
72
/* AVR-Ex family
73
* value of NVMCTRL_CMD_enum.NVMCTRL_CMD_EEPERW_gc */
74
# define NVMCTRL_CMD_PAGEERASEWRITE_gc (0x15<<0)
75
# elif defined (__AVR_AVR32DA28__) || defined (__AVR_AVR32DA32__) || defined (__AVR_AVR32DA48__) || \
76
defined (__AVR_AVR64DA28__) || defined (__AVR_AVR64DA32__) || defined (__AVR_AVR64DA48__) || \
77
defined (__AVR_AVR64DA64__) || defined (__AVR_AVR128DA28__) || defined (__AVR_AVR128DA32__) || \
78
defined (__AVR_AVR128DA48__) || defined (__AVR_AVR128DA64__) || defined (__AVR_AVR32DB28__) || \
79
defined (__AVR_AVR32DB32__) || defined (__AVR_AVR32DB48__) || defined (__AVR_AVR64DB28__) || \
80
defined (__AVR_AVR64DB32__) || defined (__AVR_AVR64DB48__) || defined (__AVR_AVR64DB64__) || \
81
defined (__AVR_AVR128DB28__) || defined (__AVR_AVR128DB32__) || defined (__AVR_AVR128DB48__) || \
82
defined (__AVR_AVR128DB64__) || defined (__AVR_AVR16DD14__) || defined (__AVR_AVR16DD20__) || \
83
defined (__AVR_AVR16DD28__) || defined (__AVR_AVR16DD32__) || defined (__AVR_AVR32DD14__) || \
84
defined (__AVR_AVR32DD20__) || defined (__AVR_AVR32DD32__) || defined (__AVR_AVR32DD28__) || \
85
defined (__AVR_AVR64DD14__) || defined (__AVR_AVR64DD20__) || defined (__AVR_AVR64DD28__) || \
86
defined (__AVR_AVR64DD32__) \
87
|| defined (__AVR_AVR64DU28__) || defined (__AVR_AVR64DU32__)
88
/* AVR-Dx family
89
* value of NVMCTRL_CMD_enum.NVMCTRL_CMD_EEERWR_gc */
90
# define NVMCTRL_CMD_PAGEERASEWRITE_gc (0x13<<0)
91
# else
92
/* To add support for a new device, define NVMCTRL CMD_PAGEERASEWRITE_gc with the value
93
* of "Erase and Write EEPROM Page" comand code for - Persistent Memory Controller (NVMCTRL).*/
94
# error "Not supported devices"
95
# endif
96
# else
97
/* the rest of the AVR devices with NVMCTRL_CTRLA (0x07)
98
* value of NVMCTRL_CMD_enum.NVMCTRL_CMD_PAGEERASEWRITE_gc */
99
# define NVMCTRL_CMD_PAGEERASEWRITE_gc 3
100
# endif
101
# endif
/* NVMCTRL_CMD_PAGEERASEWRITE_gc */
102
#endif
/* defined(NVMCTRL_CTRLA) */
103
#else
104
105
# if !defined (EECR) && defined (DEECR)
/* AT86RF401 */
106
# define EECR DEECR
107
# define EEARL DEEAR
108
# define EEDR DEEDR
109
# endif
110
111
# if !defined (EERE) && defined (EER)
/* AT86RF401 */
112
# define EERE EER
113
# endif
114
115
# if !defined (EEWE) && defined (EEPE)
/* A part of Mega and Tiny */
116
# define EEWE EEPE
117
# endif
118
# if !defined (EEWE) && defined (EEL)
/* AT86RF401 */
119
# define EEWE EEL
120
# endif
121
122
# if !defined (EEMWE) && defined (EEMPE)
/* A part of Mega and Tiny */
123
# define EEMWE EEMPE
124
# endif
125
# if !defined (EEMWE) && defined (EEU)
/* AT86RF401 */
126
# define EEMWE EEU
127
# endif
128
129
# if !_SFR_IO_REG_P (EECR) \
130
|| !_SFR_IO_REG_P (EEDR) \
131
|| !_SFR_IO_REG_P (EEARL) \
132
|| (defined (EEARH) && !_SFR_IO_REG_P (EEARH))
133
# error
134
# endif
135
136
#endif
/* !__AVR_XMEGA__ */
137
#endif
/* !__DOXYGEN__ */
138
#endif
/* !_EEDEF_H_ */
Generated on Sun Jun 9 2024 00:30:41 for AVR-LibC by
1.9.6