multiservo: update interrupt vector names
[aversive.git] / modules / devices / servo / multiservo / multiservo_archs.h
1 /*  
2  *  Copyright Droids Corporation, Microb Technology, Eirbot (2006)
3  * 
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  *  Revision : $Id: multiservo_archs.h,v 1.3.4.4 2008-03-02 17:18:16 zer0 Exp $
19  *
20  */
21
22 /* set in CTC mode */
23
24 #ifndef _MULTISERVO_ARCHS_H_
25 #define _MULTISERVO_ARCHS_H_
26
27 #include <aversive.h>
28
29 /* will be in aversive_timers */
30 #if defined (__AVR_ATmega128__) 
31
32 #if MULTISERVO_TIMER == 0
33 #ifndef TIMER0_COMP_vect
34 #if defined(SIG_OUTPUT_COMPARE0)
35 #define TIMER0_COMP_vect SIG_OUTPUT_COMPARE0
36 #endif
37 #endif
38 #define MULTISERVO_SIG_OUTPUT_COMPARE TIMER0_COMP_vect
39 #define MULTISERVO_TIMSK TIMSK
40 #define MULTISERVO_OCIE  OCIE0
41 #define MULTISERVO_TCCRnA TCCR0
42 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM01) | MULTISERVO_TIMER_PRESCALER_CONFIG)
43 #define MULTISERVO_OCR OCR0
44
45 #elif MULTISERVO_TIMER == 1
46 #ifndef TIMER1_COMPA_vect
47 #if defined(SIG_OUTPUT_COMPARE1A)
48 #define TIMER1_COMPA_vect SIG_OUTPUT_COMPARE1A
49 #endif
50 #endif
51 #define MULTISERVO_SIG_OUTPUT_COMPARE TIMER1_COMPA_vect
52 #define MULTISERVO_TIMSK TIMSK
53 #define MULTISERVO_OCIE  OCIE1A
54 #define MULTISERVO_TCCRnA TCCR1A
55 #define MULTISERVO_TCCRnA_VALUE 0
56 #define MULTISERVO_TCCRnB TCCR1B
57 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM12) | MULTISERVO_TIMER_PRESCALER_CONFIG)
58 #define MULTISERVO_OCR OCR1A
59
60 #elif MULTISERVO_TIMER == 2
61 #ifndef TIMER2_COMP_vect
62 #if defined(SIG_OUTPUT_COMPARE2)
63 #define TIMER2_COMP_vect SIG_OUTPUT_COMPARE2
64 #endif
65 #endif
66 #define MULTISERVO_SIG_OUTPUT_COMPARE TIMER2_COMP_vect
67 #define MULTISERVO_TIMSK TIMSK
68 #define MULTISERVO_OCIE  OCIE2
69 #define MULTISERVO_TCCRnA TCCR2
70 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM21) | MULTISERVO_TIMER_PRESCALER_CONFIG)
71 #define MULTISERVO_OCR OCR2
72
73 #elif MULTISERVO_TIMER == 3
74 #ifndef TIMER3_COMPA_vect
75 #if defined(SIG_OUTPUT_COMPARE3A)
76 #define TIMER3_COMPA_vect SIG_OUTPUT_COMPARE3A
77 #endif
78 #endif
79 #define MULTISERVO_SIG_OUTPUT_COMPARE TIMER3_COMPA_vect
80 #define MULTISERVO_TIMSK ETIMSK
81 #define MULTISERVO_OCIE  OCIE3A
82 #define MULTISERVO_TCCRnA TCCR3A
83 #define MULTISERVO_TCCRnA_VALUE 0
84 #define MULTISERVO_TCCRnB TCCR3B
85 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM32) | MULTISERVO_TIMER_PRESCALER_CONFIG)
86 #define MULTISERVO_OCR OCR3A
87
88 #else
89 #error "Bad timer number, check your multiservo_config.h"
90 #endif
91
92
93
94
95
96 #elif defined (__AVR_ATmega32__) 
97
98 #if MULTISERVO_TIMER == 0
99 #ifndef TIMER0_COMP_vect
100 #if defined(SIG_OUTPUT_COMPARE0)
101 #define TIMER0_COMP_vect SIG_OUTPUT_COMPARE0
102 #endif
103 #endif
104 #define MULTISERVO_SIG_OUTPUT_COMPARE TIMER0_COMP_vect
105 #define MULTISERVO_TIMSK TIMSK
106 #define MULTISERVO_OCIE  OCIE0
107 #define MULTISERVO_TCCRnA TCCR0
108 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM01) | MULTISERVO_TIMER_PRESCALER_CONFIG)
109 #define MULTISERVO_OCR OCR0
110
111 #elif MULTISERVO_TIMER == 1
112 #ifndef TIMER1_COMPA_vect
113 #if defined(SIG_OUTPUT_COMPARE1A)
114 #define TIMER1_COMPA_vect SIG_OUTPUT_COMPARE1A
115 #endif
116 #endif
117 #define MULTISERVO_SIG_OUTPUT_COMPARE TIMER1_COMPA_vect
118 #define MULTISERVO_TIMSK TIMSK
119 #define MULTISERVO_OCIE  OCIE1A
120 #define MULTISERVO_TCCRnA TCCR1A
121 #define MULTISERVO_TCCRnA_VALUE 0
122 #define MULTISERVO_TCCRnB TCCR1B
123 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM12) | MULTISERVO_TIMER_PRESCALER_CONFIG)
124 #define MULTISERVO_OCR OCR1A
125
126 #elif MULTISERVO_TIMER == 2
127 #ifndef TIMER2_COMP_vect
128 #if defined(SIG_OUTPUT_COMPARE2)
129 #define TIMER2_COMP_vect SIG_OUTPUT_COMPARE2
130 #endif
131 #endif
132 #define MULTISERVO_SIG_OUTPUT_COMPARE TIMER2_COMP_vect
133 #define MULTISERVO_TIMSK TIMSK
134 #define MULTISERVO_OCIE  OCIE2
135 #define MULTISERVO_TCCRnA TCCR2
136 #define MULTISERVO_TCCRnA_VALUE ((1 << WGM21) | MULTISERVO_TIMER_PRESCALER_CONFIG)
137 #define MULTISERVO_OCR OCR2
138
139 #else
140 #error "Bad timer number, check your multiservo_config.h"
141 #endif
142
143 #elif defined (__AVR_ATtiny2313__) 
144
145 #if MULTISERVO_TIMER == 0
146 #ifndef TIMER0_COMP_vect
147 #if defined(SIG_OUTPUT_COMPARE0)
148 #define TIMER0_COMP_vect SIG_OUTPUT_COMPARE0
149 #endif
150 #endif
151 #define MULTISERVO_SIG_OUTPUT_COMPARE TIMER0_COMP_vect
152 #define MULTISERVO_TIMSK TIMSK
153 #define MULTISERVO_OCIE  OCIE0
154 #define MULTISERVO_TCCRnA TCCR0A
155 #define MULTISERVO_TCCRnA_VALUE (1 << WGM01)
156 #define MULTISERVO_TCCRnA TCCR0B
157 #define MULTISERVO_TCCRnA_VALUE (MULTISERVO_TIMER_PRESCALER_CONFIG)
158 #define MULTISERVO_OCR OCR0
159
160 #elif MULTISERVO_TIMER == 1
161 #ifndef TIMER1_COMPA_vect
162 #if defined(SIG_OUTPUT_COMPARE1A)
163 #define TIMER1_COMPA_vect SIG_OUTPUT_COMPARE1A
164 #endif
165 #endif
166 #define MULTISERVO_SIG_OUTPUT_COMPARE TIMER1_COMPA_vect
167 #define MULTISERVO_TIMSK TIMSK
168 #define MULTISERVO_OCIE  OCIE1A
169 #define MULTISERVO_TCCRnA TCCR1A
170 #define MULTISERVO_TCCRnA_VALUE 0
171 #define MULTISERVO_TCCRnB TCCR1B
172 #define MULTISERVO_TCCRnB_VALUE ((1 << WGM12) | MULTISERVO_TIMER_PRESCALER_CONFIG)
173 #define MULTISERVO_OCR OCR1A
174
175 #else
176 #error "Bad timer number, check your multiservo_config.h"
177 #endif
178
179
180
181 /* #elif XYZ */
182
183 /* Add other archs here */
184
185 #else
186
187 #error "This MCU is not supported, see in multiservo_archs.h"
188
189 #endif /* MCU CHOICE */
190
191
192 #endif /* _MULTISERVO_ARCHS_H_ */