Memory Access (MEMACC) Resource

Agilent VISA.NET

Memory Access (MEMACC) Resource

This topic describes the Memory Access (MEMACC) Resource that is provided to encapsulate the address space of a memory-mapped bus, such as the VXIbus.

MEMACC Resource Overview

The Memory Access (MEMACC) Resource encapsulates the address space of a memory-mapped bus such as the VXIbus. A VISA Memory Access Resource, like any other resource, starts with the basic operations and attributes of the VISA Resource Template. For example, modifying the state of an attribute is done via the operation viSetAttribute.

Although the MEMACC resource does not have viSetAttribute listed in its operations, it provides the operation because it is defined in the VISA Resource Template. From this basic set, each resource adds its specific operations and attributes that allow it to perform its dedicated task, such as reading a register or writing to a memory location.

The MEMACC Resource lets a controller interact with the interface associated with this resource. It does this by providing the controller with services to access arbitrary registers or memory addresses on memory-mapped buses.

MEMACC Resource Attributes

Note: AP = Access Privileges

Attribute Name

AP

Data Type

Range

Default

Generic MEMACC Resource Attributes

VI_ATTR_DMA_ALLOW_EN

RW

Local

ViBoolean

VI_TRUE
VI_FALSE

N/A

VI_ATTR_INTF_INST_NAME

RO

Global

ViString

N/A

N/A

VI_ATTR_INTF_NUM

RO

Global

ViUInt16

0 to FFFFh

0

VI_ATTR_INTF_TYPE

RO

Global

ViUInt16

VI_INTF_VXI
VI_INTF_GPIB_VXI
VI_INTF_PXI

N/A

VI_ATTR_TMO_VALUE

RW

Local

ViUInt32

VI_TMO_IMMEDIATE
1 to FFFFFFFEh
VI_TMO_INFINITE

2000 msec.

VXI and GPIB-VXI and PXI Specific MEMACC Resource Attributes

VI_ATTR_DEST_INCREMENT

RW

Local

ViInt32

0 to 1

1

VI_ATTR_SRC_INCREMENT

RW

Local

ViInt32

0 to 1

1

VI_ATTR_WIN_ACCESS

RO

Local

ViUInt16

VI_NMAPPED
VI_USE_OPERS
VI_DEREF_ADDR

VI_NMAPPED

VI_ATTR_WIN_BASE_ADDR_32

RO

Local

ViBusAddress

N/A

N/A

VI_ATTR_WIN_BASE_ADDR_64

RO

Local

ViBusAddress64

N/A

N/A

VI_ATTR_WIN_SIZE_32

RO

Local

ViBusSize

N/A

N/A

VI_ATTR_WIN_SIZE_64

RO

Local

ViBusSize64

N/A

N/A

VXI and GPIB-VXI Specific MEMACC Resource Attributes

VI_ATTR_DEST_ACCESS_PRIV

RW

Local

ViUInt16

VI_DATA_NPRIV
VI-DATA_PRIV
VI_PROG_NPRIV
VI_PROG_PRIV
VI_BLCK_NPRIV
VI_BLCK_PRIV
VI_D64_NPRIV
VI_D64_PRIV

VI_DATA_PRIV

VI_ATTR_DEST_BYTE_ORDER

RW

Local

ViUInt16

VI_BIG_ENDIAN
VI_LITTLE_ENDIAN

VI_BIG_ENDIAN

VI_ATTR_SRC_ACCESS_PRIV

RW

Local

ViUInt16

VI_DATA_NPRIV
VI_DATA_PRIV
VI_PROG_NPRIV
VI_PROG_PRIV
VI_BLCK_NPRIV
VI_BLCK_PRIV
VI_D64_NPRIV
VI_D64_PRIV

VI_DATA_PRIV

VI_ATTR_SRC_BYTE_ORDER

RW

Local

ViUInt16

VI_BIG_ENDIAN
VI_LITTLE_ENDIAN

VI_BIG_ENDIAN

VI_ATTR_VXI_LA

RO

Global

ViInt16

0 to 255

N/A

VI_ATTR_WIN_ACCESS_PRIV

RW*

Local

ViUInt16

VI_DATA_NPRIV
VI-DATA_PRIV
VI_PROG_NPRIV
VI_PROG_PRIV
VI_BLCK_NPRIV
VI_BLCK_PRIV

VI_DATA_PRIV

VI_ATTR_WIN_BYTE_ORDER

RW*

Local

ViUInt16

