1
/* Copyright (c) 2008 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.
32
/* $Id: iom32c1.h,v 1.1.2.3 2008/04/28 17:06:22 arcanum Exp $ */
34
/* avr/iom32c1.h - definitions for ATmega32C1. */
36
/* This file should only be included from <avr/io.h>, never directly. */
39
# error "Include <avr/io.h> instead of this file."
43
# define _AVR_IOXXX_H_ "iom32c1.h"
45
# error "Attempt to include more than one <avr/ioXXX.h> file."
49
#ifndef _AVR_IOM32C1_H_
50
#define _AVR_IOM32C1_H_ 1
52
/* Registers and associated bit numbers */
54
#define PINB _SFR_IO8(0x03)
64
#define DDRB _SFR_IO8(0x04)
74
#define PORTB _SFR_IO8(0x05)
84
#define PINC _SFR_IO8(0x06)
94
#define DDRC _SFR_IO8(0x07)
104
#define PORTC _SFR_IO8(0x08)
114
#define PIND _SFR_IO8(0x09)
124
#define DDRD _SFR_IO8(0x0A)
134
#define PORTD _SFR_IO8(0x0B)
144
#define PINE _SFR_IO8(0x0C)
149
#define DDRE _SFR_IO8(0x0D)
154
#define PORTE _SFR_IO8(0x0E)
159
#define TIFR0 _SFR_IO8(0x15)
164
#define TIFR1 _SFR_IO8(0x16)
170
#define GPIOR1 _SFR_IO8(0x19)
180
#define GPIOR2 _SFR_IO8(0x1A)
190
#define PCIFR _SFR_IO8(0x1B)
192
#define EIFR _SFR_IO8(0x1C)
198
#define EIMSK _SFR_IO8(0x1D)
204
#define GPIOR0 _SFR_IO8(0x1E)
214
#define EECR _SFR_IO8(0x1F)
222
#define EEDR _SFR_IO8(0x20)
232
#define EEAR _SFR_IO16(0x21)
234
#define EEARL _SFR_IO8(0x21)
244
#define EEARH _SFR_IO8(0x22)
248
#define GTCCR _SFR_IO8(0x23)
254
#define TCCR0A _SFR_IO8(0x24)
262
#define TCCR0B _SFR_IO8(0x25)
270
#define TCNT0 _SFR_IO8(0x26)
280
#define OCR0A _SFR_IO8(0x27)
290
#define OCR0B _SFR_IO8(0x28)
300
#define PLLCSR _SFR_IO8(0x29)
305
#define SPCR _SFR_IO8(0x2C)
315
#define SPSR _SFR_IO8(0x2D)
320
#define SPDR _SFR_IO8(0x2E)
330
#define ACSR _SFR_IO8(0x30)
340
#define DWDR _SFR_IO8(0x31)
342
#define SMCR _SFR_IO8(0x33)
348
#define MCUSR _SFR_IO8(0x34)
354
#define MCUCR _SFR_IO8(0x35)
360
#define SPMCSR _SFR_IO8(0x37)
369
#define WDTCSR _SFR_MEM8(0x60)
379
#define CLKPR _SFR_MEM8(0x61)
386
#define PRR _SFR_MEM8(0x64)
395
#define OSCCAL _SFR_MEM8(0x66)
404
#define EICRA _SFR_MEM8(0x69)
414
#define PCMSK0 _SFR_MEM8(0x6A)
416
#define PCMSK1 _SFR_MEM8(0x6B)
418
#define PCMSK2 _SFR_MEM8(0x6C)
420
#define PCMSK3 _SFR_MEM8(0x6D)
422
#define TIMSK0 _SFR_MEM8(0x6E)
427
#define TIMSK1 _SFR_MEM8(0x6F)
433
#define AMP0CSR _SFR_MEM8(0x75)
443
#define AMP1CSR _SFR_MEM8(0x76)
453
#define AMP2CSR _SFR_MEM8(0x77)
463
#ifndef __ASSEMBLER__
464
#define ADC _SFR_MEM16(0x78)
466
#define ADCW _SFR_MEM16(0x78)
468
#define ADCL _SFR_MEM8(0x78)
478
#define ADCH _SFR_MEM8(0x79)
488
#define ADCSRA _SFR_MEM8(0x7A)
498
#define ADCSRB _SFR_MEM8(0x7B)
507
#define ADMUX _SFR_MEM8(0x7C)
516
#define DIDR0 _SFR_MEM8(0x7E)
526
#define DIDR1 _SFR_MEM8(0x7F)
535
#define TCCR1A _SFR_MEM8(0x80)
543
#define TCCR1B _SFR_MEM8(0x81)
552
#define TCCR1C _SFR_MEM8(0x82)
556
#define TCNT1 _SFR_MEM16(0x84)
558
#define TCNT1L _SFR_MEM8(0x84)
568
#define TCNT1H _SFR_MEM8(0x85)
578
#define ICR1 _SFR_MEM16(0x86)
580
#define ICR1L _SFR_MEM8(0x86)
590
#define ICR1H _SFR_MEM8(0x87)
600
#define OCR1A _SFR_MEM16(0x89)
602
#define OCR1AL _SFR_MEM8(0x88)
612
#define OCR1AH _SFR_MEM8(0x89)
622
#define OCR1B _SFR_MEM16(0x8A)
624
#define OCR1BL _SFR_MEM8(0x8A)
634
#define OCR1BH _SFR_MEM8(0x8B)
644
#define DACON _SFR_MEM8(0x90)
653
#define DAC _SFR_MEM16(0x91)
655
#define DACL _SFR_MEM8(0x91)
665
#define DACH _SFR_MEM8(0x92)
675
#define AC0CON _SFR_MEM8(0x94)
685
#define AC1CON _SFR_MEM8(0x95)
695
#define AC2CON _SFR_MEM8(0x96)
704
#define AC3CON _SFR_MEM8(0x97)
713
#define LINCR _SFR_MEM8(0xC8)
723
#define LINSIR _SFR_MEM8(0xC9)
733
#define LINENIR _SFR_MEM8(0xCA)
739
#define LINERR _SFR_MEM8(0xCB)
749
#define LINBTR _SFR_MEM8(0xCC)
758
#define LINBRR _SFR_MEM16(0xCD)
760
#define LINBRRL _SFR_MEM8(0xCD)
770
#define LINBRRH _SFR_MEM8(0xCE)
776
#define LINDLR _SFR_MEM8(0xCF)
786
#define LINIDR _SFR_MEM8(0xD0)
796
#define LINSEL _SFR_MEM8(0xD1)
802
#define LINDAT _SFR_MEM8(0xD2)
812
#define CANGCON _SFR_MEM8(0xD8)
822
#define CANGSTA _SFR_MEM8(0xD9)
830
#define CANGIT _SFR_MEM8(0xDA)
840
#define CANGIE _SFR_MEM8(0xDB)
850
#define CANEN2 _SFR_MEM8(0xDC)
858
#define CANEN1 _SFR_MEM8(0xDD)
860
#define CANIE2 _SFR_MEM8(0xDE)
868
#define CANIE1 _SFR_MEM8(0xDF)
870
#define CANSIT2 _SFR_MEM8(0xE0)
878
#define CANSIT1 _SFR_MEM8(0xE1)
880
#define CANBT1 _SFR_MEM8(0xE2)
888
#define CANBT2 _SFR_MEM8(0xE3)
895
#define CANBT3 _SFR_MEM8(0xE4)
904
#define CANTCON _SFR_MEM8(0xE5)
906
#define CANTIM _SFR_MEM16(0xE6)
908
#define CANTIML _SFR_MEM8(0xE6)
910
#define CANTIMH _SFR_MEM8(0xE7)
912
#define CANTTC _SFR_MEM16(0xE8)
914
#define CANTTCL _SFR_MEM8(0xE8)
916
#define CANTTCH _SFR_MEM8(0xE9)
918
#define CANTEC _SFR_MEM8(0xEA)
920
#define CANREC _SFR_MEM8(0xEB)
922
#define CANHPMOB _SFR_MEM8(0xEC)
932
#define CANPAGE _SFR_MEM8(0xED)
942
#define CANSTMOB _SFR_MEM8(0xEE)
952
#define CANCDMOB _SFR_MEM8(0xEF)
962
#define CANIDT4 _SFR_MEM8(0xF0)
972
#define CANIDT3 _SFR_MEM8(0xF1)
982
#define CANIDT2 _SFR_MEM8(0xF2)
992
#define CANIDT1 _SFR_MEM8(0xF3)
1002
#define CANIDM4 _SFR_MEM8(0xF4)
1011
#define CANIDM3 _SFR_MEM8(0xF5)
1021
#define CANIDM2 _SFR_MEM8(0xF6)
1031
#define CANIDM1 _SFR_MEM8(0xF7)
1041
#define CANSTM _SFR_MEM16(0xF8)
1043
#define CANSTML _SFR_MEM8(0xF8)
1045
#define CANSTMH _SFR_MEM8(0xF9)
1047
#define CANMSG _SFR_MEM8(0xFA)
1051
/* Interrupt Vectors */
1052
/* Interrupt Vector 0 is the reset vector. */
1053
#define ANACOMP0_vect _VECTOR(1) /* Analog Comparator 0 */
1054
#define ANACOMP1_vect _VECTOR(2) /* Analog Comparator 1 */
1055
#define ANACOMP2_vect _VECTOR(3) /* Analog Comparator 2 */
1056
#define ANACOMP3_vect _VECTOR(4) /* Analog Comparator 3 */
1057
#define PSC_FAULT_vect _VECTOR(5) /* PSC Fault */
1058
#define PSC_EC_vect _VECTOR(6) /* PSC End of Cycle */
1059
#define INT0_vect _VECTOR(7) /* External Interrupt Request 0 */
1060
#define INT1_vect _VECTOR(8) /* External Interrupt Request 1 */
1061
#define INT2_vect _VECTOR(9) /* External Interrupt Request 2 */
1062
#define INT3_vect _VECTOR(10) /* External Interrupt Request 3 */
1063
#define TIMER1_CAPT_vect _VECTOR(11) /* Timer/Counter1 Capture Event */
1064
#define TIMER1_COMPA_vect _VECTOR(12) /* Timer/Counter1 Compare Match A */
1065
#define TIMER1_COMPB_vect _VECTOR(13) /* Timer/Counter1 Compare Match B */
1066
#define TIMER1_OVF_vect _VECTOR(14) /* Timer1/Counter1 Overflow */
1067
#define TIMER0_COMPA_vect _VECTOR(15) /* Timer/Counter0 Compare Match A */
1068
#define TIMER0_COMPB_vect _VECTOR(16) /* Timer/Counter0 Compare Match B */
1069
#define TIMER0_OVF_vect _VECTOR(17) /* Timer/Counter0 Overflow */
1070
#define CAN_INT_vect _VECTOR(18) /* CAN MOB, Burst, General Errors */
1071
#define CAN_TOVF_vect _VECTOR(19) /* CAN Timer Overflow */
1072
#define LIN_TC_vect _VECTOR(20) /* LIN Transfer Complete */
1073
#define LIN_ERR_vect _VECTOR(21) /* LIN Error */
1074
#define PCINT0_vect _VECTOR(22) /* Pin Change Interrupt Request 0 */
1075
#define PCINT1_vect _VECTOR(23) /* Pin Change Interrupt Request 1 */
1076
#define PCINT2_vect _VECTOR(24) /* Pin Change Interrupt Request 2 */
1077
#define PCINT3_vect _VECTOR(25) /* Pin Change Interrupt Request 3 */
1078
#define SPI_STC_vect _VECTOR(26) /* SPI Serial Transfer Complete */
1079
#define ADC_vect _VECTOR(27) /* ADC Conversion Complete */
1080
#define WDT_vect _VECTOR(28) /* Watchdog Time-Out Interrupt */
1081
#define EE_READY_vect _VECTOR(29) /* EEPROM Ready */
1082
#define SPM_READY_vect _VECTOR(30) /* Store Program Memory Read */
1084
#define _VECTORS_SIZE (31 * 4)
1088
#define SPM_PAGESIZE (64)
1089
#define RAMSTART (0x100)
1090
#define RAMSIZE (0x800)
1091
#define RAMEND (RAMSTART + RAMSIZE - 1) /* Last On-Chip SRAM Location */
1092
#define XRAMSIZE (0x800)
1093
#define XRAMEND (RAMEND + XRAMSIZE)
1094
#define E2END (0x3FF)
1095
#define FLASHEND (0x7FFF)
1099
#define FUSE_MEMORY_SIZE 3
1102
#define FUSE_CKSEL0 ~_BV(0) /* Select Clock Source */
1103
#define FUSE_CKSEL1 ~_BV(1) /* Select Clock Source */
1104
#define FUSE_CKSEL2 ~_BV(2) /* Select Clock Source */
1105
#define FUSE_CKSEL3 ~_BV(3) /* Select Clock Source */
1106
#define FUSE_SUT0 ~_BV(4) /* Select start-up time */
1107
#define FUSE_SUT1 ~_BV(5) /* Select start-up time */
1108
#define FUSE_CKOUT ~_BV(6) /* Oscillator output option */
1109
#define FUSE_CKDIV8 ~_BV(7) /* Divide clock by 8 */
1110
#define LFUSE_DEFAULT (FUSE_CKSEL1 & FUSE_CKSEL2 & FUSE_CKSEL3 & FUSE_SUT0 & FUSE_SUT1 & FUSE_CKDIV8)
1112
/* High Fuse Byte */
1113
#define FUSE_BOOTRST ~_BV(0) /* Select Reset Vector */
1114
#define FUSE_BOOTSZ0 ~_BV(1) /* Select Boot Size */
1115
#define FUSE_BOOTSZ1 ~_BV(2) /* Select Boot Size */
1116
#define FUSE_EESAVE ~_BV(3) /* EEPROM memory is preserved through chip erase */
1117
#define FUSE_WDTON ~_BV(4) /* Watchdog timer always on */
1118
#define FUSE_SPIEN ~_BV(5) /* Enable Serial programming and Data Downloading */
1119
#define FUSE_DWEN ~_BV(6) /* debugWIRE Enable */
1120
#define FUSE_RSTDISBL ~_BV(7) /* External Reset Disable */
1121
#define HFUSE_DEFAULT (FUSE_BOOTSZ0 & FUSE_BOOTSZ1 & FUSE_SPIEN)
1123
/* Extended Fuse Byte */
1124
#define FUSE_BODLEVEL0 ~_BV(0) /* Brown-out Detector Trigger Level */
1125
#define FUSE_BODLEVEL1 ~_BV(1) /* Brown-out Detector Trigger Level */
1126
#define FUSE_BODLEVEL2 ~_BV(2) /* Brown-out Detector Trigger Level */
1127
#define FUSE_PSCRVB ~_BV(3) /* PSC Outputs xB Reset Value */
1128
#define FUSE_PSCRVA ~_BV(4) /* PSC Outputs xA Reset Value */
1129
#define FUSE_PSCRB ~_BV(5) /* PSC Reset Behavior */
1130
#define EFUSE_DEFAULT (FUSE_BODLEVEL1 & FUSE_BODLEVEL2)
1134
#define __LOCK_BITS_EXIST
1135
#define __BOOT_LOCK_BITS_0_EXIST
1136
#define __BOOT_LOCK_BITS_1_EXIST
1139
#endif /* _AVR_IOM32C1_H_ */