summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/arm/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-10-09 22:52:54 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-10-10 09:08:23 +0200
commite599318e912d8836c59d8b5202e3e31a6b8dcae9 (patch)
tree1172b8b830a1c3236e45c834c2b80e01325ea144 /freebsd/sys/arm/include
parentMove files to match FreeBSD layout (diff)
downloadrtems-libbsd-e599318e912d8836c59d8b5202e3e31a6b8dcae9.tar.bz2
Update files to match FreeBSD layout
Add compatibility with Newlib header files. Some FreeBSD header files are mapped by the translation script: o rtems/bsd/sys/_types.h o rtems/bsd/sys/errno.h o rtems/bsd/sys/lock.h o rtems/bsd/sys/param.h o rtems/bsd/sys/resource.h o rtems/bsd/sys/time.h o rtems/bsd/sys/timespec.h o rtems/bsd/sys/types.h o rtems/bsd/sys/unistd.h It is now possible to include <sys/socket.h> directly for example. Generate one Makefile which builds everything including tests.
Diffstat (limited to 'freebsd/sys/arm/include')
-rw-r--r--freebsd/sys/arm/include/machine/cpufunc.h14
-rw-r--r--freebsd/sys/arm/include/machine/in_cksum.h63
-rw-r--r--freebsd/sys/arm/include/machine/legacyvar.h6
3 files changed, 48 insertions, 35 deletions
diff --git a/freebsd/sys/arm/include/machine/cpufunc.h b/freebsd/sys/arm/include/machine/cpufunc.h
index 822fadb1..a4c1bc83 100644
--- a/freebsd/sys/arm/include/machine/cpufunc.h
+++ b/freebsd/sys/arm/include/machine/cpufunc.h
@@ -41,14 +41,15 @@
* $FreeBSD$
*/
-#ifndef _MACHINE_CPUFUNC_HH_
-#define _MACHINE_CPUFUNC_HH_
+#ifndef _MACHINE_CPUFUNC_H_
+#define _MACHINE_CPUFUNC_H_
#ifdef _KERNEL
+#ifndef __rtems__
-#include <freebsd/sys/types.h>
-#include <freebsd/machine/cpuconf.h>
-#include <freebsd/machine/katelib.h> /* For in[bwl] and out[bwl] */
+#include <rtems/bsd/sys/types.h>
+#include <machine/cpuconf.h>
+#include <machine/katelib.h> /* For in[bwl] and out[bwl] */
static __inline void
breakpoint(void)
@@ -612,7 +613,8 @@ extern int arm_pcache_unified;
extern int arm_dcache_align;
extern int arm_dcache_align_mask;
+#endif /* __rtems__ */
#endif /* _KERNEL */
-#endif /* _MACHINE_CPUFUNC_HH_ */
+#endif /* _MACHINE_CPUFUNC_H_ */
/* End of cpufunc.h */
diff --git a/freebsd/sys/arm/include/machine/in_cksum.h b/freebsd/sys/arm/include/machine/in_cksum.h
index 5e3e9333..37d88e2e 100644
--- a/freebsd/sys/arm/include/machine/in_cksum.h
+++ b/freebsd/sys/arm/include/machine/in_cksum.h
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -33,34 +29,49 @@
* from tahoe: in_cksum.c 1.2 86/01/05
* from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
* from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp
+ * from: src/sys/alpha/include/in_cksum.h,v 1.7 2005/03/02 21:33:20 joerg
* $FreeBSD$
*/
-#ifndef _MACHINE_IN_CKSUM_HH_
-#define _MACHINE_IN_CKSUM_HH_ 1
+#ifndef _MACHINE_IN_CKSUM_H_
+#define _MACHINE_IN_CKSUM_H_ 1
-#include <freebsd/sys/cdefs.h>
+#include <sys/cdefs.h>
-#ifdef _KERNEL
-u_short in_cksum(struct mbuf *m, int len);
-u_short in_addword(u_short sum, u_short b);
-u_short in_cksum_skip(struct mbuf *m, int len, int skip);
-u_int do_cksum(const void *, int);
-u_int in_cksum_hdr(const struct ip *);
+#define in_cksum(m, len) in_cksum_skip(m, len, 0)
-static __inline u_short
-in_pseudo(u_int sum, u_int b, u_int c)
+/*
+ * It it useful to have an Internet checksum routine which is inlineable
+ * and optimized specifically for the task of computing IP header checksums
+ * in the normal case (where there are no options and the header length is
+ * therefore always exactly five 32-bit words.
+ */
+#ifdef __CC_SUPPORTS___INLINE
+
+static __inline void
+in_cksum_update(struct ip *ip)
{
- __asm __volatile("adds %0, %0, %1\n"
- "adcs %0, %0, %2\n"
- "adc %0, %0, #0\n"
- : "+r" (sum)
- : "r" (b), "r" (c));
- sum = (sum & 0xffff) + (sum >> 16);
- if (sum > 0xffff)
- sum -= 0xffff;
- return (sum);
+ int __tmpsum;
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256;
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
}
-#endif /* _KERNEL */
-#endif /* _MACHINE_IN_CKSUM_HH_ */
+#else
+
+#define in_cksum_update(ip) \
+ do { \
+ int __tmpsum; \
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256; \
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
+ } while(0)
+
+#endif
+
+#ifdef _KERNEL
+u_int in_cksum_hdr(const struct ip *ip);
+u_short in_addword(u_short sum, u_short b);
+u_short in_pseudo(u_int sum, u_int b, u_int c);
+u_short in_cksum_skip(struct mbuf *m, int len, int skip);
+#endif
+
+#endif /* _MACHINE_IN_CKSUM_H_ */
diff --git a/freebsd/sys/arm/include/machine/legacyvar.h b/freebsd/sys/arm/include/machine/legacyvar.h
index 4771faf5..0b0fa433 100644
--- a/freebsd/sys/arm/include/machine/legacyvar.h
+++ b/freebsd/sys/arm/include/machine/legacyvar.h
@@ -26,8 +26,8 @@
* $FreeBSD$
*/
-#ifndef _MACHINE_LEGACYVAR_HH_
-#define _MACHINE_LEGACYVAR_HH_
+#ifndef _MACHINE_LEGACYVAR_H_
+#define _MACHINE_LEGACYVAR_H_
enum legacy_device_ivars {
LEGACY_IVAR_PCIDOMAIN,
@@ -54,4 +54,4 @@ int legacy_pcib_write_ivar(device_t dev, device_t child, int which,
struct resource *legacy_pcib_alloc_resource(device_t dev, device_t child,
int type, int *rid, u_long start, u_long end, u_long count, u_int flags);
-#endif /* !_MACHINE_LEGACYVAR_HH_ */
+#endif /* !_MACHINE_LEGACYVAR_H_ */