[freenos] r334 committed - Implemented insw() to read words from an I/O port....

  • From: codesite-noreply@xxxxxxxxxx
  • To: freenos@xxxxxxxxxxxxx
  • Date: Thu, 03 Sep 2009 22:51:58 +0000

Revision: 334
Author: nieklinnenbank
Date: Thu Sep  3 15:48:39 2009
Log: Implemented insw() to read words from an I/O port.
This function is currently a macro definition.

http://code.google.com/p/freenos/source/detail?r=334

Modified:
 /trunk/include/X86/CPU.h

=======================================
--- /trunk/include/X86/CPU.h    Wed Jul  8 15:44:39 2009
+++ /trunk/include/X86/CPU.h    Thu Sep  3 15:48:39 2009
@@ -121,6 +121,18 @@
     b; \
 })

+/**
+ * Read a word from a port.
+ * @param port The I/O port to read from.
+ * @return Word read from the port.
+ */
+#define inw(port) \
+({ \
+    unsigned short w; \
+    asm volatile ("inw %%dx, %%ax" : "=a" (w) : "d" (port)); \
+    w; \
+})
+
 /**
  * Output a byte to a port.
  * @param port Port to write to.

Other related posts:

  • » [freenos] r334 committed - Implemented insw() to read words from an I/O port.... - codesite-noreply