From owner-freebsd-hackers Mon Aug 21 05:52:14 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id FAA17856 for hackers-outgoing; Mon, 21 Aug 1995 05:52:14 -0700 Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.FreeBSD.org (8.6.11/8.6.6) with SMTP id FAA17846 for ; Mon, 21 Aug 1995 05:52:08 -0700 Received: from sax.sax.de by irz301.inf.tu-dresden.de with SMTP (5.67b+/DEC-Ultrix/4.3) id AA23586; Mon, 21 Aug 1995 14:51:02 +0200 Received: by sax.sax.de (8.6.11/8.6.12-s1) with UUCP id OAA21447 for freebsd-hackers@freebsd.org; Mon, 21 Aug 1995 14:51:01 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.6.11/8.6.9) id OAA05314 for freebsd-hackers@freebsd.org; Mon, 21 Aug 1995 14:28:08 +0200 From: J Wunsch Message-Id: <199508211228.OAA05314@uriah.heep.sax.de> Subject: Re: How to abort a DMA transfer ? To: freebsd-hackers@freebsd.org Date: Mon, 21 Aug 1995 14:28:08 +0200 (MET DST) Reply-To: freebsd-hackers@freebsd.org In-Reply-To: <199508210841.KAA13733@labinfo.iet.unipi.it> from "Luigi Rizzo" at Aug 21, 95 10:41:27 am Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) X-Phone: +49-351-2012 669 X-Mailer: ELM [version 2.4 PL23] Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Length: 1755 Sender: hackers-owner@freebsd.org Precedence: bulk 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. ;-)