RetroArch
uip_arch.h
Go to the documentation of this file.
1 
22 /*
23  * Copyright (c) 2001, Adam Dunkels.
24  * All rights reserved.
25  *
26  * Redistribution and use in source and binary forms, with or without
27  * modification, are permitted provided that the following conditions
28  * are met:
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
36  * written permission.
37  *
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.
49  *
50  * This file is part of the uIP TCP/IP stack.
51  *
52  *
53  */
54 
55 #ifndef __UIP_ARCH_H__
56 #define __UIP_ARCH_H__
57 
58 #include "uip.h"
59 
60 #define UIP_MIN(x,y) (x)<(y)?(x):(y)
61 
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))
65 
66 #define PACK_STRUCT_STRUCT __attribute__((packed))
67 #define PACK_STRUCT_FIELD(x) x
68 #define PACK_STRUCT_BEGIN
69 #define PACK_STRUCT_END
70 
71 #ifndef htons
72 #define htons(x) (x)
73 #endif
74 #ifndef ntohs
75 #define ntohs(x) (x)
76 #endif
77 #ifndef htonl
78 #define htonl(x) (x)
79 #endif
80 #ifndef ntohl
81 #define ntohl(x) (x)
82 #endif
83 
84 struct uip_pbuf;
85 struct uip_ip_addr;
86 
107 
117 u16_t uip_ipchksum(void *dataptr,u16_t len);
118 
120 
135 
136 
137 
138 extern void tcpip_tmr_needed();
139 #define tcp_tmr_needed tcpip_tmr_needed
140 
141 #if UIP_LIBC_MEMFUNCREPLACE
142 static __inline__ void uip_memcpy(void *dest,const void *src,s32_t len)
143 {
144  u8_t *dest0 = (u8_t*)dest;
145  u8_t *src0 = (u8_t*)src;
146 
147  while(len--) {
148  *dest0++ = *src0++;
149  }
150 }
151 
152 static __inline__ void uip_memset(void *dest,s32_t c,s32_t len)
153 {
154  u8_t *dest0 = (u8_t*)dest;
155 
156  while(len--) {
157  *dest0++ = (s8_t)c;
158  }
159 }
160 
161 #define UIP_MEMCPY uip_memcpy
162 #define UIP_MEMSET uip_memset
163 #else
164 #define UIP_MEMCPY memcpy
165 #define UIP_MEMSET memset
166 #endif
167 
170 #endif /* __UIP_ARCH_H__ */
Definition: uip_ip.h:82
s8 s8_t
Definition: cc.h:44
static __inline__ void uip_memcpy(void *dest, const void *src, s32_t len)
Definition: uip_arch.h:142
size_t proto_len
Definition: civetweb.c:11576
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:8418
u16_t uip_ipchksum(void *dataptr, u16_t len)
Definition: uip_arch.c:91
GLenum GLsizei len
Definition: glext.h:7389
Definition: uip_pbuf.h:27
const GLubyte * c
Definition: glext.h:9812
static __inline__ void uip_memset(void *dest, s32_t c, s32_t len)
Definition: uip_arch.h:152
u16_t uip_chksum(u16_t *buf, u32_t len)
Definition: uip_arch.c:46
GLenum src
Definition: glext.h:6980
GLfloat GLfloat p
Definition: glext.h:9809
u8 u8_t
Definition: cc.h:43
const char * proto
Definition: civetweb.c:11575
u16_t uip_chksum_pseudo(struct uip_pbuf *p, struct uip_ip_addr *src, struct uip_ip_addr *dst, u8_t proto, u16_t proto_len)
Definition: uip_arch.c:64
s32 s32_t
Definition: cc.h:48
void tcpip_tmr_needed()
Definition: tcpip.c:232
u16_t uip_ipchksum_pbuf(struct uip_pbuf *p)
Definition: uip_arch.c:96
u32 u32_t
Definition: cc.h:47
GLenum GLenum dst
Definition: glext.h:6980
u16 u16_t
Definition: cc.h:45