source: rtems/cpukit/score/cpu/avr/avr/iom323.h @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

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