Mail Archives: djgpp/1998/06/18/00:26:24
Bernhard Gleich wrote:
>
> Hi all
>
> This question should be in the FAQ, but I didn't find it.
>
> I'm trying to do some PCI DMA transfer. For this I need to know where
> the physical address of my allocated memory is. But I could not find
> any function that returns me this value. Could anyone point me to this
> type of information?
Unfortunately, you can't. The way the DPMI server handles memory, a
given chunk of memory can reside anywhere in physical memory, or even in
several different places (noncontiguously).
The usual solution is to allocate some DOS memory (with
__dpmi_allocate_dos_memory), since you *do* know where it resides (in
the low 1M), and then use that as your DMA buffer.
> Note: Currently I'm doing the DMA in a very strange way: Allocate
> (malloc) most of the memory. Clear this memory. Do a DMA transfer to a
> random physical address. Check were the memory content is changed. Now
> DMA transfer to known position in the malloced memory is
> possible. This works most of the time.
That is a **horrible** idea. Perhaps it works most of the time, but
sometimes it will fall right on top of DOS, or something equally vital,
and everything will go to Hades in a handbasket. If you get really
lucky, it will hit your disk cache. :-o
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -