Laaca
Czech republic, 05.08.2009, 12:15 |
Rayer's NVclock (Developers) |
For accessing the MMIO registers you use function _DJGPP_Map_physical_memory which isn't supported by Windows 9x.
But what about accessing the MMIO space from DS register like normal DJGPP memory? You can just increase the limit for DS and it should work.
In Freepascal I wrote the code bellow which could do the job. I tested it on LFB region and it works so it should work for other places too include the MMIO space.
Procedure MMIO_Mount_memory(phys_adr:pointer):pointer;
{Maps physical region of memory into normal address space}
var r:dword;
begin
Set_segment_limit(get_ds,$FFFFFFFF);
r:=Get_Linear_Addr(dword(phys_adr),16384*1024); {16MB adress space should be enough}
MMIO_Mount_memory:=pointer(r-get_segment_base_address(get_ds));
end;
And why you use for accesing the PCI bus the direct access and not INT 1A BIOS calls? Does it have any advantage over it? I am asking because most of code I have ever seen use direct method and not INT 1A. --- DOS-u-akbar! |
RayeR
CZ, 05.08.2009, 16:39
@ Laaca
|
Rayer's NVclock |
> For accessing the MMIO registers you use function
> _DJGPP_Map_physical_memory which isn't supported by Windows 9x.
> But what about accessing the MMIO space from DS register like normal DJGPP
> memory? You can just increase the limit for DS and it should work.
> In Freepascal I wrote the code bellow which could do the job. I tested it
> on LFB region and it works so it should work for other places too include
> the MMIO space.
Could you test it? I used this function as it seems to me closer to original mmap. Otherwise I could use movedata but it will require more changes.
> And why you use for accesing the PCI bus the direct access and not INT 1A
> BIOS calls? Does it have any advantage over it? I am asking because most
> of code I have ever seen use direct method and not INT 1A.
I rather don't rely on PCI BIOS, maybe some bugs there on some PC. I always used direct PCI access (IO port address is fixed so I don't see any problem) without problem. --- DOS gives me freedom to unlimited HW access. |
Laaca
Czech republic, 09.08.2009, 19:22
@ RayeR
|
Rayer's NVclock |
> Could you test it? I used this function as it seems to me closer to
> original mmap. Otherwise I could use movedata but it will require more
> changes.
What for test shall I do?
I tried to draw pixels into LFB space via this method and it worked fine. So it should work OK for every memory region above 1MB. --- DOS-u-akbar! |
Laaca
Czech republic, 13.08.2009, 09:54
@ Laaca
|
bug in NVclock ? |
I rewrote some routines from NVClock into Freepascal and I think I found a bug in function vc_read_pbus16 in backend.c
It looks like this:
unsigned short nv_read_pbus16(int offset)
{
int shift = (offset / 2)*16;
return (nv_card->PBUS[offset/4] >> shift) & 0xffff;
}
But I think it should be corrected like this:
unsigned short nv_read_pbus16(int offset)
{
int shift = (offset % 2)*16;
return (nv_card->PBUS[offset/4] >> shift) & 0xffff;
} --- DOS-u-akbar! |