VI_BIG_ENDIAN
VI_LITTLE_ENDIAN

VI_BIG_ENDIAN

* For VISA 2.2, the attributes VI_ATTR_WIN_BYTE_ORDER and VI_ATTR_WIN_ACCESS_PRIV are RW (readable and writeable) when the corresponding session is not mapped ( VI_ATTR_WIN_ACCESS = = VI_NMAPPED). When the session is mapped, these attributes are RO (read only).

VXI and GPIB-VXI Specific MEMACC Resource Attributes

VI_ATTR_GPIB_SECONDARY_ADDR

RO

Global

ViUInt16

0 to 30, VI_NO_SEC_ADDR

N/A

VI_ATTR_GPIB_PRIMARY_ADDR

RO

Global

ViUInt16

0 to 30

N/A

VI_ATTR_INTF_PARENT_NUM

RO

Global

ViUInt16

0 to FFFFh

N/A

MEMACC Resource Attribute Descriptions

Attribute Name

Description

Generic MEMACC Resource Attributes

VI_ATTR_DMA_ALLOW_EN

This attribute specifies whether I/O accesses should use DMA ( VI_TRUE VI_FALSE). In some implementations, this attribute may have global effects even though it is documented to be a local attribute. Since this affects performance and not functionality, that behavior is acceptable.

VI_ATTR_INTF_INST_NAME

Human-readable text describing the given interface.

VI_ATTR_INTF_NUM

Board number for the given interface.

VI_ATTR_INTF_TYPE

Interface type of the given session.

VI_ATTR_TMO_VALUE

Minimum timeout value to use, in milliseconds. A timeout value of VI_TMO_IMMEDIATE means that operations should never wait for the device to respond. A timeout value of VI_TMO_INFINITE disables the timeout mechanism.

VXI and GPIB-VXI and PXI Specific MEMACC Resource Attributes

VI_ATTR_DEST_INCREMENT

This is used in the viMoveOutXX operation to specify how much the destination offset is to be incremented after every transfer. The default value of this attribute is 1 (that is, the destination address will be incremented by 1 after each transfer), and the viMoveOutXX operation moves into consecutive elements. If this attribute is set to 0, the viMoveOutXX operation will always write to the same element, essentially treating the destination as a FIFO register.

VI_ATTR_SRC_INCREMENT

This is used in the viMoveInXX operation to specify how much the source offset is to be incremented after every transfer. The default value of this attribute is 1 (that is, the source address will be incremented by 1 after each transfer), and the viMoveInXX operation moves from consecutive elements. If this attribute is set to 0, the viMoveInXX operation will always read from the same element, essentially treating the source as a FIFO register.

VI_ATTR_WIN_ACCESS

Modes in which the current window may be accessed: not currently mapped, through operations viPeekXX and viPokeXX only, or through operations and/or by directly dereferencing the address parameter as a pointer.

VI_ATTR_WIN_BASE_ADDR_32
VI_ATTR_WIN_BASE_ADDR_64

Base address of the interface bus to which this window is mapped.

VI_ATTR_WIN_SIZE_32
VI_ATTR_WIN_SIZE_64

Size of the region mapped to this window.

VXI and GPIB-VXI Specific MEMACC Resource Attributes

VI_ATTR_DEST_ACCESS_PRIV

This attribute specifies the address modifier to be used in high-level access operations, such as viOutXX and viMoveOutXX, when writing to the destination.

VI_ATTR_DEST_BYTE_ORDER

This attribute specifies the byte order to be used in high-level access operations, such as viOutXX and viMoveOutXX, when writing to the destination.

VI_ATTR_SRC_ACCESS_PRIV

This attribute specifies the address modifier to be used in high-level access operations, such as viInXX and viMoveInXX, when reading from the source.

VI_ATTR_SRC_BYTE_ORDER

This attribute specifies the byte order to be used in high-level access operations, such as viInXX and viMoveInXX, when reading from the source.

VI_ATTR_VXI_LA

Logical address of the local controller.

VI_ATTR_WIN_ACCESS_PRIV

This attribute specifies the address modifier to be used in low-level access operations, such as viMapAddress, viPeekXX and viPokeXX, when accessing
the mapped window.

VI_ATTR_WIN_BYTE_ORDER

This attribute specifies the byte order to be used in low-level access operations, such as  viMapAddress, viPeekXX and viPokeXX, when accessing the mapped window.

GPIB-VXI Specific MEMACC Resource Attributes

