RTEMS CPU Kit with SuperCore  4.11.3
ioat94k.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2002 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_IOAT94K_H_
42 #define _AVR_IOAT94K_H_ 1
43 
44 #ifndef _AVR_IO_H_
45 # error "Include <avr/io.h> instead of this file."
46 #endif
47 
48 #ifndef _AVR_IOXXX_H_
49 # define _AVR_IOXXX_H_ "ioat94k.h"
50 #else
51 # error "Attempt to include more than one <avr/ioXXX.h> file."
52 #endif
53 
61 /* I/O registers */
62 
63 /* UART1 Baud Rate Register */
64 #define UBRR1 _SFR_IO8(0x00)
65 
66 /* UART1 Control and Status Registers */
67 #define UCSR1B _SFR_IO8(0x01)
68 #define UCSR1A _SFR_IO8(0x02)
69 
70 /* UART1 I/O Data Register */
71 #define UDR1 _SFR_IO8(0x03)
72 
73 /* 0x04 reserved */
74 
75 /* Input Pins, Port E */
76 #define PINE _SFR_IO8(0x05)
77 
78 /* Data Direction Register, Port E */
79 #define DDRE _SFR_IO8(0x06)
80 
81 /* Data Register, Port E */
82 #define PORTE _SFR_IO8(0x07)
83 
84 /* On Chip Debug Register (reserved) */
85 #define OCDR _SFR_IO8(0x08)
86 
87 /* UART0 Baud Rate Register */
88 #define UBRR0 _SFR_IO8(0x09)
89 
90 /* UART0 Control and Status Registers */
91 #define UCSR0B _SFR_IO8(0x0A)
92 #define UCSR0A _SFR_IO8(0x0B)
93 
94 /* UART0 I/O Data Register */
95 #define UDR0 _SFR_IO8(0x0C)
96 
97 /* 0x0D..0x0F reserved */
98 
99 /* Input Pins, Port D */
100 #define PIND _SFR_IO8(0x10)
101 
102 /* Data Direction Register, Port D */
103 #define DDRD _SFR_IO8(0x11)
104 
105 /* Data Register, Port D */
106 #define PORTD _SFR_IO8(0x12)
107 
108 /* FPGA I/O Select Control Register */
109 #define FISCR _SFR_IO8(0x13)
110 
111 /* FPGA I/O Select Registers A, B, C, D */
112 #define FISUA _SFR_IO8(0x14)
113 #define FISUB _SFR_IO8(0x15)
114 #define FISUC _SFR_IO8(0x16)
115 #define FISUD _SFR_IO8(0x17)
116 
117 /* FPGA Cache Logic(R) registers (top secret, under NDA) */
118 #define FPGAX _SFR_IO8(0x18)
119 #define FPGAY _SFR_IO8(0x19)
120 #define FPGAZ _SFR_IO8(0x1A)
121 #define FPGAD _SFR_IO8(0x1B)
122 
123 /* TWI stands for "Two Wire Interface" or "TWI Was I2C(tm)" */
124 
125 /* 2-wire Serial Bit Rate Register */
126 #define TWBR _SFR_IO8(0x1C)
127 
128 /* 2-wire Serial Status Register */
129 #define TWSR _SFR_IO8(0x1D)
130 
131 /* 2-wire Serial (Slave) Address Register */
132 #define TWAR _SFR_IO8(0x1E)
133 
134 /* 2-wire Serial Data Register */
135 #define TWDR _SFR_IO8(0x1F)
136 
137 /* UART Baud Register High */
138 #define UBRRH _SFR_IO8(0x20)
139 #define UBRRHI UBRRH /* New name in datasheet (1138F-FPSLI-06/02) */
140 
141 /* Watchdog Timer Control Register */
142 #define WDTCR _SFR_IO8(0x21)
143 
144 /* Timer/Counter2 Output Compare Register */
145 #define OCR2 _SFR_IO8(0x22)
146 
147 /* Timer/Counter2 (8-bit) */
148 #define TCNT2 _SFR_IO8(0x23)
149 
150 /* Timer/Counter1 Input Capture Register */
151 #define ICR1 _SFR_IO16(0x24)
152 #define ICR1L _SFR_IO8(0x24)
153 #define ICR1H _SFR_IO8(0x25)
154 
155 /* Asynchronous mode StatuS Register */
156 #define ASSR _SFR_IO8(0x26)
157 
158 /* Timer/Counter2 Control Register */
159 #define TCCR2 _SFR_IO8(0x27)
160 
161 /* Timer/Counter1 Output Compare RegisterB */
162 #define OCR1B _SFR_IO16(0x28)
163 #define OCR1BL _SFR_IO8(0x28)
164 #define OCR1BH _SFR_IO8(0x29)
165 
166 /* Timer/Counter1 Output Compare RegisterA */
167 #define OCR1A _SFR_IO16(0x2A)
168 #define OCR1AL _SFR_IO8(0x2A)
169 #define OCR1AH _SFR_IO8(0x2B)
170 
171 /* Timer/Counter1 */
172 #define TCNT1 _SFR_IO16(0x2C)
173 #define TCNT1L _SFR_IO8(0x2C)
174 #define TCNT1H _SFR_IO8(0x2D)
175 
176 /* Timer/Counter1 Control Register B */
177 #define TCCR1B _SFR_IO8(0x2E)
178 
179 /* Timer/Counter1 Control Register A */
180 #define TCCR1A _SFR_IO8(0x2F)
181 
182 /* Special Function IO Register */
183 #define SFIOR _SFR_IO8(0x30)
184 
185 /* Timer/Counter0 Output Compare Register */
186 #define OCR0 _SFR_IO8(0x31)
187 
188 /* Timer/Counter0 (8-bit) */
189 #define TCNT0 _SFR_IO8(0x32)
190 
191 /* Timer/Counter0 Control Register */
192 #define TCCR0 _SFR_IO8(0x33)
193 
194 /* 0x34 reserved */
195 
196 /* MCU Control/Status Register */
197 #define MCUR _SFR_IO8(0x35)
198 
199 /* 2-wire Serial Control Register */
200 #define TWCR _SFR_IO8(0x36)
201 
202 /* 0x37 reserved */
203 
204 /* Timer/Counter Interrupt Flag Register */
205 #define TIFR _SFR_IO8(0x38)
206 
207 /* Timer/Counter Interrupt MaSK Register */
208 #define TIMSK _SFR_IO8(0x39)
209 
210 /* Software Control Register */
211 #define SFTCR _SFR_IO8(0x3A)
212 
213 /* External Interrupt Mask/Flag Register */
214 #define EIMF _SFR_IO8(0x3B)
215 
216 /* 0x3C reserved */
217 
218 /* 0x3D..0x3E SP */
219 
220 /* 0x3F SREG */
221 
222 /* Interrupt vectors */
223 
224 #define SIG_FPGA_INTERRUPT0 _VECTOR(1) /* FPGA_INT0 */
225 #define SIG_INTERRUPT0 _VECTOR(2) /* EXT_INT0 */
226 #define SIG_FPGA_INTERRUPT1 _VECTOR(3) /* FPGA_INT1 */
227 #define SIG_INTERRUPT1 _VECTOR(4) /* EXT_INT1 */
228 #define SIG_FPGA_INTERRUPT2 _VECTOR(5) /* FPGA_INT2 */
229 #define SIG_INTERRUPT2 _VECTOR(6) /* EXT_INT2 */
230 #define SIG_FPGA_INTERRUPT3 _VECTOR(7) /* FPGA_INT3 */
231 #define SIG_INTERRUPT3 _VECTOR(8) /* EXT_INT3 */
232 #define SIG_OUTPUT_COMPARE2 _VECTOR(9) /* TIM2_COMP */
233 #define SIG_OVERFLOW2 _VECTOR(10) /* TIM2_OVF */
234 #define SIG_INPUT_CAPTURE1 _VECTOR(11) /* TIM1_CAPT */
235 #define SIG_OUTPUT_COMPARE1A _VECTOR(12) /* TIM1_COMPA */
236 #define SIG_OUTPUT_COMPARE1B _VECTOR(13) /* TIM1_COMPB */
237 #define SIG_OVERFLOW1 _VECTOR(14) /* TIM1_OVF */
238 #define SIG_OUTPUT_COMPARE0 _VECTOR(15) /* TIM0_COMP */
239 #define SIG_OVERFLOW0 _VECTOR(16) /* TIM0_OVF */
240 #define SIG_FPGA_INTERRUPT4 _VECTOR(17) /* FPGA_INT4 */
241 #define SIG_FPGA_INTERRUPT5 _VECTOR(18) /* FPGA_INT5 */
242 #define SIG_FPGA_INTERRUPT6 _VECTOR(19) /* FPGA_INT6 */
243 #define SIG_FPGA_INTERRUPT7 _VECTOR(20) /* FPGA_INT7 */
244 #define SIG_UART0_RECV _VECTOR(21) /* UART0_RXC */
245 #define SIG_UART0_DATA _VECTOR(22) /* UART0_DRE */
246 #define SIG_UART0_TRANS _VECTOR(23) /* UART0_TXC */
247 #define SIG_FPGA_INTERRUPT8 _VECTOR(24) /* FPGA_INT8 */
248 #define SIG_FPGA_INTERRUPT9 _VECTOR(25) /* FPGA_INT9 */
249 #define SIG_FPGA_INTERRUPT10 _VECTOR(26) /* FPGA_INT10 */
250 #define SIG_FPGA_INTERRUPT11 _VECTOR(27) /* FPGA_INT11 */
251 #define SIG_UART1_RECV _VECTOR(28) /* UART1_RXC */
252 #define SIG_UART1_DATA _VECTOR(29) /* UART1_DRE */
253 #define SIG_UART1_TRANS _VECTOR(30) /* UART1_TXC */
254 #define SIG_FPGA_INTERRUPT12 _VECTOR(31) /* FPGA_INT12 */
255 #define SIG_FPGA_INTERRUPT13 _VECTOR(32) /* FPGA_INT13 */
256 #define SIG_FPGA_INTERRUPT14 _VECTOR(33) /* FPGA_INT14 */
257 #define SIG_FPGA_INTERRUPT15 _VECTOR(34) /* FPGA_INT15 */
258 #define SIG_2WIRE_SERIAL _VECTOR(35) /* TWS_INT */
259 
260 #define _VECTORS_SIZE 144
261 
262 /* Bit numbers (SFRs alphabetically sorted) */
263 
264 /* ASSR */
265 #define AS2 3
266 #define TCN2UB 2
267 #define OCR2UB 1
268 #define TCR2UB 0
269 
270 /* DDRD */
271 #define DDD7 7
272 #define DDD6 6
273 #define DDD5 5
274 #define DDD4 4
275 #define DDD3 3
276 #define DDD2 2
277 #define DDD1 1
278 #define DDD0 0
279 
280 /* DDRE */
281 #define DDE7 7
282 #define DDE6 6
283 #define DDE5 5
284 #define DDE4 4
285 #define DDE3 3
286 #define DDE2 2
287 #define DDE1 1
288 #define DDE0 0
289 
290 /* EIMF */
291 #define INTF3 7
292 #define INTF2 6
293 #define INTF1 5
294 #define INTF0 4
295 #define INT3 3
296 #define INT2 2
297 #define INT1 1
298 #define INT0 0
299 
300 /* FISCR */
301 #define FIADR 7
302 #define XFIS1 1
303 #define XFIS0 0
304 
305 /* FISUA */
306 #define FIF3 7
307 #define FIF2 6
308 #define FIF1 5
309 #define FIF0 4
310 #define FINT3 3
311 #define FINT2 2
312 #define FINT1 1
313 #define FINT0 0
314 
315 /* FISUB */
316 #define FIF7 7
317 #define FIF6 6
318 #define FIF5 5
319 #define FIF4 4
320 #define FINT7 3
321 #define FINT6 2
322 #define FINT5 1
323 #define FINT4 0
324 
325 /* FISUC */
326 #define FIF11 7
327 #define FIF10 6
328 #define FIF9 5
329 #define FIF8 4
330 #define FINT11 3
331 #define FINT10 2
332 #define FINT9 1
333 #define FINT8 0
334 
335 /* FISUD */
336 #define FIF15 7
337 #define FIF14 6
338 #define FIF13 5
339 #define FIF12 4
340 #define FINT15 3
341 #define FINT14 2
342 #define FINT13 1
343 #define FINT12 0
344 
345 /* MCUR */
346 #define JTRF 7
347 #define JTD 6
348 #define SE 5
349 #define SM1 4
350 #define SM0 3
351 #define PORF 2
352 #define WDRF 1
353 #define EXTRF 0
354 
355 /* OCDR (reserved) */
356 #define IDRD 7
357 
358 /* PIND */
359 #define PIND7 7
360 #define PIND6 6
361 #define PIND5 5
362 #define PIND4 4
363 #define PIND3 3
364 #define PIND2 2
365 #define PIND1 1
366 #define PIND0 0
367 
368 /* PINE */
369 #define PINE7 7
370 #define PINE6 6
371 #define PINE5 5
372 #define PINE4 4
373 #define PINE3 3
374 #define PINE2 2
375 #define PINE1 1
376 #define PINE0 0
377 
378 /* PORTD */
379 #define PD7 7
380 #define PD6 6
381 #define PD5 5
382 #define PD4 4
383 #define PD3 3
384 #define PD2 2
385 #define PD1 1
386 #define PD0 0
387 
388 /* PORTE */
389 /*
390  PE7 = IC1 / INT3 (alternate)
391  PE6 = OC1A / INT2 (alternate)
392  PE5 = OC1B / INT1 (alternate)
393  PE4 = ET11 / INT0 (alternate)
394  PE3 = OC2 / RX1 (alternate)
395  PE2 = / TX1 (alternate)
396  PE1 = OC0 / RX0 (alternate)
397  PE0 = ET0 / TX0 (alternate)
398  */
399 #define PE7 7
400 #define PE6 6
401 #define PE5 5
402 #define PE4 4
403 #define PE3 3
404 #define PE2 2
405 #define PE1 1
406 #define PE0 0
407 
408 /* SFIOR */
409 #define PSR2 1
410 #define PSR10 0
411 
412 /* SFTCR */
413 #define FMXOR 3
414 #define WDTS 2
415 #define DBG 1
416 #define SRST 0
417 
418 /* TCCR0 */
419 #define FOC0 7
420 #define PWM0 6
421 #define COM01 5
422 #define COM00 4
423 #define CTC0 3
424 #define CS02 2
425 #define CS01 1
426 #define CS00 0
427 
428 /* TCCR1A */
429 #define COM1A1 7
430 #define COM1A0 6
431 #define COM1B1 5
432 #define COM1B0 4
433 #define FOC1A 3
434 #define FOC1B 2
435 #define PWM11 1
436 #define PWM10 0
437 
438 /* TCCR1B */
439 #define ICNC1 7
440 #define ICES1 6
441 #define ICPE 5
442 #define CTC1 3
443 #define CS12 2
444 #define CS11 1
445 #define CS10 0
446 
447 /* TCCR2 */
448 #define FOC2 7
449 #define PWM2 6
450 #define COM21 5
451 #define COM20 4
452 #define CTC2 3
453 #define CS22 2
454 #define CS21 1
455 #define CS20 0
456 
457 /* TIFR */
458 #define TOV1 7
459 #define OCF1A 6
460 #define OCF1B 5
461 #define TOV2 4
462 #define ICF1 3
463 #define OCF2 2
464 #define TOV0 1
465 #define OCF0 0
466 
467 /* TIMSK */
468 #define TOIE1 7
469 #define OCIE1A 6
470 #define OCIE1B 5
471 #define TOIE2 4
472 #define TICIE1 3
473 #define OCIE2 2
474 #define TOIE0 1
475 #define OCIE0 0
476 
477 /* TWAR */
478 /* #define TWA 1 */ /* TWA is bits 7:1 */
479 #define TWGCE 0
480 
481 /* TWCR */
482 #define TWINT 7
483 #define TWEA 6
484 #define TWSTA 5
485 #define TWSTO 4
486 #define TWWC 3
487 #define TWEN 2
488 #define TWIE 0
489 
490 /* TWSR */
491 #define TWS7 7
492 #define TWS6 6
493 #define TWS5 5
494 #define TWS4 4
495 #define TWS3 3
496 
497 /* UBRRHI
498  Bits 11..8 of UART1 are bits 7..4 of UBRRHI.
499  Bits 11..8 of UART0 are bits 3..0 of UBRRHI. */
500 /* #define UBRRHI1 4 */
501 /* #define UBRRHI0 0 */
502 
503 /* UCSR0A */
504 #define RXC0 7
505 #define TXC0 6
506 #define UDRE0 5
507 #define FE0 4
508 #define OR0 3
509 #define U2X0 1
510 #define MPCM0 0
511 
512 /* UCSR0B */
513 #define RXCIE0 7
514 #define TXCIE0 6
515 #define UDRIE0 5
516 #define RXEN0 4
517 #define TXEN0 3
518 #define CHR90 2
519 #define RXB80 1
520 #define TXB80 0
521 
522 /* UCSR1A */
523 #define RXC1 7
524 #define TXC1 6
525 #define UDRE1 5
526 #define FE1 4
527 #define OR1 3
528 #define U2X1 1
529 #define MPCM1 0
530 
531 /* UCSR1B */
532 #define RXCIE1 7
533 #define TXCIE1 6
534 #define UDRIE1 5
535 #define RXEN1 4
536 #define TXEN1 3
537 #define CHR91 2
538 #define RXB81 1
539 #define TXB81 0
540 
541 /* WDTCR */
542 #define WDTOE 4
543 #define WDE 3
544 #define WDP2 2
545 #define WDP1 1
546 #define WDP0 0
547 
548 /*
549  Last memory addresses - depending on configuration, it is possible
550  to have 20K-32K of program memory and 4K-16K of data memory
551  (all in the same 36K total of SRAM, loaded from external EEPROM).
552  */
553 
554 #ifndef RAMEND
555 #define RAMEND 0x0FFF
556 #endif
557 
558 #ifndef XRAMEND
559 #define XRAMEND RAMEND
560 #endif
561 
562 #define E2END 0
563 
564 #ifndef FLASHEND
565 #define FLASHEND 0x7FFF
566 #endif
567 
569 #endif /* _AVR_IOAT94K_H_ */