RTEMS CPU Kit with SuperCore  4.11.3
iotn12.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_IOTN12_H_
42 #define _AVR_IOTN12_H_ 1
43 
51 #ifndef _AVR_IO_H_
52 # error "Include <avr/io.h> instead of this file."
53 #endif
54 
55 #ifndef _AVR_IOXXX_H_
56 # define _AVR_IOXXX_H_ "iotn12.h"
57 #else
58 # error "Attempt to include more than one <avr/ioXXX.h> file."
59 #endif
60 
61 #ifndef __ASSEMBLER__
62 # warning "MCU not supported by the C compiler"
63 #endif
64 
65 /* I/O registers */
66 
67 /* 0x00..0x07 reserved */
68 
69 /* Analog Comparator Control and Status Register */
70 #define ACSR _SFR_IO8(0x08)
71 
72 /* 0x09..0x15 reserved */
73 
74 /* Input Pins, Port B */
75 #define PINB _SFR_IO8(0x16)
76 
77 /* Data Direction Register, Port B */
78 #define DDRB _SFR_IO8(0x17)
79 
80 /* Data Register, Port B */
81 #define PORTB _SFR_IO8(0x18)
82 
83 /* 0x19..0x1B reserved */
84 
85 /* EEPROM Control Register */
86 #define EECR _SFR_IO8(0x1C)
87 
88 /* EEPROM Data Register */
89 #define EEDR _SFR_IO8(0x1D)
90 
91 /* EEPROM Address Register */
92 #define EEAR _SFR_IO8(0x1E)
93 #define EEARL _SFR_IO8(0x1E)
94 
95 /* 0x1F..0x20 reserved */
96 
97 /* Watchdog Timer Control Register */
98 #define WDTCR _SFR_IO8(0x21)
99 
100 /* 0x22..0x30 reserved */
101 
102 /* Oscillator Calibration Register */
103 #define OSCCAL _SFR_IO8(0x31)
104 
105 /* Timer/Counter0 (8-bit) */
106 #define TCNT0 _SFR_IO8(0x32)
107 
108 /* Timer/Counter0 Control Register */
109 #define TCCR0 _SFR_IO8(0x33)
110 
111 /* MCU general Status Register */
112 #define MCUSR _SFR_IO8(0x34)
113 
114 /* MCU general Control Register */
115 #define MCUCR _SFR_IO8(0x35)
116 
117 /* 0x36..0x37 reserved */
118 
119 /* Timer/Counter Interrupt Flag Register */
120 #define TIFR _SFR_IO8(0x38)
121 
122 /* Timer/Counter Interrupt MaSK Register */
123 #define TIMSK _SFR_IO8(0x39)
124 
125 /* General Interrupt Flag Register */
126 #define GIFR _SFR_IO8(0x3A)
127 
128 /* General Interrupt MaSK register */
129 #define GIMSK _SFR_IO8(0x3B)
130 
131 /* 0x3C..0x3E reserved */
132 
133 /* 0x3F SREG */
134 
135 /* Interrupt vectors */
136 
137 /* External Interrupt 0 */
138 #define INT0_vect _VECTOR(1)
139 #define SIG_INTERRUPT0 _VECTOR(1)
140 
141 /* External Interrupt Request 0 */
142 #define IO_PINS_vect _VECTOR(2)
143 #define SIG_PIN _VECTOR(2)
144 #define SIG_PIN_CHANGE _VECTOR(2)
145 
146 /* Timer/Counter0 Overflow */
147 #define TIMER0_OVF_vect _VECTOR(3)
148 #define SIG_OVERFLOW0 _VECTOR(3)
149 
150 /* EEPROM Ready */
151 #define EE_RDY_vect _VECTOR(4)
152 #define SIG_EEPROM_READY _VECTOR(4)
153 
154 /* Analog Comparator */
155 #define ANA_COMP_vect _VECTOR(5)
156 #define SIG_COMPARATOR _VECTOR(5)
157 
158 #define _VECTORS_SIZE 12
159 
160 /* Bit numbers */
161 
162 /* GIMSK */
163 #define INT0 6
164 #define PCIE 5
165 
166 /* GIFR */
167 #define INTF0 6
168 #define PCIF 5
169 
170 /* TIMSK */
171 #define TOIE0 1
172 
173 /* TIFR */
174 #define TOV0 1
175 
176 /* MCUCR */
177 #define PUD 6
178 #define SE 5
179 #define SM 4
180 #define ISC01 1
181 #define ISC00 0
182 
183 /* TCCR0 */
184 #define CS02 2
185 #define CS01 1
186 #define CS00 0
187 
188 /* WDTCR */
189 #define WDTOE 4
190 #define WDE 3
191 #define WDP2 2
192 #define WDP1 1
193 #define WDP0 0
194 
195 /*
196  PB5 = RESET#
197  PB4 = XTAL2
198  PB3 = XTAL1
199  PB2 = T0 / SCK
200  PB1 = INT0 / AIN1 / MISO
201  PB0 = AIN0 / MOSI
202  */
203 
204 /* PORTB */
205 #define PB4 4
206 #define PB3 3
207 #define PB2 2
208 #define PB1 1
209 #define PB0 0
210 
211 /* DDRB */
212 #define DDB5 5
213 #define DDB4 4
214 #define DDB3 3
215 #define DDB2 2
216 #define DDB1 1
217 #define DDB0 0
218 
219 /* PINB */
220 #define PINB5 5
221 #define PINB4 4
222 #define PINB3 3
223 #define PINB2 2
224 #define PINB1 1
225 #define PINB0 0
226 
227 /* ACSR */
228 #define ACD 7
229 #define AINBG 6
230 #define ACO 5
231 #define ACI 4
232 #define ACIE 3
233 #define ACIS1 1
234 #define ACIS0 0
235 
236 /* EEPROM Control Register */
237 #define EERIE 3
238 #define EEMWE 2
239 #define EEWE 1
240 #define EERE 0
241 
242 /* Last memory addresses */
243 #define RAMEND 0x1F
244 #define XRAMEND 0x0
245 #define E2END 0x3F
246 #define E2PAGESIZE 2
247 #define FLASHEND 0x3FF
248 
249 
250 /* Fuses */
251 
252 #define FUSE_MEMORY_SIZE 1
253 
254 /* Low Fuse Byte */
255 #define FUSE_CKSEL0 (unsigned char)~_BV(0)
256 #define FUSE_CKSEL1 (unsigned char)~_BV(1)
257 #define FUSE_CKSEL2 (unsigned char)~_BV(2)
258 #define FUSE_CKSEL3 (unsigned char)~_BV(3)
259 #define FUSE_RSTDISBL (unsigned char)~_BV(4)
260 #define FUSE_SPIEN (unsigned char)~_BV(5)
261 #define FUSE_BODEN (unsigned char)~_BV(6)
262 #define FUSE_BODLEVEL (unsigned char)~_BV(7)
263 #define FUSE_DEFAULT (FUSE_CKSEL0 & FUSE_CKSEL2 & FUSE_CKSEL3 & FUSE_SPIEN & FUSE_BODLEVEL)
264 
265 
266 /* Lock Bits */
267 #define __LOCK_BITS_EXIST
268 
269 
270 /* Signature */
271 #define SIGNATURE_0 0x1E
272 #define SIGNATURE_1 0x90
273 #define SIGNATURE_2 0x05
274 
276 #endif /* _AVR_IOTN12_H_ */