aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/include/asm/swab.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /arch/blackfin/include/asm/swab.h
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'arch/blackfin/include/asm/swab.h')
-rw-r--r--arch/blackfin/include/asm/swab.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/blackfin/include/asm/swab.h b/arch/blackfin/include/asm/swab.h
new file mode 100644
index 00000000000..89de6507ca2
--- /dev/null
+++ b/arch/blackfin/include/asm/swab.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright 2009 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2 or later.
5 */
6
7#ifndef _BLACKFIN_SWAB_H
8#define _BLACKFIN_SWAB_H
9
10#include <linux/types.h>
11#include <asm-generic/swab.h>
12
13#ifdef __GNUC__
14
15static __inline__ __attribute_const__ __u32 __arch_swahb32(__u32 xx)
16{
17 __u32 tmp;
18 __asm__("%1 = %0 >> 8 (V);\n\t"
19 "%0 = %0 << 8 (V);\n\t"
20 "%0 = %0 | %1;\n\t"
21 : "+d"(xx), "=&d"(tmp));
22 return xx;
23}
24#define __arch_swahb32 __arch_swahb32
25
26static __inline__ __attribute_const__ __u32 __arch_swahw32(__u32 xx)
27{
28 __u32 rv;
29 __asm__("%0 = PACK(%1.L, %1.H);\n\t": "=d"(rv): "d"(xx));
30 return rv;
31}
32#define __arch_swahw32 __arch_swahw32
33
34static __inline__ __attribute_const__ __u32 __arch_swab32(__u32 xx)
35{
36 return __arch_swahb32(__arch_swahw32(xx));
37}
38#define __arch_swab32 __arch_swab32
39
40static __inline__ __attribute_const__ __u16 __arch_swab16(__u16 xx)
41{
42 __u32 xw = xx;
43 __asm__("%0 <<= 8;\n %0.L = %0.L + %0.H (NS);\n": "+d"(xw));
44 return (__u16)xw;
45}
46#define __arch_swab16 __arch_swab16
47
48#endif /* __GNUC__ */
49
50#endif /* _BLACKFIN_SWAB_H */