single register definition file - V1.0.1
[fw/sdcc] / device / include / mcs51reg.h
1 /*-------------------------------------------------------------------------
2    Register Declarations for the mcs51 compatible microcontrollers
3
4    Written By -  Bela Torok / bela.torok@kssg.ch (November 2000)
5
6    This program is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by the
8    Free Software Foundation; either version 2, or (at your option) any
9    later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20    In other words, you are welcome to use, share and improve this program.
21    You are forbidden to forbid anyone else to use, share and improve
22    what you give them.   Help stamp out software-hoarding!
23
24
25    History:
26    --------
27    Version 1.0 Nov 2, 2000 - B. Torok  / bela.torok@kssg.ch
28    Initial release, supported microcontrollers:
29    8051, 8052, Atmel AT89C1051, AT89C2051, AT89C4051,
30    Siemens SAB80515, SAB80535, SAB80515A
31
32    Version 1.0.1
33    SAB80515A definitions revised by Michael Schmitt / michael.schmitt@t-online.de
34
35    Adding support for additional microcontrollers:
36    -----------------------------------------------
37
38    1. Make an entry with the inventory of the register set of
39       the microcontroller in the  "Describe microcontrollers" section.
40
41    2. If necessary add/modify entry(s) in the "Register definitions" section
42
43    3. If necessary add/modify entry(s) in the "Interrupt vectors" section
44
45    4. Make a step-by-step protocol of your modifications
46
47    5. Send the protocol and the modified file to me ( bela.torok@kssg.ch ).
48       I'm going to compile/verify changes made by different authors.
49
50
51    Microcontroller support:
52
53    Use one of the following options:
54
55    1. use #include <mcs51reg.h> in your program & define REG_XXXXXX in your makefile.
56
57    2. use following definitions prior the
58       #include <mcs51reg.h> line in your program:
59       e.g.:
60       #define REG_8052_H       -> 8052 type microcontroller
61       or
62       #define REG_AT89CX051_H  -> Atmel AT89C1051, AT89C2051 and AT89C4051 microcontrollers
63
64
65    Use only one of the following definitions!!!
66
67    Supported Microcontrollers:
68
69    No definition      8051
70    REG_8051_H         8051
71    REG_8052_H         8052
72    REG_AT89CX051_H    Atmel AT89C1051, AT89C2051 and AT89C4051
73    REG_SAB80515_H     Siemens SAB80515 & SAB80535
74    REG_SAB80515A_H    Siemens SAB80515A
75
76 -----------------------------------------------------------------------*/
77
78
79 #ifndef HEADER_MCS51REG
80 #define HEADER_MCS51REG
81
82 //////////////////////////////////
83 ///  Describe microcontrollers ///
84 ///  (inventory of registers)  ///
85 //////////////////////////////////
86
87 // definitions for the 8051
88 #ifdef REG_8051_H
89 #ifdef MICROCONTROLLER_DEFINED
90 #define MCS51REG_ERROR
91 #endif
92 #ifndef MICROCONTROLLER_DEFINED
93 #define MICROCONTROLLER_DEFINED
94 #endif
95 #warning Selected HW: 8051
96
97 #define P0
98 #define SP
99 #define DPL
100 #define DPH
101 #define PCON
102 #define TCON
103 #define TMOD
104 #define TL0
105 #define TL1
106 #define TH0
107 #define TH1
108 #define P1
109 #define SCON
110 #define SBUF
111 #define P2
112 #define IE
113 #define P3
114 #define IP
115 #define PSW
116 #define ACC
117 #define B
118
119 #endif
120 // end of definitions for the 8051
121
122
123 // definitions for the 8052 microcontroller
124 #ifdef REG_8052_H
125 #ifdef MICROCONTROLLER_DEFINED
126 #define MCS51REG_ERROR
127 #endif
128 #ifndef MICROCONTROLLER_DEFINED
129 #define MICROCONTROLLER_DEFINED
130 #endif
131 #warning Selected HW: 8052
132
133 // 8051 register set
134 #define P0
135 #define SP
136 #define DPL
137 #define DPH
138 #define PCON
139 #define TCON
140 #define TMOD
141 #define TL0
142 #define TL1
143 #define TH0
144 #define TH1
145 #define P1
146 #define SCON
147 #define SBUF
148 #define P2
149 #define IE
150 #define P3
151 #define IP
152 #define PSW
153 #define ACC
154 #define B
155
156 // 8052 specific registers
157 #define T2CON
158 #define RCAP2L
159 #define RCAP2H
160 #define TL2
161 #define TH2
162
163 #endif
164 // end of definitions for the 8052 microcontroller
165
166 // definitionsons for the Atmel
167 // AT89C1051, AT89C2051 and AT89C4051 microcontrollers
168 #ifdef REG_AT89CX051_H
169 #ifdef MICROCONTROLLER_DEFINED
170 #define MCS51REG_ERROR
171 #endif
172 #ifndef MICROCONTROLLER_DEFINED
173 #define MICROCONTROLLER_DEFINED
174 #endif
175 #warning Selected HW: Atmel AT89Cx051
176
177 // 8051 register set without P0 & P2
178 #define SP
179 #define DPL
180 #define DPH
181 #define PCON
182 #define TCON
183 #define TMOD
184 #define TL0
185 #define TL1
186 #define TH0
187 #define TH1
188 #define P1
189 #define SCON
190 #define SBUF
191 #define IE
192 #define P3
193 #define IP
194 #define PSW
195 #define ACC
196 #define B
197
198 #endif
199 // end of definitionsons for the Atmel
200 // AT89C1051, AT89C2051 and AT89C4051 microcontrollers
201
202 // definitions for the Siemens SAB80515 & SAB80535
203 #ifdef REG_SAB80515_H
204 #ifdef MICROCONTROLLER_DEFINED
205 #define MCS51REG_ERROR
206 #endif
207 #ifndef MICROCONTROLLER_DEFINED
208 #define MICROCONTROLLER_DEFINED
209 #endif
210 #warning Selected HW: Siemens SAB80515 & SAB80535
211
212 // 8051 register set without IE, IP & PCON
213 #define P0
214 #define SP
215 #define DPL
216 #define DPH
217 #define PCON
218 #define TCON
219 #define TMOD
220 #define TL0
221 #define TL1
222 #define TH0
223 #define TH1
224 #define P1
225 #define SCON
226 #define SBUF
227 #define P2
228 #define P3
229 #define PSW
230 #define ACC
231 #define B
232
233 // SAB80515 specific registers
234 #define IE_SAB80515_FAMILY
235 #define IP0         ; // interrupt priority register - SAB80515 specific
236 #define IEN1        ; // interrupt enable register - SAB80515 specific
237 #define IRCON       ; // interrupt control register - SAB80515 specific
238 #define CCEN        ; // compare/capture enable register
239 #define CCL1        ; // compare/capture register 1, low byte
240 #define CCH1        ; // compare/capture register 1, high byte
241 #define CCL2        ; // compare/capture register 2, low byte
242 #define CCH2        ; // compare/capture register 2, high byte
243 #define CCL3        ; // compare/capture register 3, low byte
244 #define CCH3        ; // compare/capture register 3, high byte
245 #define T2CON       ;
246 #define CRCL        ; // compare/reload/capture register, low byte
247 #define CRCH        ; // compare/reload/capture register, high byte
248 #define TL2         ;
249 #define TH2         ;
250 #define ADCON       ; // A/D-converter control register
251 #define ADDAT       ; // A/D-converter data register
252 #define DAPR        ; // D/A-converter program register
253 #define P4          ; // Port 4 - SAB80515 specific
254 #define P5          ; // Port 5 - SAB80515 specific
255 #define PCON_SAB80515 ; // PCON of the SAB80515
256
257 #endif
258 // end of definitions for the Siemens SAB80515
259
260 // definitions for the Siemens SAB80515A
261 #ifdef REG_SAB80515A_H
262 #ifdef MICROCONTROLLER_DEFINED
263 #define MCS51REG_ERROR
264 #endif
265 #ifndef MICROCONTROLLER_DEFINED
266 #define MICROCONTROLLER_DEFINED
267 #endif
268 #warning Selected HW: Siemens SAB80515A
269
270 // 8051 register set without IE, IP & PCON
271 #define P0
272 #define SP
273 #define DPL
274 #define DPH
275 #define TCON
276 #define TMOD
277 #define TL0
278 #define TL1
279 #define TH0
280 #define TH1
281 #define P1
282 #define SCON
283 #define SBUF
284 #define P2
285 #define P3
286 #define PSW
287 #define ACC
288 #define B
289
290 // SAB80515A specific registers
291 #define IE_SAB80515_FAMILY
292 #define IP0         ; // interrupt priority register - SAB80515 specific
293 #define IP1         ; // interrupt priority register - SAB80515 specific
294 #define IEN1        ; // interrupt enable register - SAB80515 specific
295 #define IRCON       ; // interrupt control register - SAB80515 specific
296 #define CCEN        ; // compare/capture enable register
297 #define CCL1        ; // compare/capture register 1, low byte
298 #define CCH1        ; // compare/capture register 1, high byte
299 #define CCL2        ; // compare/capture register 2, low byte
300 #define CCH2        ; // compare/capture register 2, high byte
301 #define CCL3        ; // compare/capture register 3, low byte
302 #define CCH3        ; // compare/capture register 3, high byte
303 #define T2CON       ;
304 #define CRCL        ; // compare/reload/capture register, low byte
305 #define CRCH        ; // compare/reload/capture register, high byte
306 #define TL2         ;
307 #define TH2
308 #define ADCON0      ; // A/D-converter control register 0
309 #define ADDATH      ; // A/D data high byte
310 #define ADDATL      ; // A/D data low byte
311 #define ADCON1      ; // A/D-converter control register 1
312 #define SRELL       ; // Baudrate generator reload low
313 #define SYSCON      ; // XRAM Controller Access Control
314 #define SRELH       ; // Baudrate generator reload high
315 #define P4          ; // Port 4 - SAB80515 specific
316 #define P5          ; // Port 5 - SAB80515 specific
317 #define P6          ; // Port 6 - SAB80515 specific
318 #define PCON_SAB80515A ; // PCON of the SAB80515A
319 #define XPAGE       ; // Page Address Register for Extended On-Chip RAM
320
321 #endif
322 // end of definitions for the Siemens SAB80515A
323
324 /////////////////////////////////////////////////////////
325 ///  don't specify microcontrollers below this line!  ///
326 /////////////////////////////////////////////////////////
327
328 // default microcontroller -> 8051
329 // use default if no microcontroller specified
330 #ifndef MICROCONTROLLER_DEFINED
331 #define MICROCONTROLLER_DEFINED
332 #warning //////////////////////////////////
333 #warning // No microcontroller defined!  //
334 #warning //////////////////////////////////
335 #warning Code will be generated for the
336 #warning 8051 (default) microcontroller.
337 #warning If you have another microcontroller
338 #warning define it in the makefile, or in the
339 #warning "C" source prior
340 #warning the #include <mcs51reg.h> statement.
341 #warning If you use a non supported
342 #warning microcontroller, mcs51reg.h can be
343 #warning easily extended to support your HW.
344
345 // 8051 register set
346 #define P0
347 #define SP
348 #define DPL
349 #define DPH
350 #define PCON
351 #define TCON
352 #define TMOD
353 #define TL0
354 #define TL1
355 #define TH0
356 #define TH1
357 #define P1
358 #define SCON
359 #define SBUF
360 #define P2
361 #define IE
362 #define P3
363 #define IP
364 #define PSW
365 #define ACC
366 #define B
367
368 #endif
369 // end of definitions for the default microcontroller
370
371
372 #ifdef MCS51REG_ERROR
373 #error Two or more microcontrollers defined!
374 #endif
375
376 ////////////////////////////////
377 ///  Register definitions    ///
378 ///  (In alphabetical order) ///
379 ////////////////////////////////
380
381 #ifdef ACC
382 #undef ACC
383 sfr at 0xE0 ACC  ;
384 #endif
385
386 #ifdef ADCON
387 #undef ADCON
388 sfr at 0xD8 ADCON   ; // A/D-converter control register SAB80515 specific
389 // Bit registers
390 sbit at 0xD8 MX0        ;
391 sbit at 0xD9 MX1        ;
392 sbit at 0xDA MX2        ;
393 sbit at 0xDB ADM        ;
394 sbit at 0xDC BSY        ;
395 sbit at 0xDE CLK        ;
396 sbit at 0xDF BD         ;
397 #endif
398
399 /* ADCON0 ... Siemens also called this register ADCON in the User Manual */
400 #ifdef ADCON0
401 #undef ADCON0
402 sfr at 0xD8 ADCON0      ; // A/D-converter control register 0 SAB80515A specific
403 // Bit registers
404 sbit at 0xD8 MX0        ;
405 sbit at 0xD9 MX1        ;
406 sbit at 0xDA MX2        ;
407 sbit at 0xDB ADM        ;
408 sbit at 0xDC BSY        ;
409 sbit at 0xDD ADEX       ;
410 sbit at 0xDE CLK        ;
411 sbit at 0xDF BD         ;
412 // Not directly accessible ADCON0
413 #define ADCON0_MX0              0x01
414 #define ADCON0_MX1              0x02
415 #define ADCON0_MX2              0x04
416 #define ADCON0_ADM              0x08
417 #define ADCON0_BSY              0x10
418 #define ADCON0_ADEX             0x20
419 #define ADCON0_CLK              0x40
420 #define ADCON0_BD               0x80
421 #endif
422
423 #ifdef ADDAT
424 #undef ADDAT
425 sfr at 0xD9 ADDAT   ; // A/D-converter data register SAB80515 specific
426 #endif
427
428 #ifdef ADDATH
429 #undef ADDATH
430 sfr at 0xD9 ADDATH      ; // A/D data high byte SAB80515A specific
431 #endif
432
433 #ifdef ADDATL
434 #undef ADDATL
435 sfr at 0xDA ADDATL      ; // A/D data low byte SAB80515A specific
436 #endif
437
438 #ifdef ADCON1
439 #undef ADCON1
440 sfr at 0xDC ADCON1      ; // A/D-converter control register 1 SAB80515A specific
441 // Not directly accessible ADCON1
442 #define ADCON1_MX0              0x01
443 #define ADCON1_MX1              0x02
444 #define ADCON1_MX2              0x04
445 #define ADCON1_ADCL             0x80
446 #endif
447
448 #ifdef B
449 #undef B
450 sfr at 0xF0 B    ;
451 // Bit registers
452 sbit at 0xF0 BREG_F0        ;
453 sbit at 0xF1 BREG_F1        ;
454 sbit at 0xF2 BREG_F2        ;
455 sbit at 0xF3 BREG_F3        ;
456 sbit at 0xF4 BREG_F4        ;
457 sbit at 0xF5 BREG_F5        ;
458 sbit at 0xF6 BREG_F6        ;
459 sbit at 0xF7 BREG_F7        ;
460 #endif
461
462 #ifdef CCEN
463 #undef CCEN
464 sfr at 0xC1 CCEN        ; // compare/capture enable register SAB80515 specific
465 #endif
466
467 #ifdef CCH1
468 #undef CCH1
469 sfr at 0xC3 CCH1        ; // compare/capture register 1, high byte SAB80515 specific
470 #endif
471
472 #ifdef CCH2
473 #undef CCH2
474 sfr at 0xC5 CCH2        ; // compare/capture register 2, high byte SAB80515 specific
475 #endif
476
477 #ifdef CCH3
478 #undef CCH3
479 sfr at 0xC7 CCH3        ; // compare/capture register 3, high byte SAB80515 specific
480 #endif
481
482 #ifdef CCL1
483 #undef CCL1
484 sfr at 0xC2 CCL1        ; // compare/capture register 1, low byte SAB80515 specific
485 #endif
486
487 #ifdef CCL2
488 #undef CCL2
489 sfr at 0xC4 CCL2        ; // compare/capture register 2, low byte SAB80515 specific
490 #endif
491
492 #ifdef CCL3
493 #undef CCL3
494 sfr at 0xC6 CCL3        ; // compare/capture register 3, low byte SAB80515 specific
495 #endif
496
497 #ifdef CRCH
498 #undef CRCH
499 sfr at 0xCB CRCH    ; // compare/reload/capture register, high byte SAB80515 specific
500 #endif
501
502 #ifdef CRCL
503 #undef CRCL
504 sfr at 0xCA CRCL    ; // compare/reload/capture register, low byte SAB80515 specific
505 #endif
506
507 #ifdef DAPR
508 #undef DAPR
509 sfr at 0xD8 DAPR    ; // D/A-converter program register SAB80515 specific
510 #endif
511
512 #ifdef DPH
513 #undef DPH
514 sfr at 0x83 DPH  ;
515 #endif
516
517 #ifdef DPL
518 #undef DPL
519 sfr at 0x82 DPL  ;
520 #endif
521
522 #ifdef IE
523 #undef IE
524 sfr at 0xA8 IE   ;
525 // Bit registers
526 sbit at 0xA8 EX0  ;
527 sbit at 0xA9 ET0  ;
528 sbit at 0xAA EX1  ;
529 sbit at 0xAB ET1  ;
530 sbit at 0xAC ES   ;
531 sbit at 0xAF EA   ;
532 #ifdef REG_8052_H
533 sbit at 0xAD ET2  ; // Enable timer2 interrupt
534 #endif
535 #endif // IE
536
537 #ifdef IE_SAB80515_FAMILY
538 #undef IE_SAB80515_FAMILY
539 sfr at 0xA8 IE   ;
540 sfr at 0xA8 IEN0        ; // IE as called by Siemens
541 // Bit registers
542 sbit at 0xA8 EX0  ;
543 sbit at 0xA9 ET0  ;
544 sbit at 0xAA EX1  ;
545 sbit at 0xAB ET1  ;
546 sbit at 0xAC ES   ;
547 sbit at 0xAD ET2        ; // Enable timer 2 overflow SAB80515 specific
548 sbit at 0xAE WDT        ; // watchdog timer reset - SAB80515 specific
549 sbit at 0xAF EA   ;
550 sbit at 0xAF EAL        ; // EA as called by Siemens
551 #endif // IE_SAB80515_FAMILY
552
553 #ifdef IEN1
554 #undef IEN1
555 sfr at 0xB8 IEN1        ; // interrupt enable register - SAB80515 specific
556 // Bit registers
557 sbit at 0xB8 EADC       ; // A/D converter interrupt enable
558 sbit at 0xB9 EX2        ;
559 sbit at 0xBA EX3        ;
560 sbit at 0xBB EX4        ;
561 sbit at 0xBC EX5        ;
562 sbit at 0xBD EX6        ;
563 sbit at 0xBE SWDT       ; // watchdog timer start/reset
564 sbit at 0xBF EXEN2      ; // timer2 external reload interrupt enable
565 #endif
566
567 #ifdef IP
568 #undef IP
569 sfr at 0xB8 IP   ;
570 // Bit registers
571 sbit at 0xB8 PX0  ;
572 sbit at 0xB9 PT0  ;
573 sbit at 0xBA PX1  ;
574 sbit at 0xBB PT1  ;
575 sbit at 0xBC PS   ;
576 #endif
577
578 #ifdef IP0
579 #undef IP0
580 sfr at 0xA9 IP0         ; // interrupt priority register SAB80515 specific
581 // Not directly accessible IP1 bits
582 #define IP0_0    0x01
583 #define IP0_1    0x02
584 #define IP0_2    0x04
585 #define IP0_3    0x08
586 #define IP0_4    0x10
587 #define IP0_5    0x20
588 #define WDTS     0x40
589 #endif
590
591 #ifdef IP1
592 #undef IP1
593 sfr at 0xB9 IP1         ; // interrupt priority register SAB80515 specific
594 // Not directly accessible IP1 bits
595 #define IP1_0    0x01
596 #define IP1_1    0x02
597 #define IP1_2    0x04
598 #define IP1_3    0x08
599 #define IP1_4    0x10
600 #define IP1_5    0x20
601 #endif
602
603 #ifdef IRCON
604 #undef IRCON
605 sfr at 0xC0 IRCON       ; // interrupt control register - SAB80515 specific
606 // Bit registers
607 sbit at 0xC0 IADC       ; // A/D converter irq flag
608 sbit at 0xC1 IEX2       ; // external interrupt edge detect flag
609 sbit at 0xC2 IEX3       ;
610 sbit at 0xC3 IEX4       ;
611 sbit at 0xC4 IEX5       ;
612 sbit at 0xC5 IEX6       ;
613 sbit at 0xC6 TF2        ; // timer 2 owerflow flag
614 sbit at 0xC7 EXF2       ; // timer2 reload flag
615 #endif
616
617 #ifdef P0
618 #undef P0
619 sfr at 0x80 P0   ;
620 //  Bit Registers
621 sbit at 0x80 P0_0 ;
622 sbit at 0x81 P0_1 ;
623 sbit at 0x82 P0_2 ;
624 sbit at 0x83 P0_3 ;
625 sbit at 0x84 P0_4 ;
626 sbit at 0x85 P0_5 ;
627 sbit at 0x86 P0_6 ;
628 sbit at 0x87 P0_7 ;
629 #endif
630
631 #ifdef P1
632 #undef P1
633 sfr at 0x90 P1   ;
634 // Bit registers
635 sbit at 0x90 P1_0 ;
636 sbit at 0x91 P1_1 ;
637 sbit at 0x92 P1_2 ;
638 sbit at 0x93 P1_3 ;
639 sbit at 0x94 P1_4 ;
640 sbit at 0x95 P1_5 ;
641 sbit at 0x96 P1_6 ;
642 sbit at 0x97 P1_7 ;
643 #ifdef REG_SAB80515_H
644 sbit at 0x90 INT3_CC0   ; // P1 alternate functions - SAB80515 specific
645 sbit at 0x91 INT4_CC1   ;
646 sbit at 0x92 INT5_CC2   ;
647 sbit at 0x93 INT6_CC3   ;
648 sbit at 0x94 INT2       ;
649 sbit at 0x95 T2EX       ;
650 sbit at 0x96 CLKOUT     ;
651 sbit at 0x97 T2         ;
652 #endif
653 #ifdef REG_SAB80515A_H
654 sbit at 0x90 INT3_CC0   ; // P1 alternate functions - SAB80515 specific
655 sbit at 0x91 INT4_CC1   ;
656 sbit at 0x92 INT5_CC2   ;
657 sbit at 0x93 INT6_CC3   ;
658 sbit at 0x94 INT2       ;
659 sbit at 0x95 T2EX       ;
660 sbit at 0x96 CLKOUT     ;
661 sbit at 0x97 T2         ;
662 #endif
663 #endif
664
665 #ifdef P2
666 #undef P2
667 sfr at 0xA0 P2   ;
668 // Bit registers
669 sbit at 0xA0 P2_0 ;
670 sbit at 0xA1 P2_1 ;
671 sbit at 0xA2 P2_2 ;
672 sbit at 0xA3 P2_3 ;
673 sbit at 0xA4 P2_4 ;
674 sbit at 0xA5 P2_5 ;
675 sbit at 0xA6 P2_6 ;
676 sbit at 0xA7 P2_7 ;
677 #endif
678
679 #ifdef P3
680 #undef P3
681 sfr at 0xB0 P3   ;
682 // Bit registers
683 sbit at 0xB0 P3_0 ;
684 sbit at 0xB1 P3_1 ;
685 sbit at 0xB2 P3_2 ;
686 sbit at 0xB3 P3_3 ;
687 sbit at 0xB4 P3_4 ;
688 sbit at 0xB5 P3_5 ;
689 sbit at 0xB6 P3_6 ;
690 sbit at 0xB7 P3_7 ;
691 // alternate names
692 sbit at 0xB0 RXD  ;
693 sbit at 0xB1 TXD  ;
694 sbit at 0xB2 INT0 ;
695 sbit at 0xB3 INT1 ;
696 sbit at 0xB4 T0   ;
697 sbit at 0xB5 T1   ;
698 sbit at 0xB6 WR   ;
699 sbit at 0xB7 RD   ;
700 #endif
701
702 #ifdef P4
703 #undef P4
704 sfr at 0xE8 P4          ; // Port 4 - SAB80515 specific
705 // Bit registers
706 sbit at 0xE8 P4_0       ;
707 sbit at 0xE9 P4_1       ;
708 sbit at 0xEA P4_2       ;
709 sbit at 0xEB P4_3       ;
710 sbit at 0xEC P4_4       ;
711 sbit at 0xED P4_5       ;
712 sbit at 0xEE P4_6       ;
713 sbit at 0xEF P4_7       ;
714 #endif
715
716 #ifdef P5
717 #undef P5
718 sfr at 0xF8 P5          ; // Port 5 - SAB80515 specific
719 // Bit registers
720 sbit at 0xF8 P5_0       ;
721 sbit at 0xF9 P5_1       ;
722 sbit at 0xFA P5_2       ;
723 sbit at 0xFB P5_3       ;
724 sbit at 0xFC P5_4       ;
725 sbit at 0xFD P5_5       ;
726 sbit at 0xFE P5_6       ;
727 sbit at 0xFF P5_7       ;
728 #endif
729
730 #ifdef P6
731 #undef P6
732 sfr at 0xDB P6          ; // Port 6 - SAB80515 specific
733 #endif
734
735 #ifdef PCON
736 #undef PCON
737 sfr at 0x87 PCON ;
738 // Not directly accessible PCON bits
739 #define IDL             0x01
740 #define PD              0x02
741 #define GF0             0x04
742 #define GF1             0x08
743 #define SMOD            0x80
744 #endif
745
746 #ifdef PCON_SAB80515
747 #undef PCON_SAB80515
748 sfr at 0x87 PCON ;
749 // Not directly accessible PCON bits
750 #define SMOD            0x80
751 #endif
752
753 #ifdef PCON_SAB80515A
754 #undef PCON_SAB80515A
755 sfr at 0x87 PCON ;
756 // Not directly accessible PCON bits
757 #define IDL             0x01
758 #define IDLE            0x01  ; same as IDL
759 #define PD              0x02
760 #define PDE             0x02  ; same as PD
761 #define GF0             0x04
762 #define GF1             0x08
763 #define IDLS            0x20
764 #define PDS             0x40
765 #define SMOD            0x80
766 // alternate names
767 #define PCON_IDLE       0x01
768 #define PCON_PDE        0x02
769 #define PCON_GF0        0x04
770 #define PCON_GF1        0x08
771 #define PCON_IDLS       0x20
772 #define PCON_PDS        0x40
773 #define PCON_SMOD       0x80
774 #endif
775
776 #ifdef PSW
777 #undef PSW
778 sfr at 0xD0 PSW  ;
779 // Bit registers
780 sbit at 0xD0 P    ;
781 sbit at 0xD1 F1   ;
782 sbit at 0xD2 OV   ;
783 sbit at 0xD3 RS0  ;
784 sbit at 0xD4 RS1  ;
785 sbit at 0xD5 F0   ;
786 sbit at 0xD6 AC   ;
787 sbit at 0xD7 CY   ;
788 #endif
789
790 #ifdef RCAP2H
791 #undef RCAP2H
792 sfr at 0xCB RCAP2H  ;
793 #endif
794
795 #ifdef RCAP2L
796 #undef RCAP2L
797 sfr at 0xCA RCAP2L  ;
798 #endif
799
800 #ifdef SBUF
801 #undef SBUF
802 sfr at 0x99 SBUF ;
803 #endif
804
805 #ifdef SCON
806 #undef SCON
807 sfr at 0x98 SCON ;
808 // Bit registers
809 sbit at 0x98 RI   ;
810 sbit at 0x99 TI   ;
811 sbit at 0x9A RB8  ;
812 sbit at 0x9B TB8  ;
813 sbit at 0x9C REN  ;
814 sbit at 0x9D SM2  ;
815 sbit at 0x9E SM1  ;
816 sbit at 0x9F SM0  ;
817 #endif
818
819 #ifdef SP
820 #undef SP
821 sfr at 0x81 SP   ;
822 #endif
823
824 #ifdef SRELH
825 #undef SRELH
826 sfr at 0xBA SRELH       ; // Baudrate generator reload high
827 #endif
828
829 #ifdef SRELL
830 #undef SRELL
831 sfr at 0xAA SRELL       ; // Baudrate generator reload low
832 #endif
833
834 #ifdef SYSCON
835 #undef SYSCON
836 sfr at 0xB1 SYSCON      ; // XRAM Controller Access Control
837 // SYSCON bits
838 #define SYSCON_XMAP0    0x01
839 #define SYSCON_XMAP1    0x02
840 #define SYSCON_RMAP             0x10
841 #define SYSCON_EALE             0x20
842 #endif
843
844 #ifdef T2CON
845 #undef T2CON
846 sfr at 0xC8 T2CON ;
847 // Bit registers
848 sbit at 0xC8 T2CON_0 ;
849 sbit at 0xC9 T2CON_1 ;
850 sbit at 0xCA T2CON_2 ;
851 sbit at 0xCB T2CON_3 ;
852 sbit at 0xCC T2CON_4 ;
853 sbit at 0xCD T2CON_5 ;
854 sbit at 0xCE T2CON_6 ;
855 sbit at 0xCF T2CON_7 ;
856 // alternate names
857 sbit at 0xC8 T2I0 ;
858 sbit at 0xC9 T2I1 ;
859 sbit at 0xCA T2CM ;
860 sbit at 0xCB T2R0 ;
861 sbit at 0xCC T2R1 ;
862 sbit at 0xCD I2FR ;
863 sbit at 0xCE I3FR ;
864 sbit at 0xCF T2PS ;
865 #endif
866
867 #ifdef TCON
868 #undef TCON
869 sfr at 0x88 TCON ;
870 //  Bit registers
871 sbit at 0x88 IT0  ;
872 sbit at 0x89 IE0  ;
873 sbit at 0x8A IT1  ;
874 sbit at 0x8B IE1  ;
875 sbit at 0x8C TR0  ;
876 sbit at 0x8D TF0  ;
877 sbit at 0x8E TR1  ;
878 sbit at 0x8F TF1  ;
879 #endif
880
881 #ifdef TH0
882 #undef TH0
883 sfr at 0x8C TH0  ;
884 #endif
885
886 #ifdef TH1
887 #undef TH1
888 sfr at 0x8D TH1  ;
889 #endif
890
891 #ifdef TH2
892 #undef TH2
893 sfr at 0xCD TH2     ;
894 #endif
895
896 #ifdef TL0
897 #undef TL0
898 sfr at 0x8A TL0  ;
899 #endif
900
901 #ifdef TL1
902 #undef TL1
903 sfr at 0x8B TL1  ;
904 #endif
905
906 #ifdef TL2
907 #undef TL2
908 sfr at 0xCC TL2     ;
909 #endif
910
911 #ifdef TMOD
912 #undef TMOD
913 sfr at 0x89 TMOD ;
914 // Not directly accessible TMOD bits
915 #define T0_M0           0x01
916 #define T0_M1           0x02
917 #define T0_CT           0x04
918 #define T0_GATE         0x08
919 #define T1_M0           0x10
920 #define T1_M1           0x20
921 #define T1_CT           0x40
922 #define T1_GATE         0x80
923
924 #define T0_MASK         0x0F
925 #define T1_MASK         0xF0
926 #endif
927
928 #ifdef XPAGE
929 #undef XPAGE
930 sfr at 0x91 XPAGE     ; // Page Address Register for Extended On-Chip Ram - Siemens SAB80515A specific
931 #endif
932
933
934 /////////////////////////
935 /// Interrupt vectors ///
936 /////////////////////////
937
938 // Interrupt numbers: address = (number * 8) + 3
939 #define IE0_VECTOR      0       // 0x03 external interrupt 0
940 #define TF0_VECTOR      1       // 0x0b timer 0
941 #define IE1_VECTOR      2       // 0x13 external interrupt 1
942 #define TF1_VECTOR      3       // 0x1b timer 1
943 #define SI0_VECTOR      4       // 0x23 serial port 0
944
945
946 #ifdef REG_SAB80515_H
947 // Interrupt numbers: address = (number * 8) + 3
948 #define TF2_VECTOR      5       // 0x2B timer 2
949 #define EX2_VECTOR      5       // 0x2B external interrupt 2
950
951 #define IADC_VECTOR     8       // 0x43 A/D converter interrupt
952 #define IEX2_VECTOR     9       // 0x4B external interrupt 2
953 #define IEX3_VECTOR    10       // 0x53 external interrupt 3
954 #define IEX4_VECTOR    11       // 0x5B external interrupt 4
955 #define IEX5_VECTOR    12       // 0x63 external interrupt 5
956 #define IEX6_VECTOR    13       // 0x6B external interrupt 6
957 #endif
958
959 #ifdef REG_SAB80515A_H
960 // Interrupt numbers: address = (number * 8) + 3
961 #define TF2_VECTOR      5       // 0x2B timer 2
962 #define EX2_VECTOR      5       // 0x2B external interrupt 2
963
964 #define IADC_VECTOR     8       // 0x43 A/D converter interrupt
965 #define IEX2_VECTOR     9       // 0x4B external interrupt 2
966 #define IEX3_VECTOR    10       // 0x53 external interrupt 3
967 #define IEX4_VECTOR    11       // 0x5B external interrupt 4
968 #define IEX5_VECTOR    12       // 0x63 external interrupt 5
969 #define IEX6_VECTOR    13       // 0x6B external interrupt 6
970 #endif
971
972 #endif  // End of the header -> #ifndef MCS51REG_H