Date: Wed, 16 Apr 1997 09:39:03 -0500 From: "Eric L. Hernes" <erich@lodgenet.com> To: Luiz de Barros <luiz@nlink.com.br> Cc: freebsd-hardware@FreeBSD.ORG Subject: Re: talk to I/O Devices. Message-ID: <199704161439.JAA00602@jake.lodgenet.com> In-Reply-To: Your message of "Wed, 16 Apr 1997 10:18:14 -0300." <Pine.BSF.3.91.970416101425.14514I-100000@mirage.nlink.com.br>
next in thread | previous in thread | raw e-mail | index | archive | help
Luiz de Barros writes:
>Dear FreeBSD Experts,
>
>I would like to know how i can talk to an input/output device attached to
>some I/O ports in C. I want something equivalent to outportb and inportb
>from DOS. The board we want to develop is a remote power controller to
>reset our computers in case of a crash. The board will be controlled by
>I/O ports.
#include <machine/cpufunc.h>
#include <fcntl.h>
int
main(int ac, char **av) {
int fd;
if((fd=open("/dev/io", O_RDWR))<0){
perror("/dev/io");
return 1;
}
outb(addr, val);
inb(addr);
outsw(addr, string);
...
return 0;
}
should do it.
>
>Thanks in Advance,
>
>Luiz
>Nlink ISP.
>
eric.
--
erich@rrnet.com http://rrnet.com/~erich
erich@freebsd.org http://www.freebsd.org/~erich
erich@lodgenet.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704161439.JAA00602>
