Go to the documentation of this file.
11 static inline int in_8(
const volatile unsigned char *
addr)
15 __asm__ __volatile__(
"lbz%U1%X1 %0,%1; twi 0,%0,0; isync"
16 :
"=r" (ret) :
"m" (*addr));
20 static inline void out_8(
volatile unsigned char *
addr,
int val)
22 __asm__ __volatile__(
"stb%U0%X0 %1,%0; sync"
23 :
"=m" (*addr) :
"r" (val));
26 static inline unsigned in_le16(
const volatile u16 *addr)
30 __asm__ __volatile__(
"lhbrx %0,0,%1; twi 0,%0,0; isync"
31 :
"=r" (ret) :
"r" (addr),
"m" (*addr));
36 static inline unsigned in_be16(
const volatile u16 *addr)
40 __asm__ __volatile__(
"lhz%U1%X1 %0,%1; twi 0,%0,0; isync"
41 :
"=r" (ret) :
"m" (*addr));
45 static inline void out_le16(
volatile u16 *addr,
int val)
47 __asm__ __volatile__(
"sthbrx %1,0,%2; sync" :
"=m" (*addr)
48 :
"r" (val),
"r" (addr));
51 static inline void out_be16(
volatile u16 *addr,
int val)
53 __asm__ __volatile__(
"sth%U0%X0 %1,%0; sync"
54 :
"=m" (*addr) :
"r" (val));
57 static inline unsigned in_le32(
const volatile unsigned *addr)
61 __asm__ __volatile__(
"lwbrx %0,0,%1; twi 0,%0,0; isync"
62 :
"=r" (ret) :
"r" (addr),
"m" (*addr));
66 static inline unsigned in_be32(
const volatile unsigned *addr)
70 __asm__ __volatile__(
"lwz%U1%X1 %0,%1; twi 0,%0,0; isync"
71 :
"=r" (ret) :
"m" (*addr));
75 static inline void out_le32(
volatile unsigned *addr,
int val)
77 __asm__ __volatile__(
"stwbrx %1,0,%2; sync" :
"=m" (*addr)
78 :
"r" (val),
"r" (addr));
81 static inline void out_be32(
volatile unsigned *addr,
int val)
83 __asm__ __volatile__(
"stw%U0%X0 %1,%0; sync"
84 :
"=m" (*addr) :
"r" (val));
87 static inline void sync(
void)
89 asm volatile(
"sync" : : :
"memory");
92 static inline void eieio(
void)
94 asm volatile(
"eieio" : : :
"memory");
97 static inline void barrier(
void)
99 asm volatile(
"" : : :
"memory");