source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/tools/avr/avr/include/avr/iom8.h @ 46

Last change on this file since 46 was 46, checked in by jrpelegrina, 4 years ago

First release to Xenial

File size: 14.0 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/* $Id: iom8.h 2235 2011-03-17 04:13:14Z arcanum $ */
32
33/* avr/iom8.h - definitions for ATmega8 */
34
35#ifndef _AVR_IOM8_H_
36#define _AVR_IOM8_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_ "iom8.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 */
59#define ADCW    _SFR_IO16(0x04)
60#ifndef __ASSEMBLER__
61#define ADC     _SFR_IO16(0x04)
62#endif
63#define ADCL    _SFR_IO8(0x04)
64#define ADCH    _SFR_IO8(0x05)
65#define ADCSR   _SFR_IO8(0x06)
66#define ADCSRA  _SFR_IO8(0x06)  /* Changed in 2486H-AVR-09/02 */
67#define ADMUX   _SFR_IO8(0x07)
68
69/* analog comparator */
70#define ACSR    _SFR_IO8(0x08)
71
72/* USART */
73#define UBRRL   _SFR_IO8(0x09)
74#define UCSRB   _SFR_IO8(0x0A)
75#define UCSRA   _SFR_IO8(0x0B)
76#define UDR     _SFR_IO8(0x0C)
77
78/* SPI */
79#define SPCR    _SFR_IO8(0x0D)
80#define SPSR    _SFR_IO8(0x0E)
81#define SPDR    _SFR_IO8(0x0F)
82
83/* Port D */
84#define PIND    _SFR_IO8(0x10)
85#define DDRD    _SFR_IO8(0x11)
86#define PORTD   _SFR_IO8(0x12)
87
88/* Port C */
89#define PINC    _SFR_IO8(0x13)
90#define DDRC    _SFR_IO8(0x14)
91#define PORTC   _SFR_IO8(0x15)
92
93/* Port B */
94#define PINB    _SFR_IO8(0x16)
95#define DDRB    _SFR_IO8(0x17)
96#define PORTB   _SFR_IO8(0x18)
97
98/* EEPROM Control Register */
99#define EECR    _SFR_IO8(0x1C)
100
101/* EEPROM Data Register */
102#define EEDR    _SFR_IO8(0x1D)
103
104/* EEPROM Address Register */
105#define EEAR    _SFR_IO16(0x1E)
106#define EEARL   _SFR_IO8(0x1E)
107#define EEARH   _SFR_IO8(0x1F)
108
109#define UCSRC   _SFR_IO8(0x20)
110#define UBRRH   _SFR_IO8(0x20)
111
112#define WDTCR   _SFR_IO8(0x21)
113#define ASSR    _SFR_IO8(0x22)
114
115/* Timer 2 */
116#define OCR2    _SFR_IO8(0x23)
117#define TCNT2   _SFR_IO8(0x24)
118#define TCCR2   _SFR_IO8(0x25)
119
120/* Timer 1 */
121#define ICR1    _SFR_IO16(0x26)
122#define ICR1L   _SFR_IO8(0x26)
123#define ICR1H   _SFR_IO8(0x27)
124#define OCR1B   _SFR_IO16(0x28)
125#define OCR1BL  _SFR_IO8(0x28)
126#define OCR1BH  _SFR_IO8(0x29)
127#define OCR1A   _SFR_IO16(0x2A)
128#define OCR1AL  _SFR_IO8(0x2A)
129#define OCR1AH  _SFR_IO8(0x2B)
130#define TCNT1   _SFR_IO16(0x2C)
131#define TCNT1L  _SFR_IO8(0x2C)
132#define TCNT1H  _SFR_IO8(0x2D)
133#define TCCR1B  _SFR_IO8(0x2E)
134#define TCCR1A  _SFR_IO8(0x2F)
135
136#define SFIOR   _SFR_IO8(0x30)
137
138#define OSCCAL  _SFR_IO8(0x31)
139
140/* Timer 0 */
141#define TCNT0   _SFR_IO8(0x32)
142#define TCCR0   _SFR_IO8(0x33)
143
144#define MCUCSR  _SFR_IO8(0x34)
145#define MCUSR   _SFR_IO8(0x34)  /* Defined as an alias for MCUCSR. */
146
147#define MCUCR   _SFR_IO8(0x35)
148
149#define TWCR    _SFR_IO8(0x36)
150
151#define SPMCR   _SFR_IO8(0x37)
152
153#define TIFR    _SFR_IO8(0x38)
154#define TIMSK   _SFR_IO8(0x39)
155
156#define GIFR    _SFR_IO8(0x3A)
157#define GIMSK   _SFR_IO8(0x3B)
158#define GICR    _SFR_IO8(0x3B)   /* Changed in 2486H-AVR-09/02 */
159
160/* 0x3C reserved (OCR0?) */
161
162/* 0x3D..0x3E SP */
163
164/* 0x3F SREG */
165
166/* Interrupt vectors */
167
168/* External Interrupt Request 0 */
169#define INT0_vect_num           1
170#define INT0_vect                       _VECTOR(1)
171#define SIG_INTERRUPT0                  _VECTOR(1)
172
173/* External Interrupt Request 1 */
174#define INT1_vect_num           2
175#define INT1_vect                       _VECTOR(2)
176#define SIG_INTERRUPT1                  _VECTOR(2)
177
178/* Timer/Counter2 Compare Match */
179#define TIMER2_COMP_vect_num    3
180#define TIMER2_COMP_vect                _VECTOR(3)
181#define SIG_OUTPUT_COMPARE2             _VECTOR(3)
182
183/* Timer/Counter2 Overflow */
184#define TIMER2_OVF_vect_num             4
185#define TIMER2_OVF_vect                 _VECTOR(4)
186#define SIG_OVERFLOW2                   _VECTOR(4)
187
188/* Timer/Counter1 Capture Event */
189#define TIMER1_CAPT_vect_num    5
190#define TIMER1_CAPT_vect                _VECTOR(5)
191#define SIG_INPUT_CAPTURE1              _VECTOR(5)
192
193/* Timer/Counter1 Compare Match A */
194#define TIMER1_COMPA_vect_num   6
195#define TIMER1_COMPA_vect               _VECTOR(6)
196#define SIG_OUTPUT_COMPARE1A            _VECTOR(6)
197
198/* Timer/Counter1 Compare Match B */
199#define TIMER1_COMPB_vect_num   7
200#define TIMER1_COMPB_vect               _VECTOR(7)
201#define SIG_OUTPUT_COMPARE1B            _VECTOR(7)
202
203/* Timer/Counter1 Overflow */
204#define TIMER1_OVF_vect_num             8
205#define TIMER1_OVF_vect                 _VECTOR(8)
206#define SIG_OVERFLOW1                   _VECTOR(8)
207
208/* Timer/Counter0 Overflow */
209#define TIMER0_OVF_vect_num             9
210#define TIMER0_OVF_vect                 _VECTOR(9)
211#define SIG_OVERFLOW0                   _VECTOR(9)
212
213/* Serial Transfer Complete */
214#define SPI_STC_vect_num                10
215#define SPI_STC_vect                    _VECTOR(10)
216#define SIG_SPI                         _VECTOR(10)
217
218/* USART, Rx Complete */
219#define USART_RXC_vect_num              11
220#define USART_RXC_vect                  _VECTOR(11)
221#define SIG_UART_RECV                   _VECTOR(11)
222
223/* USART Data Register Empty */
224#define USART_UDRE_vect_num             12
225#define USART_UDRE_vect                 _VECTOR(12)
226#define SIG_UART_DATA                   _VECTOR(12)
227
228/* USART, Tx Complete */
229#define USART_TXC_vect_num              13
230#define USART_TXC_vect                  _VECTOR(13)
231#define SIG_UART_TRANS                  _VECTOR(13)
232
233/* ADC Conversion Complete */
234#define ADC_vect_num            14
235#define ADC_vect                        _VECTOR(14)
236#define SIG_ADC                         _VECTOR(14)
237
238/* EEPROM Ready */
239#define EE_RDY_vect_num         15
240#define EE_RDY_vect                     _VECTOR(15)
241#define SIG_EEPROM_READY                _VECTOR(15)
242
243/* Analog Comparator */
244#define ANA_COMP_vect_num               16
245#define ANA_COMP_vect                   _VECTOR(16)
246#define SIG_COMPARATOR                  _VECTOR(16)
247
248/* 2-wire Serial Interface */
249#define TWI_vect_num                    17
250#define TWI_vect                        _VECTOR(17)
251#define SIG_2WIRE_SERIAL                _VECTOR(17)
252
253/* Store Program Memory Ready */
254#define SPM_RDY_vect_num                18
255#define SPM_RDY_vect                    _VECTOR(18)
256#define SIG_SPM_READY                   _VECTOR(18)
257
258#define _VECTORS_SIZE 38
259
260/* Bit numbers */
261
262/* GIMSK / GICR */
263#define INT1    7
264#define INT0    6
265#define IVSEL   1
266#define IVCE    0
267
268/* GIFR */
269#define INTF1   7
270#define INTF0   6
271
272/* TIMSK */
273#define OCIE2   7
274#define TOIE2   6
275#define TICIE1  5
276#define OCIE1A  4
277#define OCIE1B  3
278#define TOIE1   2
279/* bit 1 reserved (OCIE0?) */
280#define TOIE0   0
281
282/* TIFR */
283#define OCF2    7
284#define TOV2    6
285#define ICF1    5
286#define OCF1A   4
287#define OCF1B   3
288#define TOV1    2
289/* bit 1 reserved (OCF0?) */
290#define TOV0    0
291
292/* SPMCR */
293#define SPMIE   7
294#define RWWSB   6
295/* bit 5 reserved */
296#define RWWSRE  4
297#define BLBSET  3
298#define PGWRT   2
299#define PGERS   1
300#define SPMEN   0
301
302/* TWCR */
303#define TWINT   7
304#define TWEA    6
305#define TWSTA   5
306#define TWSTO   4
307#define TWWC    3
308#define TWEN    2
309/* bit 1 reserved (TWI_TST?) */
310#define TWIE    0
311
312/* TWAR */
313#define TWA6    7
314#define TWA5    6
315#define TWA4    5
316#define TWA3    4
317#define TWA2    3
318#define TWA1    2
319#define TWA0    1
320#define TWGCE   0
321
322/* TWSR */
323#define TWS7    7
324#define TWS6    6
325#define TWS5    5
326#define TWS4    4
327#define TWS3    3
328/* bit 2 reserved */
329#define TWPS1   1
330#define TWPS0   0
331
332/* MCUCR */
333#define SE      7
334#define SM2     6
335#define SM1     5
336#define SM0     4
337#define ISC11   3
338#define ISC10   2
339#define ISC01   1
340#define ISC00   0
341
342/* MCUCSR */
343/* bits 7-4 reserved */
344#define WDRF    3
345#define BORF    2
346#define EXTRF   1
347#define PORF    0
348
349/*
350   The ADHSM bit has been removed from all documentation,
351   as being not needed at all since the comparator has proven
352   to be fast enough even without feeding it more power.
353*/
354
355/* SFIOR */
356/* bits 7-5 reserved */
357#define ACME    3
358#define PUD     2
359#define PSR2    1
360#define PSR10   0
361
362/* TCCR0 */
363/* bits 7-3 reserved */
364#define CS02    2
365#define CS01    1
366#define CS00    0
367
368/* TCCR2 */
369#define FOC2    7
370#define WGM20   6
371#define COM21   5
372#define COM20   4
373#define WGM21   3
374#define CS22    2
375#define CS21    1
376#define CS20    0
377
378/* ASSR */
379/* bits 7-4 reserved */
380#define AS2     3
381#define TCN2UB  2
382#define OCR2UB  1
383#define TCR2UB  0
384
385/* TCCR1A */
386#define COM1A1  7
387#define COM1A0  6
388#define COM1B1  5
389#define COM1B0  4
390#define FOC1A   3
391#define FOC1B   2
392#define WGM11   1
393#define WGM10   0
394
395/* TCCR1B */
396#define ICNC1   7
397#define ICES1   6
398/* bit 5 reserved */
399#define WGM13   4
400#define WGM12   3
401#define CS12    2
402#define CS11    1
403#define CS10    0
404
405/* WDTCR */
406/* bits 7-5 reserved */
407#define WDCE    4
408#define WDE     3
409#define WDP2    2
410#define WDP1    1
411#define WDP0    0
412
413/* UBRRH */
414#define URSEL   7
415
416/* UCSRC */
417#define URSEL   7
418#define UMSEL   6
419#define UPM1    5
420#define UPM0    4
421#define USBS    3
422#define UCSZ1   2
423#define UCSZ0   1
424#define UCPOL   0
425
426/* PORTB */
427#define PB7     7
428#define PB6     6
429#define PB5     5
430#define PB4     4
431#define PB3     3
432#define PB2     2
433#define PB1     1
434#define PB0     0
435
436/* DDRB */
437#define DDB7    7
438#define DDB6    6
439#define DDB5    5
440#define DDB4    4
441#define DDB3    3
442#define DDB2    2
443#define DDB1    1
444#define DDB0    0
445
446/* PINB */
447#define PINB7   7
448#define PINB6   6
449#define PINB5   5
450#define PINB4   4
451#define PINB3   3
452#define PINB2   2
453#define PINB1   1
454#define PINB0   0
455
456/* PORTC */
457#define PC6      6
458#define PC5      5
459#define PC4      4
460#define PC3      3
461#define PC2      2
462#define PC1      1
463#define PC0      0
464
465/* DDRC */
466#define DDC6    6
467#define DDC5    5
468#define DDC4    4
469#define DDC3    3
470#define DDC2    2
471#define DDC1    1
472#define DDC0    0
473
474/* PINC */
475#define PINC6   6
476#define PINC5   5
477#define PINC4   4
478#define PINC3   3
479#define PINC2   2
480#define PINC1   1
481#define PINC0   0
482
483/* PORTD */
484#define PD7      7
485#define PD6      6
486#define PD5      5
487#define PD4      4
488#define PD3      3
489#define PD2      2
490#define PD1      1
491#define PD0      0
492
493/* DDRD */
494#define DDD7    7
495#define DDD6    6
496#define DDD5    5
497#define DDD4    4
498#define DDD3    3
499#define DDD2    2
500#define DDD1    1
501#define DDD0    0
502
503/* PIND */
504#define PIND7   7
505#define PIND6   6
506#define PIND5   5
507#define PIND4   4
508#define PIND3   3
509#define PIND2   2
510#define PIND1   1
511#define PIND0   0
512
513/* SPSR */
514#define SPIF    7
515#define WCOL    6
516#define SPI2X   0
517
518/* SPCR */
519#define SPIE    7
520#define SPE     6
521#define DORD    5
522#define MSTR    4
523#define CPOL    3
524#define CPHA    2
525#define SPR1    1
526#define SPR0    0
527
528/* UCSRA */
529#define RXC     7
530#define TXC     6
531#define UDRE    5
532#define FE      4
533#define DOR     3
534#define PE      2
535#define U2X     1
536#define MPCM    0
537
538/* UCSRB */
539#define RXCIE   7
540#define TXCIE   6
541#define UDRIE   5
542#define RXEN    4
543#define TXEN    3
544#define UCSZ2   2
545#define RXB8    1
546#define TXB8    0
547
548/* ACSR */
549#define ACD     7
550#define ACBG    6
551#define ACO     5
552#define ACI     4
553#define ACIE    3
554#define ACIC    2
555#define ACIS1   1
556#define ACIS0   0
557
558/* ADCSR / ADCSRA */
559#define ADEN    7
560#define ADSC    6
561#define ADFR    5
562#define ADIF    4
563#define ADIE    3
564#define ADPS2   2
565#define ADPS1   1
566#define ADPS0   0
567
568/* ADMUX */
569#define REFS1   7
570#define REFS0   6
571#define ADLAR   5
572/* bit 4 reserved */
573#define MUX3    3
574#define MUX2    2
575#define MUX1    1
576#define MUX0    0
577
578/* EEPROM Control Register */
579#define EERIE   3
580#define EEMWE   2
581#define EEWE    1
582#define EERE    0
583
584/* Constants */
585#define SPM_PAGESIZE 64
586#define RAMSTART         (0x60)
587#define RAMEND           0x45F
588#define XRAMEND          RAMEND
589#define E2END            0x1FF
590#define E2PAGESIZE   4
591#define FLASHEND         0x1FFF
592
593
594/* Fuses */
595
596#define FUSE_MEMORY_SIZE 2
597
598/* Low Fuse Byte */
599#define FUSE_CKSEL0      (unsigned char)~_BV(0)
600#define FUSE_CKSEL1      (unsigned char)~_BV(1)
601#define FUSE_CKSEL2      (unsigned char)~_BV(2)
602#define FUSE_CKSEL3      (unsigned char)~_BV(3)
603#define FUSE_SUT0        (unsigned char)~_BV(4)
604#define FUSE_SUT1        (unsigned char)~_BV(5)
605#define FUSE_BODEN       (unsigned char)~_BV(6)
606#define FUSE_BODLEVEL    (unsigned char)~_BV(7)
607#define LFUSE_DEFAULT (FUSE_SUT0 & FUSE_CKSEL3 & FUSE_CKSEL2 & FUSE_CKSEL1)
608
609/* High Fuse Byte */
610#define FUSE_BOOTRST     (unsigned char)~_BV(0)
611#define FUSE_BOOTSZ0     (unsigned char)~_BV(1)
612#define FUSE_BOOTSZ1     (unsigned char)~_BV(2)
613#define FUSE_EESAVE      (unsigned char)~_BV(3)
614#define FUSE_CKOPT       (unsigned char)~_BV(4)
615#define FUSE_SPIEN       (unsigned char)~_BV(5)
616#define FUSE_WDTON       (unsigned char)~_BV(6)
617#define FUSE_RSTDISBL    (unsigned char)~_BV(7)
618#define HFUSE_DEFAULT (FUSE_SPIEN & FUSE_BOOTSZ1 & FUSE_BOOTSZ0)
619
620
621/* Lock Bits */
622#define __LOCK_BITS_EXIST
623#define __BOOT_LOCK_BITS_0_EXIST
624#define __BOOT_LOCK_BITS_1_EXIST
625
626
627/* Signature */
628#define SIGNATURE_0 0x1E
629#define SIGNATURE_1 0x93
630#define SIGNATURE_2 0x07
631
632
633/* Deprecated items */
634#if !defined(__AVR_LIBC_DEPRECATED_ENABLE__)
635
636#pragma GCC system_header
637
638#pragma GCC poison SIG_INTERRUPT0
639#pragma GCC poison SIG_INTERRUPT1
640#pragma GCC poison SIG_OUTPUT_COMPARE2
641#pragma GCC poison SIG_OVERFLOW2
642#pragma GCC poison SIG_INPUT_CAPTURE1
643#pragma GCC poison SIG_OUTPUT_COMPARE1A
644#pragma GCC poison SIG_OUTPUT_COMPARE1B
645#pragma GCC poison SIG_OVERFLOW1
646#pragma GCC poison SIG_OVERFLOW0
647#pragma GCC poison SIG_SPI
648#pragma GCC poison SIG_UART_RECV
649#pragma GCC poison SIG_UART_DATA
650#pragma GCC poison SIG_UART_TRANS
651#pragma GCC poison SIG_ADC
652#pragma GCC poison SIG_EEPROM_READY
653#pragma GCC poison SIG_COMPARATOR
654#pragma GCC poison SIG_2WIRE_SERIAL
655#pragma GCC poison SIG_SPM_READY
656
657#endif  /* !defined(__AVR_LIBC_DEPRECATED_ENABLE__) */
658
659
660#endif /* _AVR_IOM8_H_ */
Note: See TracBrowser for help on using the repository browser.