source: rtems/cpukit/score/cpu/avr/avr/iotn2313.h @ b697bc6

4.115
Last change on this file since b697bc6 was b697bc6, checked in by Joel Sherrill <joel.sherrill@…>, on 01/10/13 at 21:06:42

cpukit: Use Consistent Beginning of Doxygen Group Notation

This is the result of a sed script which converts all uses
of @{ into a consistent form.

  • Property mode set to 100644
File size: 15.7 KB
Line 
1/**
2 * @file
3 *
4 * @brief Definitions for ATtiny2313
5 *
6 * This file should only be included from <avr/io.h>, never directly.
7 */
8
9/* Copyright (c) 2004, 2005, 2006 Bob Paddock
10   All rights reserved.
11
12   Redistribution and use in source and binary forms, with or without
13   modification, are permitted provided that the following conditions are met:
14
15   * Redistributions of source code must retain the above copyright
16     notice, this list of conditions and the following disclaimer.
17
18   * Redistributions in binary form must reproduce the above copyright
19     notice, this list of conditions and the following disclaimer in
20     the documentation and/or other materials provided with the
21     distribution.
22
23   * Neither the name of the copyright holders nor the names of
24     contributors may be used to endorse or promote products derived
25     from this software without specific prior written permission.
26
27  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37  POSSIBILITY OF SUCH DAMAGE. */
38
39
40/* iotn2313.h derived from io2313.h by Bob Paddock.
41
42   The changes between the AT90S2313 and the ATtiny2313 are extensive.
43
44   Atmel has renamed several registers, and bits.  See Atmel application note
45   AVR091, as well as the errata at the end of the current ATtiny2313 data
46   sheet.  Some of the names have changed more than once during the sampling
47   period of the ATtiny2313.
48
49   Where there is no conflict the new and old names are both supported.
50
51   In the case of a new feature in a register, only the new name is used.
52   This intentionally breaks old code, so that there are no silent bugs.  The
53   source code must be updated to the new name in this case.
54
55   The hardware interrupt vector table has changed from that of the AT90S2313.
56
57   ATtiny2313 programs in page mode rather than the byte mode of the
58   AT90S2313.  Beware of programming the ATtiny2313 as a AT90S2313 device,
59   when programming the Flash.
60
61   ATtiny2313 has Signature Bytes: 0x1E 0x91 0x0A.
62
63   Changes and/or additions are noted by "ATtiny" in the comments below. */
64
65/* avr/iotn2313.h - definitions for ATtiny2313 */
66
67#ifndef _AVR_IOTN2313_H_
68#define _AVR_IOTN2313_H_ 1
69
70/* This file should only be included from <avr/io.h>, never directly. */
71
72#ifndef _AVR_IO_H_
73#  error "Include <avr/io.h> instead of this file."
74#endif
75
76#ifndef _AVR_IOXXX_H_
77#  define _AVR_IOXXX_H_ "iotn2313.h"
78#else
79#  error "Attempt to include more than one <avr/ioXXX.h> file."
80#endif
81
82/**
83 * @defgroup AvrDef_iotn2313 ATtiny2313 Definitions
84 *
85 * @ingroup avr
86 *
87 */
88/**@{**/
89
90/* I/O registers */
91
92/*
93 *  The Register Bit names are represented by their bit number (0-7).
94 *  Example: PORTB |= _BV(PORTB7); Set MSB of PORTB.
95 */
96
97/* 0x00 Reserved */
98
99/* ATtiny Digital Input Disable Register DIDR */
100#define DIDR    _SFR_IO8(0x01)
101
102#define AIN1D   1
103#define AIN0D   0
104
105/* ATtiny USART Baud Rate Register High UBBRH[11:8] */
106#define UBRRH   _SFR_IO8(0x02)
107
108/* ATtiny USART Control and Status Register C UCSRC */
109#define UCSRC   _SFR_IO8(0x03)
110
111#define UMSEL   6
112#define UPM1    5
113#define UPM0    4
114#define USBS    3
115#define UCSZ1   2
116#define UCSZ0   1
117#define UCPOL   0
118
119/* 0x04 -> 0x07 Reserved */
120
121/* ATtiny Analog Comparator Control and Status Register ACSR */
122#define ACSR    _SFR_IO8(0x08)
123
124#define ACD     7
125#define ACBG    6
126#define ACO     5
127#define ACI     4
128#define ACIE    3
129#define ACIC    2
130#define ACIS1   1
131#define ACIS0   0
132
133/* USART Baud Rate Register Low UBBRL[7:0] */
134#define UBRRL   _SFR_IO8(0x09)
135
136/* ATtiny USART Control Register UCSRB */
137#define UCSRB   _SFR_IO8(0x0A)
138
139#define RXCIE   7
140#define TXCIE   6
141#define UDRIE   5
142#define RXEN    4
143#define TXEN    3
144#define UCSZ2   2
145#define RXB8    1
146#define TXB8    0
147
148/* ATtiny USART Status Register UCSRA */
149#define UCSRA   _SFR_IO8(0x0B)
150
151#define RXC     7
152#define TXC     6
153#define UDRE    5
154#define FE      4
155#define DOR     3
156#define UPE     2
157#define U2X     1
158#define MPCM    0
159
160/* USART I/O Data Register UBR or RXB[7:0], TXB[7:0] */
161#define UDR     _SFR_IO8(0x0C)
162#define RXB     _SFR_IO8(0x0C)
163#define TXB     _SFR_IO8(0x0C)
164
165/* ATtiny USI Control Register USICR */
166#define USICR   _SFR_IO8(0x0D)
167
168#define USISIE  7
169#define USIOIE  6
170#define USIWM1  5
171#define USIWM0  4
172#define USICS1  3
173#define USICS0  2
174#define USICLK  1
175#define USITC   0
176
177/* ATtiny USI Status Register USISR */
178#define USISR   _SFR_IO8(0x0E)
179
180#define USISIF  7
181#define USIOIF  6
182#define USIPF   5
183#define USIDC   4
184#define USICNT3 3
185#define USICNT2 2
186#define USICNT1 1
187#define USICNT0 0
188
189/* ATtiny USI Data Register USIDR[7:0] */
190#define USIDR   _SFR_IO8(0x0F)
191
192/* Input Pins, Port D PIND[6:0] */
193#define PIND    _SFR_IO8(0x10)
194
195#define PIND6   6
196#define PIND5   5
197#define PIND4   4
198#define PIND3   3
199#define PIND2   2
200#define PIND1   1
201#define PIND0   0
202
203/* Data Direction Register, Port D DDRD[6:0] */
204#define DDRD    _SFR_IO8(0x11)
205
206#define DDD6    6
207#define DDD5    5
208#define DDD4    4
209#define DDD3    3
210#define DDD2    2
211#define DDD1    1
212#define DDD0    0
213
214/* Data Register, Port D PORTD[6:0] */
215#define PORTD   _SFR_IO8(0x12)
216
217#define PD6     6
218#define PD5     5
219#define PD4     4
220#define PD3     3
221#define PD2     2
222#define PD1     1
223#define PD0     0
224
225/* ATtiny General Purpose I/O Register Zero GPIOR0[7:0] */
226#define GPIOR0  _SFR_IO8(0x13)
227
228/* ATtiny General Purpose I/O Register One GPIOR1[7:0] */
229#define GPIOR1  _SFR_IO8(0x14)
230
231/* ATtiny General Purpose I/O Register Two One GPIOR2[7:0] */
232#define GPIOR2  _SFR_IO8(0x15)
233
234/* Input Pins, Port B PORTB[7:0] */
235#define PINB    _SFR_IO8(0x16)
236
237#define PINB7   7
238#define PINB6   6
239#define PINB5   5
240#define PINB4   4
241#define PINB3   3
242#define PINB2   2
243#define PINB1   1
244#define PINB0   0
245
246/* Data Direction Register, Port B PORTB[7:0] */
247#define DDRB    _SFR_IO8(0x17)
248
249#define DDB7    7
250#define DDB6    6
251#define DDB5    5
252#define DDB4    4
253#define DDB3    3
254#define DDB2    2
255#define DDB1    1
256#define DDB0    0
257
258/* Data Register, Port B PORTB[7:0] */
259#define PORTB   _SFR_IO8(0x18)
260
261#define PB7     7
262#define PB6     6
263#define PB5     5
264#define PB4     4
265#define PB3     3
266#define PB2     2
267#define PB1     1
268#define PB0     0
269
270/* Port A Input Pins Address PINA[2:0] */
271#define PINA    _SFR_IO8(0x19)
272
273#define PINA2   2
274#define PINA1   1
275#define PINA0   0
276
277/* Port A Data Direction Register DDRA[2:0] */
278#define DDRA    _SFR_IO8(0x1A)
279
280#define DDRA2   2
281#define DDRA1   1
282#define DDRA0   0
283
284/* Port A Data Register PORTA[2:0] */
285#define PORTA   _SFR_IO8(0x1B)
286
287#define PA2     2
288#define PA1     1
289#define PA0     0
290
291/* ATtiny EEPROM Control Register EECR */
292#define EECR    _SFR_IO8(0x1C)
293#define EEPM1   5
294#define EEPM0   4
295#define EERIE   3
296#define EEMPE   2
297#define EEPE    1
298#define EERE    0
299
300/* EEPROM Data Register */
301#define EEDR    _SFR_IO8(0x1D)
302
303/* The EEPROM Address Register EEAR[6:0] */
304#define EEAR    _SFR_IO8(0x1E)
305#define EEARL   _SFR_IO8(0x1E)
306#define EEAR6   6
307#define EEAR5   5
308#define EEAR4   4
309#define EEAR3   3
310#define EEAR2   2
311#define EEAR1   1
312#define EEAR0   0
313
314/* 0x1F Reserved */
315
316/* ATtiny Pin Change Mask Register PCMSK PCINT[7:0] */
317#define PCMSK   _SFR_IO8(0x20)
318
319#define PCINT7  7
320#define PCINT6  6
321#define PCINT5  5
322#define PCINT4  4
323#define PCINT3  3
324#define PCINT2  2
325#define PCINT1  1
326#define PCINT0  0
327
328/* ATtiny Watchdog Timer Control Register WDTCSR */
329#define WDTCSR  _SFR_IO8(0x21)
330
331#define WDIF    7
332#define WDIE    6
333#define WDP3    5
334#define WDCE    4
335#define WDE     3
336#define WDP2    2
337#define WDP1    1
338#define WDP0    0
339
340/* ATtiny Timer/Counter1 Control Register C TCCR1C */
341#define TCCR1C  _SFR_IO8(0x22)
342
343#define FOC1A   7
344#define FOC1B   6
345
346/* General Timer/Counter Control Register GTCCR */
347#define GTCCR   _SFR_IO8(0x23)
348
349#define PSR10   0
350
351/* T/C 1 Input Capture Register ICR1[15:0] */
352#define ICR1    _SFR_IO16(0x24)
353#define ICR1L   _SFR_IO8(0x24)
354#define ICR1H   _SFR_IO8(0x25)
355
356/* ATtiny Clock Prescale Register */
357#define CLKPR   _SFR_IO8(0x26)
358
359#define CLKPCE  7
360#define CLKPS3  3
361#define CLKPS2  2
362#define CLKPS1  1
363#define CLKPS0  0
364
365/* 0x27 Reserved */
366
367/* ATtiny Output Compare Register 1 B OCR1B[15:0] */
368#define OCR1B   _SFR_IO16(0x28)
369#define OCR1BL  _SFR_IO8(0x28)
370#define OCR1BH  _SFR_IO8(0x29)
371
372/* Output Compare Register 1 OCR1A[15:0] */
373#define OCR1    _SFR_IO16(0x2A)
374#define OCR1L   _SFR_IO8(0x2A)
375#define OCR1H   _SFR_IO8(0x2B)
376#define OCR1A   _SFR_IO16(0x2A)
377#define OCR1AL  _SFR_IO8(0x2A)
378#define OCR1AH  _SFR_IO8(0x2B)
379
380/* Timer/Counter 1 TCNT1[15:0] */
381#define TCNT1   _SFR_IO16(0x2C)
382#define TCNT1L  _SFR_IO8(0x2C)
383#define TCNT1H  _SFR_IO8(0x2D)
384
385/* ATtiny Timer/Counter 1 Control and Status Register TCCR1B */
386#define TCCR1B  _SFR_IO8(0x2E)
387
388#define ICNC1   7
389#define ICES1   6
390#define WGM13   4
391#define WGM12   3 /* Was CTC1 in AT90S2313 */
392#define CS12    2
393#define CS11    1
394#define CS10    0
395
396/* ATtiny Timer/Counter 1 Control Register TCCR1A */
397#define TCCR1A  _SFR_IO8(0x2F)
398
399#define COM1A1  7
400#define COM1A0  6
401#define COM1B1  5
402#define COM1B0  4
403#define WGM11   1 /* Was PWM11 in AT90S2313 */
404#define WGM10   0 /* Was PWM10 in AT90S2313 */
405
406/* ATtiny Timer/Counter Control Register A TCCR0A */
407#define TCCR0A  _SFR_IO8(0x30)
408
409#define COM0A1  7
410#define COM0A0  6
411#define COM0B1  5
412#define COM0B0  4
413#define WGM01   1
414#define WGM00   0
415
416/* ATtiny Oscillator Calibration Register OSCCAL[6:0] */
417#define OSCCAL  _SFR_IO8(0x31)
418
419#define CAL6    6
420#define CAL5    5
421#define CAL4    4
422#define CAL3    3
423#define CAL2    2
424#define CAL1    1
425#define CAL0    0
426
427/* Timer/Counter 0 TCNT0[7:0] */
428#define TCNT0   _SFR_IO8(0x32)
429
430/* ATtiny Timer/Counter 0 Control Register TCCR0B */
431#define TCCR0B  _SFR_IO8(0x33)
432
433#define FOC0A   7
434#define FOC0B   6
435#define WGM02   3
436#define CS02    2
437#define CS01    1
438#define CS00    0
439
440/* ATtiny MCU Status Register MCUSR */
441#define MCUSR   _SFR_IO8(0x34)
442
443#define WDRF    3
444#define BORF    2
445#define EXTRF   1
446#define PORF    0
447
448/* ATtiny MCU general Control Register MCUCR */
449#define MCUCR   _SFR_IO8(0x35)
450
451#define PUD     7
452#define SM1     6
453#define SE      5
454#define SM0     4 /* Some preliminary ATtiny2313 data sheets incorrectly refer
455                     to this bit as SMD; was SM in AT90S2313. */
456#define ISC11   3
457#define ISC10   2
458#define ISC01   1
459#define ISC00   0
460
461/* ATtiny Output Compare Register A OCR0A[7:0] */
462#define OCR0A   _SFR_IO8(0x36)
463
464/* ATtiny Store Program Memory Control and Status Register SPMCSR */
465#define SPMCSR  _SFR_IO8(0x37)
466
467#define CTPB    4
468#define RFLB    3
469#define PGWRT   2
470#define PGERS   1
471#define SPMEN   0   /* The name is used in ATtiny2313.xml file. */
472#define SELFPRGEN 0 /* The name is used in datasheet. */
473#define SELFPRGE  0 /* The name is left for compatibility. */
474
475/* ATtiny Timer/Counter Interrupt Flag register TIFR */
476#define TIFR    _SFR_IO8(0x38)
477
478#define TOV1    7
479#define OCF1A   6
480#define OCF1B   5
481#define ICF1    3
482#define OCF0B   2
483#define TOV0    1
484#define OCF0A   0
485
486/* ATtiny Timer/Counter Interrupt MaSK register TIMSK */
487#define TIMSK   _SFR_IO8(0x39)
488
489#define TOIE1   7
490#define OCIE1A  6
491#define OCIE1B  5
492#define ICIE1   3
493#define OCIE0B  2
494#define TOIE0   1
495#define OCIE0A  0
496
497/* ATtiny External Interrupt Flag Register EIFR, was GIFR */
498#define EIFR    _SFR_IO8(0x3A)
499
500#define INTF1   7
501#define INTF0   6
502#define PCIF    5
503
504/* ATtiny General Interrupt MaSK register GIMSK */
505#define GIMSK   _SFR_IO8(0x3B)
506
507#define INT1    7
508#define INT0    6
509#define PCIE    5
510
511/* ATtiny Output Compare Register B OCR0B[7:0] */
512#define OCR0B   _SFR_IO8(0x3C)
513
514/* Interrupt vectors: */
515
516/* External Interrupt Request 0 */
517#define INT0_vect                       _VECTOR(1)
518#define SIG_INTERRUPT0                  _VECTOR(1)
519#define SIG_INT0                        _VECTOR(1)
520
521/* External Interrupt Request 1 */
522#define INT1_vect                       _VECTOR(2)
523#define SIG_INTERRUPT1                  _VECTOR(2)
524#define SIG_INT1                        _VECTOR(2)
525
526/* Timer/Counter1 Capture Event */
527#define TIMER1_CAPT_vect                _VECTOR(3)
528#define SIG_INPUT_CAPTURE1              _VECTOR(3)
529#define SIG_TIMER1_CAPT                 _VECTOR(3)
530
531/* Timer/Counter1 Compare Match A */
532#define TIMER1_COMPA_vect               _VECTOR(4)
533#define SIG_OUTPUT_COMPARE1A            _VECTOR(4)
534#define SIG_TIMER1_COMPA                _VECTOR(4)
535
536/* Timer/Counter1 Overflow */
537#define TIMER1_OVF_vect                 _VECTOR(5)
538#define SIG_OVERFLOW1                   _VECTOR(5)
539#define SIG_TIMER1_OVF                  _VECTOR(5)
540
541/* Timer/Counter0 Overflow */
542#define TIMER0_OVF_vect                 _VECTOR(6)
543#define SIG_OVERFLOW0                   _VECTOR(6)
544#define SIG_TIMER0_OVF                  _VECTOR(6)
545
546/* USART, Rx Complete */
547#define USART_RX_vect                   _VECTOR(7)
548#define SIG_USART0_RECV                 _VECTOR(7)
549#define SIG_USART0_RX                   _VECTOR(7)
550
551/* USART Data Register Empty */
552#define USART_UDRE_vect                 _VECTOR(8)
553#define SIG_USART0_DATA                 _VECTOR(8)
554#define SIG_USART0_UDRE                 _VECTOR(8)
555
556/* USART, Tx Complete */
557#define USART_TX_vect                   _VECTOR(9)
558#define SIG_USART0_TRANS                _VECTOR(9)
559#define SIG_USART0_TX                   _VECTOR(9)
560
561/* Analog Comparator */
562#define ANA_COMP_vect                   _VECTOR(10)
563#define SIG_COMPARATOR                  _VECTOR(10)
564#define SIG_ANALOG_COMP                 _VECTOR(10)
565#define PCINT_vect                      _VECTOR(11)
566#define SIG_PIN_CHANGE                  _VECTOR(11)
567#define SIG_PCINT                       _VECTOR(11)
568#define TIMER1_COMPB_vect               _VECTOR(12)
569#define SIG_OUTPUT_COMPARE1B            _VECTOR(12)
570#define SIG_TIMER1_COMPB                _VECTOR(12)
571#define TIMER0_COMPA_vect               _VECTOR(13)
572#define SIG_OUTPUT_COMPARE0A            _VECTOR(13)
573#define SIG_TIMER0_COMPA                _VECTOR(13)
574#define TIMER0_COMPB_vect               _VECTOR(14)
575#define SIG_OUTPUT_COMPARE0B            _VECTOR(14)
576#define SIG_TIMER0_COMPB                _VECTOR(14)
577
578/* USI Start Condition */
579#define USI_START_vect                  _VECTOR(15)
580#define SIG_USI_START                   _VECTOR(15)
581#define SIG_USI_START                   _VECTOR(15)
582
583/* USI Overflow */
584#define USI_OVERFLOW_vect               _VECTOR(16)
585#define SIG_USI_OVERFLOW                _VECTOR(16)
586#define SIG_USI_OVERFLOW                _VECTOR(16)
587#define EEPROM_READY_vect               _VECTOR(17)
588#define SIG_EEPROM_READY                _VECTOR(17)
589#define SIG_EE_READY                    _VECTOR(17)
590
591/* Watchdog Timer Overflow */
592#define WDT_OVERFLOW_vect               _VECTOR(18)
593#define SIG_WATCHDOG_TIMEOUT            _VECTOR(18)
594#define SIG_WDT_OVERFLOW                _VECTOR(18)
595
596/* 38 = (18*2)+2: Number of vectors times two, plus the reset vector */
597#define _VECTORS_SIZE     38
598
599/* Constants */
600#define SPM_PAGESIZE 32
601#define RAMEND       0xDF
602#define XRAMEND      RAMEND
603#define E2END        0x7F
604#define E2PAGESIZE   4
605#define FLASHEND     0x07FF
606
607
608/* Fuses */
609#define FUSE_MEMORY_SIZE 3
610
611/* Low Fuse Byte */
612#define FUSE_CKSEL0      (unsigned char)~_BV(0)
613#define FUSE_CKSEL1      (unsigned char)~_BV(1)
614#define FUSE_CKSEL2      (unsigned char)~_BV(2)
615#define FUSE_CKSEL3      (unsigned char)~_BV(3)
616#define FUSE_SUT0        (unsigned char)~_BV(4)
617#define FUSE_SUT1        (unsigned char)~_BV(5)
618#define FUSE_CKOUT       (unsigned char)~_BV(6)
619#define FUSE_CKDIV8      (unsigned char)~_BV(7)
620#define LFUSE_DEFAULT (FUSE_CKSEL0 & FUSE_CKSEL1 & FUSE_CKSEL3 & FUSE_SUT0 & FUSE_CKDIV8)
621
622/* High Fuse Byte */
623#define FUSE_RSTDISBL    (unsigned char)~_BV(0)
624#define FUSE_BODLEVEL0   (unsigned char)~_BV(1)
625#define FUSE_BODLEVEL1   (unsigned char)~_BV(2)
626#define FUSE_BODLEVEL2   (unsigned char)~_BV(3)
627#define FUSE_WDTON       (unsigned char)~_BV(4)
628#define FUSE_SPIEN       (unsigned char)~_BV(5)
629#define FUSE_EESAVE      (unsigned char)~_BV(6)
630#define FUSE_DWEN        (unsigned char)~_BV(7)
631#define HFUSE_DEFAULT (FUSE_SPIEN)
632
633/* Extended Fuse Byte */
634#define FUSE_SELFPRGEN   (unsigned char)~_BV(0)
635#define EFUSE_DEFAULT (0xFF)
636
637
638/* Lock Bits */
639#define __LOCK_BITS_EXIST
640
641
642/* Signature */
643#define SIGNATURE_0 0x1E
644#define SIGNATURE_1 0x91
645#define SIGNATURE_2 0x0A
646
647/** @} */
648
649#endif  /* _AVR_IOTN2313_H_ */
Note: See TracBrowser for help on using the repository browser.