delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/15/07:02:25

Date: Wed, 15 Oct 1997 13:01:56 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Peter Scargill <pscargill AT cix DOT compulink DOT co DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Physical address from array ? Not a clue!
In-Reply-To: <EI1711.H0x@cix.compulink.co.uk>
Message-ID: <Pine.SUN.3.91.971015130015.17868E-100000@is>
MIME-Version: 1.0

On Tue, 14 Oct 1997, Peter Scargill wrote:

> I'm really having trouble getting my head around this. given an array, 
> lets say "fred[70000]" how do you get the PHYSICAL address into an int so 
> you can pass that to, say, a dma chip which is ready to accept a 32-bit 
> address.

One way is to use the VDS (Virtual DMA Services) API.  The API is
actually a bunch of functions of Interrupt 4Bh which you can look up
e.g. in Ralf Brown's Interrupt List.  Microsoft also has a VDS
specification which can be downloaded.

The relevant function there is function 8103h, Lock DMA Buffer.  You
pass it a pointer to your buffer, and if it returns a physical address
of a locked buffer that can be used for DMA.  (There's much more to it
than I've told; in particular, it might return the address of an
entirely different buffer, if your buffer doesn't meet all the DMA
requirements.  Please read the description of this function for a
complete picture.)

Please note that currently, VDS is not available if you run CWSDPMI
with no other memory manager.  You need to install a memory manager
such as EMM386 or QEMM, or run under Windows, to get VDS support.

I imagine that if you allocate a DOS buffer, you can use its address as 
the physical address, since DOS memory is usually mapped 1-to-1.  You 
might consider checking out Allegro sources to see how does it do DMA.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019