
ProDAQ 3020 USB 2.0 VXIbus Slot-0 Interface User Manual
3020-XX-UM
Copyright, © 2003 Bustec Production Ltd.
Page 35 of 60
Figure 29 - Memory-based I/O
The second group of functions is intended to map a register range into the memory of the
host and accessing it directly. Because this ability is architecture and system dependent,
the VISA standard foresees an attribute, which allows determining whether the range
could be physically mapped or the system architecture does not allow it. Depending on the
value of the attribute VI_ATTR_WIN_ACCESS, the range mapped can be directly
accessed (e.g. by using a C-style pointer), or the functions viPeek8, viPeek16, viPeek32,
viPoke8, viPoke16 and viPoke32 must be used to access registers in the mapped range.
Figure 30 shows the same function as in Figure 29, this time implemented with memory
mapping functions.
Note
The ProDAQ 3020 USB 2.0 VXIbus Slot-0 interface does not support direct memory
mapping. Any access to the VXIbus is forwarded via packets on the USB bus from
the host to the interface, executed and the result send back via a second packet
from the interface to the host. Therefore the functions viPeek8, viPeek16, viPeek32,
viPoke8, viPoke16 and viPoke32 must be used when mapping a memory range
using viMapAddress.
ViStatus function rmw_register (ViSession instr_session, ViBusAddress offset, ViUInt16 mod)
{
ViStatus status;
ViChar descr[256];
ViUInt16 value;
if ((status = viIn16 (instr_session, VI_A16_SPACE, offset, &value) != VI_SUCCESS)
{
viStatusDesc (instr_session, status, descr);
if (status > VI_SUCCESS)
printf (“VISA WARNING: viIn16 returned status %08x (%s)\n”, status, descr);
else
{
printf (“VISA ERROR: viIn16 returned status %08x (%s)\n”, status, descr);
return status;
}
}
value = value | mod;
if ((status = viOut16 (instr_session, VI_A16_SPACE, offset, value) != VI_SUCCESS)
{
viStatusDesc (instr_session, status, descr);
if (status > VI_SUCCESS)
printf (“VISA WARNING: viOut16 returned status %08x (%s)\n”, status, descr);
else
{
printf (“VISA ERROR: viOut16 returned status %08x (%s)\n”, status, descr);
return status;
}
}
return VI_SUCCESS;
}
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com