Mail Archives: djgpp/2001/05/11/09:41:29
> From: "Tims News" <ttodd_nospam AT cct DOT co DOT uk>
> Newsgroups: comp.os.msdos.djgpp
> Date: Fri, 11 May 2001 11:42:10 +0100
>
> I am currently working on MultiBus II Message Passing and have hit a small
> problem with the DMA transfer.
>
> I need to convert a standard pointer (eg. struct mystruct* pInstance) to a
> PHYSICAL memory address. This is not the address of the data to be
> transferred (that seems well documented in the FAQ - although I haven't
> tried the code yet), this is for the DMA command block.
Sorry, I don't understand: the DMA command block should include the
physical address of where the data should be moved. Section 18.13 of
the FAQ describes several alternatives to find a physical address of a
memory buffer suitable for DMA. What exactly are you missing in that
description?
> Also, PLEASE PLEASE PLEASE, if you send me a "read faq entry n"
> could you please also include the link for the FAQ to which you refer - as
> far as I can make out there are a number of (all sleightly) different ones
> around
The latest on-line version of the FAQ is here:
http://www.delorie.com/djgpp/v2faq/faq.html
You can download the latest version (to read it locally) from here:
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/faq230b.zip
> // Convert pointer to physical memory location
> Selector = *((UINT16*)(((UINT8*)(&pCmd))+4));
> __dpmi_get_segment_base_address((UINT32)Selector, &Physical);
> Physical += *((UINT32*)(&pCmd));
This is wrong: you compute the logical address, not a physical
address. The base address of your program's data is not a physical
address, because it is _before_ the memory-mapping unit built into the
CPU translates it into a physical address.
In addition, you method of computing the selector is bogus: the
selector is not encoded within the address, as in real mode. To get
the selector for your data, simply call the library function _my_ds().
Anyway, you _must_ use one of the methods described by the FAQ section
18.13 to get a physical address.
- Raw text -