www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/01/18:01:33

Message-ID: <010401c07446$c447b3a0$5045cea7@optonline.net>
From: "Alan J. Livingston" <AlanLivingston AT acm DOT org>
To: <djgpp AT delorie DOT com>
References: <rpW26.50336$nM5 DOT 8360195 AT news02 DOT optonline DOT net> <2561-Sun31Dec2000120030+0200-eliz AT is DOT elta DOT co DOT il>
Subject: Re: Physical Address Mapping Problem
Date: Mon, 1 Jan 2001 18:01:25 -0500
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Reply-To: djgpp AT delorie DOT com

Eli,

Thanks for your help.  Indeed, I had a bug when reading the base address
register.  Using the correct address works much better!  Thanks for the 2x4
up against the head!

-Alan
----- Original Message -----
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Newsgroups: comp.os.msdos.djgpp
To: "Alan" <LMail AT optonline DOT net>
Cc: <djgpp AT delorie DOT com>
Sent: Sunday, December 31, 2000 5:00 AM
Subject: Re: Physical Address Mapping Problem


> > 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