PCIS_INT.CPP
资源名称:PCIAccess.rar [点击查看]
上传用户:whzhdz
上传日期:2007-03-07
资源大小:6k
文件大小:1k
源码类别:
嵌入式/单片机编程
开发平台:
DOS
- #include <stdio.h>
- #include <conio.h>
- #include <dos.h>
- void main(void)
- {
- int bus, device, func, regindex;
- union REGS regs, outregs;
- unsigned long lo, hi, ovalue;
- unsigned long BaseAddr;
- clrscr();
- func = 0;
- regindex = 0;
- for(bus=0; bus<5; bus++)
- {
- for(device=0; device<32; device++)
- {
- regs.h.bh = bus;
- regs.h.bl = (device<<3) | (func & 0x07);
- regindex = 0;
- regs.x.di = regindex;
- regs.x.ax = 0xB109;
- int86(0x1A,®s,&outregs);
- lo = outregs.x.cx;
- regs.x.di = regindex + 2;
- int86(0x1A,®s,&outregs);
- hi = outregs.x.cx;
- ovalue = hi*65536l+lo;
- if (lo != 0xffff)
- {
- printf("nBus = 0x%xn", bus);
- printf("Device = 0x%xn", device);
- printf("ID = %lxn", ovalue);
- for(BaseAddr=0; BaseAddr<=5; BaseAddr++)
- {
- regindex = 0x10 + BaseAddr*4;
- regs.x.di = regindex;
- int86(0x1A,®s,&outregs);
- lo = outregs.x.cx;
- regs.x.di = regindex + 2;
- int86(0x1A,®s,&outregs);
- hi = outregs.x.cx;
- ovalue = hi*65536l+lo;
- printf("Base%d: Low = 0x%xtHi = 0x%xn", BaseAddr, lo, hi);
- }
- regindex = 0x3c;
- regs.x.di = regindex;
- int86(0x1A,®s,&outregs);
- lo = outregs.x.cx;
- printf("IRQ# = %dn", lo & 0xff);
- getch();
- }
- }
- }
- }
English
