Mail Archives: djgpp/1999/08/11/02:56:37
Chris Holmes wrote:
>
> Martin Czamai wrote:
> >
> > Hello!
> >
> > I want to access the memory space given from a BAR (base adress
> > register) of a PCI controller. (the adress is dynamic allocated by the
> > system)
> > Therefore I wrote a function that returns the (absolute) adress that
> > has to be accessed. Usually it is around 0xFFFFF000 .
> > I used __djgpp_map_physical_memory (mappedBAR, NoBytes, BaseAdr) for
> > mapping the device to a created memory block named 'mappedBAR'; the
> > number of bytes to map (NoBytes) is a multiple of a mem-page found
> > with __dpmi_get_page_size(&NoBytes) (4096 bytes) and the base adress
> > (BaseAdr) is equal the absolute address of the BAR.
> > My problem is, that the __djgpp_map_physical_memory (mappedBAR,
> > NoBytes, BaseAdr) returns EACCES as errno, wich is a rejection of the
> > request to the DPMI server. What does this message exactly mean?
> > Who could help me getting started to access this memory?
> > I am using RHIDE 1.4.
> > Please send your reply to Martin_Czamai AT peak-service DOT com .
> > Thank you!
>
> Wow... FFFFF000 is pretty near the 4 gig limit. Unless you have
> 4 gig of ram, I think the PCI controller is lying to you.
>
No, this is not true. In fact, any card on your system bus can respond
to memory access requests (of which physical RAM is just one kind). The
reason why it is so high is so that it does not interfere (or become
masked) by physical RAM. Case in point:
SVGA Linear Framebuffers; they indicate what memory range the video
card will respond to as writes/reads into it's internal video RAM.
Those can appear just above your physical RAM size (mine's around
0x0C000000).
Note that __djgpp_map_physical_memory requires a DPMI 1.0 server, and
only of the two commonly used ones (windows, cwsdpmi) is 1.0, while the
other is .9. I can't remember which is which, but to check, try running
the program in the OTHER environment to see if that works.
If neither works do it the old skool way:
new_descriptor = __dpmi_allocate_segment_descriptor(1);
__dpmi_set_segment_base(new_descriptor,
that_place_the_PCI_controller_says_to_map);
__dpmi_set_segment_limit(new_descriptor, size_of_pages_in_bytes);
Now you have a good descriptor. If EACCESS happens again after all this,
then your PCI card is lying to you.
moogla
- Raw text -