2 * \defgroup uiparch Architecture specific uIP functions
5 * The functions in the architecture specific module implement the IP
6 * check sum and 32-bit additions.
8 * The IP checksum calculation is the most computationally expensive
9 * operation in the TCP/IP stack and it therefore pays off to
10 * implement this in efficient assembler. The purpose of the uip-arch
11 * module is to let the checksum functions to be implemented in
12 * architecture specific assembler.
18 * Declarations of architecture specific functions.
19 * \author Adam Dunkels <adam@dunkels.com>
23 * Copyright (c) 2001, Adam Dunkels.
24 * All rights reserved.
26 * Redistribution and use in source and binary forms, with or without
27 * modification, are permitted provided that the following conditions
29 * 1. Redistributions of source code must retain the above copyright
30 * notice, this list of conditions and the following disclaimer.
31 * 2. Redistributions in binary form must reproduce the above copyright
32 * notice, this list of conditions and the following disclaimer in the
33 * documentation and/or other materials provided with the distribution.
34 * 3. The name of the author may not be used to endorse or promote
35 * products derived from this software without specific prior
38 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
39 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
40 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
41 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
42 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
44 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
45 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
46 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
47 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
48 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 * This file is part of the lwBT stack.
60 #include "processor.h"
62 #define MEM_ALIGNMENT 4
63 #define MEM_ALIGN(mem) ((void*)(((u32_t)(mem)+MEM_ALIGNMENT-1)&~(u32_t)(MEM_ALIGNMENT-1)))
64 #define MEM_ALIGN_SIZE(size) (((size)+MEM_ALIGNMENT-1)&~(u32_t)(MEM_ALIGNMENT-1))
67 #if BYTE_ORDER == BIG_ENDIAN
69 #define htole16 bswap16
72 #define htole32 bswap32
75 #define htole64 bswap64
78 #define le16toh bswap16
81 #define le32toh bswap32
84 #define le64toh bswap64
113 #if LIBC_MEMFUNCREPLACE
114 static __inline__
void __memcpy(void *dest
,const void *src
,s32_t len
)
116 u8_t
*dest0
= (u8_t
*)dest
;
117 u8_t
*src0
= (u8_t
*)src
;
124 static __inline__
void __memset(void *dest
,s32_t c
,s32_t len
)
126 u8_t
*dest0
= (u8_t
*)dest
;
133 #define MEMCPY __memcpy
134 #define MEMSET __memset
136 #define MEMCPY memcpy
137 #define MEMSET memset
142 #define LOG(fmt, ...) fprintf(stderr, "[BTLOG] " __FILE__ ":%i: " fmt "\n", __LINE__, ##__VA_ARGS__)
144 #define LOG(fmt, ...)
145 #endif /* LOGGING == 1 */
149 #define ERROR(fmt,...) fprintf(stderr, "[BTERR] " __FILE__ ":%i: " fmt "\n", __LINE__, ##__VA_ARGS__)
151 #define ERROR(fmt, ...)
152 #endif /* ERRORING == 1 */
156 #endif /* __UIP_ARCH_H__ */