00001 /* ---------------------------------------------------------------------------- 00002 * SAM Software Package License 00003 * ---------------------------------------------------------------------------- 00004 * Copyright (c) 2013, Atmel Corporation 00005 * 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions are met: 00010 * 00011 * - Redistributions of source code must retain the above copyright notice, 00012 * this list of conditions and the disclaimer below. 00013 * 00014 * Atmel's name may not be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR 00018 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00020 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00022 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00023 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00024 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00025 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00026 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 * ---------------------------------------------------------------------------- 00028 */ 00029 00030 #ifndef _CC_H 00031 #define _CC_H 00032 00033 #include <string.h> 00034 #include <stdio.h> 00035 #include <stdlib.h> 00036 00037 /* Define platform endianness */ 00038 #define BYTE_ORDER LITTLE_ENDIAN 00039 00040 /* The unsigned data types */ 00041 typedef unsigned char u8_t; 00042 typedef unsigned short u16_t; 00043 typedef unsigned int u32_t; 00044 00045 /* The signed counterparts */ 00046 typedef signed char s8_t; 00047 typedef signed short s16_t; 00048 typedef signed int s32_t; 00049 00050 /* A generic pointer type */ 00051 typedef u32_t mem_ptr_t; 00052 00053 /* Display name of types */ 00054 #define U16_F "hu" 00055 #define S16_F "hd" 00056 #define X16_F "hx" 00057 #define U32_F "u" 00058 #define S32_F "d" 00059 #define X32_F "x" 00060 00061 /* Compiler hints for packing lwip's structures */ 00062 #if defined(__CC_ARM) 00063 /* Setup PACKing macros for MDK Tools */ 00064 #define PACK_STRUCT_BEGIN 00065 #define PACK_STRUCT_STRUCT __attribute__ ((packed)) 00066 #define PACK_STRUCT_END 00067 #define PACK_STRUCT_FIELD(x) x 00068 #elif defined (__ICCARM__) 00069 /* Setup PACKing macros for EWARM Tools */ 00070 #define PACK_STRUCT_BEGIN __packed 00071 #define PACK_STRUCT_STRUCT 00072 #define PACK_STRUCT_END 00073 #define PACK_STRUCT_FIELD(x) x 00074 #elif defined (__GNUC__) 00075 /* Setup PACKing macros for GCC Tools */ 00076 #define PACK_STRUCT_BEGIN 00077 #define PACK_STRUCT_STRUCT __attribute__ ((packed)) 00078 #define PACK_STRUCT_END 00079 #define PACK_STRUCT_FIELD(x) x 00080 #else 00081 #error "This compiler does not support." 00082 #endif 00083 00084 00085 #define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \ 00086 x, __LINE__, __FILE__); exit(1);} while(0) 00087 #endif /* _CC_H */ 00088