pciIntConnect - VxWorks

This is a discussion on pciIntConnect - VxWorks ; Hi, I am running 5.4 on a penitum BSP and have trouble handling and interrupt within a PCI card driver. I am retrieving the interrupt details using pciConfigInByte() and PCI_CFG_DEV_INT_LINE and PCI_CFG_DEV_INT_PIN and using these details to connect a handler ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: pciIntConnect

  1. pciIntConnect

    Hi, I am running 5.4 on a penitum BSP and have trouble handling and
    interrupt within a PCI card driver.

    I am retrieving the interrupt details using pciConfigInByte() and
    PCI_CFG_DEV_INT_LINE and PCI_CFG_DEV_INT_PIN and using these details
    to connect a handler to my interrupt using:-

    if(pciIntLibInit()==OK)
    {
    int nIRQ = INT_NUM_IRQ0 + nIntLine;
    if(pciIntConnect((VOIDFUNCPTR*)(INUM_TO_IVEC(nIRQ) ),
    (VOIDFUNCPTR)InteruptHandler, (void*)pInterrupt) != OK)
    {
    printMsg("ISR connect ERROR\n");
    return 0;
    }
    else
    {
    waitIntSem = semBCreate(SEM_Q_FIFO , SEM_EMPTY);
    printMsg("ISR connect OK\n");
    }
    if(sysIntEnablePIC(nIRQ) != OK)
    {
    printMsg("IRQ Enable ERROR\n");
    return 0;
    }
    else
    {
    printMsg("IRQ enable OK\n");
    }
    }

    Can anyone tell me does the PCI handler connection have to be done
    before sysHwInit?
    Am I missing something here, I believe this code should work?


  2. Re: pciIntConnect

    On Feb 1, 6:55 am, "Bendont" wrote:
    > Hi, I am running 5.4 on a penitum BSP and have trouble handling and
    > interrupt within a PCI card driver.
    >
    > I am retrieving the interrupt details using pciConfigInByte() and
    > PCI_CFG_DEV_INT_LINE and PCI_CFG_DEV_INT_PIN and using these details
    > to connect a handler to my interrupt using:-
    >
    > if(pciIntLibInit()==OK)
    > {
    > int nIRQ = INT_NUM_IRQ0 + nIntLine;
    > if(pciIntConnect((VOIDFUNCPTR*)(INUM_TO_IVEC(nIRQ) ),
    > (VOIDFUNCPTR)InteruptHandler, (void*)pInterrupt) != OK)
    > {
    > printMsg("ISR connect ERROR\n");
    > return 0;}
    >
    > else
    > {
    > waitIntSem = semBCreate(SEM_Q_FIFO , SEM_EMPTY);
    > printMsg("ISR connect OK\n");}
    >
    > if(sysIntEnablePIC(nIRQ) != OK)
    > {
    > printMsg("IRQ Enable ERROR\n");
    > return 0;}
    >
    > else
    > {
    > printMsg("IRQ enable OK\n");
    >
    > }
    > }
    >
    > Can anyone tell me does the PCI handler connection have to be done
    > before sysHwInit?
    > Am I missing something here, I believe this code should work?


    Whenever I've used pciIntConnect, I've had to add code to sysLib.c to
    setup the pci interrupts to use the pciInt() ISR. Then I could use
    pciIntConnect() to connect the interrupt. And yes, this is done before
    calling the pciIntConnect function. This has been in the PPC BSP so
    I'm not sure if it's the same.

    This is what I do:

    intConnect (INUM_TO_IVEC(PCI_PRI_INTA_VEC), pciInt, 0);
    intConnect (INUM_TO_IVEC(PCI_PRI_INTB_VEC), pciInt, 1);
    intConnect (INUM_TO_IVEC(PCI_PRI_INTC_VEC), pciInt, 2);
    intConnect (INUM_TO_IVEC(PCI_PRI_INTD_VEC), pciInt, 3);
    intEnable (PMC_INT_LVL1);
    intEnable (PMC_INT_LVL2);
    intEnable (PMC_INT_LVL3);
    intEnable (PMC_INT_LVL4);

    Then pciIntConnect works... Hope this helps.

    Rick


  3. Re: pciIntConnect

    Hi Rick,

    Thanks for your reply.

    >From what I can see, the first call to pciIntConnect for this BSP

    actually calls intConnect internally.

    I wonder if this is the same in the PPC BSP?

    I have actually tried calling intConnect and attaching pciInt prior to
    calling pciIntConnect however this wasn't done in sysLib.c. Does this
    have to be done prior to any other sysLib.c calls?

    I will try doing as you have suggested.

    thanks

    Tim


  4. Re: pciIntConnect

    Are you sure that you're BSP is properly setting up
    PCI_CFG_DEV_INT_LINE and PCI_CFG_DEV_INT_PIN ?




+ Reply to Thread