Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Aug 1995 14:28:08 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-hackers@freebsd.org
Subject:   Re: How to abort a DMA transfer ?
Message-ID:  <199508211228.OAA05314@uriah.heep.sax.de>
In-Reply-To: <199508210841.KAA13733@labinfo.iet.unipi.it> from "Luigi Rizzo" at Aug 21, 95 10:41:27 am

next in thread | previous in thread | raw e-mail | index | archive | help
As Luigi Rizzo wrote:
> 
> Consider the following scenario (working with a hand scanner):
> 1) on open, a buffer is allocated with sufficient room for reading N
>    scanlines (the size of a scanline depends on the resolution, and the
>    number of lines might be in the range 10..100)
> 2) the device is closed while the DMA is active (which is essentially
>    all the times) *and* there will be no further data coming from the
>    scanner (this is likely: the user knows he wants to close the
>    device, thus he stops scanning and then gives the appropriate
>    commands);
> 3) a new open is requested, possibly with different parameters, which
>    causes the need for a larger buffer; now I need to abort the
>    previous transfer, free the old memory, and malloc a newer block.

Does the scanner not set TC (terminal count, hardware signal) at the
completion of its transfer?  It's the usual way how the transfer will
be ended.  The DMAC will issue an interrupt on receipt of this signal.

> > now)?  I would personally do everything in avoiding even touching such
> > a hot iron like the DMAC.
> 
> I'll see if I can get the data sheets for an 8237.

It's not the 8237 data sheet.  It's rather that weird (to say the
least) circuitry that is built around it in an IBM PC.  And the fact
that it's rather easy to totally choke a computer with misconfigured
DMA transfers.  (Believe me, i've been playing alot with a DMAC in my
CP/M era...)

If you really want to dig into this, get the van Dilluwe, at the very
least.  You will find a detailed description of the DMAC and related
hardware registers.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)



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