RTEMS CPU Kit with SuperCore  4.11.3
io76c711.h
Go to the documentation of this file.
1 
9 /* Copyright (c) 2002, Marek Michalkiewicz
10  All rights reserved.
11 
12  Redistribution and use in source and binary forms, with or without
13  modification, are permitted provided that the following conditions are met:
14 
15  * Redistributions of source code must retain the above copyright
16  notice, this list of conditions and the following disclaimer.
17 
18  * Redistributions in binary form must reproduce the above copyright
19  notice, this list of conditions and the following disclaimer in
20  the documentation and/or other materials provided with the
21  distribution.
22 
23  * Neither the name of the copyright holders nor the names of
24  contributors may be used to endorse or promote products derived
25  from this software without specific prior written permission.
26 
27  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37  POSSIBILITY OF SUCH DAMAGE. */
38 
39 
40 /* avr/io76c711.h - definitions for AT76C711 */
41 
42 #ifndef _AVR_IO76C711_H_
43 #define _AVR_IO76C711_H_ 1
44 
45 /* This file should only be included from <avr/io.h>, never directly. */
46 
47 #ifndef _AVR_IO_H_
48 # error "Include <avr/io.h> instead of this file."
49 #endif
50 
51 #ifndef _AVR_IOXXX_H_
52 # define _AVR_IOXXX_H_ "io76c711.h"
53 #else
54 # error "Attempt to include more than one <avr/ioXXX.h> file."
55 #endif
56 
65 /* I/O registers */
66 
67 /* 0x00-0x0C reserved */
68 
69 /* SPI */
70 #define SPCR _SFR_IO8(0x0D)
71 #define SPSR _SFR_IO8(0x0E)
72 #define SPDR _SFR_IO8(0x0F)
73 
74 /* Port D */
75 #define PIND _SFR_IO8(0x10)
76 #define DDRD _SFR_IO8(0x11)
77 #define PORTD _SFR_IO8(0x12)
78 
79 /* Peripheral Enable Register */
80 #define PERIPHEN _SFR_IO8(0x13)
81 
82 /* Clock Control Register */
83 #define CLK_CNTR _SFR_IO8(0x14)
84 
85 /* Data Register, Port C */
86 #define PORTC _SFR_IO8(0x15)
87 
88 /* Port B */
89 #define PINB _SFR_IO8(0x16)
90 #define DDRB _SFR_IO8(0x17)
91 #define PORTB _SFR_IO8(0x18)
92 
93 /* Port A */
94 #define PINA _SFR_IO8(0x19)
95 #define DDRA _SFR_IO8(0x1A)
96 #define PORTA _SFR_IO8(0x1B)
97 
98 /* 0x1C-0x1F reserved */
99 
100 #define IRDAMOD _SFR_IO8(0x20)
101 
102 #define WDTCR _SFR_IO8(0x21)
103 
104 /* 0x22-0x25 reserved */
105 /* Timer 1 */
106 #define ICR1 _SFR_IO16(0x26)
107 #define ICR1L _SFR_IO8(0x26)
108 #define ICR1H _SFR_IO8(0x27)
109 #define OCR1B _SFR_IO16(0x28)
110 #define OCR1BL _SFR_IO8(0x28)
111 #define OCR1BH _SFR_IO8(0x29)
112 #define OCR1A _SFR_IO16(0x2A)
113 #define OCR1AL _SFR_IO8(0x2A)
114 #define OCR1AH _SFR_IO8(0x2B)
115 #define TCNT1 _SFR_IO16(0x2C)
116 #define TCNT1L _SFR_IO8(0x2C)
117 #define TCNT1H _SFR_IO8(0x2D)
118 #define TCCR1B _SFR_IO8(0x2E)
119 #define TCCR1A _SFR_IO8(0x2F)
120 
121 /* 0x30 reserved */
122 
123 /* Timer 0 */
124 #define PRELD _SFR_IO8(0x31)
125 #define TCNT0 _SFR_IO8(0x32)
126 #define TCCR0 _SFR_IO8(0x33)
127 
128 #define MCUSR _SFR_IO8(0x34)
129 #define MCUCR _SFR_IO8(0x35)
130 
131 #define TIFR _SFR_IO8(0x36)
132 #define TIMSK _SFR_IO8(0x37)
133 
134 /* 0x38 reserved */
135 
136 #define EIMSK _SFR_IO8(0x39)
137 
138 /* 0x3A-0x3C reserved */
139 
140 /* 0x3D..0x3E SP */
141 
142 /* 0x3F SREG */
143 
144 /* Interrupt vectors */
145 
146 #define SIG_SUSPEND_RESUME _VECTOR(1)
147 #define SIG_INTERRUPT0 _VECTOR(2)
148 #define SIG_INPUT_CAPTURE1 _VECTOR(3)
149 #define SIG_OUTPUT_COMPARE1A _VECTOR(4)
150 #define SIG_OUTPUT_COMPARE1B _VECTOR(5)
151 #define SIG_OVERFLOW1 _VECTOR(6)
152 #define SIG_OVERFLOW0 _VECTOR(7)
153 #define SIG_SPI _VECTOR(8)
154 #define SIG_TDMAC _VECTOR(9)
155 #define SIG_UART0 _VECTOR(10)
156 #define SIG_RDMAC _VECTOR(11)
157 #define SIG_USB_HW _VECTOR(12)
158 #define SIG_UART1 _VECTOR(13)
159 #define SIG_INTERRUPT1 _VECTOR(14)
160 
161 #define _VECTORS_SIZE 60
162 
163 /* Bit numbers */
164 
165 /* EIMSK */
166 /* bits 7-4 reserved */
167 #define POL1 3
168 #define POL0 2
169 #define INT1 1
170 #define INT0 0
171 
172 /* TIMSK */
173 #define TOIE1 7
174 #define OCIE1A 6
175 #define OCIE1B 5
176 /* bit 4 reserved */
177 #define TICIE1 3
178 /* bit 2 reserved */
179 #define TOIE0 1
180 /* bit 0 reserved */
181 
182 /* TIFR */
183 #define TOV1 7
184 #define OCF1A 6
185 #define OCF1B 5
186 /* bit 4 reserved */
187 #define ICF1 3
188 /* bit 2 reserved */
189 #define TOV0 1
190 /* bit 0 reserved */
191 
192 /* MCUCR */
193 /* bits 7-6 reserved */
194 #define SE 5
195 #define SM1 4
196 #define SM0 3
197 /* bits 2-0 reserved */
198 
199 /* MCUSR */
200 /* bits 7-2 reserved */
201 #define EXTRF 1
202 #define PORF 0
203 
204 /* TCCR0 */
205 /* bits 7-6 reserved */
206 #define COM01 5
207 #define COM00 4
208 #define CTC0 3
209 #define CS02 2
210 #define CS01 1
211 #define CS00 0
212 
213 /* TCCR1A */
214 #define COM1A1 7
215 #define COM1A0 6
216 #define COM1B1 5
217 #define COM1B0 4
218 /* bits 3-0 reserved */
219 
220 /* TCCR1B */
221 #define ICNC1 7
222 #define ICES1 6
223 /* bits 5-4 reserved */
224 #define CTC1 3
225 #define CS12 2
226 #define CS11 1
227 #define CS10 0
228 
229 /* WDTCR */
230 /* bits 7-5 reserved */
231 #define WDTOE 4
232 #define WDE 3
233 #define WDP2 2
234 #define WDP1 1
235 #define WDP0 0
236 
237 /* IRDAMOD */
238 /* bits 7-3 reserved */
239 #define POL 2
240 #define MODE 1
241 #define EN 0
242 
243 /* PORTA */
244 #define PA7 7
245 #define PA6 6
246 #define PA5 5
247 #define PA4 4
248 #define PA3 3
249 #define PA2 2
250 #define PA1 1
251 #define PA0 0
252 
253 /* DDRA */
254 #define DDA7 7
255 #define DDA6 6
256 #define DDA5 5
257 #define DDA4 4
258 #define DDA3 3
259 #define DDA2 2
260 #define DDA1 1
261 #define DDA0 0
262 
263 /* PINA */
264 #define PINA7 7
265 #define PINA6 6
266 #define PINA5 5
267 #define PINA4 4
268 #define PINA3 3
269 #define PINA2 2
270 #define PINA1 1
271 #define PINA0 0
272 
273 /*
274  PB7 = SCK
275  PB6 = MISO
276  PB5 = MOSI
277  PB4 = SS#
278  PB2 = ICP
279  PB1 = T1
280  PB0 = T0
281  */
282 
283 /* PORTB */
284 #define PB7 7
285 #define PB6 6
286 #define PB5 5
287 #define PB4 4
288 #define PB3 3
289 #define PB2 2
290 #define PB1 1
291 #define PB0 0
292 
293 /* DDRB */
294 #define DDB7 7
295 #define DDB6 6
296 #define DDB5 5
297 #define DDB4 4
298 #define DDB3 3
299 #define DDB2 2
300 #define DDB1 1
301 #define DDB0 0
302 
303 /* PINB */
304 #define PINB7 7
305 #define PINB6 6
306 #define PINB5 5
307 #define PINB4 4
308 #define PINB3 3
309 #define PINB2 2
310 #define PINB1 1
311 #define PINB0 0
312 
313 /* PORTC */
314 /* bits 7-4 reserved */
315 #define PC3 3
316 #define PC2 2
317 #define PC1 1
318 #define PC0 0
319 
320 /*
321  PD7 = INT1 / OC1B
322  PD6 = INT0 / OC1A
323  PD1 = TXD
324  PD0 = RXD
325  */
326 
327 /* PORTD */
328 #define PD7 7
329 #define PD6 6
330 #define PD5 5
331 #define PD4 4
332 #define PD3 3
333 #define PD2 2
334 #define PD1 1
335 #define PD0 0
336 
337 /* DDRD */
338 #define DDD7 7
339 #define DDD6 6
340 #define DDD5 5
341 #define DDD4 4
342 #define DDD3 3
343 #define DDD2 2
344 #define DDD1 1
345 #define DDD0 0
346 
347 /* PIND */
348 #define PIND7 7
349 #define PIND6 6
350 #define PIND5 5
351 #define PIND4 4
352 #define PIND3 3
353 #define PIND2 2
354 #define PIND1 1
355 #define PIND0 0
356 
357 /* CLK_CNTR */
358 /* bits 7-5 reserved */
359 #define UOSC 4
360 #define UCK 3
361 #define IRCK 2
362 /* bits 1-0 reserved */
363 
364 /* PERIPHEN */
365 /* bits 7-3 reserved */
366 #define IRDA 2
367 #define UART 1
368 #define USB 0
369 
370 /* SPSR */
371 #define SPIF 7
372 #define WCOL 6
373 /* bits 5-0 reserved */
374 
375 /* SPCR */
376 #define SPIE 7
377 #define SPE 6
378 #define DORD 5
379 #define MSTR 4
380 #define CPOL 3
381 #define CPHA 2
382 #define SPR1 1
383 #define SPR0 0
384 
385 /* Memory mapped registers (XXX - not yet changed to use _SFR_MEM8() macros) */
386 
387 /* UART */
388 #define UART0_BASE 0x2020
389 #define UART1_BASE 0x2030
390 /* offsets from the base address */
391 #define US_RHR 0x00
392 #define US_THR 0x00
393 #define US_IER 0x01
394 #define US_FCR 0x02
395 #define US_PMR 0x03
396 #define US_MR 0x04
397 #define US_CSR 0x05
398 #define US_CR 0x06
399 #define US_BL 0x07
400 #define US_BM 0x08
401 #define US_RTO 0x09
402 #define US_TTG 0x0A
403 
404 /* DMA */
405 #define DMA_BASE 0x2000
406 /* offsets from the base address */
407 #define TXTADL 0x01
408 #define TXPLL 0x03
409 #define TXPLM 0x04
410 #define TXTPLL 0x05
411 #define TXTPLM 0x06
412 #define RXTADL 0x07
413 #define RXTADMEN 0x08
414 #define RSPLL 0x09
415 #define RXPLM 0x0A
416 #define RXTPLL 0x0B
417 #define RXTPLM 0x0C
418 #define INTCST 0x0D
419 /* XXX DPORG register mentioned on page 20, but undocumented */
420 
421 /* XXX Program Memory Control Bit mentioned on page 20, but undocumented */
422 #define PROGRAM_MEMORY_CONTROL_BIT 0x2040
423 
424 /* USB */
425 #define USB_BASE 0x1000
426 /* offsets from the base address */
427 #define FRM_NUM_H 0x0FD
428 #define FRM_NUM_L 0x0FC
429 #define GLB_STATE 0x0FB
430 #define SPRSR 0x0FA
431 #define SPRSIE 0x0F9
432 #define UISR 0x0F7
433 #define UIAR 0x0F5
434 #define FADDR 0x0F2
435 #define ENDPPGPG 0x0F1
436 #define ECR0 0x0EF
437 #define ECR1 0x0EE
438 #define ECR2 0x0ED
439 #define ECR3 0x0EC
440 #define ECR4 0x0EB
441 #define ECR5 0x0EA
442 #define ECR6 0x0E9
443 #define ECR7 0x0E8
444 #define CSR0 0x0DF
445 #define CSR1 0x0DE
446 #define CSR2 0x0DD
447 #define CSR3 0x0DC
448 #define CSR4 0x0DB
449 #define CSR5 0x0DA
450 #define CSR6 0x0D9
451 #define CSR7 0x0D8
452 #define FDR0 0x0CF
453 #define FDR1 0x0CE
454 #define FDR2 0x0CD
455 #define FDR3 0x0CC
456 #define FDR4 0x0CB
457 #define FDR5 0x0CA
458 #define FDR6 0x0C9
459 #define FDR7 0x0C8
460 #define FBYTE_CNT0_L 0x0BF
461 #define FBYTE_CNT1_L 0x0BE
462 #define FBYTE_CNT2_L 0x0BD
463 #define FBYTE_CNT3_L 0x0BC
464 #define FBYTE_CNT4_L 0x0BB
465 #define FBYTE_CNT5_L 0x0BA
466 #define FBYTE_CNT6_L 0x0B9
467 #define FBYTE_CNT7_L 0x0B8
468 #define FBYTE_CNT0_H 0x0AF
469 #define FBYTE_CNT1_H 0x0AE
470 #define FBYTE_CNT2_H 0x0AD
471 #define FBYTE_CNT3_H 0x0AC
472 #define FBYTE_CNT4_H 0x0AB
473 #define FBYTE_CNT5_H 0x0AA
474 #define FBYTE_CNT6_H 0x0A9
475 #define FBYTE_CNT7_H 0x0A8
476 #define SLP_MD_EN 0x100
477 #define IRQ_EN 0x101
478 #define IRQ_STAT 0x102
479 #define SUSP_WUP 0x103
480 #define PA_EN 0x104
481 #define USB_DMA_ADL 0x105
482 #define USB_DMA_ADH 0x106
483 #define USB_DMA_PLR 0x107
484 #define USB_DMA_EAD 0x108
485 #define USB_DMA_PLT 0x109
486 #define USB_DMA_EN 0x10A
487 
488 /* Last memory addresses */
489 #define RAMEND 0x07FF
490 #define XRAMEND RAMEND
491 #define E2END 0
492 #define FLASHEND 0x3FFF
493 
494 /*
495  AT76C711 data space memory map (ranges not listed are reserved):
496  0x0000 - 0x001F - AVR registers
497  0x0020 - 0x005F - AVR I/O space
498  0x0060 - 0x07FF - AVR data SRAM
499  0x1000 - 0x1FFF - USB (not all locations used)
500  0x2000 - 0x201F - DMA controller
501  0x2020 - 0x202F - UART0
502  0x2030 - 0x203F - UART1 (IRDA)
503  0x2040 - the mysterious Program Memory Control bit (???)
504  0x3000 - 0x37FF - DPRAM
505  0x8000 - 0xBFFF - program SRAM (read/write), would be nice if other
506  AVR devices did that as well (no need to use LPM!)
507  */
508 
511 #endif /* _AVR_IO76C711_H_ */