[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Direct I/O port access (x86)
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: Direct I/O port access (x86)
- From: Cox Family <cox_(_dot_)_family_(_at_)_sk_(_dot_)_sympatico_(_dot_)_ca>
- Date: Mon, 04 Jun 2001 11:28:13 -0600
I have a quick question regarding direct I/O port access
under OpenBSD 2.8-GENERIC that I was hoping someone here
might be able to answer.
Recently, I've been trying to get some code running that
sends data to the Yamaha OPL3 ("Adlib") sound-chip found
on many Sound Blaster-compatible sound cards.
More specifically, the code uses the 'inb' / 'outb' macros
found in <machine/pio.h> (IIRC) to send the data directly
to the chip, which is most often found at ports 0x388 and
Unfortunately, the program segfault's on the first 'outb'
call, leaving few clues as to where the problem may lie.
>From what I've been able to find in other sources, the 'pro-
per' way of doing direct I/O port access under *BSD seems to
be something like this:
1. Open "/dev/io" in order to gain permissions needed to use
the 'inb' / 'outb' macros.
2. Send data to the device using 'inb' / 'outb'.
3. Close "/dev/io" (obviously ;-)
Would anyone care to take a guess as to where the problem may
be? Lack of permissions to access the sound device?
Visit your host, monkey.org