www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/31/05:02:34

Date: Sun, 31 Dec 2000 12:00:31 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: "Alan" <LMail AT optonline DOT net>
Message-Id: <2561-Sun31Dec2000120030+0200-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
CC: djgpp AT delorie DOT com
In-reply-to: <rpW26.50336$nM5.8360195@news02.optonline.net>
(LMail AT optonline DOT net)
Subject: Re: Physical Address Mapping Problem
References: <rpW26.50336$nM5 DOT 8360195 AT news02 DOT optonline DOT net>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: "Alan" <LMail AT optonline DOT net>
> Newsgroups: comp.os.msdos.djgpp
> Date: Fri, 29 Dec 2000 06:44:39 GMT
> 
> I'm trying to map the physical address of a PCI board, whose BAR0 register
> contains 0xE1410000.  So, it should be a memory mapped.  Probing the BAR
> with 0xFFFFFFFF gives a length of 512 bytes.

Is this information reliable, or are you just guessing?  Can you find
an authoritative source of information about the board's physical
address and the size of the memory it maps into the PC address space?

This is critical for proper mapping under DPMI, so I suggest to invest
some effort in getting the accurate information.

> #include <stdio.h>
> #include <io.h>
> #include <dpmi.h>
> 
> int main ()
> {
>  int  CaptureSelector;
>  char Buf[256];
>  __dpmi_meminfo mi;
> 
>  /* Map the physical device address to linear memory.  */
>  mi.address=0xE1410000;
>  mi.size=0x200;
>  if (__dpmi_physical_address_mapping (&mi) == -1)
>   return 1;
> 
>  /* Now mi.address holds the linear address.  */
> 
>  /* Allocate an LDT descriptor and set it up to span the entire
>    device on-board memory.  */
>  CaptureSelector=__dpmi_allocate_ldt_descriptors (1);
>  if (CaptureSelector == -1)
>   return 2;
> 
>  if (__dpmi_set_segment_base_address (CaptureSelector, mi.address) == -1)
>   return 3;
> 
>  if (__dpmi_set_segment_limit (CaptureSelector, mi.size - 1) == -1)
>   return 4;
> 
>  sprintf (Buf, "MC1=0x%08X\r\n\n", _farpeekl (CaptureSelector, 0xFC));
>  _write (2, Buf, strlen (Buf));
> 
>  return 0;
> 
> }

I don't see anything wrong with this code.

- Raw text -


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