lwip-sys with changes

Fork of lwip-sys by mbed official

Committer:
mbed_official
Date:
Thu Mar 12 14:31:45 2015 +0000
Revision:
15:7d4b24b58e04
Parent:
10:09b0951b1899
Synchronized with git revision 051854181516992fb498d51f9ee6e70cbad9e083

Full URL: https://github.com/mbedmicro/mbed/commit/051854181516992fb498d51f9ee6e70cbad9e083/

Fix ksdk mcu HAL - stopbit

Who changed what in which revision?

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