source: rtems/cpukit/score/cpu/avr/avr/iom8535.h @ 04a62dce

4.104.115
Last change on this file since 04a62dce was 04a62dce, checked in by Joel Sherrill <joel.sherrill@…>, on 08/06/09 at 14:52:07

2009-08-05 Josh Switnicki <josh.switnicki@…>

  • Makefile.am: added AVR specific Header files to score/cpu/avr/avr. These are from avr-libc 1.6 and assumed to exist by AVR applications.
  • preinstall.am: Regenerated.
  • Property mode set to 100644
File size: 17.8 KB
Line 
1/* Copyright (c) 2002, Steinar Haugen
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$ */
32
33/* avr/iom8535.h - definitions for ATmega8535 */
34
35#ifndef _AVR_IOM8535_H_
36#define _AVR_IOM8535_H_ 1
37
38/* This file should only be included from <avr/io.h>, never directly. */
39
40#ifndef _AVR_IO_H_
41#  error "Include <avr/io.h> instead of this file."
42#endif
43
44#ifndef _AVR_IOXXX_H_
45#  define _AVR_IOXXX_H_ "iom8535.h"
46#else
47#  error "Attempt to include more than one <avr/ioXXX.h> file."
48#endif
49
50/* I/O registers */
51
52/* TWI stands for "Two Wire Interface" or "TWI Was I2C(tm)" */
53#define TWBR    _SFR_IO8(0x00)
54#define TWSR    _SFR_IO8(0x01)
55#define TWAR    _SFR_IO8(0x02)
56#define TWDR    _SFR_IO8(0x03)
57
58/* ADC Data register */
59#ifndef __ASSEMBLER__
60#define ADC     _SFR_IO16(0x04)
61#endif
62#define ADCW    _SFR_IO16(0x04)
63#define ADCL    _SFR_IO8(0x04)
64#define ADCH    _SFR_IO8(0x05)
65
66/* ADC Control and Status Register */
67#define ADCSRA  _SFR_IO8(0x06)
68
69/* ADC MUX */
70#define ADMUX   _SFR_IO8(0x07)
71
72/* Analog Comparator Control and Status Register */
73#define ACSR    _SFR_IO8(0x08)
74
75/* USART Baud Rate Register */
76#define UBRRL   _SFR_IO8(0x09)
77
78/* USART Control and Status Register B */
79#define UCSRB   _SFR_IO8(0x0A)
80
81/* USART Control and Status Register A */
82#define UCSRA   _SFR_IO8(0x0B)
83
84/* USART I/O Data Register */
85#define UDR     _SFR_IO8(0x0C)
86
87/* SPI Control Register */
88#define SPCR    _SFR_IO8(0x0D)
89
90/* SPI Status Register */
91#define SPSR    _SFR_IO8(0x0E)
92
93/* SPI I/O Data Register */
94#define SPDR    _SFR_IO8(0x0F)
95
96/* Input Pins, Port D */
97#define PIND    _SFR_IO8(0x10)
98
99/* Data Direction Register, Port D */
100#define DDRD    _SFR_IO8(0x11)
101
102/* Data Register, Port D */
103#define PORTD   _SFR_IO8(0x12)
104
105/* Input Pins, Port C */
106#define PINC    _SFR_IO8(0x13)
107
108/* Data Direction Register, Port C */
109#define DDRC    _SFR_IO8(0x14)
110
111/* Data Register, Port C */
112#define PORTC   _SFR_IO8(0x15)
113
114/* Input Pins, Port B */
115#define PINB    _SFR_IO8(0x16)
116
117/* Data Direction Register, Port B */
118#define DDRB    _SFR_IO8(0x17)
119
120/* Data Register, Port B */
121#define PORTB   _SFR_IO8(0x18)
122
123/* Input Pins, Port A */
124#define PINA    _SFR_IO8(0x19)
125
126/* Data Direction Register, Port A */
127#define DDRA    _SFR_IO8(0x1A)
128
129/* Data Register, Port A */
130#define PORTA   _SFR_IO8(0x1B)
131
132/* EEPROM Control Register */
133#define EECR    _SFR_IO8(0x1C)
134
135/* EEPROM Data Register */
136#define EEDR    _SFR_IO8(0x1D)
137
138/* EEPROM Address Register */
139#define EEAR    _SFR_IO16(0x1E)
140#define EEARL   _SFR_IO8(0x1E)
141#define EEARH   _SFR_IO8(0x1F)
142
143/* USART Baud Rate Register HI         */
144/* USART Control and Status Register C */
145#define UBRRH   _SFR_IO8(0x20)
146#define UCSRC   UBRRH
147
148/* Watchdog Timer Control Register */
149#define WDTCR   _SFR_IO8(0x21)
150
151/* Asynchronous mode Status Register */
152#define ASSR    _SFR_IO8(0x22)
153
154/* Timer/Counter2 Output Compare Register */
155#define OCR2    _SFR_IO8(0x23)
156
157/* Timer/Counter 2 */
158#define TCNT2   _SFR_IO8(0x24)
159
160/* Timer/Counter 2 Control Register */
161#define TCCR2   _SFR_IO8(0x25)
162
163/* T/C 1 Input Capture Register */
164#define ICR1    _SFR_IO16(0x26)
165#define ICR1L   _SFR_IO8(0x26)
166#define ICR1H   _SFR_IO8(0x27)
167
168/* Timer/Counter1 Output Compare Register B */
169#define OCR1B   _SFR_IO16(0x28)
170#define OCR1BL  _SFR_IO8(0x28)
171#define OCR1BH  _SFR_IO8(0x29)
172
173/* Timer/Counter1 Output Compare Register A */
174#define OCR1A   _SFR_IO16(0x2A)
175#define OCR1AL  _SFR_IO8(0x2A)
176#define OCR1AH  _SFR_IO8(0x2B)
177
178/* Timer/Counter 1 */
179#define TCNT1   _SFR_IO16(0x2C)
180#define TCNT1L  _SFR_IO8(0x2C)
181#define TCNT1H  _SFR_IO8(0x2D)
182
183/* Timer/Counter 1 Control and Status Register */
184#define TCCR1B  _SFR_IO8(0x2E)
185
186/* Timer/Counter 1 Control Register */
187#define TCCR1A  _SFR_IO8(0x2F)
188
189/* Special Function IO Register */
190#define SFIOR   _SFR_IO8(0x30)
191
192/* Oscillator Calibration Register */
193#define OSCCAL  _SFR_IO8(0x31)
194
195/* Timer/Counter 0 */
196#define TCNT0   _SFR_IO8(0x32)
197
198/* Timer/Counter 0 Control Register */
199#define TCCR0   _SFR_IO8(0x33)
200
201/* MCU Control and Status Register */
202#define MCUCSR  _SFR_IO8(0x34)
203
204/* MCU Control Register */
205#define MCUCR   _SFR_IO8(0x35)
206
207/* TWI Control Register */
208#define TWCR    _SFR_IO8(0x36)
209
210/* Store Program Memory Control Register */
211#define SPMCR   _SFR_IO8(0x37)
212
213/* Timer/Counter Interrupt Flag register */
214#define TIFR    _SFR_IO8(0x38)
215
216/* Timer/Counter Interrupt MaSK register */
217#define TIMSK   _SFR_IO8(0x39)
218
219/* General Interrupt Flag Register */
220#define GIFR    _SFR_IO8(0x3A)
221
222/* General Interrupt MaSK register */
223#define GICR    _SFR_IO8(0x3B)
224
225/* Timer/Counter 0 Output Compare Register */
226#define OCR0    _SFR_IO8(0x3C)
227
228/* 0x3D..0x3E SP */
229
230/* 0x3F SREG */
231
232/* Interrupt vectors */
233
234/* External Interrupt 0 */
235#define INT0_vect                       _VECTOR(1)
236#define SIG_INTERRUPT0                  _VECTOR(1)
237
238/* External Interrupt 1 */
239#define INT1_vect                       _VECTOR(2)
240#define SIG_INTERRUPT1                  _VECTOR(2)
241
242/* Timer/Counter2 Compare Match */
243#define TIMER2_COMP_vect                _VECTOR(3)
244#define SIG_OUTPUT_COMPARE2             _VECTOR(3)
245
246/* Timer/Counter2 Overflow */
247#define TIMER2_OVF_vect                 _VECTOR(4)
248#define SIG_OVERFLOW2                   _VECTOR(4)
249
250/* Timer/Counter1 Capture Event */
251#define TIMER1_CAPT_vect                _VECTOR(5)
252#define SIG_INPUT_CAPTURE1              _VECTOR(5)
253
254/* Timer/Counter1 Compare Match A */
255#define TIMER1_COMPA_vect               _VECTOR(6)
256#define SIG_OUTPUT_COMPARE1A            _VECTOR(6)
257
258/* Timer/Counter1 Compare Match B */
259#define TIMER1_COMPB_vect               _VECTOR(7)
260#define SIG_OUTPUT_COMPARE1B            _VECTOR(7)
261
262/* Timer/Counter1 Overflow */
263#define TIMER1_OVF_vect                 _VECTOR(8)
264#define SIG_OVERFLOW1                   _VECTOR(8)
265
266/* Timer/Counter0 Overflow */
267#define TIMER0_OVF_vect                 _VECTOR(9)
268#define SIG_OVERFLOW0                   _VECTOR(9)
269
270/* SPI Serial Transfer Complete */
271#define SPI_STC_vect                    _VECTOR(10)
272#define SIG_SPI                         _VECTOR(10)
273
274/* USART, RX Complete */
275#define USART_RX_vect                   _VECTOR(11)
276#define SIG_UART_RECV                   _VECTOR(11)
277
278/* USART Data Register Empty */
279#define USART_UDRE_vect                 _VECTOR(12)
280#define SIG_UART_DATA                   _VECTOR(12)
281
282/* USART, TX Complete */
283#define USART_TX_vect                   _VECTOR(13)
284#define SIG_UART_TRANS                  _VECTOR(13)
285
286/* ADC Conversion Complete */
287#define ADC_vect                        _VECTOR(14)
288#define SIG_ADC                         _VECTOR(14)
289
290/* EEPROM Ready */
291#define EE_RDY_vect                     _VECTOR(15)
292#define SIG_EEPROM_READY                _VECTOR(15)
293
294/* Analog Comparator */
295#define ANA_COMP_vect                   _VECTOR(16)
296#define SIG_COMPARATOR                  _VECTOR(16)
297
298/* Two-wire Serial Interface */
299#define TWI_vect                        _VECTOR(17)
300#define SIG_2WIRE_SERIAL                _VECTOR(17)
301
302/* External Interrupt Request 2 */
303#define INT2_vect                       _VECTOR(18)
304#define SIG_INTERRUPT2                  _VECTOR(18)
305
306/* TimerCounter0 Compare Match */
307#define TIMER0_COMP_vect                _VECTOR(19)
308#define SIG_OUTPUT_COMPARE0             _VECTOR(19)
309
310/* Store Program Memory Read */
311#define SPM_RDY_vect                    _VECTOR(20)
312#define SIG_SPM_READY                   _VECTOR(20)
313
314#define _VECTORS_SIZE 42
315
316/*
317   The Register Bit names are represented by their bit number (0-7).
318*/
319
320/* General Interrupt Control Register */
321#define    INT1         7
322#define    INT0         6
323#define    INT2         5
324#define    IVSEL        1
325#define    IVCE         0
326
327/* General Interrupt Flag Register */
328#define    INTF1        7
329#define    INTF0        6
330#define    INTF2        5
331
332/* Timer/Counter Interrupt MaSK register */
333#define    OCIE2        7
334#define    TOIE2        6
335#define    TICIE1       5
336#define    OCIE1A       4
337#define    OCIE1B       3
338#define    TOIE1        2
339#define    OCIE0        1
340#define    TOIE0        0
341
342/* Timer/Counter Interrupt Flag register */
343#define    OCF2         7
344#define    TOV2         6
345#define    ICF1         5
346#define    OCF1A        4
347#define    OCF1B        3
348#define    TOV1         2
349#define    OCF0         1
350#define    TOV0         0
351
352/* Store Program Memory Control Register */
353#define    SPMIE        7
354#define    RWWSB        6
355#define    RWWSRE       4
356#define    BLBSET       3
357#define    PGWRT        2
358#define    PGERS        1
359#define    SPMEN        0
360
361/* TWI Control Register */
362#define    TWINT        7
363#define    TWEA         6
364#define    TWSTA        5
365#define    TWSTO        4
366#define    TWWC         3
367#define    TWEN         2
368#define    TWIE         0
369
370/* MCU Control Register */
371#define    SM2          7
372#define    SE           6
373#define    SM1          5
374#define    SM0          4
375#define    ISC11        3
376#define    ISC10        2
377#define    ISC01        1
378#define    ISC00        0
379
380/* MCU Control and Status Register */
381#define    ISC2         6
382#define    WDRF         3
383#define    BORF         2
384#define    EXTRF        1
385#define    PORF         0
386
387/* Timer/Counter 0 Control Register */
388#define    FOC0         7
389#define    WGM00        6
390#define    COM01        5
391#define    COM00        4
392#define    WGM01        3
393#define    CS02         2
394#define    CS01         1
395#define    CS00         0
396
397/*
398   The ADHSM bit has been removed from all documentation,
399   as being not needed at all since the comparator has proven
400   to be fast enough even without feeding it more power.
401*/
402
403/* Special Function IO Register */
404#define    ADTS2        7
405#define    ADTS1        6
406#define    ADTS0        5
407#define    ACME         3
408#define    PUD          2
409#define    PSR2         1
410#define    PSR10        0
411
412/* Timer/Counter 1 Control Register */
413#define    COM1A1       7
414#define    COM1A0       6
415#define    COM1B1       5
416#define    COM1B0       4
417#define    FOC1A        3
418#define    FOC1B        2
419#define    WGM11        1
420#define    WGM10        0
421
422/* Timer/Counter 1 Control and Status Register */
423#define    ICNC1        7
424#define    ICES1        6
425#define    WGM13        4
426#define    WGM12        3
427#define    CS12         2
428#define    CS11         1
429#define    CS10         0
430
431/* Timer/Counter 2 Control Register */
432#define    FOC2         7
433#define    WGM20        6
434#define    COM21        5
435#define    COM20        4
436#define    WGM21        3
437#define    CS22         2
438#define    CS21         1
439#define    CS20         0
440
441/* Asynchronous mode Status Register */
442#define    AS2          3
443#define    TCN2UB       2
444#define    OCR2UB       1
445#define    TCR2UB       0
446
447/* Watchdog Timer Control Register */
448#define    WDCE         4
449#define    WDE          3
450#define    WDP2         2
451#define    WDP1         1
452#define    WDP0         0
453
454/* USART Control and Status Register C */
455#define    URSEL        7
456#define    UMSEL        6
457#define    UPM1         5
458#define    UPM0         4
459#define    USBS         3
460#define    UCSZ1        2
461#define    UCSZ0        1
462#define    UCPOL        0
463
464/* Data Register, Port A */
465#define    PA7          7
466#define    PA6          6
467#define    PA5          5
468#define    PA4          4
469#define    PA3          3
470#define    PA2          2
471#define    PA1          1
472#define    PA0          0
473
474/* Data Direction Register, Port A */
475#define    DDA7         7
476#define    DDA6         6
477#define    DDA5         5
478#define    DDA4         4
479#define    DDA3         3
480#define    DDA2         2
481#define    DDA1         1
482#define    DDA0         0
483
484/* Input Pins, Port A */
485#define    PINA7        7
486#define    PINA6        6
487#define    PINA5        5
488#define    PINA4        4
489#define    PINA3        3
490#define    PINA2        2
491#define    PINA1        1
492#define    PINA0        0
493
494/* Data Register, Port B */
495#define    PB7          7
496#define    PB6          6
497#define    PB5          5
498#define    PB4          4
499#define    PB3          3
500#define    PB2          2
501#define    PB1          1
502#define    PB0          0
503
504/* Data Direction Register, Port B */
505#define    DDB7         7
506#define    DDB6         6
507#define    DDB5         5
508#define    DDB4         4
509#define    DDB3         3
510#define    DDB2         2
511#define    DDB1         1
512#define    DDB0         0
513
514/* Input Pins, Port B */
515#define    PINB7        7
516#define    PINB6        6
517#define    PINB5        5
518#define    PINB4        4
519#define    PINB3        3
520#define    PINB2        2
521#define    PINB1        1
522#define    PINB0        0
523
524/* Data Register, Port C */
525#define    PC7          7
526#define    PC6          6
527#define    PC5          5
528#define    PC4          4
529#define    PC3          3
530#define    PC2          2
531#define    PC1          1
532#define    PC0          0
533
534/* Data Direction Register, Port C */
535#define    DDC7         7
536#define    DDC6         6
537#define    DDC5         5
538#define    DDC4         4
539#define    DDC3         3
540#define    DDC2         2
541#define    DDC1         1
542#define    DDC0         0
543
544/* Input Pins, Port C */
545#define    PINC7        7
546#define    PINC6        6
547#define    PINC5        5
548#define    PINC4        4
549#define    PINC3        3
550#define    PINC2        2
551#define    PINC1        1
552#define    PINC0        0
553
554/* Data Register, Port D */
555#define    PD7          7
556#define    PD6          6
557#define    PD5          5
558#define    PD4          4
559#define    PD3          3
560#define    PD2          2
561#define    PD1          1
562#define    PD0          0
563
564/* Data Direction Register, Port D */
565#define    DDD7         7
566#define    DDD6         6
567#define    DDD5         5
568#define    DDD4         4
569#define    DDD3         3
570#define    DDD2         2
571#define    DDD1         1
572#define    DDD0         0
573
574/* Input Pins, Port D */
575#define    PIND7        7
576#define    PIND6        6
577#define    PIND5        5
578#define    PIND4        4
579#define    PIND3        3
580#define    PIND2        2
581#define    PIND1        1
582#define    PIND0        0
583
584/* SPI Status Register */
585#define    SPIF         7
586#define    WCOL         6
587#define    SPI2X        0
588
589/* SPI Control Register */
590#define    SPIE         7
591#define    SPE          6
592#define    DORD         5
593#define    MSTR         4
594#define    CPOL         3
595#define    CPHA         2
596#define    SPR1         1
597#define    SPR0         0
598
599/* USART Control and Status Register A */
600#define    RXC          7
601#define    TXC          6
602#define    UDRE         5
603#define    FE           4
604#define    DOR          3
605#define    PE           2
606#define    U2X          1
607#define    MPCM         0
608
609/* USART Control and Status Register B */
610#define    RXCIE        7
611#define    TXCIE        6
612#define    UDRIE        5
613#define    RXEN         4
614#define    TXEN         3
615#define    UCSZ2        2
616#define    RXB8         1
617#define    TXB8         0
618
619/* Analog Comparator Control and Status Register */
620#define    ACD          7
621#define    ACBG         6
622#define    ACO          5
623#define    ACI          4
624#define    ACIE         3
625#define    ACIC         2
626#define    ACIS1        1
627#define    ACIS0        0
628
629/* ADC Multiplexer Selection Register */
630#define    REFS1        7
631#define    REFS0        6
632#define    ADLAR        5
633#define    MUX4         4
634#define    MUX3         3
635#define    MUX2         2
636#define    MUX1         1
637#define    MUX0         0
638
639/* ADC Control and Status Register */
640#define    ADEN         7
641#define    ADSC         6
642#define    ADATE        5
643#define    ADIF         4
644#define    ADIE         3
645#define    ADPS2        2
646#define    ADPS1        1
647#define    ADPS0        0
648
649/* TWI (Slave) Address Register */
650#define    TWGCE        0
651
652/* TWI Status Register */
653#define    TWS7         7
654#define    TWS6         6
655#define    TWS5         5
656#define    TWS4         4
657#define    TWS3         3
658#define    TWPS1        1
659#define    TWPS0        0
660
661/* EEPROM Control Register */
662#define    EERIE        3
663#define    EEMWE        2
664#define    EEWE         1
665#define    EERE         0
666
667/* Constants */
668#define SPM_PAGESIZE 64
669#define RAMEND       0x25F    /* Last On-Chip SRAM Location */
670#define XRAMEND      RAMEND
671#define E2END        0x1FF
672#define E2PAGESIZE   4
673#define FLASHEND     0x1FFF
674
675
676/* Fuses */
677
678#define FUSE_MEMORY_SIZE 2
679
680/* Low Fuse Byte */
681#define FUSE_CKSEL0      (unsigned char)~_BV(0)
682#define FUSE_CKSEL1      (unsigned char)~_BV(1)
683#define FUSE_CKSEL2      (unsigned char)~_BV(2)
684#define FUSE_CKSEL3      (unsigned char)~_BV(3)
685#define FUSE_SUT0        (unsigned char)~_BV(4)
686#define FUSE_SUT1        (unsigned char)~_BV(5)
687#define FUSE_BODEN       (unsigned char)~_BV(6)
688#define FUSE_BODLEVEL    (unsigned char)~_BV(7)
689#define LFUSE_DEFAULT (FUSE_CKSEL1 & FUSE_CKSEL2 & FUSE_CKSEL3 & FUSE_SUT0 & FUSE_SUT1)
690
691/* High Fuse Byte */
692#define FUSE_BOOTRST     (unsigned char)~_BV(0)
693#define FUSE_BOOTSZ0     (unsigned char)~_BV(1)
694#define FUSE_BOOTSZ1     (unsigned char)~_BV(2)
695#define FUSE_EESAVE      (unsigned char)~_BV(3)
696#define FUSE_CKOPT       (unsigned char)~_BV(4)
697#define FUSE_SPIEN       (unsigned char)~_BV(5)
698#define FUSE_WDTON       (unsigned char)~_BV(6)
699#define FUSE_S8535C      (unsigned char)~_BV(7)
700#define HFUSE_DEFAULT (FUSE_BOOTSZ0 & FUSE_BOOTSZ1 & FUSE_SPIEN)
701
702
703/* Lock Bits */
704#define __LOCK_BITS_EXIST
705#define __BOOT_LOCK_BITS_0_EXIST
706#define __BOOT_LOCK_BITS_1_EXIST
707
708
709/* Signature */
710#define SIGNATURE_0 0x1E
711#define SIGNATURE_1 0x93
712#define SIGNATURE_2 0x08
713
714
715#endif /* _AVR_IOM8535_H_ */
Note: See TracBrowser for help on using the repository browser.