]>
git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/net/lwip/lwip-sys/arch/cc.h
2 * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
27 * This file is part of the lwIP TCP/IP stack.
29 * Author: Adam Dunkels <adam@sics.se>
37 /* Types based on stdint.h */
40 typedef uint16_t u16_t
;
41 typedef int16_t s16_t
;
42 typedef uint32_t u32_t
;
43 typedef int32_t s32_t
;
44 typedef uintptr_t mem_ptr_t
;
46 /* Define (sn)printf formatters for these lwIP types */
55 /* ARM/LPC17xx is little endian only */
56 #define BYTE_ORDER LITTLE_ENDIAN
58 /* Use LWIP error codes */
59 #define LWIP_PROVIDE_ERRNO
61 #if defined(__arm__) && defined(__ARMCC_VERSION)
62 /* Keil uVision4 tools */
63 #define PACK_STRUCT_BEGIN __packed
64 #define PACK_STRUCT_STRUCT
65 #define PACK_STRUCT_END
66 #define PACK_STRUCT_FIELD(fld) fld
67 #define ALIGNED(n) __align(n)
68 #elif defined (__IAR_SYSTEMS_ICC__)
69 /* IAR Embedded Workbench tools */
70 #define PACK_STRUCT_BEGIN __packed
71 #define PACK_STRUCT_STRUCT
72 #define PACK_STRUCT_END
73 #define PACK_STRUCT_FIELD(fld) fld
75 #define ALIGNED(n) _Pragma(IAR_STR(data_alignment= ## n ##))
77 /* GCC tools (CodeSourcery) */
78 #define PACK_STRUCT_BEGIN
79 #define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
80 #define PACK_STRUCT_END
81 #define PACK_STRUCT_FIELD(fld) fld
82 #define ALIGNED(n) __attribute__((aligned (n)))
85 /* Provide Thumb-2 routines for GCC to improve performance */
86 #if defined(TOOLCHAIN_GCC) && defined(__thumb2__)
87 #define MEMCPY(dst,src,len) thumb2_memcpy(dst,src,len)
88 #define LWIP_CHKSUM thumb2_checksum
89 /* Set algorithm to 0 so that unused lwip_standard_chksum function
90 doesn't generate compiler warning */
91 #define LWIP_CHKSUM_ALGORITHM 0
93 void* thumb2_memcpy(void* pDest
, const void* pSource
, size_t length
);
94 u16_t
thumb2_checksum(void* pData
, int length
);
96 /* Used with IP headers only */
97 #define LWIP_CHKSUM_ALGORITHM 1
105 void assert_printf(char *msg
, int line
, char *file
);
107 /* Plaform specific diagnostic output */
108 #define LWIP_PLATFORM_DIAG(vars) printf vars
109 #define LWIP_PLATFORM_ASSERT(flag) { assert_printf((flag), __LINE__, __FILE__); }
111 #define LWIP_PLATFORM_DIAG(msg) { ; }
112 #define LWIP_PLATFORM_ASSERT(flag) { ; }
116 #define LWIP_PLATFORM_HTONS(x) __REV16(x)
117 #define LWIP_PLATFORM_HTONL(x) __REV(x)
119 #endif /* __CC_H__ */