1
/* Copyright (c) 2007 Anatoly Sokolov
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: iousbxx2.h,v 1.3 2007/05/12 11:40:46 aesok Exp $ */
33
/* iousbxx2.h - definitions for AT90USB82 and AT90USB162. */
35
#ifndef _AVR_IOUSBXX2_H_
36
#define _AVR_IOUSBXX2_H_ 1
38
/* This file should only be included from <avr/io.h>, never directly. */
41
# error "Include <avr/io.h> instead of this file."
45
# define _AVR_IOXXX_H_ "iousbxx2.h"
47
# error "Attempt to include more than one <avr/ioXXX.h> file."
50
/* Registers and associated bit numbers */
52
/* Reserved [0x00..0x02] */
54
#define PINB _SFR_IO8(0X03)
64
#define DDRB _SFR_IO8(0x04)
74
#define PORTB _SFR_IO8(0x05)
84
#define PINC _SFR_IO8(0x06)
93
#define DDRC _SFR_IO8(0x07)
102
#define PORTC _SFR_IO8(0x08)
111
#define PIND _SFR_IO8(0x09)
121
#define DDRD _SFR_IO8(0x0A)
131
#define PORTD _SFR_IO8(0x0B)
141
/* Reserved [0xC..0x14] */
143
#define TIFR0 _SFR_IO8(0x15)
148
#define TIFR1 _SFR_IO8(0x16)
155
/* Reserved [0x17..0x1A] */
157
#define PCIFR _SFR_IO8(0x1B)
161
#define EIFR _SFR_IO8(0x1C)
171
#define EIMSK _SFR_IO8(0x1D)
181
#define GPIOR0 _SFR_IO8(0x1E)
183
#define EECR _SFR_IO8(0x1F)
191
#define EEDR _SFR_IO8(0x20)
193
#define EEAR _SFR_IO16(0x21)
194
#define EEARL _SFR_IO8(0x21)
195
#define EEARH _SFR_IO8(0x22)
197
/* 6-char sequence denoting where to find the EEPROM registers in memory space.
198
Adresses denoted in hex syntax with uppercase letters. Used by the EEPROM
200
First two letters: EECR address.
201
Second two letters: EEDR address.
202
Last two letters: EEAR address. */
203
#define __EEPROM_REG_LOCATIONS__ 1F2021
205
#define GTCCR _SFR_IO8(0x23)
210
#define TCCR0A _SFR_IO8(0x24)
218
#define TCCR0B _SFR_IO8(0x25)
226
#define TCNT0 _SFR_IO8(0X26)
228
#define OCR0A _SFR_IO8(0x27)
230
#define OCR0B _SFR_IO8(0X28)
232
#define PLLCSR _SFR_IO8(0x29)
239
#define GPIOR1 _SFR_IO8(0x2A)
241
#define GPIOR2 _SFR_IO8(0x2B)
243
#define SPCR _SFR_IO8(0x2C)
253
#define SPSR _SFR_IO8(0x2D)
258
#define SPDR _SFR_IO8(0x2E)
260
/* Reserved [0x2F] */
262
#define ACSR _SFR_IO8(0x30)
272
#define DWDR _SFR_IO8(0x31)
275
/* Reserved [0x32] */
277
#define SMCR _SFR_IO8(0x33)
283
#define MCUSR _SFR_IO8(0x34)
290
#define MCUCR _SFR_IO8(0x35)
294
/* Reserved [0x36] */
296
#define SPMCSR _SFR_IO8(0x37)
306
/* Reserved [0x38..0x3C] */
308
/* SP [0x3D..0x3E] */
311
#define WDTCSR _SFR_MEM8(0x60)
321
#define CLKPR _SFR_MEM8(0x61)
328
#define WDTCKD _SFR_MEM8(0x62)
334
#define REGCR _SFR_MEM8(0x63)
337
#define PRR0 _SFR_MEM8(0x64)
342
#define PRR1 _SFR_MEM8(0x65)
346
#define OSCCAL _SFR_MEM8(0x66)
348
/* Reserved [0x67] */
350
#define PCICR _SFR_MEM8(0x68)
354
#define EICRA _SFR_MEM8(0x69)
364
#define EICRB _SFR_MEM8(0x6A)
374
#define PCMSK0 _SFR_MEM8(0x6B)
384
#define PCMSK1 _SFR_MEM8(0x6C)
391
/* Reserved [0x6D] */
393
#define TIMSK0 _SFR_MEM8(0x6E)
398
#define TIMSK1 _SFR_MEM8(0x6F)
405
/* Reserved [0x70..0x7F] */
407
#define TCCR1A _SFR_MEM8(0x80)
417
#define TCCR1B _SFR_MEM8(0x81)
426
#define TCCR1C _SFR_MEM8(0x82)
431
/* Reserved [0x83] */
433
/* Combine TCNT1L and TCNT1H */
434
#define TCNT1 _SFR_MEM16(0x84)
436
#define TCNT1L _SFR_MEM8(0x84)
437
#define TCNT1H _SFR_MEM8(0x85)
439
/* Combine ICR1L and ICR1H */
440
#define ICR1 _SFR_MEM16(0x86)
442
#define ICR1L _SFR_MEM8(0x86)
443
#define ICR1H _SFR_MEM8(0x87)
445
/* Combine OCR1AL and OCR1AH */
446
#define OCR1A _SFR_MEM16(0x88)
448
#define OCR1AL _SFR_MEM8(0x88)
449
#define OCR1AH _SFR_MEM8(0x89)
451
/* Combine OCR1BL and OCR1BH */
452
#define OCR1B _SFR_MEM16(0x8A)
454
#define OCR1BL _SFR_MEM8(0x8A)
455
#define OCR1BH _SFR_MEM8(0x8B)
457
/* Combine OCR1CL and OCR1CH */
458
#define OCR1C _SFR_MEM16(0x8C)
460
#define OCR1CL _SFR_MEM8(0x8C)
461
#define OCR1CH _SFR_MEM8(0x8D)
463
/* Reserved [0x8E..0xC7] */
465
#define UCSR1A _SFR_MEM8(0xC8)
475
#define UCSR1B _SFR_MEM8(0XC9)
485
#define UCSR1C _SFR_MEM8(0xCA)
495
#define UCSR1D _SFR_MEM8(0xCB)
499
/* Combine UBRR1L and UBRR1H */
500
#define UBRR1 _SFR_MEM16(0xCC)
502
#define UBRR1L _SFR_MEM8(0xCC)
503
#define UBRR1H _SFR_MEM8(0xCD)
505
#define UDR1 _SFR_MEM8(0XCE)
507
/* Reserved [0xCF] */
509
#define CKSEL0 _SFR_MEM8(0XD0)
518
#define CKSEL1 _SFR_MEM8(0XD1)
528
#define CKSTA _SFR_MEM8(0XD2)
532
/* Reserved [0xD3..0xD7] */
534
#define USBCON _SFR_MEM8(0XD8)
538
/* Reserved [0xD9..0xDA] */
540
/* Combine UDPADDL and UDPADDH */
541
#define UDPADD _SFR_MEM16(0xDB)
543
#define UDPADDL _SFR_MEM8(0xDB)
544
#define UDPADDH _SFR_MEM8(0xDC)
547
/* Reserved [0xDD..0xDF] */
549
#define UDCON _SFR_MEM8(0XE0)
554
#define UDINT _SFR_MEM8(0XE1)
562
#define UDIEN _SFR_MEM8(0XE2)
570
#define UDADDR _SFR_MEM8(0XE3)
573
/* Combine UDFNUML and UDFNUMH */
574
#define UDFNUM _SFR_MEM16(0xE4)
576
#define UDFNUML _SFR_MEM8(0xE4)
577
#define UDFNUMH _SFR_MEM8(0xE5)
579
#define UDMFN _SFR_MEM8(0XE6)
582
/* Reserved [0xE7] */
584
#define UEINTX _SFR_MEM8(0XE8)
594
#define UENUM _SFR_MEM8(0XE9)
599
#define UERST _SFR_MEM8(0XEA)
606
#define UECONX _SFR_MEM8(0XEB)
612
#define UECFG0X _SFR_MEM8(0XEC)
617
#define UECFG1X _SFR_MEM8(0XED)
625
#define UESTA0X _SFR_MEM8(0XEE)
634
#define UESTA1X _SFR_MEM8(0XEF)
639
#define UEIENX _SFR_MEM8(0XF0)
648
#define UEDATX _SFR_MEM8(0XF1)
650
#define UEBCLX _SFR_MEM8(0xF2)
652
/* Reserved [0xF3] */
654
#define UEINT _SFR_MEM8(0XF4)
661
/* Reserved [0xF5..0xF9] */
663
#define PS2CON _SFR_MEM8(0XFA)
666
#define UPOE _SFR_MEM8(0XFB)
676
/* Reserved [0xFC..0xFF] */
678
/* Interrupt vectors */
680
/* External Interrupt Request 0 */
681
#define INT0_vect _VECTOR(1)
683
/* External Interrupt Request 1 */
684
#define INT1_vect _VECTOR(2)
686
/* External Interrupt Request 2 */
687
#define INT2_vect _VECTOR(3)
689
/* External Interrupt Request 3 */
690
#define INT3_vect _VECTOR(4)
692
/* External Interrupt Request 4 */
693
#define INT4_vect _VECTOR(5)
695
/* External Interrupt Request 5 */
696
#define INT5_vect _VECTOR(6)
698
/* External Interrupt Request 6 */
699
#define INT6_vect _VECTOR(7)
701
/* External Interrupt Request 7 */
702
#define INT7_vect _VECTOR(8)
704
/* Pin Change Interrupt Request 0 */
705
#define PCINT0_vect _VECTOR(9)
707
/* Pin Change Interrupt Request 1 */
708
#define PCINT1_vect _VECTOR(10)
710
/* USB General Interrupt Request */
711
#define USB_GEN_vect _VECTOR(11)
713
/* USB Endpoint/Pipe Interrupt Communication Request */
714
#define USB_COM_vect _VECTOR(12)
716
/* Watchdog Time-out Interrupt */
717
#define WDT_vect _VECTOR(13)
719
/* Timer/Counter2 Capture Event */
720
#define TIMER1_CAPT_vect _VECTOR(14)
722
/* Timer/Counter2 Compare Match B */
723
#define TIMER1_COMPA_vect _VECTOR(15)
725
/* Timer/Counter2 Compare Match B */
726
#define TIMER1_COMPB_vect _VECTOR(16)
728
/* Timer/Counter2 Compare Match C */
729
#define TIMER1_COMPC_vect _VECTOR(17)
731
/* Timer/Counter1 Overflow */
732
#define TIMER1_OVF_vect _VECTOR(18)
734
/* Timer/Counter0 Compare Match A */
735
#define TIMER0_COMPA_vect _VECTOR(19)
737
/* Timer/Counter0 Compare Match B */
738
#define TIMER0_COMPB_vect _VECTOR(20)
740
/* Timer/Counter0 Overflow */
741
#define TIMER0_OVF_vect _VECTOR(21)
743
/* SPI Serial Transfer Complete */
744
#define SPI_STC_vect _VECTOR(22)
746
/* USART1, Rx Complete */
747
#define USART1_RX_vect _VECTOR(23)
749
/* USART1 Data register Empty */
750
#define USART1_UDRE_vect _VECTOR(24)
752
/* USART1, Tx Complete */
753
#define USART1_TX_vect _VECTOR(25)
755
/* Analog Comparator */
756
#define ANALOG_COMP_vect _VECTOR(26)
759
#define EE_READY_vect _VECTOR(27)
761
/* Store Program Memory Read */
762
#define SPM_READY_vect _VECTOR(28)
764
#define _VECTORS_SIZE 116
766
#endif /* _AVR_IOUSBXX2_H_ */