From: "Tom Demmer" Organization: Lehrstuhl Stroemungsmechanik, RUB To: djgpp AT delorie DOT com Date: Mon, 28 Apr 1997 08:39:59 GMT-1 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Need help on DMA transfer Reply-to: Demmer AT LStM DOT Ruhr-Uni-Bochum DOT De Message-ID: <5E6E9801EF3@brain1.lstm.ruhr-uni-bochum.de> Precedence: bulk Hi all, I have (partially) ported the GPIB library from the Linux Lab Project to DJGPP. It is a lib to program IO-Cards that communicate with Voltmeters, Oscilloscopes and such things. These cards can be run in two modes, PIO or DMA. The PIO part is working, but I think DMA could be faster. So I have a few questions: - Can the DMA buffer be above 1 MB, or _must_ I transfer from/to DOS memory? - If I have to go over DOS mem, how can I ensure the buffer does not cross a 128kB boundary? Or is the information, DMA buffers must not cross such a boundary, outdated? And the toughest thing ;-) this is from the Linux code: I know what most of the functions are doing, but I don't have the slightest idea _how_: /* program dma controller */ /* rwop->io_cnt is the # of bytes to xfer */ /* rwop->io_pbuf is a pointer to the buffer ** to read/write from/to */ cli(); disable_dma( ibdma ); /* ibdma is the DMA channel */ clear_dma_ff ( ibdma ); /* ???? */ /* These ones are self-explaining, but how to do it? */ set_dma_count( ibdma, rwop->io_cnt ); set_dma_addr ( ibdma, rwop->io_pbuf); if (rwop->io_flags & IO_READ) { set_dma_mode( ibdma, DMA_MODE_READ ); } else { set_dma_mode( ibdma, DMA_MODE_WRITE ); } enable_dma( ibdma );/* enable Host side DMA transfers */ sti(); /* ** Let IO card initiate DMA */ bdDMAstart(rwop); /* ** Wait until card finished or error */ bdDMAwait(rwop, 0); /* ** Stop IO card and get amount xfered */ resid = bdDMAstop(rwop); /* ** Disable DMA channel. How? */ disable_dma( ibdma ); return resid; Any help appreciated, TIA. Ciao Tom ****************************************************************** * Thomas Demmer * Phone : +49 234 700 6434 * * Universitaetsstr. 150 * Fax : +49 234 709 4162 * * Lehrstuhl fuer Stroemungsmechanik * * * D-44780 Bochum * * ****************************************************************** * Email: demmer AT LStM DOT Ruhr-Uni-Bochum DOT De * * WWW: http://www.lstm.ruhr-uni-bochum.de/~demmer * ****************************************************************** Anatomy (n): something everyone has, but which looks better on a girl. -- Bruce Raeburn.