Mail Archives: djgpp/2001/01/01/18:01:33
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 -