RTEMS CPU Kit with SuperCore  4.11.3
iom324pa.h
Go to the documentation of this file.
1 /* Copyright (c) 2009 Atmel Corporation
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 
32 /* avr/iom324pa.h - definitions for ATmega324PA */
33 
34 /* This file should only be included from <avr/io.h>, never directly. */
35 
36 #ifndef _AVR_IO_H_
37 # error "Include <avr/io.h> instead of this file."
38 #endif
39 
40 #ifndef _AVR_IOXXX_H_
41 # define _AVR_IOXXX_H_ "iom324pa.h"
42 #else
43 # error "Attempt to include more than one <avr/ioXXX.h> file."
44 #endif
45 
46 
47 #ifndef _AVR_ATmega324PA_H_
48 #define _AVR_ATmega324PA_H_ 1
49 
50 
51 /* Registers and associated bit numbers. */
52 
53 #define PINA _SFR_IO8(0x00)
54 #define PINA0 0
55 #define PINA1 1
56 #define PINA2 2
57 #define PINA3 3
58 #define PINA4 4
59 #define PINA5 5
60 #define PINA6 6
61 #define PINA7 7
62 
63 #define DDRA _SFR_IO8(0x01)
64 #define DDA0 0
65 #define DDA1 1
66 #define DDA2 2
67 #define DDA3 3
68 #define DDA4 4
69 #define DDA5 5
70 #define DDA6 6
71 #define DDA7 7
72 
73 #define PORTA _SFR_IO8(0x02)
74 #define PORTA0 0
75 #define PORTA1 1
76 #define PORTA2 2
77 #define PORTA3 3
78 #define PORTA4 4
79 #define PORTA5 5
80 #define PORTA6 6
81 #define PORTA7 7
82 
83 #define PINB _SFR_IO8(0x03)
84 #define PINB0 0
85 #define PINB1 1
86 #define PINB2 2
87 #define PINB3 3
88 #define PINB4 4
89 #define PINB5 5
90 #define PINB6 6
91 #define PINB7 7
92 
93 #define DDRB _SFR_IO8(0x04)
94 #define DDB0 0
95 #define DDB1 1
96 #define DDB2 2
97 #define DDB3 3
98 #define DDB4 4
99 #define DDB5 5
100 #define DDB6 6
101 #define DDB7 7
102 
103 #define PORTB _SFR_IO8(0x05)
104 #define PORTB0 0
105 #define PORTB1 1
106 #define PORTB2 2
107 #define PORTB3 3
108 #define PORTB4 4
109 #define PORTB5 5
110 #define PORTB6 6
111 #define PORTB7 7
112 
113 #define PINC _SFR_IO8(0x06)
114 #define PINC0 0
115 #define PINC1 1
116 #define PINC2 2
117 #define PINC3 3
118 #define PINC4 4
119 #define PINC5 5
120 #define PINC6 6
121 #define PINC7 7
122 
123 #define DDRC _SFR_IO8(0x07)
124 #define DDC0 0
125 #define DDC1 1
126 #define DDC2 2
127 #define DDC3 3
128 #define DDC4 4
129 #define DDC5 5
130 #define DDC6 6
131 #define DDC7 7
132 
133 #define PORTC _SFR_IO8(0x08)
134 #define PORTC0 0
135 #define PORTC1 1
136 #define PORTC2 2
137 #define PORTC3 3
138 #define PORTC4 4
139 #define PORTC5 5
140 #define PORTC6 6
141 #define PORTC7 7
142 
143 #define PIND _SFR_IO8(0x09)
144 #define PIND0 0
145 #define PIND1 1
146 #define PIND2 2
147 #define PIND3 3
148 #define PIND4 4
149 #define PIND5 5
150 #define PIND6 6
151 #define PIND7 7
152 
153 #define DDRD _SFR_IO8(0x0A)
154 #define DDD0 0
155 #define DDD1 1
156 #define DDD2 2
157 #define DDD3 3
158 #define DDD4 4
159 #define DDD5 5
160 #define DDD6 6
161 #define DDD7 7
162 
163 #define PORTD _SFR_IO8(0x0B)
164 #define PORTD0 0
165 #define PORTD1 1
166 #define PORTD2 2
167 #define PORTD3 3
168 #define PORTD4 4
169 #define PORTD5 5
170 #define PORTD6 6
171 #define PORTD7 7
172 
173 #define TIFR0 _SFR_IO8(0x15)
174 #define TOV0 0
175 #define OCF0A 1
176 #define OCF0B 2
177 
178 #define TIFR1 _SFR_IO8(0x16)
179 #define TOV1 0
180 #define OCF1A 1
181 #define OCF1B 2
182 #define ICF1 5
183 
184 #define TIFR2 _SFR_IO8(0x17)
185 #define TOV2 0
186 #define OCF2A 1
187 #define OCF2B 2
188 
189 #define PCIFR _SFR_IO8(0x1B)
190 #define PCIF0 0
191 #define PCIF1 1
192 #define PCIF2 2
193 #define PCIF3 3
194 
195 #define EIFR _SFR_IO8(0x1C)
196 #define INTF0 0
197 #define INTF1 1
198 #define INTF2 2
199 
200 #define EIMSK _SFR_IO8(0x1D)
201 #define INT0 0
202 #define INT1 1
203 #define INT2 2
204 
205 #define GPIOR0 _SFR_IO8(0x1E)
206 #define GPIOR00 0
207 #define GPIOR01 1
208 #define GPIOR02 2
209 #define GPIOR03 3
210 #define GPIOR04 4
211 #define GPIOR05 5
212 #define GPIOR06 6
213 #define GPIOR07 7
214 
215 #define EECR _SFR_IO8(0x1F)
216 #define EERE 0
217 #define EEPE 1
218 #define EEMPE 2
219 #define EERIE 3
220 #define EEPM0 4
221 #define EEPM1 5
222 
223 #define EEDR _SFR_IO8(0x20)
224 #define EEDR0 0
225 #define EEDR1 1
226 #define EEDR2 2
227 #define EEDR3 3
228 #define EEDR4 4
229 #define EEDR5 5
230 #define EEDR6 6
231 #define EEDR7 7
232 
233 #define EEAR _SFR_IO16(0x21)
234 
235 #define EEARL _SFR_IO8(0x21)
236 #define EEAR0 0
237 #define EEAR1 1
238 #define EEAR2 2
239 #define EEAR3 3
240 #define EEAR4 4
241 #define EEAR5 5
242 #define EEAR6 6
243 #define EEAR7 7
244 
245 #define EEARH _SFR_IO8(0x22)
246 #define EEAR8 0
247 #define EEAR9 1
248 #define EEAR10 2
249 #define EEAR11 3
250 
251 #define GTCCR _SFR_IO8(0x23)
252 #define PSRSYNC 0
253 #define PSRASY 1
254 #define TSM 7
255 
256 #define TCCR0A _SFR_IO8(0x24)
257 #define WGM00 0
258 #define WGM01 1
259 #define COM0B0 4
260 #define COM0B1 5
261 #define COM0A0 6
262 #define COM0A1 7
263 
264 #define TCCR0B _SFR_IO8(0x25)
265 #define CS00 0
266 #define CS01 1
267 #define CS02 2
268 #define WGM02 3
269 #define FOC0B 6
270 #define FOC0A 7
271 
272 #define TCNT0 _SFR_IO8(0x26)
273 #define TCNT0_0 0
274 #define TCNT0_1 1
275 #define TCNT0_2 2
276 #define TCNT0_3 3
277 #define TCNT0_4 4
278 #define TCNT0_5 5
279 #define TCNT0_6 6
280 #define TCNT0_7 7
281 
282 #define OCR0A _SFR_IO8(0x27)
283 #define OCR0A_0 0
284 #define OCR0A_1 1
285 #define OCR0A_2 2
286 #define OCR0A_3 3
287 #define OCR0A_4 4
288 #define OCR0A_5 5
289 #define OCR0A_6 6
290 #define OCR0A_7 7
291 
292 #define OCR0B _SFR_IO8(0x28)
293 #define OCR0B_0 0
294 #define OCR0B_1 1
295 #define OCR0B_2 2
296 #define OCR0B_3 3
297 #define OCR0B_4 4
298 #define OCR0B_5 5
299 #define OCR0B_6 6
300 #define OCR0B_7 7
301 
302 #define GPIOR1 _SFR_IO8(0x2A)
303 #define GPIOR10 0
304 #define GPIOR11 1
305 #define GPIOR12 2
306 #define GPIOR13 3
307 #define GPIOR14 4
308 #define GPIOR15 5
309 #define GPIOR16 6
310 #define GPIOR17 7
311 
312 #define GPIOR2 _SFR_IO8(0x2B)
313 #define GPIOR20 0
314 #define GPIOR21 1
315 #define GPIOR22 2
316 #define GPIOR23 3
317 #define GPIOR24 4
318 #define GPIOR25 5
319 #define GPIOR26 6
320 #define GPIOR27 7
321 
322 #define SPCR0 _SFR_IO8(0x2C)
323 #define SPR00 0
324 #define SPR10 1
325 #define CPHA0 2
326 #define CPOL0 3
327 #define MSTR0 4
328 #define DORD0 5
329 #define SPE0 6
330 #define SPIE0 7
331 
332 #define SPSR0 _SFR_IO8(0x2D)
333 #define SPI2X0 0
334 #define WCOL0 6
335 #define SPIF0 7
336 
337 #define SPDR0 _SFR_IO8(0x2E)
338 #define SPDRB0 0
339 #define SPDRB1 1
340 #define SPDRB2 2
341 #define SPDRB3 3
342 #define SPDRB4 4
343 #define SPDRB5 5
344 #define SPDRB6 6
345 #define SPDRB7 7
346 
347 #define ACSR _SFR_IO8(0x30)
348 #define ACIS0 0
349 #define ACIS1 1
350 #define ACIC 2
351 #define ACIE 3
352 #define ACI 4
353 #define ACO 5
354 #define ACBG 6
355 #define ACD 7
356 
357 #define OCDR _SFR_IO8(0x31)
358 #define OCDR0 0
359 #define OCDR1 1
360 #define OCDR2 2
361 #define OCDR3 3
362 #define OCDR4 4
363 #define OCDR5 5
364 #define OCDR6 6
365 #define OCDR7 7
366 
367 #define SMCR _SFR_IO8(0x33)
368 #define SE 0
369 #define SM0 1
370 #define SM1 2
371 #define SM2 3
372 
373 #define MCUSR _SFR_IO8(0x34)
374 #define PORF 0
375 #define EXTRF 1
376 #define BORF 2
377 #define WDRF 3
378 #define JTRF 4
379 
380 #define MCUCR _SFR_IO8(0x35)
381 #define IVCE 0
382 #define IVSEL 1
383 #define PUD 4
384 #define BODSE 5
385 #define BODS 6
386 #define JTD 7
387 
388 #define SPMCSR _SFR_IO8(0x37)
389 #define SPMEN 0
390 #define PGERS 1
391 #define PGWRT 2
392 #define BLBSET 3
393 #define RWWSRE 4
394 #define SIGRD 5
395 #define RWWSB 6
396 #define SPMIE 7
397 
398 #define WDTCSR _SFR_MEM8(0x60)
399 #define WDP0 0
400 #define WDP1 1
401 #define WDP2 2
402 #define WDE 3
403 #define WDCE 4
404 #define WDP3 5
405 #define WDIE 6
406 #define WDIF 7
407 
408 #define CLKPR _SFR_MEM8(0x61)
409 #define CLKPS0 0
410 #define CLKPS1 1
411 #define CLKPS2 2
412 #define CLKPS3 3
413 #define CLKPCE 7
414 
415 #define PRR0 _SFR_MEM8(0x64)
416 #define PRADC 0
417 #define PRUSART0 1
418 #define PRSPI 2
419 #define PRTIM1 3
420 #define PRUSART1 4
421 #define PRTIM0 5
422 #define PRTIM2 6
423 #define PRTWI 7
424 
425 #define OSCCAL _SFR_MEM8(0x66)
426 #define CAL0 0
427 #define CAL1 1
428 #define CAL2 2
429 #define CAL3 3
430 #define CAL4 4
431 #define CAL5 5
432 #define CAL6 6
433 #define CAL7 7
434 
435 #define PCICR _SFR_MEM8(0x68)
436 #define PCIE0 0
437 #define PCIE1 1
438 #define PCIE2 2
439 #define PCIE3 3
440 
441 #define EICRA _SFR_MEM8(0x69)
442 #define ISC00 0
443 #define ISC01 1
444 #define ISC10 2
445 #define ISC11 3
446 #define ISC20 4
447 #define ISC21 5
448 
449 #define PCMSK0 _SFR_MEM8(0x6B)
450 #define PCINT0 0
451 #define PCINT1 1
452 #define PCINT2 2
453 #define PCINT3 3
454 #define PCINT4 4
455 #define PCINT5 5
456 #define PCINT6 6
457 #define PCINT7 7
458 
459 #define PCMSK1 _SFR_MEM8(0x6C)
460 #define PCINT8 0
461 #define PCINT9 1
462 #define PCINT10 2
463 #define PCINT11 3
464 #define PCINT12 4
465 #define PCINT13 5
466 #define PCINT14 6
467 #define PCINT15 7
468 
469 #define PCMSK2 _SFR_MEM8(0x6D)
470 #define PCINT16 0
471 #define PCINT17 1
472 #define PCINT18 2
473 #define PCINT19 3
474 #define PCINT20 4
475 #define PCINT21 5
476 #define PCINT22 6
477 #define PCINT23 7
478 
479 #define TIMSK0 _SFR_MEM8(0x6E)
480 #define TOIE0 0
481 #define OCIE0A 1
482 #define OCIE0B 2
483 
484 #define TIMSK1 _SFR_MEM8(0x6F)
485 #define TOIE1 0
486 #define OCIE1A 1
487 #define OCIE1B 2
488 #define ICIE1 5
489 
490 #define TIMSK2 _SFR_MEM8(0x70)
491 #define TOIE2 0
492 #define OCIE2A 1
493 #define OCIE2B 2
494 
495 #define PCMSK3 _SFR_MEM8(0x73)
496 #define PCINT24 0
497 #define PCINT25 1
498 #define PCINT26 2
499 #define PCINT27 3
500 #define PCINT28 4
501 #define PCINT29 5
502 #define PCINT30 6
503 #define PCINT31 7
504 
505 #ifndef __ASSEMBLER__
506 #define ADC _SFR_MEM16(0x78)
507 #endif
508 #define ADCW _SFR_MEM16(0x78)
509 
510 #define ADCL _SFR_MEM8(0x78)
511 #define ADCL0 0
512 #define ADCL1 1
513 #define ADCL2 2
514 #define ADCL3 3
515 #define ADCL4 4
516 #define ADCL5 5
517 #define ADCL6 6
518 #define ADCL7 7
519 
520 #define ADCH _SFR_MEM8(0x79)
521 #define ADCH0 0
522 #define ADCH1 1
523 #define ADCH2 2
524 #define ADCH3 3
525 #define ADCH4 4
526 #define ADCH5 5
527 #define ADCH6 6
528 #define ADCH7 7
529 
530 #define ADCSRA _SFR_MEM8(0x7A)
531 #define ADPS0 0
532 #define ADPS1 1
533 #define ADPS2 2
534 #define ADIE 3
535 #define ADIF 4
536 #define ADATE 5
537 #define ADSC 6
538 #define ADEN 7
539 
540 #define ADCSRB _SFR_MEM8(0x7B)
541 #define ADTS0 0
542 #define ADTS1 1
543 #define ADTS2 2
544 #define ACME 6
545 
546 #define ADMUX _SFR_MEM8(0x7C)
547 #define MUX0 0
548 #define MUX1 1
549 #define MUX2 2
550 #define MUX3 3
551 #define MUX4 4
552 #define ADLAR 5
553 #define REFS0 6
554 #define REFS1 7
555 
556 #define DIDR0 _SFR_MEM8(0x7E)
557 #define ADC0D 0
558 #define ADC1D 1
559 #define ADC2D 2
560 #define ADC3D 3
561 #define ADC4D 4
562 #define ADC5D 5
563 #define ADC6D 6
564 #define ADC7D 7
565 
566 #define DIDR1 _SFR_MEM8(0x7F)
567 #define AIN0D 0
568 #define AIN1D 1
569 
570 #define TCCR1A _SFR_MEM8(0x80)
571 #define WGM10 0
572 #define WGM11 1
573 #define COM1B0 4
574 #define COM1B1 5
575 #define COM1A0 6
576 #define COM1A1 7
577 
578 #define TCCR1B _SFR_MEM8(0x81)
579 #define CS10 0
580 #define CS11 1
581 #define CS12 2
582 #define WGM12 3
583 #define WGM13 4
584 #define ICES1 6
585 #define ICNC1 7
586 
587 #define TCCR1C _SFR_MEM8(0x82)
588 #define FOC1B 6
589 #define FOC1A 7
590 
591 #define TCNT1 _SFR_MEM16(0x84)
592 
593 #define TCNT1L _SFR_MEM8(0x84)
594 #define TCNT1L0 0
595 #define TCNT1L1 1
596 #define TCNT1L2 2
597 #define TCNT1L3 3
598 #define TCNT1L4 4
599 #define TCNT1L5 5
600 #define TCNT1L6 6
601 #define TCNT1L7 7
602 
603 #define TCNT1H _SFR_MEM8(0x85)
604 #define TCNT1H0 0
605 #define TCNT1H1 1
606 #define TCNT1H2 2
607 #define TCNT1H3 3
608 #define TCNT1H4 4
609 #define TCNT1H5 5
610 #define TCNT1H6 6
611 #define TCNT1H7 7
612 
613 #define ICR1 _SFR_MEM16(0x86)
614 
615 #define ICR1L _SFR_MEM8(0x86)
616 #define ICR1L0 0
617 #define ICR1L1 1
618 #define ICR1L2 2
619 #define ICR1L3 3
620 #define ICR1L4 4
621 #define ICR1L5 5
622 #define ICR1L6 6
623 #define ICR1L7 7
624 
625 #define ICR1H _SFR_MEM8(0x87)
626 #define ICR1H0 0
627 #define ICR1H1 1
628 #define ICR1H2 2
629 #define ICR1H3 3
630 #define ICR1H4 4
631 #define ICR1H5 5
632 #define ICR1H6 6
633 #define ICR1H7 7
634 
635 #define OCR1A _SFR_MEM16(0x88)
636 
637 #define OCR1AL _SFR_MEM8(0x88)
638 #define OCR1AL0 0
639 #define OCR1AL1 1
640 #define OCR1AL2 2
641 #define OCR1AL3 3
642 #define OCR1AL4 4
643 #define OCR1AL5 5
644 #define OCR1AL6 6
645 #define OCR1AL7 7
646 
647 #define OCR1AH _SFR_MEM8(0x89)
648 #define OCR1AH0 0
649 #define OCR1AH1 1
650 #define OCR1AH2 2
651 #define OCR1AH3 3
652 #define OCR1AH4 4
653 #define OCR1AH5 5
654 #define OCR1AH6 6
655 #define OCR1AH7 7
656 
657 #define OCR1B _SFR_MEM16(0x8A)
658 
659 #define OCR1BL _SFR_MEM8(0x8A)
660 #define OCR1BL0 0
661 #define OCR1BL1 1
662 #define OCR1BL2 2
663 #define OCR1BL3 3
664 #define OCR1BL4 4
665 #define OCR1BL5 5
666 #define OCR1BL6 6
667 #define OCR1BL7 7
668 
669 #define OCR1BH _SFR_MEM8(0x8B)
670 #define OCR1BH0 0
671 #define OCR1BH1 1
672 #define OCR1BH2 2
673 #define OCR1BH3 3
674 #define OCR1BH4 4
675 #define OCR1BH5 5
676 #define OCR1BH6 6
677 #define OCR1BH7 7
678 
679 #define TCCR2A _SFR_MEM8(0xB0)
680 #define WGM20 0
681 #define WGM21 1
682 #define COM2B0 4
683 #define COM2B1 5
684 #define COM2A0 6
685 #define COM2A1 7
686 
687 #define TCCR2B _SFR_MEM8(0xB1)
688 #define CS20 0
689 #define CS21 1
690 #define CS22 2
691 #define WGM22 3
692 #define FOC2B 6
693 #define FOC2A 7
694 
695 #define TCNT2 _SFR_MEM8(0xB2)
696 #define TCNT2_0 0
697 #define TCNT2_1 1
698 #define TCNT2_2 2
699 #define TCNT2_3 3
700 #define TCNT2_4 4
701 #define TCNT2_5 5
702 #define TCNT2_6 6
703 #define TCNT2_7 7
704 
705 #define OCR2A _SFR_MEM8(0xB3)
706 #define OCR2A_0 0
707 #define OCR2A_1 1
708 #define OCR2A_2 2
709 #define OCR2A_3 3
710 #define OCR2A_4 4
711 #define OCR2A_5 5
712 #define OCR2A_6 6
713 #define OCR2A_7 7
714 
715 #define OCR2B _SFR_MEM8(0xB4)
716 #define OCR2B_0 0
717 #define OCR2B_1 1
718 #define OCR2B_2 2
719 #define OCR2B_3 3
720 #define OCR2B_4 4
721 #define OCR2B_5 5
722 #define OCR2B_6 6
723 #define OCR2B_7 7
724 
725 #define ASSR _SFR_MEM8(0xB6)
726 #define TCR2BUB 0
727 #define TCR2AUB 1
728 #define OCR2BUB 2
729 #define OCR2AUB 3
730 #define TCN2UB 4
731 #define AS2 5
732 #define EXCLK 6
733 
734 #define TWBR _SFR_MEM8(0xB8)
735 #define TWBR0 0
736 #define TWBR1 1
737 #define TWBR2 2
738 #define TWBR3 3
739 #define TWBR4 4
740 #define TWBR5 5
741 #define TWBR6 6
742 #define TWBR7 7
743 
744 #define TWSR _SFR_MEM8(0xB9)
745 #define TWPS0 0
746 #define TWPS1 1
747 #define TWS3 3
748 #define TWS4 4
749 #define TWS5 5
750 #define TWS6 6
751 #define TWS7 7
752 
753 #define TWAR _SFR_MEM8(0xBA)
754 #define TWGCE 0
755 #define TWA0 1
756 #define TWA1 2
757 #define TWA2 3
758 #define TWA3 4
759 #define TWA4 5
760 #define TWA5 6
761 #define TWA6 7
762 
763 #define TWDR _SFR_MEM8(0xBB)
764 #define TWD0 0
765 #define TWD1 1
766 #define TWD2 2
767 #define TWD3 3
768 #define TWD4 4
769 #define TWD5 5
770 #define TWD6 6
771 #define TWD7 7
772 
773 #define TWCR _SFR_MEM8(0xBC)
774 #define TWIE 0
775 #define TWEN 2
776 #define TWWC 3
777 #define TWSTO 4
778 #define TWSTA 5
779 #define TWEA 6
780 #define TWINT 7
781 
782 #define TWAMR _SFR_MEM8(0xBD)
783 #define TWAM0 1
784 #define TWAM1 2
785 #define TWAM2 3
786 #define TWAM3 4
787 #define TWAM4 5
788 #define TWAM5 6
789 #define TWAM6 7
790 
791 #define UCSR0A _SFR_MEM8(0xC0)
792 #define MPCM0 0
793 #define U2X0 1
794 #define UPE0 2
795 #define DOR0 3
796 #define FE0 4
797 #define UDRE0 5
798 #define TXC0 6
799 #define RXC0 7
800 
801 #define UCSR0B _SFR_MEM8(0xC1)
802 #define TXB80 0
803 #define RXB80 1
804 #define UCSZ02 2
805 #define TXEN0 3
806 #define RXEN0 4
807 #define UDRIE0 5
808 #define TXCIE0 6
809 #define RXCIE0 7
810 
811 #define UCSR0C _SFR_MEM8(0xC2)
812 #define UCPOL0 0
813 #define UCSZ00 1
814 #define UCSZ01 2
815 #define USBS0 3
816 #define UPM00 4
817 #define UPM01 5
818 #define UMSEL00 6
819 #define UMSEL01 7
820 
821 #define UBRR0 _SFR_MEM16(0xC4)
822 
823 #define UBRR0L _SFR_MEM8(0xC4)
824 #define _UBRR0 0
825 #define _UBRR1 1
826 #define UBRR2 2
827 #define UBRR3 3
828 #define UBRR4 4
829 #define UBRR5 5
830 #define UBRR6 6
831 #define UBRR7 7
832 
833 #define UBRR0H _SFR_MEM8(0xC5)
834 #define UBRR8 0
835 #define UBRR9 1
836 #define UBRR10 2
837 #define UBRR11 3
838 
839 #define UDR0 _SFR_MEM8(0xC6)
840 #define UDR0_0 0
841 #define UDR0_1 1
842 #define UDR0_2 2
843 #define UDR0_3 3
844 #define UDR0_4 4
845 #define UDR0_5 5
846 #define UDR0_6 6
847 #define UDR0_7 7
848 
849 #define UCSR1A _SFR_MEM8(0xC8)
850 #define MPCM1 0
851 #define U2X1 1
852 #define UPE1 2
853 #define DOR1 3
854 #define FE1 4
855 #define UDRE1 5
856 #define TXC1 6
857 #define RXC1 7
858 
859 #define UCSR1B _SFR_MEM8(0xC9)
860 #define TXB81 0
861 #define RXB81 1
862 #define UCSZ12 2
863 #define TXEN1 3
864 #define RXEN1 4
865 #define UDRIE1 5
866 #define TXCIE1 6
867 #define RXCIE1 7
868 
869 #define UCSR1C _SFR_MEM8(0xCA)
870 #define UCPOL1 0
871 #define UCSZ10 1
872 #define UCSZ11 2
873 #define USBS1 3
874 #define UPM10 4
875 #define UPM11 5
876 #define UMSEL10 6
877 #define UMSEL11 7
878 
879 #define UBRR1 _SFR_MEM16(0xCC)
880 
881 #define UBRR1L _SFR_MEM8(0xCC)
882 #define UBRR_0 0
883 #define UBRR_1 1
884 #define UBRR_2 2
885 #define UBRR_3 3
886 #define UBRR_4 4
887 #define UBRR_5 5
888 #define UBRR_6 6
889 #define UBRR_7 7
890 
891 #define UBRR1H _SFR_MEM8(0xCD)
892 #define UBRR_8 0
893 #define UBRR_9 1
894 #define UBRR_10 2
895 #define UBRR_11 3
896 
897 #define UDR1 _SFR_MEM8(0xCE)
898 #define UDR1_0 0
899 #define UDR1_1 1
900 #define UDR1_2 2
901 #define UDR1_3 3
902 #define UDR1_4 4
903 #define UDR1_5 5
904 #define UDR1_6 6
905 #define UDR1_7 7
906 
907 
908 /* Interrupt vectors */
909 /* Vector 0 is the reset vector */
910 #define INT0_vect_num 1
911 #define INT0_vect _VECTOR(1) /* External Interrupt Request 0 */
912 #define INT1_vect_num 2
913 #define INT1_vect _VECTOR(2) /* External Interrupt Request 1 */
914 #define INT2_vect_num 3
915 #define INT2_vect _VECTOR(3) /* External Interrupt Request 2 */
916 #define PCINT0_vect_num 4
917 #define PCINT0_vect _VECTOR(4) /* Pin Change Interrupt Request 0 */
918 #define PCINT1_vect_num 5
919 #define PCINT1_vect _VECTOR(5) /* Pin Change Interrupt Request 1 */
920 #define PCINT2_vect_num 6
921 #define PCINT2_vect _VECTOR(6) /* Pin Change Interrupt Request 2 */
922 #define PCINT3_vect_num 7
923 #define PCINT3_vect _VECTOR(7) /* Pin Change Interrupt Request 3 */
924 #define WDT_vect_num 8
925 #define WDT_vect _VECTOR(8) /* Watchdog Time-out Interrupt */
926 #define TIMER2_COMPA_vect_num 9
927 #define TIMER2_COMPA_vect _VECTOR(9) /* Timer/Counter2 Compare Match A */
928 #define TIMER2_COMPB_vect_num 10
929 #define TIMER2_COMPB_vect _VECTOR(10) /* Timer/Counter2 Compare Match B */
930 #define TIMER2_OVF_vect_num 11
931 #define TIMER2_OVF_vect _VECTOR(11) /* Timer/Counter2 Overflow */
932 #define TIMER1_CAPT_vect_num 12
933 #define TIMER1_CAPT_vect _VECTOR(12) /* Timer/Counter1 Capture Event */
934 #define TIMER1_COMPA_vect_num 13
935 #define TIMER1_COMPA_vect _VECTOR(13) /* Timer/Counter1 Compare Match A */
936 #define TIMER1_COMPB_vect_num 14
937 #define TIMER1_COMPB_vect _VECTOR(14) /* Timer/Counter1 Compare Match B */
938 #define TIMER1_OVF_vect_num 15
939 #define TIMER1_OVF_vect _VECTOR(15) /* Timer/Counter1 Overflow */
940 #define TIMER0_COMPA_vect_num 16
941 #define TIMER0_COMPA_vect _VECTOR(16) /* Timer/Counter0 Compare Match A */
942 #define TIMER0_COMPB_vect_num 17
943 #define TIMER0_COMPB_vect _VECTOR(17) /* Timer/Counter0 Compare Match B */
944 #define TIMER0_OVF_vect_num 18
945 #define TIMER0_OVF_vect _VECTOR(18) /* Timer/Counter0 Overflow */
946 #define SPI_STC_vect_num 19
947 #define SPI_STC_vect _VECTOR(19) /* SPI Serial Transfer Complete */
948 #define USART0_RX_vect_num 20
949 #define USART0_RX_vect _VECTOR(20) /* USART0, Rx Complete */
950 #define USART0_UDRE_vect_num 21
951 #define USART0_UDRE_vect _VECTOR(21) /* USART0 Data register Empty */
952 #define USART0_TX_vect_num 22
953 #define USART0_TX_vect _VECTOR(22) /* USART0, Tx Complete */
954 #define ANALOG_COMP_vect_num 23
955 #define ANALOG_COMP_vect _VECTOR(23) /* Analog Comparator */
956 #define ADC_vect_num 24
957 #define ADC_vect _VECTOR(24) /* ADC Conversion Complete */
958 #define EE_READY_vect_num 25
959 #define EE_READY_vect _VECTOR(25) /* EEPROM Ready */
960 #define TWI_vect_num 26
961 #define TWI_vect _VECTOR(26) /* 2-wire Serial Interface */
962 #define SPM_READY_vect_num 27
963 #define SPM_READY_vect _VECTOR(27) /* Store Program Memory Read */
964 #define USART1_RX_vect_num 28
965 #define USART1_RX_vect _VECTOR(28) /* USART1 RX complete */
966 #define USART1_UDRE_vect_num 29
967 #define USART1_UDRE_vect _VECTOR(29) /* USART1 Data Register Empty */
968 #define USART1_TX_vect_num 30
969 #define USART1_TX_vect _VECTOR(30) /* USART1 TX complete */
970 
971 #define _VECTOR_SIZE 4 /* Size of individual vector. */
972 #define _VECTORS_SIZE (31 * _VECTOR_SIZE)
973 
974 
975 /* Constants */
976 #define SPM_PAGESIZE (128)
977 #define RAMSTART (0x100)
978 #define RAMSIZE (2048)
979 #define RAMEND (RAMSTART + RAMSIZE - 1)
980 #define XRAMSTART (0x0)
981 #define XRAMSIZE (0)
982 #define XRAMEND (RAMEND)
983 #define E2END (0x3FF)
984 #define E2PAGESIZE (4)
985 #define FLASHEND (0x7FFF)
986 
987 
988 /* Fuses */
989 #define FUSE_MEMORY_SIZE 3
990 
991 /* Low Fuse Byte */
992 #define FUSE_CKSEL0 (unsigned char)~_BV(0) /* Select Clock Source */
993 #define FUSE_CKSEL1 (unsigned char)~_BV(1) /* Select Clock Source */
994 #define FUSE_CKSEL2 (unsigned char)~_BV(2) /* Select Clock Source */
995 #define FUSE_CKSEL3 (unsigned char)~_BV(3) /* Select Clock Source */
996 #define FUSE_SUT0 (unsigned char)~_BV(4) /* Select start-up time */
997 #define FUSE_SUT1 (unsigned char)~_BV(5) /* Select start-up time */
998 #define FUSE_CKOUT (unsigned char)~_BV(6) /* Clock output */
999 #define FUSE_CKDIV8 (unsigned char)~_BV(7) /* Divide clock by 8 */
1000 #define LFUSE_DEFAULT (FUSE_CKDIV8 & FUSE_SUT1 & FUSE_SUT0 & FUSE_CKSEL3 & FUSE_CKSEL2 & FUSE_CKSEL0)
1001 
1002 /* High Fuse Byte */
1003 #define FUSE_BOOTRST (unsigned char)~_BV(0) /* Select Reset Vector */
1004 #define FUSE_BOOTSZ0 (unsigned char)~_BV(1) /* Select Boot Size */
1005 #define FUSE_BOOTSZ1 (unsigned char)~_BV(2) /* Select Boot Size */
1006 #define FUSE_EESAVE (unsigned char)~_BV(3) /* EEPROM memory is preserved through chip erase */
1007 #define FUSE_WDTON (unsigned char)~_BV(4) /* Watchdog timer always on */
1008 #define FUSE_SPIEN (unsigned char)~_BV(5) /* Enable Serial programming and Data Downloading */
1009 #define FUSE_JTAGEN (unsigned char)~_BV(6) /* Enable JTAG */
1010 #define FUSE_OCDEN (unsigned char)~_BV(7) /* Enable OCD */
1011 #define HFUSE_DEFAULT (FUSE_JTAGEN & FUSE_SPIEN & FUSE_BOOTSZ1 & FUSE_BOOTSZ0)
1012 
1013 /* Extended Fuse Byte */
1014 #define FUSE_BODLEVEL0 (unsigned char)~_BV(0) /* Brown-out Detector trigger level */
1015 #define FUSE_BODLEVEL1 (unsigned char)~_BV(1) /* Brown-out Detector trigger level */
1016 #define FUSE_BODLEVEL2 (unsigned char)~_BV(2) /* Brown-out Detector trigger level */
1017 #define EFUSE_DEFAULT (0xFF)
1018 
1019 
1020 /* Lock Bits */
1021 #define __LOCK_BITS_EXIST
1022 #define __BOOT_LOCK_BITS_0_EXIST
1023 #define __BOOT_LOCK_BITS_1_EXIST
1024 
1025 
1026 /* Signature */
1027 #define SIGNATURE_0 0x1E
1028 #define SIGNATURE_1 0x95
1029 #define SIGNATURE_2 0x11
1030 
1031 
1032 /* Device Pin Definitions */
1033 #define MOSI_DDR DDRB
1034 #define MOSI_PORT PORTB
1035 #define MOSI_PIN PINB
1036 #define MOSI_BIT 5
1037 
1038 #define PCINT13_DDR DDRB
1039 #define PCINT13_PORT PORTB
1040 #define PCINT13_PIN PINB
1041 #define PCINT13_BIT 5
1042 
1043 #define MISO_DDR DDRB
1044 #define MISO_PORT PORTB
1045 #define MISO_PIN PINB
1046 #define MISO_BIT 6
1047 
1048 #define PCINT14_DDR DDRB
1049 #define PCINT14_PORT PORTB
1050 #define PCINT14_PIN PINB
1051 #define PCINT14_BIT 6
1052 
1053 #define SCK_DDR DDRB
1054 #define SCK_PORT PORTB
1055 #define SCK_PIN PINB
1056 #define SCK_BIT 7
1057 
1058 #define PCINT15_DDR DDRB
1059 #define PCINT15_PORT PORTB
1060 #define PCINT15_PIN PINB
1061 #define PCINT15_BIT 7
1062 
1063 #define RXD_DDR DDRD
1064 #define RXD_PORT PORTD
1065 #define RXD_PIN PIND
1066 #define RXD_BIT 0
1067 
1068 #define PCINT24_DDR DDRD
1069 #define PCINT24_PORT PORTD
1070 #define PCINT24_PIN PIND
1071 #define PCINT24_BIT 0
1072 
1073 #define TXD_DDR DDRD
1074 #define TXD_PORT PORTD
1075 #define TXD_PIN PIND
1076 #define TXD_BIT 1
1077 
1078 #define PCINT25_DDR DDRD
1079 #define PCINT25_PORT PORTD
1080 #define PCINT25_PIN PIND
1081 #define PCINT25_BIT 1
1082 
1083 #define INT0_DDR DDRD
1084 #define INT0_PORT PORTD
1085 #define INT0_PIN PIND
1086 #define INT0_BIT 2
1087 
1088 #define PCINT26_DDR DDRD
1089 #define PCINT26_PORT PORTD
1090 #define PCINT26_PIN PIND
1091 #define PCINT26_BIT 2
1092 
1093 #define INT1_DDR DDRD
1094 #define INT1_PORT PORTD
1095 #define INT1_PIN PIND
1096 #define INT1_BIT 3
1097 
1098 #define PCINT27_DDR DDRD
1099 #define PCINT27_PORT PORTD
1100 #define PCINT27_PIN PIND
1101 #define PCINT27_BIT 3
1102 
1103 #define OC1B_DDR DDRD
1104 #define OC1B_PORT PORTD
1105 #define OC1B_PIN PIND
1106 #define OC1B_BIT 4
1107 
1108 #define PCINT28_DDR DDRD
1109 #define PCINT28_PORT PORTD
1110 #define PCINT28_PIN PIND
1111 #define PCINT28_BIT 4
1112 
1113 #define OC1A_DDR DDRD
1114 #define OC1A_PORT PORTD
1115 #define OC1A_PIN PIND
1116 #define OC1A_BIT 5
1117 
1118 #define PCINT29_DDR DDRD
1119 #define PCINT29_PORT PORTD
1120 #define PCINT29_PIN PIND
1121 #define PCINT29_BIT 5
1122 
1123 #define ICP_DDR DDRD
1124 #define ICP_PORT PORTD
1125 #define ICP_PIN PIND
1126 #define ICP_BIT 6
1127 
1128 #define OC2B_DDR DDRD
1129 #define OC2B_PORT PORTD
1130 #define OC2B_PIN PIND
1131 #define OC2B_BIT 6
1132 
1133 #define PCINT30_DDR DDRD
1134 #define PCINT30_PORT PORTD
1135 #define PCINT30_PIN PIND
1136 #define PCINT30_BIT 6
1137 
1138 #define OC2A_DDR DDRD
1139 #define OC2A_PORT PORTD
1140 #define OC2A_PIN PIND
1141 #define OC2A_BIT 7
1142 
1143 #define PCINT31_DDR DDRD
1144 #define PCINT31_PORT PORTD
1145 #define PCINT31_PIN PIND
1146 #define PCINT31_BIT 7
1147 
1148 #define SCL_DDR DDRC
1149 #define SCL_PORT PORTC
1150 #define SCL_PIN PINC
1151 #define SCL_BIT 0
1152 
1153 #define PCINT16_DDR DDRC
1154 #define PCINT16_PORT PORTC
1155 #define PCINT16_PIN PINC
1156 #define PCINT16_BIT 0
1157 
1158 #define SDA_DDR DDRC
1159 #define SDA_PORT PORTC
1160 #define SDA_PIN PINC
1161 #define SDA_BIT 1
1162 
1163 #define PCINT17_DDR DDRC
1164 #define PCINT17_PORT PORTC
1165 #define PCINT17_PIN PINC
1166 #define PCINT17_BIT 1
1167 
1168 #define PCINT18_DDR DDRC
1169 #define PCINT18_PORT PORTC
1170 #define PCINT18_PIN PINC
1171 #define PCINT18_BIT 2
1172 
1173 #define PCINT19_DDR DDRC
1174 #define PCINT19_PORT PORTC
1175 #define PCINT19_PIN PINC
1176 #define PCINT19_BIT 3
1177 
1178 #define PCINT20_DDR DDRC
1179 #define PCINT20_PORT PORTC
1180 #define PCINT20_PIN PINC
1181 #define PCINT20_BIT 4
1182 
1183 #define PCINT21_DDR DDRC
1184 #define PCINT21_PORT PORTC
1185 #define PCINT21_PIN PINC
1186 #define PCINT21_BIT 5
1187 
1188 #define PCINT22_DDR DDRC
1189 #define PCINT22_PORT PORTC
1190 #define PCINT22_PIN PINC
1191 #define PCINT22_BIT 6
1192 
1193 #define PCINT23_DDR DDRC
1194 #define PCINT23_PORT PORTC
1195 #define PCINT23_PIN PINC
1196 #define PCINT23_BIT 7
1197 
1198 #define ADC7_DDR DDRA
1199 #define ADC7_PORT PORTA
1200 #define ADC7_PIN PINA
1201 #define ADC7_BIT 7
1202 
1203 #define PCINT7_DDR DDRA
1204 #define PCINT7_PORT PORTA
1205 #define PCINT7_PIN PINA
1206 #define PCINT7_BIT 7
1207 
1208 #define ADC6_DDR DDRA
1209 #define ADC6_PORT PORTA
1210 #define ADC6_PIN PINA
1211 #define ADC6_BIT 6
1212 
1213 #define PCINT6_DDR DDRA
1214 #define PCINT6_PORT PORTA
1215 #define PCINT6_PIN PINA
1216 #define PCINT6_BIT 6
1217 
1218 #define ADC5_DDR DDRA
1219 #define ADC5_PORT PORTA
1220 #define ADC5_PIN PINA
1221 #define ADC5_BIT 5
1222 
1223 #define PCINT5_DDR DDRA
1224 #define PCINT5_PORT PORTA
1225 #define PCINT5_PIN PINA
1226 #define PCINT5_BIT 5
1227 
1228 #define ADC4_DDR DDRA
1229 #define ADC4_PORT PORTA
1230 #define ADC4_PIN PINA
1231 #define ADC4_BIT 4
1232 
1233 #define PCINT4_DDR DDRA
1234 #define PCINT4_PORT PORTA
1235 #define PCINT4_PIN PINA
1236 #define PCINT4_BIT 4
1237 
1238 #define ADC3_DDR DDRA
1239 #define ADC3_PORT PORTA
1240 #define ADC3_PIN PINA
1241 #define ADC3_BIT 3
1242 
1243 #define PCINT3_DDR DDRA
1244 #define PCINT3_PORT PORTA
1245 #define PCINT3_PIN PINA
1246 #define PCINT3_BIT 3
1247 
1248 #define ADC2_DDR DDRA
1249 #define ADC2_PORT PORTA
1250 #define ADC2_PIN PINA
1251 #define ADC2_BIT 2
1252 
1253 #define PCINT2_DDR DDRA
1254 #define PCINT2_PORT PORTA
1255 #define PCINT2_PIN PINA
1256 #define PCINT2_BIT 2
1257 
1258 #define ADC1_DDR DDRA
1259 #define ADC1_PORT PORTA
1260 #define ADC1_PIN PINA
1261 #define ADC1_BIT 1
1262 
1263 #define PCINT1_DDR DDRA
1264 #define PCINT1_PORT PORTA
1265 #define PCINT1_PIN PINA
1266 #define PCINT1_BIT 1
1267 
1268 #define ADC0_DDR DDRA
1269 #define ADC0_PORT PORTA
1270 #define ADC0_PIN PINA
1271 #define ADC0_BIT 0
1272 
1273 #define PCINT0_DDR DDRA
1274 #define PCINT0_PORT PORTA
1275 #define PCINT0_PIN PINA
1276 #define PCINT0_BIT 0
1277 
1278 #define XCK_DDR DDRB
1279 #define XCK_PORT PORTB
1280 #define XCK_PIN PINB
1281 #define XCK_BIT 0
1282 
1283 #define T0_DDR DDRB
1284 #define T0_PORT PORTB
1285 #define T0_PIN PINB
1286 #define T0_BIT 0
1287 
1288 #define PCINT8_DDR DDRB
1289 #define PCINT8_PORT PORTB
1290 #define PCINT8_PIN PINB
1291 #define PCINT8_BIT 0
1292 
1293 #define T1_DDR DDRB
1294 #define T1_PORT PORTB
1295 #define T1_PIN PINB
1296 #define T1_BIT 1
1297 
1298 #define CLKO_DDR DDRB
1299 #define CLKO_PORT PORTB
1300 #define CLKO_PIN PINB
1301 #define CLKO_BIT 1
1302 
1303 #define PCINT9_DDR DDRB
1304 #define PCINT9_PORT PORTB
1305 #define PCINT9_PIN PINB
1306 #define PCINT9_BIT 1
1307 
1308 #define AIN0_DDR DDRB
1309 #define AIN0_PORT PORTB
1310 #define AIN0_PIN PINB
1311 #define AIN0_BIT 2
1312 
1313 #define INT2_DDR DDRB
1314 #define INT2_PORT PORTB
1315 #define INT2_PIN PINB
1316 #define INT2_BIT 2
1317 
1318 #define PCINT10_DDR DDRB
1319 #define PCINT10_PORT PORTB
1320 #define PCINT10_PIN PINB
1321 #define PCINT10_BIT 2
1322 
1323 #define AIN1_DDR DDRB
1324 #define AIN1_PORT PORTB
1325 #define AIN1_PIN PINB
1326 #define AIN1_BIT 3
1327 
1328 #define OC0A_DDR DDRB
1329 #define OC0A_PORT PORTB
1330 #define OC0A_PIN PINB
1331 #define OC0A_BIT 3
1332 
1333 #define PCINT11_DDR DDRB
1334 #define PCINT11_PORT PORTB
1335 #define PCINT11_PIN PINB
1336 #define PCINT11_BIT 3
1337 
1338 #define SS_DDR DDRB
1339 #define SS_PORT PORTB
1340 #define SS_PIN PINB
1341 #define SS_BIT 4
1342 
1343 #define OC0B_DDR DDRB
1344 #define OC0B_PORT PORTB
1345 #define OC0B_PIN PINB
1346 #define OC0B_BIT 4
1347 
1348 #define PCINT12_DDR DDRB
1349 #define PCINT12_PORT PORTB
1350 #define PCINT12_PIN PINB
1351 #define PCINT12_BIT 4
1352 
1353 #endif /* _AVR_ATmega324PA_H_ */
1354