Q\A about VME bus for Vxworks

Aditya Amar wrote:
> Calling upon all VxWorks Gurus for help !!
> 
> My problem has to do with handling interrupts from the VMEbus
> I am using various custom designed boards ( which are connected to the SBC via the VME bus) to 
> generate interrupts. The SBC is a MVME5100 board having a PPC604 processor and interfaced with
> a VME bus via the "Tundra PCI Universe2B" chip. We are using the mvme5100 BSP provided by 
> Wind River for this board.
> 
> I have copied the following code-snippet from  a Wind-River document "WTN-56" which 
> explains "VME Bus access and control via Tundra Universe 2" ...
> 
> /* connect interrupt service routine 
> 
> The following sample code can be integrated into an application to enable VME bus interrupts 
> 
> and attach interrupt handlers */
> 
> #include "vxWorks.h"
> 
> #include "stdio.h"
> 
> #include "logLib.h"
> 
> #include "intLib.h"
> 
> #define INUM_TO_IVEC(intNum) ((VOIDFUNCPTR *) ((intNum) << 3))
> 
> /* The following functions can be used to test VME bus interrupts */
> 
> /* Use the function sysBusIntGen from a second bus master to generate
> 
> an interrupt */
> 
> void vmeHandler (void)
> 
> {
> 
> logMsg ("Inside vmeHandler ISR....");
> 
> }
> 
> void vmeMain (int intLevel, int vector)
> 
> {
> 
> sysIntEnable (intLevel);
> 
> printf ("Level %d enabled\n", intLevel);
> 
> intConnect(INUM_TO_IVEC(vector),(VOIDFUNCPTR) vmeHandler, 0);
> 
> }
> 
> My questions are as follows:-
> 1.The VMEbus has 7  levels of prioritized interrupts (IRQ1...IRQ7) . If I am 
> generating IRQ4 from our custom designed h/w board then what should 
> be the argument in the call to sysIntEnable from within vmeMain ().
>
4.

> When I generated an IRQ4 interrupt from our custom board , over the 
> VMEbus and called sysIntEnable(4) to enable the specified bus interrupt level,
>  I got a scrolling display of error messages on my debug monitor indicating that a 
> wrong VMEbus interrupt :0 was recieved ?????????
> 

Your board probably is not using "release on acknowledge".  It is also
possible that the board is not sending the correct interrupt number.

>  
> 2. Assuming that during the IACK ( interrupt acknowledge) cycle, the interrupting board would send 0x60 as the 
> Interrupt Number/Interrupt Vector  to the the SBC over the VME bus 
> my call to intConnect should be 
> 
>     intConnect (INUM_TO_IVEC (0x60), myVMEinterruptHandler, 0);   or
>     intConnect (0x60, myVMEinterruptHandler, 0);  
> 
> Is 0x60 an interrupt number or an interrupt vector ?
> 

In VMEspeak, the term interrupt vector is used for the same thing
that WRS calls an interrupt Number.  Basically, you use INUM_TO_IVEC
on whatever the board is going to put on the bus during the IACK
cycle.

> 3. I was under the impression that the intArchLib ( which is the architecture-dependent 
> interrupt library ) will provide the definition of  INUM_TO_IVEC. But from the code snippet 
> above it looks like I have to define it myself. So the question is who provides the 
> definition of  INUM_TO_IVEC ? If I have to define it how do I do it ?
> 

It should be in one of the .h files.  I forget which, why don't you
just search fot it?

> I am NOT using sysBusIntGen()  to simulate the generation of interrupts, rather I am using our custom
> H/W boards to actually generate interrupts across the VMEbus. We have verified that these interrupts
> are actually getting generated and being transferred across the VMEbus using probes, but are 
> not able to connect an ISR which will handle this interrupt on the SBC.
> 

Is the board sending 0x60 during the IACK cycle?  Is the board turning
the int off when the IACK comes through?  See a copy of the standard
for the exact seq of events.  I have had trouble with custom boards
in which the designer was changing his bus signals on the wrong edge
of bus control signals.  The VME standard has the exact requirements.

> Any help/advice will be greatly appreciated....
> 
> best,
> Adi

你可能感兴趣的:(Q\A about VME bus for Vxworks)