Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Oct 1996 00:12:16 +0930 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        ajones@ctron.com (Alexander Seth Jones)
Cc:        hackers@freefall.freebsd.org
Subject:   Re: DMA and autoinitialize
Message-ID:  <199610221442.AAA17298@genesis.atrad.adelaide.edu.au>
In-Reply-To: <326CD424.7085@ctron.com> from "Alexander Seth Jones" at Oct 22, 96 10:03:16 am

next in thread | previous in thread | raw e-mail | index | archive | help
Alexander Seth Jones stands accused of saying:
> 
> I'm writing a device driver for an audio card and would like to
> autoinitialize the DMA.  Right now, I do this using isa_dmastart. 
> However, I don't see any routines to grab the data periodically to place
> it in a buffer inside my driver.  I can't use isa_dmadone, because if a
> bounce buffer is being used, it'll flag it as not being used anymore, so
> I won't be able to get anymore data.  What makes things tough is that
> the interrupt on the card is not tied to DMA in hardware, so I have to
> poll the DMA controller periodically to see how many bytes I can
> transfer over to an internal buffer.

Yecch, what a revolting piece of hardware.

>   I looked through all the drivers and didn't see anybody even doing any
> autoinitialization, nor did I see a routine to periodically grab stuff
> from the DMA buffer (2.1.5-RELEASE)  Does such a routine exist? or will
> I have to write one? or can someone suggest another way to approach
> this?

I would be inclined to use a timeout that expires several times faster
than the card can get through the DMA buffer, and have the DMA looping
through a circular buffer internal to the driver.  This means copying
from userspace to your buffer, which is bad-ish, but it avoids losing
control to the DMA routines.  In the worst case then the audio would 
repeat rather than glitch.  (You can see this sort of behaviour eg.
in Quake when you save to disk; the second or so of audio it plays
loops until it's finished in DOS and can catch up.)

YMMV, I am pulling this out of thin air rather than actually studying 
the problem.

> Alex Jones              |  ajones@ctron.com

-- 
]] Mike Smith, Software Engineer        msmith@atrad.adelaide.edu.au    [[
]] Genesis Software                     genesis@atrad.adelaide.edu.au   [[
]] High-speed data acquisition and      (GSM mobile)  <FOUND!>          [[
]] realtime instrument control          (ph/fax)  +61-8-8267-3493       [[
]] Collector of old Unix hardware.      "Where are your PEZ?" The Tick  [[



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