[comp.unix.sysv386] Need to Address i/o ports directoly HELP!!

yml@grebyn.com (Yermo M. Lamers) (02/14/91)

Here's the situation:

I've got a digital I/O board with some digital outputs and some digital
inputs and this board sits at a given I/O address in my 386 (running SCO
Opendesktop).

I need to write a program that turns on relays and reads stati.
Therefore I need to be able to write bytes out to the I/O port and read
bytes from an adjacent I/O port. (it's a very simple card).

In the SCO unix manuals they described a system for directly accessing
the video boards (EGA, VGA and the like). Is there a way without writing
a device driver to write/read bytes to/from an I/O port?  Has anyone out
there already solved a similar problem?

I've been unable to find a Digital I/O vendor who had a Unix Device
Driver.

Can anyone on the net give me some insights? please?

Any replies will be greatly appreciated. Please send replies to :

yml@grebyn.com


Thanks.

Yermo Lamers
yml@grebyn.com
Wash. D.C. area.

john@jwt.UUCP (John Temples) (02/15/91)

In article <1991Feb14.044524.3106@grebyn.com> yml@grebyn.UUCP (Yermo M. Lamers) writes:
>In the SCO unix manuals they described a system for directly accessing
>the video boards (EGA, VGA and the like). Is there a way without writing
>a device driver to write/read bytes to/from an I/O port?  Has anyone out
>there already solved a similar problem?

ISC and ESIX have ioctl calls documented in display(7): KDADDIO,
KDENABIO, and  MCAIO, though I've never tried using these with
arbitrary addresses not on the video cards.  I just wrote a one-line
device driver:

u.u_ar0[EFL] |= PS_IOPL;

which, when opened, gives you I/O privilege level so you can
read/write any port.  This comes in handy for lots of different
things, like reprogramming keyboard repeat rates, or doing quick-hack
hardware interfaces like you've described above.  Note that this does
subvert some of the OS's protection; use at your own risk, etc.

Of course, on ISC/ESIX, the above doesn't need to be in a device
driver since the u block is writeable.  :(
-- 
John W. Temples -- john@jwt.UUCP (uunet!jwt!john)