Chapter 3 Software Overview
NI-VXI User Manual
3-28
© National Instruments Corporation
Multiple-Pointer Access for a Window
Application programmers can encounter a potential problem when the
application requires different privilege states, byte orders, and/or base
addresses within the same window. If the hardware context changes
due to a subsequent call to
MapVXIAddress
or other calls such as
SetPrivilege
or
SetByteOrder
, previously mapped pointers would
not have their intended access parameters. This problem is greater in a
multitasking system, where independent and conflicting processes can
change the hardware context. Two types of access privileges to a
window are available to aid in solving this problem: Owner Privilege,
and Access-Only Privilege. These two privileges define which caller of
the
MapVXIAddress
function can change the settings of the
corresponding window.
Owner Privilege
A caller can obtain Owner Privilege to a window by requesting owner
privilege in the
MapVXIAddress
call (via the accessparms parameter).
This call will not succeed if another process already has either Owner
Privilege or Access-Only Privilege to that window. If the call succeeds,
the function returns a valid pointer and a non-negative return value.
The 32-bit windowId output parameter returned from the
MapVXIAddress
call associates the C pointer returned from the
function with a particular window and also signifies Owner Privilege to
that window. Owner Privilege access is complete and exclusive. The
caller can use
SetPrivilege
,
SetByteOrder
, and
SetContext
with
this windowId to dynamically change the access privileges.
Notice that if the call to
MapVXIAddress
succeeds for either Owner
Privilege or Access-Only Privilege, the pointer remains valid in both
cases until an explicit
UnMapVXIAddress
call is made for the
corresponding window. The pointer is guaranteed to be a valid pointer
in either multitasking systems or nonmultitasking systems. The
advantage with Owner Privilege is that it gives complete and exclusive
access for that window to the caller, so you can dynamically change the
access privileges. Because no other callers can succeed, there is no
problem with either destroying another caller’s access state or having
an inconsistent pointer environment.
Access-Only Privilege
A process can obtain Access-Only Privilege by requesting access-only
privileges in the
MapVXIAddress
call. With this privilege mode, you