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>
33 * settings to adapt lwIP for compiler and machine architecture
34 * DETAILS: ./lwip/doc/sys_arch.txt
41 /* This file must either include a system-local <errno.h> which defines
42 the standard *nix error codes, or it should #define LWIP_PROVIDE_ERRNO
43 to make lwip/arch.h define the codes which are used throughout. */
44 #define LWIP_PROVIDE_ERRNO
46 /* if the compiler does not provede memset() this file must include a
47 definition of it, or include a file which defines it. */
49 /* type definitions */
52 typedef uint16_t u16_t;
53 typedef int16_t s16_t;
54 typedef uint32_t u32_t;
55 typedef int32_t s32_t;
56 typedef u32_t mem_ptr_t;
58 /*#ifdef __little_endian__
60 #define BYTE_ORDER LITTLE_ENDIAN
63 #define BYTE_ORDER BIG_ENDIAN
66 /* Define (sn)printf formatters for these lwIP types */
75 #if defined(__arm__) && defined(__ARMCC_VERSION)
77 // Setup PACKing macros for KEIL/RVMDK Tools
79 #define PACK_STRUCT_BEGIN __packed
80 #define PACK_STRUCT_STRUCT
81 #define PACK_STRUCT_END
82 #define PACK_STRUCT_FIELD(x) x
83 #elif defined (__IAR_SYSTEMS_ICC__)
85 // Setup PACKing macros for IAR Tools
87 #define PACK_STRUCT_BEGIN
88 #define PACK_STRUCT_STRUCT
89 #define PACK_STRUCT_END
90 #define PACK_STRUCT_FIELD(x) x
91 #define PACK_STRUCT_USE_INCLUDES
92 #elif defined (__TMS470__)
93 #define PACK_STRUCT_BEGIN
94 #define PACK_STRUCT_STRUCT
95 #define PACK_STRUCT_END
96 #define PACK_STRUCT_FIELD(x) x
99 // Setup PACKing macros for GCC Tools
101 #define PACK_STRUCT_BEGIN
102 #define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
103 #define PACK_STRUCT_END
104 #define PACK_STRUCT_FIELD(x) x
108 * 1 - load byte by byte, construct 16 bits word and add: not efficient for most platforms
109 * 2 - load first byte if odd address, loop processing 16 bits words, add last byte.
110 * 3 - load first byte and word if not 4 byte aligned, loop processing 32 bits words, add last word/byte.
114 #ifndef LWIP_CHKSUM_ALGORITHM
115 #define LWIP_CHKSUM_ALGORITHM 2
121 #define LWIP_PLATFORM_DIAG(expr)
123 //extern void __error__(char *pcFilename, unsigned long ulLine);
124 extern int32_t rpp_sci_printf(const char* format, ...);
125 #define LWIP_PLATFORM_ASSERT(expr) rpp_sci_printf((const char *) expr)
130 __error__(__FILE__, __LINE__); \
135 #define LWIP_PLATFORM_ASSERT(expr)
138 /* "lightweight" synchronization mechanisms */
139 /* #define SYS_ARCH_DECL_PROTECT(x) */ /* declare a protection state variable */
140 /* #define SYS_ARCH_PROTECT(x) */ /* enter protection mode */
141 /* #define SYS_ARCH_UNPROTECT(x) */ /* leave protection mode */
143 #endif /* __CC_H__ */