patch-1.3.4 linux/include/asm-i386/io.h
Next file: linux/include/asm-i386/segment.h
Previous file: linux/include/asm-i386/bitops.h
Back to the patch index
Back to the overall index
- Lines: 35
- Date:
Mon Jun 26 15:39:10 1995
- Orig file:
v1.3.3/linux/include/asm-i386/io.h
- Orig date:
Fri Jun 2 15:56:28 1995
diff -u --recursive --new-file v1.3.3/linux/include/asm-i386/io.h linux/include/asm-i386/io.h
@@ -60,6 +60,34 @@
#define bus_to_virt phys_to_virt
/*
+ * readX/writeX() are used to access memory mapped devices. On some
+ * architectures the memory mapped IO stuff needs to be accessed
+ * differently. On the x86 architecture, we just read/write the
+ * memory location directly.
+ */
+extern inline unsigned long readb(unsigned long addr)
+{ return *(unsigned char *) addr; }
+
+extern inline unsigned long readw(unsigned long addr)
+{ return *(unsigned short *) addr; }
+
+extern inline unsigned long readl(unsigned long addr)
+{ return *(unsigned int *) addr; }
+
+extern inline void writeb(unsigned char b, unsigned long addr)
+{ *(unsigned char *) addr = b; }
+
+extern inline void writew(unsigned short b, unsigned long addr)
+{ *(unsigned short *) addr = b; }
+
+extern inline void writel(unsigned int b, unsigned long addr)
+{ *(unsigned int *) addr = b; }
+
+#define memset_io(a,b,c) memset((void *)(a),(b),(c))
+#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
+#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
+
+/*
* Talk about misusing macros..
*/
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this