Compiler.h

Go to the documentation of this file.
00001 
00002 
00003 
00019 /*********************************************************************
00020  * Software License Agreement
00021  *
00022  * Copyright (C) 2002-2008 Microchip Technology Inc.  All rights 
00023  * reserved.
00024  *
00025  * Microchip licenses to you the right to use, modify, copy, and 
00026  * distribute: 
00027  * (i)  the Software when embedded on a Microchip microcontroller or 
00028  *      digital signal controller product ("Device") which is 
00029  *      integrated into Licensee's product; or
00030  * (ii) ONLY the Software driver source files ENC28J60.c and 
00031  *      ENC28J60.h ported to a non-Microchip device used in 
00032  *      conjunction with a Microchip ethernet controller for the 
00033  *      sole purpose of interfacing with the ethernet controller. 
00034  *
00035  * You should refer to the license agreement accompanying this 
00036  * Software for additional information regarding your rights and 
00037  * obligations.
00038  *
00039  * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT 
00040  * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT 
00041  * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A 
00042  * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL 
00043  * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR 
00044  * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF 
00045  * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS 
00046  * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE 
00047  * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER 
00048  * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT 
00049  * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
00050  *
00051  *
00052  * Author               Date        Comment
00053  *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00054  * Howard Schlunder     10/03/2006  Original, copied from old Compiler.h
00055  * Howard Schlunder     11/07/2007  Reorganized and simplified
00056  ********************************************************************/
00057 #ifndef __COMPILER_H
00058 #define __COMPILER_H
00059 
00060 // Include proper device header file
00061 #if defined(__18CXX) || defined(HI_TECH_C)  
00062     // All PIC18 processors
00063     #if defined(HI_TECH_C)  // HI TECH PICC-18 compiler
00064         #define __18CXX
00065         #include <htc.h>
00066     #else                   // Microchip C18 compiler
00067         #include <p18cxxx.h>
00068     #endif
00069 #elif defined(__PIC24F__)   // Microchip C30 compiler
00070     // PIC24F processor
00071     #include <p24Fxxxx.h>
00072 #elif defined(__PIC24H__)   // Microchip C30 compiler
00073     // PIC24H processor
00074     #include <p24Hxxxx.h>
00075 #elif defined(__dsPIC33F__) // Microchip C30 compiler
00076     // dsPIC33F processor
00077     #include <p33Fxxxx.h>
00078 #elif defined(__dsPIC30F__) // Microchip C30 compiler
00079     // dsPIC30F processor
00080     #include <p30fxxxx.h>
00081 #elif defined(__PIC32MX__)  // Microchip C32 compiler
00082     #if !defined(__C32__)
00083         #define __C32__
00084     #endif
00085     #include <p32xxxx.h>
00086     #include <plib.h>
00087 #else
00088     #error Unknown processor or compiler.  See Compiler.h
00089 #endif
00090 
00091 #include <stdio.h>
00092 #include <stdlib.h>
00093 #include <string.h>
00094 
00095 
00096 // Base RAM and ROM pointer types for given architecture
00097 #if defined(__C32__)
00098     #define PTR_BASE        DWORD
00099     #define ROM_PTR_BASE    DWORD
00100 #elif defined(__C30__)
00101     #define PTR_BASE        WORD
00102     #define ROM_PTR_BASE    WORD
00103 #elif defined(__18CXX)
00104     #define PTR_BASE        WORD
00105     #define ROM_PTR_BASE    unsigned short long
00106 #endif
00107 
00108 
00109 // Definitions that apply to all compilers, except C18
00110 #if !defined(__18CXX) || defined(HI_TECH_C)
00111     #define memcmppgm2ram(a,b,c)    memcmp(a,b,c)
00112     #define strcmppgm2ram(a,b)      strcmp(a,b)
00113     #define memcpypgm2ram(a,b,c)    memcpy(a,b,c)
00114     #define strcpypgm2ram(a,b)      strcpy(a,b)
00115     #define strncpypgm2ram(a,b,c)   strncpy(a,b,c)
00116     #define strstrrampgm(a,b)       strstr(a,b)
00117     #define strlenpgm(a)            strlen(a)
00118     #define strchrpgm(a,b)          strchr(a,b)
00119     #define strcatpgm2ram(a,b)      strcat(a,b)
00120 #endif
00121 
00122 
00123 // Definitions that apply to all 8-bit products
00124 // (PIC18)
00125 #if defined(__18CXX)
00126     #define __attribute__(a)
00127 
00128     #define FAR                         far
00129 
00130     // Microchip C18 specific defines
00131     #if !defined(HI_TECH_C)
00132         #define ROM                     const rom
00133         #define strcpypgm2ram(a, b)     strcpypgm2ram(a,(far rom char*)b)
00134     #endif
00135     
00136     // HI TECH PICC-18 STD specific defines
00137     #if defined(HI_TECH_C)
00138         #define ROM                     const
00139         #define rom
00140         #define Nop()                   asm("NOP");
00141         #define ClrWdt()                asm("CLRWDT");
00142         #define Reset()                 asm("RESET");
00143     #endif
00144     
00145 // Definitions that apply to all 16-bit and 32-bit products
00146 // (PIC24F, PIC24H, dsPIC30F, dsPIC33F, and PIC32)
00147 #else
00148     #define ROM                     const
00149 
00150     // 16-bit specific defines (PIC24F, PIC24H, dsPIC30F, dsPIC33F)
00151     #if defined(__C30__)
00152         #define Reset()             asm("reset")
00153         #define FAR                 __attribute__((far))
00154     #endif
00155 
00156     // 32-bit specific defines (PIC32)
00157     #if defined(__C32__)
00158         #define persistent
00159         #define far
00160         #define FAR
00161         #define Reset()             SoftReset()
00162         #define ClrWdt()            (WDTCONSET = _WDTCON_WDTCLR_MASK)
00163         #define Nop()               asm("nop")
00164     #endif
00165 #endif
00166 
00167 
00168 
00169 #endif

Generated on Sun Nov 27 20:02:38 2011 for eWicht by  doxygen 1.5.5