RTEMS CPU Kit with SuperCore  4.11.3
iotn15.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2002,2005 Marek Michalkiewicz
11  * All rights reserved.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions are met:
15  *
16  * * Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  *
19  * * Redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in
21  * the documentation and/or other materials provided with the
22  * distribution.
23  *
24  * * Neither the name of the copyright holders nor the names of
25  * contributors may be used to endorse or promote products derived
26  * from this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
32  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38  * POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #ifndef _AVR_IOTN15_H_
42 #define _AVR_IOTN15_H_ 1
43 
52 #ifndef _AVR_IO_H_
53 # error "Include <avr/io.h> instead of this file."
54 #endif
55 
56 #ifndef _AVR_IOXXX_H_
57 # define _AVR_IOXXX_H_ "iotn15.h"
58 #else
59 # error "Attempt to include more than one <avr/ioXXX.h> file."
60 #endif
61 
62 #ifndef __ASSEMBLER__
63 # warning "MCU not supported by the C compiler"
64 #endif
65 
66 /* I/O registers */
67 
68 /* 0x00..0x03 reserved */
69 
70 #ifndef __ASSEMBLER__
71 #define ADC _SFR_IO16 (0x04)
72 #endif
73 #define ADCW _SFR_IO16(0x04)
74 #define ADCL _SFR_IO8(0x04)
75 #define ADCH _SFR_IO8(0x05)
76 #define ADCSR _SFR_IO8(0x06)
77 #define ADMUX _SFR_IO8(0x07)
78 
79 /* Analog Comparator Control and Status Register */
80 #define ACSR _SFR_IO8(0x08)
81 
82 /* 0x09..0x15 reserved */
83 
84 /* Input Pins, Port B */
85 #define PINB _SFR_IO8(0x16)
86 
87 /* Data Direction Register, Port B */
88 #define DDRB _SFR_IO8(0x17)
89 
90 /* Data Register, Port B */
91 #define PORTB _SFR_IO8(0x18)
92 
93 /* 0x19..0x1B reserved */
94 
95 /* EEPROM Control Register */
96 #define EECR _SFR_IO8(0x1C)
97 
98 /* EEPROM Data Register */
99 #define EEDR _SFR_IO8(0x1D)
100 
101 /* EEPROM Address Register */
102 #define EEAR _SFR_IO8(0x1E)
103 #define EEARL _SFR_IO8(0x1E)
104 
105 /* 0x1F..0x20 reserved */
106 
107 /* Watchdog Timer Control Register */
108 #define WDTCR _SFR_IO8(0x21)
109 
110 /* 0x22..0x2B reserved */
111 #define SFIOR _SFR_IO8(0x2C)
112 
113 #define OCR1B _SFR_IO8(0x2D)
114 #define OCR1A _SFR_IO8(0x2E)
115 #define TCNT1 _SFR_IO8(0x2F)
116 #define TCCR1 _SFR_IO8(0x30)
117 
118 /* Oscillator Calibration Register */
119 #define OSCCAL _SFR_IO8(0x31)
120 
121 /* Timer/Counter0 (8-bit) */
122 #define TCNT0 _SFR_IO8(0x32)
123 
124 /* Timer/Counter0 Control Register */
125 #define TCCR0 _SFR_IO8(0x33)
126 
127 /* MCU general Status Register */
128 #define MCUSR _SFR_IO8(0x34)
129 
130 /* MCU general Control Register */
131 #define MCUCR _SFR_IO8(0x35)
132 
133 /* 0x36..0x37 reserved */
134 
135 /* Timer/Counter Interrupt Flag Register */
136 #define TIFR _SFR_IO8(0x38)
137 
138 /* Timer/Counter Interrupt MaSK Register */
139 #define TIMSK _SFR_IO8(0x39)
140 
141 /* General Interrupt Flag Register */
142 #define GIFR _SFR_IO8(0x3A)
143 
144 /* General Interrupt MaSK register */
145 #define GIMSK _SFR_IO8(0x3B)
146 
147 /* 0x3C..0x3E reserved */
148 
149 /* 0x3F SREG */
150 
151 /* Interrupt vectors */
152 
153 /* External Interrupt 0 */
154 #define INT0_vect _VECTOR(1)
155 #define SIG_INTERRUPT0 _VECTOR(1)
156 
157 /* External Interrupt Request 0 */
158 #define IO_PINS_vect _VECTOR(2)
159 #define SIG_PIN _VECTOR(2)
160 #define SIG_PIN_CHANGE _VECTOR(2)
161 
162 /* Timer/Counter1 Compare Match */
163 #define TIMER1_COMP_vect _VECTOR(3)
164 #define SIG_OUTPUT_COMPARE1A _VECTOR(3)
165 
166 /* Timer/Counter1 Overflow */
167 #define TIMER1_OVF_vect _VECTOR(4)
168 #define SIG_OVERFLOW1 _VECTOR(4)
169 
170 /* Timer/Counter0 Overflow */
171 #define TIMER0_OVF_vect _VECTOR(5)
172 #define SIG_OVERFLOW0 _VECTOR(5)
173 
174 /* EEPROM Ready */
175 #define EE_RDY_vect _VECTOR(6)
176 #define SIG_EEPROM_READY _VECTOR(6)
177 
178 /* Analog Comparator */
179 #define ANA_COMP_vect _VECTOR(7)
180 #define SIG_COMPARATOR _VECTOR(7)
181 
182 /* ADC Conversion Ready */
183 #define ADC_vect _VECTOR(8)
184 #define SIG_ADC _VECTOR(8)
185 
186 #define _VECTORS_SIZE 18
187 
188 /* Bit numbers */
189 
190 /* GIMSK */
191 #define INT0 6
192 #define PCIE 5
193 
194 /* GIFR */
195 #define INTF0 6
196 #define PCIF 5
197 
198 /* TIMSK */
199 #define OCIE1 6
200 #define TOIE1 2
201 #define TOIE0 1
202 
203 /* TIFR */
204 #define OCF1 6
205 #define TOV1 2
206 #define TOV0 1
207 
208 /* MCUCR */
209 #define PUD 6
210 #define SE 5
211 #define SM1 4
212 #define SM0 3
213 #define ISC01 1
214 #define ISC00 0
215 
216 /* MCUSR */
217 #define WDRF 3
218 #define BORF 2
219 #define EXTRF 1
220 #define PORF 0
221 
222 /* TCCR0 */
223 #define CS02 2
224 #define CS01 1
225 #define CS00 0
226 
227 /* TCCR1 */
228 #define CTC1 7
229 #define PWM1 6
230 #define COM1A1 5
231 #define COM1A0 4
232 #define CS13 3
233 #define CS12 2
234 #define CS11 1
235 #define CS10 0
236 
237 /* SFIOR */
238 #define FOC1A 2
239 #define PSR1 1
240 #define PSR0 0
241 
242 /* WDTCR */
243 #define WDTOE 4
244 #define WDE 3
245 #define WDP2 2
246 #define WDP1 1
247 #define WDP0 0
248 
249 /*
250  PB5 = RESET# / ADC0
251  PB4 = ADC3
252  PB3 = ADC2
253  PB2 = SCK / ADC1 / T0 / INT0
254  PB1 = MISO / AIN1 / OCP
255  PB0 = MOSI / AIN0 / AREF
256  */
257 
258 /* PORTB */
259 #define PB4 4
260 #define PB3 3
261 #define PB2 2
262 #define PB1 1
263 #define PB0 0
264 
265 /* DDRB */
266 #define DDB4 4
267 #define DDB3 3
268 #define DDB2 2
269 #define DDB1 1
270 #define DDB0 0
271 
272 /* PINB */
273 #define PINB5 5
274 #define PINB4 4
275 #define PINB3 3
276 #define PINB2 2
277 #define PINB1 1
278 #define PINB0 0
279 
280 /* ACSR */
281 #define ACD 7
282 #define GREF 6
283 #define ACO 5
284 #define ACI 4
285 #define ACIE 3
286 #define ACIS1 1
287 #define ACIS0 0
288 
289 /* ADMUX */
290 #define REFS1 7
291 #define REFS0 6
292 #define ADLAR 5
293 #define MUX2 2
294 #define MUX1 1
295 #define MUX0 0
296 
297 /* ADCSR */
298 #define ADEN 7
299 #define ADSC 6
300 #define ADFR 5
301 #define ADIF 4
302 #define ADIE 3
303 #define ADPS2 2
304 #define ADPS1 1
305 #define ADPS0 0
306 
307 /* EEPROM Control Register */
308 #define EERIE 3
309 #define EEMWE 2
310 #define EEWE 1
311 #define EERE 0
312 
313 /* Last memory addresses */
314 #define RAMEND 0x1F
315 #define XRAMEND 0x0
316 #define E2END 0x3F
317 #define E2PAGESIZE 2
318 #define FLASHEND 0x3FF
319 
320 
321 /* Fuses */
322 
323 #define FUSE_MEMORY_SIZE 1
324 
325 /* Fuse Byte */
326 #define FUSE_CKSEL0 (unsigned char)~_BV(0)
327 #define FUSE_CKSEL1 (unsigned char)~_BV(1)
328 #define FUSE_RSTDISBL (unsigned char)~_BV(4)
329 #define FUSE_SPIEN (unsigned char)~_BV(5)
330 #define FUSE_BODEN (unsigned char)~_BV(6)
331 #define FUSE_BODLEVEL (unsigned char)~_BV(7)
332 #define FUSE_DEFAULT (FUSE_CKSEL0 & FUSE_CKSEL1 & FUSE_SPIEN)
333 
334 
335 /* Lock Bits */
336 #define __LOCK_BITS_EXIST
337 
338 
339 /* Signature */
340 #define SIGNATURE_0 0x1E
341 #define SIGNATURE_1 0x90
342 #define SIGNATURE_2 0x06
343 
345 #endif /* _AVR_IOTN15_H_ */