source: rtems/cpukit/score/cpu/avr/avr/io90pwm1.h @ 04a62dce

4.104.11
Last change on this file since 04a62dce was 04a62dce, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 6, 2009 at 2:52:07 PM

2009-08-05 Josh Switnicki <josh.switnicki@…>

  • Makefile.am: added AVR specific Header files to score/cpu/avr/avr. These are from avr-libc 1.6 and assumed to exist by AVR applications.
  • preinstall.am: Regenerated.
  • Property mode set to 100644
File size: 32.8 KB
Line 
1/* Copyright (c) 2005, Andrey Pashchenko
2   Copyright (c) 2007, Anatoly Sokolov
3   All rights reserved.
4
5   Redistribution and use in source and binary forms, with or without
6   modification, are permitted provided that the following conditions are met:
7
8   * Redistributions of source code must retain the above copyright
9     notice, this list of conditions and the following disclaimer.
10
11   * Redistributions in binary form must reproduce the above copyright
12     notice, this list of conditions and the following disclaimer in
13     the documentation and/or other materials provided with the
14     distribution.
15
16   * Neither the name of the copyright holders nor the names of
17     contributors may be used to endorse or promote products derived
18     from this software without specific prior written permission.
19
20  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  POSSIBILITY OF SUCH DAMAGE. */
31
32/* $Id$ */
33
34/* avr/iopwm1.h - definitions for AT90PWM1 device */
35
36#ifndef _AVR_IOPWM1_H_
37#define _AVR_IOPWM1_H_ 1
38
39/* This file should only be included from <avr/io.h>, never directly. */
40
41#ifndef _AVR_IO_H_
42#  error "Include <avr/io.h> instead of this file."
43#endif
44
45#ifndef _AVR_IOXXX_H_
46#  define _AVR_IOXXX_H_ "iopwm1.h"
47#else
48#  error "Attempt to include more than one <avr/ioXXX.h> file."
49#endif
50
51/* I/O registers */
52
53/* Reserved [0x00..0x02] */
54
55/* Port B Input Pins Address */
56#define PINB    _SFR_IO8(0x03)
57/* PINB */
58#define PINB7   7
59#define PINB6   6
60#define PINB5   5
61#define PINB4   4
62#define PINB3   3
63#define PINB2   2
64#define PINB1   1
65#define PINB0   0
66
67/* Port B Data Direction Register */
68#define DDRB    _SFR_IO8(0x04)
69/* DDRB */
70#define DDB7    7
71#define DDB6    6
72#define DDB5    5
73#define DDB4    4
74#define DDB3    3
75#define DDB2    2
76#define DDB1    1
77#define DDB0    0
78
79/* Port B Data Register */
80#define PORTB   _SFR_IO8(0x05)
81/* PORTB */
82#define PB7     7
83#define PB6     6
84#define PB5     5
85#define PB4     4
86#define PB3     3
87#define PB2     2
88#define PB1     1
89#define PB0     0
90
91/* Reserved [0x06..0x08] */
92
93/* Port D Input Pins Address */
94#define PIND    _SFR_IO8(0x09)
95/* PIND */
96#define PIND7   7
97#define PIND6   6
98#define PIND5   5
99#define PIND4   4
100#define PIND3   3
101#define PIND2   2
102#define PIND1   1
103#define PIND0   0
104
105/* Port D Data Direction Register */
106#define DDRD    _SFR_IO8(0x0A)
107/* DDRD */
108#define DDD7    7
109#define DDD6    6
110#define DDD5    5
111#define DDD4    4
112#define DDD3    3
113#define DDD2    2
114#define DDD1    1
115#define DDD0    0
116
117/* Port D Data Register */
118#define PORTD   _SFR_IO8(0x0B)
119/* PORTD */
120#define PD7     7
121#define PD6     6
122#define PD5     5
123#define PD4     4
124#define PD3     3
125#define PD2     2
126#define PD1     1
127#define PD0     0
128
129/* Port E Input Pins Address */
130#define PINE    _SFR_IO8(0x0C)
131/* PINE */
132#define PINE2   2
133#define PINE1   1
134#define PINE0   0
135
136/* Port E Data Direction Register */
137#define DDRE    _SFR_IO8(0x0D)
138/* DDRE */
139#define DDE2    2
140#define DDE1    1
141#define DDE0    0
142
143/* Port E Data Register */
144#define PORTE   _SFR_IO8(0x0E)
145/* PORTE */
146#define PE2     2
147#define PE1     1
148#define PE0     0
149
150/* Reserved [0x0F..0x14] */
151
152/* Timer/Counter 0 Interrupt Flag Register */
153#define TIFR0   _SFR_IO8(0x15)
154/* TIFR0 */
155#define OCF0B   2   /* Output Compare Flag 0B */
156#define OCF0A   1   /* Output Compare Flag 0A */
157#define TOV0    0   /* Overflow Flag */
158
159/* Timer/Counter1 Interrupt Flag Register */
160#define TIFR1   _SFR_IO8(0x16)
161/* TIFR1 */
162#define ICF1    5   /* Input Capture Flag 1 */
163#define OCF1B   2   /* Output Compare Flag 1B*/
164#define OCF1A   1   /* Output Compare Flag 1A*/
165#define TOV1    0   /* Overflow Flag */
166
167/* Reserved [0x17..0x18] */
168
169/* General Purpose I/O Register 1 */
170#define GPIOR1  _SFR_IO8(0x19)
171/* GPIOR1 */
172#define GPIOR17 7
173#define GPIOR16 6
174#define GPIOR15 5
175#define GPIOR14 4
176#define GPIOR13 3
177#define GPIOR12 2
178#define GPIOR11 1
179#define GPIOR10 0
180
181/* General Purpose I/O Register 2 */
182#define GPIOR2  _SFR_IO8(0x1A)
183/* GPIOR2 */
184#define GPIOR27 7
185#define GPIOR26 6
186#define GPIOR25 5
187#define GPIOR24 4
188#define GPIOR23 3
189#define GPIOR22 2
190#define GPIOR21 1
191#define GPIOR20 0
192
193/* General Purpose I/O Register 3 */
194#define GPIOR3  _SFR_IO8(0x1B)
195/* GPIOR3 */
196#define GPIOR37 7
197#define GPIOR36 6
198#define GPIOR35 5
199#define GPIOR34 4
200#define GPIOR33 3
201#define GPIOR32 2
202#define GPIOR31 1
203#define GPIOR30 0
204
205/* External Interrupt Flag Register */
206#define EIFR    _SFR_IO8(0x1C)
207/* EIFR */
208#define INTF3   3
209#define INTF2   2
210#define INTF1   1
211#define INTF0   0
212
213/* External Interrupt Mask Register */
214#define EIMSK   _SFR_IO8(0x1D)
215/* EIMSK */
216#define INT3    3   /* External Interrupt Request 3 Enable */
217#define INT2    2   /* External Interrupt Request 2 Enable */
218#define INT1    1   /* External Interrupt Request 1 Enable */
219#define INT0    0   /* External Interrupt Request 0 Enable */
220
221/* General Purpose I/O Register 0 */
222#define GPIOR0  _SFR_IO8(0x1E)
223/* GPIOR0 */
224#define GPIOR07 7
225#define GPIOR06 6
226#define GPIOR05 5
227#define GPIOR04 4
228#define GPIOR03 3
229#define GPIOR02 2
230#define GPIOR01 1
231#define GPIOR00 0
232
233/* EEPROM Control Register */
234#define EECR    _SFR_IO8(0x1F)
235/* EECR */
236#define EERIE   3   /* EEPROM Ready Interrupt Enable */
237#define EEMWE   2   /* EEPROM Master Write Enable */
238#define EEWE    1   /* EEPROM Write Enable */
239#define EERE    0   /* EEPROM Read Enable */
240
241/* EEPROM Data Register */
242#define EEDR    _SFR_IO8(0x20)
243/* EEDR */
244#define EEDR7   7
245#define EEDR6   6
246#define EEDR5   5
247#define EEDR4   4
248#define EEDR3   3
249#define EEDR2   2
250#define EEDR1   1
251#define EEDR0   0
252
253/* The EEPROM Address Registers */
254#define EEAR    _SFR_IO16(0x21)
255#define EEARL   _SFR_IO8(0x21)
256#define EEARH   _SFR_IO8(0x22)
257/* EEARH */
258#define EEAR11  3
259#define EEAR10  2
260#define EEAR9   1
261#define EEAR8   0
262/* EEARL */
263#define EEAR7   7
264#define EEAR6   6
265#define EEAR5   5
266#define EEAR4   4
267#define EEAR3   3
268#define EEAR2   2
269#define EEAR1   1
270#define EEAR0   0
271
272/* 6-char sequence denoting where to find the EEPROM registers in memory space.
273   Adresses denoted in hex syntax with uppercase letters. Used by the EEPROM
274   subroutines.
275   First two letters:  EECR address.
276   Second two letters: EEDR address.
277   Last two letters:   EEAR address.  */
278#define __EEPROM_REG_LOCATIONS__ 1F2021
279
280/* General Timer/Counter Control Register */
281#define GTCCR   _SFR_IO8(0x23)
282/* GTCCR */
283#define TSM     7   /* Timer/Counter Synchronization Mode */
284#define ICPSEL1 6   /* Timer1 Input Capture Selection Bit */
285#define PSRSYNC 0
286
287/* Timer/Counter Control Register A */
288#define TCCR0A  _SFR_IO8(0x24)
289/* TCCR0A */
290#define COM0A1  7   /* Compare Output Mode, Phase Correct PWM Mode */
291#define COM0A0  6   /* Compare Output Mode, Phase Correct PWM Mode */
292#define COM0B1  5   /* Compare Output Mode, Fast PWm */
293#define COM0B0  4   /* Compare Output Mode, Fast PWm */
294#define WGM01   1   /* Waveform Generation Mode */
295#define WGM00   0   /* Waveform Generation Mode */
296
297/* Timer/Counter Control Register B */
298#define TCCR0B  _SFR_IO8(0x25)
299/* TCCR0B */
300#define FOC0A   7   /* Force Output Compare A */
301#define FOC0B   6   /* Force Output Compare B */
302#define WGM02   3   /* Waveform Generation Mode */
303#define CS02    2   /* Clock Select */
304#define CS01    1   /* Clock Select */
305#define CS00    0   /* Clock Select */
306
307/* Timer/Counter0 Register */
308#define TCNT0   _SFR_IO8(0x26)
309/* TCNT0 */
310#define TCNT07  7
311#define TCNT06  6
312#define TCNT05  5
313#define TCNT04  4
314#define TCNT03  3
315#define TCNT02  2
316#define TCNT01  1
317#define TCNT00  0
318
319/* Timer/Counter0 Output Compare Register A */
320#define OCR0A   _SFR_IO8(0x27)
321/* OCR0A */
322#define OCR0A7  7
323#define OCR0A6  6
324#define OCR0A5  5
325#define OCR0A4  4
326#define OCR0A3  3
327#define OCR0A2  2
328#define OCR0A1  1
329#define OCR0A0  0
330
331/* Timer/Counter0 Output Compare Register B */
332#define OCR0B   _SFR_IO8(0x28)
333/* OCR0B */
334#define OCR0B7  7
335#define OCR0B6  6
336#define OCR0B5  5
337#define OCR0B4  4
338#define OCR0B3  3
339#define OCR0B2  2
340#define OCR0B1  1
341#define OCR0B0  0
342
343/* PLL Control and Status Register */
344#define PLLCSR  _SFR_IO8(0x29)
345/* PLLCSR */
346#define PLLF    2
347#define PLLE    1   /* PLL Enable */
348#define PLOCK   0   /* PLL Lock Detector */
349
350/* Reserved [0x2A..0x2B] */
351
352/* SPI Control Register */
353#define SPCR    _SFR_IO8(0x2C)
354/* SPCR */
355#define SPIE    7   /* SPI Interrupt Enable */
356#define SPE     6   /* SPI Enable */
357#define DORD    5   /* Data Order */
358#define MSTR    4   /* Master/Slave Select */
359#define CPOL    3   /* Clock polarity */
360#define CPHA    2   /* Clock Phase */
361#define SPR1    1   /* SPI Clock Rate Select 1 */
362#define SPR0    0   /* SPI Clock Rate Select 0 */
363
364/* SPI Status Register */
365#define SPSR    _SFR_IO8(0x2D)
366/* SPSR */
367#define SPIF    7   /* SPI Interrupt Flag */
368#define WCOL    6   /* Write Collision Flag */
369#define SPI2X   0   /* Double SPI Speed Bit */
370
371/* SPI Data Register */
372#define SPDR    _SFR_IO8(0x2E)
373/* SPDR */
374#define SPD7    7
375#define SPD6    6
376#define SPD5    5
377#define SPD4    4
378#define SPD3    3
379#define SPD2    2
380#define SPD1    1
381#define SPD0    0
382
383/* Reserved [0x2F] */
384
385/* Analog Comparator Status Register */
386#define ACSR    _SFR_IO8(0x30)
387/* ACSR */
388#define ACCKDIV 7   /* Analog Comparator Clock Divider */
389#define AC2IF   6   /* Analog Comparator 2 Interrupt Flag Bit */
390#define AC0IF   4   /* Analog Comparator 0 Interrupt Flag Bit */
391#define AC2O    2   /* Analog Comparator 2 Output Bit */
392#define AC0O    0   /* Analog Comparator 0 Output Bit */
393
394/* Monitor Data Register */
395#define MONDR   _SFR_IO8(0x31)
396
397/* Monitor Stop Mode Control Register */
398#define MSMCR   _SFR_IO8(0x32)
399
400/* Sleep Mode Control Register */
401#define SMCR    _SFR_IO8(0x33)
402/* SMCR */
403#define SM2     3   /* Sleep Mode Select bit2 */
404#define SM1     2   /* Sleep Mode Select bit1 */
405#define SM0     1   /* Sleep Mode Select bit0 */
406#define SE      0   /* Sleep Enable */
407
408/* MCU Status Register */
409#define MCUSR   _SFR_IO8(0x34)
410/* MCUSR */
411#define WDRF    3   /* Watchdog Reset Flag */
412#define BORF    2   /* Brown-out Reset Flag */
413#define EXTRF   1   /* External Reset Flag */
414#define PORF    0   /* Power-on reset flag */
415
416/* MCU Control Register */
417#define MCUCR   _SFR_IO8(0x35)
418/* MCUCR */
419#define SPIPS   7   /* SPI Pin Select */
420#define PUD     4   /* Pull-up disable */
421#define IVSEL   1   /* Interrupt Vector Select */
422#define IVCE    0   /* Interrupt Vector Change Enable */
423
424/* Reserved [0x36] */
425
426/* Store Program Memory Control Register */
427#define SPMCSR  _SFR_IO8(0x37)
428/* SPMCSR */
429#define SPMIE   7   /* SPM Interrupt Enable */
430#define RWWSB   6   /* Read While Write Section Busy */
431#define RWWSRE  4   /* Read While Write section read enable */
432#define BLBSET  3   /* Boot Lock Bit Set */
433#define PGWRT   2   /* Page Write */
434#define PGERS   1   /* Page Erase */
435#define SPMEN   0   /* Store Program Memory Enable */
436
437/* Reserved [0x38..0x3C] */
438
439/* 0x3D..0x3E SP  [defined in <avr/io.h>] */
440/* 0x3F SREG      [defined in <avr/io.h>] */
441
442/* Watchdog Timer Control Register */
443#define WDTCSR  _SFR_MEM8(0x60)
444/* WDTCSR */
445#define WDIF    7   /* Watchdog Timeout Interrupt Flag */
446#define WDIE    6   /* Watchdog Timeout Interrupt Enable */
447#define WDP3    5   /* Watchdog Timer Prescaler bit3 */
448#define WDCE    4   /* Watchdog Change Enable */
449#define WDE     3   /* Watchdog Enable */
450#define WDP2    2   /* Watchdog Timer Prescaler bit2 */
451#define WDP1    1   /* Watchdog Timer Prescaler bit1 */
452#define WDP0    0   /* Watchdog Timer Prescaler bit0 */
453
454/* Clock Prescaler Register */
455#define CLKPR   _SFR_MEM8(0x61)
456/* CLKPR */
457#define CLKPCE  7   /* Clock Prescaler Change Enable */
458#define CLKPS3  3   /* Clock Prescaler Select bit3 */
459#define CLKPS2  2   /* Clock Prescaler Select bit2 */
460#define CLKPS1  1   /* Clock Prescaler Select bit1 */
461#define CLKPS0  0   /* Clock Prescaler Select bit0 */
462
463/* Reserved [0x62..0x63] */
464
465/* Power Reduction Register */
466#define PRR     _SFR_MEM8(0x64)
467/* PRR */
468#define PRPSC2  7   /* Power Reduction PSC2 */
469#define PRPSC1  6   /* Power Reduction PSC1 */
470#define PRPSC0  5   /* Power Reduction PSC0 */
471#define PRTIM1  4   /* Power Reduction Timer/Counter1 */
472#define PRTIM0  3   /* Power Reduction Timer/Counter0 */
473#define PRSPI   2   /* Power Reduction Serial Peripheral Interface */
474#define PRADC   0   /* Power Reduction ADC */
475
476/* Reserved [0x65] */
477
478/* Oscillator Calibration Value */
479#define OSCCAL  _SFR_MEM8(0x66)
480/* OSCCAL */
481#define CAL6    6
482#define CAL5    5
483#define CAL4    4
484#define CAL3    3
485#define CAL2    2
486#define CAL1    1
487#define CAL0    0
488
489/* Reserved [0x67..0x68] */
490
491/* External Interrupt Control Register A */
492#define EICRA   _SFR_MEM8(0x69)
493/* EICRA */
494#define ISC31   7
495#define ISC30   6
496#define ISC21   5
497#define ISC20   4
498#define ISC11   3
499#define ISC10   2
500#define ISC01   1
501#define ISC00   0
502
503/* Reserved [0x6A..0x6D] */
504
505/* Timer/Counter0 Interrupt Mask Register */
506#define TIMSK0  _SFR_MEM8(0x6E)
507/* TIMSK0 */
508#define OCIE0B  2   /* Output Compare Match B Interrupt Enable */
509#define OCIE0A  1   /* Output Compare Match A Interrupt Enable */
510#define TOIE0   0   /* Overflow Interrupt Enable */
511
512/* Timer/Counter1 Interrupt Mask Register */
513#define TIMSK1  _SFR_MEM8(0x6F)
514/* TIMSK1 */
515#define ICIE1   5   /* Input Capture Interrupt Enable */
516#define OCIE1B  2   /* Output Compare Match B Interrupt Enable */
517#define OCIE1A  1   /* Output Compare Match A Interrupt Enable */
518#define TOIE1   0   /* Overflow Interrupt Enable */
519
520/* Reserved [0x70..0x75] */
521
522/* Amplifier 0 Control and Status register */
523#define AMP0CSR _SFR_MEM8(0x76)
524#define AMP0EN  7
525#define AMP0IS  6
526#define AMP0G1  5
527#define AMP0G0  4
528#define AMP0TS1 1
529#define AMP0TS0 0
530
531/* Reserved [0x77] */
532
533/* ADC Result Data Register */
534#ifndef __ASSEMBLER__
535#define ADC     _SFR_MEM16(0x78)
536#endif
537#define ADCW    _SFR_MEM16(0x78)
538#define ADCL    _SFR_MEM8(0x78)
539#define ADCH    _SFR_MEM8(0x79)
540
541/* ADC Control and Status Register A */
542#define ADCSRA  _SFR_MEM8(0x7A)
543/* ADCSRA */
544#define ADEN    7   /* ADC Enable */
545#define ADSC    6   /* ADC Start Conversion */
546#define ADATE   5   /* ADC Auto Trigger Enable */
547#define ADIF    4   /* ADC Interrupt Flag */
548#define ADIE    3   /* ADC Interrupt Enable */
549#define ADPS2   2   /* ADC Prescaler Select bit2 */
550#define ADPS1   1   /* ADC Prescaler Select bit1 */
551#define ADPS0   0   /* ADC Prescaler Select bit0 */
552
553/* ADC Control and Status Register B */
554#define ADCSRB  _SFR_MEM8(0x7B)
555/* ADCSRB */
556#define ADTS3   3   /* ADC Auto Trigger Source 2 */
557#define ADTS2   2   /* ADC Auto Trigger Source 2 */
558#define ADTS1   1   /* ADC Auto Trigger Source 1 */
559#define ADTS0   0   /* ADC Auto Trigger Source 0 */
560
561/* ADC multiplexer Selection Register */
562#define ADMUX   _SFR_MEM8(0x7C)
563/* ADMUX */
564#define REFS1   7   /* Reference Selection bit1 */
565#define REFS0   6   /* Reference Selection bit0 */
566#define ADLAR   5   /* Left Adjust Result */
567#define MUX3    3   /* Analog Channel and Gain Selection bit3 */
568#define MUX2    2   /* Analog Channel and Gain Selection bit2 */
569#define MUX1    1   /* Analog Channel and Gain Selection bit1 */
570#define MUX0    0   /* Analog Channel and Gain Selection bit0 */
571
572/* Reserved [0x7D] */
573
574/* Digital Input Disable Register 0 */
575#define DIDR0   _SFR_MEM8(0x7E)
576/* DIDR0 */
577#define ADC7D   7   /* ADC7 Digital input Disable */
578#define ADC6D   6   /* ADC6 Digital input Disable */
579#define ADC5D   5   /* ADC5 Digital input Disable */
580#define ADC4D   4   /* ADC4 Digital input Disable */
581#define ADC3D   3   /* ADC3 Digital input Disable */
582#define ADC2D   2   /* ADC2 Digital input Disable */
583#define ADC1D   1   /* ADC1 Digital input Disable */
584#define ADC0D   0   /* ADC0 Digital input Disable */
585
586/* Digital Input Disable Register 1 */
587#define DIDR1   _SFR_MEM8(0x7F)
588/* DIDR1 */
589#define ACMP0D  5
590#define AMP0PD  4
591#define AMP0ND  3
592#define ADC10D  2   /* ADC10 Digital input Disable */
593#define ADC9D   1   /* ADC9 Digital input Disable */
594#define ADC8D   0   /* ADC8 Digital input Disable */
595
596/* Timer/Counter1 Control Register A */
597#define TCCR1A  _SFR_MEM8(0x80)
598/* TCCR1A */
599#define COM1A1  7   /* Comparet Ouput Mode 1A, bit 1 */
600#define COM1A0  6   /* Comparet Ouput Mode 1A, bit 0 */
601#define COM1B1  5   /* Compare Output Mode 1B, bit 1 */
602#define COM1B0  4   /* Compare Output Mode 1B, bit 0 */
603#define WGM11   1   /* Waveform Generation Mode */
604#define WGM10   0   /* Waveform Generation Mode */
605
606/* Timer/Counter1 Control Register B */
607#define TCCR1B  _SFR_MEM8(0x81)
608/* TCCR1B */
609#define ICNC1   7   /* Input Capture 1 Noise Canceler */
610#define ICES1   6   /* Input Capture 1 Edge Select */
611#define WGM13   4   /* Waveform Generation Mode */
612#define WGM12   3   /* Waveform Generation Mode */
613#define CS12    2   /* Prescaler source of Timer/Counter 1 */
614#define CS11    1   /* Prescaler source of Timer/Counter 1 */
615#define CS10    0   /* Prescaler source of Timer/Counter 1 */
616
617/* Timer/Counter1 Control Register C */
618#define TCCR1C  _SFR_MEM8(0x82)
619/* TCCR1C */
620#define FOC1A   7   /* Force Output Compare for Channel A */
621#define FOC1B   6   /* Force Output Compare for Channel B */
622
623/* Reserved [0x83] */
624
625/* Timer/Counter1 */
626#define TCNT1   _SFR_MEM16(0x84)
627#define TCNT1L  _SFR_MEM8(0x84)
628#define TCNT1H  _SFR_MEM8(0x85)
629/* TCNT1H */
630#define TCNT115 7
631#define TCNT114 6
632#define TCNT113 5
633#define TCNT112 4
634#define TCNT111 3
635#define TCNT110 2
636#define TCNT19  1
637#define TCNT18  0
638/* TCNT1L */
639#define TCNT17  7
640#define TCNT16  6
641#define TCNT15  5
642#define TCNT14  4
643#define TCNT13  3
644#define TCNT12  2
645#define TCNT11  1
646#define TCNT10  0
647
648/* Input Capture Register 1 */
649#define ICR1    _SFR_MEM16(0x86)
650#define ICR1L   _SFR_MEM8(0x86)
651#define ICR1H   _SFR_MEM8(0x87)
652/* ICR1H */
653#define ICR115  7
654#define ICR114  6
655#define ICR113  5
656#define ICR112  4
657#define ICR111  3
658#define ICR110  2
659#define ICR19   1
660#define ICR18   0
661/* ICR1L */
662#define ICR17   7
663#define ICR16   6
664#define ICR15   5
665#define ICR14   4
666#define ICR13   3
667#define ICR12   2
668#define ICR11   1
669#define ICR10   0
670
671/* Output Compare Register 1 A */
672#define OCR1A   _SFR_MEM16(0x88)
673#define OCR1AL  _SFR_MEM8(0x88)
674#define OCR1AH  _SFR_MEM8(0x89)
675/* OCR1AH */
676#define OCR1A15 7
677#define OCR1A14 6
678#define OCR1A13 5
679#define OCR1A12 4
680#define OCR1A11 3
681#define OCR1A10 2
682#define OCR1A9  1
683#define OCR1A8  0
684/* OCR1AL */
685#define OCR1A7  7
686#define OCR1A6  6
687#define OCR1A5  5
688#define OCR1A4  4
689#define OCR1A3  3
690#define OCR1A2  2
691#define OCR1A1  1
692#define OCR1A0  0
693
694/* Output Compare Register 1 B */
695#define OCR1B   _SFR_MEM16(0x8A)
696#define OCR1BL  _SFR_MEM8(0x8A)
697#define OCR1BH  _SFR_MEM8(0x8B)
698/* OCR1BH */
699#define OCR1B15 7
700#define OCR1B14 6
701#define OCR1B13 5
702#define OCR1B12 4
703#define OCR1B11 3
704#define OCR1B10 2
705#define OCR1B9  1
706#define OCR1B8  0
707/* OCR1BL */
708#define OCR1B7  7
709#define OCR1B6  6
710#define OCR1B5  5
711#define OCR1B4  4
712#define OCR1B3  3
713#define OCR1B2  2
714#define OCR1B1  1
715#define OCR1B0  0
716
717/* Reserved [0x8C..0x9F] */
718
719/* PSC0 Interrupt Flag Register */
720#define PIFR0   _SFR_MEM8(0xA0)
721/* PIFR0 */
722#define PSEI0   5   /* PSC0 Synchro Error Interrupt */
723#define PEV0B   4   /* PSC0 External Event B Interrupt */
724#define PEV0A   3   /* PSC0 External Event A Interrupt */
725#define PRN01   2   /* PSC0 Ramp Number bit1 */
726#define PRN00   1   /* PSC0 Ramp Number bit0 */
727#define PEOP0   0   /* End Of PSC0 Interrupt */
728
729/* PSC0 Interrupt Mask Register */
730#define PIM0    _SFR_MEM8(0xA1)
731/* PIM0 */
732#define PSEIE0  5   /* PSC0 Synchro Error Interrupt Enable */
733#define PEVE0B  4   /* PSC0 External Event B Interrupt Enable */
734#define PEVE0A  3   /* PSC0 External Event A Interrupt Enable */
735#define PEOPE0  0   /* PSC0 End Of Cycle Interrupt Enable */
736
737/* Reserved [0xA2..0xA3] */
738
739/* PSC2 Interrupt Flag Register */
740#define PIFR2   _SFR_MEM8(0xA4)
741/* PIFR2 */
742#define PSEI2   5   /* PSC2 Synchro Error Interrupt */
743#define PEV2B   4   /* PSC2 External Event B Interrupt */
744#define PEV2A   3   /* PSC2 External Event A Interrupt */
745#define PRN21   2   /* PSC2 Ramp Number bit1 */
746#define PRN20   1   /* PSC2 Ramp Number bit0 */
747#define PEOP2   0   /* End Of PSC2 Interrupt */
748
749/* PSC2 Interrupt Mask Register */
750#define PIM2    _SFR_MEM8(0xA5)
751/* PIM2 */
752#define PSEIE2  5   /* PSC2 Synchro Error Interrupt Enable */
753#define PEVE2B  4   /* PSC2 External Event B Interrupt Enable */
754#define PEVE2A  3   /* PSC2 External Event A Interrupt Enable */
755#define PEOPE2  0   /* PSC2 End Of Cycle Interrupt Enable */
756
757/* Reserved [0xA6..0xAC] */
758
759/* Analog Comparator 0 Control Register */
760#define AC0CON  _SFR_MEM8(0xAD)
761/* AC0CON */
762#define AC0EN   7   /* Analog Comparator 0 Enable Bit */
763#define AC0IE   6   /* Analog Comparator 0 Interrupt Enable bit */
764#define AC0IS1  5   /* Analog Comparator 0 Interrupt Select bit1 */
765#define AC0IS0  4   /* Analog Comparator 0 Interrupt Select bit0 */
766#define AC0M2   2   /* Analog Comparator 0 Multiplexer register bit2 */
767#define AC0M1   1   /* Analog Comparator 0 Multiplexer register bit1 */
768#define AC0M0   0   /* Analog Comparator 0 Multiplexer register bit0 */
769
770/* Reserved [0xB0..0xAE] */
771
772/* Analog Comparator 2 Control Register */
773#define AC2CON  _SFR_MEM8(0xAF)
774/* AC2CON */
775#define AC2EN   7   /* Analog Comparator 2 Enable Bit */
776#define AC2IE   6   /* Analog Comparator 2 Interrupt Enable bit */
777#define AC2IS1  5   /* Analog Comparator 2 Interrupt Select bit1 */
778#define AC2IS0  4   /* Analog Comparator 2 Interrupt Select bit0 */
779#define AC2M2   2   /* Analog Comparator 2 Multiplexer register bit2 */
780#define AC2M1   1   /* Analog Comparator 2 Multiplexer register bit1 */
781#define AC2M0   0   /* Analog Comparator 2 Multiplexer register bit0 */
782
783/* Reserved [0xB0..0xCF] */
784
785/* PSC 0 Synchro and Output Configuration */
786#define PSOC0   _SFR_MEM8(0xD0)
787/* PSOC0 */
788#define PSYNC01 5   /* Synchronization Out for ADC Selection bit1 */
789#define PSYNC00 4   /* Synchronization Out for ADC Selection bit0 */
790#define POEN0B  2   /* PSC 0 OUT Part B Output Enable */
791#define POEN0A  0   /* PSC 0 OUT Part A Output Enable */
792
793/* Reserved [0xD1] */
794
795/* Output Compare SA Registers */
796#define OCR0SA  _SFR_MEM16(0xD2)
797#define OCR0SAL _SFR_MEM8(0xD2)
798#define OCR0SAH _SFR_MEM8(0xD3)
799
800/* Output Compare RA Registers */
801#define OCR0RA  _SFR_MEM16(0xD4)
802#define OCR0RAL _SFR_MEM8(0xD4)
803#define OCR0RAH _SFR_MEM8(0xD5)
804
805/* Output Compare SB Registers */
806#define OCR0SB  _SFR_MEM16(0xD6)
807#define OCR0SBL _SFR_MEM8(0xD6)
808#define OCR0SBH _SFR_MEM8(0xD7)
809
810/* Output Compare RB Registers */
811#define OCR0RB  _SFR_MEM16(0xD8)
812#define OCR0RBL _SFR_MEM8(0xD8)
813#define OCR0RBH _SFR_MEM8(0xD9)
814
815/* PSC 0 Configuration Register */
816#define PCNF0   _SFR_MEM8(0xDA)
817/* PCNF0 */
818#define PFIFTY0  7  /* PSC 0 Fifty */
819#define PALOCK0  6  /* PSC 0 Autolock */
820#define PLOCK0   5  /* PSC 0 Lock */
821#define PMODE01  4  /* PSC 0 Mode bit1 */
822#define PMODE00  3  /* PSC 0 Mode bit0 */
823#define POP0     2  /* PSC 0 Output Polarity */
824#define PCLKSEL0 1  /* PSC 0 Input Clock Select */
825
826/* PSC 0 Control Register */
827#define PCTL0   _SFR_MEM8(0xDB)
828/* PCTL0 */
829#define PPRE01  7   /* PSC 0 Prescaler Select bit1 */
830#define PPRE00  6   /* PSC 0 Prescaler Select bit0 */
831#define PBFM0   5   /* Balance Flank Width Modulation */
832#define PAOC0B  4   /* PSC 0 Asynchronous Output Control B */
833#define PAOC0A  3   /* PSC 0 Asynchronous Output Control A */
834#define PARUN0  2   /* PSC 0 Autorun */
835#define PCCYC0  1   /* PSC 0 Complete Cycle */
836#define PRUN0   0   /* PSC 0 Run */
837
838/* PSC 0 Input A Control Register */
839#define PFRC0A  _SFR_MEM8(0xDC)
840/* PFRC0A */
841#define PCAE0A  7   /* PSC 0 Capture Enable Input Part A */
842#define PISEL0A 6   /* PSC 0 Input Select for Part A */
843#define PELEV0A 5   /* PSC 0 Edge Level Selector of Input Part A */
844#define PFLTE0A 4   /* PSC 0 Filter Enable on Input Part A */
845#define PRFM0A3 3   /* PSC 0 Fault Mode bit3 */
846#define PRFM0A2 2   /* PSC 0 Fault Mode bit2 */
847#define PRFM0A1 1   /* PSC 0 Fault Mode bit1 */
848#define PRFM0A0 0   /* PSC 0 Fault Mode bit0 */
849
850/* PSC 0 Input B Control Register */
851#define PFRC0B  _SFR_MEM8(0xDD)
852/* PFRC0B */
853#define PCAE0B  7   /* PSC 0 Capture Enable Input Part B */
854#define PISEL0B 6   /* PSC 0 Input Select for Part B */
855#define PELEV0B 5   /* PSC 0 Edge Level Selector of Input Part B */
856#define PFLTE0B 4   /* PSC 0 Filter Enable on Input Part B */
857#define PRFM0B3 3   /* PSC 0 Fault Mode bit3 */
858#define PRFM0B2 2   /* PSC 0 Fault Mode bit2 */
859#define PRFM0B1 1   /* PSC 0 Fault Mode bit1 */
860#define PRFM0B0 0   /* PSC 0 Fault Mode bit0 */
861
862/* PSC 0 Input Capture Registers */
863#define PICR0   _SFR_MEM16(0xDE)
864
865#define PICR0L  _SFR_MEM8(0xDE)
866
867#define PICR0H  _SFR_MEM8(0xDF)
868#define PCST0   7   /* PSC Capture Software Trig bit */
869
870/* Reserved [0xE0..0xEF] */
871
872/* PSC 2 Synchro and Output Configuration */
873#define PSOC2   _SFR_MEM8(0xF0)
874/* PSOC2 */
875#define POS23   7   /* PSCOUT23 Selection */
876#define POS22   6   /* PSCOUT22 Selection */
877#define PSYNC21 5   /* Synchronization Out for ADC Selection bit1 */
878#define PSYNC20 4   /* Synchronization Out for ADC Selection bit0 */
879#define POEN2D  3   /* PSCOUT23 Output Enable */
880#define POEN2B  2   /* PSC 2 OUT Part B Output Enable */
881#define POEN2C  1   /* PSCOUT22 Output Enable */
882#define POEN2A  0   /* PSC 2 OUT Part A Output Enable */
883
884/* PSC 2 Output Matrix */
885#define POM2    _SFR_MEM8(0xF1)
886/* POM2 */
887#define POMV2B3 7   /* Output Matrix Output B Ramp 3 */
888#define POMV2B2 6   /* Output Matrix Output B Ramp 2 */
889#define POMV2B1 5   /* Output Matrix Output B Ramp 1 */
890#define POMV2B0 4   /* Output Matrix Output B Ramp 0 */
891#define POMV2A3 3   /* Output Matrix Output A Ramp 3 */
892#define POMV2A2 2   /* Output Matrix Output A Ramp 2 */
893#define POMV2A1 1   /* Output Matrix Output A Ramp 1 */
894#define POMV2A0 0   /* Output Matrix Output A Ramp 0 */
895
896/* Output Compare SA Registers */
897#define OCR2SA  _SFR_MEM16(0xF2)
898#define OCR2SAL _SFR_MEM8(0xF2)
899#define OCR2SAH _SFR_MEM8(0xF3)
900
901/* Output Compare RA Registers */
902#define OCR2RA  _SFR_MEM16(0xF4)
903#define OCR2RAL _SFR_MEM8(0xF4)
904#define OCR2RAH _SFR_MEM8(0xF5)
905
906/* Output Compare SB Registers */
907#define OCR2SB  _SFR_MEM16(0xF6)
908#define OCR2SBL _SFR_MEM8(0xF6)
909#define OCR2SBH _SFR_MEM8(0xF7)
910
911/* Output Compare RB Registers */
912#define OCR2RB  _SFR_MEM16(0xF8)
913#define OCR2RBL _SFR_MEM8(0xF8)
914#define OCR2RBH _SFR_MEM8(0xF9)
915
916/* PSC 2 Configuration Register */
917#define PCNF2   _SFR_MEM8(0xFA)
918/* PCNF2 */
919#define PFIFTY2  7  /* PSC 2 Fifty */
920#define PALOCK2  6  /* PSC 2 Autolock */
921#define PLOCK2   5  /* PSC 2 Lock */
922#define PMODE21  4  /* PSC 2 Mode bit1 */
923#define PMODE20  3  /* PSC 2 Mode bit0 */
924#define POP2     2  /* PSC 2 Output Polarity */
925#define PCLKSEL2 1  /* PSC 2 Input Clock Select */
926#define POME2    0  /* PSC 2 Output Matrix Enable */
927
928/* PSC 2 Control Register */
929#define PCTL2   _SFR_MEM8(0xFB)
930/* PCTL2 */
931#define PPRE21  7   /* PSC 2 Prescaler Select bit1 */
932#define PPRE20  6   /* PSC 2 Prescaler Select bit0 */
933#define PBFM2   5   /* Balance Flank Width Modulation */
934#define PAOC2B  4   /* PSC 2 Asynchronous Output Control B */
935#define PAOC2A  3   /* PSC 2 Asynchronous Output Control A */
936#define PARUN2  2   /* PSC 2 Autorun */
937#define PCCYC2  1   /* PSC 2 Complete Cycle */
938#define PRUN2   0   /* PSC 2 Run */
939
940/* PSC 2 Input A Control Register */
941#define PFRC2A  _SFR_MEM8(0xFC)
942/* PFRC2A */
943#define PCAE2A  7   /* PSC 2 Capture Enable Input Part A */
944#define PISEL2A 6   /* PSC 2 Input Select for Part A */
945#define PELEV2A 5   /* PSC 2 Edge Level Selector of Input Part A */
946#define PFLTE2A 4   /* PSC 2 Filter Enable on Input Part A */
947#define PRFM2A3 3   /* PSC 2 Fault Mode bit3 */
948#define PRFM2A2 2   /* PSC 2 Fault Mode bit2 */
949#define PRFM2A1 1   /* PSC 2 Fault Mode bit1 */
950#define PRFM2A0 0   /* PSC 2 Fault Mode bit0 */
951
952/* PSC 2 Input B Control Register */
953#define PFRC2B  _SFR_MEM8(0xFD)
954/* PFRC2B */
955#define PCAE2B  7   /* PSC 2 Capture Enable Input Part B */
956#define PISEL2B 6   /* PSC 2 Input Select for Part B */
957#define PELEV2B 5   /* PSC 2 Edge Level Selector of Input Part B */
958#define PFLTE2B 4   /* PSC 2 Filter Enable on Input Part B */
959#define PRFM2B3 3   /* PSC 2 Fault Mode bit3 */
960#define PRFM2B2 2   /* PSC 2 Fault Mode bit2 */
961#define PRFM2B1 1   /* PSC 2 Fault Mode bit1 */
962#define PRFM2B0 0   /* PSC 2 Fault Mode bit0 */
963
964/* PSC 2 Input Capture Registers */
965#define PICR2   _SFR_MEM16(0xFE)
966
967#define PICR2L  _SFR_MEM8(0xFE)
968
969#define PICR2H  _SFR_MEM8(0xFF)
970#define PCST2   7   /* PSC Capture Software Trig bit */
971                    /* not implemented on AT90PWM2/AT90PWM3 */
972
973
974/* Interrupt vectors */
975/* PSC2 Capture Event */
976#define PSC2_CAPT_vect                  _VECTOR(1)
977#define SIG_PSC2_CAPTURE                _VECTOR(1)
978
979/* PSC2 End Cycle */
980#define PSC2_EC_vect                    _VECTOR(2)
981#define SIG_PSC2_END_CYCLE              _VECTOR(2)
982
983/* PSC0 Capture Event */
984#define PSC0_CAPT_vect                  _VECTOR(5)
985#define SIG_PSC0_CAPTURE                _VECTOR(5)
986
987/* PSC0 End Cycle */
988#define PSC0_EC_vect                    _VECTOR(6)
989#define SIG_PSC0_END_CYCLE              _VECTOR(6)
990
991/* Analog Comparator 0 */
992#define ANALOG_COMP_0_vect              _VECTOR(7)
993#define SIG_COMPARATOR0                 _VECTOR(7)
994
995/* Analog Comparator 2 */
996#define ANALOG_COMP_2_vect              _VECTOR(9)
997#define SIG_COMPARATOR2                 _VECTOR(9)
998
999/* External Interrupt Request 0 */
1000#define INT0_vect                       _VECTOR(10)
1001#define SIG_INTERRUPT0                  _VECTOR(10)
1002
1003/* Timer/Counter1 Capture Event */
1004#define TIMER1_CAPT_vect                _VECTOR(11)
1005#define SIG_INPUT_CAPTURE1              _VECTOR(11)
1006
1007/* Timer/Counter1 Compare Match A */
1008#define TIMER1_COMPA_vect               _VECTOR(12)
1009#define SIG_OUTPUT_COMPARE1A            _VECTOR(12)
1010#define SIG_OUTPUT_COMPARE1_A           _VECTOR(12)
1011
1012/* Timer/Counter Compare Match B */
1013#define TIMER1_COMPB_vect               _VECTOR(13)
1014#define SIG_OUTPUT_COMPARE1B            _VECTOR(13)
1015#define SIG_OUTPUT_COMPARE1_B           _VECTOR(13)
1016
1017/* Timer/Counter1 Overflow */
1018#define TIMER1_OVF_vect                 _VECTOR(15)
1019#define SIG_OVERFLOW1                   _VECTOR(15)
1020
1021/* Timer/Counter0 Compare Match A */
1022#define TIMER0_COMP_A_vect              _VECTOR(16)
1023#define SIG_OUTPUT_COMPARE0A            _VECTOR(16)
1024#define SIG_OUTPUT_COMPARE0_A           _VECTOR(16)
1025
1026/* Timer/Counter0 Overflow */
1027#define TIMER0_OVF_vect                 _VECTOR(17)
1028#define SIG_OVERFLOW0                   _VECTOR(17)
1029
1030/* ADC Conversion Complete */
1031#define ADC_vect                        _VECTOR(18)
1032#define SIG_ADC                         _VECTOR(18)
1033
1034/* External Interrupt Request 1 */
1035#define INT1_vect                       _VECTOR(19)
1036#define SIG_INTERRUPT1                  _VECTOR(19)
1037
1038/* SPI Serial Transfer Complete */
1039#define SPI_STC_vect                    _VECTOR(20)
1040#define SIG_SPI                         _VECTOR(20)
1041
1042/* External Interrupt Request 2 */
1043#define INT2_vect                       _VECTOR(24)
1044#define SIG_INTERRUPT2                  _VECTOR(24)
1045
1046/* Watchdog Timeout Interrupt */
1047#define WDT_vect                        _VECTOR(25)
1048#define SIG_WDT                         _VECTOR(25)
1049#define SIG_WATCHDOG_TIMEOUT            _VECTOR(25)
1050
1051/* EEPROM Ready */
1052#define EE_READY_vect                   _VECTOR(26)
1053#define SIG_EEPROM_READY                _VECTOR(26)
1054
1055/* Timer Counter 0 Compare Match B */
1056#define TIMER0_COMPB_vect               _VECTOR(27)
1057#define SIG_OUTPUT_COMPARE0B            _VECTOR(27)
1058#define SIG_OUTPUT_COMPARE0_B           _VECTOR(27)
1059
1060/* External Interrupt Request 3 */
1061#define INT3_vect                       _VECTOR(28)
1062#define SIG_INTERRUPT3                  _VECTOR(28)
1063
1064/* Store Program Memory Read */
1065#define SPM_READY_vect                  _VECTOR(31)
1066#define SIG_SPM_READY                   _VECTOR(31)
1067
1068#define _VECTORS_SIZE   64
1069
1070/* Constants */
1071#define SPM_PAGESIZE    64
1072
1073#define RAMEND      0x02FF
1074#define XRAMEND     RAMEND
1075#define E2END       0x01FF
1076#define FLASHEND    0x0FFF
1077
1078
1079/* Fuse Information */
1080
1081#define FUSE_MEMORY_SIZE 3
1082
1083/* Low Fuse Byte */
1084#define FUSE_CKSEL0  (unsigned char)~_BV(0)  /* Select Clock Source */
1085#define FUSE_CKSEL1  (unsigned char)~_BV(1)  /* Select Clock Source */
1086#define FUSE_CKSEL2  (unsigned char)~_BV(2)  /* Select Clock Source */
1087#define FUSE_CKSEL3  (unsigned char)~_BV(3)  /* Select Clock Source */
1088#define FUSE_SUT0    (unsigned char)~_BV(4)  /* Select start-up time */
1089#define FUSE_SUT1    (unsigned char)~_BV(5)  /* Select start-up time */
1090#define FUSE_CKOUT   (unsigned char)~_BV(6)  /* Oscillator output option */
1091#define FUSE_CKDIV8  (unsigned char)~_BV(7)  /* Divide clock by 8 */
1092#define LFUSE_DEFAULT (FUSE_CKSEL0 & FUSE_CKSEL2 & FUSE_CKSEL3 & FUSE_SUT0 & FUSE_CKDIV8)
1093
1094/* High Fuse Byte */
1095#define FUSE_BODLEVEL0  (unsigned char)~_BV(0)
1096#define FUSE_BODLEVEL1  (unsigned char)~_BV(1)
1097#define FUSE_BODLEVEL2  (unsigned char)~_BV(2)
1098#define FUSE_EESAVE     (unsigned char)~_BV(3)  /* EEPROM memory is preserved through chip erase */
1099#define FUSE_WDTON      (unsigned char)~_BV(4)  /* Watchdog timer always on */
1100#define FUSE_SPIEN      (unsigned char)~_BV(5)  /* Enable Serial programming and Data Downloading */
1101#define FUSE_DWEN       (unsigned char)~_BV(6)  /* debugWIRE Enable */
1102#define FUSE_RSTDISBL   (unsigned char)~_BV(7)  /* External Reset Diasble */
1103#define HFUSE_DEFAULT (FUSE_SPIEN)
1104
1105/* Extended Fuse Byte */
1106#define FUSE_BOOTRST     (unsigned char)~_BV(0)
1107#define FUSE_BOOTSZ0     (unsigned char)~_BV(1)
1108#define FUSE_BOOTSZ1     (unsigned char)~_BV(2)
1109#define FUSE_PSCRV       (unsigned char)~_BV(4)
1110#define FUSE_PSC0RB      (unsigned char)~_BV(5)
1111#define FUSE_PSC2RB      (unsigned char)~_BV(7)
1112#define EFUSE_DEFAULT (FUSE_BOOTSZ0 & FUSE_BOOTSZ1)
1113
1114
1115/* Lock Bits */
1116#define __LOCK_BITS_EXIST
1117#define __BOOT_LOCK_BITS_0_EXIST
1118#define __BOOT_LOCK_BITS_1_EXIST
1119
1120
1121#endif /* _AVR_IOPWM1_H_ */
Note: See TracBrowser for help on using the repository browser.