mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-19 06:49:42 +02:00
[adm5120] fix hardware byte swapping to work in little endian mode as well
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7712 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
239f351507
commit
cad5267742
@ -904,12 +904,12 @@ void __init adm5120_swab_test(void)
|
|||||||
u32 t1,t2;
|
u32 t1,t2;
|
||||||
|
|
||||||
t1 = 0x1234;
|
t1 = 0x1234;
|
||||||
t2 = swab16(t1);
|
t2 = __arch__swab16(t1);
|
||||||
printk("hardware swab16 test %s, data:0x%04X, result:0x%04X\n",
|
printk("hardware swab16 test %s, data:0x%04X, result:0x%04X\n",
|
||||||
(t2 == 0x3412) ? "passed" :"failed", t1, t2);
|
(t2 == 0x3412) ? "passed" :"failed", t1, t2);
|
||||||
|
|
||||||
t1 = 0x12345678;
|
t1 = 0x12345678;
|
||||||
t2 = swab32(t1);
|
t2 = __arch__swab32(t1);
|
||||||
printk("hardware swab32 test %s, data:0x%08X, result:0x%08X\n",
|
printk("hardware swab32 test %s, data:0x%08X, result:0x%08X\n",
|
||||||
(t2 == 0x78563412) ? "passed" :"failed", t1, t2);
|
(t2 == 0x78563412) ? "passed" :"failed", t1, t2);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
+static __inline__ __attribute_const__ __u16 ___adm5120__swab16(__u16 x)
|
+static __inline__ __attribute_const__ __u16 ___adm5120__swab16(__u16 x)
|
||||||
+{
|
+{
|
||||||
+ __asm__ (
|
+ __asm__ (
|
||||||
+ " sw %2, 0xC8(%1) \n"
|
+ " sh %2, 0xCA(%1) \n"
|
||||||
+ " lhu %0, 0xCC(%1) \n"
|
+ " lhu %0, 0xCC(%1) \n"
|
||||||
+ : "=r" (x)
|
+ : "=r" (x)
|
||||||
+ : "r" (0xB2000000), "r" (x));
|
+ : "r" (0xB2000000), "r" (x));
|
||||||
|
Loading…
Reference in New Issue
Block a user