1 /* 2 * Copyright (c) 2001, Swedish Institute of Computer Science. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the Institute nor the names of its contributors 14 * may be used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * This file is part of the lwIP TCP/IP stack. 30 * 31 * Author: Adam Dunkels <[email protected]> 32 * 33 * $Id: cc.h,v 1.1.1.1 2004/12/16 14:17:13 bear Exp $ 34 */ 35 #ifndef __ARCH_CC_H__ 36 #define __ARCH_CC_H__ 37 38 #include <rthw.h> 39 #include <rtthread.h> 40 41 #define U16_F "hu" 42 #define S16_F "hd" 43 #define X16_F "hx" 44 #define U32_F "lu" 45 #define S32_F "ld" 46 #define X32_F "lx" 47 48 #if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) 49 #include <sys/time.h> 50 #define LWIP_TIMEVAL_PRIVATE 0 51 #else 52 #define LWIP_TIMEVAL_PRIVATE 1 53 #endif 54 55 #if defined(__CC_ARM) /* ARMCC compiler */ 56 #define PACK_STRUCT_FIELD(x) x 57 #define PACK_STRUCT_STRUCT __attribute__ ((__packed__)) 58 #define PACK_STRUCT_BEGIN 59 #define PACK_STRUCT_END 60 #elif defined(__IAR_SYSTEMS_ICC__) /* IAR Compiler */ 61 #define PACK_STRUCT_BEGIN 62 #define PACK_STRUCT_STRUCT 63 #define PACK_STRUCT_END 64 #define PACK_STRUCT_FIELD(x) x 65 #define PACK_STRUCT_USE_INCLUDES 66 #elif defined(__GNUC__) /* GNU GCC Compiler */ 67 #define PACK_STRUCT_FIELD(x) x 68 #define PACK_STRUCT_STRUCT __attribute__((packed)) 69 #define PACK_STRUCT_BEGIN 70 #define PACK_STRUCT_END 71 #elif defined(_MSC_VER) 72 #define PACK_STRUCT_FIELD(x) x 73 #define PACK_STRUCT_STRUCT 74 #define PACK_STRUCT_BEGIN 75 #define PACK_STRUCT_END 76 #endif 77 78 void sys_arch_assert(const char* file, int line); 79 #define LWIP_PLATFORM_DIAG(x) do {rt_kprintf x;} while(0) 80 #define LWIP_PLATFORM_ASSERT(x) do {rt_kprintf(x); sys_arch_assert(__FILE__, __LINE__);}while(0) 81 82 #include "string.h" 83 84 #define SYS_ARCH_DECL_PROTECT(level) 85 #define SYS_ARCH_PROTECT(level) rt_enter_critical() 86 #define SYS_ARCH_UNPROTECT(level) rt_exit_critical() 87 88 #endif /* __ARCH_CC_H__ */ 89 90