From: "Alan" Newsgroups: comp.os.msdos.djgpp Subject: Physical Address Mapping Problem Lines: 59 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: Date: Fri, 29 Dec 2000 06:44:39 GMT NNTP-Posting-Host: 167.206.69.80 X-Trace: news02.optonline.net 978072279 167.206.69.80 (Fri, 29 Dec 2000 01:44:39 EST) NNTP-Posting-Date: Fri, 29 Dec 2000 01:44:39 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 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 #include #include 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; }