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: io2343.h 2456 2014-11-19 09:57:29Z saaadhu $ */ 32 33 /* avr/io2343.h - definitions for AT90S2343 */ 34 35 #ifndef _AVR_IO2343_H_ 36 #define _AVR_IO2343_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_ "io2343.h" 46 #else 47 # error "Attempt to include more than one <avr/ioXXX.h> file." 48 #endif 49 50 /* I/O registers */ 51 52 /* Input Pins, Port B */ 53 #define PINB _SFR_IO8(0x16) 54 55 /* Data Direction Register, Port B */ 56 #define DDRB _SFR_IO8(0x17) 57 58 /* Data Register, Port B */ 59 #define PORTB _SFR_IO8(0x18) 60 61 /* EEPROM Control Register */ 62 #define EECR _SFR_IO8(0x1C) 63 64 /* EEPROM Data Register */ 65 #define EEDR _SFR_IO8(0x1D) 66 67 /* EEPROM Address Register */ 68 #define EEAR _SFR_IO8(0x1E) 69 #define EEARL _SFR_IO8(0x1E) 70 71 /* Watchdog Timer Control Register */ 72 #define WDTCR _SFR_IO8(0x21) 73 74 /* Timer/Counter 0 */ 75 #define TCNT0 _SFR_IO8(0x32) 76 77 /* Timer/Counter 0 Control Register */ 78 #define TCCR0 _SFR_IO8(0x33) 79 80 /* MCU Status Register */ 81 #define MCUSR _SFR_IO8(0x34) 82 83 /* MCU general Control Register */ 84 #define MCUCR _SFR_IO8(0x35) 85 86 /* Timer/Counter Interrupt Flag register */ 87 #define TIFR _SFR_IO8(0x38) 88 89 /* Timer/Counter Interrupt MaSK register */ 90 #define TIMSK _SFR_IO8(0x39) 91 92 /* General Interrupt Flag register */ 93 #define GIFR _SFR_IO8(0x3A) 94 95 /* General Interrupt MaSK register */ 96 #define GIMSK _SFR_IO8(0x3B) 97 98 /* 0x3D..0x3E SP */ 99 100 /* 0x3F SREG */ 101 102 /* Interrupt vectors */ 103 104 /* External Interrupt 0 */ 105 #define INT0_vect_num 1 106 #define INT0_vect _VECTOR(1) 107 #define SIG_INTERRUPT0 _VECTOR(1) 108 109 /* Timer/Counter0 Overflow */ 110 #define TIMER0_OVF0_vect_num 2 111 #define TIMER0_OVF0_vect _VECTOR(2) 112 #define SIG_OVERFLOW0 _VECTOR(2) 113 114 #define _VECTORS_SIZE 6 115 116 /* 117 The Register Bit names are represented by their bit number (0-7). 118 */ 119 120 /* General Interrupt MaSK register */ 121 #define INT0 6 122 #define INTF0 6 123 124 /* General Interrupt Flag Register */ 125 #define TOIE0 1 126 #define TOV0 1 127 128 /* MCU general Control Register */ 129 #define SE 5 130 #define SM 4 131 #define ISC01 1 132 #define ISC00 0 133 134 /* MCU Status Register */ 135 #define PORF 0 136 #define EXTRF 1 137 138 /* Timer/Counter 0 Control Register */ 139 #define CS02 2 140 #define CS01 1 141 #define CS00 0 142 143 /* Watchdog Timer Control Register */ 144 #define WDTOE 4 145 #define WDE 3 146 #define WDP2 2 147 #define WDP1 1 148 #define WDP0 0 149 150 /* 151 PB3 = CLOCK 152 PB2 = SCK/T0 153 PB1 = MISO/INT0 154 PB0 = MOSI 155 */ 156 157 /* Data Register, Port B */ 158 #define PB4 4 159 #define PB3 3 160 #define PB2 2 161 #define PB1 1 162 #define PB0 0 163 164 /* Data Direction Register, Port B */ 165 #define DDB4 4 166 #define DDB3 3 167 #define DDB2 2 168 #define DDB1 1 169 #define DDB0 0 170 171 /* Input Pins, Port B */ 172 #define PINB4 4 173 #define PINB3 3 174 #define PINB2 2 175 #define PINB1 1 176 #define PINB0 0 177 178 /* EEPROM Control Register */ 179 #define EERIE 3 180 #define EEMWE 2 181 #define EEWE 1 182 #define EERE 0 183 184 /* Constants */ 185 #define RAMSTART 0x60 186 #define RAMEND 0xDF 187 #define XRAMEND RAMEND 188 #define E2END 0x7F 189 #define E2PAGESIZE 0 190 #define FLASHEND 0x07FF 191 192 193 /* Fuses */ 194 #define FUSE_MEMORY_SIZE 1 195 196 /* Low Fuse Byte */ 197 #define FUSE_RCEN (unsigned char)~_BV(0) 198 #define FUSE_SPIEN (unsigned char)~_BV(5) 199 #define LFUSE_DEFAULT (0xFF) 200 201 202 /* Lock Bits */ 203 #define __LOCK_BITS_EXIST 204 205 206 /* Signature */ 207 #define SIGNATURE_0 0x1E 208 #define SIGNATURE_1 0x91 209 #define SIGNATURE_2 0x03 210 211 212 #define SLEEP_MODE_IDLE 0 213 #define SLEEP_MODE_PWR_DOWN _BV(SM) 214 215 216 #endif /* _AVR_IO2343_H_ */ 217