Linux - I/O port access


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

#include <stdio.h>
#include <unistd.h>
#include <asm/io.h>

int main()
{

  unsigned char value;
 
  if (ioperm(BASEPORT, 3, 1)) {
     perror("ioperm"); exit(1);
  }

  // Byte schreiben
  outb(0, BASEPORT);

  // Byte lesen
  value = inb(BASEPORT)

  // Freigeben
  if (ioperm(BASEPORT, 3, 0)) {
     perror("ioperm"); exit(1);
  }

}



CLinux
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki