/[H8]/trunk/docs/MCHPStack2.20/Source/Compiler.h
ViewVC logotype

Annotation of /trunk/docs/MCHPStack2.20/Source/Compiler.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (hide annotations) (download)
Tue May 1 08:17:39 2007 UTC (17 years, 1 month ago) by hedin
File MIME type: text/plain
File size: 9546 byte(s)
Removed tcpip stack 4.02 and added tcpip stack 2.20.
1 hedin 62 /*********************************************************************
2     *
3     * Compiler specific defs.
4     *
5     *********************************************************************
6     * FileName: Compiler.h
7     * Dependencies: None
8     * Processor: PIC18
9     * Complier: MCC18 v1.00.50 or higher
10     * HITECH PICC-18 V8.10PL1 or higher
11     * Company: Microchip Technology, Inc.
12     *
13     * Software License Agreement
14     *
15     * The software supplied herewith by Microchip Technology Incorporated
16     * (the “Company”) for its PICmicro® Microcontroller is intended and
17     * supplied to you, the Company’s customer, for use solely and
18     * exclusively on Microchip PICmicro Microcontroller products. The
19     * software is owned by the Company and/or its supplier, and is
20     * protected under applicable copyright laws. All rights are reserved.
21     * Any use in violation of the foregoing restrictions may subject the
22     * user to criminal sanctions under applicable laws, as well as to
23     * civil liability for the breach of the terms and conditions of this
24     * license.
25     *
26     * THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
27     * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
28     * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
29     * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
30     * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
31     * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
32     *
33     *
34     * Author Date Comment
35     *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36     * Nilesh Rajbharti 11/14/01 Original (Rev 1.0)
37     * Nilesh Rajbharti 2/9/02 Cleanup
38     * Nilesh Rajbharti 5/22/02 Rev 2.0 (See version.log for detail)
39     ********************************************************************/
40     #ifndef COMPILER_H
41     #define COMPILER_H
42    
43     #if defined(HI_TECH_C)
44     #if defined(_MPC_)
45     #define HITECH_C18
46     #else
47     #error "Unknown part is selected."
48     #endif
49     #else
50     #if !defined(_WIN32)
51     #define MCHP_C18
52     #endif
53     #endif
54    
55     #if defined(MCHP_C18) && defined(HITECH_C18)
56     #error "Invalid Compiler selection."
57     #endif
58    
59     #if !defined(MCHP_C18) && !defined(HITECH_C18) && !defined(_WIN32)
60     #error "Compiler not supported."
61     #endif
62    
63     #if defined(MCHP_C18)
64     #include <p18cxxx.h> // p18cxxx.h must have current processor
65     // defined.
66     #endif
67    
68     #if defined(HITECH_C18)
69     #include <pic18.h>
70     #include <stdio.h>
71     #endif
72    
73     #include <stdlib.h>
74    
75     /*
76     * Clock frequency value.
77     * This value is used to calculate Tick Counter value
78     */
79     #define CLOCK_FREQ (20000000) // Hz
80    
81    
82    
83     #if defined(MCHP_C18)
84     #define ROM rom
85    
86     #define LATA2 LATAbits.LATA2
87     #define LATA3 LATAbits.LATA3
88     #define LATA4 LATAbits.LATA4
89     #define PORTB_RB5 PORTBbits.RB5
90    
91     #define PORTA_RA4 PORTAbits.RA4
92     #define PORTA_RA5 PORTAbits.RA5
93     #define TRISA_RA2 TRISAbits.TRISA2
94     #define TRISA_RA5 TRISAbits.TRISA5
95    
96     #define TRISC_RC7 TRISCbits.TRISC7
97     #define TRISC_RC6 TRISCbits.TRISC6
98     #define TRISC_RC5 TRISCbits.TRISC5
99     #define TRISC_RC4 TRISCbits.TRISC4
100     #define TRISC_RC3 TRISCbits.TRISC3
101     #define TRISC_RC2 TRISCbits.TRISC2
102     #define TRISC_RC1 TRISCbits.TRISC1
103     #define TRISC_RC0 TRISCbits.TRISC0
104    
105     #define PORTC_RC7 PORTCbits.RC7
106     #define PORTC_RC6 PORTCbits.RC6
107     #define PORTC_RC5 PORTCbits.RC5
108     #define PORTC_RC4 PORTCbits.RC4
109     #define PORTC_RC3 PORTCbits.RC3
110     #define PORTC_RC2 PORTCbits.RC2
111     #define PORTC_RC1 PORTCbits.RC1
112     #define PORTC_RC0 PORTCbits.RC0
113    
114     #define TRISD_RD7 TRISDbits.TRISD7
115     #define TRISD_RD6 TRISDbits.TRISD6
116     #define TRISD_RD5 TRISDbits.TRISD5
117     #define TRISD_RD4 TRISDbits.TRISD4
118     #define TRISD_RD3 TRISDbits.TRISD3
119     #define TRISD_RD2 TRISDbits.TRISD2
120     #define TRISD_RD1 TRISDbits.TRISD1
121     #define TRISD_RD0 TRISDbits.TRISD0
122    
123     #define PORTD_RD7 PORTDbits.RD7
124     #define PORTD_RD6 PORTDbits.RD6
125     #define PORTD_RD5 PORTDbits.RD5
126     #define PORTD_RD4 PORTDbits.RD4
127     #define PORTD_RD3 PORTDbits.RD3
128     #define PORTD_RD2 PORTDbits.RD2
129     #define PORTD_RD1 PORTDbits.RD1
130     #define PORTD_RD0 PORTDbits.RD0
131    
132     #define PORTE_RE2 PORTEbits.RE2
133     #define PORTE_RE1 PORTEbits.RE1
134     #define PORTE_RE0 PORTEbits.RE0
135    
136     #define INTCON_TMR0IE INTCONbits.TMR0IE
137     #define INTCON_TMR0IF INTCONbits.TMR0IF
138     #define INTCON2_RBPU INTCON2bits.RBPU
139    
140     #define T0CON_TMR0ON T0CONbits.TMR0ON
141    
142     #define SSPCON1_WCOL SSPCON1bits.WCOL
143    
144     #define SSPCON2_SEN SSPCON2bits.SEN
145     #define SSPCON2_ACKSTAT SSPCON2bits.ACKSTAT
146     #define SSPCON2_RSEN SSPCON2bits.RSEN
147     #define SSPCON2_RCEN SSPCON2bits.RCEN
148     #define SSPCON2_ACKEN SSPCON2bits.ACKEN
149     #define SSPCON2_PEN SSPCON2bits.PEN
150     #define SSPCON2_ACKDT SSPCON2bits.ACKDT
151    
152     #define SSPSTAT_R_W SSPSTATbits.R_W
153     #define SSPSTAT_BF SSPSTATbits.BF
154    
155     #define INTCON_GIEH INTCONbits.GIEH
156     #define INTCON_GIEL INTCONbits.GIEL
157    
158     #define PIR2_BCLIF PIR2bits.BCLIF
159    
160     #define PIE1_TXIE PIE1bits.TXIE
161     #define PIE1_RCIE PIE1bits.RCIE
162    
163     #define PIR1_RCIF PIR1bits.RCIF
164     #define PIR1_TXIF PIR1bits.TXIF
165    
166    
167     #define TXSTA_TRMT TXSTAbits.TRMT
168     #define TXSTA_BRGH TXSTAbits.BRGH
169    
170     #define RCSTA_CREN RCSTAbits.CREN
171    
172     #define ADCON0_GO ADCON0bits.GO
173     #define ADCON0_ADON ADCON0bits.ADON
174    
175     #define RCON_POR RCONbits.POR
176    
177    
178     #endif
179    
180     #if defined(HITECH_C18)
181     #define ROM const
182    
183     #define memcmppgm2ram(a, b, c) memcmp(a, b, c)
184     #define memcpypgm2ram(a, b, c) mymemcpy(a, b, c)
185     #define itoa(val, string) sprintf(string, "%u", val)
186    
187     extern void *mymemcpy(void * d1, const void * s1, unsigned char n);
188     extern char *strupr(char*);
189    
190     /* Fix for HITECH C */
191     #define TXREG _TXREG
192     static volatile near unsigned char _TXREG @ 0xFAD;
193    
194    
195     #define LATA2 LA2
196     #define LATA3 LA3
197     #define LATA4 LA4
198     #define PORTB_RB5 RB5
199    
200     #define PORTA_RA4 RA4
201     #define PORTA_RA5 RA5
202     #define TRISA_RA2 TRISA2
203     #define TRISA_RA5 TRISA5
204    
205     #define TRISC_RC7 TRISC7
206     #define TRISC_RC6 TRISC6
207     #define TRISC_RC5 TRISC5
208     #define TRISC_RC4 TRISC4
209     #define TRISC_RC3 TRISC3
210     #define TRISC_RC2 TRISC2
211     #define TRISC_RC1 TRISC1
212     #define TRISC_RC0 TRISC0
213    
214     #define PORTC_RC7 RC7
215     #define PORTC_RC6 RC6
216     #define PORTC_RC5 RC5
217     #define PORTC_RC4 RC4
218     #define PORTC_RC3 RC3
219     #define PORTC_RC2 RC2
220     #define PORTC_RC1 RC1
221     #define PORTC_RC0 RC0
222    
223     #define TRISD_RD7 TRISD7
224     #define TRISD_RD6 TRISD6
225     #define TRISD_RD5 TRISD5
226     #define TRISD_RD4 TRISD4
227     #define TRISD_RD3 TRISD3
228     #define TRISD_RD2 TRISD2
229     #define TRISD_RD1 TRISD1
230     #define TRISD_RD0 TRISD0
231    
232     #define PORTD_RD7 RD7
233     #define PORTD_RD6 RD6
234     #define PORTD_RD5 RD5
235     #define PORTD_RD4 RD4
236     #define PORTD_RD3 RD3
237     #define PORTD_RD2 RD2
238     #define PORTD_RD1 RD1
239     #define PORTD_RD0 RD0
240    
241    
242     #define PORTE_RE2 RE2
243     #define PORTE_RE1 RE1
244     #define PORTE_RE0 RE0
245    
246     #define INTCON_TMR0IE TMR0IE
247     #define INTCON_TMR0IF TMR0IF
248     #define INTCON2_RBPU RBPU
249    
250     #define T0CON_TMR0ON TMR0ON
251    
252     #define SSPCON1_WCOL WCOL
253    
254     #define SSPCON2_SEN SEN
255     #define SSPCON2_ACKSTAT ACKSTAT
256     #define SSPCON2_RSEN RSEN
257     #define SSPCON2_RCEN RCEN
258     #define SSPCON2_ACKEN ACKEN
259     #define SSPCON2_PEN PEN
260     #define SSPCON2_ACKDT ACKDT
261    
262     #define SSPSTAT_R_W RW
263     #define SSPSTAT_BF BF
264    
265     #define INTCON_GIEH GIEH
266     #define INTCON_GIEL GIEL
267    
268     #define PIR2_BCLIF BCLIF
269    
270     #define PIE1_TXIE TXIE
271     #define PIE1_RCIE RCIE
272    
273     #define PIR1_TXIF TXIF
274     #define PIR1_RCIF RCIF
275    
276    
277     #define TXSTA_TRMT TRMT
278     #define TXSTA_BRGH BRGH
279    
280     #define RCSTA_CREN CREN
281    
282     #define ADCON0_GO GODONE
283     #define ADCON0_ADON ADON
284    
285    
286     #define Nop() asm("NOP");
287    
288     #define RCON_POR POR
289    
290    
291     #endif
292    
293    
294     #endif

  ViewVC Help
Powered by ViewVC 1.1.20