Subject: Re: Accessing physical memory From: Bryanston School Date: Wed, 05 Jun 1996 12:52:52 +0100 Message-Id: <000000246612916820372@bryanston.co.uk> Organization: Bryanston School To: DJGPP MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit 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.