NetBSD/sys/arch/sh3/include/bswap.h
itojun 65363da25e Merge in NetBSD/sh3 from cvs.kame.net repository.
Tree structure:
- sys/arch/sh3: sh3 generic code
	As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
1999-09-13 10:30:21 +00:00

51 lines
904 B
C

/* $NetBSD: bswap.h,v 1.1 1999/09/13 10:31:14 itojun Exp $ */
/* Written by Manuel Bouyer. Public domain */
#ifndef _SH3_BSWAP_H_
#define _SH3_BSWAP_H_
#include <sys/cdefs.h>
#ifndef _KERNEL
__BEGIN_DECLS
u_int16_t bswap16 __P((u_int16_t));
u_int32_t bswap32 __P((u_int32_t));
u_int64_t bswap64 __P((u_int64_t));
__END_DECLS
#else /* _KERNEL */
__BEGIN_DECLS
static __inline u_int16_t bswap16 __P((u_int16_t));
static __inline u_int32_t bswap32 __P((u_int32_t));
u_int64_t bswap64 __P((u_int64_t));
__END_DECLS
static __inline u_int16_t
bswap16(x)
u_int16_t x;
{
u_int16_t rval;
__asm __volatile ("swap.b %1,%0" : "=r"(rval) : "r"(x));
return rval;
}
static __inline u_int32_t
bswap32(x)
u_int32_t x;
{
u_int32_t rval;
__asm __volatile ("swap.b %1,%0; swap.w %0,%0; swap.b %0,%0"
: "=r"(rval) : "r"(x));
return rval;
}
#endif /* _KERNEL */
#endif /* _SH3_BSWAP_H_ */