1 /*-------------------------------------------------------------------------
2 sab80515.h - Register Declarations for SIEMENS/INFINEON SAB 80515 Processor
3 based on reg51.h by Sandeep Dutta sandeep.dutta@usa.net
4 KEIL C compatible definitions are included
6 Copyright (C) 2005, Bela Torok / bela.torok@kssg.ch
8 This library is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this library; see the file COPYING. If not, write to the
20 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
23 As a special exception, if you link this library with other files,
24 some of which are compiled with SDCC, to produce an executable,
25 this library does not by itself cause the resulting executable to
26 be covered by the GNU General Public License. This exception does
27 not however invalidate any other reasons why the executable file
28 might be covered by the GNU General Public License.
29 -------------------------------------------------------------------------*/
36 /* BYTE addressable registers */
53 SFR(IEN0
, 0xA8); /* as called by Siemens */
54 SFR(IP0
, 0xA9); /* interrupt priority register - SAB80515 specific */
56 SFR(IEN1
, 0xB8); /* interrupt enable register - SAB80515 specific */
57 SFR(IP1
, 0xB9); /* interrupt priority register as called by Siemens */
58 SFR(IRCON
, 0xC0); /* interrupt control register - SAB80515 specific */
59 SFR(CCEN
, 0xC1); /* compare/capture enable register */
60 SFR(CCL1
, 0xC2); /* compare/capture register 1, low byte */
61 SFR(CCH1
, 0xC3); /* compare/capture register 1, high byte */
62 SFR(CCL2
, 0xC4); /* compare/capture register 2, low byte */
63 SFR(CCH2
, 0xC5); /* compare/capture register 2, high byte */
64 SFR(CCL3
, 0xC6); /* compare/capture register 3, low byte */
65 SFR(CCH3
, 0xC7); /* compare/capture register 3, high byte */
67 SFR(CRCL
, 0xCA); /* compare/reload/capture register, low byte */
68 SFR(CRCH
, 0xCB); /* compare/reload/capture register, high byte */
72 SFR(ADCON
, 0xD8); /* A/D-converter control register */
73 SFR(ADDAT
, 0xD9); /* A/D-converter data register */
74 SFR(DAPR
, 0xDA); /* D/A-converter program register */
75 SFR(P6
, 0xDB); /* Port 6 - SAB80515 specific */
78 SFR(P4
, 0xE8); /* Port 4 - SAB80515 specific */
80 SFR(P5
, 0xF8); /* Port 5 - SAB80515 specific */
83 /* BIT addressable registers */
114 SBIT(INT3_CC0
, 0x90, 0); /* P1 alternate functions - SAB80515 specific */
115 SBIT(INT4_CC1
, 0x90, 1);
116 SBIT(INT5_CC2
, 0x90, 2);
117 SBIT(INT6_CC3
, 0x90, 3);
120 SBIT(CLKOUT
, 0x90, 6);
150 SBIT(WDT
, 0xA8, 6); /* watchdog timer reset - SAB80515 specific */
153 SBIT(EAL
, 0xA8, 7); /* EA as called by Siemens */
175 SBIT(EADC
, 0xB8, 0); /* A/D converter interrupt enable */
181 SBIT(SWDT
, 0xB8, 6); /* watchdog timer start/reset */
182 SBIT(EXEN2
, 0xB8, 7); /* timer2 external reload interrupt enable */
185 SBIT(IADC
, 0xC0, 0); /* A/D converter irq flag */
186 SBIT(IEX2
, 0xC0, 1); /* external interrupt edge detect flag */
191 SBIT(TF2
, 0xC0, 6); /* timer 2 owerflow flag */
192 SBIT(EXF2
, 0xC0, 7); /* timer2 reload flag */
195 SBIT(T2CON_0
, 0xC8, 0);
196 SBIT(T2CON_1
, 0xC8, 1);
197 SBIT(T2CON_2
, 0xC8, 2);
198 SBIT(T2CON_3
, 0xC8, 3);
199 SBIT(T2CON_4
, 0xC8, 4);
200 SBIT(T2CON_5
, 0xC8, 5);
201 SBIT(T2CON_6
, 0xC8, 6);
202 SBIT(T2CON_7
, 0xC8, 7);
237 SBIT(AREG_F0
, 0xA0, 0);
238 SBIT(AREG_F1
, 0xA0, 1);
239 SBIT(AREG_F2
, 0xA0, 2);
240 SBIT(AREG_F3
, 0xA0, 3);
241 SBIT(AREG_F4
, 0xA0, 4);
242 SBIT(AREG_F5
, 0xA0, 5);
243 SBIT(AREG_F6
, 0xA0, 6);
244 SBIT(AREG_F7
, 0xA0, 7);
257 SBIT(BREG_F0
, 0xF0, 0);
258 SBIT(BREG_F1
, 0xF0, 1);
259 SBIT(BREG_F2
, 0xF0, 2);
260 SBIT(BREG_F3
, 0xF0, 3);
261 SBIT(BREG_F4
, 0xF0, 4);
262 SBIT(BREG_F5
, 0xF0, 5);
263 SBIT(BREG_F6
, 0xF0, 6);
264 SBIT(BREG_F7
, 0xF0, 7);
276 /* BIT definitions for bits that are not directly accessible */
321 #define T0_GATE_ 0x08
325 #define T1_GATE_ 0x80
330 #define T0_MASK_ 0x0F
331 #define T1_MASK_ 0xF0
341 #define WMCON_WDTEN 0x01
342 #define WMCON_WDTRST 0x02
343 #define WMCON_DPS 0x04
344 #define WMCON_EEMEN 0x08
345 #define WMCON_EEMWE 0x10
346 #define WMCON_PS0 0x20
347 #define WMCON_PS1 0x40
348 #define WMCON_PS2 0x80
351 #define SPCR_SPR0 0x01
352 #define SPCR_SPR1 0x02
353 #define SPCR_CPHA 0x04
354 #define SPCR_CPOL 0x08
355 #define SPCR_MSTR 0x10
356 #define SPCR_DORD 0x20
357 #define SPCR_SPE 0x40
358 #define SPCR_SPIE 0x80
361 #define SPSR_WCOL 0x40
362 #define SPSR_SPIF 0x80
365 #define SPDR_SPD0 0x10
366 #define SPDR_SPD1 0x20
367 #define SPDR_SPD2 0x40
368 #define SPDR_SPD3 0x80
369 #define SPDR_SPD4 0x10
370 #define SPDR_SPD5 0x20
371 #define SPDR_SPD6 0x40
372 #define SPDR_SPD7 0x80
374 /* Interrupt numbers: address = (number * 8) + 3 */
375 #define IE0_VECTOR 0 /* 0x03 external interrupt 0 */
376 #define TF0_VECTOR 1 /* 0x0b timer 0 */
377 #define IE1_VECTOR 2 /* 0x13 external interrupt 1 */
378 #define TF1_VECTOR 3 /* 0x1b timer 1 */
379 #define SI0_VECTOR 4 /* 0x23 serial port 0 */
380 #define TF2_VECTOR 5 /* 0x2B timer 2 */
381 #define EX2_VECTOR 5 /* 0x2B external interrupt 2 */
383 #define IADC_VECTOR 8 /* 0x43 A/D converter interrupt */
384 #define IEX2_VECTOR 9 /* 0x4B external interrupt 2 */
385 #define IEX3_VECTOR 10 /* 0x53 external interrupt 3 */
386 #define IEX4_VECTOR 11 /* 0x5B external interrupt 4 */
387 #define IEX5_VECTOR 12 /* 0x63 external interrupt 5 */
388 #define IEX6_VECTOR 13 /* 0x6B external interrupt 6 */