National Instruments NI-VXI Network Card User Manual


 
Chapter 2 Introduction to the NI-VXI Functions
NI-VXI User Manual 2-16 © National Instruments Corporation
Note:
On modern, 32-bit operating systems running on high-performance
processors (such as Microsoft Windows NT on a Pentium or Solaris 2
on a SPARC), we have found no performance gained by using macros
instead of functions. For this reason, we strongly recommend that you use
functions on these platforms to allow your program to be more portable
across future platforms.
Slave Memory Access
It is possible to share local resources such as RAM with the
VXI/VMEbus. You can accomplish this functionality by setting the
appropriate fields in the
VXIedit
or
VXItedit
NI-VXI resource
editor utility to instruct the controller to respond to bus accesses as a
slave. What address space is used is dependent on the settings in
VXIedit
or
VXItedit
. However, the actual VXI/VMEbus memory
addresses are assigned by
RESMAN
and should be read by the program
through the
GetDevInfo()
function.
Keep in mind that when the controller shares its resources, it may not
allocate them from the local system first. For example, if you instruct
the system to share 1 MB of RAM, the controller will map VXI/VME
addresses (as defined by
RESMAN
) to 1 MB of local memory. However,
the controller may not have prevented the local system from also using
this space. For example, on a IBM compatible PC, the first 1 MB of
address space contains not only user RAM, but also the interrupt vector
table, video memory, BIOS, and so on. Therefore, it is important that
you first use
VXImemAlloc()
to reserve a portion of the shared
memory, and then communicate this address to the remote master that
will be accessing the slave memory. For example, assume that the
following code will run on a controller that has shared 1 MB of local
RAM.
C/C++ Example:
main() {
INT16 ret;
UINT32 *useraddr, vxiaddr;
void *bufaddr;
/* Initialize and allocate 4 KB of memory */
ret = InitVXIlibrary();
ret = VXImemAlloc(4096, &useraddr, &vxiaddr);
/* Put code here to communicate vxiaddr */
/* returned by VXImemAlloc */