*BSD News Article 24657


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!haven.umd.edu!news.umbc.edu!europa.eng.gtefsd.com!howland.reston.ans.net!EU.net!sun4nl!tuegate.tue.nl!news.win.tue.nl!wzv.win.tue.nl!gvr.win.tue.nl!guido
From: guido@gvr.win.tue.nl (Guido van Rooij)
Newsgroups: comp.os.386bsd.questions
Subject: Re: [FreeBSD-1.0] How to access io-ports ?
Date: 2 Dec 1993 10:51:50 GMT
Organization: Eindhoven University of Technology, The Netherlands
Lines: 32
Message-ID: <2dkhc6$ckm@wzv.win.tue.nl>
References: <CHD7AB.Bwy@hermes.hrz.uni-bielefeld.de> <hastyCHDJJ1.C9I@netcom.com>
NNTP-Posting-Host: gvr.win.tue.nl

hasty@netcom.com (Amancio Hasty Jr) writes:

>In article <CHD7AB.Bwy@hermes.hrz.uni-bielefeld.de> uphya001@odie.uni-bielefeld.de writes:
>>---
>>
>>Hello!
>>
>>I want to access some AD-, DA-cards from FreeBSD. To implement this I must
>>have access to the io-ports via in and out. 
>>
>>What is the best way to solve this problem. In the case I have to implement ioctls in the kernel, who is able to give me a small and simple example program?
>>

>This code fragment will give you access to the i/o ports;however,
>it does have the unfortunate effect that will change your key
>board input/output to X mode. This problem can be easily fix by
[method deleted]
As I mentioned in an earlier posting there is a *much* better solution.
I am sure this works in FreeBSD, but as far as I know, the same method also 
works for NetBSD. You can easily check this in /sys/arch/i386/i386/mem.c
in the mmopen() function. Just for which minor the IOPL flag is set.

In FreeBSD, all you have to do is open("/dev/io",O_RDWR), where
/dev/io is a major 2 minor 14 character device. That will do the trick
without any side effects.

-Guido
-- 
Guido van Rooij                 |  Internet: guido@gvr.win.tue.nl
Bisschopsmolen 16               |  Phone:    ++31.40.461433
5612 DS Eindhoven               |  ((12+144+20)+3*sqrt(4))/7 
The Netherlands                 |    +(5*11)=9^2+0