to write a device driver or not to write (i/o, opl3, stupidity)

Mathew Kanner mat at cnd.mcgill.ca
Wed Oct 15 14:15:04 PDT 2003


On Oct 15, lauri.jarvenpaa at students.turkuamk.fi wrote:
> Hello. I'm sorry to disturb you but.. I have read manuals, searched web, fed the ducks (evil ones), but I can not figure out some things.
> 
> 1:
> I have an isa card with i/o address 0x300-0x301. No dma, no irq - just i/o.
> How can I read/write from/to this address to program the card?
> Card is a HardSID and it is pc implementation of famous Commodore 64 synthesizer chip so actually I want to program that chip, not just _any_ card :)
> 
> I'm under an impression that there is no way to write directly to ports (like in dos) and that I should write a device driver. Or is there already some generic i/o driver? After intensive reading of manuals, it is still unclear to me what this driver should do and what the drivers usually do.
> 
> I mean, what services do drivers offer? What services they _need_ to offer? Do they just create appropriate device nodes and let the applications to worry about using them or do they do some data manipulation or do they offer routines and interfaces for applications or what? What should this particular driver do as I just want to read/write data.
> 

	I'm not positive about this but I think that you can do it
from usermode by opening /dev/io (as root) and the use inb, outb
macros defined in cpufunc.h.

> 2:
> Also, there is an OPL3 synthesizer chip in older Sound Blasters and compatibles. Man pages say this chip is supported. I just wonder, how it is supported? How do I read/write from/to this chip if I know i/o address of it? Yes I'm stupid but please, little bit of mercy?
> 

	The current midi drivers in FreeBSD are dated, I've seen some
of it work but never synth chips like opl.  See sys/dev/sound/isa/opl.c
	If you want to read/write to it from usermode skipping the
driver, see #1.

> 3:
> Then, there is /dev/midi and /dev/sequencer. If I want to read incoming midi data I read /dev/midi right? When do I want to read /dev/sequencer?
> 

	If you *have* a /dev/midi that works (unlikely), yes you can
read it.  You will get a raw stream directly from the external device.
/dev/sequencer gives processed packets (optionally) including timing
information.  /dev/sequencer has been obseleted by /dev/music.

	--Mat

-- 
	We peer so suspiciously at each other that we cannot see
	that we Canadians are standing on the mountaintop of human
	wealth, freedom and privilege.
			- Pierre Elliott Trudeau


More information about the freebsd-hackers mailing list