00001
00002
00003
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #ifndef __COMPILER_H
00058 #define __COMPILER_H
00059
00060
00061 #if defined(__18CXX) || defined(HI_TECH_C)
00062
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
00071 #include <p24Fxxxx.h>
00072 #elif defined(__PIC24H__) // Microchip C30 compiler
00073
00074 #include <p24Hxxxx.h>
00075 #elif defined(__dsPIC33F__) // Microchip C30 compiler
00076
00077 #include <p33Fxxxx.h>
00078 #elif defined(__dsPIC30F__) // Microchip C30 compiler
00079
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
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
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
00124
00125 #if defined(__18CXX)
00126 #define __attribute__(a)
00127
00128 #define FAR far
00129
00130
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
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
00146
00147 #else
00148 #define ROM const
00149
00150
00151 #if defined(__C30__)
00152 #define Reset() asm("reset")
00153 #define FAR __attribute__((far))
00154 #endif
00155
00156
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