From owner-freebsd-hackers Sun Aug 20 11:58:06 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id LAA12355 for hackers-outgoing; Sun, 20 Aug 1995 11:58:06 -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 LAA12348 for ; Sun, 20 Aug 1995 11:58:03 -0700 Received: from sax.sax.de by irz301.inf.tu-dresden.de with SMTP (5.67b+/DEC-Ultrix/4.3) id AA05867; Sun, 20 Aug 1995 20:57:53 +0200 Received: by sax.sax.de (8.6.11/8.6.12-s1) with UUCP id UAA14816 for freebsd-hackers@freebsd.org; Sun, 20 Aug 1995 20:57:53 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.6.11/8.6.9) id UAA01188 for freebsd-hackers@freebsd.org; Sun, 20 Aug 1995 20:13:16 +0200 From: J Wunsch Message-Id: <199508201813.UAA01188@uriah.heep.sax.de> Subject: Re: How to abort a DMA transfer ? To: freebsd-hackers@freebsd.org Date: Sun, 20 Aug 1995 20:13:16 +0200 (MET DST) Reply-To: freebsd-hackers@freebsd.org In-Reply-To: <199508201701.TAA12803@labinfo.iet.unipi.it> from "Luigi Rizzo" at Aug 20, 95 07:01:00 pm 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: 1420 Sender: hackers-owner@freebsd.org Precedence: bulk As Luigi Rizzo wrote: > > How (within a device driver) do I abort a DMA transfer which has > been started but has not completed yet ? I am having this problem > in the driver for a hand-scanner (the scanner does some read ahead; > meanwhile, a user might close the device and we want to abort the > transfer and free the buffer). I am surprised I haven't seen (or > understood!) anything like this in existing drivers, not even in > the floppy driver! You are surprised to have not seen this in the floppy driver? This surprises me. :-) Actually, i'd immediately kill the floppy controller if i would abort a transfer in progress. The only means then would raise the reset line of the FDC. I'm not sure if setting some masking bit in one of the DMAC registers will actually _abort_ a transfer. Van Gilluwe does only speak about masking a request. The culprit is that DMA operation is usually IO-controlled (via the TC signal) instead of being software- controlled. Why don't you simply continue the started request, and throw away its results once the DMAC has signalled the command completetion by an interrupt (and the interrupt handler sees that the device is closed now)? I would personally do everything in avoiding even touching such a hot iron like the DMAC. -- 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. ;-)