National Instruments NI-VXI Network Card User Manual


 
Chapter 2 Introduction to the NI-VXI Functions
© National Instruments Corporation 2
-
17 NI-VXI User Manual
/* At this point, the remote master can perform */
/* I/O on the shared, allocated space. In addition, */
/* the program can use the local address to perform */
/* I/O on the same space, such as reading back a block */
/* of data */
bufaddr = malloc (4096);
ret = VXImemCopy (useraddr, bufaddr, 4096, 0);
/* Return memory to local system */
ret = VXImemFree(useraddr);
ret = CloseVXIlibrary();
}
Interrupts and Signals
In NI-VXI, you can set up your controller to function as both an
interrupt handler and an interrupter. You can also have your controller
respond to writes to its signal register. Signaling another device
requires the high-level or low-level VXI/VMEbus access functions, as
discussed earlier. In addition, NI-VXI lets you configure both
interrupts and signals to be handled either through callback handlers or
through the signal queue. See the VXI Signal Functions section in
Chapter 3, Software Overview, for more details about the signal queue,
but for now you can look upon it as a FIFO (first-in, first-out) queue
that you can access via the signal queue management functions, such as
SignalDeq()
. Both the signal queue and the callback handler will
provide the status/ID obtained from the interrupt acknowledge or from
the signal register. You can use this value to determine which device
generated the interrupt/signal as well as the cause of the event. See the
VXI Interrupt Functions section in Chapter 3, Software Overview, for
more information.
Handling either signals or interrupts through the signal queue is very
straightforward. You can use the
RouteVXIint()
and
RouteSignal()
functions to specify that the events should be handled
by the signal queue. After you have enabled the event handler through
either the
EnableSignalInt()
or the
EnableVXItoSignalInt()
call, the event is placed on the queue when it occurs. You can use the
SignalDeq()
or
WaitForSignal()
functions to retrieve the event
from the queue.
Note:
RESMAN
allocates interrupt lines to VXI devices that support the
programmable interrupt command. Devices should use only those
interrupt lines allocated to them. Again, you can use
GetDevInfo()
to
determine what interrupt lines have been allocated to the controller.