From owner-freebsd-hackers Sun Aug 23 18:21:51 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA19458 for freebsd-hackers-outgoing; Sun, 23 Aug 1998 18:21:51 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from picnic.mat.net (picnic.mat.net [209.118.174.117]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA19449 for ; Sun, 23 Aug 1998 18:21:47 -0700 (PDT) (envelope-from chuckr@glue.umd.edu) Received: from localhost (chuckr@localhost) by picnic.mat.net (8.9.1/8.8.5) with SMTP id UAA11399; Sun, 23 Aug 1998 20:19:19 -0400 (EDT) Date: Sun, 23 Aug 1998 20:19:19 -0400 (EDT) From: Chuck Robey X-Sender: chuckr@picnic.mat.net To: Bill Paul cc: hackers@FreeBSD.ORG Subject: Re: PCI devices In-Reply-To: <199808231747.NAA18976@skynet.ctr.columbia.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 23 Aug 1998, Bill Paul wrote: > Of all the gin joints in all the towns in all the world, Chuck Robey had > to walk into mine and say: > > > Does anyone know where I might find a good example of probing and > > attaching a pci device? I'm talking about the C code. I'm looking at a > > PCI sound card, but I can't find anything on how to do sound stuff using > > PCI. > > > > Thanks. > > I would start by looking at the device drivers in /sys/pci. That's > where I started. [some deletions] > As for 'PCI sound stuff,' that I don't know about. So far I've only > written network drivers, but I'd wager that there are a couple of > similarities. You probably have to provide a way to transfer large > streams of encoded audio data into and out of the adapter, which is > probably where DMA comes in. You have to give the card pointers > to buffers containing audio data to be played, then wait for an > interrupt from the card telling you the transfer is complete so you > can free the buffers and transfer more. And you need to be able to > program mixer levels and things using internal registers. I don't know > about things like MIDI or wave tables so I can't imagine how those work. > I'm assuming you do have the proper documentation for your board; > if not you're going to be totally lost. Among other things, the sound code wants to use linker sets for probing and other things, just like the pci code. I wondered about this, and my current best guess is to register both, with the pci routines doing the real work, and the sound routines merely checking the results and making sure the probe/attach was successful. You see, there are functions automatically registered/called via the sound code stuff that pci doesn't know about, so I can't completely ignore it. Does this sound reasonable (to have the probe + attach work done in two places, sort of? ----------------------------+----------------------------------------------- Chuck Robey | Interests include any kind of voice or data chuckr@glue.umd.edu | communications topic, C programming, and Unix. 213 Lakeside Drive Apt T-1 | Greenbelt, MD 20770 | I run Journey2 and picnic (FreeBSD-current) (301) 220-2114 | and jaunt (NetBSD). ----------------------------+----------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message