Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - PCI BAR (Base address registers ) not shown /accessible in QNX : (1 Item)
   
PCI BAR (Base address registers ) not shown /accessible in QNX  
Hello,
I need to read the BAR of  PCI card from Beckhoff GmbH (vendor id 15ech ,device id 1100h).
For this I first call  pci attach () and then pci_attach_device (). Device and ventor ID are passed as argument of 
variable from “pci_dev_info” structure. Moreover when pci –v command is given in QNX terminal the BAR of the PCI card
 is not listed for this card.

Here is the program code: 

struct pci_dev_info info;
     void *hdl;
     memset(&info, 0, sizeof (info));

       /* Connect to the PCI server */
        phdl = pci_attach( 0 );
        if( phdl == -1 ) {

            return EXIT_FAILURE;
        }

        /* Initialize the pci_dev_info structure */

	    info.VendorId = VendorID; 
	    info.DeviceId = DeviceID;

        /*  Attach a driver to a PCI device with given Vendor & Device ID is found */
	    if ((hdl = pci_attach_device(0,	PCI_SEARCH_VENDEV|PCI_INIT_ALL, 0, &info)) == 0) {

	    return EXIT_FAILURE;    /* specified PCI device not found */

	    }

		size_t nBarLen = info.BaseAddressSize[2]; //  set to BAR2 length
		uint64_t nBarAddr = info.PciBaseAddress[2]; // set to BAR2 physical address

However we have a custom PCI bus scan algorithm which when run under QNX  gives access to BAR’s from  the same PCI card
.