Message-ID: <010401c07446$c447b3a0$5045cea7@optonline.net> From: "Alan J. Livingston" To: References: <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 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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" Newsgroups: comp.os.msdos.djgpp To: "Alan" Cc: Sent: Sunday, December 31, 2000 5:00 AM Subject: Re: Physical Address Mapping Problem > > From: "Alan" > > 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 > > #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; > > > > } > > I don't see anything wrong with this code.