Master Memory Access - National Instruments NI-VXI User Manual

Ni-vxi user manual
Table of Contents

Advertisement

Chapter 2
Introduction to the NI-VXI Functions

Master Memory Access

C/C++ Example:
#include <nivxi.h>
#include <stdio.h>
main() {
INT16 ret, la;
UINT16 *addrptr, svalue;
UINT32 addr, window1;
INT32 timeout;
UINT32 addrptr1;
/* Start all programs with this function */
ret = InitVXIlibrary();
BusErrorRecv = 0;
/* The following code maps the A16 space with the Access Only */
/* access in order to access the A16 space directly.
addr = 0xc000L;
NI-VXI User Manual
You can access VXIbus memory directly through the NI-VXI
high-level and low-level VXIbus access functions, within the
capabilities of the controller. The main difference between the
high-level and low-level access functions is in the amount of
encapsulation given by NI-VXI.
The high-level VXIbus access functions include functions such as
and
VXIin()
VXImove()
VXI system without dealing with such details as memory-mapping
windows, status checking, and recovering from bus timeouts. Although
these functions tend to have more overhead associated with them than
the low-level functions, they are much simpler to use and typically
require less debugging. We recommend that beginner programmers in
VXI rely on the high-level functions until they are familiar with VXI
memory accesses.
You can use the low-level VXI/VMEbus access functions if you want
to access VXI/VME memory with as little overhead as possible.
Although you now have to perform such actions as bus error handling
and mapping—which are handled automatically by the high-level
functions—you can experience a performance gain if you optimize for
the particular accesses you are performing. Consider the following
sample code, which performs a memory access using the low-level
functions. Notice that there is no bus error handler installed by the
program (See the Interrupts and Signals section). Instead, the program
uses the NI-VXI default bus error handler. This handler automatically
increments the
BusErrorRecv
/* BusErrorRecv defined in nivxi.h */
/* Map upper 16 KB of the A16 space */
2-14
that you can use to access memory in the
global variable.
/* Reset global variable */
© National Instruments Corporation
*/

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents