Imported Upstream version 2.9.0
[debian/cc1111] / device / include / mcs51 / p89lpc935_6.h
1 /*--------------------------------------------------------------------------
2 p89lpc935_6.h
3
4 This header allows to use the microcontrolers NXP (formerly Philips)
5 p89lpc935, 936.
6
7 Copyright (c) 2008 Gudjon I. Gudjonsson <gudjon AT gudjon.org>
8
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU
17  Lesser General Public License for more details.
18
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307 USA
22
23  The registered are ordered in the same way as in the NXP data sheet:
24  http://www.standardics.nxp.com/products/lpc900/datasheet/p89lpc933.p89lpc934.p89lpc935.p89lpc936.pdf
25
26
27 --------------------------------------------------------------------------*/
28 #ifndef __P89LPC935_6_H__
29 #define __P89LPC935_6_H__
30 #include <compiler.h>
31
32 /*BYTE Registers*/
33 SFR(ACC, 0xE0); // Accumulator
34         SBIT(ACC_7, 0xE0, 7);
35         SBIT(ACC_6, 0xE0, 6);
36         SBIT(ACC_5, 0xE0, 5);
37         SBIT(ACC_4, 0xE0, 4);
38         SBIT(ACC_3, 0xE0, 3);
39         SBIT(ACC_2, 0xE0, 2);
40         SBIT(ACC_1, 0xE0, 1);
41         SBIT(ACC_0, 0xE0, 0);
42 SFR(ADCON0, 0x8E); // A/D control register 0
43         #define  ENBI0    0x80
44         #define  ENADCI0  0x40
45         #define  TMM0     0x20
46         #define  EDGE0    0x10
47         #define  ADCI0    0x08
48         #define  ENADC0   0x04
49         #define  ADCS01   0x02
50         #define  ADCS00   0x01
51 SFR(ADCON1, 0x97); // A/D control register 1
52         #define  ENBI1    0x80
53         #define  ENADCI1  0x40
54         #define  TMM1     0x20
55         #define  EDGE1    0x10
56         #define  ADCI1    0x08
57         #define  ENADC1   0x04
58         #define  ADCS11   0x02
59         #define  ADCS10   0x01
60 SFR(ADINS, 0xA3); // A/D input select
61         #define  ADI13    0x80
62         #define  ADI12    0x40
63         #define  ADI11    0x20
64         #define  ADI10    0x10
65         #define  ADI03    0x08
66         #define  ADI02    0x04
67         #define  ADI01    0x02
68         #define  ADI00    0x01
69 SFR(ADMODA, 0xC0); // A/D mode register A
70         SBIT(BNDI1,  0xC0, 7);
71         SBIT(BURST1, 0xC0, 6);
72         SBIT(SCC1,   0xC0, 5);
73         SBIT(SCAN1,  0xC0, 4);
74         SBIT(BNDI0,  0xC0, 3);
75         SBIT(BURST0, 0xC0, 2);
76         SBIT(SCC0,   0xC0, 1);
77         SBIT(SCAN0,  0xC0, 0);
78 SFR(ADMODB, 0xA1); // A/D mode register B
79         #define  CLK2     0x80
80         #define  CLK1     0x40
81         #define  CLK0     0x20
82         #define  ENDAC1   0x08
83         #define  ENDAC0   0x04
84         #define  BSA1     0x02
85         #define  BSA0     0x01
86 SFR(AD0BH,   0xBB); // A/D_0 boundary high register
87 SFR(AD0BL,   0xA6); // A/D_0 boundary low register
88 SFR(AD0DAT0, 0xC5); // A/D_0 data register 0
89 SFR(AD0DAT1, 0xC6); // A/D_0 data register 1
90 SFR(AD0DAT2, 0xC7); // A/D_0 data register 2
91 SFR(AD0DAT3, 0xF4); // A/D_0 data register 3
92 SFR(AD1BH,   0xC4); // A/D_1 boundary high register
93 SFR(AD1BL,   0xBC); // A/D_1 boundary low register
94 SFR(AD1DAT0, 0xD5); // A/D_1 data register 0
95 SFR(AD1DAT1, 0xD6); // A/D_1 data register 1
96 SFR(AD1DAT2, 0xD7); // A/D_1 data register 2
97 SFR(AD1DAT3, 0xF5); // A/D_1 data register 3
98 SFR(AUXR1,   0xA2); // Auxilary function register
99         #define  CLKLP    0x80
100         #define  EBRR     0x40
101         #define  ENT1     0x20
102         #define  ENT0     0x10
103         #define  SRST     0x08
104         #define  DPS      0x01 // Bit 2 is always 0
105 SFR(B, 0xF0); // B register
106         SBIT(B7, 0xF0, 7);
107         SBIT(B6, 0xF0, 6);
108         SBIT(B5, 0xF0, 5);
109         SBIT(B4, 0xF0, 4);
110         SBIT(B3, 0xF0, 3);
111         SBIT(B2, 0xF0, 2);
112         SBIT(B1, 0xF0, 1);
113         SBIT(B0, 0xF0, 0);
114 SFR(BRGR0,  0xBE); // Baud rate generator rate low
115 SFR(BRGR1,  0xBF); // Baud rate generator rate high
116 SFR(BRGCON, 0xBD); // Baud rate generator control
117         #define  SBRGS    0x02
118         #define  BRGEN    0x01
119 SFR(CCCRA,  0xEA); // Capture compare A control register
120         #define  ICECA2   0x80
121         #define  ICECA1   0x40
122         #define  ICECA0   0x20
123         #define  ICESA    0x10
124         #define  ICNFA    0x08
125         #define  FCOA     0x04
126         #define  OCMA1    0x02
127         #define  OCMA0    0x01
128 SFR(CCCRB,  0xEB); // Capture compare B control register
129         #define  ICECB2   0x80
130         #define  ICECB1   0x40
131         #define  ICECB0   0x20
132         #define  ICESB    0x10
133         #define  ICNFB    0x08
134         #define  FCOB     0x04
135         #define  OCMB1    0x02
136         #define  OCMB0    0x01
137 SFR(CCCRC,  0xEC); // Capture compare C control register
138         #define  FCOC     0x04
139         #define  OCMC1    0x02
140         #define  OCMC0    0x01
141 SFR(CCCRD,  0xED); // Capture compare D control register
142         #define  FCOD     0x04
143         #define  OCMD1    0x02
144         #define  OCMD0    0x01
145 SFR(CMP1,   0xAC); // Comparator 1 control register
146         #define  CE1      0x20
147         #define  CP1      0x10
148         #define  CN1      0x08
149         #define  OE1      0x04
150         #define  CO1      0x02
151         #define  CMF1     0x01
152 SFR(CMP2,   0xAD); // Comparator 2 control register
153         #define  CE2      0x20
154         #define  CP2      0x10
155         #define  CN2      0x08
156         #define  OE2      0x04
157         #define  CO2      0x02
158         #define  CMF2     0x01
159 SFR(DEECON, 0xF1); // Data EEPROM control register
160         #define  EEIF     0x80
161         #define  HVERR    0x40
162         #define  ECTL1    0x20
163         #define  ECTL0    0x10
164         #define  EADR8    0x01
165 SFR(DEEDAT, 0xF2); // Data EEPROM data register
166 SFR(DEEADR, 0xF3); // Data EEPROM address register
167 SFR(DIVM,   0x95); // CPU clock divide-by-M control
168 SFR(DPH,    0x83); // Data Pointer High
169 SFR(DPL,    0x82); // Data Pointer Low
170 SFR(FMADRH, 0xE7); // Program flash address high
171 SFR(FMADRL, 0xE6); // Program flash address low
172 SFR(FMCON,  0xE4);
173         // Program flash control (Read)
174         #define  BUSY     0x80
175         #define  HVA      0x08
176         #define  HVE      0x04
177         #define  SV       0x02
178         #define  OI       0x01
179         // Program flash control (Write)
180         #define  FMCMD_7  0x80
181         #define  FMCMD_6  0x40
182         #define  FMCMD_5  0x20
183         #define  FMCMD_4  0x10
184         #define  FMCMD_3  0x08
185         #define  FMCMD_2  0x04
186         #define  FMCMD_1  0x02
187         #define  FMCMD_0  0x01
188 SFR(FMDATA,  0xE5); // Program flash data
189 SFR(I2ADR,   0xDB); // I2C slave address register
190         #define I2ADR_6  0x80
191         #define I2ADR_5  0x40
192         #define I2ADR_4  0x20
193         #define I2ADR_3  0x10
194         #define I2ADR_2  0x08
195         #define I2ADR_1  0x04
196         #define I2ADR_0  0x02
197         #define GC       0x01
198 SFR(I2CON,  0xD8); // I2C control register
199         SBIT(I2EN,  0xD8, 6);
200         SBIT(STA,   0xD8, 5);
201         SBIT(STO,   0xD8, 4);
202         SBIT(SI,    0xD8, 3);
203         SBIT(AA,    0xD8, 2);
204         SBIT(CRSEL, 0xD8, 0);
205 SFR(I2DAT,  0xDA); // I2C data register
206 SFR(I2SCLH, 0xDD); // I2C serial clock generator/SCL duty cycle register high
207 SFR(I2SCLL, 0xDC); // I2C serial clock generator/SCL duty cycle register low
208 SFR(I2STAT, 0xD9); // I2C status register
209         #define STA_4   0x80
210         #define STA_3   0x40
211         #define STA_2   0x20
212         #define STA_1   0x10
213         #define STA_0   0x08    // Only write 0 to the lowest three bits
214 SFR(ICRAH,  0xAB); // Input capture A register high
215 SFR(ICRAL,  0xAA); // Input capture A register low
216 SFR(ICRBH,  0xAF); // Input capture B register high
217 SFR(ICRBL,  0xAE); // Input capture B register low
218 SFR(IEN0,   0xA8); // Interrupt Enable 0
219         SBIT(EA,     0xA8, 7);
220         SBIT(EWDRT,  0xA8, 6);
221         SBIT(EBO,    0xA8, 5);
222         SBIT(ES_ESR, 0xA8, 4);
223         SBIT(ET1,    0xA8, 3);
224         SBIT(EX1,    0xA8, 2);
225         SBIT(ET0,    0xA8, 1);
226         SBIT(EX0,    0xA8, 0);
227 SFR(IEN1,  0xE8); // Interrupt Enable 1
228         SBIT(EADEE,  0xE8, 7);
229         SBIT(EST,    0xE8, 6);
230         SBIT(ECCU,   0xE8, 4);
231         SBIT(ESPI,   0xE8, 3);
232         SBIT(EC,     0xE8, 2);
233         SBIT(EKBI,   0xE8, 1);
234         SBIT(EI2C,   0xE8, 0);
235 SFR(IP0, 0xB8); // Interrupt Priority 0
236         SBIT(PWDRT,  0xB8, 6);
237         SBIT(PBO,    0xB8, 5);
238         SBIT(PS_PSR, 0xB8, 4);
239         SBIT(PT1,    0xB8, 3);
240         SBIT(PX1,    0xB8, 2);
241         SBIT(PT0,    0xB8, 1);
242         SBIT(PX0,    0xB8, 0);
243 SFR(IP0H, 0xB7); // Interrupt Priority 0 high
244         #define PWDRTH    0x40
245         #define PBOH      0x20
246         #define PSH_PSRH  0x10
247         #define PT1H      0x08
248         #define PX1H      0x04
249         #define PT0H      0x02
250         #define PX0H      0x01
251 SFR(IP1,  0xF8); // Interrupt Priority 1
252         SBIT(PADEE, 0xF8, 7);
253         SBIT(PST,   0xF8, 6);
254         SBIT(PCCU,  0xF8, 4);
255         SBIT(PSPI,  0xF8, 3);
256         SBIT(PC,    0xF8, 2);
257         SBIT(PKBI,  0xF8, 1);
258         SBIT(PI2C,  0xF8, 0);
259 SFR(IP1H, 0xF7); // Interrupt Priority 1 High
260         #define PAEEH  0x80
261         #define PSTH   0x40
262         #define PCCUH  0x10
263         #define PSPIH  0x08
264         #define PCH    0x04
265         #define PKBIH  0x02
266         #define PI2CH  0x01
267 SFR(KBCON, 0x94); // Keypad control register
268         #define PATN_SEL 0x02
269         #define KBIF     0x01
270 SFR(KBMASK, 0x86); // Keypad interrupt mask register
271 SFR(KBPATN, 0x93); // Keypad pattern register
272 SFR(OCRAH,  0xEF); // Output compare A register high
273 SFR(OCRAL,  0xEE); // Output compare A register low
274 SFR(OCRBH,  0xFB); // Output compare B register high
275 SFR(OCRBL,  0xFA); // Output compare B register low
276 SFR(OCRCH,  0xFD); // Output compare C register high
277 SFR(OCRCL,  0xFC); // Output compare C register low
278 SFR(OCRDH,  0xFF); // Output compare D register high
279 SFR(OCRDL,  0xFE); // Output compare D register low
280 SFR(P0, 0x80); // Port 0
281         SBIT(P0_7,   0x80, 7);
282         SBIT(T1,     0x80, 7);
283         SBIT(KB7,    0x80, 7);
284         SBIT(P0_6,   0x80, 6);
285         SBIT(CMP_1,  0x80, 6); // Renamed, not to conflict with the CMP1 register
286         SBIT(KB6,    0x80, 6);
287         SBIT(P0_5,   0x80, 5);
288         SBIT(CMPREF, 0x80, 5);
289         SBIT(KB5,    0x80, 5);
290         SBIT(P0_4,   0x80, 4);
291         SBIT(CIN1A,  0x80, 4);
292         SBIT(KB4,    0x80, 4);
293         SBIT(P0_3,   0x80, 3);
294         SBIT(CIN1B,  0x80, 3);
295         SBIT(KB3,    0x80, 3);
296         SBIT(P0_2,   0x80, 2);
297         SBIT(CIN2A,  0x80, 2);
298         SBIT(KB2,    0x80, 2);
299         SBIT(P0_1,   0x80, 1);
300         SBIT(CIN2B,  0x80, 1);
301         SBIT(KB1,    0x80, 1);
302         SBIT(P0_0,   0x80, 0);
303         SBIT(CMP_2,  0x80, 0); // Renamed, not to conflict with the CMP2 register
304         SBIT(KB0,    0x80, 0);
305 SFR(P1, 0x90); // Port 1
306         SBIT(P1_7,   0x90, 7);
307         SBIT(OCC,    0x90, 7);
308         SBIT(P1_6,   0x90, 6);
309         SBIT(OCB,    0x90, 6);
310         SBIT(P1_5,   0x90, 5);
311         SBIT(RST,    0x90, 5);
312         SBIT(P1_4,   0x90, 4);
313         SBIT(INT1,   0x90, 4);
314         SBIT(P1_3,   0x90, 3);
315         SBIT(INT0,   0x90, 3);
316         SBIT(SDA,    0x90, 3);
317         SBIT(P1_2,   0x90, 2);
318         SBIT(T0,     0x90, 2);
319         SBIT(SCL,    0x90, 2);
320         SBIT(P1_1,   0x90, 1);
321         SBIT(RXD,    0x90, 1);
322         SBIT(P1_0,   0x90, 0);
323         SBIT(TXD,    0x90, 0);
324 SFR(P2, 0xA0); // Port 2
325         SBIT(P2_7,   0xA0, 7);
326         SBIT(ICA,    0xA0, 7);
327         SBIT(P2_6,   0xA0, 6);
328         SBIT(OCA,    0xA0, 6);
329         SBIT(P2_5,   0xA0, 5);
330         SBIT(SPICLK, 0xA0, 5);
331         SBIT(P2_4,   0xA0, 4);
332         SBIT(SS,     0xA0, 4);
333         SBIT(P2_3,   0xA0, 3);
334         SBIT(MISO,   0xA0, 3);
335         SBIT(P2_2,   0xA0, 2);
336         SBIT(MOSI,   0xA0, 2);
337         SBIT(P2_1,   0xA0, 1);
338         SBIT(OCD,    0xA0, 1);
339         SBIT(P2_0,   0xA0, 0);
340         SBIT(ICB,    0xA0, 0);
341 SFR(P3, 0xB0); // Port 3
342         SBIT(P3_7, 0xB0, 7);
343         SBIT(P3_6, 0xB0, 6);
344         SBIT(P3_5, 0xB0, 5);
345         SBIT(P3_4, 0xB0, 4);
346         SBIT(P3_3, 0xB0, 3);
347         SBIT(P3_2, 0xB0, 2);
348         SBIT(P3_1, 0xB0, 1);
349         SBIT(XTAL1,0xB0, 1);
350         SBIT(P3_0, 0xB0, 0);
351         SBIT(XTAL2,0xB0, 0);
352 SFR(P0M1, 0x84); // Port 0 output mode 1
353         #define P0M1_7  0x80
354         #define P0M1_6  0x40
355         #define P0M1_5  0x20
356         #define P0M1_4  0x10
357         #define P0M1_3  0x08
358         #define P0M1_2  0x04
359         #define P0M1_1  0x02
360         #define P0M1_0  0x01
361 SFR(P0M2, 0x85); // Port 0 output mode 2
362         #define P0M2_7  0x80
363         #define P0M2_6  0x40
364         #define P0M2_5  0x20
365         #define P0M2_4  0x10
366         #define P0M2_3  0x08
367         #define P0M2_2  0x04
368         #define P0M2_1  0x02
369         #define P0M2_0  0x01
370 SFR(P1M1, 0x91); // Port 1 output mode 1
371         #define P1M1_7  0x80
372         #define P1M1_6  0x40
373         #define P1M1_4  0x10
374         #define P1M1_3  0x08
375         #define P1M1_2  0x04
376         #define P1M1_1  0x02
377         #define P1M1_0  0x01
378 SFR(P1M2, 0x92); // Port 1 output mode 2
379         #define P1M2_7  0x80
380         #define P1M2_6  0x40
381         #define P1M2_4  0x10
382         #define P1M2_3  0x08
383         #define P1M2_2  0x04
384         #define P1M2_1  0x02
385         #define P1M2_0  0x01
386 SFR(P2M1, 0xA4); // Port 2 output mode 1
387         #define P2M1_7  0x80
388         #define P2M1_6  0x40
389         #define P2M1_5  0x20
390         #define P2M1_4  0x10
391         #define P2M1_3  0x08
392         #define P2M1_2  0x04
393         #define P2M1_1  0x02
394         #define P2M1_0  0x01
395 SFR(P2M2, 0xA5); // Port 2 output mode 2
396         #define P2M2_7  0x80
397         #define P2M2_6  0x40
398         #define P2M2_5  0x20
399         #define P2M2_4  0x10
400         #define P2M2_3  0x08
401         #define P2M2_2  0x04
402         #define P2M2_1  0x02
403         #define P2M2_0  0x01
404 SFR(P3M1, 0xB1); // Port 3 output mode 1
405         #define P3M1_1  0x02
406         #define P3M1_0  0x01
407 SFR(P3M2, 0xB2); // Port 3 output mode 2
408         #define P3M2_1  0x02
409         #define P3M2_0  0x01
410 SFR(PCON,  0x87); // Power control register
411         #define SMOD1   0x80
412         #define SMOD0   0x40
413         #define BOPD    0x20
414         #define BOI     0x10
415         #define GF1     0x08
416         #define GF0     0x04
417         #define PMOD1   0x02
418         #define PMOD0   0x01
419 SFR(PCONA, 0xB5); // Power control register A
420         #define RTCPD   0x80
421         #define DEEPD   0x40
422         #define VCPD    0x20
423         #define ADPD    0x10
424         #define I2PD    0x08
425         #define SPPD    0x04
426         #define SPD     0x02
427         #define CCUPR   0x01
428 SFR(PSW, 0xD0); // Program Status Word
429         SBIT(CY,  0xD0, 7);
430         SBIT(AC,  0xD0, 6);
431         SBIT(F0,  0xD0, 5);
432         SBIT(RS1, 0xD0, 4);
433         SBIT(RS0, 0xD0, 3);
434         SBIT(OV,  0xD0, 2);
435         SBIT(F1,  0xD0, 1);
436         SBIT(P,   0xD0, 0);
437 SFR(PT0AD, 0xF6); // Port 0 digital input disable
438         #define PT0AD_5   0x20
439         #define PT0AD_4   0x10
440         #define PT0AD_3   0x08
441         #define PT0AD_2   0x04
442         #define PT0AD_1   0x02
443 SFR(RSTSRC, 0xDF); // Reset source register
444         #define BOF    0x20
445         #define POF    0x10
446         #define R_BK   0x08
447         #define R_WD   0x04
448         #define R_SF   0x02
449         #define R_EX   0x01
450 SFR(RTCCON, 0xD1); // Real-time clock control
451         #define RTCF   0x80
452         #define RTCS1  0x40
453         #define RTCS0  0x20
454         #define ERTC   0x02
455         #define RTCEN  0x01
456 SFR(RTCH,  0xD2); // Real-time clock register high
457 SFR(RTCL,  0xD3); // Real-time clock register low
458 SFR(SADDR, 0xA9); // Serial port address register
459 SFR(SADEN, 0xB9); // Serial port address enable
460 SFR(SBUF,  0x99); // Serial port data buffer register
461 SFR(SCON,  0x98); // Serial port control
462         SBIT(SM0_FE, 0x98, 7);
463         SBIT(SM1,    0x98, 6);
464         SBIT(SM2,    0x98, 5);
465         SBIT(REN,    0x98, 4);
466         SBIT(TB8,    0x98, 3);
467         SBIT(RB8,    0x98, 2);
468         SBIT(TI,     0x98, 1);
469         SBIT(RI,     0x98, 0);
470 SFR(SSTAT, 0xBA); // Serial port extended status register
471         #define DBMOD  0x80
472         #define INTLO  0x40
473         #define CIDIS  0x20
474         #define DBISEL 0x10
475         #define FE     0x08
476         #define BR     0x04
477         #define OE     0x02
478         #define STINT  0x01
479 SFR(SP,     0x81); // Stack Pointer
480 SFR(SPCTL,  0xE2); // SPI control register
481         #define SSIG  0x80
482         #define SPEN  0x40
483         #define DORD  0x20
484         #define MSTR  0x10
485         #define CPOL  0x08
486         #define CPHA  0x04
487         #define SPR1  0x02
488         #define SPR0  0x01
489 SFR(SPSTAT, 0xE1); // SPI status register
490         #define SPIF  0x80
491         #define WCOL  0x40
492 SFR(SPDAT,  0xE3); // SPI data register
493 SFR(TAMOD,  0x8F); // Timer 0 and 1 auxiliary mode
494         #define T1M2  0x10
495         #define T0M2  0x01
496 SFR(TCON,   0x88); // Timer 0 and 1 control
497         SBIT(TF1, 0x88, 7);
498         SBIT(TR1, 0x88, 6);
499         SBIT(TF0, 0x88, 5);
500         SBIT(TR0, 0x88, 4);
501         SBIT(IE1, 0x88, 3);
502         SBIT(IT1, 0x88, 2);
503         SBIT(IE0, 0x88, 1);
504         SBIT(IT0, 0x88, 0);
505 SFR(TCR20,  0xC8); // CCU control register 0
506         SBIT(PLEEN,  0xC8, 7);
507         SBIT(HLTRN,  0xC8, 6);
508         SBIT(HLTEN,  0xC8, 5);
509         SBIT(ALTCD,  0xC8, 4);
510         SBIT(ALTAB,  0xC8, 3);
511         SBIT(TDIR2,  0xC8, 2);
512         SBIT(TMOD21, 0xC8, 1);
513         SBIT(TMOD20, 0xC8, 0);
514 SFR(TCR21,  0xF9); // CCU control register 1
515         #define TCOU2   0x80
516         #define PLLDV_3 0x08
517         #define PLLDV_2 0x04
518         #define PLLDV_1 0x02
519         #define PLLDV_0 0x01
520 SFR(TH0,  0x8C); // Timer 0 high
521 SFR(TH1,  0x8D); // Timer 1 high
522 SFR(TH2,  0xCD); // CCU timer high
523 SFR(TICR2,0xC9); // CCU interrupt control register
524         #define TOIE2    0x80
525         #define TOCIE2D  0x40
526         #define TOCIE2C  0x20
527         #define TOCIE2B  0x10
528         #define TOCIE2A  0x08
529         #define TICIE2B  0x02
530         #define TICIE2A  0x01
531 SFR(TIFR2,0xE9); // CCU interrupt flag register
532         #define TOIF2    0x80
533         #define TOCF2D  0x40
534         #define TOCF2C  0x20
535         #define TOCF2B  0x10
536         #define TOCF2A  0x08
537         #define TICF2B  0x02
538         #define TICF2A  0x01
539 SFR(TISE2,0xDE); // CCU interrupt status encode register
540         #define ENCINT2  0x04
541         #define ENCINT1  0x02
542         #define ENCINT0  0x01
543 SFR(TL0,   0x8A); // Timer 0 low
544 SFR(TL1,   0x8B); // Timer 1 low
545 SFR(TL2,   0xCC); // CCU timer low
546 SFR(TMOD, 0x89); // Timer 0 and 1 mode
547         #define T1GATE  0x80
548         #define T1C_T   0x40
549         #define T1M1    0x20
550         #define T1M0    0x10
551         #define T0GATE  0x08
552         #define T0C_T   0x04
553         #define T0M1    0x02
554         #define T0M0    0x01
555 SFR(TOR2H, 0xCF); // CCU reload register high
556 SFR(TOR2L, 0xCE); // CCU reload register low
557 SFR(TPCR2H,0xCB); // Prescaler control register high
558         #define TPCR2H_1 0x02
559         #define TPCR2H_0 0x01
560 SFR(TPCR2L,0xCA); // Prescaler control register low
561         #define TPCR2L_7 0x80
562         #define TPCR2L_6 0x40
563         #define TPCR2L_5 0x20
564         #define TPCR2L_4 0x10
565         #define TPCR2L_3 0x08
566         #define TPCR2L_2 0x04
567         #define TPCR2L_1 0x02
568         #define TPCR2L_0 0x01
569 SFR(TRIM, 0x96); // Internal oscillator trim register
570         #define RCCLK   0x80
571         #define ENCLK   0x40
572         #define TRIM_5  0x20
573         #define TRIM_4  0x10
574         #define TRIM_3  0x08
575         #define TRIM_2  0x04
576         #define TRIM_1  0x02
577         #define TRIM_0  0x01
578 SFR(WDCON, 0xA7); // Watchdog control register
579         #define PRE2    0x80
580         #define PRE1    0x40
581         #define PRE0    0x20
582         #define WDRUN   0x04
583         #define WDTOF   0x02
584         #define WDCLK   0x01
585 SFR(WDL,    0xC1); // Watchdog load
586 SFR(WFEED1, 0xC2); // Watchdog feed 1
587 SFR(WFEED2, 0xC3); // Watchdog feed 2
588 #endif // __P89LPC935_6_H__