VI_ATTR_GPIB_PRIMARY_ADDR

Primary address of the GPIB-VXI controller used by the given session.

VI_ATTR_GPIB_SECONDARY_ADDR

Secondary address of the GPIB-VXI controller used by the given session.

VI_ATTR_INTF_PARENT_NUM

Board number of the GPIB board to which the GPIB-VXI is attached.

MEMACC Resource Events

This resource defines the following event for communication with applications, where AP = Access Privilege.

VI_EVENT_IO_COMPLETION - Notification that an asynchronous operation has completed.

Event Attribute

Description

AP

Data Type

Range

VI_ATTR_BUFFER

Address of a buffer that was used in an asynchronous operation.

RO

ViBuf

N/A

VI_ATTR_EVENT_TYPE

Unique logical identifier of the event.

RO

ViEventType

VI_EVENT_IO_COMPLETION

VI_ATTR_JOB_ID

 

Job ID of the asynchronous operation that has completed.

RO

iJobId

N/A

VI_ATTR_OPER_NAME

Name of the operation generating the event.

RO

iString

N/A

VI_ATTR_STATUS

Return code of the asynchronous I/O operation that has completed.

RO

iStatus

N/A

VI_ATTR_RET_COUNT

Actual number of elements that were asynchronously transferred.

RO

ViBus Size

*

VI_ATTR_RET_COUNT_32

Actual number of elements that were asynchronously transferred.

RO

ViUInt32

0 to FFFFFFFFh

VI_ATTR_RET_COUNT_64**

Actual number of elements that were asynchronously transferred.

RO

ViUInt64

0 to FFFFFFFF FFFFFFFFh

*The data type is defined in the appropriate VPP 4.3.x framework specification.

**Defined only for operating systems that are 64-bit native.

MEMACC Resource Operations

viIn8 (vi, space, offset, val8)

viIn16 (vi, space, offset, val16)

viIn32 (vi, space, offset, val32)

viIn64 (vi, space, offset, val64)

 

viMapAddress (vi, mapSpace, mapBase, mapSize, access, suggested, address)

viMapAddressEx (vi, mapSpace, mapBase64, mapSize, access, suggested, address) 

viMemAlloc(vi, size, offset)
viMemFree(vi, offset)
viMemAllocEx(vi, size, offset64)
viMemFreeEx(vi, offset64)

viMove (vi, srcSpace, srcOffset, srcWidth, destSpace, destOffset, destWidth, length)

viMovEx (vi, srcSpace, srcOffset64, srcWidth, destSpace, destOffset64, destWidth, length) 

viMoveAsync (vi, srcSpace, srcOffset, srcWidth, destSpace, destOffset, destWidth, length, jobId)

viMoveAsyncEx (vi, srcSpace, srcOffset64, srcWidth, destSpace, destOffset64, destWidth, length, jobId) 

 

viMoveIn8 (vi, space, offset, length, buf8)

viMoveIn16 (vi, space, offset, length, buf16)

viMoveIn32 (vi, space, offset, length, buf32)

viMoveIn64 (vi, space, offset, length, buf64)

viMoveIn8Ex (vi, space, offset64, length, buf8)

viMoveIn16Ex (vi, space, offset64, length, buf16)

viMoveIn32Ex (vi, space, offset64, length, buf32)

viMoveIn64Ex (vi, space, offset64, length, buf64) 

viMoveOut8 (vi, space, offset, length, buf8)

viMoveOut16 (vi, space, offset, length, buf16)

viMoveOut32 (vi, space, offset, length, buf32)

viMoveOut64 (vi, space, offset, length, buf64)

viMoveOut8Ex (vi, space, offset64, length, buf8)

viMoveOut16Ex (vi, space, offset64, length, buf16)

viMoveOut32Ex (vi, space, offset64, length, buf32)

viMoveOut64Ex (vi, space, offse64, length, buf64) 

 

viOut8 (vi, space, offset, val8)

viOut16 (vi, space, offset, val16)

viOut32 (vi, space, offset, val32)

viOut64 (vi, space, offset, val64)

 

viPeek8 (vi, addr, val8)

viPeek16 (vi, addr, val16)

viPeek32 (vi, addr, val32)

viPeek64 (vi, addr, val64)

viPoke8 (vi, addr, val8)

viPoke16 (vi, addr, val16)

viPoke32 (vi, addr, val32)

viPoke64 (vi, addr, val64)

 

viUnmapAddress (vi)