Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @file IxOsalEndianess.h (Obsolete file) |
| 3 | * |
| 4 | * @brief Header file for determining system endianess and OS |
| 5 | * |
| 6 | * @par |
| 7 | * @version $Revision: 1.1 |
| 8 | * |
| 9 | * @par |
| 10 | * IXP400 SW Release version 2.0 |
| 11 | * |
| 12 | * -- Copyright Notice -- |
| 13 | * |
| 14 | * @par |
| 15 | * Copyright 2001-2005, Intel Corporation. |
| 16 | * All rights reserved. |
| 17 | * |
| 18 | * @par |
| 19 | * Redistribution and use in source and binary forms, with or without |
| 20 | * modification, are permitted provided that the following conditions |
| 21 | * are met: |
| 22 | * 1. Redistributions of source code must retain the above copyright |
| 23 | * notice, this list of conditions and the following disclaimer. |
| 24 | * 2. Redistributions in binary form must reproduce the above copyright |
| 25 | * notice, this list of conditions and the following disclaimer in the |
| 26 | * documentation and/or other materials provided with the distribution. |
| 27 | * 3. Neither the name of the Intel Corporation nor the names of its contributors |
| 28 | * may be used to endorse or promote products derived from this software |
| 29 | * without specific prior written permission. |
| 30 | * |
| 31 | * @par |
| 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' |
| 33 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 34 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 35 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
| 36 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 40 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 41 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 42 | * SUCH DAMAGE. |
| 43 | * |
| 44 | * @par |
| 45 | * -- End of Copyright Notice -- |
| 46 | */ |
| 47 | |
| 48 | |
| 49 | #ifndef IxOsalEndianess_H |
| 50 | #define IxOsalEndianess_H |
| 51 | |
| 52 | #if defined (__vxworks) || defined (__linux) |
| 53 | |
| 54 | /* get ntohl/ntohs/htohl/htons macros and CPU definitions for VxWorks */ |
| 55 | /* #include <netinet/in.h> */ |
| 56 | |
| 57 | #elif defined (__wince) |
| 58 | |
| 59 | /* get ntohl/ntohs/htohl/htons macros definitions for WinCE */ |
| 60 | #include <Winsock2.h> |
| 61 | |
| 62 | #else |
| 63 | |
| 64 | #error Unknown OS, please add a section with the include file for htonl/htons/ntohl/ntohs |
| 65 | |
| 66 | #endif /* vxworks or linux or wince */ |
| 67 | |
| 68 | /* Compiler specific endianness selector - WARNING this works only with arm gcc, use appropriate defines with diab */ |
| 69 | |
| 70 | #ifndef __wince |
| 71 | |
| 72 | #if defined (__ARMEL__) |
| 73 | |
| 74 | #ifndef __LITTLE_ENDIAN |
| 75 | |
| 76 | #define __LITTLE_ENDIAN |
| 77 | |
| 78 | #endif /* _LITTLE_ENDIAN */ |
| 79 | |
| 80 | #elif defined (__ARMEB__) || CPU == SIMSPARCSOLARIS |
| 81 | |
| 82 | #ifndef __BIG_ENDIAN |
| 83 | |
| 84 | #define __BIG_ENDIAN |
| 85 | |
| 86 | #endif /* __BIG_ENDIAN */ |
| 87 | |
| 88 | #else |
| 89 | |
| 90 | #error Error, could not identify target endianness |
| 91 | |
| 92 | #endif /* endianness selector no WinCE OSes */ |
| 93 | |
| 94 | #else /* ndef __wince */ |
| 95 | |
| 96 | #define __LITTLE_ENDIAN |
| 97 | |
| 98 | #endif /* def __wince */ |
| 99 | |
| 100 | |
| 101 | /* OS mode selector */ |
| 102 | #if defined (__vxworks) && defined (__LITTLE_ENDIAN) |
| 103 | |
| 104 | #define IX_OSAL_VXWORKS_LE |
| 105 | |
| 106 | #elif defined (__vxworks) && defined (__BIG_ENDIAN) |
| 107 | |
| 108 | #define IX_OSAL_VXWORKS_BE |
| 109 | |
| 110 | #elif defined (__linux) && defined (__BIG_ENDIAN) |
| 111 | |
| 112 | #define IX_OSAL_LINUX_BE |
| 113 | |
| 114 | #elif defined (__linux) && defined (__LITTLE_ENDIAN) |
| 115 | |
| 116 | #define IX_OSAL_LINUX_LE |
| 117 | |
| 118 | #elif defined (BOOTLOADER_BLD) && defined (__LITTLE_ENDIAN) |
| 119 | |
| 120 | #define IX_OSAL_EBOOT_LE |
| 121 | |
| 122 | #elif defined (__wince) && defined (__LITTLE_ENDIAN) |
| 123 | |
| 124 | #define IX_OSAL_WINCE_LE |
| 125 | |
| 126 | #else |
| 127 | |
| 128 | #error Unknown OS/Endianess combination - only vxWorks BE LE, Linux BE LE, WinCE BE LE are supported |
| 129 | |
| 130 | #endif /* mode selector */ |
| 131 | |
| 132 | |
| 133 | |
| 134 | #endif /* IxOsalEndianess_H */ |