lwip-sys with changes

Fork of lwip-sys by mbed official

Committer:
emilmont
Date:
Mon Jul 23 11:52:46 2012 +0000
Revision:
6:2ace1ff71ae6
Parent:
4:dd37867293e7
Child:
8:742ae4a0ca3f
tidyup

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 6:2ace1ff71ae6 1 /*
emilmont 6:2ace1ff71ae6 2 * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
emilmont 6:2ace1ff71ae6 3 * All rights reserved.
emilmont 6:2ace1ff71ae6 4 *
emilmont 6:2ace1ff71ae6 5 * Redistribution and use in source and binary forms, with or without modification,
emilmont 6:2ace1ff71ae6 6 * are permitted provided that the following conditions are met:
emilmont 6:2ace1ff71ae6 7 *
emilmont 6:2ace1ff71ae6 8 * 1. Redistributions of source code must retain the above copyright notice,
emilmont 6:2ace1ff71ae6 9 * this list of conditions and the following disclaimer.
emilmont 6:2ace1ff71ae6 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
emilmont 6:2ace1ff71ae6 11 * this list of conditions and the following disclaimer in the documentation
emilmont 6:2ace1ff71ae6 12 * and/or other materials provided with the distribution.
emilmont 6:2ace1ff71ae6 13 * 3. The name of the author may not be used to endorse or promote products
emilmont 6:2ace1ff71ae6 14 * derived from this software without specific prior written permission.
emilmont 6:2ace1ff71ae6 15 *
emilmont 6:2ace1ff71ae6 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
emilmont 6:2ace1ff71ae6 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
emilmont 6:2ace1ff71ae6 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
emilmont 6:2ace1ff71ae6 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
emilmont 6:2ace1ff71ae6 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
emilmont 6:2ace1ff71ae6 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
emilmont 6:2ace1ff71ae6 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
emilmont 6:2ace1ff71ae6 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
emilmont 6:2ace1ff71ae6 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
emilmont 6:2ace1ff71ae6 25 * OF SUCH DAMAGE.
emilmont 6:2ace1ff71ae6 26 *
emilmont 6:2ace1ff71ae6 27 * This file is part of the lwIP TCP/IP stack.
emilmont 6:2ace1ff71ae6 28 *
emilmont 6:2ace1ff71ae6 29 * Author: Adam Dunkels <adam@sics.se>
emilmont 6:2ace1ff71ae6 30 *
emilmont 6:2ace1ff71ae6 31 */
emilmont 6:2ace1ff71ae6 32 #ifndef __CC_H__
emilmont 6:2ace1ff71ae6 33 #define __CC_H__
emilmont 6:2ace1ff71ae6 34
emilmont 6:2ace1ff71ae6 35 #include <stdint.h>
emilmont 6:2ace1ff71ae6 36
emilmont 6:2ace1ff71ae6 37 /* Types based on stdint.h */
emilmont 6:2ace1ff71ae6 38 typedef uint8_t u8_t;
emilmont 6:2ace1ff71ae6 39 typedef int8_t s8_t;
emilmont 6:2ace1ff71ae6 40 typedef uint16_t u16_t;
emilmont 6:2ace1ff71ae6 41 typedef int16_t s16_t;
emilmont 6:2ace1ff71ae6 42 typedef uint32_t u32_t;
emilmont 6:2ace1ff71ae6 43 typedef int32_t s32_t;
emilmont 6:2ace1ff71ae6 44 typedef uintptr_t mem_ptr_t;
emilmont 6:2ace1ff71ae6 45
emilmont 6:2ace1ff71ae6 46 /* Define (sn)printf formatters for these lwIP types */
emilmont 6:2ace1ff71ae6 47 #define U16_F "hu"
emilmont 6:2ace1ff71ae6 48 #define S16_F "hd"
emilmont 6:2ace1ff71ae6 49 #define X16_F "hx"
emilmont 6:2ace1ff71ae6 50 #define U32_F "lu"
emilmont 6:2ace1ff71ae6 51 #define S32_F "ld"
emilmont 6:2ace1ff71ae6 52 #define X32_F "lx"
emilmont 6:2ace1ff71ae6 53 #define SZT_F "uz"
emilmont 6:2ace1ff71ae6 54
emilmont 6:2ace1ff71ae6 55 /* ARM/LPC17xx is little endian only */
emilmont 6:2ace1ff71ae6 56 #define BYTE_ORDER LITTLE_ENDIAN
emilmont 6:2ace1ff71ae6 57
emilmont 6:2ace1ff71ae6 58 /* Use LWIP error codes */
emilmont 6:2ace1ff71ae6 59 #define LWIP_PROVIDE_ERRNO
emilmont 6:2ace1ff71ae6 60
emilmont 6:2ace1ff71ae6 61 #if defined(__arm__) && defined(__ARMCC_VERSION)
emilmont 6:2ace1ff71ae6 62 /* Keil uVision4 tools */
emilmont 6:2ace1ff71ae6 63 #define PACK_STRUCT_BEGIN __packed
emilmont 6:2ace1ff71ae6 64 #define PACK_STRUCT_STRUCT
emilmont 6:2ace1ff71ae6 65 #define PACK_STRUCT_END
emilmont 6:2ace1ff71ae6 66 #define PACK_STRUCT_FIELD(fld) fld
emilmont 6:2ace1ff71ae6 67 #define ALIGNED(n) __align(n)
emilmont 6:2ace1ff71ae6 68 #elif defined (__IAR_SYSTEMS_ICC__)
emilmont 6:2ace1ff71ae6 69 /* IAR Embedded Workbench tools */
emilmont 6:2ace1ff71ae6 70 #define PACK_STRUCT_BEGIN __packed
emilmont 6:2ace1ff71ae6 71 #define PACK_STRUCT_STRUCT
emilmont 6:2ace1ff71ae6 72 #define PACK_STRUCT_END
emilmont 6:2ace1ff71ae6 73 #define PACK_STRUCT_FIELD(fld) fld
emilmont 6:2ace1ff71ae6 74 // #define PACK_STRUCT_USE_INCLUDES
emilmont 6:2ace1ff71ae6 75 #error NEEDS ALIGNED // FIXME TBD
emilmont 6:2ace1ff71ae6 76 #else
emilmont 6:2ace1ff71ae6 77 /* GCC tools (CodeSourcery) */
emilmont 6:2ace1ff71ae6 78 #define PACK_STRUCT_BEGIN
emilmont 6:2ace1ff71ae6 79 #define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
emilmont 6:2ace1ff71ae6 80 #define PACK_STRUCT_END
emilmont 6:2ace1ff71ae6 81 #define PACK_STRUCT_FIELD(fld) fld
emilmont 6:2ace1ff71ae6 82 #define ALIGNED(n) __attribute__((aligned (n)))
emilmont 6:2ace1ff71ae6 83 #define ALIGNED(n) __align(n)
emilmont 6:2ace1ff71ae6 84 #endif
emilmont 6:2ace1ff71ae6 85
emilmont 6:2ace1ff71ae6 86 /* Used with IP headers only */
emilmont 6:2ace1ff71ae6 87 #define LWIP_CHKSUM_ALGORITHM 1
emilmont 6:2ace1ff71ae6 88
emilmont 6:2ace1ff71ae6 89 #ifdef LWIP_DEBUG
emilmont 6:2ace1ff71ae6 90
emilmont 6:2ace1ff71ae6 91 #include "stdio.h"
emilmont 6:2ace1ff71ae6 92
emilmont 6:2ace1ff71ae6 93 void assert_printf(char *msg, int line, char *file);
emilmont 6:2ace1ff71ae6 94
emilmont 6:2ace1ff71ae6 95 /* Plaform specific diagnostic output */
emilmont 6:2ace1ff71ae6 96 #define LWIP_PLATFORM_DIAG(vars) printf vars
emilmont 6:2ace1ff71ae6 97 #define LWIP_PLATFORM_ASSERT(flag) { assert_printf((flag), __LINE__, __FILE__); }
emilmont 6:2ace1ff71ae6 98 #else
emilmont 6:2ace1ff71ae6 99 #define LWIP_PLATFORM_DIAG(msg) { ; }
emilmont 6:2ace1ff71ae6 100 #define LWIP_PLATFORM_ASSERT(flag) { ; }
emilmont 6:2ace1ff71ae6 101 #endif
emilmont 6:2ace1ff71ae6 102
emilmont 6:2ace1ff71ae6 103 #include "cmsis.h"
emilmont 6:2ace1ff71ae6 104 #define LWIP_PLATFORM_HTONS(x) __REV16(x)
emilmont 6:2ace1ff71ae6 105 #define LWIP_PLATFORM_HTONL(x) __REV(x)
emilmont 6:2ace1ff71ae6 106
emilmont 6:2ace1ff71ae6 107 #endif /* __CC_H__ */