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

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki