]> git.sur5r.net Git - u-boot/blobdiff - include/asm-nios2/io.h
Merge with /home/tur/git/u-boot#motionpro
[u-boot] / include / asm-nios2 / io.h
index b16a98865ad057c94d095efb1bc8af84c7972164..5bb5322952f86884b0b8efe86afe659f9edce66e 100644 (file)
 #ifndef __ASM_NIOS2_IO_H_
 #define __ASM_NIOS2_IO_H_
 
-#define sync() asm volatile ("sync" : : : "memory");
+static inline void sync(void)
+{
+       __asm__ __volatile__ ("sync" : : : "memory");
+}
 
 extern unsigned char inb (unsigned char *port);
 extern unsigned short inw (unsigned short *port);
@@ -39,12 +42,13 @@ extern unsigned inl (unsigned port);
 #define readl(addr)\
        ({unsigned long val;\
         asm volatile( "ldwio %0, 0(%1)" :"=r"(val) : "r" (addr)); val;})
+
 #define writeb(addr,val)\
-       asm volatile ("stbio %0, 0(%1)" : : "r" (addr), "r" (val))
+       asm volatile ("stbio %1, 0(%0)" : : "r" (addr), "r" (val))
 #define writew(addr,val)\
-       asm volatile ("sthio %0, 0(%1)" : : "r" (addr), "r" (val))
+       asm volatile ("sthio %1, 0(%0)" : : "r" (addr), "r" (val))
 #define writel(addr,val)\
-       asm volatile ("stwio %0, 0(%1)" : : "r" (addr), "r" (val))
+       asm volatile ("stwio %1, 0(%0)" : : "r" (addr), "r" (val))
 
 #define inb(addr)      readb(addr)
 #define inw(addr)      readw(addr)