~abogani/ubuntu/lucid/avr-libc/avr-libc.fix-FTBFS

« back to all changes in this revision

Viewing changes to include/avr/common.h

  • Committer: Bazaar Package Importer
  • Author(s): Hakan Ardo
  • Date: 2007-12-29 16:20:03 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071229162003-lyyrt60vipc9xbwm
Tags: 1:1.4.7-1
* New upstream release (closes: #410831, #420163, #421088, #452199, #394231)
* Replaced tetex packages with texlive in Build-Depends (closes:
  #427266)
* Now ignores returnstatus of pdflatex when generating docs to prevent
  the build processing from halting on latex warnings (closes:
  #427266)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2007 Eric B. Weddington
 
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
 
 
10
   * Redistributions in binary form must reproduce the above copyright
 
11
     notice, this list of conditions and the following disclaimer in
 
12
     the documentation and/or other materials provided with the
 
13
     distribution.
 
14
 
 
15
   * Neither the name of the copyright holders nor the names of
 
16
     contributors may be used to endorse or promote products derived
 
17
     from this software without specific prior written permission.
 
18
 
 
19
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 
20
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
21
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
22
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 
23
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 
24
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
25
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
26
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 
27
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
28
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
29
  POSSIBILITY OF SUCH DAMAGE. */
 
30
 
 
31
/* $Id: common.h,v 1.3.2.2 2007/07/10 05:04:50 arcanum Exp $ */
 
32
 
 
33
 
 
34
#ifndef _AVR_COMMON_H
 
35
#define _AVR_COMMON_H
 
36
 
 
37
#include <avr/sfr_defs.h>
 
38
 
 
39
/* 
 
40
This purpose of this header is to define registers that have not been 
 
41
previously defined in the individual device IO header files, and to define 
 
42
other symbols that are common across AVR device families.
 
43
 
 
44
This file is designed to be included in <avr/io.h> after the individual
 
45
device IO header files, and after <avr/sfr_defs.h>
 
46
 
 
47
*/
 
48
 
 
49
/*------------ Registers Not Previously Defined ------------*/
 
50
 
 
51
/* 
 
52
These are registers that are not previously defined in the individual
 
53
IO header files, OR they are defined here because they are used in parts of
 
54
avr-libc even if a device is not selected but a general architecture has
 
55
been selected.
 
56
*/
 
57
 
 
58
 
 
59
/*
 
60
Stack pointer register.
 
61
 
 
62
AVR architecture 1 has no RAM, thus no stack pointer. 
 
63
 
 
64
All other architectures do have a stack pointer.  Some devices have only
 
65
less than 256 bytes of possible RAM locations (128 Bytes of SRAM
 
66
and no option for external RAM), thus SPH is officially "reserved"
 
67
for them.
 
68
 
 
69
*/
 
70
#if __AVR_ARCH__ != 1
 
71
 
 
72
#  ifndef SPL
 
73
#    define SPL _SFR_IO8(0x3D)
 
74
#  endif
 
75
#  if XRAMEND < 0x100
 
76
#    ifndef SP
 
77
#      define SP  _SFR_IO8(0x3D)
 
78
#    endif
 
79
#  else
 
80
#    ifndef SP
 
81
#      define SP  _SFR_IO16(0x3D)
 
82
#    endif
 
83
#    ifndef SPH
 
84
#      define SPH _SFR_IO8(0x3E)
 
85
#    endif
 
86
#  endif /* XRAMEND < 0x100 && !defined(__COMPILING_AVR_LIBC__) */
 
87
 
 
88
#endif /* __AVR_ARCH__ != 1 */
 
89
 
 
90
 
 
91
/* Status Register */
 
92
#ifndef SREG
 
93
#  define SREG _SFR_IO8(0x3F)
 
94
#endif
 
95
 
 
96
/* SREG bit definitions */
 
97
#ifndef SREG_C
 
98
#  define SREG_C  (0)
 
99
#endif
 
100
#ifndef SREG_Z
 
101
#  define SREG_Z  (1)
 
102
#endif
 
103
#ifndef SREG_N
 
104
#  define SREG_N  (2)
 
105
#endif
 
106
#ifndef SREG_V
 
107
#  define SREG_V  (3)
 
108
#endif
 
109
#ifndef SREG_S
 
110
#  define SREG_S  (4)
 
111
#endif
 
112
#ifndef SREG_H
 
113
#  define SREG_H  (5)
 
114
#endif
 
115
#ifndef SREG_T
 
116
#  define SREG_T  (6)
 
117
#endif
 
118
#ifndef SREG_I
 
119
#  define SREG_I  (7)
 
120
#endif
 
121
 
 
122
 
 
123
/* AVR 6 Architecture */
 
124
#if __AVR_ARCH__ == 6
 
125
#  ifndef EIND
 
126
#    define EIND  _SFR_IO8(0X3C)
 
127
#  endif
 
128
#endif /* __AVR_ARCH__ == 6 */
 
129
 
 
130
 
 
131
 
 
132
#if defined(__COMPILING_AVR_LIBC__)
 
133
 
 
134
/*
 
135
Only few devices come without EEPROM.  In order to assemble the
 
136
EEPROM library components without defining a specific device, we
 
137
keep the EEPROM-related definitions here.
 
138
*/
 
139
 
 
140
/* EEPROM Control Register */
 
141
#  ifndef EECR
 
142
#    define EECR   _SFR_IO8(0x1C)
 
143
#  endif
 
144
 
 
145
/* EEPROM Data Register */
 
146
#  ifndef EEDR
 
147
#    define EEDR   _SFR_IO8(0x1D)
 
148
#  endif
 
149
 
 
150
/* EEPROM Address Register */
 
151
#  ifndef EEAR
 
152
#    define EEAR   _SFR_IO16(0x1E)
 
153
#  endif
 
154
#  ifndef EEARL
 
155
#    define EEARL  _SFR_IO8(0x1E)
 
156
#  endif
 
157
#  ifndef EEARH
 
158
#    define EEARH  _SFR_IO8(0x1F)
 
159
#  endif
 
160
 
 
161
/* EEPROM Control Register bits */
 
162
#  ifndef EERE
 
163
#    define EERE   (0)
 
164
#  endif
 
165
#  ifndef EEWE
 
166
#    define EEWE   (1)
 
167
#  endif
 
168
#  ifndef EEMWE
 
169
#    define EEMWE  (2)
 
170
#  endif
 
171
#  ifndef EERIE
 
172
#    define EERIE  (3)
 
173
#  endif
 
174
 
 
175
#endif /* __COMPILING_AVR_LIBC__ */
 
176
 
 
177
 
 
178
 
 
179
/*------------ Common Symbols ------------*/
 
180
 
 
181
/* 
 
182
Generic definitions for registers that are common across multiple AVR devices
 
183
and families.
 
184
*/
 
185
 
 
186
/* Pointer registers definitions */
 
187
#if __AVR_ARCH__ != 1  /* avr1 does not have X and Y pointers */
 
188
#  define XL  r26
 
189
#  define XH  r27
 
190
#  define YL  r28
 
191
#  define YH  r29
 
192
#endif /* #if __AVR_ARCH__ != 1 */
 
193
#define ZL  r30
 
194
#define ZH  r31
 
195
 
 
196
 
 
197
/* Status Register */
 
198
#if defined(SREG)
 
199
#  define AVR_STATUS_REG   SREG
 
200
#  define AVR_STATUS_ADDR  _SFR_IO_ADDR(SREG)
 
201
#endif
 
202
 
 
203
/* Stack Pointer (combined) Register */
 
204
#if defined(SP)
 
205
#  define AVR_STACK_POINTER_REG   SP
 
206
#  define AVR_STACK_POINTER_ADDR  _SFR_IO_ADDR(SP)
 
207
#endif
 
208
 
 
209
/* Stack Pointer High Register */
 
210
#if defined(SPH)
 
211
#  define _HAVE_AVR_STACK_POINTER_HI 1
 
212
#  define AVR_STACK_POINTER_HI_REG   SPH
 
213
#  define AVR_STACK_POINTER_HI_ADDR  _SFR_IO_ADDR(SPH)
 
214
#endif
 
215
 
 
216
/* Stack Pointer Low Register */
 
217
#if defined(SPL)
 
218
#  define AVR_STACK_POINTER_LO_REG   SPL
 
219
#  define AVR_STACK_POINTER_LO_ADDR  _SFR_IO_ADDR(SPL)
 
220
#endif
 
221
 
 
222
/* RAMPZ Register */
 
223
#if defined(RAMPZ)
 
224
#  define AVR_RAMPZ_REG   RAMPZ
 
225
#  define AVR_RAMPZ_ADDR  _SFR_IO_ADDR(RAMPZ)
 
226
#endif
 
227
 
 
228
/* Extended Indirect Register */
 
229
#if defined(EIND)
 
230
#  define AVR_EXTENDED_INDIRECT_REG   EIND
 
231
#  define AVR_EXTENDED_INDIRECT_ADDR  _SFR_IO_ADDR(EIND)
 
232
#endif
 
233
 
 
234
 
 
235
#endif /* _AVR_COMMON_H */