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