1
/* Copyright (c) 2009 Atmel Corporation
4
Redistribution and use in source and binary forms, with or without
5
modification, are permitted provided that the following conditions are met:
7
* Redistributions of source code must retain the above copyright
8
notice, this list of conditions and the following disclaimer.
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
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.
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. */
31
/* $Id: iotn87.h,v 1.1.2.2 2009/01/22 23:29:13 arcanum Exp $ */
33
/* avr/iotn87.h - definitions for ATtiny87 */
35
/* This file should only be included from <avr/io.h>, never directly. */
38
# error "Include <avr/io.h> instead of this file."
42
# define _AVR_IOXXX_H_ "iotn87.h"
44
# error "Attempt to include more than one <avr/ioXXX.h> file."
48
#ifndef _AVR_ATtiny87_H_
49
#define _AVR_ATtiny87_H_ 1
52
/* Registers and associated bit numbers. */
54
#define PINA _SFR_IO8(0x00)
64
#define DDRA _SFR_IO8(0x01)
74
#define PORTA _SFR_IO8(0x02)
84
#define PINB _SFR_IO8(0x03)
94
#define DDRB _SFR_IO8(0x04)
104
#define PORTB _SFR_IO8(0x05)
114
#define PORTCR _SFR_IO8(0x12)
120
#define TIFR0 _SFR_IO8(0x15)
124
#define TIFR1 _SFR_IO8(0x16)
130
#define PCIFR _SFR_IO8(0x1B)
134
#define EIFR _SFR_IO8(0x1C)
138
#define EIMSK _SFR_IO8(0x1D)
142
#define GPIOR0 _SFR_IO8(0x1E)
152
#define EECR _SFR_IO8(0x1F)
160
#define EEDR _SFR_IO8(0x20)
170
#define EEAR _SFR_IO16(0x21)
172
#define EEARL _SFR_IO8(0x21)
182
#define EEARH _SFR_IO8(0x22)
185
#define GTCCR _SFR_IO8(0x23)
190
#define TCCR0A _SFR_IO8(0x25)
196
#define TCCR0B _SFR_IO8(0x26)
202
#define TCNT0 _SFR_IO8(0x27)
212
#define OCR0A _SFR_IO8(0x28)
222
#define GPIOR1 _SFR_IO8(0x2A)
232
#define GPIOR2 _SFR_IO8(0x2B)
242
#define SPCR _SFR_IO8(0x2C)
252
#define SPSR _SFR_IO8(0x2D)
257
#define SPDR _SFR_IO8(0x2E)
267
#define ACSR _SFR_IO8(0x30)
277
#define DWDR _SFR_IO8(0x31)
287
#define SMCR _SFR_IO8(0x33)
292
#define MCUSR _SFR_IO8(0x34)
298
#define MCUCR _SFR_IO8(0x35)
303
#define SPMCSR _SFR_IO8(0x37)
312
#define WDTCR _SFR_MEM8(0x60)
322
#define CLKPR _SFR_MEM8(0x61)
329
#define CLKCSR _SFR_MEM8(0x62)
337
#define CLKSELR _SFR_MEM8(0x63)
346
#define PRR _SFR_MEM8(0x64)
354
#define OSCCAL _SFR_MEM8(0x66)
364
#define PCICR _SFR_MEM8(0x68)
368
#define EICRA _SFR_MEM8(0x69)
374
#define PCMSK0 _SFR_MEM8(0x6B)
384
#define PCMSK1 _SFR_MEM8(0x6C)
394
#define TIMSK0 _SFR_MEM8(0x6E)
398
#define TIMSK1 _SFR_MEM8(0x6F)
404
#define AMISCR _SFR_MEM8(0x77)
409
#ifndef __ASSEMBLER__
410
#define ADC _SFR_MEM16(0x78)
412
#define ADCW _SFR_MEM16(0x78)
414
#define ADCL _SFR_MEM8(0x78)
424
#define ADCH _SFR_MEM8(0x79)
434
#define ADCSRA _SFR_MEM8(0x7A)
444
#define ADCSRB _SFR_MEM8(0x7B)
453
#define ADMUX _SFR_MEM8(0x7C)
463
#define DIDR0 _SFR_MEM8(0x7E)
473
#define DIDR1 _SFR_MEM8(0x7F)
478
#define TCCR1A _SFR_MEM8(0x80)
486
#define TCCR1B _SFR_MEM8(0x81)
495
#define TCCR1C _SFR_MEM8(0x82)
499
#define TCCR1D _SFR_MEM8(0x83)
509
#define TCNT1 _SFR_MEM16(0x84)
511
#define TCNT1L _SFR_MEM8(0x84)
521
#define TCNT1H _SFR_MEM8(0x85)
531
#define ICR1 _SFR_MEM16(0x86)
533
#define ICR1L _SFR_MEM8(0x86)
543
#define ICR1H _SFR_MEM8(0x87)
553
#define OCR1A _SFR_MEM16(0x88)
555
#define OCR1AL _SFR_MEM8(0x88)
565
#define OCR1AH _SFR_MEM8(0x89)
575
#define OCR1B _SFR_MEM16(0x8A)
577
#define OCR1BL _SFR_MEM8(0x8A)
587
#define OCR1BH _SFR_MEM8(0x8B)
597
#define ASSR _SFR_MEM8(0xB6)
605
#define USICR _SFR_MEM8(0xB8)
615
#define USISR _SFR_MEM8(0xB9)
625
#define USIDR _SFR_MEM8(0xBA)
635
#define USIBR _SFR_MEM8(0xBB)
645
#define USIPP _SFR_MEM8(0xBC)
648
#define LINCR _SFR_MEM8(0xC8)
658
#define LINSIR _SFR_MEM8(0xC9)
668
#define LINENIR _SFR_MEM8(0xCA)
674
#define LINERR _SFR_MEM8(0xCB)
684
#define LINBTR _SFR_MEM8(0xCC)
693
#define LINBRR _SFR_MEM16(0xCD)
695
#define LINBRRL _SFR_MEM8(0xCD)
705
#define LINBRRH _SFR_MEM8(0xCE)
711
#define LINDLR _SFR_MEM8(0xCF)
721
#define LINIDR _SFR_MEM8(0xD0)
731
#define LINSEL _SFR_MEM8(0xD1)
737
#define LINDAT _SFR_MEM8(0xD2)
748
/* Interrupt vectors */
749
/* Vector 0 is the reset vector */
750
#define INT0_vect_num 1
751
#define INT0_vect _VECTOR(1) /* External Interrupt Request 0 */
752
#define USI_OVF_vect_num 19
753
#define USI_OVF_vect _VECTOR(19) /* USI Overflow */
754
#define INT1_vect_num 2
755
#define INT1_vect _VECTOR(2) /* External Interrupt Request 1 */
756
#define PCINT0_vect_num 3
757
#define PCINT0_vect _VECTOR(3) /* Pin Change Interrupt Request 0 */
758
#define PCINT1_vect_num 4
759
#define PCINT1_vect _VECTOR(4) /* Pin Change Interrupt Request 1 */
760
#define WDT_vect_num 5
761
#define WDT_vect _VECTOR(5) /* Watchdog Time-Out Interrupt */
762
#define TIMER1_CAPT_vect_num 6
763
#define TIMER1_CAPT_vect _VECTOR(6) /* Timer/Counter1 Capture Event */
764
#define TIMER1_COMPA_vect_num 7
765
#define TIMER1_COMPA_vect _VECTOR(7) /* Timer/Counter1 Compare Match 1A */
766
#define TIMER1_COMPB_vect_num 8
767
#define TIMER1_COMPB_vect _VECTOR(8) /* Timer/Counter1 Compare Match 1B */
768
#define TIMER1_OVF_vect_num 9
769
#define TIMER1_OVF_vect _VECTOR(9) /* Timer/Counter1 Overflow */
770
#define TIMER0_COMPA_vect_num 10
771
#define TIMER0_COMPA_vect _VECTOR(10) /* Timer/Counter0 Compare Match 0A */
772
#define TIMER0_OVF_vect_num 11
773
#define TIMER0_OVF_vect _VECTOR(11) /* Timer/Counter0 Overflow */
774
#define LIN_TC_vect_num 12
775
#define LIN_TC_vect _VECTOR(12) /* LIN Transfer Complete */
776
#define LIN_ERR_vect_num 13
777
#define LIN_ERR_vect _VECTOR(13) /* LIN Error */
778
#define SPI_STC_vect_num 14
779
#define SPI_STC_vect _VECTOR(14) /* SPI Serial Transfer Complete */
780
#define ADC_vect_num 15
781
#define ADC_vect _VECTOR(15) /* ADC Conversion Complete */
782
#define EE_RDY_vect_num 16
783
#define EE_RDY_vect _VECTOR(16) /* EEPROM Ready */
784
#define ANA_COMP_vect_num 17
785
#define ANA_COMP_vect _VECTOR(17) /* Analog Comparator */
786
#define USI_START_vect_num 18
787
#define USI_START_vect _VECTOR(18) /* USI Start */
789
#define _VECTOR_SIZE 2 /* Size of individual vector. */
790
#define _VECTORS_SIZE (20 * _VECTOR_SIZE)
794
#define SPM_PAGESIZE (128)
795
#define RAMSTART (0x0100)
796
#define RAMSIZE (512)
797
#define RAMEND (RAMSTART + RAMSIZE - 1)
798
#define XRAMSTART (NA)
800
#define XRAMEND (RAMEND)
801
#define E2END (0x1FF)
802
#define E2PAGESIZE (4)
803
#define FLASHEND (0x1FFF)
807
#define FUSE_MEMORY_SIZE 3
810
#define FUSE_CKSEL0 (unsigned char)~_BV(0) /* Select Clock source */
811
#define FUSE_CKSEL1 (unsigned char)~_BV(1) /* Select Clock source */
812
#define FUSE_CKSEL2 (unsigned char)~_BV(2) /* Select Clock source */
813
#define FUSE_CKSEL3 (unsigned char)~_BV(3) /* Select Clock source */
814
#define FUSE_SUT0 (unsigned char)~_BV(4) /* Select start-up time */
815
#define FUSE_SUT1 (unsigned char)~_BV(5) /* Select start-up time */
816
#define FUSE_CKOUT (unsigned char)~_BV(6) /* Clock Output Enable */
817
#define FUSE_CKDIV8 (unsigned char)~_BV(7) /* Divide clock by 8 */
818
#define LFUSE_DEFAULT (FUSE_CKSEL0 & FUSE_CKSEL2 & FUSE_CKSEL3 & FUSE_SUT0 & FUSE_CKDIV8)
821
#define FUSE_BODLEVEL0 (unsigned char)~_BV(0) /* Brown-out Detector trigger level */
822
#define FUSE_BODLEVEL1 (unsigned char)~_BV(1) /* Brown-out Detector trigger level */
823
#define FUSE_BODLEVEL2 (unsigned char)~_BV(2) /* Brown-out Detector trigger level */
824
#define FUSE_EESAVE (unsigned char)~_BV(3) /* EEPROM memory is preserved through the Chip Erase */
825
#define FUSE_WDTON (unsigned char)~_BV(4) /* Watchdog Timer always ON */
826
#define FUSE_SPIEN (unsigned char)~_BV(5) /* Enable Serial Program and Data Downloading */
827
#define FUSE_DWEN (unsigned char)~_BV(6) /* DebugWIRE Enable */
828
#define FUSE_RSTDISBL (unsigned char)~_BV(7) /* External Reset disable */
829
#define HFUSE_DEFAULT (FUSE_SPIEN)
831
/* Extended Fuse Byte */
832
#define FUSE_SELFPRGEN (unsigned char)~_BV(0) /* Self-Programming Enable */
833
#define EFUSE_DEFAULT (0xFF)
837
#define __LOCK_BITS_EXIST
841
#define SIGNATURE_0 0x1E
842
#define SIGNATURE_1 0x93
843
#define SIGNATURE_2 0x87
846
#endif /* _AVR_ATtiny87_H_ */