/* Copyright (c) 2005, Andrey Pashchenko Copyright (c) 2007, Anatoly Sokolov 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: io90pwm1.h 2225 2011-03-02 16:27:26Z arcanum $ */ /* avr/iopwm1.h - definitions for AT90PWM1 device */ #ifndef _AVR_IOPWM1_H_ #define _AVR_IOPWM1_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_ "iopwm1.h" #else # error "Attempt to include more than one file." #endif /* I/O registers */ /* Reserved [0x00..0x02] */ /* Port B Input Pins Address */ #define PINB _SFR_IO8(0x03) /* PINB */ #define PINB7 7 #define PINB6 6 #define PINB5 5 #define PINB4 4 #define PINB3 3 #define PINB2 2 #define PINB1 1 #define PINB0 0 /* Port B Data Direction Register */ #define DDRB _SFR_IO8(0x04) /* DDRB */ #define DDB7 7 #define DDB6 6 #define DDB5 5 #define DDB4 4 #define DDB3 3 #define DDB2 2 #define DDB1 1 #define DDB0 0 /* Port B Data Register */ #define PORTB _SFR_IO8(0x05) /* PORTB */ #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..0x08] */ /* Port D Input Pins Address */ #define PIND _SFR_IO8(0x09) /* PIND */ #define PIND7 7 #define PIND6 6 #define PIND5 5 #define PIND4 4 #define PIND3 3 #define PIND2 2 #define PIND1 1 #define PIND0 0 /* Port D Data Direction Register */ #define DDRD _SFR_IO8(0x0A) /* DDRD */ #define DDD7 7 #define DDD6 6 #define DDD5 5 #define DDD4 4 #define DDD3 3 #define DDD2 2 #define DDD1 1 #define DDD0 0 /* Port D Data Register */ #define PORTD _SFR_IO8(0x0B) /* PORTD */ #define PD7 7 #define PD6 6 #define PD5 5 #define PD4 4 #define PD3 3 #define PD2 2 #define PD1 1 #define PD0 0 /* Port E Input Pins Address */ #define PINE _SFR_IO8(0x0C) /* PINE */ #define PINE2 2 #define PINE1 1 #define PINE0 0 /* Port E Data Direction Register */ #define DDRE _SFR_IO8(0x0D) /* DDRE */ #define DDE2 2 #define DDE1 1 #define DDE0 0 /* Port E Data Register */ #define PORTE _SFR_IO8(0x0E) /* PORTE */ #define PE2 2 #define PE1 1 #define PE0 0 /* Reserved [0x0F..0x14] */ /* Timer/Counter 0 Interrupt Flag Register */ #define TIFR0 _SFR_IO8(0x15) /* TIFR0 */ #define OCF0B 2 /* Output Compare Flag 0B */ #define OCF0A 1 /* Output Compare Flag 0A */ #define TOV0 0 /* Overflow Flag */ /* Timer/Counter1 Interrupt Flag Register */ #define TIFR1 _SFR_IO8(0x16) /* TIFR1 */ #define ICF1 5 /* Input Capture Flag 1 */ #define OCF1B 2 /* Output Compare Flag 1B*/ #define OCF1A 1 /* Output Compare Flag 1A*/ #define TOV1 0 /* Overflow Flag */ /* Reserved [0x17..0x18] */ /* General Purpose I/O Register 1 */ #define GPIOR1 _SFR_IO8(0x19) /* GPIOR1 */ #define GPIOR17 7 #define GPIOR16 6 #define GPIOR15 5 #define GPIOR14 4 #define GPIOR13 3 #define GPIOR12 2 #define GPIOR11 1 #define GPIOR10 0 /* General Purpose I/O Register 2 */ #define GPIOR2 _SFR_IO8(0x1A) /* GPIOR2 */ #define GPIOR27 7 #define GPIOR26 6 #define GPIOR25 5 #define GPIOR24 4 #define GPIOR23 3 #define GPIOR22 2 #define GPIOR21 1 #define GPIOR20 0 /* General Purpose I/O Register 3 */ #define GPIOR3 _SFR_IO8(0x1B) /* GPIOR3 */ #define GPIOR37 7 #define GPIOR36 6 #define GPIOR35 5 #define GPIOR34 4 #define GPIOR33 3 #define GPIOR32 2 #define GPIOR31 1 #define GPIOR30 0 /* External Interrupt Flag Register */ #define EIFR _SFR_IO8(0x1C) /* EIFR */ #define INTF3 3 #define INTF2 2 #define INTF1 1 #define INTF0 0 /* External Interrupt Mask Register */ #define EIMSK _SFR_IO8(0x1D) /* EIMSK */ #define INT3 3 /* External Interrupt Request 3 Enable */ #define INT2 2 /* External Interrupt Request 2 Enable */ #define INT1 1 /* External Interrupt Request 1 Enable */ #define INT0 0 /* External Interrupt Request 0 Enable */ /* General Purpose I/O Register 0 */ #define GPIOR0 _SFR_IO8(0x1E) /* GPIOR0 */ #define GPIOR07 7 #define GPIOR06 6 #define GPIOR05 5 #define GPIOR04 4 #define GPIOR03 3 #define GPIOR02 2 #define GPIOR01 1 #define GPIOR00 0 /* EEPROM Control Register */ #define EECR _SFR_IO8(0x1F) /* EECR */ #define EERIE 3 /* EEPROM Ready Interrupt Enable */ #define EEMWE 2 /* EEPROM Master Write Enable */ #define EEWE 1 /* EEPROM Write Enable */ #define EERE 0 /* EEPROM Read Enable */ /* EEPROM Data Register */ #define EEDR _SFR_IO8(0x20) /* EEDR */ #define EEDR7 7 #define EEDR6 6 #define EEDR5 5 #define EEDR4 4 #define EEDR3 3 #define EEDR2 2 #define EEDR1 1 #define EEDR0 0 /* The EEPROM Address Registers */ #define EEAR _SFR_IO16(0x21) #define EEARL _SFR_IO8(0x21) #define EEARH _SFR_IO8(0x22) /* EEARH */ #define EEAR11 3 #define EEAR10 2 #define EEAR9 1 #define EEAR8 0 /* EEARL */ #define EEAR7 7 #define EEAR6 6 #define EEAR5 5 #define EEAR4 4 #define EEAR3 3 #define EEAR2 2 #define EEAR1 1 #define EEAR0 0 /* 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) /* GTCCR */ #define TSM 7 /* Timer/Counter Synchronization Mode */ #define ICPSEL1 6 /* Timer1 Input Capture Selection Bit */ #define PSRSYNC 0 /* Timer/Counter Control Register A */ #define TCCR0A _SFR_IO8(0x24) /* TCCR0A */ #define COM0A1 7 /* Compare Output Mode, Phase Correct PWM Mode */ #define COM0A0 6 /* Compare Output Mode, Phase Correct PWM Mode */ #define COM0B1 5 /* Compare Output Mode, Fast PWm */ #define COM0B0 4 /* Compare Output Mode, Fast PWm */ #define WGM01 1 /* Waveform Generation Mode */ #define WGM00 0 /* Waveform Generation Mode */ /* Timer/Counter Control Register B */ #define TCCR0B _SFR_IO8(0x25) /* TCCR0B */ #define FOC0A 7 /* Force Output Compare A */ #define FOC0B 6 /* Force Output Compare B */ #define WGM02 3 /* Waveform Generation Mode */ #define CS02 2 /* Clock Select */ #define CS01 1 /* Clock Select */ #define CS00 0 /* Clock Select */ /* Timer/Counter0 Register */ #define TCNT0 _SFR_IO8(0x26) /* TCNT0 */ #define TCNT07 7 #define TCNT06 6 #define TCNT05 5 #define TCNT04 4 #define TCNT03 3 #define TCNT02 2 #define TCNT01 1 #define TCNT00 0 /* Timer/Counter0 Output Compare Register A */ #define OCR0A _SFR_IO8(0x27) /* OCR0A */ #define OCR0A7 7 #define OCR0A6 6 #define OCR0A5 5 #define OCR0A4 4 #define OCR0A3 3 #define OCR0A2 2 #define OCR0A1 1 #define OCR0A0 0 /* Timer/Counter0 Output Compare Register B */ #define OCR0B _SFR_IO8(0x28) /* OCR0B */ #define OCR0B7 7 #define OCR0B6 6 #define OCR0B5 5 #define OCR0B4 4 #define OCR0B3 3 #define OCR0B2 2 #define OCR0B1 1 #define OCR0B0 0 /* PLL Control and Status Register */ #define PLLCSR _SFR_IO8(0x29) /* PLLCSR */ #define PLLF 2 #define PLLE 1 /* PLL Enable */ #define PLOCK 0 /* PLL Lock Detector */ /* Reserved [0x2A..0x2B] */ /* SPI Control Register */ #define SPCR _SFR_IO8(0x2C) /* SPCR */ #define SPIE 7 /* SPI Interrupt Enable */ #define SPE 6 /* SPI Enable */ #define DORD 5 /* Data Order */ #define MSTR 4 /* Master/Slave Select */ #define CPOL 3 /* Clock polarity */ #define CPHA 2 /* Clock Phase */ #define SPR1 1 /* SPI Clock Rate Select 1 */ #define SPR0 0 /* SPI Clock Rate Select 0 */ /* SPI Status Register */ #define SPSR _SFR_IO8(0x2D) /* SPSR */ #define SPIF 7 /* SPI Interrupt Flag */ #define WCOL 6 /* Write Collision Flag */ #define SPI2X 0 /* Double SPI Speed Bit */ /* SPI Data Register */ #define SPDR _SFR_IO8(0x2E) /* SPDR */ #define SPD7 7 #define SPD6 6 #define SPD5 5 #define SPD4 4 #define SPD3 3 #define SPD2 2 #define SPD1 1 #define SPD0 0 /* Reserved [0x2F] */ /* Analog Comparator Status Register */ #define ACSR _SFR_IO8(0x30) /* ACSR */ #define ACCKDIV 7 /* Analog Comparator Clock Divider */ #define AC2IF 6 /* Analog Comparator 2 Interrupt Flag Bit */ #define AC0IF 4 /* Analog Comparator 0 Interrupt Flag Bit */ #define AC2O 2 /* Analog Comparator 2 Output Bit */ #define AC0O 0 /* Analog Comparator 0 Output Bit */ /* Monitor Data Register */ #define MONDR _SFR_IO8(0x31) /* Monitor Stop Mode Control Register */ #define MSMCR _SFR_IO8(0x32) /* Sleep Mode Control Register */ #define SMCR _SFR_IO8(0x33) /* SMCR */ #define SM2 3 /* Sleep Mode Select bit2 */ #define SM1 2 /* Sleep Mode Select bit1 */ #define SM0 1 /* Sleep Mode Select bit0 */ #define SE 0 /* Sleep Enable */ /* MCU Status Register */ #define MCUSR _SFR_IO8(0x34) /* MCUSR */ #define WDRF 3 /* Watchdog Reset Flag */ #define BORF 2 /* Brown-out Reset Flag */ #define EXTRF 1 /* External Reset Flag */ #define PORF 0 /* Power-on reset flag */ /* MCU Control Register */ #define MCUCR _SFR_IO8(0x35) /* MCUCR */ #define SPIPS 7 /* SPI Pin Select */ #define PUD 4 /* Pull-up disable */ #define IVSEL 1 /* Interrupt Vector Select */ #define IVCE 0 /* Interrupt Vector Change Enable */ /* Reserved [0x36] */ /* Store Program Memory Control Register */ #define SPMCSR _SFR_IO8(0x37) /* SPMCSR */ #define SPMIE 7 /* SPM Interrupt Enable */ #define RWWSB 6 /* Read While Write Section Busy */ #define RWWSRE 4 /* Read While Write section read enable */ #define BLBSET 3 /* Boot Lock Bit Set */ #define PGWRT 2 /* Page Write */ #define PGERS 1 /* Page Erase */ #define SPMEN 0 /* Store Program Memory Enable */ /* Reserved [0x38..0x3C] */ /* 0x3D..0x3E SP [defined in ] */ /* 0x3F SREG [defined in ] */ /* Watchdog Timer Control Register */ #define WDTCSR _SFR_MEM8(0x60) /* WDTCSR */ #define WDIF 7 /* Watchdog Timeout Interrupt Flag */ #define WDIE 6 /* Watchdog Timeout Interrupt Enable */ #define WDP3 5 /* Watchdog Timer Prescaler bit3 */ #define WDCE 4 /* Watchdog Change Enable */ #define WDE 3 /* Watchdog Enable */ #define WDP2 2 /* Watchdog Timer Prescaler bit2 */ #define WDP1 1 /* Watchdog Timer Prescaler bit1 */ #define WDP0 0 /* Watchdog Timer Prescaler bit0 */ /* Clock Prescaler Register */ #define CLKPR _SFR_MEM8(0x61) /* CLKPR */ #define CLKPCE 7 /* Clock Prescaler Change Enable */ #define CLKPS3 3 /* Clock Prescaler Select bit3 */ #define CLKPS2 2 /* Clock Prescaler Select bit2 */ #define CLKPS1 1 /* Clock Prescaler Select bit1 */ #define CLKPS0 0 /* Clock Prescaler Select bit0 */ /* Reserved [0x62..0x63] */ /* Power Reduction Register */ #define PRR _SFR_MEM8(0x64) /* PRR */ #define PRPSC2 7 /* Power Reduction PSC2 */ #define PRPSC1 6 /* Power Reduction PSC1 */ #define PRPSC0 5 /* Power Reduction PSC0 */ #define PRTIM1 4 /* Power Reduction Timer/Counter1 */ #define PRTIM0 3 /* Power Reduction Timer/Counter0 */ #define PRSPI 2 /* Power Reduction Serial Peripheral Interface */ #define PRADC 0 /* Power Reduction ADC */ #define __AVR_HAVE_PRR ((1<