Contiki 2.5
portpins.h
1 /* Copyright (c) 2003 Theodore A. Roth
2  All rights reserved.
3 
4  Redistribution and use in source and binary forms, with or without
5  modification, are permitted provided that the following conditions are met:
6 
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9 
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
13  distribution.
14 
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.
18 
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. */
30 
31 /* $Id: portpins.h,v 1.4.2.1 2009/03/19 22:19:26 arcanum Exp $ */
32 
33 #ifndef _AVR_PORTPINS_H_
34 #define _AVR_PORTPINS_H_ 1
35 
36 /* This file should only be included from <avr/io.h>, never directly. */
37 
38 #ifndef _AVR_IO_H_
39 # error "Include <avr/io.h> instead of this file."
40 #endif
41 
42 /* Define Generic PORTn, DDn, and PINn values. */
43 
44 /* Port Data Register (generic) */
45 #define PORT7 7
46 #define PORT6 6
47 #define PORT5 5
48 #define PORT4 4
49 #define PORT3 3
50 #define PORT2 2
51 #define PORT1 1
52 #define PORT0 0
53 
54 /* Port Data Direction Register (generic) */
55 #define DD7 7
56 #define DD6 6
57 #define DD5 5
58 #define DD4 4
59 #define DD3 3
60 #define DD2 2
61 #define DD1 1
62 #define DD0 0
63 
64 /* Port Input Pins (generic) */
65 #define PIN7 7
66 #define PIN6 6
67 #define PIN5 5
68 #define PIN4 4
69 #define PIN3 3
70 #define PIN2 2
71 #define PIN1 1
72 #define PIN0 0
73 
74 /* Define PORTxn an Pxn values for all possible port pins if not defined already by io.h. */
75 
76 /* PORT A */
77 
78 #if defined(PA0) && !defined(PORTA0)
79 # define PORTA0 PA0
80 #elif defined(PORTA0) && !defined(PA0)
81 # define PA0 PORTA0
82 #endif
83 #if defined(PA1) && !defined(PORTA1)
84 # define PORTA1 PA1
85 #elif defined(PORTA1) && !defined(PA1)
86 # define PA1 PORTA1
87 #endif
88 #if defined(PA2) && !defined(PORTA2)
89 # define PORTA2 PA2
90 #elif defined(PORTA2) && !defined(PA2)
91 # define PA2 PORTA2
92 #endif
93 #if defined(PA3) && !defined(PORTA3)
94 # define PORTA3 PA3
95 #elif defined(PORTA3) && !defined(PA3)
96 # define PA3 PORTA3
97 #endif
98 #if defined(PA4) && !defined(PORTA4)
99 # define PORTA4 PA4
100 #elif defined(PORTA4) && !defined(PA4)
101 # define PA4 PORTA4
102 #endif
103 #if defined(PA5) && !defined(PORTA5)
104 # define PORTA5 PA5
105 #elif defined(PORTA5) && !defined(PA5)
106 # define PA5 PORTA5
107 #endif
108 #if defined(PA6) && !defined(PORTA6)
109 # define PORTA6 PA6
110 #elif defined(PORTA6) && !defined(PA6)
111 # define PA6 PORTA6
112 #endif
113 #if defined(PA7) && !defined(PORTA7)
114 # define PORTA7 PA7
115 #elif defined(PORTA7) && !defined(PA7)
116 # define PA7 PORTA7
117 #endif
118 
119 /* PORT B */
120 
121 #if defined(PB0) && !defined(PORTB0)
122 # define PORTB0 PB0
123 #elif defined(PORTB0) && !defined(PB0)
124 # define PB0 PORTB0
125 #endif
126 #if defined(PB1) && !defined(PORTB1)
127 # define PORTB1 PB1
128 #elif defined(PORTB1) && !defined(PB1)
129 # define PB1 PORTB1
130 #endif
131 #if defined(PB2) && !defined(PORTB2)
132 # define PORTB2 PB2
133 #elif defined(PORTB2) && !defined(PB2)
134 # define PB2 PORTB2
135 #endif
136 #if defined(PB3) && !defined(PORTB3)
137 # define PORTB3 PB3
138 #elif defined(PORTB3) && !defined(PB3)
139 # define PB3 PORTB3
140 #endif
141 #if defined(PB4) && !defined(PORTB4)
142 # define PORTB4 PB4
143 #elif defined(PORTB4) && !defined(PB4)
144 # define PB4 PORTB4
145 #endif
146 #if defined(PB5) && !defined(PORTB5)
147 # define PORTB5 PB5
148 #elif defined(PORTB5) && !defined(PB5)
149 # define PB5 PORTB5
150 #endif
151 #if defined(PB6) && !defined(PORTB6)
152 # define PORTB6 PB6
153 #elif defined(PORTB6) && !defined(PB6)
154 # define PB6 PORTB6
155 #endif
156 #if defined(PB7) && !defined(PORTB7)
157 # define PORTB7 PB7
158 #elif defined(PORTB7) && !defined(PB7)
159 # define PB7 PORTB7
160 #endif
161 
162 /* PORT C */
163 
164 #if defined(PC0) && !defined(PORTC0)
165 # define PORTC0 PC0
166 #elif defined(PORTC0) && !defined(PC0)
167 # define PC0 PORTC0
168 #endif
169 #if defined(PC1) && !defined(PORTC1)
170 # define PORTC1 PC1
171 #elif defined(PORTC1) && !defined(PC1)
172 # define PC1 PORTC1
173 #endif
174 #if defined(PC2) && !defined(PORTC2)
175 # define PORTC2 PC2
176 #elif defined(PORTC2) && !defined(PC2)
177 # define PC2 PORTC2
178 #endif
179 #if defined(PC3) && !defined(PORTC3)
180 # define PORTC3 PC3
181 #elif defined(PORTC3) && !defined(PC3)
182 # define PC3 PORTC3
183 #endif
184 #if defined(PC4) && !defined(PORTC4)
185 # define PORTC4 PC4
186 #elif defined(PORTC4) && !defined(PC4)
187 # define PC4 PORTC4
188 #endif
189 #if defined(PC5) && !defined(PORTC5)
190 # define PORTC5 PC5
191 #elif defined(PORTC5) && !defined(PC5)
192 # define PC5 PORTC5
193 #endif
194 #if defined(PC6) && !defined(PORTC6)
195 # define PORTC6 PC6
196 #elif defined(PORTC6) && !defined(PC6)
197 # define PC6 PORTC6
198 #endif
199 #if defined(PC7) && !defined(PORTC7)
200 # define PORTC7 PC7
201 #elif defined(PORTC7) && !defined(PC7)
202 # define PC7 PORTC7
203 #endif
204 
205 /* PORT D */
206 
207 #if defined(PD0) && !defined(PORTD0)
208 # define PORTD0 PD0
209 #elif defined(PORTD0) && !defined(PD0)
210 # define PD0 PORTD0
211 #endif
212 #if defined(PD1) && !defined(PORTD1)
213 # define PORTD1 PD1
214 #elif defined(PORTD1) && !defined(PD1)
215 # define PD1 PORTD1
216 #endif
217 #if defined(PD2) && !defined(PORTD2)
218 # define PORTD2 PD2
219 #elif defined(PORTD2) && !defined(PD2)
220 # define PD2 PORTD2
221 #endif
222 #if defined(PD3) && !defined(PORTD3)
223 # define PORTD3 PD3
224 #elif defined(PORTD3) && !defined(PD3)
225 # define PD3 PORTD3
226 #endif
227 #if defined(PD4) && !defined(PORTD4)
228 # define PORTD4 PD4
229 #elif defined(PORTD4) && !defined(PD4)
230 # define PD4 PORTD4
231 #endif
232 #if defined(PD5) && !defined(PORTD5)
233 # define PORTD5 PD5
234 #elif defined(PORTD5) && !defined(PD5)
235 # define PD5 PORTD5
236 #endif
237 #if defined(PD6) && !defined(PORTD6)
238 # define PORTD6 PD6
239 #elif defined(PORTD6) && !defined(PD6)
240 # define PD6 PORTD6
241 #endif
242 #if defined(PD7) && !defined(PORTD7)
243 # define PORTD7 PD7
244 #elif defined(PORTD7) && !defined(PD7)
245 # define PD7 PORTD7
246 #endif
247 
248 /* PORT E */
249 
250 #if defined(PE0) && !defined(PORTE0)
251 # define PORTE0 PE0
252 #elif defined(PORTE0) && !defined(PE0)
253 # define PE0 PORTE0
254 #endif
255 #if defined(PE1) && !defined(PORTE1)
256 # define PORTE1 PE1
257 #elif defined(PORTE1) && !defined(PE1)
258 # define PE1 PORTE1
259 #endif
260 #if defined(PE2) && !defined(PORTE2)
261 # define PORTE2 PE2
262 #elif defined(PORTE2) && !defined(PE2)
263 # define PE2 PORTE2
264 #endif
265 #if defined(PE3) && !defined(PORTE3)
266 # define PORTE3 PE3
267 #elif defined(PORTE3) && !defined(PE3)
268 # define PE3 PORTE3
269 #endif
270 #if defined(PE4) && !defined(PORTE4)
271 # define PORTE4 PE4
272 #elif defined(PORTE4) && !defined(PE4)
273 # define PE4 PORTE4
274 #endif
275 #if defined(PE5) && !defined(PORTE5)
276 # define PORTE5 PE5
277 #elif defined(PORTE5) && !defined(PE5)
278 # define PE5 PORTE5
279 #endif
280 #if defined(PE6) && !defined(PORTE6)
281 # define PORTE6 PE6
282 #elif defined(PORTE6) && !defined(PE6)
283 # define PE6 PORTE6
284 #endif
285 #if defined(PE7) && !defined(PORTE7)
286 # define PORTE7 PE7
287 #elif defined(PORTE7) && !defined(PE7)
288 # define PE7 PORTE7
289 #endif
290 
291 /* PORT F */
292 
293 #if defined(PF0) && !defined(PORTF0)
294 # define PORTF0 PF0
295 #elif defined(PORTF0) && !defined(PF0)
296 # define PF0 PORTF0
297 #endif
298 #if defined(PF1) && !defined(PORTF1)
299 # define PORTF1 PF1
300 #elif defined(PORTF1) && !defined(PF1)
301 # define PF1 PORTF1
302 #endif
303 #if defined(PF2) && !defined(PORTF2)
304 # define PORTF2 PF2
305 #elif defined(PORTF2) && !defined(PF2)
306 # define PF2 PORTF2
307 #endif
308 #if defined(PF3) && !defined(PORTF3)
309 # define PORTF3 PF3
310 #elif defined(PORTF3) && !defined(PF3)
311 # define PF3 PORTF3
312 #endif
313 #if defined(PF4) && !defined(PORTF4)
314 # define PORTF4 PF4
315 #elif defined(PORTF4) && !defined(PF4)
316 # define PF4 PORTF4
317 #endif
318 #if defined(PF5) && !defined(PORTF5)
319 # define PORTF5 PF5
320 #elif defined(PORTF5) && !defined(PF5)
321 # define PF5 PORTF5
322 #endif
323 #if defined(PF6) && !defined(PORTF6)
324 # define PORTF6 PF6
325 #elif defined(PORTF6) && !defined(PF6)
326 # define PF6 PORTF6
327 #endif
328 #if defined(PF7) && !defined(PORTF7)
329 # define PORTF7 PF7
330 #elif defined(PORTF7) && !defined(PF7)
331 # define PF7 PORTF7
332 #endif
333 
334 /* PORT G */
335 
336 #if defined(PG0) && !defined(PORTG0)
337 # define PORTG0 PG0
338 #elif defined(PORTG0) && !defined(PG0)
339 # define PG0 PORTG0
340 #endif
341 #if defined(PG1) && !defined(PORTG1)
342 # define PORTG1 PG1
343 #elif defined(PORTG1) && !defined(PG1)
344 # define PG1 PORTG1
345 #endif
346 #if defined(PG2) && !defined(PORTG2)
347 # define PORTG2 PG2
348 #elif defined(PORTG2) && !defined(PG2)
349 # define PG2 PORTG2
350 #endif
351 #if defined(PG3) && !defined(PORTG3)
352 # define PORTG3 PG3
353 #elif defined(PORTG3) && !defined(PG3)
354 # define PG3 PORTG3
355 #endif
356 #if defined(PG4) && !defined(PORTG4)
357 # define PORTG4 PG4
358 #elif defined(PORTG4) && !defined(PG4)
359 # define PG4 PORTG4
360 #endif
361 #if defined(PG5) && !defined(PORTG5)
362 # define PORTG5 PG5
363 #elif defined(PORTG5) && !defined(PG5)
364 # define PG5 PORTG5
365 #endif
366 #if defined(PG6) && !defined(PORTG6)
367 # define PORTG6 PG6
368 #elif defined(PORTG6) && !defined(PG6)
369 # define PG6 PORTG6
370 #endif
371 #if defined(PG7) && !defined(PORTG7)
372 # define PORTG7 PG7
373 #elif defined(PORTG7) && !defined(PG7)
374 # define PG7 PORTG7
375 #endif
376 
377 /* PORT H */
378 
379 #if defined(PH0) && !defined(PORTH0)
380 # define PORTH0 PH0
381 #elif defined(PORTH0) && !defined(PH0)
382 # define PH0 PORTH0
383 #endif
384 #if defined(PH1) && !defined(PORTH1)
385 # define PORTH1 PH1
386 #elif defined(PORTH1) && !defined(PH1)
387 # define PH1 PORTH1
388 #endif
389 #if defined(PH2) && !defined(PORTH2)
390 # define PORTH2 PH2
391 #elif defined(PORTH2) && !defined(PH2)
392 # define PH2 PORTH2
393 #endif
394 #if defined(PH3) && !defined(PORTH3)
395 # define PORTH3 PH3
396 #elif defined(PORTH3) && !defined(PH3)
397 # define PH3 PORTH3
398 #endif
399 #if defined(PH4) && !defined(PORTH4)
400 # define PORTH4 PH4
401 #elif defined(PORTH4) && !defined(PH4)
402 # define PH4 PORTH4
403 #endif
404 #if defined(PH5) && !defined(PORTH5)
405 # define PORTH5 PH5
406 #elif defined(PORTH5) && !defined(PH5)
407 # define PH5 PORTH5
408 #endif
409 #if defined(PH6) && !defined(PORTH6)
410 # define PORTH6 PH6
411 #elif defined(PORTH6) && !defined(PH6)
412 # define PH6 PORTH6
413 #endif
414 #if defined(PH7) && !defined(PORTH7)
415 # define PORTH7 PH7
416 #elif defined(PORTH7) && !defined(PH7)
417 # define PH7 PORTH7
418 #endif
419 
420 /* PORT J */
421 
422 #if defined(PJ0) && !defined(PORTJ0)
423 # define PORTJ0 PJ0
424 #elif defined(PORTJ0) && !defined(PJ0)
425 # define PJ0 PORTJ0
426 #endif
427 #if defined(PJ1) && !defined(PORTJ1)
428 # define PORTJ1 PJ1
429 #elif defined(PORTJ1) && !defined(PJ1)
430 # define PJ1 PORTJ1
431 #endif
432 #if defined(PJ2) && !defined(PORTJ2)
433 # define PORTJ2 PJ2
434 #elif defined(PORTJ2) && !defined(PJ2)
435 # define PJ2 PORTJ2
436 #endif
437 #if defined(PJ3) && !defined(PORTJ3)
438 # define PORTJ3 PJ3
439 #elif defined(PORTJ3) && !defined(PJ3)
440 # define PJ3 PORTJ3
441 #endif
442 #if defined(PJ4) && !defined(PORTJ4)
443 # define PORTJ4 PJ4
444 #elif defined(PORTJ4) && !defined(PJ4)
445 # define PJ4 PORTJ4
446 #endif
447 #if defined(PJ5) && !defined(PORTJ5)
448 # define PORTJ5 PJ5
449 #elif defined(PORTJ5) && !defined(PJ5)
450 # define PJ5 PORTJ5
451 #endif
452 #if defined(PJ6) && !defined(PORTJ6)
453 # define PORTJ6 PJ6
454 #elif defined(PORTJ6) && !defined(PJ6)
455 # define PJ6 PORTJ6
456 #endif
457 #if defined(PJ7) && !defined(PORTJ7)
458 # define PORTJ7 PJ7
459 #elif defined(PORTJ7) && !defined(PJ7)
460 # define PJ7 PORTJ7
461 #endif
462 
463 /* PORT K */
464 
465 #if defined(PK0) && !defined(PORTK0)
466 # define PORTK0 PK0
467 #elif defined(PORTK0) && !defined(PK0)
468 # define PK0 PORTK0
469 #endif
470 #if defined(PK1) && !defined(PORTK1)
471 # define PORTK1 PK1
472 #elif defined(PORTK1) && !defined(PK1)
473 # define PK1 PORTK1
474 #endif
475 #if defined(PK2) && !defined(PORTK2)
476 # define PORTK2 PK2
477 #elif defined(PORTK2) && !defined(PK2)
478 # define PK2 PORTK2
479 #endif
480 #if defined(PK3) && !defined(PORTK3)
481 # define PORTK3 PK3
482 #elif defined(PORTK3) && !defined(PK3)
483 # define PK3 PORTK3
484 #endif
485 #if defined(PK4) && !defined(PORTK4)
486 # define PORTK4 PK4
487 #elif defined(PORTK4) && !defined(PK4)
488 # define PK4 PORTK4
489 #endif
490 #if defined(PK5) && !defined(PORTK5)
491 # define PORTK5 PK5
492 #elif defined(PORTK5) && !defined(PK5)
493 # define PK5 PORTK5
494 #endif
495 #if defined(PK6) && !defined(PORTK6)
496 # define PORTK6 PK6
497 #elif defined(PORTK6) && !defined(PK6)
498 # define PK6 PORTK6
499 #endif
500 #if defined(PK7) && !defined(PORTK7)
501 # define PORTK7 PK7
502 #elif defined(PORTK7) && !defined(PK7)
503 # define PK7 PORTK7
504 #endif
505 
506 /* PORT L */
507 
508 #if defined(PL0) && !defined(PORTL0)
509 # define PORTL0 PL0
510 #elif defined(PORTL0) && !defined(PL0)
511 # define PL0 PORTL0
512 #endif
513 #if defined(PL1) && !defined(PORTL1)
514 # define PORTL1 PL1
515 #elif defined(PORTL1) && !defined(PL1)
516 # define PL1 PORTL1
517 #endif
518 #if defined(PL2) && !defined(PORTL2)
519 # define PORTL2 PL2
520 #elif defined(PORTL2) && !defined(PL2)
521 # define PL2 PORTL2
522 #endif
523 #if defined(PL3) && !defined(PORTL3)
524 # define PORTL3 PL3
525 #elif defined(PORTL3) && !defined(PL3)
526 # define PL3 PORTL3
527 #endif
528 #if defined(PL4) && !defined(PORTL4)
529 # define PORTL4 PL4
530 #elif defined(PORTL4) && !defined(PL4)
531 # define PL4 PORTL4
532 #endif
533 #if defined(PL5) && !defined(PORTL5)
534 # define PORTL5 PL5
535 #elif defined(PORTL5) && !defined(PL5)
536 # define PL5 PORTL5
537 #endif
538 #if defined(PL6) && !defined(PORTL6)
539 # define PORTL6 PL6
540 #elif defined(PORTL6) && !defined(PL6)
541 # define PL6 PORTL6
542 #endif
543 #if defined(PL7) && !defined(PORTL7)
544 # define PORTL7 PL7
545 #elif defined(PORTL7) && !defined(PL7)
546 # define PL7 PORTL7
547 #endif
548 
549 #endif /* _AVR_PORTPINS_H_ */