阅读:2397回复:4
如何获取映射在PCI空间的IO基地址? 请进!
请教!
我想通过读写0XCF8和0XCFC两个寄存器,写个函数来获取LOCAL端 映射在PCI端的IO基地址,以便随时调用。其实就是读PCI9052配置信息中的PCIBAR3,我写了个函数,但在调用时,有时是正确的,有时是错误的(读出是0Xcccccccc),请各位帮我一下,不甚感激。 参考驱动方法 DP_InpD,DP_OutpD是2000下对IO口读写函数 DWORD getiobase(); DWORD getiobase() { DWORD io_CF8; // port 0xcf8 DWORD io_CFC; // port 0xcfc DWORD IOBASE; io_CF8=0x80000000; //because the first bit is enable/disable for(;;) //so must be 1,so from 0x800000000 { DP_OutpD(0xcf8,io_CF8); io_CFC=DP_InpD(0xcfc); if (io_CFC==0x905010b5) //if =0xffffffff,then is a invalid { //bus number and device number DP_OutpD(0xcf8,io_CF8+4*7); //read DWORD IOBASE=DP_InpD(0xcfc); // printf(\"Base Address Register=%lx\\n\",DP_InpD(0xcfc)); } io_CF8+=0x800; if (io_CF8>=0x80FFFF00) break; } return IOBASE; } |
|
沙发#
发布于:2004-05-27 08:40
怎么没有人顶啊?
我会多给分的! |
|