1
/* Copyright (c) 2009 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. */
31
/* $Id: iotn4.h 2063 2009-11-18 22:06:28Z arcanum $ */
33
/* avr/iotn4.h - definitions for ATtiny4 */
35
/* This file should only be included from <avr/io.h>, never directly. */
38
# error "Include <avr/io.h> instead of this file."
42
# define _AVR_IOXXX_H_ "iotn4.h"
44
# error "Attempt to include more than one <avr/ioXXX.h> file."
48
#ifndef _AVR_ATtiny4_H_
49
#define _AVR_ATtiny4_H_ 1
52
/* Registers and associated bit numbers. */
54
#define PINB _SFR_IO8(0x00)
60
#define DDRB _SFR_IO8(0x01)
66
#define PORTB _SFR_IO8(0x02)
72
#define PUEB _SFR_IO8(0x03)
78
#define PORTCR _SFR_IO8(0x0C)
81
#define PCMSK _SFR_IO8(0x10)
87
#define PCIFR _SFR_IO8(0x11)
90
#define PCICR _SFR_IO8(0x12)
93
#define EIMSK _SFR_IO8(0x13)
96
#define EIFR _SFR_IO8(0x14)
99
#define EICRA _SFR_IO8(0x15)
103
#define DIDR0 _SFR_IO8(0x17)
107
#define ACSR _SFR_IO8(0x1F)
116
#define ICR0 _SFR_IO16(0x22)
118
#define ICR0L _SFR_IO8(0x22)
128
#define ICR0H _SFR_IO8(0x23)
138
#define OCR0B _SFR_IO16(0x24)
140
#define OCR0BL _SFR_IO8(0x24)
150
#define OCR0BH _SFR_IO8(0x25)
160
#define OCR0A _SFR_IO16(0x26)
162
#define OCR0AL _SFR_IO8(0x26)
172
#define OCR0AH _SFR_IO8(0x27)
182
#define TCNT0 _SFR_IO16(0x28)
184
#define TCNT0L _SFR_IO8(0x28)
194
#define TCNT0H _SFR_IO8(0x29)
204
#define TIFR0 _SFR_IO8(0x2A)
210
#define TIMSK0 _SFR_IO8(0x2B)
216
#define TCCR0C _SFR_IO8(0x2C)
220
#define TCCR0B _SFR_IO8(0x2D)
229
#define TCCR0A _SFR_IO8(0x2E)
237
#define GTCCR _SFR_IO8(0x2F)
241
#define WDTCSR _SFR_IO8(0x31)
250
#define NVMCSR _SFR_IO8(0x32)
253
#define NVMCMD _SFR_IO8(0x33)
261
#define VLMCSR _SFR_IO8(0x34)
268
#define PRR _SFR_IO8(0x35)
272
#define CLKPSR _SFR_IO8(0x36)
278
#define CLKMSR _SFR_IO8(0x37)
282
#define OSCCAL _SFR_IO8(0x39)
292
#define SMCR _SFR_IO8(0x3A)
298
#define RSTFLR _SFR_IO8(0x3B)
303
#define CCP _SFR_IO8(0x3C)
314
/* Interrupt vectors */
315
/* Vector 0 is the reset vector */
316
#define INT0_vect_num 1
317
#define INT0_vect _VECTOR(1) /* External Interrupt Request 0 */
318
#define PCINT0_vect_num 2
319
#define PCINT0_vect _VECTOR(2) /* Pin Change Interrupt Request 0 */
320
#define TIM0_CAPT_vect_num 3
321
#define TIM0_CAPT_vect _VECTOR(3) /* Timer/Counter0 Input Capture */
322
#define TIM0_OVF_vect_num 4
323
#define TIM0_OVF_vect _VECTOR(4) /* Timer/Counter0 Overflow */
324
#define TIM0_COMPA_vect_num 5
325
#define TIM0_COMPA_vect _VECTOR(5) /* Timer/Counter Compare Match A */
326
#define TIM0_COMPB_vect_num 6
327
#define TIM0_COMPB_vect _VECTOR(6) /* Timer/Counter Compare Match B */
328
#define ANA_COMP_vect_num 7
329
#define ANA_COMP_vect _VECTOR(7) /* Analog Comparator */
330
#define WDT_vect_num 8
331
#define WDT_vect _VECTOR(8) /* Watchdog Time-out */
332
#define VLM_vect_num 9
333
#define VLM_vect _VECTOR(9) /* Vcc Voltage Level Monitor */
335
#define _VECTOR_SIZE 2 /* Size of individual vector. */
336
#define _VECTORS_SIZE (10 * _VECTOR_SIZE)
340
#define SPM_PAGESIZE (32)
341
#define RAMSTART (0x40)
343
#define RAMEND (RAMSTART + RAMSIZE - 1)
344
#define XRAMSTART (NA)
346
#define XRAMEND (RAMEND)
348
#define E2PAGESIZE (0)
349
#define FLASHEND (0x1FF)
353
#define FUSE_MEMORY_SIZE 0
357
#define __LOCK_BITS_EXIST
361
#define SIGNATURE_0 0x1E
362
#define SIGNATURE_1 0x90
363
#define SIGNATURE_2 0x0A
366
/* Device Pin Definitions */
367
#define SPDATA_DDR DDRCINT
368
#define SPDATA_PORT PORTCINT
369
#define SPDATA_PIN PINCINT
370
#define SPDATA_BIT INT0
372
#define OC0A_DDR DDRCINT
373
#define OC0A_PORT PORTCINT
374
#define OC0A_PIN PINCINT
375
#define OC0A_BIT INT0
377
#define ADC0_DDR DDRCINT
378
#define ADC0_PORT PORTCINT
379
#define ADC0_PIN PINCINT
380
#define ADC0_BIT INT0
382
#define AIN0_DDR DDRCINT
383
#define AIN0_PORT PORTCINT
384
#define AIN0_PIN PINCINT
385
#define AIN0_BIT INT0
387
#define PB0_DDR DDRCINT
388
#define PB0_PORT PORTCINT
389
#define PB0_PIN PINCINT
392
#define SPCLK_DDR DDRCINT
393
#define SPCLK_PORT PORTCINT
394
#define SPCLK_PIN PINCINT
395
#define SPCLK_BIT INT1
397
#define CLKI_DDR DDRCINT
398
#define CLKI_PORT PORTCINT
399
#define CLKI_PIN PINCINT
400
#define CLKI_BIT INT1
402
#define ICP0_DDR DDRCINT
403
#define ICP0_PORT PORTCINT
404
#define ICP0_PIN PINCINT
405
#define ICP0_BIT INT1
407
#define OC0B_DDR DDRCINT
408
#define OC0B_PORT PORTCINT
409
#define OC0B_PIN PINCINT
410
#define OC0B_BIT INT1
412
#define ADC1_DDR DDRCINT
413
#define ADC1_PORT PORTCINT
414
#define ADC1_PIN PINCINT
415
#define ADC1_BIT INT1
417
#define AIN1_DDR DDRCINT
418
#define AIN1_PORT PORTCINT
419
#define AIN1_PIN PINCINT
420
#define AIN1_BIT INT1
422
#define PB1_DDR DDRCINT
423
#define PB1_PORT PORTCINT
424
#define PB1_PIN PINCINT
427
#define CLKO_DDR DDRT
428
#define CLKO_PORT PORTT
429
#define CLKO_PIN PINT
432
#define PCINT2_DDR DDRT
433
#define PCINT2_PORT PORTT
434
#define PCINT2_PIN PINT
435
#define PCINT2_BIT T0
437
#define INT0_DDR DDRT
438
#define INT0_PORT PORTT
439
#define INT0_PIN PINT
442
#define ADC2_DDR DDRT
443
#define ADC2_PORT PORTT
444
#define ADC2_PIN PINT
448
#define PB2_PORT PORTT
452
#define PCINT3_DDR DDRRESET
453
#define PCINT3_PORT PORTRESET
454
#define PCINT3_PIN PINRESET
455
#define PCINT3_BIT RESET
457
#define ADC3_DDR DDRRESET
458
#define ADC3_PORT PORTRESET
459
#define ADC3_PIN PINRESET
460
#define ADC3_BIT RESET
462
#define PB3_DDR DDRRESET
463
#define PB3_PORT PORTRESET
464
#define PB3_PIN PINRESET
465
#define PB3_BIT RESET
467
#endif /* _AVR_ATtiny4_H_ */