to write a device driver or not to write (i/o, opl3, stupidity)
Poul-Henning Kamp
phk at phk.freebsd.dk
Wed Oct 15 14:53:35 PDT 2003
In message <20031016000052.648ca035.lauri.jarvenpaa at students.turkuamk.fi>, laur
i.jarvenpaa at students.turkuamk.fi writes:
>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 :)
You can do this from userland as root by opening /dev/io:
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/time.h>
#include <machine/cpufunc.h>
int
main(int argc, char **argv)
{
FILE *f;
f = fopen("/dev/io", "r");
outl(0xe11c, 0x120);
outl(0xe124, 0xd0602004);
outl(0xe134, 0x18600020);
outl(0xe11c, 0x130);
[...]
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the freebsd-hackers
mailing list