delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/29/02:06:38.1

From: "Alan" <LMail AT optonline DOT net>
Newsgroups: comp.os.msdos.djgpp
References: <rpW26.50336$nM5 DOT 8360195 AT news02 DOT optonline DOT net>
Subject: Re: Physical Address Mapping Problem -- Using CWSDPR0
Lines: 69
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Message-ID: <qtW26.50414$nM5.8362832@news02.optonline.net>
Date: Fri, 29 Dec 2000 06:48:54 GMT
NNTP-Posting-Host: 167.206.69.80
X-Trace: news02.optonline.net 978072534 167.206.69.80 (Fri, 29 Dec 2000 01:48:54 EST)
NNTP-Posting-Date: Fri, 29 Dec 2000 01:48:54 EST
Organization: Optimum Online
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

One thing I forgot, I'm using CWSDPR0 for DPMI since I don't want or need
virtual memory.

-Alan

"Alan" <LMail AT optonline DOT net> wrote in message
news:rpW26.50336$nM5 DOT 8360195 AT news02 DOT optonline DOT net...
> 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.
>
> I wrote a quick test to see if I could address the memory:
>
> The register at offset 0xFC is a 32 bit r/w register.  When read, the
upper
> 16 bits return all zeros.  After a reset, the register should read back
> 0x00000100.  An NT driver and a VxWorks driver both read back the correct
> value.  Unfortunately, the output of this test program is:
>
> MC1=0xFFFFFFFF
>
> Hmmm...  Anyone have any idea what I'm doing wrong?
>
> I'm running DOS 6.22 and I've tried it both with and without Himem.sys and
> emm386.exe.  I always get the same result.
>
> Thanks in advance for your time!
>
>
> #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;
>
> }
>
>


- Raw text -


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