Programming considerations, Programming considerations -27 – National Instruments NI-VXI User Manual

Page 65

Advertising
background image

Chapter 3 Software Overview

© National Instruments Corporation

3-27

NI-VXI User Manual

Programming Considerations

All accesses to the VXI/VMEbus address spaces are performed by
reads and writes to particular offsets within the local CPU address
space, which are made to correspond to addresses on the VXI/VMEbus
(using a hardware interface). The areas where the address space of the
local CPU is mapped onto the VXI/VMEbus are referred to as
windows. The sizes and numbers of windows present vary depending
on the hardware being used. The size of the window is always a power
of two, where a multiple of the size of the window would encompass
an entire VXI/VMEbus address space. The multiple for which a
window currently can access is determined by modifying a window
base
register.

The constraints of a particular hardware platform lead to restrictions on
the area of address space reserved for windows into VXI/VMEbus
address spaces. Be sure to take into account the number and size of the
windows provided by a particular platform. If a mapped pointer is to be
incremented or decremented, the bounds for accessing within a
particular address space must be tested before accessing within the
space.

NI-VXI uses a term within this chapter called the hardware
(or window) context. The hardware context for window to VXI/VME
consists of the VXI/VME address space being accessed, the base offset
into the address space, the access privilege, and the byte order for the
accesses through the window. Before accessing a particular address,
you must set up the window with the appropriate hardware context.
You can use the

MapVXIAddress

function for this purpose. This

function returns a pointer that you can use for subsequent accesses to
the window with the

VXIpeek

and

VXIpoke

functions.

On most systems,

VXIpeek

and

VXIpoke

are really C macros

(

#defines

) that dereference the pointer. It is highly recommended to

use these functions instead of performing the direct dereference within
the application. If your application does not use

VXIpeek

and

VXIpoke

, it might not be portable between different platforms. In

addition,

VXIpeek

and

VXIpoke

allow for compatibility between the

C language and other languages such as BASIC.

Advertising