1 |
/*********************************************************************
|
2 |
*
|
3 |
* Compiler and hardware specific definitions
|
4 |
*
|
5 |
*********************************************************************
|
6 |
* FileName: Compiler.h
|
7 |
* Dependencies: None
|
8 |
* Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F
|
9 |
* Complier: Microchip C18 v3.02 or higher
|
10 |
* Microchip C30 v2.01 or higher
|
11 |
* Company: Microchip Technology, Inc.
|
12 |
*
|
13 |
* Software License Agreement
|
14 |
*
|
15 |
* Copyright © 2002-2007 Microchip Technology Inc. All rights
|
16 |
* reserved.
|
17 |
*
|
18 |
* Microchip licenses to you the right to use, modify, copy, and
|
19 |
* distribute:
|
20 |
* (i) the Software when embedded on a Microchip microcontroller or
|
21 |
* digital signal controller product (“Device”) which is
|
22 |
* integrated into Licensee’s product; or
|
23 |
* (ii) ONLY the Software driver source files ENC28J60.c and
|
24 |
* ENC28J60.h ported to a non-Microchip device used in
|
25 |
* conjunction with a Microchip ethernet controller for the
|
26 |
* sole purpose of interfacing with the ethernet controller.
|
27 |
*
|
28 |
* You should refer to the license agreement accompanying this
|
29 |
* Software for additional information regarding your rights and
|
30 |
* obligations.
|
31 |
*
|
32 |
* THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT
|
33 |
* WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
|
34 |
* LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
|
35 |
* PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
36 |
* MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
|
37 |
* CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
|
38 |
* PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
|
39 |
* BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
|
40 |
* THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
|
41 |
* SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
|
42 |
* (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
|
43 |
*
|
44 |
*
|
45 |
* Author Date Comment
|
46 |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
47 |
* Howard Schlunder 10/03/2006 Original, copied from old Compiler.h
|
48 |
********************************************************************/
|
49 |
#ifndef __COMPILER_H
|
50 |
#define __COMPILER_H
|
51 |
|
52 |
// Include proper device header file
|
53 |
// INSTR_FREQ is used to calculate Tick counter value, set UART
|
54 |
// baud rate, etc. based on CLOCK_FREQ, defined in
|
55 |
// (HardwareProfile.h)
|
56 |
#if defined(__18CXX) || defined(HI_TECH_C)
|
57 |
// All PIC18 processors
|
58 |
#if defined(HI_TECH_C) // HI TECH PICC-18 compiler
|
59 |
#define __18CXX
|
60 |
#include <pic18.h>
|
61 |
#else // Microchip C18 compiler
|
62 |
#include <p18cxxx.h>
|
63 |
#endif
|
64 |
#define INSTR_FREQ (CLOCK_FREQ/4)
|
65 |
#elif defined(__PIC24F__) // Microchip C30 compiler
|
66 |
// PIC24F processor
|
67 |
#include <p24Fxxxx.h>
|
68 |
#define INSTR_FREQ (CLOCK_FREQ/2)
|
69 |
#elif defined(__PIC24H__) // Microchip C30 compiler
|
70 |
// PIC24H processor
|
71 |
#include <p24Hxxxx.h>
|
72 |
#define INSTR_FREQ (CLOCK_FREQ/2)
|
73 |
#elif defined(__dsPIC33F__) // Microchip C30 compiler
|
74 |
// dsPIC33F processor
|
75 |
#include <p33Fxxxx.h>
|
76 |
#define INSTR_FREQ (CLOCK_FREQ/2)
|
77 |
#elif defined(__dsPIC30F__) // Microchip C30 compiler
|
78 |
// dsPIC30F processor
|
79 |
#include <p30fxxxx.h>
|
80 |
#define INSTR_FREQ (CLOCK_FREQ/4)
|
81 |
#else
|
82 |
#error Unknown processor or compiler. See Compiler.h
|
83 |
#endif
|
84 |
|
85 |
#include <stdio.h>
|
86 |
#include <stdlib.h>
|
87 |
#include <string.h>
|
88 |
|
89 |
#if defined(__18CXX) && !defined(HI_TECH_C)
|
90 |
#define ROM rom
|
91 |
#define strcpypgm2ram(a, b) strcpypgm2ram(a,(far rom char*)b)
|
92 |
#elif defined(__18CXX) && defined(HI_TECH_C)
|
93 |
#define ROM const
|
94 |
#define rom
|
95 |
#define Nop() asm("NOP");
|
96 |
#define Reset() asm("RESET");
|
97 |
#define memcmppgm2ram(a,b,c) memcmp(a,b,c)
|
98 |
#define memcpypgm2ram(a,b,c) memcpy(a,b,c)
|
99 |
#define strcpypgm2ram(a,b) strcpy(a,b)
|
100 |
#define strcpypgm2ram(a,b) strcpy(a,b)
|
101 |
#define strncpypgm2ram(a,b,c) strncpy(a,b,c)
|
102 |
#define strstrrampgm(a,b) strstr(a,b)
|
103 |
#define strlenpgm(a) strlen(a)
|
104 |
#define strchrpgm(a,b) strchr(a,b)
|
105 |
#define strcatpgm2ram(a,b) strcat(a,b)
|
106 |
#endif
|
107 |
|
108 |
#if defined(__18CXX)
|
109 |
#define __attribute__(a)
|
110 |
|
111 |
#if defined(__18F8720) || defined(__18F87J10) || defined(__18F97J60)
|
112 |
#define TXSTAbits TXSTA1bits
|
113 |
#define TXREG TXREG1
|
114 |
#define TXSTA TXSTA1
|
115 |
#define RCSTA RCSTA1
|
116 |
#define SPBRG SPBRG1
|
117 |
#define RCREG RCREG1
|
118 |
#define SPICON SSP1CON1
|
119 |
#define SPISTATbits SPI1STATbits
|
120 |
#endif
|
121 |
|
122 |
#elif defined(__C30__)
|
123 |
#define ROM const
|
124 |
#define memcmppgm2ram(a,b,c) memcmp(a,b,c)
|
125 |
#define memcpypgm2ram(a,b,c) memcpy(a,b,c)
|
126 |
#define strcpypgm2ram(a, b) strcpy(a,b)
|
127 |
#define strncpypgm2ram(a,b,c) strncpy(a,b,c)
|
128 |
#define strlenpgm(a) strlen(a)
|
129 |
#define strstrrampgm(a,b) strstr(a,b)
|
130 |
#define strchrpgm(a,b) strchr(a,b)
|
131 |
#define strcatpgm2ram(a,b) strcat(a,b)
|
132 |
#define Reset() asm("reset")
|
133 |
|
134 |
#if defined(__dsPIC33F__) || defined(__PIC24H__)
|
135 |
#define AD1PCFGbits AD1PCFGLbits
|
136 |
#define AD1CHS AD1CHS0
|
137 |
#elif defined(__dsPIC30F__)
|
138 |
#define ADC1BUF0 ADCBUF0
|
139 |
#define AD1CHS ADCHS
|
140 |
#define AD1CON1 ADCON1
|
141 |
#define AD1CON2 ADCON2
|
142 |
#define AD1CON3 ADCON3
|
143 |
#define AD1PCFGbits ADPCFGbits
|
144 |
#define AD1CSSL ADCSSL
|
145 |
#define AD1IF ADIF
|
146 |
#define AD1IE ADIE
|
147 |
#define _ADC1Interrupt _ADCInterrupt
|
148 |
#endif
|
149 |
#endif
|
150 |
|
151 |
|
152 |
|
153 |
#endif
|