Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Oct 2003 23:53:30 +0200
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        lauri.jarvenpaa@students.turkuamk.fi
Cc:        freebsd-hackers@freebsd.org
Subject:    Re: to write a device driver or not to write (i/o, opl3, stupidity) 
Message-ID:  <47299.1066254810@critter.freebsd.dk>
In-Reply-To: Your message of "Thu, 16 Oct 2003 00:00:52 %2B0300." <20031016000052.648ca035.lauri.jarvenpaa@students.turkuamk.fi> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20031016000052.648ca035.lauri.jarvenpaa@students.turkuamk.fi>, laur
i.jarvenpaa@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@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47299.1066254810>