Subject: Re: /dev/io - what, why and how? :)
To: Mike Long <mike.long@analog.com>
From: Phil Knaack <flipk@ncremp.ag.iastate.edu>
List: port-i386
Date: 05/22/1996 17:18:28
oper@mikrobitti.fi writes:
>>A friend of mine is trying to get a DigiBoard serial card working on
>>NetBSD. He would like to peek the UART registers to see what is going
>>on with them.
>>Is it possible to use /dev/io to read (and write?) i386 IO space
>>registers? If so, how?
Mike Long writes:
>First: AFAIK, use of /dev/io is discouraged; you should use the
>functions (e.g. ioperm()) in libi386.a instead.
>/dev/io is similar to /dev/mem, except that it accesses the x86 I/O
>space instead of memory. To use /dev/io, use something like:
< [ using lseek() to seek within /dev/io ]
Actually, the way I had understood it was that if you merely open()
/dev/io, then your process was then allowed to use the assembly-level
inb() and outb() macros located in /usr/include/machine/pio.h.
The way that is preferred now is to use i386_get_ioperm() and
i386_set_ioperm() to twiddle bits in a bitmap to allow you to access
specific ports; and _then_ use the inb() and outb() macros in machine/pio.h.
Using the assembler macros is undoubtedly much faster than
doing read's and write's to /dev/io ..
Cheers,
Phil
--
Phillip F Knaack flipk@iastate.edu
Database Programmer, NCREMP Student Development Group
ISU Extension Project Vincent, Iowa State University