patch-2.1.124 linux/include/asm-sparc/io.h
Next file: linux/include/asm-sparc/ioctls.h
Previous file: linux/include/asm-sparc/hardirq.h
Back to the patch index
Back to the overall index
- Lines: 122
- Date:
Sun Oct 4 10:22:44 1998
- Orig file:
v2.1.123/linux/include/asm-sparc/io.h
- Orig date:
Thu Apr 23 20:21:38 1998
diff -u --recursive --new-file v2.1.123/linux/include/asm-sparc/io.h linux/include/asm-sparc/io.h
@@ -1,4 +1,4 @@
-/* $Id: io.h,v 1.15 1998/01/30 10:59:51 jj Exp $ */
+/* $Id: io.h,v 1.18 1998/09/21 05:07:17 jj Exp $ */
#ifndef __SPARC_IO_H
#define __SPARC_IO_H
@@ -15,77 +15,84 @@
* space only works on sun4's
*/
-extern __inline__ unsigned long inb_local(unsigned long addr)
+#define virt_to_bus virt_to_phys
+
+extern __inline__ unsigned flip_dword (unsigned d) {
+ return ((d&0xff)<<24) | (((d>>8)&0xff)<<16) | (((d>>16)&0xff)<<8)| ((d>>24)&0xff);
+}
+
+extern __inline__ unsigned short flip_word (unsigned short d) {
+ return ((d&0xff) << 8) | ((d>>8)&0xff);
+}
+
+extern __inline__ unsigned long readb(unsigned long addr)
{
- return 0;
+ return *(volatile unsigned char*)addr;
}
-extern __inline__ void outb_local(unsigned char b, unsigned long addr)
+extern __inline__ unsigned long readw(unsigned long addr)
{
- return;
+ return flip_word(*(volatile unsigned short*)addr);
}
-extern __inline__ unsigned long inb(unsigned long addr)
+extern __inline__ unsigned long readl(unsigned long addr)
{
- return 0;
+ return flip_dword(*(volatile unsigned long*)addr);
}
-extern __inline__ unsigned long inw(unsigned long addr)
+extern __inline__ void writeb(unsigned short b, unsigned long addr)
{
- return 0;
+ *(volatile unsigned char*)addr = b;
}
-extern __inline__ unsigned long inl(unsigned long addr)
+extern __inline__ void writew(unsigned short b, unsigned long addr)
{
- return 0;
+ *(volatile unsigned short*)addr = flip_word(b);
}
-extern __inline__ void outb(unsigned char b, unsigned long addr)
+extern __inline__ void writel(unsigned int b, unsigned long addr)
{
- return;
+ *(volatile unsigned long*)addr = flip_dword(b);
}
-extern __inline__ void outw(unsigned short b, unsigned long addr)
+extern __inline__ unsigned long inb_local(unsigned long addr)
{
- return;
+ return readb(addr);
}
-extern __inline__ void outl(unsigned int b, unsigned long addr)
+extern __inline__ void outb_local(unsigned char b, unsigned long addr)
{
- return;
+ return writeb(b,addr);
}
-/*
- * Memory functions
- */
-extern __inline__ unsigned long readb(unsigned long addr)
+extern __inline__ unsigned long inb(unsigned long addr)
{
- return 0;
+ return readb(addr);
}
-extern __inline__ unsigned long readw(unsigned long addr)
+extern __inline__ unsigned long inw(unsigned long addr)
{
- return 0;
+ return readw(addr);
}
-extern __inline__ unsigned long readl(unsigned long addr)
+extern __inline__ unsigned long inl(unsigned long addr)
{
- return 0;
+ return readl(addr);
}
-extern __inline__ void writeb(unsigned short b, unsigned long addr)
+extern __inline__ void outb(unsigned char b, unsigned long addr)
{
- return;
+ return writeb(b,addr);
}
-extern __inline__ void writew(unsigned short b, unsigned long addr)
+extern __inline__ void outw(unsigned short b, unsigned long addr)
{
- return;
+ return writew(b,addr);
}
-extern __inline__ void writel(unsigned int b, unsigned long addr)
+extern __inline__ void outl(unsigned int b, unsigned long addr)
{
- return;
+ return writel(b,addr);
}
#define inb_p inb
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov