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 |
Wolfgang Denk | c57eadc | 2013-07-28 22:12:47 +0200 | [diff] [blame] | 19 | * SPDX-License-Identifier: BSD-3-Clause |
Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 20 | * @par |
| 21 | * -- End of Copyright Notice -- |
| 22 | */ |
| 23 | |
| 24 | |
| 25 | #ifndef IxOsalEndianess_H |
| 26 | #define IxOsalEndianess_H |
| 27 | |
| 28 | #if defined (__vxworks) || defined (__linux) |
| 29 | |
| 30 | /* get ntohl/ntohs/htohl/htons macros and CPU definitions for VxWorks */ |
| 31 | /* #include <netinet/in.h> */ |
| 32 | |
| 33 | #elif defined (__wince) |
| 34 | |
| 35 | /* get ntohl/ntohs/htohl/htons macros definitions for WinCE */ |
| 36 | #include <Winsock2.h> |
| 37 | |
| 38 | #else |
| 39 | |
| 40 | #error Unknown OS, please add a section with the include file for htonl/htons/ntohl/ntohs |
| 41 | |
| 42 | #endif /* vxworks or linux or wince */ |
| 43 | |
| 44 | /* Compiler specific endianness selector - WARNING this works only with arm gcc, use appropriate defines with diab */ |
| 45 | |
| 46 | #ifndef __wince |
| 47 | |
| 48 | #if defined (__ARMEL__) |
| 49 | |
| 50 | #ifndef __LITTLE_ENDIAN |
| 51 | |
| 52 | #define __LITTLE_ENDIAN |
| 53 | |
| 54 | #endif /* _LITTLE_ENDIAN */ |
| 55 | |
| 56 | #elif defined (__ARMEB__) || CPU == SIMSPARCSOLARIS |
| 57 | |
| 58 | #ifndef __BIG_ENDIAN |
| 59 | |
| 60 | #define __BIG_ENDIAN |
| 61 | |
| 62 | #endif /* __BIG_ENDIAN */ |
| 63 | |
| 64 | #else |
| 65 | |
| 66 | #error Error, could not identify target endianness |
| 67 | |
| 68 | #endif /* endianness selector no WinCE OSes */ |
| 69 | |
| 70 | #else /* ndef __wince */ |
| 71 | |
| 72 | #define __LITTLE_ENDIAN |
| 73 | |
| 74 | #endif /* def __wince */ |
| 75 | |
| 76 | |
| 77 | /* OS mode selector */ |
| 78 | #if defined (__vxworks) && defined (__LITTLE_ENDIAN) |
| 79 | |
| 80 | #define IX_OSAL_VXWORKS_LE |
| 81 | |
| 82 | #elif defined (__vxworks) && defined (__BIG_ENDIAN) |
| 83 | |
| 84 | #define IX_OSAL_VXWORKS_BE |
| 85 | |
| 86 | #elif defined (__linux) && defined (__BIG_ENDIAN) |
| 87 | |
| 88 | #define IX_OSAL_LINUX_BE |
| 89 | |
| 90 | #elif defined (__linux) && defined (__LITTLE_ENDIAN) |
| 91 | |
| 92 | #define IX_OSAL_LINUX_LE |
| 93 | |
| 94 | #elif defined (BOOTLOADER_BLD) && defined (__LITTLE_ENDIAN) |
| 95 | |
| 96 | #define IX_OSAL_EBOOT_LE |
| 97 | |
| 98 | #elif defined (__wince) && defined (__LITTLE_ENDIAN) |
| 99 | |
| 100 | #define IX_OSAL_WINCE_LE |
| 101 | |
| 102 | #else |
| 103 | |
| 104 | #error Unknown OS/Endianess combination - only vxWorks BE LE, Linux BE LE, WinCE BE LE are supported |
| 105 | |
| 106 | #endif /* mode selector */ |
| 107 | |
| 108 | |
| 109 | |
| 110 | #endif /* IxOsalEndianess_H */ |