*BSD News Article 45780


Return to BSD News archive

Xref: sserve comp.unix.bsd.freebsd.misc:2369 comp.unix.programmer:26475
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nexus.coast.net!news.kei.com!news.mathworks.com!news.ultranet.com!news.sprintlink.net!howland.reston.ans.net!Germany.EU.net!nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!RRZ.Uni-Koeln.DE!se
From: se@MI.Uni-Koeln.DE (Stefan Esser)
Newsgroups: comp.unix.bsd.freebsd.misc,comp.unix.programmer
Subject: Re: Direct access to I/O ports
Date: 22 Jun 1995 19:44:16 GMT
Organization: Institute for Mathematics, University of Cologne, Germany
Lines: 38
Message-ID: <3sch6g$4su@news.rrz.uni-koeln.de>
References: <3s75qm$fn@spice.eppet.pt> <JKH.95Jun21143629@whisker.internet-eireann.ie> <3sbg5q$snj@bonnie.tcd-dresden.de>
NNTP-Posting-Host: fileserv1.mi.uni-koeln.de

In article <3sbg5q$snj@bonnie.tcd-dresden.de>, j@bonnie.heep.sax.de (J Wunsch) writes:
|> Jordan K. Hubbard <jkh@whisker.internet-eireann.ie> wrote:
|> 
|> >   I'm currently running FreeBSD 2.x and I'd like to develop some C
|> >   applications that directely access specific hardware ports.
|> >
|> >No problem.  Just open /dev/io in your application and you'll then
|> >be granted the priviledge of executing the inb/outb instructions
|> >directly.
|> 
|> Umm Jordan, are you sure it's actually working right now?  This one
|> used to be commented out with a /* broken */ comment in
|> sys/i386/i386/mem.c.

Well, there used to be an interface (similar to /dev/mem)
for port I/O. You would open /dev/io, lseek() to the I/O
port of your choice and then read() or write() single bytes,
and the kernel did an inb() or outb(). (Longer transfers 
were used the insb() or outsb() instructions and accesses 
to 16bit or 32bit ports used other /dev/io? devices ...)

Anyway. If you open /dev/io now, this will now just reset 
one bit in a task descriptor corresponding to your process, 
and the process will be granted port access permissions 
thereafter.

No more seeks and reads or writes! 
Just use the port I/O operations directly in your program. 
And this makes the old (commented out) code quite unnecessary 
today ...

Regards, STefan
-- 
 Stefan Esser				Internet:	<se@ZPR.Uni-Koeln.DE>
 Zentrum fuer Paralleles Rechnen	Tel:		+49 221 4706021
 Universitaet zu Koeln			FAX:		+49 221 4705160
 Weyertal 80
 50931 Koeln