?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /*********************************************************************
2 *
3 * Compiler and hardware specific definitions
4 *
5 *********************************************************************
6 * FileName: Compiler.h
7 * Dependencies: None
8 * Processor: PIC18, PIC24F, PIC24H, PIC24E, dsPIC30F, dsPIC33F,
9 * dsPIC33E, PIC32
10 * Compiler: Microchip C32 v1.00 or higher
11 * Microchip C30 v3.01 or higher
12 * Microchip C18 v3.13 or higher
13 * HI-TECH PICC-18 PRO 9.63 or higher
14 * Company: Microchip Technology, Inc.
15 *
16 * Software License Agreement
17 *
18 * Copyright (C) 2002-2010 Microchip Technology Inc. All rights
19 * reserved.
20 *
21 * Microchip licenses to you the right to use, modify, copy, and
22 * distribute:
23 * (i) the Software when embedded on a Microchip microcontroller or
24 * digital signal controller product ("Device") which is
25 * integrated into Licensee's product; or
26 * (ii) ONLY the Software driver source files ENC28J60.c and
27 * ENC28J60.h ported to a non-Microchip device used in
28 * conjunction with a Microchip ethernet controller for the
29 * sole purpose of interfacing with the ethernet controller.
30 *
31 * You should refer to the license agreement accompanying this
32 * Software for additional information regarding your rights and
33 * obligations.
34 *
35 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
36 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
37 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
38 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
39 * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
40 * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
41 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
42 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
43 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
44 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
45 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
46 *
47 *
48 * Date Comment
49 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50 * 10/03/2006 Original, copied from old Compiler.h
51 * 11/07/2007 Reorganized and simplified
52 * 03/31/2010 Removed dependency on WORD and DWORD typedefs
53 * 04/14/2010 Added defines to uniquely identify each compiler
54 ********************************************************************/
55 #ifndef __COMPILER_H
56 #define __COMPILER_H
57  
58 // Include proper device header file
59 #if defined(__18CXX) && !defined(HI_TECH_C)
60 // PIC18 processor with Microchip C18 compiler
61 #define COMPILER_MPLAB_C18
62 #include <p18cxxx.h>
63 #elif defined(__PICC18__) && defined(HI_TECH_C)
64 // PIC18 processor with (Microchip) HI-TECH PICC-18 compiler
65 #if !defined(__18CXX)
66 #define __18CXX
67 #endif
68 #define COMPILER_HITECH_PICC18
69 #include <htc.h>
70 #elif (defined(__PIC24F__) || defined(__PIC24FK__)) && defined(__C30__) // Microchip C30 compiler
71 // PIC24F processor
72 #define COMPILER_MPLAB_C30
73 #include <p24Fxxxx.h>
74 #elif defined(__PIC24H__) && defined(__C30__) // Microchip C30 compiler
75 // PIC24H processor
76 #define COMPILER_MPLAB_C30
77 #include <p24Hxxxx.h>
78 #elif defined(__PIC24E__) && defined(__C30__) // Microchip C30 compiler
79 // PIC24E processor
80 #define COMPILER_MPLAB_C30
81 #include <p24Exxxx.h>
82 #elif defined(__dsPIC33F__) && defined(__C30__) // Microchip C30 compiler
83 // dsPIC33F processor
84 #define COMPILER_MPLAB_C30
85 #include <p33Fxxxx.h>
86 #elif defined(__dsPIC33E__) && defined(__C30__) // Microchip C30 compiler
87 // dsPIC33E processor
88 #define COMPILER_MPLAB_C30
89 #include <p33Exxxx.h>
90 #elif defined(__dsPIC30F__) && defined(__C30__) // Microchip C30 compiler
91 // dsPIC30F processor
92 #define COMPILER_MPLAB_C30
93 #include <p30fxxxx.h>
94 #elif defined(__C30__) // Microchip C30 compiler, but targeting "generic-16bit" processor.
95 #define COMPILER_MPLAB_C30
96 #include <p30sim.h>
97 // Define some useful inline assembly functions which are normally in the
98 // processor header files, but absent from the generic p30sim.h file.
99 #if !defined(Nop)
100 #define Nop() __builtin_nop()
101 #define ClrWdt() {__asm__ volatile ("clrwdt");}
102 #define Sleep() {__asm__ volatile ("pwrsav #0");}
103 #define Idle() {__asm__ volatile ("pwrsav #1");}
104 #endif
105 #elif defined(__PIC32MX__) // Microchip C32 compiler
106 #if !defined(__C32__)
107 #define __C32__
108 #endif
109 #define COMPILER_MPLAB_C32
110 #include <p32xxxx.h>
111 #include <plib.h>
112 #else
113 #error Unknown processor or compiler. See Compiler.h
114 #endif
115  
116 #include <stdio.h>
117 #include <stdlib.h>
118 #include <string.h>
119  
120  
121 // Base RAM and ROM pointer types for given architecture
122 #if defined(__PIC32MX__)
123 #define PTR_BASE unsigned long
124 #define ROM_PTR_BASE unsigned long
125 #elif defined(__C30__)
126 #define PTR_BASE unsigned short
127 #define ROM_PTR_BASE unsigned short
128 #elif defined(COMPILER_MPLAB_C18)
129 #define PTR_BASE unsigned short
130 #define ROM_PTR_BASE unsigned short long
131 #elif defined(COMPILER_HITECH_PICC18)
132 #define PTR_BASE unsigned short
133 #define ROM_PTR_BASE unsigned long
134 #endif
135  
136  
137 // Definitions that apply to all except Microchip MPLAB C Compiler for PIC18 MCUs (C18)
138 #if !defined(COMPILER_MPLAB_C18)
139 #define memcmppgm2ram(a,b,c) memcmp(a,b,c)
140 #define strcmppgm2ram(a,b) strcmp(a,b)
141 #define memcpypgm2ram(a,b,c) memcpy(a,b,c)
142 #define strcpypgm2ram(a,b) strcpy(a,b)
143 #define strncpypgm2ram(a,b,c) strncpy(a,b,c)
144 #define strstrrampgm(a,b) strstr(a,b)
145 #define strlenpgm(a) strlen(a)
146 #define strchrpgm(a,b) strchr(a,b)
147 #define strcatpgm2ram(a,b) strcat(a,b)
148 #endif
149  
150  
151 // Definitions that apply to all 8-bit products
152 // (PIC18)
153 #if defined(__18CXX)
154 #define __attribute__(a)
155  
156 #define FAR far
157  
158 // Microchip C18 specific defines
159 #if defined(COMPILER_MPLAB_C18)
160 #define ROM rom
161 #endif
162  
163 // HI TECH PICC-18 specific defines
164 #if defined(COMPILER_HITECH_PICC18)
165 #define ROM const
166 #define rom
167 #define Nop() asm("NOP");
168 #define ClrWdt() asm("CLRWDT");
169 #define Reset() asm("RESET");
170 #endif
171  
172 // Definitions that apply to all 16-bit and 32-bit products
173 // (PIC24F, PIC24H, dsPIC30F, dsPIC33F, and PIC32)
174 #else
175 #define ROM const
176  
177 // 16-bit specific defines (PIC24F, PIC24H, dsPIC30F, dsPIC33F)
178 #if defined(__C30__)
179 #define Reset() asm("reset")
180 #define FAR __attribute__((far))
181 #endif
182  
183 // 32-bit specific defines (PIC32)
184 #if defined(__PIC32MX__)
185 #define persistent
186 #define far
187 #define FAR
188 #define Reset() SoftReset()
189 #define ClrWdt() (WDTCONSET = _WDTCON_WDTCLR_MASK)
190  
191 // MPLAB C Compiler for PIC32 MCUs version 1.04 and below don't have a
192 // Nop() function. However, version 1.05 has Nop() declared as _nop().
193 #if !defined(Nop) && (__C32_VERSION__ <= 104)
194 #define Nop() asm("nop")
195 #endif
196 #endif
197 #endif
198  
199  
200  
201 #endif
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3