* .version: bumped version to 2.5.6 (pic14 ABI changed)
[fw/sdcc] / 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 V1.6
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 #pragma memmap INDF_ADDR INDF_ADDR SFR 0x000    // INDF
47 #pragma memmap TMR0_ADDR TMR0_ADDR SFR 0x000    // TMR0
48 #pragma memmap PCL_ADDR PCL_ADDR SFR 0x000      // PCL
49 #pragma memmap STATUS_ADDR STATUS_ADDR SFR 0x000        // STATUS
50 #pragma memmap FSR_ADDR FSR_ADDR SFR 0x000      // FSR
51 #pragma memmap PORTA_ADDR PORTA_ADDR SFR 0x000  // PORTA
52 #pragma memmap PORTB_ADDR PORTB_ADDR SFR 0x000  // PORTB
53 #pragma memmap PCLATH_ADDR PCLATH_ADDR SFR 0x000        // PCLATH
54 #pragma memmap INTCON_ADDR INTCON_ADDR SFR 0x000        // INTCON
55 #pragma memmap OPTION_REG_ADDR OPTION_REG_ADDR SFR 0x000        // OPTION_REG
56 #pragma memmap TRISA_ADDR TRISA_ADDR SFR 0x000  // TRISA
57 #pragma memmap TRISB_ADDR TRISB_ADDR SFR 0x000  // TRISB
58 #pragma memmap PCON_ADDR PCON_ADDR SFR 0x000    // PCON
59
60
61 //         LIST
62 // P16C558.INC  Standard Header File, Version 1.00    Microchip Technology, Inc.
63 //         NOLIST
64
65 // This header file defines configurations, registers, and other useful bits of
66 // information for the PIC16C558 microcontroller.  These names are taken to match 
67 // the data sheets as closely as possible.  
68
69 // Note that the processor must be selected before this file is 
70 // included.  The processor may be selected the following ways:
71
72 //       1. Command line switch:
73 //               C:\ MPASM MYFILE.ASM /PIC16C558
74 //       2. LIST directive in the source file
75 //               LIST   P=PIC16C558
76 //       3. Processor Type entry in the MPASM full-screen interface
77
78 //==========================================================================
79 //
80 //       Revision History
81 //
82 //==========================================================================
83
84 //Rev:   Date:    Reason:
85
86 //1.00   04/22/96 Initial Creation
87
88 //==========================================================================
89 //
90 //       Verify Processor
91 //
92 //==========================================================================
93
94 //        IFNDEF __16C558
95 //            MESSG "Processor-header file mismatch.  Verify selected processor."
96 //         ENDIF
97
98 //==========================================================================
99 //
100 //       Register Definitions
101 //
102 //==========================================================================
103
104 #define W                    0x0000
105 #define F                    0x0001
106
107 //----- Register Files------------------------------------------------------
108
109 extern data __at (INDF_ADDR) volatile char      INDF;
110 extern sfr  __at (TMR0_ADDR)                    TMR0;
111 extern data __at (PCL_ADDR) volatile char       PCL;
112 extern sfr  __at (STATUS_ADDR)                  STATUS;
113 extern sfr  __at (FSR_ADDR)                     FSR;
114 extern sfr  __at (PORTA_ADDR)                   PORTA;
115 extern sfr  __at (PORTB_ADDR)                   PORTB;
116 extern sfr  __at (PCLATH_ADDR)                  PCLATH;
117 extern sfr  __at (INTCON_ADDR)                  INTCON;
118
119 extern sfr  __at (OPTION_REG_ADDR)              OPTION_REG;
120 extern sfr  __at (TRISA_ADDR)                   TRISA;
121 extern sfr  __at (TRISB_ADDR)                   TRISB;
122 extern sfr  __at (PCON_ADDR)                    PCON;
123
124 //----- STATUS Bits --------------------------------------------------------
125
126
127 //----- INTCON Bits --------------------------------------------------------
128
129
130 //----- OPTION Bits --------------------------------------------------------
131
132
133 //----- PCON Bits ----------------------------------------------------------
134
135
136 //==========================================================================
137 //
138 //       RAM Definition
139 //
140 //==========================================================================
141
142 //         __MAXRAM H'BF'
143 //         __BADRAM H'07'-H'09', H'0C'-H'1F'
144 //         __BADRAM H'87'-H'89', H'8C'-H'8D', H'8F'-H'9F'
145
146 //==========================================================================
147 //
148 //       Configuration Bits
149 //
150 //==========================================================================
151
152 #define _CP_ALL              0x00CF
153 #define _CP_75               0x15DF
154 #define _CP_50               0x2AEF
155 #define _CP_OFF              0x3FFF
156 #define _PWRTE_OFF           0x3FFF
157 #define _PWRTE_ON            0x3FF7
158 #define _WDT_ON              0x3FFF
159 #define _WDT_OFF             0x3FFB
160 #define _LP_OSC              0x3FFC
161 #define _XT_OSC              0x3FFD
162 #define _HS_OSC              0x3FFE
163 #define _RC_OSC              0x3FFF
164
165 //         LIST
166
167 // ----- INTCON bits --------------------
168 typedef union {
169   struct {
170     unsigned char RBIF:1;
171     unsigned char INTF:1;
172     unsigned char T0IF:1;
173     unsigned char RBIE:1;
174     unsigned char INTE:1;
175     unsigned char T0IE:1;
176     unsigned char :1;
177     unsigned char GIE:1;
178   };
179 } __INTCON_bits_t;
180 extern volatile __INTCON_bits_t __at(INTCON_ADDR) INTCON_bits;
181
182 #define RBIF                 INTCON_bits.RBIF
183 #define INTF                 INTCON_bits.INTF
184 #define T0IF                 INTCON_bits.T0IF
185 #define RBIE                 INTCON_bits.RBIE
186 #define INTE                 INTCON_bits.INTE
187 #define T0IE                 INTCON_bits.T0IE
188 #define GIE                  INTCON_bits.GIE
189
190 // ----- OPTION_REG bits --------------------
191 typedef union {
192   struct {
193     unsigned char PS0:1;
194     unsigned char PS1:1;
195     unsigned char PS2:1;
196     unsigned char PSA:1;
197     unsigned char T0SE:1;
198     unsigned char T0CS:1;
199     unsigned char INTEDG:1;
200     unsigned char NOT_RBPU:1;
201   };
202 } __OPTION_REG_bits_t;
203 extern volatile __OPTION_REG_bits_t __at(OPTION_REG_ADDR) OPTION_REG_bits;
204
205 #define PS0                  OPTION_REG_bits.PS0
206 #define PS1                  OPTION_REG_bits.PS1
207 #define PS2                  OPTION_REG_bits.PS2
208 #define PSA                  OPTION_REG_bits.PSA
209 #define T0SE                 OPTION_REG_bits.T0SE
210 #define T0CS                 OPTION_REG_bits.T0CS
211 #define INTEDG               OPTION_REG_bits.INTEDG
212 #define NOT_RBPU             OPTION_REG_bits.NOT_RBPU
213
214 // ----- PCON bits --------------------
215 typedef union {
216   struct {
217     unsigned char :1;
218     unsigned char NOT_POR:1;
219     unsigned char :1;
220     unsigned char :1;
221     unsigned char :1;
222     unsigned char :1;
223     unsigned char :1;
224     unsigned char :1;
225   };
226 } __PCON_bits_t;
227 extern volatile __PCON_bits_t __at(PCON_ADDR) PCON_bits;
228
229 #define NOT_POR              PCON_bits.NOT_POR
230
231 // ----- STATUS bits --------------------
232 typedef union {
233   struct {
234     unsigned char C:1;
235     unsigned char DC:1;
236     unsigned char Z:1;
237     unsigned char NOT_PD:1;
238     unsigned char NOT_TO:1;
239     unsigned char RP0:1;
240     unsigned char RP1:1;
241     unsigned char IRP:1;
242   };
243 } __STATUS_bits_t;
244 extern volatile __STATUS_bits_t __at(STATUS_ADDR) STATUS_bits;
245
246 #define C                    STATUS_bits.C
247 #define DC                   STATUS_bits.DC
248 #define Z                    STATUS_bits.Z
249 #define NOT_PD               STATUS_bits.NOT_PD
250 #define NOT_TO               STATUS_bits.NOT_TO
251 #define RP0                  STATUS_bits.RP0
252 #define RP1                  STATUS_bits.RP1
253 #define IRP                  STATUS_bits.IRP
254
255 #endif