From owner-freebsd-hackers@FreeBSD.ORG Wed Oct 15 14:15:04 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6F5BC16A4B3 for ; Wed, 15 Oct 2003 14:15:04 -0700 (PDT) Received: from hak.cnd.mcgill.ca (hak.cnd.mcgill.ca [132.216.11.133]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9125A43FAF for ; Wed, 15 Oct 2003 14:15:02 -0700 (PDT) (envelope-from mat@hak.cnd.mcgill.ca) Received: from hak.cnd.mcgill.ca (localhost [127.0.0.1]) by hak.cnd.mcgill.ca (8.12.9/8.12.8) with ESMTP id h9FLDTk4008605; Wed, 15 Oct 2003 17:13:29 -0400 (EDT) (envelope-from mat@hak.cnd.mcgill.ca) Received: (from mat@localhost) by hak.cnd.mcgill.ca (8.12.9/8.12.8/Submit) id h9FLDTbG008604; Wed, 15 Oct 2003 17:13:29 -0400 (EDT) Date: Wed, 15 Oct 2003 17:13:29 -0400 From: Mathew Kanner To: lauri.jarvenpaa@students.turkuamk.fi Message-ID: <20031015211329.GE1810@cnd.mcgill.ca> References: <20031016000052.648ca035.lauri.jarvenpaa@students.turkuamk.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031016000052.648ca035.lauri.jarvenpaa@students.turkuamk.fi> User-Agent: Mutt/1.4.1i Organization: I speak for myself, operating in Montreal, CANADA X-Spam-Status: No, hits=-5.0 required=5.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_MUTT version=2.55 X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: freebsd-hackers@freebsd.org Subject: Re: to write a device driver or not to write (i/o, opl3, stupidity) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2003 21:15:04 -0000 On Oct 15, lauri.jarvenpaa@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