Tuesday, October 19, 2010

write to port

(1) http://www.faqs.org/docs/Linux-mini/IO-Port-Programming.html

(2) http://ubuntuforums.org/showthread.php?t=1211949

resource 1, we need to change the include file
from
#include <asm/io.h>
to
#include <sys/io.h>

resource 2 is another example of IO programming in C

We also could use in and out assembly instructions to write something to port.
However, in and out instruction have been locked in protected mode.

mov 0xff %al
mov 0xb2 %dx
out %al %dx

write 0xff to port 0xb2

No comments: