mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 22:51:37 +00:00
cris: introduce asm/swab.h
Adjust the arch overrides to the new names as well. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
5bf431fa32
commit
aa0effbd1c
6 changed files with 44 additions and 45 deletions
|
@ -1,26 +1,30 @@
|
||||||
#ifndef _CRIS_ARCH_BYTEORDER_H
|
#ifndef _CRIS_ARCH_SWAB_H
|
||||||
#define _CRIS_ARCH_BYTEORDER_H
|
#define _CRIS_ARCH_SWAB_H
|
||||||
|
|
||||||
#include <asm/types.h>
|
#include <asm/types.h>
|
||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
|
|
||||||
|
#define __SWAB_64_THRU_32__
|
||||||
|
|
||||||
/* we just define these two (as we can do the swap in a single
|
/* we just define these two (as we can do the swap in a single
|
||||||
* asm instruction in CRIS) and the arch-independent files will put
|
* asm instruction in CRIS) and the arch-independent files will put
|
||||||
* them together into ntohl etc.
|
* them together into ntohl etc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
|
static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
|
||||||
{
|
{
|
||||||
__asm__ ("swapwb %0" : "=r" (x) : "0" (x));
|
__asm__ ("swapwb %0" : "=r" (x) : "0" (x));
|
||||||
|
|
||||||
return(x);
|
return(x);
|
||||||
}
|
}
|
||||||
|
#define __arch_swab32 __arch_swab32
|
||||||
|
|
||||||
static inline __attribute_const__ __u16 ___arch__swab16(__u16 x)
|
static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
|
||||||
{
|
{
|
||||||
__asm__ ("swapb %0" : "=r" (x) : "0" (x));
|
__asm__ ("swapb %0" : "=r" (x) : "0" (x));
|
||||||
|
|
||||||
return(x);
|
return(x);
|
||||||
}
|
}
|
||||||
|
#define __arch_swab16 __arch_swab16
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef _ASM_CRIS_ARCH_BYTEORDER_H
|
|
||||||
#define _ASM_CRIS_ARCH_BYTEORDER_H
|
|
||||||
|
|
||||||
#include <asm/types.h>
|
|
||||||
|
|
||||||
static inline __const__ __u32
|
|
||||||
___arch__swab32(__u32 x)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
|
|
||||||
return (x);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline __const__ __u16
|
|
||||||
___arch__swab16(__u16 x)
|
|
||||||
{
|
|
||||||
__asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
|
|
||||||
return (x);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _ASM_CRIS_ARCH_BYTEORDER_H */
|
|
24
arch/cris/include/arch-v32/arch/swab.h
Normal file
24
arch/cris/include/arch-v32/arch/swab.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef _ASM_CRIS_ARCH_SWAB_H
|
||||||
|
#define _ASM_CRIS_ARCH_SWAB_H
|
||||||
|
|
||||||
|
#include <asm/types.h>
|
||||||
|
|
||||||
|
#define __SWAB_64_THRU_32__
|
||||||
|
|
||||||
|
static inline __const__ __u32
|
||||||
|
__arch_swab32(__u32 x)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
|
||||||
|
return (x);
|
||||||
|
}
|
||||||
|
#define __arch_swab32 __arch_swab32
|
||||||
|
|
||||||
|
static inline __const__ __u16
|
||||||
|
__arch_swab16(__u16 x)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
|
||||||
|
return (x);
|
||||||
|
}
|
||||||
|
#define __arch_swab16 __arch_swab16
|
||||||
|
|
||||||
|
#endif /* _ASM_CRIS_ARCH_SWAB_H */
|
|
@ -9,3 +9,4 @@ header-y += sync_serial.h
|
||||||
|
|
||||||
unifdef-y += etraxgpio.h
|
unifdef-y += etraxgpio.h
|
||||||
unifdef-y += rs485.h
|
unifdef-y += rs485.h
|
||||||
|
unifdef-y += swab.h
|
||||||
|
|
|
@ -1,25 +1,7 @@
|
||||||
#ifndef _CRIS_BYTEORDER_H
|
#ifndef _CRIS_BYTEORDER_H
|
||||||
#define _CRIS_BYTEORDER_H
|
#define _CRIS_BYTEORDER_H
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#include <asm/swab.h>
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
#include <arch/byteorder.h>
|
|
||||||
|
|
||||||
/* defines are necessary because the other files detect the presence
|
|
||||||
* of a defined __arch_swab32, not an inline
|
|
||||||
*/
|
|
||||||
#define __arch__swab32(x) ___arch__swab32(x)
|
|
||||||
#define __arch__swab16(x) ___arch__swab16(x)
|
|
||||||
#endif /* __KERNEL__ */
|
|
||||||
|
|
||||||
#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
|
|
||||||
# define __BYTEORDER_HAS_U64__
|
|
||||||
# define __SWAB_64_THRU_32__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
|
|
||||||
#include <linux/byteorder/little_endian.h>
|
#include <linux/byteorder/little_endian.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
8
arch/cris/include/asm/swab.h
Normal file
8
arch/cris/include/asm/swab.h
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef _CRIS_SWAB_H
|
||||||
|
#define _CRIS_SWAB_H
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
#include <arch/swab.h>
|
||||||
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
|
#endif /* _CRIS_SWAB_H */
|
Loading…
Add table
Add a link
Reference in a new issue