www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/05/08:33:31

Subject: Re: Accessing physical memory
From: Bryanston School <MOLESWORTH DOT THOMAS AT bryanston DOT co DOT uk>
Date: Wed, 05 Jun 1996 12:52:52 +0100
Message-Id: <000000246612916820372@bryanston.co.uk>
Organization: Bryanston School
To: DJGPP <djgpp AT delorie DOT com>
MIME-Version: 1.0

On Wed, Jun 5, 1996, 7:10:59 am GMT Eli Zaretskii wrote:


>
>On Tue, 4 Jun 1996, Bryanston School wrote:
>
>> >> Is there a way to access physical memory at a specified address without
>> >> using farptrs or Fat DS?
>> >
>> >What's wrong with these two methods?  Without knowing what is it that you
>> >are looking for, it is hard to advise you about other ways.
>> >
>>
>> farptrs: I could use these, but I would prefer to just use
>> pointers.
>>
>> I have a PCI video capture board which uses physical memory
>> to store the data - can I just allocate a buffer in memory
>> using malloc(), then map the card into this? Will this work,
>> or will the memory allocated be shuffled around?
>
>If what you need is to access a buffer of captured data, you can use
>`dosmemget' or `movedata' library functions to move the data from the
>board to a buffer allocated with `malloc', then access that buffer as
>usual.  This should be faster than if you were to access the board
>repeatedly, even if you did map it into your address space, because every
>access gets slowed down by the slow bus operation.
>

The memory used here is physical, PC, memory, that's an area
in the 32Mb of memory that I have. The board itself doesn't have
any memory on it. What I want to do is to allocate an area of
memory, find out the exact address and size, and tell the board
where to put it (it uses PCI DMA transfers or something, not sure
exactly how it works). The way I've been doing it so far is to
tell the board to use a 1Mb buffer starting at about 1.25Mb,
and allocate that physical memory using DPMI. What I would like
to do ideally is:

 byte *buffer;

 buffer = malloc(1048576);     /* Set up a 1 Mb buffer */
 board_map(buffer, 1048576);   /* Map board into buffer */

Will this memory be shuffled around by the various memory
managers, or will this be safe?

Thanks for the help,

Thomas.

- Raw text -


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