Imported Upstream version 2.9.0
[debian/cc1111] / device / include / pic / pic16c558.h
1 //
2 // Register Declarations for Microchip 16C558 Processor
3 //
4 //
5 // This header file was automatically generated by:
6 //
7 //      inc2h.pl V4783
8 //
9 //      Copyright (c) 2002, Kevin L. Pauba, All Rights Reserved
10 //
11 //      SDCC is licensed under the GNU Public license (GPL) v2.  Note that
12 //      this license covers the code to the compiler and other executables,
13 //      but explicitly does not cover any code or objects generated by sdcc.
14 //      We have not yet decided on a license for the run time libraries, but
15 //      it will not put any requirements on code linked against it. See:
16 // 
17 //      http://www.gnu.org/copyleft/gpl/html
18 //
19 //      See http://sdcc.sourceforge.net/ for the latest information on sdcc.
20 //
21 // 
22 #ifndef P16C558_H
23 #define P16C558_H
24
25 //
26 // Register addresses.
27 //
28 #define INDF_ADDR       0x0000
29 #define TMR0_ADDR       0x0001
30 #define PCL_ADDR        0x0002
31 #define STATUS_ADDR     0x0003
32 #define FSR_ADDR        0x0004
33 #define PORTA_ADDR      0x0005
34 #define PORTB_ADDR      0x0006
35 #define PCLATH_ADDR     0x000A
36 #define INTCON_ADDR     0x000B
37 #define OPTION_REG_ADDR 0x0081
38 #define TRISA_ADDR      0x0085
39 #define TRISB_ADDR      0x0086
40 #define PCON_ADDR       0x008E
41
42 //
43 // Memory organization.
44 //
45
46
47
48 //         LIST
49 // P16C558.INC  Standard Header File, Version 1.00    Microchip Technology, Inc.
50 //         NOLIST
51
52 // This header file defines configurations, registers, and other useful bits of
53 // information for the PIC16C558 microcontroller.  These names are taken to match 
54 // the data sheets as closely as possible.  
55
56 // Note that the processor must be selected before this file is 
57 // included.  The processor may be selected the following ways:
58
59 //       1. Command line switch:
60 //               C:\ MPASM MYFILE.ASM /PIC16C558
61 //       2. LIST directive in the source file
62 //               LIST   P=PIC16C558
63 //       3. Processor Type entry in the MPASM full-screen interface
64
65 //==========================================================================
66 //
67 //       Revision History
68 //
69 //==========================================================================
70
71 //Rev:   Date:    Reason:
72
73 //1.00   04/22/96 Initial Creation
74
75 //==========================================================================
76 //
77 //       Verify Processor
78 //
79 //==========================================================================
80
81 //        IFNDEF __16C558
82 //            MESSG "Processor-header file mismatch.  Verify selected processor."
83 //         ENDIF
84
85 //==========================================================================
86 //
87 //       Register Definitions
88 //
89 //==========================================================================
90
91 #define W                    0x0000
92 #define F                    0x0001
93
94 //----- Register Files------------------------------------------------------
95
96 extern __sfr  __at (INDF_ADDR)                    INDF;
97 extern __sfr  __at (TMR0_ADDR)                    TMR0;
98 extern __sfr  __at (PCL_ADDR)                     PCL;
99 extern __sfr  __at (STATUS_ADDR)                  STATUS;
100 extern __sfr  __at (FSR_ADDR)                     FSR;
101 extern __sfr  __at (PORTA_ADDR)                   PORTA;
102 extern __sfr  __at (PORTB_ADDR)                   PORTB;
103 extern __sfr  __at (PCLATH_ADDR)                  PCLATH;
104 extern __sfr  __at (INTCON_ADDR)                  INTCON;
105
106 extern __sfr  __at (OPTION_REG_ADDR)              OPTION_REG;
107 extern __sfr  __at (TRISA_ADDR)                   TRISA;
108 extern __sfr  __at (TRISB_ADDR)                   TRISB;
109 extern __sfr  __at (PCON_ADDR)                    PCON;
110
111 //----- STATUS Bits --------------------------------------------------------
112
113
114 //----- INTCON Bits --------------------------------------------------------
115
116
117 //----- OPTION Bits --------------------------------------------------------
118
119
120 //----- PCON Bits ----------------------------------------------------------
121
122
123 //==========================================================================
124 //
125 //       RAM Definition
126 //
127 //==========================================================================
128
129 //         __MAXRAM H'BF'
130 //         __BADRAM H'07'-H'09', H'0C'-H'1F'
131 //         __BADRAM H'87'-H'89', H'8C'-H'8D', H'8F'-H'9F'
132
133 //==========================================================================
134 //
135 //       Configuration Bits
136 //
137 //==========================================================================
138
139 #define _CP_ALL              0x00CF
140 #define _CP_75               0x15DF
141 #define _CP_50               0x2AEF
142 #define _CP_OFF              0x3FFF
143 #define _PWRTE_OFF           0x3FFF
144 #define _PWRTE_ON            0x3FF7
145 #define _WDT_ON              0x3FFF
146 #define _WDT_OFF             0x3FFB
147 #define _LP_OSC              0x3FFC
148 #define _XT_OSC              0x3FFD
149 #define _HS_OSC              0x3FFE
150 #define _RC_OSC              0x3FFF
151
152 //         LIST
153
154 // ----- INTCON bits --------------------
155 typedef union {
156   struct {
157     unsigned char RBIF:1;
158     unsigned char INTF:1;
159     unsigned char T0IF:1;
160     unsigned char RBIE:1;
161     unsigned char INTE:1;
162     unsigned char T0IE:1;
163     unsigned char :1;
164     unsigned char GIE:1;
165   };
166 } __INTCON_bits_t;
167 extern volatile __INTCON_bits_t __at(INTCON_ADDR) INTCON_bits;
168
169 #ifndef NO_BIT_DEFINES
170 #define RBIF                 INTCON_bits.RBIF
171 #define INTF                 INTCON_bits.INTF
172 #define T0IF                 INTCON_bits.T0IF
173 #define RBIE                 INTCON_bits.RBIE
174 #define INTE                 INTCON_bits.INTE
175 #define T0IE                 INTCON_bits.T0IE
176 #define GIE                  INTCON_bits.GIE
177 #endif /* NO_BIT_DEFINES */
178
179 // ----- OPTION_REG bits --------------------
180 typedef union {
181   struct {
182     unsigned char PS0:1;
183     unsigned char PS1:1;
184     unsigned char PS2:1;
185     unsigned char PSA:1;
186     unsigned char T0SE:1;
187     unsigned char T0CS:1;
188     unsigned char INTEDG:1;
189     unsigned char NOT_RBPU:1;
190   };
191 } __OPTION_REG_bits_t;
192 extern volatile __OPTION_REG_bits_t __at(OPTION_REG_ADDR) OPTION_REG_bits;
193
194 #ifndef NO_BIT_DEFINES
195 #define PS0                  OPTION_REG_bits.PS0
196 #define PS1                  OPTION_REG_bits.PS1
197 #define PS2                  OPTION_REG_bits.PS2
198 #define PSA                  OPTION_REG_bits.PSA
199 #define T0SE                 OPTION_REG_bits.T0SE
200 #define T0CS                 OPTION_REG_bits.T0CS
201 #define INTEDG               OPTION_REG_bits.INTEDG
202 #define NOT_RBPU             OPTION_REG_bits.NOT_RBPU
203 #endif /* NO_BIT_DEFINES */
204
205 // ----- PCON bits --------------------
206 typedef union {
207   struct {
208     unsigned char :1;
209     unsigned char NOT_POR:1;
210     unsigned char :1;
211     unsigned char :1;
212     unsigned char :1;
213     unsigned char :1;
214     unsigned char :1;
215     unsigned char :1;
216   };
217 } __PCON_bits_t;
218 extern volatile __PCON_bits_t __at(PCON_ADDR) PCON_bits;
219
220 #ifndef NO_BIT_DEFINES
221 #define NOT_POR              PCON_bits.NOT_POR
222 #endif /* NO_BIT_DEFINES */
223
224 // ----- PORTA bits --------------------
225 typedef union {
226   struct {
227     unsigned char RA0:1;
228     unsigned char RA1:1;
229     unsigned char RA2:1;
230     unsigned char RA3:1;
231     unsigned char RA4:1;
232     unsigned char RA5:1;
233     unsigned char :1;
234     unsigned char :1;
235   };
236 } __PORTA_bits_t;
237 extern volatile __PORTA_bits_t __at(PORTA_ADDR) PORTA_bits;
238
239 #ifndef NO_BIT_DEFINES
240 #define RA0                  PORTA_bits.RA0
241 #define RA1                  PORTA_bits.RA1
242 #define RA2                  PORTA_bits.RA2
243 #define RA3                  PORTA_bits.RA3
244 #define RA4                  PORTA_bits.RA4
245 #define RA5                  PORTA_bits.RA5
246 #endif /* NO_BIT_DEFINES */
247
248 // ----- PORTB bits --------------------
249 typedef union {
250   struct {
251     unsigned char RB0:1;
252     unsigned char RB1:1;
253     unsigned char RB2:1;
254     unsigned char RB3:1;
255     unsigned char RB4:1;
256     unsigned char RB5:1;
257     unsigned char RB6:1;
258     unsigned char RB7:1;
259   };
260 } __PORTB_bits_t;
261 extern volatile __PORTB_bits_t __at(PORTB_ADDR) PORTB_bits;
262
263 #ifndef NO_BIT_DEFINES
264 #define RB0                  PORTB_bits.RB0
265 #define RB1                  PORTB_bits.RB1
266 #define RB2                  PORTB_bits.RB2
267 #define RB3                  PORTB_bits.RB3
268 #define RB4                  PORTB_bits.RB4
269 #define RB5                  PORTB_bits.RB5
270 #define RB6                  PORTB_bits.RB6
271 #define RB7                  PORTB_bits.RB7
272 #endif /* NO_BIT_DEFINES */
273
274 // ----- STATUS bits --------------------
275 typedef union {
276   struct {
277     unsigned char C:1;
278     unsigned char DC:1;
279     unsigned char Z:1;
280     unsigned char NOT_PD:1;
281     unsigned char NOT_TO:1;
282     unsigned char RP0:1;
283     unsigned char RP1:1;
284     unsigned char IRP:1;
285   };
286 } __STATUS_bits_t;
287 extern volatile __STATUS_bits_t __at(STATUS_ADDR) STATUS_bits;
288
289 #ifndef NO_BIT_DEFINES
290 #define C                    STATUS_bits.C
291 #define DC                   STATUS_bits.DC
292 #define Z                    STATUS_bits.Z
293 #define NOT_PD               STATUS_bits.NOT_PD
294 #define NOT_TO               STATUS_bits.NOT_TO
295 #define RP0                  STATUS_bits.RP0
296 #define RP1                  STATUS_bits.RP1
297 #define IRP                  STATUS_bits.IRP
298 #endif /* NO_BIT_DEFINES */
299
300 // ----- TRISA bits --------------------
301 typedef union {
302   struct {
303     unsigned char TRISA0:1;
304     unsigned char TRISA1:1;
305     unsigned char TRISA2:1;
306     unsigned char TRISA3:1;
307     unsigned char TRISA4:1;
308     unsigned char TRISA5:1;
309     unsigned char :1;
310     unsigned char :1;
311   };
312 } __TRISA_bits_t;
313 extern volatile __TRISA_bits_t __at(TRISA_ADDR) TRISA_bits;
314
315 #ifndef NO_BIT_DEFINES
316 #define TRISA0               TRISA_bits.TRISA0
317 #define TRISA1               TRISA_bits.TRISA1
318 #define TRISA2               TRISA_bits.TRISA2
319 #define TRISA3               TRISA_bits.TRISA3
320 #define TRISA4               TRISA_bits.TRISA4
321 #define TRISA5               TRISA_bits.TRISA5
322 #endif /* NO_BIT_DEFINES */
323
324 // ----- TRISB bits --------------------
325 typedef union {
326   struct {
327     unsigned char TRISB0:1;
328     unsigned char TRISB1:1;
329     unsigned char TRISB2:1;
330     unsigned char TRISB3:1;
331     unsigned char TRISB4:1;
332     unsigned char TRISB5:1;
333     unsigned char TRISB6:1;
334     unsigned char TRISB7:1;
335   };
336 } __TRISB_bits_t;
337 extern volatile __TRISB_bits_t __at(TRISB_ADDR) TRISB_bits;
338
339 #ifndef NO_BIT_DEFINES
340 #define TRISB0               TRISB_bits.TRISB0
341 #define TRISB1               TRISB_bits.TRISB1
342 #define TRISB2               TRISB_bits.TRISB2
343 #define TRISB3               TRISB_bits.TRISB3
344 #define TRISB4               TRISB_bits.TRISB4
345 #define TRISB5               TRISB_bits.TRISB5
346 #define TRISB6               TRISB_bits.TRISB6
347 #define TRISB7               TRISB_bits.TRISB7
348 #endif /* NO_BIT_DEFINES */
349
350 #endif