Jump to content

Error in application with PlxPciDeviceFind() function


surya.1006

Recommended Posts

Our main file calls the standard PLX function SelectDevice() which further includes the standard function PlxPciDeviceFind().

The codes are compiled successfully, but when we run the application, it prints the message "Before PlxPciDeviceFind function call:" as shown below and stops after that, showing a "segmentation fault".

 

 

/*********************************************************************

*

* Function  : SelectDevice

*

* Description: Asks the user which PLX PCI device to select

*

* Returns    : Total Plx devices found

*              -1,  if user cancelled the selection

*

********************************************************************/

S8

SelectDevice(

    DEVICE_LOCATION *pDevice

    )

{

    printf("Entering Select Device function:");

    U32 i;

    U32 DeviceNum;

 

 

    pDevice->BusNumber      = (U8)-1;

    pDevice->SlotNumber      = (U8)-1;

    pDevice->VendorId        = (U16)-1;

    pDevice->DeviceId        = (U16)-1;

    pDevice->SerialNumber[0] = '\0';

 

    DeviceNum = FIND_AMOUNT_MATCHED;

    printf("\nBefore PlxPciDeviceFind function call:");

    if (PlxPciDeviceFind(

            pDevice,

            &DeviceNum

            ) != ApiSuccess)

    {

        return 0;

    }

    printf("\nAfter PlxPciDeviceFind function call:");

    if (DeviceNum == 0)

        return 0;

 

This is a standard code in the standard file called PlxInit.c. The value of FIND_AMOUNT_ATTACHED is derived from a standard file included here called Plx.h and the value of which is 80001.

Can anybody suggest why is it stopping at that point, as I suspect the problem might be with the DeviceNum parameter here.

Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.