FPGA Interface C API Reference

Content Type
Programming Language
Current manual

Session Functions

Session Functions

The FPGA Interface C API includes the following session functions.

NiFpga_Open

NiFpga_Status NiFpga_Open(const char* bitfile, const char* signature, const char* resource, uint32_t attribute, NiFpga_Session* session)

Opens a session to the FPGA. This call ensures that the contents of the bitfile are programmed to the FPGA. The FPGA runs unless the NiFpga_OpenAttribute_NoRun attribute is used.

Because different operating systems have different default current working directories for applications, you must pass an absolute path for the bitfile parameter. If you pass only the filename instead of an absolute path, the operating system may not be able to locate the bitfile. For example, the default current working directories are C:\ni-rt\system\ for Phar Lap ETS and /c/ for VxWorks. Because the generated *_Bitfile constant is a #define to a string literal, you can use C/C++ string-literal concatenation to form an absolute path. For example, if the bitfile is in the root directory of a Phar Lap ETS system, pass the following for the bitfile parameter.

"C:\" NiFpga_MyApplication_Bitfile.

Parameters

Name Type Description
bitfile const char* path to the bitfile
signature const char* signature of the bitfile
resource const char* RIO resource string to open (RIO0 or rio://mysystem/RIO)
attribute uint32_t bitwise OR of any NiFpga_OpenAttributes, or 0
session NiFpga_Session* outputs the session handle, which must be closed when no longer needed

Return Value

result of the call

NiFpga_Close

NiFpga_Status NiFpga_Close(NiFpga_Session session, uint32_t attribute)

Closes the session to the FPGA. The FPGA resets unless either another session is still open or you use the NiFpga_CloseAttribute_NoResetIfLastSession attribute.

Parameters

Name Type Description
session NiFpga_Session handle to a currently open session
attribute uint32_t bitwise OR of any NiFpga_CloseAttributes, or 0

Return Value

result of the call

Was this information helpful?

Log in to get a better experience

Help us improve your future ni.com experience.

Did you find the documentation you were looking for?

Submit