PCIe 버스 장치 매거

1537 단어 Hardware
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 

#include 
#include 

#include 


#include 

STATUS pciEnum( UINT32 bus)
{
	
	 UINT8 device, function;
	 UINT16  devID;
	 UINT16  venID;
	 UINT32 bar0,bar1,bar2,bar3,bar4,bar5;
	 
    for (device = 0; device < PCI_MAX_DEV; device ++)
    for (function = 0; function < PCI_MAX_FUNC; function ++)
    	if(pciConfigInWord(bus,device,function,PCI_CFG_DEVICE_ID,&devID)==OK)
        {
    		if(devID!=0xFFFF)
    		{
    			pciConfigInWord(bus,device,function,PCI_CFG_VENDOR_ID,&venID);
    			printf("bus=%d,device=%d,function=%d,[venID=%x,devId=%x]
",bus,device,function,venID,devID); pciConfigInLong(bus,device,function,PCI_CFG_BASE_ADDRESS_0,&bar0); pciConfigInLong(bus,device,function,PCI_CFG_BASE_ADDRESS_1,&bar1); pciConfigInLong(bus,device,function,PCI_CFG_BASE_ADDRESS_2,&bar2); pciConfigInLong(bus,device,function,PCI_CFG_BASE_ADDRESS_3,&bar3); pciConfigInLong(bus,device,function,PCI_CFG_BASE_ADDRESS_4,&bar4); pciConfigInLong(bus,device,function,PCI_CFG_BASE_ADDRESS_5,&bar5); printf("bar0=%x,bar1=%x,bar2=%x
",bar0,bar1,bar2); printf("bar3=%x,bar4=%x,bar5=%x
",bar3,bar4,bar5); } } }

좋은 웹페이지 즐겨찾기