The LabVIEW FPGA Advanced Session Resources are provided to enable the creation of flexible middleware that interact with NI FPGA targets. For traditional drivers like DAQmx or instruments, one developer can create a library of VIs and provide them to other developers to use as seen in Figure 1.
Using the provided new LabVIEW FPGA interface capabilities, a developer can now create this same sort of instrument driver experience by creating a middleware driver on top of the LabVIEW FPGA interface as seen in Figure 2. This middleware driver can be developed flexible enough to still allow the user of this driver to customize the FPGA or change the FPGA target. The middleware can detect the contents of the FPGA, and interface with it according to what it contains. For example, the middleware's standard driver functions could allow configuration and run time interaction with six detected items of PWM IP on any NI FPGA, or four detected items of PWM IP on any NI FPGA while exposing a consistent API to the user.
LabVIEW FPGA Advanced Session Resources installs two new LabVIEW nodes:
In the example in Figure 4, a bitfile is opened by path dynamically, queried for resources, the first resource is opened and written to. In a real application you might want to do some detection to make sure the first resource is actually what you want, either by looking at the type (register or FIFO), the name, or the data type.
Note that when the top level session is closed, all child sessions are also closed.
This example opens the FPGA VI reference to inspect the session's available resources with the Get Resources node. However, in some cases you might want to inspect the bitfile prior to opening a reference because opening a reference requires RIO hardware be present. To inspect a bitfile without hardware, do not use the new Get Resources node, but rather use the already shipping VI: <\vi.lib>\rvi\Bitfile\Public\nirviGetControlsFromBitfile.vi.for controls and indicators and <LabVIEW>\resource\RVI\compilationResultUtilities\niLvFpgaGetDmaChannelInfoFromXML.vi for FIFOs. A snippit of using both of these is shown in Figure 5.
Please note the data type refnum for a control or indicator must have the resource name set to Value and must be only one item. After importing from a bitfile or VI, delete out everything but one item and change the name to Value. See Figure 6.
For FIFO resources, the name must be FIFO. See Figure 7.
Download the attached VI Package file and double click it to begin the install.
All operating systems that LabVIEW FPGA and NI-RIO supports.
The LabVIEW FPGA Advanced Interface Tools is provided as unsupported software. If you encounter a problem with this library, or if you have suggestions for a future revision, please post to the support forum for this download: LabVIEW FPGA Advanced Session Resources Feedback Do not call National Instruments for support of this library.
The attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense