Move a large block of data in NI-VISA or the NI-VXI API
The most efficient way to move a block of data is to use viMoveX() in NI-VISA or VXImove() in the NI-VXI API. (National Instruments recommends using NI-VISA, rather than the NI-VXI API, to develop your application.) You can find an example of how to use these functions in the NI-VISA and NI-VXI API examples directories. The NI-VISA example is in the vxipnp\win32\Nivisa\examples directory and is called HighReg.c. The NI-VXI API example in the nivxi\win32\examples directory is called VXIblock.c.
Optimizing Large VXIbus Transfers
For best performance, keep the following in mind when using viMove() or VXImove():
- Make sure your buffers are 32-bit aligned.
- Transfer 32-bit data whenever possible.
- Use VXI block access privileges to significantly improve performance to devices that can accept block transfers, and likewise use D64 access privileges for devices that can accept the VME64 64-bit data transfer protocol.
- To optimize move performance on virtual memory systems such as the Windows operating system, lock the user buffer in memory yourself so the move operation does not need to lock the buffer.
- To optimize move performance on paged memory systems such as the Windows operating system, use a contiguous buffer so the move operation does not need to build a scatter-gather list for the user buffer.
Note viMemAlloc() or VXImemAlloc() returns 32-bit aligned, page-locked, continuous buffers that work efficiently with the move operations. |