Date: Fri, 19 Apr 1996 08:49:21 -0600 From: Sean Kelly <kelly@fsl.noaa.gov> To: eeg@telecom.at Cc: freebsd-questions@freebsd.org Subject: Re: How can I read/write from/to an I/O-port? Message-ID: <9604191448.AA05057@fslg8.fsl.noaa.gov> In-Reply-To: <317764B2.6DCC0261@telecom.at> (message from Hollerer on Fri, 19 Apr 1996 12:02:26 %2B0200)
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "Franz" == Hollerer <eeg@telecom.at> writes:
Franz> Under Linux a /dev/port exits to write/read to/from an
Franz> I/O-port. Does a similar /dev/??? exits under FreeBSD or
Franz> must I write a little device driver for this?
It exists. First, open /dev/io. Then use inb() and outb() functions
to read and write to the I/O ports:
#include <machine/cpufunc.h>
...
int data;
int fd = open("/dev/io", O_RDWR);
data = inb(0x2a8);
outb(0x3e8, 16);
close(fd);
Looking at the kernel code, it looks like the inb() and outb()
functions are temporary. In the future, I think you'll open /dev/io,
then mmap() or use lseek() and read()/write() to read and write the
ports. But someone on the core team will confirm/deny this.
--
Sean Kelly
NOAA Forecast Systems Laboratory kelly@fsl.noaa.gov
Boulder Colorado USA http://www-sdd.fsl.noaa.gov/~kelly/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9604191448.AA05057>
