/* Copyright (c) 2006, Pieter Conradie All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* $Id: iom406.h 2225 2011-03-02 16:27:26Z arcanum $ */ /* avr/iom406.h - definitions for ATmega406 */ #ifndef _AVR_IOM406_H_ #define _AVR_IOM406_H_ 1 /* This file should only be included from , never directly. */ #ifndef _AVR_IO_H_ # error "Include instead of this file." #endif #ifndef _AVR_IOXXX_H_ # define _AVR_IOXXX_H_ "iom406.h" #else # error "Attempt to include more than one file." #endif /* I/O registers */ #define PINA _SFR_IO8(0x00) #define PINA7 7 #define PINA6 6 #define PINA5 5 #define PINA4 4 #define PINA3 3 #define PINA2 2 #define PINA1 1 #define PINA0 0 #define DDRA _SFR_IO8(0x01) #define DDA7 7 #define DDA6 6 #define DDA5 5 #define DDA4 4 #define DDA3 3 #define DDA2 2 #define DDA1 1 #define DDA0 0 #define PORTA _SFR_IO8(0x02) #define PA7 7 #define PA6 6 #define PA5 5 #define PA4 4 #define PA3 3 #define PA2 2 #define PA1 1 #define PA0 0 #define PINB _SFR_IO8(0x03) #define PINB7 7 #define PINB6 6 #define PINB5 5 #define PINB4 4 #define PINB3 3 #define PINB2 2 #define PINB1 1 #define PINB0 0 #define DDRB _SFR_IO8(0x04) #define DDB7 7 #define DDB6 6 #define DDB5 5 #define DDB4 4 #define DDB3 3 #define DDB2 2 #define DDB1 1 #define DDB0 0 #define PORTB _SFR_IO8(0x05) #define PB7 7 #define PB6 6 #define PB5 5 #define PB4 4 #define PB3 3 #define PB2 2 #define PB1 1 #define PB0 0 /* Reserved [0x06..0x07] */ #define PORTC _SFR_IO8(0x08) #define PC0 0 #define PIND _SFR_IO8(0x09) #define PIND1 1 #define PIND0 0 #define DDRD _SFR_IO8(0x0A) #define DDD1 1 #define DDD0 0 #define PORTD _SFR_IO8(0x0B) #define PD1 1 #define PD0 0 /* Reserved [0x0C..0x14] */ /* Timer/Counter0 Interrupt Flag Register */ #define TIFR0 _SFR_IO8(0x15) #define OCF0B 2 #define OCF0A 1 #define TOV0 0 /* Timer/Counter1 Interrupt Flag Register */ #define TIFR1 _SFR_IO8(0x16) #define OCF1A 1 #define TOV1 0 /* Reserved [0x17..0x1A] */ /* Pin Change Interrupt Control Register */ #define PCIFR _SFR_IO8(0x1B) #define PCIF1 1 #define PCIF0 0 /* External Interrupt Flag Register */ #define EIFR _SFR_IO8(0x1C) #define INTF3 3 #define INTF2 2 #define INTF1 1 #define INTF0 0 /* External Interrupt MaSK register */ #define EIMSK _SFR_IO8(0x1D) #define INT3 3 #define INT2 2 #define INT1 1 #define INT0 0 /* General Purpose I/O Register 0 */ #define GPIOR0 _SFR_IO8(0x1E) /* EEPROM Control Register */ #define EECR _SFR_IO8(0x1F) #define EEPM1 5 #define EEPM0 4 #define EERIE 3 #define EEMPE 2 #define EEPE 1 #define EERE 0 /* EEPROM Data Register */ #define EEDR _SFR_IO8(0x20) /* EEPROM Address Register */ #define EEAR _SFR_IO16(0x21) #define EEARL _SFR_IO8(0x21) #define EEARH _SFR_IO8(0x22) /* 6-char sequence denoting where to find the EEPROM registers in memory space. Adresses denoted in hex syntax with uppercase letters. Used by the EEPROM subroutines. First two letters: EECR address. Second two letters: EEDR address. Last two letters: EEAR address. */ #define __EEPROM_REG_LOCATIONS__ 1F2021 /* General Timer/Counter Control Register */ #define GTCCR _SFR_IO8(0x23) #define TSM 7 #define PSRSYNC 0 /* Timer/Counter Control Register A */ #define TCCR0A _SFR_IO8(0x24) #define COM0A1 7 #define COM0A0 6 #define COM0B1 5 #define COM0B0 4 #define WGM01 1 #define WGM00 0 /* Timer/Counter Control Register B */ #define TCCR0B _SFR_IO8(0x25) #define FOC0A 7 #define FOC0B 6 #define WGM02 3 #define CS02 2 #define CS01 1 #define CS00 0 /* Timer/Counter 0 */ #define TCNT0 _SFR_IO8(0x26) /* Output Compare Register A */ #define OCR0A _SFR_IO8(0x27) /* Output Compare Register B */ #define OCR0B _SFR_IO8(0x28) /* Reserved [0x29] */ /* General Purpose I/O Register 1 */ #define GPIOR1 _SFR_IO8(0x2A) /* General Purpose I/O Register 2 */ #define GPIOR2 _SFR_IO8(0x2B) /* Reserved [0x2C..0x30] */ /* On-chip Debug Register */ #define OCDR _SFR_IO8(0x31) /* Reserved [0x32] */ /* Sleep Mode Control Register */ #define SMCR _SFR_IO8(0x33) #define SM2 3 #define SM1 2 #define SM0 1 #define SE 0 /* MCU Status Register */ #define MCUSR _SFR_IO8(0x34) #define JTRF 4 #define WDRF 3 #define BODRF 2 #define EXTRF 1 #define PORF 0 /* MCU general Control Register */ #define MCUCR _SFR_IO8(0x35) #define JTD 7 #define PUD 4 #define IVSEL 1 #define IVCE 0 /* Reserved [0x36] */ /* Store Program Memory Control and Status Register */ #define SPMCSR _SFR_IO8(0x37) #define SPMIE 7 #define RWWSB 6 #define SIGRD 5 #define RWWSRE 4 #define BLBSET 3 #define PGWRT 2 #define PGERS 1 #define SPMEN 0 /* Reserved [0x36..0x3C] */ /* 0x3D..0x3E SP */ /* 0x3F SREG */ /* Extended I/O registers */ /* Watchdog Timer Control Register */ #define WDTCSR _SFR_MEM8(0x60) #define WDIF 7 #define WDIE 6 #define WDP3 5 #define WDCE 4 #define WDE 3 #define WDP2 2 #define WDP1 1 #define WDP0 0 /* Reserved [0x61] */ /* Wake-up Timer Control and Status Register */ #define WUTCSR _SFR_MEM8(0x62) #define WUTIF 7 #define WUTIE 6 #define WUTCF 5 #define WUTR 4 #define WUTE 3 #define WUTP2 2 #define WUTP1 1 #define WUTP0 0 /* Reserved [0x63] */ /* Power Reduction Register 0 */ #define PRR0 _SFR_MEM8(0x64) #define PRTWI 3 #define PRTIM1 2 #define PRTIM0 1 #define PRVADC 0 #define __AVR_HAVE_PRR0 ((1<