Hi,
I’m trying to detect several devices with the same vendorID and deviceID.
To do that I call pci_find_device(), but every time this function is
terminated
by the SIGSEGV signal.
What can be a reason ?
Below is source code.
Regards,
Jacek
#include <stdlib.h>
#include <stdio.h>
#include <hw/pci.h>
#include <sys/neutrino.h>
#define VendorID 0x1011
#define DeviceID 0x9
#define max_index 10
int main(int argc, char *argv[]) {
int phdl,i;
unsigned* dev_func, *bus;
phdl = pci_attach(0);
if( phdl == -1 ) {
fprintf( stderr, “Unable to initialize PCI\n” );
return EXIT_FAILURE;
}
for (i=0;i<max_index;i++){
if (pci_find_device(DeviceID,VendorID,i,bus,dev_func)== PCI_SUCCESS)
printf ("\n Found adapter: VendorID=0x%x, DeviceID=0x%x, pci_index=%d
\n",VendorID,DeviceID,i);
}
pci_detach( phdl );
return EXIT_SUCCESS;
}
Now, with these two modifications is ok:
unsigned dev_func,bus;
…
if (pci_find_device(DeviceID,VendorID,i,&bus,&dev_func)== PCI_SUCCESS)
Jacek
U¿ytkownik “Jacek Rudnicki” <jacek.rudnicki@quantum.com.pl> napisa³ w
wiadomo¶ci news:f5qmiu$a54$1@inn.qnx.com…
Hi,
I’m trying to detect several devices with the same vendorID and deviceID.
To do that I call pci_find_device(), but every time this function is
terminated
by the SIGSEGV signal.
What can be a reason ?
Below is source code.
Regards,
Jacek
#include <stdlib.h
#include <stdio.h
#include <hw/pci.h
#include <sys/neutrino.h
#define VendorID 0x1011
#define DeviceID 0x9
#define max_index 10
int main(int argc, char *argv[]) {
int phdl,i;
unsigned* dev_func, *bus;
phdl = pci_attach(0);
if( phdl == -1 ) {
fprintf( stderr, “Unable to initialize PCI\n” );
return EXIT_FAILURE;
}
for (i=0;i<max_index;i++){
if (pci_find_device(DeviceID,VendorID,i,bus,dev_func)== PCI_SUCCESS)
printf ("\n Found adapter: VendorID=0x%x, DeviceID=0x%x, pci_index=%d
\n",VendorID,DeviceID,i);
}
pci_detach( phdl );
return EXIT_SUCCESS;
}