*BSD News Article 22823


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!swrinde!cs.utexas.edu!uunet!noc.near.net!analog.com!analog.com!nwd2sun2.analog.com!Mike.Long
From: Mike.Long@analog.com (Michael W. Long)
Subject: Re: Looking for a routine.
In-Reply-To: pitts@bigbang.astro.indiana.edu's message of 22 Oct 1993 23:40:08 -0400
Message-ID: <MIKE.LONG.93Oct25184453@cthulhu.analog.com>
Lines: 58
Sender: usenet@analog.com
Reply-To: Mike Long <Mike.Long@Analog.com>
Organization: Analog Devices Inc, Norwood MA, USA
References: <1993Oct23.022017.10698@serval.net.wsu.edu> <CFBzIw.6LI@usenet.ucs.indiana.edu>
Date: Mon, 25 Oct 1993 22:44:53 GMT

In article <CFBzIw.6LI@usenet.ucs.indiana.edu> pitts@bigbang.astro.indiana.edu (Jim Pitts) writes:

>I in my quest to get my Diamond SpeedStar 24 graphics card working I am looking
>at some code from Linux.  This code uses a routine called ioperm like:
>
>void perm_ports(int perm)
>{
>  ioperm(0x3c2, 1, perm);
>  ioperm(0x3cc, 1, perm);
>}
>
>I can find no such routine in FreeBSD.  I notice that it is -also- used
>in the XFree86 distribution of X386/lib/X11/etc/ati.test.c which is
>for the ATI card.  It is used like this:
>
>   ATIExtReg = *((short int *)bios_data + 0x08);
>   ioperm( ATIExtReg, 2, 1 );
>
>I am not sure exactly what this does.  If someone could tell me where to find
>this routine, send me one if they have it, or just tell me what it does so I
>can write my own, I would appreciate it very much.

I would also like to know if *BSD has anything equivalent.

I have a Digicom Connection 96+ modem, which requires that code be downloaded
to to it in order to operate.  A Linux hacker (Ray Burr, ryb@hoggle.oau.org)
wrote a program called smodemdl that uses the ioperm() function to bypass the
Linux serial port driver and access the ports directly.  Doing so is necessary
for the following reason:

PC architecture serial ports are given an 8-byte region in the I/O adress
space; not all of this area is used (for registers, etc.) with a conventional
serial port.  The Digicom modem uses a normally unused port in this space to
control the loading of code into itself.  Obviously, a standard com driver
doesn't know anything about this extra port and what it's for, so using the
serial port driver, no matter what version of UNIX you're running, is not an
option.

The only way I can think of to reproduce this program in NetBSD is to call
ioctl() to gain exclusive access to the serial port (tty) in question, and then
use the /dev/mem interface to access the ports.  I'm still trying to figure out
how /dev/mem works, so I haven't been able to test the feasiblity of this idea
at all.  Regardless of whether it works, it's an ugly solution; among other
things, I would have to hard-code which I/O port addresses correspond to which
com ports.  I would much rather use the UNIX device driver interface instead of
talking to the I/O ports directly; that's what device drivers are for.  I don't
even want to think about writing a full-blown device-driver for this; I would
like to have a user-level solution that wouldn't require any kernel
recompilation to work.

Can anyone help me with this problem?  If you want to look at the code I'm
trying to port, it's on the anonymous ftp site feenix.metronet.com as
/pub/wolfgang/smodemdl.tar.gz.
--
Mike Long                                         Mike.Long@Analog.com
VLSI Design Engineer                              voice: (617)461-4030
Analog Devices, SPD Div.                            FAX: (617)461-3010
Norwood, MA 02062                            *this = !opinion(Analog);