00001 // //////////////////////////////////////////////////////////////////////////// 00002 // //////////////////////////////////////////////////////////////////////////// 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 * Nilesh Rajbharti 5/17/01 Original (Rev 1.0) 00055 * Nilesh Rajbharti 2/9/02 Cleanup 00056 ********************************************************************/ 00057 #ifndef __HELPERS_H 00058 #define __HELPERS_H 00059 00060 00061 #if !defined(__18CXX) || defined(HI_TECH_C) 00062 char *strupr(char* s); 00063 void ultoa(DWORD Value, BYTE* Buffer); 00064 #endif 00065 00066 #if defined(__DEBUG) 00067 #define DebugPrint(a) {putrsUART(a);} 00068 #else 00069 #define DebugPrint(a) 00070 #endif 00071 00072 DWORD GenerateRandomDWORD(void); 00073 void uitoa(WORD Value, BYTE* Buffer); 00074 void UnencodeURL(BYTE* URL); 00075 WORD Base64Decode(BYTE* cSourceData, WORD wSourceLen, BYTE* cDestData, WORD wDestLen); 00076 WORD Base64Encode(BYTE* cSourceData, WORD wSourceLen, BYTE* cDestData, WORD wDestLen); 00077 BOOL StringToIPAddress(BYTE* str, IP_ADDR* IPAddress); 00078 BYTE ReadStringUART(BYTE* Dest, BYTE BufferLen); 00079 BYTE hexatob(WORD_VAL AsciiChars); 00080 BYTE btohexa_high(BYTE b); 00081 BYTE btohexa_low(BYTE b); 00082 signed char stricmppgm2ram(BYTE* a, ROM BYTE* b); 00083 00084 // MODIFIX: Commented out! 00085 #if 0 00086 #if defined(__18CXX) 00087 BOOL ROMStringToIPAddress(ROM BYTE* str, IP_ADDR* IPAddress); 00088 #else 00089 // Non-ROM variant for C30 and C32 00090 #define ROMStringToIPAddress(a,b) StringToIPAddress((BYTE*)a,b) 00091 #endif 00092 #endif 00093 00094 WORD swaps(WORD v); 00095 DWORD swapl(DWORD v); 00096 00097 WORD CalcIPChecksum(BYTE* buffer, WORD len); 00098 WORD CalcIPBufferChecksum(WORD len); 00099 00100 #if defined(__18CXX) 00101 DWORD leftRotateDWORD(DWORD val, BYTE bits); 00102 #else 00103 // Rotations are more efficient in C30 and C32 00104 #define leftRotateDWORD(x, n) (((x) << (n)) | ((x) >> (32-(n)))) 00105 #endif 00106 00107 void FormatNetBIOSName(BYTE Name[16]); 00108 00109 #endif
1.5.5