diff --git a/Makefile b/Makefile index c5d8e81..8aafbea 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ include Makefile.inc # # All Target -all: ts-VMSd +all: vmscli utils/vmsrawdump ts-VMSd src/libVMS.a: FORCE $(MAKE) -C src libVMS.a @@ -16,9 +16,16 @@ ts-VMSd: src/ts-VMSd.cpp.o src/libVMS.a @echo '[LD ] $@' ${co}$(CPP) $(LIBS_FLAGS) -o $@ $^ ${CRIOCPP}/lib/libcRIOcpp.a $(LIBS) +vmscli: src/vmscli.cpp.o src/libVMS.a + @echo '[LD ] $@' + ${co}$(CPP) $(LIBS_FLAGS) -o $@ $^ ../ts_cRIOcpp/lib/libcRIOcpp.a $(LIBS) $(shell pkg-config --libs readline $(silence)) -lreadline + +utils/vmsrawdump: utils/vmsrawdump.cpp + @${MAKE} -C utils + # Other Targets clean: - @$(foreach file,ts_MTVMS src/ts_MTVMS.cpp.o *.ipk ipk, echo '[RM ] ${file}'; $(RM) -r $(file);) + @$(foreach file,ts-VMSd vmscli src/ts-VMS.cpp.o src/vmscli.cpp.o *.ipk ipk, echo '[RM ] ${file}'; $(RM) -r $(file);) @$(foreach dir,src tests,$(MAKE) -C ${dir} $@;) # file targets @@ -44,14 +51,17 @@ ipk: ts-VMS_$(VERSION)_x64.ipk TS_DDSCONFIG=../ts_ddsconfig -ts-VMS_$(VERSION)_x64.ipk: ts-VMSd +ts-VMS_$(VERSION)_x64.ipk: vmscli utils/vmsrawdump ts-VMSd @echo '[MK ] ipk $@' + ${co}mkdir -p ipk/data/usr/bin ${co}mkdir -p ipk/data/usr/sbin ${co}mkdir -p ipk/data/etc/init.d ${co}mkdir -p ipk/data/etc/default ${co}mkdir -p ipk/data/var/lib/MTVMS ${co}mkdir -p ipk/control - ${co}cp ts-VMSd ipk/data/usr/sbin/ts-VMSd + ${co}cp vmscli ipk/data/usr/bin/ + ${co}cp utils/vmsrawdump ipk/data/usr/bin/ + ${co}cp ts-VMSd ipk/data/usr/sbin/ ${co}cp init ipk/data/etc/init.d/ts-VMS ${co}cp default_ts-VMS ipk/data/etc/default/ts-VMS ${co}cp -r SettingFiles/* ipk/data/var/lib/MTVMS diff --git a/Makefile.inc b/Makefile.inc index e1f0616..3ad7aea 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -54,7 +54,8 @@ endif LIBS += $(PKG_LIBS) -ldl -ldcpssacpp -ldcpsgapi -lddsuser -lddskernel \ -lpthread -lddsserialization -lddsconfparser -lddsconf \ -lddsdatabase -lddsutil -lddsos \ - ${SAL_WORK_DIR}/lib/libSAL_MTVMS.a + ${SAL_WORK_DIR}/lib/libSAL_MTVMS.a \ + -lstdc++fs LIBS_FLAGS += -L${OSPL_HOME}/lib -L${LSST_SDK_INSTALL}/lib diff --git a/SettingFiles/CameraRotator.yaml b/SettingFiles/CameraRotator.yaml index de95133..24ac749 100644 --- a/SettingFiles/CameraRotator.yaml +++ b/SettingFiles/CameraRotator.yaml @@ -2,6 +2,7 @@ Subsystem : "CameraRotator" IsController : true Period: 5 OutputType: 3 +Sensors: 3 XCoefficients : [1.0,1.0,1.0] YCoefficients : [1.0,1.0,1.0] ZCoefficients : [1.0,1.0,1.0] diff --git a/SettingFiles/M1M3.yaml b/SettingFiles/M1M3.yaml index 05d6f02..c46276b 100644 --- a/SettingFiles/M1M3.yaml +++ b/SettingFiles/M1M3.yaml @@ -2,6 +2,7 @@ Subsystem : "M1M3" IsController : true Period: 5 OutputType: 3 +Sensors: 3 XCoefficients : [1.0,1.0,1.0] YCoefficients : [1.0,1.0,1.0] ZCoefficients : [1.0,1.0,1.0] diff --git a/SettingFiles/M2.yaml b/SettingFiles/M2.yaml index 884111e..e11b19a 100644 --- a/SettingFiles/M2.yaml +++ b/SettingFiles/M2.yaml @@ -1,7 +1,8 @@ Subsystem : "M2" +IsController : true Period: 5 OutputType: 3 -IsController : true +Sensors: 6 XCoefficients : [1.0,1.0,1.0] YCoefficients : [1.0,1.0,1.0] ZCoefficients : [1.0,1.0,1.0] diff --git a/doc/version-history.rst b/doc/version-history.rst index a196fd4..0ccf57e 100644 --- a/doc/version-history.rst +++ b/doc/version-history.rst @@ -4,6 +4,11 @@ Version History =============== +v1.2.2 +------ + +* vmscli, vmsrawdump utilities + v1.2.1 ------ diff --git a/init b/init index bdf6eb7..e35dde9 100755 --- a/init +++ b/init @@ -48,12 +48,12 @@ startdaemon(){ done logger -t VMS_start -p user.info "Starting with IP $LSST_DDS_IP" echo -n "Starting TS VMS $1:" - start-stop-daemon --start --oknodo --pidfile ${PIDFILE}_$1.pid --startas $DAEMON -- -p ${PIDFILE}_$1.pid -u vms:vms $1 + start-stop-daemon --start --oknodo --pidfile ${PIDFILE}_$1.pid --exec $DAEMON -- -p ${PIDFILE}_$1.pid -u vms:vms $1 echo "done" } stopdaemon(){ echo -n "Stopping TS VMS $1:" - start-stop-daemon --stop --oknodo --remove-pidfile --retry 5 -p ${PIDFILE}_$1.pid + start-stop-daemon --stop --oknodo --remove-pidfile --user vms --retry 5 -p ${PIDFILE}_$1.pid sudo -E -u vms -g vms LD_LIBRARY_PATH=$OSPL_HOME/lib PATH=$PATH:$OSPL_HOME/bin $OSPL_HOME/bin/ospl stop echo "done" } diff --git a/src/LSST/VMS/Accelerometer.cpp b/src/LSST/VMS/Accelerometer.cpp index 37b9f05..2c9c027 100644 --- a/src/LSST/VMS/Accelerometer.cpp +++ b/src/LSST/VMS/Accelerometer.cpp @@ -26,52 +26,18 @@ #include #include #include -#include -#define AXIS_PER_SENSOR 3 -#define MAX_SAMPLE_PER_PUBLISH 50 #define G2M_S_2(g) (g * 9.80665) -namespace LSST { -namespace VMS { +using namespace LSST::VMS; Accelerometer::Accelerometer(VMSApplicationSettings *vmsApplicationSettings) { SPDLOG_DEBUG("Accelerometer::Accelerometer()"); _vmsApplicationSettings = vmsApplicationSettings; - - if (vmsApplicationSettings->Subsystem == "M1M3") { - _subsystem = M1M3; - _numberOfSensors = 3; - } else if (vmsApplicationSettings->Subsystem == "M2") { - _subsystem = M2; - _numberOfSensors = 6; - } else if (vmsApplicationSettings->Subsystem == "CameraRotator") { - _subsystem = CameraRotator; - _numberOfSensors = 3; - } else if (vmsApplicationSettings->Subsystem == "TMA") { - _subsystem = TMA; - _numberOfSensors = 3; - } else { - SPDLOG_ERROR("Unknown subsystem: {}", vmsApplicationSettings->Subsystem); - exit(EXIT_FAILURE); - } - _sampleData = new MTVMS_dataC[_numberOfSensors]; - _psds = new Telemetry::PSD[_numberOfSensors]; - _dataIndex = 0; - - float _periodInS = _vmsApplicationSettings->period / 1000.0f; - - for (int s = 0; s < _numberOfSensors; s++) { - _sampleData[s].sensor = s + 1; - _psds[s].configure(s + 1, 1.0f / (2.0f * _periodInS), _periodInS); - } } -Accelerometer::~Accelerometer(void) { - delete[] _psds; - delete[] _sampleData; -} +Accelerometer::~Accelerometer(void) {} void Accelerometer::enableAccelerometers() { SPDLOG_INFO("Accelerometer: enableAccelerometers(), period {}, output type {}", @@ -87,40 +53,19 @@ void Accelerometer::disableAccelerometers() { } void Accelerometer::sampleData() { - SPDLOG_TRACE("Accelerometer: sampleData() count {}", _dataIndex); - uint32_t buffer[_numberOfSensors * AXIS_PER_SENSOR]; + SPDLOG_TRACE("Accelerometer: sampleData()"); + uint32_t buffer[_vmsApplicationSettings->sensors * AXIS_PER_SENSOR]; - FPGA::instance().readResponseFIFO(buffer, _numberOfSensors * AXIS_PER_SENSOR, + FPGA::instance().readResponseFIFO(buffer, _vmsApplicationSettings->sensors * AXIS_PER_SENSOR, _vmsApplicationSettings->period * 2); - if (_dataIndex == 0) { - double data_timestamp = VMSPublisher::instance().getTimestamp(); - - for (int s = 0; s < _numberOfSensors; s++) { - _sampleData[s].timestamp = data_timestamp; - } - } - uint32_t *dataBuffer = buffer; - for (int s = 0; s < _numberOfSensors; s++) { + for (int s = 0; s < _vmsApplicationSettings->sensors; s++) { float acc_x = _convert(&dataBuffer); float acc_y = _convert(&dataBuffer); float acc_z = _convert(&dataBuffer); - _sampleData[s].accelerationX[_dataIndex] = acc_x; - _sampleData[s].accelerationY[_dataIndex] = acc_y; - _sampleData[s].accelerationZ[_dataIndex] = acc_z; - - _psds[s].append(acc_x, acc_y, acc_z); - } - - _dataIndex++; - - if (_dataIndex >= MAX_SAMPLE_PER_PUBLISH) { - for (int s = 0; s < _numberOfSensors; s++) { - VMSPublisher::instance().putData(&(_sampleData[s])); - } - _dataIndex = 0; + processData(s, acc_x, acc_y, acc_z); } } @@ -148,6 +93,3 @@ float Accelerometer::_convert(uint32_t **data) { return NAN; } } - -} /* namespace VMS */ -} /* namespace LSST */ diff --git a/src/LSST/VMS/Accelerometer.h b/src/LSST/VMS/Accelerometer.h index 25bb712..fb9209a 100644 --- a/src/LSST/VMS/Accelerometer.h +++ b/src/LSST/VMS/Accelerometer.h @@ -21,16 +21,16 @@ * along with this program. If not, see . */ -#ifndef ACCELEROMETER_H_ -#define ACCELEROMETER_H_ +#ifndef __ACCELEROMETER_H_ +#define __ACCELEROMETER_H_ -#include -#include #include namespace LSST { namespace VMS { +constexpr static int AXIS_PER_SENSOR = 3; + /** * VMS Accelerometer sampling. */ @@ -44,19 +44,18 @@ class Accelerometer { void sampleData(); +protected: + VMSApplicationSettings *_vmsApplicationSettings; + + virtual void processData(int sensor, float acc_x, float acc_y, float acc_z) = 0; + private: enum { M1M3, M2, CameraRotator, TMA } _subsystem; - int _numberOfSensors; - int _dataIndex; - MTVMS_dataC *_sampleData; - Telemetry::PSD *_psds; - VMSApplicationSettings *_vmsApplicationSettings; - float _convert(uint32_t **data); }; } /* namespace VMS */ } /* namespace LSST */ -#endif /* ACCELEROMETER_H_ */ +#endif /* __ACCELEROMETER_H_ */ diff --git a/src/LSST/VMS/Commands/EnterControl.h b/src/LSST/VMS/Commands/EnterControl.h index a92ccc1..11be3cd 100644 --- a/src/LSST/VMS/Commands/EnterControl.h +++ b/src/LSST/VMS/Commands/EnterControl.h @@ -25,9 +25,10 @@ #include #include -#include -#include +#include + +#include #include namespace LSST { diff --git a/src/LSST/VMS/Events/FPGAState.cpp b/src/LSST/VMS/Events/FPGAState.cpp index dfb9292..9fff79f 100644 --- a/src/LSST/VMS/Events/FPGAState.cpp +++ b/src/LSST/VMS/Events/FPGAState.cpp @@ -38,6 +38,9 @@ FPGAState::FPGAState(token) { } void FPGAState::send() { + if (instance()._publish == false) { + return; + } salReturn ret = VMSPublisher::SAL()->putSample_logevent_fpgaState(&instance()); if (ret != SAL__OK) { SPDLOG_WARN("Can not send fpgaState: {}", ret); diff --git a/src/LSST/VMS/Events/FPGAState.h b/src/LSST/VMS/Events/FPGAState.h index 625f084..68123eb 100644 --- a/src/LSST/VMS/Events/FPGAState.h +++ b/src/LSST/VMS/Events/FPGAState.h @@ -45,6 +45,12 @@ class FPGAState final : MTVMS_logevent_fpgaStateC, public cRIO::Singleton #ifdef SIMULATOR -#include #include #endif @@ -44,8 +43,7 @@ #include #include -namespace LSST { -namespace VMS { +using namespace LSST::VMS; FPGA::FPGA(token) : SimpleFPGA(LSST::cRIO::VMS) {} @@ -259,6 +257,3 @@ void FPGA::readResponseFIFO(uint32_t *data, size_t length, int32_t timeoutInMs) } #endif } - -} /* namespace VMS */ -} /* namespace LSST */ diff --git a/src/LSST/VMS/FileAccelerometer.cpp b/src/LSST/VMS/FileAccelerometer.cpp new file mode 100644 index 0000000..6cb70c8 --- /dev/null +++ b/src/LSST/VMS/FileAccelerometer.cpp @@ -0,0 +1,71 @@ +/* + * This file is part of LSST MT VMS package. + * + * Developed for the Vera C. Rubin Telescope and Site System. + * This product includes software developed by the LSST Project + * (https://www.lsst.org). + * See the COPYRIGHT file at the top-level directory of this distribution + * for details of code ownership. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include + +#include + +#include + +using namespace LSST::VMS; + +FileAccelerometer::FileAccelerometer(VMSApplicationSettings *vmsApplicationSettings, + std::filesystem::path file_path) + : Accelerometer(vmsApplicationSettings) { + SPDLOG_DEBUG("FlleAccelerometer::FileAccelerometer({})", file_path.string()); + + auto ppath = file_path.parent_path(); + + if (!ppath.empty()) { + std::filesystem::create_directories(ppath); + } + _ofile.open(file_path, std::ofstream::out | std::ofstream::binary | std::ofstream::trunc); + _ofile.exceptions(std::ios::badbit | std::ios::failbit); + + // some magic string to identify a file + _ofile.write("VMS", 3); + uint8_t d = _vmsApplicationSettings->Subsystem.length() + 1; + _ofile.write(reinterpret_cast(&d), 1); + _ofile.write(_vmsApplicationSettings->Subsystem.c_str(), d - 1); + d = _vmsApplicationSettings->sensors; + _ofile.write(reinterpret_cast(&d), 1); +} + +FileAccelerometer::~FileAccelerometer(void) { _ofile.close(); } + +void FileAccelerometer::processData(int sensor, float acc_x, float acc_y, float acc_z) { + SPDLOG_TRACE("FileAccelerometer: processData()"); + + if (sensor == 0) { + auto now = std::chrono::system_clock::now(); + auto micros = std::chrono::duration_cast(now.time_since_epoch()).count(); + _ofile.write(reinterpret_cast(µs), sizeof(micros)); + } + + _ofile.write(reinterpret_cast(&acc_x), sizeof(acc_x)); + _ofile.write(reinterpret_cast(&acc_y), sizeof(acc_x)); + _ofile.write(reinterpret_cast(&acc_z), sizeof(acc_x)); +} diff --git a/src/LSST/VMS/FileAccelerometer.h b/src/LSST/VMS/FileAccelerometer.h new file mode 100644 index 0000000..6c0868a --- /dev/null +++ b/src/LSST/VMS/FileAccelerometer.h @@ -0,0 +1,55 @@ +/* + * This file is part of LSST MT VMS package. + * + * Developed for the Vera C. Rubin Telescope and Site System. + * This product includes software developed by the LSST Project + * (https://www.lsst.org). + * See the COPYRIGHT file at the top-level directory of this distribution + * for details of code ownership. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __FILE_ACCELEROMETER_H_ +#define __FILE_ACCELEROMETER_H_ + +#include +#include + +#include + +namespace LSST { +namespace VMS { + +/** + * VMS File Accelerometer sampling. + */ +class FileAccelerometer : public Accelerometer { +public: + FileAccelerometer(VMSApplicationSettings *vmsApplicationSettings, std::filesystem::path file_path); + virtual ~FileAccelerometer(void); + + void flush() { _ofile.flush(); } + +protected: + void processData(int sensor, float acc_x, float acc_y, float acc_z) override; + +private: + std::ofstream _ofile; +}; + +} /* namespace VMS */ +} /* namespace LSST */ + +#endif /* __FILE_ACCELEROMETER_H_ */ diff --git a/src/LSST/VMS/SALAccelerometer.cpp b/src/LSST/VMS/SALAccelerometer.cpp new file mode 100644 index 0000000..df48fae --- /dev/null +++ b/src/LSST/VMS/SALAccelerometer.cpp @@ -0,0 +1,85 @@ +/* + * This file is part of LSST MT VMS package. + * + * Developed for the Vera C. Rubin Telescope and Site System. + * This product includes software developed by the LSST Project + * (https://www.lsst.org). + * See the COPYRIGHT file at the top-level directory of this distribution + * for details of code ownership. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include +#include +#include +#include + +#define AXIS_PER_SENSOR 3 +#define MAX_SAMPLE_PER_PUBLISH 50 +#define G2M_S_2(g) (g * 9.80665) + +using namespace LSST::VMS; + +SALAccelerometer::SALAccelerometer(VMSApplicationSettings *vmsApplicationSettings) + : Accelerometer(vmsApplicationSettings) { + SPDLOG_DEBUG("Accelerometer::Accelerometer()"); + + _sampleData = new MTVMS_dataC[_vmsApplicationSettings->sensors]; + _psds = new Telemetry::PSD[_vmsApplicationSettings->sensors]; + _dataIndex = 0; + + float _periodInS = _vmsApplicationSettings->period / 1000.0f; + + for (int s = 0; s < _vmsApplicationSettings->sensors; s++) { + _sampleData[s].sensor = s + 1; + _psds[s].configure(s + 1, 1.0f / (2.0f * _periodInS), _periodInS); + } +} + +SALAccelerometer::~SALAccelerometer(void) { + delete[] _psds; + delete[] _sampleData; +} + +void SALAccelerometer::processData(int sensor, float acc_x, float acc_y, float acc_z) { + SPDLOG_TRACE("SALAccelerometer: processData() count {}", _dataIndex); + + if (_dataIndex == 0) { + double data_timestamp = VMSPublisher::instance().getTimestamp(); + + for (int s = 0; s < _vmsApplicationSettings->sensors; s++) { + _sampleData[s].timestamp = data_timestamp; + } + } + + _sampleData[sensor].accelerationX[_dataIndex] = acc_x; + _sampleData[sensor].accelerationY[_dataIndex] = acc_y; + _sampleData[sensor].accelerationZ[_dataIndex] = acc_z; + + _psds[sensor].append(acc_x, acc_y, acc_z); + + if (sensor == _vmsApplicationSettings->sensors - 1) { + _dataIndex++; + + if (_dataIndex >= MAX_SAMPLE_PER_PUBLISH) { + for (int s = 0; s < _vmsApplicationSettings->sensors; s++) { + VMSPublisher::instance().putData(&(_sampleData[s])); + } + _dataIndex = 0; + } + } +} diff --git a/src/LSST/VMS/SALAccelerometer.h b/src/LSST/VMS/SALAccelerometer.h new file mode 100644 index 0000000..75b3456 --- /dev/null +++ b/src/LSST/VMS/SALAccelerometer.h @@ -0,0 +1,56 @@ +/* + * This file is part of LSST MT VMS package. + * + * Developed for the Vera C. Rubin Telescope and Site System. + * This product includes software developed by the LSST Project + * (https://www.lsst.org). + * See the COPYRIGHT file at the top-level directory of this distribution + * for details of code ownership. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __SAL_ACCELEROMETER_H_ +#define __SAL_ACCELEROMETER_H_ + +#include + +#include +#include +#include + +namespace LSST { +namespace VMS { + +/** + * VMS SAL Accelerometer sampling. + */ +class SALAccelerometer : public Accelerometer { +public: + SALAccelerometer(VMSApplicationSettings *vmsApplicationSettings); + virtual ~SALAccelerometer(void); + +protected: + void processData(int sensor, float acc_x, float acc_y, float acc_z) override; + +private: + int _dataIndex; + MTVMS_dataC *_sampleData; + Telemetry::PSD *_psds; +}; + +} /* namespace VMS */ +} /* namespace LSST */ + +#endif /* __SAL_ACCELEROMETER_H_ */ diff --git a/src/LSST/VMS/VMSApplicationSettings.cpp b/src/LSST/VMS/VMSApplicationSettings.cpp index 33b772d..3d2f487 100644 --- a/src/LSST/VMS/VMSApplicationSettings.cpp +++ b/src/LSST/VMS/VMSApplicationSettings.cpp @@ -39,6 +39,7 @@ void VMSApplicationSettings::load(const std::string &filename) { IsController = doc["IsController"].as(); period = doc["Period"].as(5); outputType = doc["OutputType"].as(3); + sensors = doc["Sensors"].as(); RIO = doc["RIO"].as("RIO0"); XCoefficients = doc["XCoefficients"].as>(); YCoefficients = doc["YCoefficients"].as>(); diff --git a/src/LSST/VMS/VMSApplicationSettings.h b/src/LSST/VMS/VMSApplicationSettings.h index 8cee4d3..788dffc 100644 --- a/src/LSST/VMS/VMSApplicationSettings.h +++ b/src/LSST/VMS/VMSApplicationSettings.h @@ -36,6 +36,7 @@ class VMSApplicationSettings { bool IsController; int32_t period; int outputType; + int sensors; std::string RIO; std::vector XCoefficients; std::vector YCoefficients; diff --git a/src/NiFpga/NiFpga.c b/src/NiFpga/NiFpga.c index b927f72..a4361c6 100644 --- a/src/NiFpga/NiFpga.c +++ b/src/NiFpga/NiFpga.c @@ -12,37 +12,37 @@ * Platform specific includes. */ #if NiFpga_Windows - #include +#include #elif NiFpga_Linux || NiFpga_MacOsX - #include - #include - #include +#include +#include +#include #else - #error +#error #endif /* * Platform specific defines. */ #if NiFpga_Windows - #define NiFpga_CCall __cdecl - #define NiFpga_StdCall __stdcall +#define NiFpga_CCall __cdecl +#define NiFpga_StdCall __stdcall #else - #define NiFpga_CCall - #define NiFpga_StdCall +#define NiFpga_CCall +#define NiFpga_StdCall #endif /* * Global library handle, or NULL if the library isn't loaded. */ #if NiFpga_Windows - static HMODULE NiFpga_library = NULL; +static HMODULE NiFpga_library = NULL; #elif NiFpga_VxWorks - static MODULE_ID NiFpga_library = NULL; +static MODULE_ID NiFpga_library = NULL; #elif NiFpga_Linux || NiFpga_MacOsX - static void* NiFpga_library = NULL; +static void* NiFpga_library = NULL; #else - #error +#error #endif /* @@ -53,14 +53,11 @@ static char* const NiFpga_cviResourceType = "FPGA Interface C API"; -typedef void* (NiFpga_CCall *NiFpga_AcquireCviResource)(void* resource, - char* type, - char* description, - ...); +typedef void*(NiFpga_CCall* NiFpga_AcquireCviResource)(void* resource, char* type, char* description, ...); static NiFpga_AcquireCviResource NiFpga_acquireCviResource = NULL; -typedef void* (NiFpga_StdCall *NiFpga_ReleaseCviResource)(void* resource); +typedef void*(NiFpga_StdCall* NiFpga_ReleaseCviResource)(void* resource); static NiFpga_ReleaseCviResource NiFpga_releaseCviResource = NULL; #endif @@ -68,2853 +65,1586 @@ static NiFpga_ReleaseCviResource NiFpga_releaseCviResource = NULL; /* * Session management functions. */ -static NiFpga_Status (NiFpga_CCall *NiFpga_open)( - const char* path, - const char* signature, - const char* resource, - uint32_t attribute, - NiFpga_Session* session) = NULL; - -NiFpga_Status NiFpga_Open(const char* path, - const char* signature, - const char* resource, - uint32_t attribute, - NiFpga_Session* session) -{ - const NiFpga_Status result = NiFpga_open - ? NiFpga_open(path, - signature, - resource, - attribute, - session) - : NiFpga_Status_ResourceNotInitialized; - #if NiFpga_CviResourceTracking - if (NiFpga_acquireCviResource - && NiFpga_IsNotError(result)) - NiFpga_acquireCviResource((void*)*session, - NiFpga_cviResourceType, - "NiFpga_Session %#08x", - *session); - #endif - return result; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_close)( - NiFpga_Session session, - uint32_t attribute) = NULL; - -NiFpga_Status NiFpga_Close(NiFpga_Session session, - uint32_t attribute) -{ - if (!NiFpga_close) - return NiFpga_Status_ResourceNotInitialized; - #if NiFpga_CviResourceTracking - if (NiFpga_releaseCviResource) - NiFpga_releaseCviResource((void*)session); - #endif - return NiFpga_close(session, attribute); +static NiFpga_Status(NiFpga_CCall* NiFpga_open)(const char* path, const char* signature, const char* resource, + uint32_t attribute, NiFpga_Session* session) = NULL; + +NiFpga_Status NiFpga_Open(const char* path, const char* signature, const char* resource, uint32_t attribute, + NiFpga_Session* session) { + const NiFpga_Status result = NiFpga_open ? NiFpga_open(path, signature, resource, attribute, session) + : NiFpga_Status_ResourceNotInitialized; +#if NiFpga_CviResourceTracking + if (NiFpga_acquireCviResource && NiFpga_IsNotError(result)) + NiFpga_acquireCviResource((void*)*session, NiFpga_cviResourceType, "NiFpga_Session %#08x", *session); +#endif + return result; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_close)(NiFpga_Session session, uint32_t attribute) = NULL; + +NiFpga_Status NiFpga_Close(NiFpga_Session session, uint32_t attribute) { + if (!NiFpga_close) return NiFpga_Status_ResourceNotInitialized; +#if NiFpga_CviResourceTracking + if (NiFpga_releaseCviResource) NiFpga_releaseCviResource((void*)session); +#endif + return NiFpga_close(session, attribute); } /* * FPGA state functions. */ -static NiFpga_Status (NiFpga_CCall *NiFpga_run)( - NiFpga_Session session, - uint32_t attribute) = NULL; +static NiFpga_Status(NiFpga_CCall* NiFpga_run)(NiFpga_Session session, uint32_t attribute) = NULL; -NiFpga_Status NiFpga_Run(NiFpga_Session session, - uint32_t attribute) -{ - return NiFpga_run - ? NiFpga_run(session, attribute) - : NiFpga_Status_ResourceNotInitialized; +NiFpga_Status NiFpga_Run(NiFpga_Session session, uint32_t attribute) { + return NiFpga_run ? NiFpga_run(session, attribute) : NiFpga_Status_ResourceNotInitialized; } -static NiFpga_Status (NiFpga_CCall *NiFpga_abort)( - NiFpga_Session session) = NULL; +static NiFpga_Status(NiFpga_CCall* NiFpga_abort)(NiFpga_Session session) = NULL; -NiFpga_Status NiFpga_Abort(NiFpga_Session session) -{ - return NiFpga_abort - ? NiFpga_abort(session) - : NiFpga_Status_ResourceNotInitialized; +NiFpga_Status NiFpga_Abort(NiFpga_Session session) { + return NiFpga_abort ? NiFpga_abort(session) : NiFpga_Status_ResourceNotInitialized; } -static NiFpga_Status (NiFpga_CCall *NiFpga_reset)( - NiFpga_Session session) = NULL; +static NiFpga_Status(NiFpga_CCall* NiFpga_reset)(NiFpga_Session session) = NULL; -NiFpga_Status NiFpga_Reset(NiFpga_Session session) -{ - return NiFpga_reset - ? NiFpga_reset(session) - : NiFpga_Status_ResourceNotInitialized; +NiFpga_Status NiFpga_Reset(NiFpga_Session session) { + return NiFpga_reset ? NiFpga_reset(session) : NiFpga_Status_ResourceNotInitialized; } -static NiFpga_Status (NiFpga_CCall *NiFpga_download)( - NiFpga_Session session) = NULL; +static NiFpga_Status(NiFpga_CCall* NiFpga_download)(NiFpga_Session session) = NULL; -NiFpga_Status NiFpga_Download(NiFpga_Session session) -{ - return NiFpga_download - ? NiFpga_download(session) - : NiFpga_Status_ResourceNotInitialized; +NiFpga_Status NiFpga_Download(NiFpga_Session session) { + return NiFpga_download ? NiFpga_download(session) : NiFpga_Status_ResourceNotInitialized; } /* * Functions to read from scalar indicators and controls. */ -static NiFpga_Status (NiFpga_CCall *NiFpga_readBool)( - NiFpga_Session session, - uint32_t indicator, - NiFpga_Bool* value) = NULL; - -NiFpga_Status NiFpga_ReadBool(NiFpga_Session session, - uint32_t indicator, - NiFpga_Bool* value) -{ - return NiFpga_readBool - ? NiFpga_readBool(session, indicator, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readI8)( - NiFpga_Session session, - uint32_t indicator, - int8_t* value) = NULL; - -NiFpga_Status NiFpga_ReadI8(NiFpga_Session session, - uint32_t indicator, - int8_t* value) -{ - return NiFpga_readI8 - ? NiFpga_readI8(session, indicator, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readU8)( - NiFpga_Session session, - uint32_t indicator, - uint8_t* value) = NULL; - -NiFpga_Status NiFpga_ReadU8(NiFpga_Session session, - uint32_t indicator, - uint8_t* value) -{ - return NiFpga_readU8 - ? NiFpga_readU8(session, indicator, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readI16)( - NiFpga_Session session, - uint32_t indicator, - int16_t* value) = NULL; - -NiFpga_Status NiFpga_ReadI16(NiFpga_Session session, - uint32_t indicator, - int16_t* value) -{ - return NiFpga_readI16 - ? NiFpga_readI16(session, indicator, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readU16)( - NiFpga_Session session, - uint32_t indicator, - uint16_t* value) = NULL; - -NiFpga_Status NiFpga_ReadU16(NiFpga_Session session, - uint32_t indicator, - uint16_t* value) -{ - return NiFpga_readU16 - ? NiFpga_readU16(session, indicator, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readI32)( - NiFpga_Session session, - uint32_t indicator, - int32_t* value) = NULL; - -NiFpga_Status NiFpga_ReadI32(NiFpga_Session session, - uint32_t indicator, - int32_t* value) -{ - return NiFpga_readI32 - ? NiFpga_readI32(session, indicator, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readU32)( - NiFpga_Session session, - uint32_t indicator, - uint32_t* value) = NULL; - -NiFpga_Status NiFpga_ReadU32(NiFpga_Session session, - uint32_t indicator, - uint32_t* value) -{ - return NiFpga_readU32 - ? NiFpga_readU32(session, indicator, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readI64)( - NiFpga_Session session, - uint32_t indicator, - int64_t* value) = NULL; - -NiFpga_Status NiFpga_ReadI64(NiFpga_Session session, - uint32_t indicator, - int64_t* value) -{ - return NiFpga_readI64 - ? NiFpga_readI64(session, indicator, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readU64)( - NiFpga_Session session, - uint32_t indicator, - uint64_t* value) = NULL; - -NiFpga_Status NiFpga_ReadU64(NiFpga_Session session, - uint32_t indicator, - uint64_t* value) -{ - return NiFpga_readU64 - ? NiFpga_readU64(session, indicator, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readSgl)( - NiFpga_Session session, - uint32_t indicator, - float* value) = NULL; - -NiFpga_Status NiFpga_ReadSgl(NiFpga_Session session, - uint32_t indicator, - float* value) -{ - return NiFpga_readSgl - ? NiFpga_readSgl(session, indicator, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readDbl)( - NiFpga_Session session, - uint32_t indicator, - double* value) = NULL; - -NiFpga_Status NiFpga_ReadDbl(NiFpga_Session session, - uint32_t indicator, - double* value) -{ - return NiFpga_readDbl - ? NiFpga_readDbl(session, indicator, value) - : NiFpga_Status_ResourceNotInitialized; -} - -NiFpga_Status NiFpga_ReadFxp64(NiFpga_Session session, - uint32_t indicator, - NiFpga_FxpTypeInfo typeInfo, - uint64_t* value) -{ - NiFpga_Status status = NiFpga_ReadU64(session, indicator, value); - if (NiFpga_IsNotError(status)) - { +static NiFpga_Status(NiFpga_CCall* NiFpga_readBool)(NiFpga_Session session, uint32_t indicator, + NiFpga_Bool* value) = NULL; + +NiFpga_Status NiFpga_ReadBool(NiFpga_Session session, uint32_t indicator, NiFpga_Bool* value) { + return NiFpga_readBool ? NiFpga_readBool(session, indicator, value) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readI8)(NiFpga_Session session, uint32_t indicator, + int8_t* value) = NULL; + +NiFpga_Status NiFpga_ReadI8(NiFpga_Session session, uint32_t indicator, int8_t* value) { + return NiFpga_readI8 ? NiFpga_readI8(session, indicator, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readU8)(NiFpga_Session session, uint32_t indicator, + uint8_t* value) = NULL; + +NiFpga_Status NiFpga_ReadU8(NiFpga_Session session, uint32_t indicator, uint8_t* value) { + return NiFpga_readU8 ? NiFpga_readU8(session, indicator, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readI16)(NiFpga_Session session, uint32_t indicator, + int16_t* value) = NULL; + +NiFpga_Status NiFpga_ReadI16(NiFpga_Session session, uint32_t indicator, int16_t* value) { + return NiFpga_readI16 ? NiFpga_readI16(session, indicator, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readU16)(NiFpga_Session session, uint32_t indicator, + uint16_t* value) = NULL; + +NiFpga_Status NiFpga_ReadU16(NiFpga_Session session, uint32_t indicator, uint16_t* value) { + return NiFpga_readU16 ? NiFpga_readU16(session, indicator, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readI32)(NiFpga_Session session, uint32_t indicator, + int32_t* value) = NULL; + +NiFpga_Status NiFpga_ReadI32(NiFpga_Session session, uint32_t indicator, int32_t* value) { + return NiFpga_readI32 ? NiFpga_readI32(session, indicator, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readU32)(NiFpga_Session session, uint32_t indicator, + uint32_t* value) = NULL; + +NiFpga_Status NiFpga_ReadU32(NiFpga_Session session, uint32_t indicator, uint32_t* value) { + return NiFpga_readU32 ? NiFpga_readU32(session, indicator, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readI64)(NiFpga_Session session, uint32_t indicator, + int64_t* value) = NULL; + +NiFpga_Status NiFpga_ReadI64(NiFpga_Session session, uint32_t indicator, int64_t* value) { + return NiFpga_readI64 ? NiFpga_readI64(session, indicator, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readU64)(NiFpga_Session session, uint32_t indicator, + uint64_t* value) = NULL; + +NiFpga_Status NiFpga_ReadU64(NiFpga_Session session, uint32_t indicator, uint64_t* value) { + return NiFpga_readU64 ? NiFpga_readU64(session, indicator, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readSgl)(NiFpga_Session session, uint32_t indicator, + float* value) = NULL; + +NiFpga_Status NiFpga_ReadSgl(NiFpga_Session session, uint32_t indicator, float* value) { + return NiFpga_readSgl ? NiFpga_readSgl(session, indicator, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readDbl)(NiFpga_Session session, uint32_t indicator, + double* value) = NULL; + +NiFpga_Status NiFpga_ReadDbl(NiFpga_Session session, uint32_t indicator, double* value) { + return NiFpga_readDbl ? NiFpga_readDbl(session, indicator, value) : NiFpga_Status_ResourceNotInitialized; +} + +NiFpga_Status NiFpga_ReadFxp64(NiFpga_Session session, uint32_t indicator, NiFpga_FxpTypeInfo typeInfo, + uint64_t* value) { + NiFpga_Status status = NiFpga_ReadU64(session, indicator, value); + if (NiFpga_IsNotError(status)) { *value = *value >> (64 - typeInfo.wordLength); - } - return status; + } + return status; } /* * Functions to write to scalar controls and indicators. */ -static NiFpga_Status (NiFpga_CCall *NiFpga_writeBool)( - NiFpga_Session session, - uint32_t control, - NiFpga_Bool value) = NULL; - -NiFpga_Status NiFpga_WriteBool(NiFpga_Session session, - uint32_t control, - NiFpga_Bool value) -{ - return NiFpga_writeBool - ? NiFpga_writeBool(session, control, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeI8)( - NiFpga_Session session, - uint32_t control, - int8_t value) = NULL; - -NiFpga_Status NiFpga_WriteI8(NiFpga_Session session, - uint32_t control, - int8_t value) -{ - return NiFpga_writeI8 - ? NiFpga_writeI8(session, control, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeU8)( - NiFpga_Session session, - uint32_t control, - uint8_t value) = NULL; - -NiFpga_Status NiFpga_WriteU8(NiFpga_Session session, - uint32_t control, - uint8_t value) -{ - return NiFpga_writeU8 - ? NiFpga_writeU8(session, control, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeI16)( - NiFpga_Session session, - uint32_t control, - int16_t value) = NULL; - -NiFpga_Status NiFpga_WriteI16(NiFpga_Session session, - uint32_t control, - int16_t value) -{ - return NiFpga_writeI16 - ? NiFpga_writeI16(session, control, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeU16)( - NiFpga_Session session, - uint32_t control, - uint16_t value) = NULL; - -NiFpga_Status NiFpga_WriteU16(NiFpga_Session session, - uint32_t control, - uint16_t value) -{ - return NiFpga_writeU16 - ? NiFpga_writeU16(session, control, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeI32)( - NiFpga_Session session, - uint32_t control, - int32_t value) = NULL; - -NiFpga_Status NiFpga_WriteI32(NiFpga_Session session, - uint32_t control, - int32_t value) -{ - return NiFpga_writeI32 - ? NiFpga_writeI32(session, control, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeU32)( - NiFpga_Session session, - uint32_t control, - uint32_t value) = NULL; - -NiFpga_Status NiFpga_WriteU32(NiFpga_Session session, - uint32_t control, - uint32_t value) -{ - return NiFpga_writeU32 - ? NiFpga_writeU32(session, control, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeI64)( - NiFpga_Session session, - uint32_t control, - int64_t value) = NULL; - -NiFpga_Status NiFpga_WriteI64(NiFpga_Session session, - uint32_t control, - int64_t value) -{ - return NiFpga_writeI64 - ? NiFpga_writeI64(session, control, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeU64)( - NiFpga_Session session, - uint32_t control, - uint64_t value) = NULL; - -NiFpga_Status NiFpga_WriteU64(NiFpga_Session session, - uint32_t control, - uint64_t value) -{ - return NiFpga_writeU64 - ? NiFpga_writeU64(session, control, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeSgl)( - NiFpga_Session session, - uint32_t control, - float value) = NULL; - -NiFpga_Status NiFpga_WriteSgl(NiFpga_Session session, - uint32_t control, - float value) -{ - return NiFpga_writeSgl - ? NiFpga_writeSgl(session, control, value) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeDbl)( - NiFpga_Session session, - uint32_t control, - double value) = NULL; - -NiFpga_Status NiFpga_WriteDbl(NiFpga_Session session, - uint32_t control, - double value) -{ - return NiFpga_writeDbl - ? NiFpga_writeDbl(session, control, value) - : NiFpga_Status_ResourceNotInitialized; -} - -NiFpga_Status NiFpga_WriteFxp64(NiFpga_Session session, - uint32_t control, - NiFpga_FxpTypeInfo typeInfo, - uint64_t value) -{ - value = value << (64 - typeInfo.wordLength); - return NiFpga_WriteU64(session, control, value); +static NiFpga_Status(NiFpga_CCall* NiFpga_writeBool)(NiFpga_Session session, uint32_t control, + NiFpga_Bool value) = NULL; + +NiFpga_Status NiFpga_WriteBool(NiFpga_Session session, uint32_t control, NiFpga_Bool value) { + return NiFpga_writeBool ? NiFpga_writeBool(session, control, value) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeI8)(NiFpga_Session session, uint32_t control, + int8_t value) = NULL; + +NiFpga_Status NiFpga_WriteI8(NiFpga_Session session, uint32_t control, int8_t value) { + return NiFpga_writeI8 ? NiFpga_writeI8(session, control, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeU8)(NiFpga_Session session, uint32_t control, + uint8_t value) = NULL; + +NiFpga_Status NiFpga_WriteU8(NiFpga_Session session, uint32_t control, uint8_t value) { + return NiFpga_writeU8 ? NiFpga_writeU8(session, control, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeI16)(NiFpga_Session session, uint32_t control, + int16_t value) = NULL; + +NiFpga_Status NiFpga_WriteI16(NiFpga_Session session, uint32_t control, int16_t value) { + return NiFpga_writeI16 ? NiFpga_writeI16(session, control, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeU16)(NiFpga_Session session, uint32_t control, + uint16_t value) = NULL; + +NiFpga_Status NiFpga_WriteU16(NiFpga_Session session, uint32_t control, uint16_t value) { + return NiFpga_writeU16 ? NiFpga_writeU16(session, control, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeI32)(NiFpga_Session session, uint32_t control, + int32_t value) = NULL; + +NiFpga_Status NiFpga_WriteI32(NiFpga_Session session, uint32_t control, int32_t value) { + return NiFpga_writeI32 ? NiFpga_writeI32(session, control, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeU32)(NiFpga_Session session, uint32_t control, + uint32_t value) = NULL; + +NiFpga_Status NiFpga_WriteU32(NiFpga_Session session, uint32_t control, uint32_t value) { + return NiFpga_writeU32 ? NiFpga_writeU32(session, control, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeI64)(NiFpga_Session session, uint32_t control, + int64_t value) = NULL; + +NiFpga_Status NiFpga_WriteI64(NiFpga_Session session, uint32_t control, int64_t value) { + return NiFpga_writeI64 ? NiFpga_writeI64(session, control, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeU64)(NiFpga_Session session, uint32_t control, + uint64_t value) = NULL; + +NiFpga_Status NiFpga_WriteU64(NiFpga_Session session, uint32_t control, uint64_t value) { + return NiFpga_writeU64 ? NiFpga_writeU64(session, control, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeSgl)(NiFpga_Session session, uint32_t control, + float value) = NULL; + +NiFpga_Status NiFpga_WriteSgl(NiFpga_Session session, uint32_t control, float value) { + return NiFpga_writeSgl ? NiFpga_writeSgl(session, control, value) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeDbl)(NiFpga_Session session, uint32_t control, + double value) = NULL; + +NiFpga_Status NiFpga_WriteDbl(NiFpga_Session session, uint32_t control, double value) { + return NiFpga_writeDbl ? NiFpga_writeDbl(session, control, value) : NiFpga_Status_ResourceNotInitialized; +} + +NiFpga_Status NiFpga_WriteFxp64(NiFpga_Session session, uint32_t control, NiFpga_FxpTypeInfo typeInfo, + uint64_t value) { + value = value << (64 - typeInfo.wordLength); + return NiFpga_WriteU64(session, control, value); } /* * Functions to read from array indicators and controls. */ -static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayBool)( - NiFpga_Session session, - uint32_t indicator, - NiFpga_Bool* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_ReadArrayBool(NiFpga_Session session, - uint32_t indicator, - NiFpga_Bool* array, - size_t size) -{ - return NiFpga_readArrayBool - ? NiFpga_readArrayBool(session, indicator, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayI8)( - NiFpga_Session session, - uint32_t indicator, - int8_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_ReadArrayI8(NiFpga_Session session, - uint32_t indicator, - int8_t* array, - size_t size) -{ - return NiFpga_readArrayI8 - ? NiFpga_readArrayI8(session, indicator, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayU8)( - NiFpga_Session session, - uint32_t indicator, - uint8_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_ReadArrayU8(NiFpga_Session session, - uint32_t indicator, - uint8_t* array, - size_t size) -{ - return NiFpga_readArrayU8 - ? NiFpga_readArrayU8(session, indicator, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayI16)( - NiFpga_Session session, - uint32_t indicator, - int16_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_ReadArrayI16(NiFpga_Session session, - uint32_t indicator, - int16_t* array, - size_t size) -{ - return NiFpga_readArrayI16 - ? NiFpga_readArrayI16(session, indicator, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayU16)( - NiFpga_Session session, - uint32_t indicator, - uint16_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_ReadArrayU16(NiFpga_Session session, - uint32_t indicator, - uint16_t* array, - size_t size) -{ - return NiFpga_readArrayU16 - ? NiFpga_readArrayU16(session, indicator, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayI32)( - NiFpga_Session session, - uint32_t indicator, - int32_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_ReadArrayI32(NiFpga_Session session, - uint32_t indicator, - int32_t* array, - size_t size) -{ - return NiFpga_readArrayI32 - ? NiFpga_readArrayI32(session, indicator, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayU32)( - NiFpga_Session session, - uint32_t indicator, - uint32_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_ReadArrayU32(NiFpga_Session session, - uint32_t indicator, - uint32_t* array, - size_t size) -{ - return NiFpga_readArrayU32 - ? NiFpga_readArrayU32(session, indicator, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayI64)( - NiFpga_Session session, - uint32_t indicator, - int64_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_ReadArrayI64(NiFpga_Session session, - uint32_t indicator, - int64_t* array, - size_t size) -{ - return NiFpga_readArrayI64 - ? NiFpga_readArrayI64(session, indicator, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayU64)( - NiFpga_Session session, - uint32_t indicator, - uint64_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_ReadArrayU64(NiFpga_Session session, - uint32_t indicator, - uint64_t* array, - size_t size) -{ - return NiFpga_readArrayU64 - ? NiFpga_readArrayU64(session, indicator, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readArraySgl)( - NiFpga_Session session, - uint32_t indicator, - float* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_ReadArraySgl(NiFpga_Session session, - uint32_t indicator, - float* array, - size_t size) -{ - return NiFpga_readArraySgl - ? NiFpga_readArraySgl(session, indicator, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayDbl)( - NiFpga_Session session, - uint32_t indicator, - double* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_ReadArrayDbl(NiFpga_Session session, - uint32_t indicator, - double* array, - size_t size) -{ - return NiFpga_readArrayDbl - ? NiFpga_readArrayDbl(session, indicator, array, size) - : NiFpga_Status_ResourceNotInitialized; +static NiFpga_Status(NiFpga_CCall* NiFpga_readArrayBool)(NiFpga_Session session, uint32_t indicator, + NiFpga_Bool* array, size_t size) = NULL; + +NiFpga_Status NiFpga_ReadArrayBool(NiFpga_Session session, uint32_t indicator, NiFpga_Bool* array, + size_t size) { + return NiFpga_readArrayBool ? NiFpga_readArrayBool(session, indicator, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readArrayI8)(NiFpga_Session session, uint32_t indicator, + int8_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_ReadArrayI8(NiFpga_Session session, uint32_t indicator, int8_t* array, size_t size) { + return NiFpga_readArrayI8 ? NiFpga_readArrayI8(session, indicator, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readArrayU8)(NiFpga_Session session, uint32_t indicator, + uint8_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_ReadArrayU8(NiFpga_Session session, uint32_t indicator, uint8_t* array, size_t size) { + return NiFpga_readArrayU8 ? NiFpga_readArrayU8(session, indicator, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readArrayI16)(NiFpga_Session session, uint32_t indicator, + int16_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_ReadArrayI16(NiFpga_Session session, uint32_t indicator, int16_t* array, size_t size) { + return NiFpga_readArrayI16 ? NiFpga_readArrayI16(session, indicator, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readArrayU16)(NiFpga_Session session, uint32_t indicator, + uint16_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_ReadArrayU16(NiFpga_Session session, uint32_t indicator, uint16_t* array, size_t size) { + return NiFpga_readArrayU16 ? NiFpga_readArrayU16(session, indicator, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readArrayI32)(NiFpga_Session session, uint32_t indicator, + int32_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_ReadArrayI32(NiFpga_Session session, uint32_t indicator, int32_t* array, size_t size) { + return NiFpga_readArrayI32 ? NiFpga_readArrayI32(session, indicator, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readArrayU32)(NiFpga_Session session, uint32_t indicator, + uint32_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_ReadArrayU32(NiFpga_Session session, uint32_t indicator, uint32_t* array, size_t size) { + return NiFpga_readArrayU32 ? NiFpga_readArrayU32(session, indicator, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readArrayI64)(NiFpga_Session session, uint32_t indicator, + int64_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_ReadArrayI64(NiFpga_Session session, uint32_t indicator, int64_t* array, size_t size) { + return NiFpga_readArrayI64 ? NiFpga_readArrayI64(session, indicator, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readArrayU64)(NiFpga_Session session, uint32_t indicator, + uint64_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_ReadArrayU64(NiFpga_Session session, uint32_t indicator, uint64_t* array, size_t size) { + return NiFpga_readArrayU64 ? NiFpga_readArrayU64(session, indicator, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readArraySgl)(NiFpga_Session session, uint32_t indicator, + float* array, size_t size) = NULL; + +NiFpga_Status NiFpga_ReadArraySgl(NiFpga_Session session, uint32_t indicator, float* array, size_t size) { + return NiFpga_readArraySgl ? NiFpga_readArraySgl(session, indicator, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readArrayDbl)(NiFpga_Session session, uint32_t indicator, + double* array, size_t size) = NULL; + +NiFpga_Status NiFpga_ReadArrayDbl(NiFpga_Session session, uint32_t indicator, double* array, size_t size) { + return NiFpga_readArrayDbl ? NiFpga_readArrayDbl(session, indicator, array, size) + : NiFpga_Status_ResourceNotInitialized; } /* * Functions to write to array controls and indicators. */ -static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayBool)( - NiFpga_Session session, - uint32_t control, - const NiFpga_Bool* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_WriteArrayBool(NiFpga_Session session, - uint32_t control, - const NiFpga_Bool* array, - size_t size) -{ - return NiFpga_writeArrayBool - ? NiFpga_writeArrayBool(session, control, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayI8)( - NiFpga_Session session, - uint32_t control, - const int8_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_WriteArrayI8(NiFpga_Session session, - uint32_t control, - const int8_t* array, - size_t size) -{ - return NiFpga_writeArrayI8 - ? NiFpga_writeArrayI8(session, control, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayU8)( - NiFpga_Session session, - uint32_t control, - const uint8_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_WriteArrayU8(NiFpga_Session session, - uint32_t control, - const uint8_t* array, - size_t size) -{ - return NiFpga_writeArrayU8 - ? NiFpga_writeArrayU8(session, control, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayI16)( - NiFpga_Session session, - uint32_t control, - const int16_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_WriteArrayI16(NiFpga_Session session, - uint32_t control, - const int16_t* array, - size_t size) -{ - return NiFpga_writeArrayI16 - ? NiFpga_writeArrayI16(session, control, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayU16)( - NiFpga_Session session, - uint32_t control, - const uint16_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_WriteArrayU16(NiFpga_Session session, - uint32_t control, - const uint16_t* array, - size_t size) -{ - return NiFpga_writeArrayU16 - ? NiFpga_writeArrayU16(session, control, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayI32)( - NiFpga_Session session, - uint32_t control, - const int32_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_WriteArrayI32(NiFpga_Session session, - uint32_t control, - const int32_t* array, - size_t size) -{ - return NiFpga_writeArrayI32 - ? NiFpga_writeArrayI32(session, control, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayU32)( - NiFpga_Session session, - uint32_t control, - const uint32_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_WriteArrayU32(NiFpga_Session session, - uint32_t control, - const uint32_t* array, - size_t size) -{ - return NiFpga_writeArrayU32 - ? NiFpga_writeArrayU32(session, control, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayI64)( - NiFpga_Session session, - uint32_t control, - const int64_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_WriteArrayI64(NiFpga_Session session, - uint32_t control, - const int64_t* array, - size_t size) -{ - return NiFpga_writeArrayI64 - ? NiFpga_writeArrayI64(session, control, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayU64)( - NiFpga_Session session, - uint32_t control, - const uint64_t* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_WriteArrayU64(NiFpga_Session session, - uint32_t control, - const uint64_t* array, - size_t size) -{ - return NiFpga_writeArrayU64 - ? NiFpga_writeArrayU64(session, control, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeArraySgl)( - NiFpga_Session session, - uint32_t control, - const float* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_WriteArraySgl(NiFpga_Session session, - uint32_t control, - const float* array, - size_t size) -{ - return NiFpga_writeArraySgl - ? NiFpga_writeArraySgl(session, control, array, size) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayDbl)( - NiFpga_Session session, - uint32_t control, - const double* array, - size_t size) = NULL; - -NiFpga_Status NiFpga_WriteArrayDbl(NiFpga_Session session, - uint32_t control, - const double* array, - size_t size) -{ - return NiFpga_writeArrayDbl - ? NiFpga_writeArrayDbl(session, control, array, size) - : NiFpga_Status_ResourceNotInitialized; +static NiFpga_Status(NiFpga_CCall* NiFpga_writeArrayBool)(NiFpga_Session session, uint32_t control, + const NiFpga_Bool* array, size_t size) = NULL; + +NiFpga_Status NiFpga_WriteArrayBool(NiFpga_Session session, uint32_t control, const NiFpga_Bool* array, + size_t size) { + return NiFpga_writeArrayBool ? NiFpga_writeArrayBool(session, control, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeArrayI8)(NiFpga_Session session, uint32_t control, + const int8_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_WriteArrayI8(NiFpga_Session session, uint32_t control, const int8_t* array, + size_t size) { + return NiFpga_writeArrayI8 ? NiFpga_writeArrayI8(session, control, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeArrayU8)(NiFpga_Session session, uint32_t control, + const uint8_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_WriteArrayU8(NiFpga_Session session, uint32_t control, const uint8_t* array, + size_t size) { + return NiFpga_writeArrayU8 ? NiFpga_writeArrayU8(session, control, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeArrayI16)(NiFpga_Session session, uint32_t control, + const int16_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_WriteArrayI16(NiFpga_Session session, uint32_t control, const int16_t* array, + size_t size) { + return NiFpga_writeArrayI16 ? NiFpga_writeArrayI16(session, control, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeArrayU16)(NiFpga_Session session, uint32_t control, + const uint16_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_WriteArrayU16(NiFpga_Session session, uint32_t control, const uint16_t* array, + size_t size) { + return NiFpga_writeArrayU16 ? NiFpga_writeArrayU16(session, control, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeArrayI32)(NiFpga_Session session, uint32_t control, + const int32_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_WriteArrayI32(NiFpga_Session session, uint32_t control, const int32_t* array, + size_t size) { + return NiFpga_writeArrayI32 ? NiFpga_writeArrayI32(session, control, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeArrayU32)(NiFpga_Session session, uint32_t control, + const uint32_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_WriteArrayU32(NiFpga_Session session, uint32_t control, const uint32_t* array, + size_t size) { + return NiFpga_writeArrayU32 ? NiFpga_writeArrayU32(session, control, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeArrayI64)(NiFpga_Session session, uint32_t control, + const int64_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_WriteArrayI64(NiFpga_Session session, uint32_t control, const int64_t* array, + size_t size) { + return NiFpga_writeArrayI64 ? NiFpga_writeArrayI64(session, control, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeArrayU64)(NiFpga_Session session, uint32_t control, + const uint64_t* array, size_t size) = NULL; + +NiFpga_Status NiFpga_WriteArrayU64(NiFpga_Session session, uint32_t control, const uint64_t* array, + size_t size) { + return NiFpga_writeArrayU64 ? NiFpga_writeArrayU64(session, control, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeArraySgl)(NiFpga_Session session, uint32_t control, + const float* array, size_t size) = NULL; + +NiFpga_Status NiFpga_WriteArraySgl(NiFpga_Session session, uint32_t control, const float* array, + size_t size) { + return NiFpga_writeArraySgl ? NiFpga_writeArraySgl(session, control, array, size) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeArrayDbl)(NiFpga_Session session, uint32_t control, + const double* array, size_t size) = NULL; + +NiFpga_Status NiFpga_WriteArrayDbl(NiFpga_Session session, uint32_t control, const double* array, + size_t size) { + return NiFpga_writeArrayDbl ? NiFpga_writeArrayDbl(session, control, array, size) + : NiFpga_Status_ResourceNotInitialized; } /* * Interrupt functions. */ -static NiFpga_Status (NiFpga_CCall *NiFpga_reserveIrqContext)( - NiFpga_Session session, - NiFpga_IrqContext* context) = NULL; +static NiFpga_Status(NiFpga_CCall* NiFpga_reserveIrqContext)(NiFpga_Session session, + NiFpga_IrqContext* context) = NULL; + +NiFpga_Status NiFpga_ReserveIrqContext(NiFpga_Session session, NiFpga_IrqContext* context) { + const NiFpga_Status result = NiFpga_reserveIrqContext ? NiFpga_reserveIrqContext(session, context) + : NiFpga_Status_ResourceNotInitialized; +#if NiFpga_CviResourceTracking + if (NiFpga_acquireCviResource && NiFpga_IsNotError(result)) + NiFpga_acquireCviResource(*context, NiFpga_cviResourceType, "NiFpga_IrqContext 0x%p", *context); +#endif + return result; +} +static NiFpga_Status(NiFpga_CCall* NiFpga_unreserveIrqContext)(NiFpga_Session session, + NiFpga_IrqContext context) = NULL; -NiFpga_Status NiFpga_ReserveIrqContext(NiFpga_Session session, - NiFpga_IrqContext* context) -{ - const NiFpga_Status result = NiFpga_reserveIrqContext - ? NiFpga_reserveIrqContext(session, context) - : NiFpga_Status_ResourceNotInitialized; - #if NiFpga_CviResourceTracking - if (NiFpga_acquireCviResource - && NiFpga_IsNotError(result)) - NiFpga_acquireCviResource(*context, - NiFpga_cviResourceType, - "NiFpga_IrqContext 0x%p", - *context); - #endif - return result; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_unreserveIrqContext)( - NiFpga_Session session, - NiFpga_IrqContext context) = NULL; - - -NiFpga_Status NiFpga_UnreserveIrqContext(NiFpga_Session session, - NiFpga_IrqContext context) -{ - if (!NiFpga_unreserveIrqContext) - return NiFpga_Status_ResourceNotInitialized; - #if NiFpga_CviResourceTracking - if (NiFpga_releaseCviResource) - NiFpga_releaseCviResource(context); - #endif - return NiFpga_unreserveIrqContext(session, context); -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_waitOnIrqs)( - NiFpga_Session session, - NiFpga_IrqContext context, - uint32_t irqs, - uint32_t timeout, - uint32_t* irqsAsserted, - NiFpga_Bool* timedOut) = NULL; - -NiFpga_Status NiFpga_WaitOnIrqs(NiFpga_Session session, - NiFpga_IrqContext context, - uint32_t irqs, - uint32_t timeout, - uint32_t* irqsAsserted, - NiFpga_Bool* timedOut) -{ - return NiFpga_waitOnIrqs - ? NiFpga_waitOnIrqs(session, - context, - irqs, - timeout, - irqsAsserted, - timedOut) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acknowledgeIrqs)( - NiFpga_Session session, - uint32_t irqs) = NULL; - -NiFpga_Status NiFpga_AcknowledgeIrqs(NiFpga_Session session, - uint32_t irqs) -{ - return NiFpga_acknowledgeIrqs - ? NiFpga_acknowledgeIrqs(session, irqs) - : NiFpga_Status_ResourceNotInitialized; +NiFpga_Status NiFpga_UnreserveIrqContext(NiFpga_Session session, NiFpga_IrqContext context) { + if (!NiFpga_unreserveIrqContext) return NiFpga_Status_ResourceNotInitialized; +#if NiFpga_CviResourceTracking + if (NiFpga_releaseCviResource) NiFpga_releaseCviResource(context); +#endif + return NiFpga_unreserveIrqContext(session, context); +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_waitOnIrqs)(NiFpga_Session session, NiFpga_IrqContext context, + uint32_t irqs, uint32_t timeout, uint32_t* irqsAsserted, + NiFpga_Bool* timedOut) = NULL; + +NiFpga_Status NiFpga_WaitOnIrqs(NiFpga_Session session, NiFpga_IrqContext context, uint32_t irqs, + uint32_t timeout, uint32_t* irqsAsserted, NiFpga_Bool* timedOut) { + return NiFpga_waitOnIrqs ? NiFpga_waitOnIrqs(session, context, irqs, timeout, irqsAsserted, timedOut) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acknowledgeIrqs)(NiFpga_Session session, uint32_t irqs) = NULL; + +NiFpga_Status NiFpga_AcknowledgeIrqs(NiFpga_Session session, uint32_t irqs) { + return NiFpga_acknowledgeIrqs ? NiFpga_acknowledgeIrqs(session, irqs) + : NiFpga_Status_ResourceNotInitialized; } /* * DMA FIFO state functions. */ -static NiFpga_Status (NiFpga_CCall *NiFpga_configureFifo)( - NiFpga_Session session, - uint32_t fifo, - size_t depth) = NULL; - -NiFpga_Status NiFpga_ConfigureFifo(NiFpga_Session session, - uint32_t fifo, - size_t depth) -{ - return NiFpga_configureFifo - ? NiFpga_configureFifo(session, fifo, depth) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_configureFifo2)( - NiFpga_Session session, - uint32_t fifo, - size_t requestedDepth, - size_t* actualDepth) = NULL; - -NiFpga_Status NiFpga_ConfigureFifo2(NiFpga_Session session, - uint32_t fifo, - size_t requestedDepth, - size_t* actualDepth) -{ - return NiFpga_configureFifo2 - ? NiFpga_configureFifo2(session, fifo, requestedDepth, actualDepth) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_setFifoPropertyU32)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint32_t value) = NULL; - -NiFpga_Status NiFpga_SetFifoPropertyU32(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint32_t value) -{ - return NiFpga_setFifoPropertyU32 - ? NiFpga_setFifoPropertyU32(session, fifo, property, value) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_setFifoPropertyI32)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int32_t value) = NULL; - -NiFpga_Status NiFpga_SetFifoPropertyI32(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int32_t value) -{ - return NiFpga_setFifoPropertyI32 - ? NiFpga_setFifoPropertyI32(session, fifo, property, value) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_setFifoPropertyU64)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint64_t value) = NULL; - -NiFpga_Status NiFpga_SetFifoPropertyU64(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint64_t value) -{ - return NiFpga_setFifoPropertyU64 - ? NiFpga_setFifoPropertyU64(session, fifo, property, value) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_setFifoPropertyI64)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int64_t value) = NULL; - -NiFpga_Status NiFpga_SetFifoPropertyI64(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int64_t value) -{ - return NiFpga_setFifoPropertyI64 - ? NiFpga_setFifoPropertyI64(session, fifo, property, value) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_setFifoPropertyPtr)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - void* value) = NULL; - -NiFpga_Status NiFpga_SetFifoPropertyPtr(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - void* value) -{ - return NiFpga_setFifoPropertyPtr - ? NiFpga_setFifoPropertyPtr(session, fifo, property, value) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_getFifoPropertyU32)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint32_t* value) = NULL; - -NiFpga_Status NiFpga_GetFifoPropertyU32(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint32_t* value) -{ - return NiFpga_getFifoPropertyU32 - ? NiFpga_getFifoPropertyU32(session, fifo, property, value) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_getFifoPropertyI32)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int32_t* value) = NULL; - -NiFpga_Status NiFpga_GetFifoPropertyI32(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int32_t* value) -{ - return NiFpga_getFifoPropertyI32 - ? NiFpga_getFifoPropertyI32(session, fifo, property, value) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_getFifoPropertyU64)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint64_t* value) = NULL; - -NiFpga_Status NiFpga_GetFifoPropertyU64(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint64_t* value) -{ - return NiFpga_getFifoPropertyU64 - ? NiFpga_getFifoPropertyU64(session, fifo, property, value) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_getFifoPropertyI64)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int64_t* value) = NULL; - -NiFpga_Status NiFpga_GetFifoPropertyI64(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int64_t* value) -{ - return NiFpga_getFifoPropertyI64 - ? NiFpga_getFifoPropertyI64(session, fifo, property, value) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_getFifoPropertyPtr)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - void** value) = NULL; - -NiFpga_Status NiFpga_GetFifoPropertyPtr(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - void** value) -{ - return NiFpga_getFifoPropertyPtr - ? NiFpga_getFifoPropertyPtr(session, fifo, property, value) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_commitFifoConfiguration)( - NiFpga_Session session, - uint32_t fifo) = NULL; - -NiFpga_Status NiFpga_CommitFifoConfiguration(NiFpga_Session session, - uint32_t fifo) -{ - return NiFpga_commitFifoConfiguration - ? NiFpga_commitFifoConfiguration(session, fifo) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_startFifo)( - NiFpga_Session session, - uint32_t fifo) = NULL; - -NiFpga_Status NiFpga_StartFifo(NiFpga_Session session, - uint32_t fifo) -{ - return NiFpga_startFifo - ? NiFpga_startFifo(session, fifo) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_stopFifo)( - NiFpga_Session session, - uint32_t fifo) = NULL; - -NiFpga_Status NiFpga_StopFifo(NiFpga_Session session, - uint32_t fifo) -{ - return NiFpga_stopFifo - ? NiFpga_stopFifo(session, fifo) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_unreserveFifo)( - NiFpga_Session session, - uint32_t fifo) = NULL; - -NiFpga_Status NiFpga_UnreserveFifo(NiFpga_Session session, - uint32_t fifo) -{ - return NiFpga_unreserveFifo - ? NiFpga_unreserveFifo(session, fifo) - : NiFpga_Status_VersionMismatch; +static NiFpga_Status(NiFpga_CCall* NiFpga_configureFifo)(NiFpga_Session session, uint32_t fifo, + size_t depth) = NULL; + +NiFpga_Status NiFpga_ConfigureFifo(NiFpga_Session session, uint32_t fifo, size_t depth) { + return NiFpga_configureFifo ? NiFpga_configureFifo(session, fifo, depth) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_configureFifo2)(NiFpga_Session session, uint32_t fifo, + size_t requestedDepth, size_t* actualDepth) = NULL; + +NiFpga_Status NiFpga_ConfigureFifo2(NiFpga_Session session, uint32_t fifo, size_t requestedDepth, + size_t* actualDepth) { + return NiFpga_configureFifo2 ? NiFpga_configureFifo2(session, fifo, requestedDepth, actualDepth) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_setFifoPropertyU32)(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, + uint32_t value) = NULL; + +NiFpga_Status NiFpga_SetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + uint32_t value) { + return NiFpga_setFifoPropertyU32 ? NiFpga_setFifoPropertyU32(session, fifo, property, value) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_setFifoPropertyI32)(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, + int32_t value) = NULL; + +NiFpga_Status NiFpga_SetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + int32_t value) { + return NiFpga_setFifoPropertyI32 ? NiFpga_setFifoPropertyI32(session, fifo, property, value) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_setFifoPropertyU64)(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, + uint64_t value) = NULL; + +NiFpga_Status NiFpga_SetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + uint64_t value) { + return NiFpga_setFifoPropertyU64 ? NiFpga_setFifoPropertyU64(session, fifo, property, value) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_setFifoPropertyI64)(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, + int64_t value) = NULL; + +NiFpga_Status NiFpga_SetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + int64_t value) { + return NiFpga_setFifoPropertyI64 ? NiFpga_setFifoPropertyI64(session, fifo, property, value) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_setFifoPropertyPtr)(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, + void* value) = NULL; + +NiFpga_Status NiFpga_SetFifoPropertyPtr(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + void* value) { + return NiFpga_setFifoPropertyPtr ? NiFpga_setFifoPropertyPtr(session, fifo, property, value) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_getFifoPropertyU32)(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, + uint32_t* value) = NULL; + +NiFpga_Status NiFpga_GetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + uint32_t* value) { + return NiFpga_getFifoPropertyU32 ? NiFpga_getFifoPropertyU32(session, fifo, property, value) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_getFifoPropertyI32)(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, + int32_t* value) = NULL; + +NiFpga_Status NiFpga_GetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + int32_t* value) { + return NiFpga_getFifoPropertyI32 ? NiFpga_getFifoPropertyI32(session, fifo, property, value) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_getFifoPropertyU64)(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, + uint64_t* value) = NULL; + +NiFpga_Status NiFpga_GetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + uint64_t* value) { + return NiFpga_getFifoPropertyU64 ? NiFpga_getFifoPropertyU64(session, fifo, property, value) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_getFifoPropertyI64)(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, + int64_t* value) = NULL; + +NiFpga_Status NiFpga_GetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + int64_t* value) { + return NiFpga_getFifoPropertyI64 ? NiFpga_getFifoPropertyI64(session, fifo, property, value) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_getFifoPropertyPtr)(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, + void** value) = NULL; + +NiFpga_Status NiFpga_GetFifoPropertyPtr(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + void** value) { + return NiFpga_getFifoPropertyPtr ? NiFpga_getFifoPropertyPtr(session, fifo, property, value) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_commitFifoConfiguration)(NiFpga_Session session, + uint32_t fifo) = NULL; + +NiFpga_Status NiFpga_CommitFifoConfiguration(NiFpga_Session session, uint32_t fifo) { + return NiFpga_commitFifoConfiguration ? NiFpga_commitFifoConfiguration(session, fifo) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_startFifo)(NiFpga_Session session, uint32_t fifo) = NULL; + +NiFpga_Status NiFpga_StartFifo(NiFpga_Session session, uint32_t fifo) { + return NiFpga_startFifo ? NiFpga_startFifo(session, fifo) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_stopFifo)(NiFpga_Session session, uint32_t fifo) = NULL; + +NiFpga_Status NiFpga_StopFifo(NiFpga_Session session, uint32_t fifo) { + return NiFpga_stopFifo ? NiFpga_stopFifo(session, fifo) : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_unreserveFifo)(NiFpga_Session session, uint32_t fifo) = NULL; + +NiFpga_Status NiFpga_UnreserveFifo(NiFpga_Session session, uint32_t fifo) { + return NiFpga_unreserveFifo ? NiFpga_unreserveFifo(session, fifo) : NiFpga_Status_VersionMismatch; } /* * Functions to read from target-to-host DMA FIFOs. */ -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoBool)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_Bool* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoBool(NiFpga_Session session, - uint32_t fifo, - NiFpga_Bool* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoBool - ? NiFpga_readFifoBool(session, - fifo, - data, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoI8)( - NiFpga_Session session, - uint32_t fifo, - int8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoI8(NiFpga_Session session, - uint32_t fifo, - int8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoI8 - ? NiFpga_readFifoI8(session, - fifo, - data, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoU8)( - NiFpga_Session session, - uint32_t fifo, - uint8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoU8(NiFpga_Session session, - uint32_t fifo, - uint8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoU8 - ? NiFpga_readFifoU8(session, - fifo, - data, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoI16)( - NiFpga_Session session, - uint32_t fifo, - int16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoI16(NiFpga_Session session, - uint32_t fifo, - int16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoI16 - ? NiFpga_readFifoI16(session, - fifo, - data, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoU16)( - NiFpga_Session session, - uint32_t fifo, - uint16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoU16(NiFpga_Session session, - uint32_t fifo, - uint16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoU16 - ? NiFpga_readFifoU16(session, - fifo, - data, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoI32)( - NiFpga_Session session, - uint32_t fifo, - int32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoI32(NiFpga_Session session, - uint32_t fifo, - int32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoI32 - ? NiFpga_readFifoI32(session, - fifo, - data, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoU32)( - NiFpga_Session session, - uint32_t fifo, - uint32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoU32(NiFpga_Session session, - uint32_t fifo, - uint32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoU32 - ? NiFpga_readFifoU32(session, - fifo, - data, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoI64)( - NiFpga_Session session, - uint32_t fifo, - int64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoI64(NiFpga_Session session, - uint32_t fifo, - int64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoI64 - ? NiFpga_readFifoI64(session, - fifo, - data, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoU64)( - NiFpga_Session session, - uint32_t fifo, - uint64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoU64(NiFpga_Session session, - uint32_t fifo, - uint64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoU64 - ? NiFpga_readFifoU64(session, - fifo, - data, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoSgl)( - NiFpga_Session session, - uint32_t fifo, - float* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoSgl(NiFpga_Session session, - uint32_t fifo, - float* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoSgl - ? NiFpga_readFifoSgl(session, - fifo, - data, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoDbl)( - NiFpga_Session session, - uint32_t fifo, - double* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoDbl(NiFpga_Session session, - uint32_t fifo, - double* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoDbl - ? NiFpga_readFifoDbl(session, - fifo, - data, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoComposite)( - NiFpga_Session session, - uint32_t fifo, - void* data, - uint32_t bytesPerElement, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_ReadFifoComposite(NiFpga_Session session, - uint32_t fifo, - void* data, - uint32_t bytesPerElement, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining) -{ - return NiFpga_readFifoComposite - ? NiFpga_readFifoComposite(session, - fifo, - data, - bytesPerElement, - numberOfElements, - timeout, - elementsRemaining) - : NiFpga_Status_VersionMismatch; +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoBool)(NiFpga_Session session, uint32_t fifo, + NiFpga_Bool* data, size_t numberOfElements, + uint32_t timeout, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoBool(NiFpga_Session session, uint32_t fifo, NiFpga_Bool* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining) { + return NiFpga_readFifoBool + ? NiFpga_readFifoBool(session, fifo, data, numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoI8)(NiFpga_Session session, uint32_t fifo, int8_t* data, + size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoI8(NiFpga_Session session, uint32_t fifo, int8_t* data, size_t numberOfElements, + uint32_t timeout, size_t* elementsRemaining) { + return NiFpga_readFifoI8 + ? NiFpga_readFifoI8(session, fifo, data, numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoU8)(NiFpga_Session session, uint32_t fifo, uint8_t* data, + size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoU8(NiFpga_Session session, uint32_t fifo, uint8_t* data, size_t numberOfElements, + uint32_t timeout, size_t* elementsRemaining) { + return NiFpga_readFifoU8 + ? NiFpga_readFifoU8(session, fifo, data, numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoI16)(NiFpga_Session session, uint32_t fifo, int16_t* data, + size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoI16(NiFpga_Session session, uint32_t fifo, int16_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining) { + return NiFpga_readFifoI16 + ? NiFpga_readFifoI16(session, fifo, data, numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoU16)(NiFpga_Session session, uint32_t fifo, uint16_t* data, + size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoU16(NiFpga_Session session, uint32_t fifo, uint16_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining) { + return NiFpga_readFifoU16 + ? NiFpga_readFifoU16(session, fifo, data, numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoI32)(NiFpga_Session session, uint32_t fifo, int32_t* data, + size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoI32(NiFpga_Session session, uint32_t fifo, int32_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining) { + return NiFpga_readFifoI32 + ? NiFpga_readFifoI32(session, fifo, data, numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoU32)(NiFpga_Session session, uint32_t fifo, uint32_t* data, + size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoU32(NiFpga_Session session, uint32_t fifo, uint32_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining) { + return NiFpga_readFifoU32 + ? NiFpga_readFifoU32(session, fifo, data, numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoI64)(NiFpga_Session session, uint32_t fifo, int64_t* data, + size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoI64(NiFpga_Session session, uint32_t fifo, int64_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining) { + return NiFpga_readFifoI64 + ? NiFpga_readFifoI64(session, fifo, data, numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoU64)(NiFpga_Session session, uint32_t fifo, uint64_t* data, + size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoU64(NiFpga_Session session, uint32_t fifo, uint64_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining) { + return NiFpga_readFifoU64 + ? NiFpga_readFifoU64(session, fifo, data, numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoSgl)(NiFpga_Session session, uint32_t fifo, float* data, + size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoSgl(NiFpga_Session session, uint32_t fifo, float* data, size_t numberOfElements, + uint32_t timeout, size_t* elementsRemaining) { + return NiFpga_readFifoSgl + ? NiFpga_readFifoSgl(session, fifo, data, numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoDbl)(NiFpga_Session session, uint32_t fifo, double* data, + size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoDbl(NiFpga_Session session, uint32_t fifo, double* data, size_t numberOfElements, + uint32_t timeout, size_t* elementsRemaining) { + return NiFpga_readFifoDbl + ? NiFpga_readFifoDbl(session, fifo, data, numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_readFifoComposite)(NiFpga_Session session, uint32_t fifo, + void* data, uint32_t bytesPerElement, + size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_ReadFifoComposite(NiFpga_Session session, uint32_t fifo, void* data, + uint32_t bytesPerElement, size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining) { + return NiFpga_readFifoComposite ? NiFpga_readFifoComposite(session, fifo, data, bytesPerElement, + numberOfElements, timeout, elementsRemaining) + : NiFpga_Status_VersionMismatch; } /* * Functions to write to host-to-target DMA FIFOs. */ -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoBool)( - NiFpga_Session session, - uint32_t fifo, - const NiFpga_Bool* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoBool( - NiFpga_Session session, - uint32_t fifo, - const NiFpga_Bool* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoBool - ? NiFpga_writeFifoBool(session, - fifo, - data, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoI8)( - NiFpga_Session session, - uint32_t fifo, - const int8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoI8(NiFpga_Session session, - uint32_t fifo, - const int8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoI8 - ? NiFpga_writeFifoI8(session, - fifo, - data, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoU8)( - NiFpga_Session session, - uint32_t fifo, - const uint8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoU8(NiFpga_Session session, - uint32_t fifo, - const uint8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoU8 - ? NiFpga_writeFifoU8(session, - fifo, - data, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoI16)( - NiFpga_Session session, - uint32_t fifo, - const int16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoI16( - NiFpga_Session session, - uint32_t fifo, - const int16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoI16 - ? NiFpga_writeFifoI16(session, - fifo, - data, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoU16)( - NiFpga_Session session, - uint32_t fifo, - const uint16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoU16( - NiFpga_Session session, - uint32_t fifo, - const uint16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoU16 - ? NiFpga_writeFifoU16(session, - fifo, - data, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoI32)( - NiFpga_Session session, - uint32_t fifo, - const int32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoI32( - NiFpga_Session session, - uint32_t fifo, - const int32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoI32 - ? NiFpga_writeFifoI32(session, - fifo, - data, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoU32)( - NiFpga_Session session, - uint32_t fifo, - const uint32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoU32( - NiFpga_Session session, - uint32_t fifo, - const uint32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoU32 - ? NiFpga_writeFifoU32(session, - fifo, - data, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoI64)( - NiFpga_Session session, - uint32_t fifo, - const int64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoI64( - NiFpga_Session session, - uint32_t fifo, - const int64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoI64 - ? NiFpga_writeFifoI64(session, - fifo, - data, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoU64)( - NiFpga_Session session, - uint32_t fifo, - const uint64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoU64( - NiFpga_Session session, - uint32_t fifo, - const uint64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoU64 - ? NiFpga_writeFifoU64(session, - fifo, - data, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoSgl)( - NiFpga_Session session, - uint32_t fifo, - const float* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoSgl( - NiFpga_Session session, - uint32_t fifo, - const float* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoSgl - ? NiFpga_writeFifoSgl(session, - fifo, - data, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoDbl)( - NiFpga_Session session, - uint32_t fifo, - const double* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoDbl( - NiFpga_Session session, - uint32_t fifo, - const double* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoDbl - ? NiFpga_writeFifoDbl(session, - fifo, - data, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoComposite)( - NiFpga_Session session, - uint32_t fifo, - const void* data, - uint32_t bytesPerElement, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) = NULL; - -NiFpga_Status NiFpga_WriteFifoComposite( - NiFpga_Session session, - uint32_t fifo, - const void* data, - uint32_t bytesPerElement, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining) -{ - return NiFpga_writeFifoComposite - ? NiFpga_writeFifoComposite(session, - fifo, - data, - bytesPerElement, - numberOfElements, - timeout, - emptyElementsRemaining) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsBool)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_Bool** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoReadElementsBool( - NiFpga_Session session, - uint32_t fifo, - NiFpga_Bool** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoReadElementsBool - ? NiFpga_acquireFifoReadElementsBool(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsI8)( - NiFpga_Session session, - uint32_t fifo, - int8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoReadElementsI8( - NiFpga_Session session, - uint32_t fifo, - int8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoReadElementsI8 - ? NiFpga_acquireFifoReadElementsI8(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsU8)( - NiFpga_Session session, - uint32_t fifo, - uint8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoReadElementsU8( - NiFpga_Session session, - uint32_t fifo, - uint8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoReadElementsU8 - ? NiFpga_acquireFifoReadElementsU8(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsI16)( - NiFpga_Session session, - uint32_t fifo, - int16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoReadElementsI16( - NiFpga_Session session, - uint32_t fifo, - int16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoReadElementsI16 - ? NiFpga_acquireFifoReadElementsI16(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsU16)( - NiFpga_Session session, - uint32_t fifo, - uint16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoReadElementsU16( - NiFpga_Session session, - uint32_t fifo, - uint16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoReadElementsU16 - ? NiFpga_acquireFifoReadElementsU16(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsI32)( - NiFpga_Session session, - uint32_t fifo, - int32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoReadElementsI32( - NiFpga_Session session, - uint32_t fifo, - int32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoReadElementsI32 - ? NiFpga_acquireFifoReadElementsI32(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsU32)( - NiFpga_Session session, - uint32_t fifo, - uint32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoReadElementsU32( - NiFpga_Session session, - uint32_t fifo, - uint32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoReadElementsU32 - ? NiFpga_acquireFifoReadElementsU32(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsI64)( - NiFpga_Session session, - uint32_t fifo, - int64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoReadElementsI64( - NiFpga_Session session, - uint32_t fifo, - int64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoReadElementsI64 - ? NiFpga_acquireFifoReadElementsI64(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsU64)( - NiFpga_Session session, - uint32_t fifo, - uint64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoReadElementsU64( - NiFpga_Session session, - uint32_t fifo, - uint64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoReadElementsU64 - ? NiFpga_acquireFifoReadElementsU64(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsSgl)( - NiFpga_Session session, - uint32_t fifo, - float** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoReadElementsSgl( - NiFpga_Session session, - uint32_t fifo, - float** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoReadElementsSgl - ? NiFpga_acquireFifoReadElementsSgl(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsDbl)( - NiFpga_Session session, - uint32_t fifo, - double** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoReadElementsDbl( - NiFpga_Session session, - uint32_t fifo, - double** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoReadElementsDbl - ? NiFpga_acquireFifoReadElementsDbl(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsBool)( - NiFpga_Session session, - uint32_t fifo, - NiFpga_Bool** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoWriteElementsBool( - NiFpga_Session session, - uint32_t fifo, - NiFpga_Bool** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoWriteElementsBool - ? NiFpga_acquireFifoWriteElementsBool(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsI8)( - NiFpga_Session session, - uint32_t fifo, - int8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoWriteElementsI8( - NiFpga_Session session, - uint32_t fifo, - int8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoWriteElementsI8 - ? NiFpga_acquireFifoWriteElementsI8(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsU8)( - NiFpga_Session session, - uint32_t fifo, - uint8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoWriteElementsU8( - NiFpga_Session session, - uint32_t fifo, - uint8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoWriteElementsU8 - ? NiFpga_acquireFifoWriteElementsU8(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsI16)( - NiFpga_Session session, - uint32_t fifo, - int16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoWriteElementsI16( - NiFpga_Session session, - uint32_t fifo, - int16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoWriteElementsI16 - ? NiFpga_acquireFifoWriteElementsI16(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsU16)( - NiFpga_Session session, - uint32_t fifo, - uint16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoWriteElementsU16( - NiFpga_Session session, - uint32_t fifo, - uint16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoWriteElementsU16 - ? NiFpga_acquireFifoWriteElementsU16(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsI32)( - NiFpga_Session session, - uint32_t fifo, - int32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoWriteElementsI32( - NiFpga_Session session, - uint32_t fifo, - int32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoWriteElementsI32 - ? NiFpga_acquireFifoWriteElementsI32(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsU32)( - NiFpga_Session session, - uint32_t fifo, - uint32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoWriteElementsU32( - NiFpga_Session session, - uint32_t fifo, - uint32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoWriteElementsU32 - ? NiFpga_acquireFifoWriteElementsU32(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsI64)( - NiFpga_Session session, - uint32_t fifo, - int64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoWriteElementsI64( - NiFpga_Session session, - uint32_t fifo, - int64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoWriteElementsI64 - ? NiFpga_acquireFifoWriteElementsI64(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsU64)( - NiFpga_Session session, - uint32_t fifo, - uint64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoWriteElementsU64( - NiFpga_Session session, - uint32_t fifo, - uint64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoWriteElementsU64 - ? NiFpga_acquireFifoWriteElementsU64(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsSgl)( - NiFpga_Session session, - uint32_t fifo, - float** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoWriteElementsSgl( - NiFpga_Session session, - uint32_t fifo, - float** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoWriteElementsSgl - ? NiFpga_acquireFifoWriteElementsSgl(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsDbl)( - NiFpga_Session session, - uint32_t fifo, - double** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) = NULL; - -NiFpga_Status NiFpga_AcquireFifoWriteElementsDbl( - NiFpga_Session session, - uint32_t fifo, - double** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining) -{ - return NiFpga_acquireFifoWriteElementsDbl - ? NiFpga_acquireFifoWriteElementsDbl(session, - fifo, - elements, - elementsRequested, - timeout, - elementsAcquired, - elementsRemaining) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_releaseFifoElements)( - NiFpga_Session session, - uint32_t fifo, - size_t elements) = NULL; - -NiFpga_Status NiFpga_ReleaseFifoElements(NiFpga_Session session, - uint32_t fifo, - size_t elements) -{ - return NiFpga_releaseFifoElements - ? NiFpga_releaseFifoElements(session, fifo, elements) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_getPeerToPeerFifoEndpoint)( - NiFpga_Session session, - uint32_t fifo, - uint32_t* endpoint) = NULL; - -NiFpga_Status NiFpga_GetPeerToPeerFifoEndpoint(NiFpga_Session session, - uint32_t fifo, - uint32_t* endpoint) -{ - return NiFpga_getPeerToPeerFifoEndpoint - ? NiFpga_getPeerToPeerFifoEndpoint(session, fifo, endpoint) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_mapP2PSinkFifo)( - const NiFpga_Session session, - const uint32_t fifo, - size_t* size, - void** virtualAddress) = NULL; - -NiFpga_Status NiFpga_MapP2PSinkFifo(const NiFpga_Session session, - const uint32_t fifo, - size_t* size, - void** virtualAddress) -{ - return NiFpga_mapP2PSinkFifo - ? NiFpga_mapP2PSinkFifo(session, fifo, size, virtualAddress) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_unmapP2PSinkFifo)( - const NiFpga_Session session, - const uint32_t fifo) = NULL; - -NiFpga_Status NiFpga_UnmapP2PSinkFifo(const NiFpga_Session session, - const uint32_t fifo) -{ - return NiFpga_unmapP2PSinkFifo - ? NiFpga_unmapP2PSinkFifo(session, fifo) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_getBitfileContents)( - NiFpga_Session session, - const char** contents) = NULL; - -NiFpga_Status NiFpga_GetBitfileContents(NiFpga_Session session, - const char** contents) -{ - return NiFpga_getBitfileContents - ? NiFpga_getBitfileContents(session, contents) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_findRegisterPrivate)( - NiFpga_Session session, - const char* resourceName, - uint32_t expectedResourceType, - uint32_t* resourceOffset) = NULL; - -NiFpga_Status NiFpga_FindRegisterPrivate(NiFpga_Session session, - const char* resourceName, - uint32_t expectedResourceType, - uint32_t* resourceOffset) -{ - return NiFpga_findRegisterPrivate - ? NiFpga_findRegisterPrivate(session, resourceName, expectedResourceType, resourceOffset) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_findFifoPrivate)( - NiFpga_Session session, - const char* resourceName, - uint32_t expectedResourceType, - uint32_t* resourceOffset) = NULL; - -NiFpga_Status NiFpga_FindFifoPrivate(NiFpga_Session session, - const char* fifoName, - uint32_t expectedResourceType, - uint32_t* resourceOffset) -{ - return NiFpga_findFifoPrivate - ? NiFpga_findFifoPrivate(session, fifoName, expectedResourceType, resourceOffset) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_openHostMemoryBuffer)( - const NiFpga_Session session, - const char* memoryName, - size_t* memorySize, - void** virtualAddress) = NULL; - -NiFpga_Status NiFpga_OpenHostMemoryBuffer(const NiFpga_Session session, - const char* memoryName, - size_t* memorySize, - void** virtualAddress) -{ - return NiFpga_openHostMemoryBuffer - ? NiFpga_openHostMemoryBuffer(session, memoryName, memorySize, virtualAddress) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_closeHostMemoryBuffer)( - const NiFpga_Session session, - const char* memoryName) = NULL; - -NiFpga_Status NiFpga_CloseHostMemoryBuffer(const NiFpga_Session session, - const char* memoryName) -{ - return NiFpga_closeHostMemoryBuffer - ? NiFpga_closeHostMemoryBuffer(session, memoryName) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_openLowLatencyBuffer)( - const NiFpga_Session session, - const char* memoryName, - size_t* memorySizeToHost, - void** virtualAddressToHost, - size_t* memorySizeToFpga, - void** virtualAddressToFpga) = NULL; - -NiFpga_Status NiFpga_OpenLowLatencyBuffer(const NiFpga_Session session, - const char* memoryName, - size_t* memorySizeToHost, - void** virtualAddressToHost, - size_t* memorySizeToFpga, - void** virtualAddressToFpga) -{ - return NiFpga_openLowLatencyBuffer - ? NiFpga_openLowLatencyBuffer(session, memoryName, memorySizeToHost, virtualAddressToHost, memorySizeToFpga, virtualAddressToFpga) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_closeLowLatencyBuffer)( - const NiFpga_Session session, - const char* memoryName) = NULL; - -NiFpga_Status NiFpga_CloseLowLatencyBuffer(const NiFpga_Session session, - const char* memoryName) -{ - return NiFpga_closeLowLatencyBuffer - ? NiFpga_closeLowLatencyBuffer(session, memoryName) - : NiFpga_Status_ResourceNotInitialized; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_clientFunctionCall)( - NiFpga_Session session, - uint32_t group, - uint32_t functionId, - const void* inBuffer, - size_t inBufferSize, - void* outBuffer, - size_t outBufferSize) = NULL; - -NiFpga_Status NiFpga_ClientFunctionCall(NiFpga_Session session, - uint32_t group, - uint32_t functionId, - const void* inBuffer, - size_t inBufferSize, - void* outBuffer, - size_t outBufferSize) -{ - return NiFpga_clientFunctionCall - ? NiFpga_clientFunctionCall(session, group, functionId, inBuffer, inBufferSize, outBuffer, outBufferSize) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_findRegister)( - NiFpga_Session session, - const char* registerName, - uint32_t* registerOffset) = NULL; - -NiFpga_Status NiFpga_FindRegister(NiFpga_Session session, - const char* registerName, - uint32_t* registerOffset) -{ - return NiFpga_findRegister - ? NiFpga_findRegister(session, registerName, registerOffset) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_findFifo)( - NiFpga_Session session, - const char* fifoName, - uint32_t* fifoNumber) = NULL; - -NiFpga_Status NiFpga_FindFifo(NiFpga_Session session, - const char* fifoName, - uint32_t* fifoNumber) -{ - return NiFpga_findFifo - ? NiFpga_findFifo(session, fifoName, fifoNumber) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_getFpgaViState)( - NiFpga_Session session, - uint32_t* state) = NULL; - -NiFpga_Status NiFpga_GetFpgaViState(NiFpga_Session session, uint32_t* state) -{ - return NiFpga_getFpgaViState - ? NiFpga_getFpgaViState(session, state) - : NiFpga_Status_VersionMismatch; -} - -static NiFpga_Status (NiFpga_CCall *NiFpga_getBitfileSignature)( - NiFpga_Session session, - uint32_t* signature, - size_t* signatureSize) = NULL; - -NiFpga_Status NiFpga_GetBitfileSignature(NiFpga_Session session, uint32_t* state, size_t* signatureSize) -{ - return NiFpga_getBitfileSignature - ? NiFpga_getBitfileSignature(session, state, signatureSize) - : NiFpga_Status_VersionMismatch; +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoBool)(NiFpga_Session session, uint32_t fifo, + const NiFpga_Bool* data, size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoBool(NiFpga_Session session, uint32_t fifo, const NiFpga_Bool* data, + size_t numberOfElements, uint32_t timeout, + size_t* emptyElementsRemaining) { + return NiFpga_writeFifoBool ? NiFpga_writeFifoBool(session, fifo, data, numberOfElements, timeout, + emptyElementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoI8)(NiFpga_Session session, uint32_t fifo, + const int8_t* data, size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoI8(NiFpga_Session session, uint32_t fifo, const int8_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining) { + return NiFpga_writeFifoI8 ? NiFpga_writeFifoI8(session, fifo, data, numberOfElements, timeout, + emptyElementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoU8)(NiFpga_Session session, uint32_t fifo, + const uint8_t* data, size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoU8(NiFpga_Session session, uint32_t fifo, const uint8_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining) { + return NiFpga_writeFifoU8 ? NiFpga_writeFifoU8(session, fifo, data, numberOfElements, timeout, + emptyElementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoI16)(NiFpga_Session session, uint32_t fifo, + const int16_t* data, size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoI16(NiFpga_Session session, uint32_t fifo, const int16_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining) { + return NiFpga_writeFifoI16 ? NiFpga_writeFifoI16(session, fifo, data, numberOfElements, timeout, + emptyElementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoU16)(NiFpga_Session session, uint32_t fifo, + const uint16_t* data, size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoU16(NiFpga_Session session, uint32_t fifo, const uint16_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining) { + return NiFpga_writeFifoU16 ? NiFpga_writeFifoU16(session, fifo, data, numberOfElements, timeout, + emptyElementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoI32)(NiFpga_Session session, uint32_t fifo, + const int32_t* data, size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoI32(NiFpga_Session session, uint32_t fifo, const int32_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining) { + return NiFpga_writeFifoI32 ? NiFpga_writeFifoI32(session, fifo, data, numberOfElements, timeout, + emptyElementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoU32)(NiFpga_Session session, uint32_t fifo, + const uint32_t* data, size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoU32(NiFpga_Session session, uint32_t fifo, const uint32_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining) { + return NiFpga_writeFifoU32 ? NiFpga_writeFifoU32(session, fifo, data, numberOfElements, timeout, + emptyElementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoI64)(NiFpga_Session session, uint32_t fifo, + const int64_t* data, size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoI64(NiFpga_Session session, uint32_t fifo, const int64_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining) { + return NiFpga_writeFifoI64 ? NiFpga_writeFifoI64(session, fifo, data, numberOfElements, timeout, + emptyElementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoU64)(NiFpga_Session session, uint32_t fifo, + const uint64_t* data, size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoU64(NiFpga_Session session, uint32_t fifo, const uint64_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining) { + return NiFpga_writeFifoU64 ? NiFpga_writeFifoU64(session, fifo, data, numberOfElements, timeout, + emptyElementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoSgl)(NiFpga_Session session, uint32_t fifo, + const float* data, size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoSgl(NiFpga_Session session, uint32_t fifo, const float* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining) { + return NiFpga_writeFifoSgl ? NiFpga_writeFifoSgl(session, fifo, data, numberOfElements, timeout, + emptyElementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoDbl)(NiFpga_Session session, uint32_t fifo, + const double* data, size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoDbl(NiFpga_Session session, uint32_t fifo, const double* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining) { + return NiFpga_writeFifoDbl ? NiFpga_writeFifoDbl(session, fifo, data, numberOfElements, timeout, + emptyElementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_writeFifoComposite)(NiFpga_Session session, uint32_t fifo, + const void* data, uint32_t bytesPerElement, + size_t numberOfElements, uint32_t timeout, + size_t* emptyElementsRemaining) = NULL; + +NiFpga_Status NiFpga_WriteFifoComposite(NiFpga_Session session, uint32_t fifo, const void* data, + uint32_t bytesPerElement, size_t numberOfElements, uint32_t timeout, + size_t* emptyElementsRemaining) { + return NiFpga_writeFifoComposite + ? NiFpga_writeFifoComposite(session, fifo, data, bytesPerElement, numberOfElements, + timeout, emptyElementsRemaining) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoReadElementsBool)( + NiFpga_Session session, uint32_t fifo, NiFpga_Bool** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoReadElementsBool(NiFpga_Session session, uint32_t fifo, + NiFpga_Bool** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, + size_t* elementsRemaining) { + return NiFpga_acquireFifoReadElementsBool + ? NiFpga_acquireFifoReadElementsBool(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoReadElementsI8)( + NiFpga_Session session, uint32_t fifo, int8_t** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoReadElementsI8(NiFpga_Session session, uint32_t fifo, int8_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoReadElementsI8 + ? NiFpga_acquireFifoReadElementsI8(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoReadElementsU8)( + NiFpga_Session session, uint32_t fifo, uint8_t** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoReadElementsU8(NiFpga_Session session, uint32_t fifo, uint8_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoReadElementsU8 + ? NiFpga_acquireFifoReadElementsU8(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoReadElementsI16)( + NiFpga_Session session, uint32_t fifo, int16_t** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoReadElementsI16(NiFpga_Session session, uint32_t fifo, int16_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoReadElementsI16 + ? NiFpga_acquireFifoReadElementsI16(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoReadElementsU16)( + NiFpga_Session session, uint32_t fifo, uint16_t** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoReadElementsU16(NiFpga_Session session, uint32_t fifo, uint16_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoReadElementsU16 + ? NiFpga_acquireFifoReadElementsU16(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoReadElementsI32)( + NiFpga_Session session, uint32_t fifo, int32_t** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoReadElementsI32(NiFpga_Session session, uint32_t fifo, int32_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoReadElementsI32 + ? NiFpga_acquireFifoReadElementsI32(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoReadElementsU32)( + NiFpga_Session session, uint32_t fifo, uint32_t** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoReadElementsU32(NiFpga_Session session, uint32_t fifo, uint32_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoReadElementsU32 + ? NiFpga_acquireFifoReadElementsU32(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoReadElementsI64)( + NiFpga_Session session, uint32_t fifo, int64_t** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoReadElementsI64(NiFpga_Session session, uint32_t fifo, int64_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoReadElementsI64 + ? NiFpga_acquireFifoReadElementsI64(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoReadElementsU64)( + NiFpga_Session session, uint32_t fifo, uint64_t** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoReadElementsU64(NiFpga_Session session, uint32_t fifo, uint64_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoReadElementsU64 + ? NiFpga_acquireFifoReadElementsU64(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoReadElementsSgl)( + NiFpga_Session session, uint32_t fifo, float** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoReadElementsSgl(NiFpga_Session session, uint32_t fifo, float** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoReadElementsSgl + ? NiFpga_acquireFifoReadElementsSgl(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoReadElementsDbl)( + NiFpga_Session session, uint32_t fifo, double** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoReadElementsDbl(NiFpga_Session session, uint32_t fifo, double** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoReadElementsDbl + ? NiFpga_acquireFifoReadElementsDbl(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoWriteElementsBool)( + NiFpga_Session session, uint32_t fifo, NiFpga_Bool** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoWriteElementsBool(NiFpga_Session session, uint32_t fifo, + NiFpga_Bool** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, + size_t* elementsRemaining) { + return NiFpga_acquireFifoWriteElementsBool + ? NiFpga_acquireFifoWriteElementsBool(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoWriteElementsI8)( + NiFpga_Session session, uint32_t fifo, int8_t** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoWriteElementsI8(NiFpga_Session session, uint32_t fifo, int8_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoWriteElementsI8 + ? NiFpga_acquireFifoWriteElementsI8(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoWriteElementsU8)( + NiFpga_Session session, uint32_t fifo, uint8_t** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoWriteElementsU8(NiFpga_Session session, uint32_t fifo, uint8_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoWriteElementsU8 + ? NiFpga_acquireFifoWriteElementsU8(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoWriteElementsI16)( + NiFpga_Session session, uint32_t fifo, int16_t** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoWriteElementsI16(NiFpga_Session session, uint32_t fifo, int16_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoWriteElementsI16 + ? NiFpga_acquireFifoWriteElementsI16(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoWriteElementsU16)( + NiFpga_Session session, uint32_t fifo, uint16_t** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoWriteElementsU16(NiFpga_Session session, uint32_t fifo, uint16_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoWriteElementsU16 + ? NiFpga_acquireFifoWriteElementsU16(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoWriteElementsI32)( + NiFpga_Session session, uint32_t fifo, int32_t** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoWriteElementsI32(NiFpga_Session session, uint32_t fifo, int32_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoWriteElementsI32 + ? NiFpga_acquireFifoWriteElementsI32(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoWriteElementsU32)( + NiFpga_Session session, uint32_t fifo, uint32_t** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoWriteElementsU32(NiFpga_Session session, uint32_t fifo, uint32_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoWriteElementsU32 + ? NiFpga_acquireFifoWriteElementsU32(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoWriteElementsI64)( + NiFpga_Session session, uint32_t fifo, int64_t** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoWriteElementsI64(NiFpga_Session session, uint32_t fifo, int64_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoWriteElementsI64 + ? NiFpga_acquireFifoWriteElementsI64(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoWriteElementsU64)( + NiFpga_Session session, uint32_t fifo, uint64_t** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoWriteElementsU64(NiFpga_Session session, uint32_t fifo, uint64_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoWriteElementsU64 + ? NiFpga_acquireFifoWriteElementsU64(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoWriteElementsSgl)( + NiFpga_Session session, uint32_t fifo, float** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoWriteElementsSgl(NiFpga_Session session, uint32_t fifo, float** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoWriteElementsSgl + ? NiFpga_acquireFifoWriteElementsSgl(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_acquireFifoWriteElementsDbl)( + NiFpga_Session session, uint32_t fifo, double** elements, size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) = NULL; + +NiFpga_Status NiFpga_AcquireFifoWriteElementsDbl(NiFpga_Session session, uint32_t fifo, double** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining) { + return NiFpga_acquireFifoWriteElementsDbl + ? NiFpga_acquireFifoWriteElementsDbl(session, fifo, elements, elementsRequested, timeout, + elementsAcquired, elementsRemaining) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_releaseFifoElements)(NiFpga_Session session, uint32_t fifo, + size_t elements) = NULL; + +NiFpga_Status NiFpga_ReleaseFifoElements(NiFpga_Session session, uint32_t fifo, size_t elements) { + return NiFpga_releaseFifoElements ? NiFpga_releaseFifoElements(session, fifo, elements) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_getPeerToPeerFifoEndpoint)(NiFpga_Session session, uint32_t fifo, + uint32_t* endpoint) = NULL; + +NiFpga_Status NiFpga_GetPeerToPeerFifoEndpoint(NiFpga_Session session, uint32_t fifo, uint32_t* endpoint) { + return NiFpga_getPeerToPeerFifoEndpoint ? NiFpga_getPeerToPeerFifoEndpoint(session, fifo, endpoint) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_mapP2PSinkFifo)(const NiFpga_Session session, const uint32_t fifo, + size_t* size, void** virtualAddress) = NULL; + +NiFpga_Status NiFpga_MapP2PSinkFifo(const NiFpga_Session session, const uint32_t fifo, size_t* size, + void** virtualAddress) { + return NiFpga_mapP2PSinkFifo ? NiFpga_mapP2PSinkFifo(session, fifo, size, virtualAddress) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_unmapP2PSinkFifo)(const NiFpga_Session session, + const uint32_t fifo) = NULL; + +NiFpga_Status NiFpga_UnmapP2PSinkFifo(const NiFpga_Session session, const uint32_t fifo) { + return NiFpga_unmapP2PSinkFifo ? NiFpga_unmapP2PSinkFifo(session, fifo) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_getBitfileContents)(NiFpga_Session session, + const char** contents) = NULL; + +NiFpga_Status NiFpga_GetBitfileContents(NiFpga_Session session, const char** contents) { + return NiFpga_getBitfileContents ? NiFpga_getBitfileContents(session, contents) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_findRegisterPrivate)(NiFpga_Session session, + const char* resourceName, + uint32_t expectedResourceType, + uint32_t* resourceOffset) = NULL; + +NiFpga_Status NiFpga_FindRegisterPrivate(NiFpga_Session session, const char* resourceName, + uint32_t expectedResourceType, uint32_t* resourceOffset) { + return NiFpga_findRegisterPrivate + ? NiFpga_findRegisterPrivate(session, resourceName, expectedResourceType, resourceOffset) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_findFifoPrivate)(NiFpga_Session session, const char* resourceName, + uint32_t expectedResourceType, + uint32_t* resourceOffset) = NULL; + +NiFpga_Status NiFpga_FindFifoPrivate(NiFpga_Session session, const char* fifoName, + uint32_t expectedResourceType, uint32_t* resourceOffset) { + return NiFpga_findFifoPrivate + ? NiFpga_findFifoPrivate(session, fifoName, expectedResourceType, resourceOffset) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_openHostMemoryBuffer)(const NiFpga_Session session, + const char* memoryName, size_t* memorySize, + void** virtualAddress) = NULL; + +NiFpga_Status NiFpga_OpenHostMemoryBuffer(const NiFpga_Session session, const char* memoryName, + size_t* memorySize, void** virtualAddress) { + return NiFpga_openHostMemoryBuffer + ? NiFpga_openHostMemoryBuffer(session, memoryName, memorySize, virtualAddress) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_closeHostMemoryBuffer)(const NiFpga_Session session, + const char* memoryName) = NULL; + +NiFpga_Status NiFpga_CloseHostMemoryBuffer(const NiFpga_Session session, const char* memoryName) { + return NiFpga_closeHostMemoryBuffer ? NiFpga_closeHostMemoryBuffer(session, memoryName) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_openLowLatencyBuffer)( + const NiFpga_Session session, const char* memoryName, size_t* memorySizeToHost, + void** virtualAddressToHost, size_t* memorySizeToFpga, void** virtualAddressToFpga) = NULL; + +NiFpga_Status NiFpga_OpenLowLatencyBuffer(const NiFpga_Session session, const char* memoryName, + size_t* memorySizeToHost, void** virtualAddressToHost, + size_t* memorySizeToFpga, void** virtualAddressToFpga) { + return NiFpga_openLowLatencyBuffer + ? NiFpga_openLowLatencyBuffer(session, memoryName, memorySizeToHost, virtualAddressToHost, + memorySizeToFpga, virtualAddressToFpga) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_closeLowLatencyBuffer)(const NiFpga_Session session, + const char* memoryName) = NULL; + +NiFpga_Status NiFpga_CloseLowLatencyBuffer(const NiFpga_Session session, const char* memoryName) { + return NiFpga_closeLowLatencyBuffer ? NiFpga_closeLowLatencyBuffer(session, memoryName) + : NiFpga_Status_ResourceNotInitialized; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_clientFunctionCall)(NiFpga_Session session, uint32_t group, + uint32_t functionId, const void* inBuffer, + size_t inBufferSize, void* outBuffer, + size_t outBufferSize) = NULL; + +NiFpga_Status NiFpga_ClientFunctionCall(NiFpga_Session session, uint32_t group, uint32_t functionId, + const void* inBuffer, size_t inBufferSize, void* outBuffer, + size_t outBufferSize) { + return NiFpga_clientFunctionCall ? NiFpga_clientFunctionCall(session, group, functionId, inBuffer, + inBufferSize, outBuffer, outBufferSize) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_findRegister)(NiFpga_Session session, const char* registerName, + uint32_t* registerOffset) = NULL; + +NiFpga_Status NiFpga_FindRegister(NiFpga_Session session, const char* registerName, + uint32_t* registerOffset) { + return NiFpga_findRegister ? NiFpga_findRegister(session, registerName, registerOffset) + : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_findFifo)(NiFpga_Session session, const char* fifoName, + uint32_t* fifoNumber) = NULL; + +NiFpga_Status NiFpga_FindFifo(NiFpga_Session session, const char* fifoName, uint32_t* fifoNumber) { + return NiFpga_findFifo ? NiFpga_findFifo(session, fifoName, fifoNumber) : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_getFpgaViState)(NiFpga_Session session, uint32_t* state) = NULL; + +NiFpga_Status NiFpga_GetFpgaViState(NiFpga_Session session, uint32_t* state) { + return NiFpga_getFpgaViState ? NiFpga_getFpgaViState(session, state) : NiFpga_Status_VersionMismatch; +} + +static NiFpga_Status(NiFpga_CCall* NiFpga_getBitfileSignature)(NiFpga_Session session, uint32_t* signature, + size_t* signatureSize) = NULL; + +NiFpga_Status NiFpga_GetBitfileSignature(NiFpga_Session session, uint32_t* state, size_t* signatureSize) { + return NiFpga_getBitfileSignature ? NiFpga_getBitfileSignature(session, state, signatureSize) + : NiFpga_Status_VersionMismatch; } /** * A type large enough to hold entry point function pointer. */ -typedef NiFpga_Status (NiFpga_CCall *NiFpga_FunctionPointer)(); +typedef NiFpga_Status(NiFpga_CCall* NiFpga_FunctionPointer)(); /** * A NULL-terminated array of all entry point functions. */ -static const struct -{ - const char* const name; - NiFpga_FunctionPointer* const address; - NiFpga_Bool required; -} NiFpga_functions[] = -{ - {"NiFpgaDll_Open", (NiFpga_FunctionPointer*)&NiFpga_open, 1}, - {"NiFpgaDll_Close", (NiFpga_FunctionPointer*)&NiFpga_close, 1}, - {"NiFpgaDll_Run", (NiFpga_FunctionPointer*)&NiFpga_run, 1}, - {"NiFpgaDll_Abort", (NiFpga_FunctionPointer*)&NiFpga_abort, 1}, - {"NiFpgaDll_Reset", (NiFpga_FunctionPointer*)&NiFpga_reset, 1}, - {"NiFpgaDll_Download", (NiFpga_FunctionPointer*)&NiFpga_download, 1}, - {"NiFpgaDll_ReadBool", (NiFpga_FunctionPointer*)&NiFpga_readBool, 1}, - {"NiFpgaDll_ReadI8", (NiFpga_FunctionPointer*)&NiFpga_readI8, 1}, - {"NiFpgaDll_ReadU8", (NiFpga_FunctionPointer*)&NiFpga_readU8, 1}, - {"NiFpgaDll_ReadI16", (NiFpga_FunctionPointer*)&NiFpga_readI16, 1}, - {"NiFpgaDll_ReadU16", (NiFpga_FunctionPointer*)&NiFpga_readU16, 1}, - {"NiFpgaDll_ReadI32", (NiFpga_FunctionPointer*)&NiFpga_readI32, 1}, - {"NiFpgaDll_ReadU32", (NiFpga_FunctionPointer*)&NiFpga_readU32, 1}, - {"NiFpgaDll_ReadI64", (NiFpga_FunctionPointer*)&NiFpga_readI64, 1}, - {"NiFpgaDll_ReadU64", (NiFpga_FunctionPointer*)&NiFpga_readU64, 1}, - {"NiFpgaDll_ReadSgl", (NiFpga_FunctionPointer*)&NiFpga_readSgl, 1}, - {"NiFpgaDll_ReadDbl", (NiFpga_FunctionPointer*)&NiFpga_readDbl, 1}, - {"NiFpgaDll_WriteBool", (NiFpga_FunctionPointer*)&NiFpga_writeBool, 1}, - {"NiFpgaDll_WriteI8", (NiFpga_FunctionPointer*)&NiFpga_writeI8, 1}, - {"NiFpgaDll_WriteU8", (NiFpga_FunctionPointer*)&NiFpga_writeU8, 1}, - {"NiFpgaDll_WriteI16", (NiFpga_FunctionPointer*)&NiFpga_writeI16, 1}, - {"NiFpgaDll_WriteU16", (NiFpga_FunctionPointer*)&NiFpga_writeU16, 1}, - {"NiFpgaDll_WriteI32", (NiFpga_FunctionPointer*)&NiFpga_writeI32, 1}, - {"NiFpgaDll_WriteU32", (NiFpga_FunctionPointer*)&NiFpga_writeU32, 1}, - {"NiFpgaDll_WriteI64", (NiFpga_FunctionPointer*)&NiFpga_writeI64, 1}, - {"NiFpgaDll_WriteU64", (NiFpga_FunctionPointer*)&NiFpga_writeU64, 1}, - {"NiFpgaDll_WriteSgl", (NiFpga_FunctionPointer*)&NiFpga_writeSgl, 1}, - {"NiFpgaDll_WriteDbl", (NiFpga_FunctionPointer*)&NiFpga_writeDbl, 1}, - {"NiFpgaDll_ReadArrayBool", (NiFpga_FunctionPointer*)&NiFpga_readArrayBool, 1}, - {"NiFpgaDll_ReadArrayI8", (NiFpga_FunctionPointer*)&NiFpga_readArrayI8, 1}, - {"NiFpgaDll_ReadArrayU8", (NiFpga_FunctionPointer*)&NiFpga_readArrayU8, 1}, - {"NiFpgaDll_ReadArrayI16", (NiFpga_FunctionPointer*)&NiFpga_readArrayI16, 1}, - {"NiFpgaDll_ReadArrayU16", (NiFpga_FunctionPointer*)&NiFpga_readArrayU16, 1}, - {"NiFpgaDll_ReadArrayI32", (NiFpga_FunctionPointer*)&NiFpga_readArrayI32, 1}, - {"NiFpgaDll_ReadArrayU32", (NiFpga_FunctionPointer*)&NiFpga_readArrayU32, 1}, - {"NiFpgaDll_ReadArrayI64", (NiFpga_FunctionPointer*)&NiFpga_readArrayI64, 1}, - {"NiFpgaDll_ReadArrayU64", (NiFpga_FunctionPointer*)&NiFpga_readArrayU64, 1}, - {"NiFpgaDll_ReadArraySgl", (NiFpga_FunctionPointer*)&NiFpga_readArraySgl, 1}, - {"NiFpgaDll_ReadArrayDbl", (NiFpga_FunctionPointer*)&NiFpga_readArrayDbl, 1}, - {"NiFpgaDll_WriteArrayBool", (NiFpga_FunctionPointer*)&NiFpga_writeArrayBool, 1}, - {"NiFpgaDll_WriteArrayI8", (NiFpga_FunctionPointer*)&NiFpga_writeArrayI8, 1}, - {"NiFpgaDll_WriteArrayU8", (NiFpga_FunctionPointer*)&NiFpga_writeArrayU8, 1}, - {"NiFpgaDll_WriteArrayI16", (NiFpga_FunctionPointer*)&NiFpga_writeArrayI16, 1}, - {"NiFpgaDll_WriteArrayU16", (NiFpga_FunctionPointer*)&NiFpga_writeArrayU16, 1}, - {"NiFpgaDll_WriteArrayI32", (NiFpga_FunctionPointer*)&NiFpga_writeArrayI32, 1}, - {"NiFpgaDll_WriteArrayU32", (NiFpga_FunctionPointer*)&NiFpga_writeArrayU32, 1}, - {"NiFpgaDll_WriteArrayI64", (NiFpga_FunctionPointer*)&NiFpga_writeArrayI64, 1}, - {"NiFpgaDll_WriteArrayU64", (NiFpga_FunctionPointer*)&NiFpga_writeArrayU64, 1}, - {"NiFpgaDll_WriteArraySgl", (NiFpga_FunctionPointer*)&NiFpga_writeArraySgl, 1}, - {"NiFpgaDll_WriteArrayDbl", (NiFpga_FunctionPointer*)&NiFpga_writeArrayDbl, 1}, - {"NiFpgaDll_ReserveIrqContext", (NiFpga_FunctionPointer*)&NiFpga_reserveIrqContext, 1}, - {"NiFpgaDll_UnreserveIrqContext", (NiFpga_FunctionPointer*)&NiFpga_unreserveIrqContext, 1}, - {"NiFpgaDll_WaitOnIrqs", (NiFpga_FunctionPointer*)&NiFpga_waitOnIrqs, 1}, - {"NiFpgaDll_AcknowledgeIrqs", (NiFpga_FunctionPointer*)&NiFpga_acknowledgeIrqs, 1}, - {"NiFpgaDll_ConfigureFifo", (NiFpga_FunctionPointer*)&NiFpga_configureFifo, 1}, - {"NiFpgaDll_ConfigureFifo2", (NiFpga_FunctionPointer*)&NiFpga_configureFifo2, 1}, - {"NiFpgaDll_SetFifoPropertyU32", (NiFpga_FunctionPointer*)&NiFpga_setFifoPropertyU32, 0}, - {"NiFpgaDll_SetFifoPropertyI32", (NiFpga_FunctionPointer*)&NiFpga_setFifoPropertyI32, 0}, - {"NiFpgaDll_SetFifoPropertyU64", (NiFpga_FunctionPointer*)&NiFpga_setFifoPropertyU64, 0}, - {"NiFpgaDll_SetFifoPropertyI64", (NiFpga_FunctionPointer*)&NiFpga_setFifoPropertyI64, 0}, - {"NiFpgaDll_SetFifoPropertyPtr", (NiFpga_FunctionPointer*)&NiFpga_setFifoPropertyPtr, 0}, - {"NiFpgaDll_GetFifoPropertyU32", (NiFpga_FunctionPointer*)&NiFpga_getFifoPropertyU32, 0}, - {"NiFpgaDll_GetFifoPropertyI32", (NiFpga_FunctionPointer*)&NiFpga_getFifoPropertyI32, 0}, - {"NiFpgaDll_GetFifoPropertyU64", (NiFpga_FunctionPointer*)&NiFpga_getFifoPropertyU64, 0}, - {"NiFpgaDll_GetFifoPropertyI64", (NiFpga_FunctionPointer*)&NiFpga_getFifoPropertyI64, 0}, - {"NiFpgaDll_GetFifoPropertyPtr", (NiFpga_FunctionPointer*)&NiFpga_getFifoPropertyPtr, 0}, - {"NiFpgaDll_CommitFifoConfiguration", (NiFpga_FunctionPointer*)&NiFpga_commitFifoConfiguration, 0}, - {"NiFpgaDll_StartFifo", (NiFpga_FunctionPointer*)&NiFpga_startFifo, 1}, - {"NiFpgaDll_StopFifo", (NiFpga_FunctionPointer*)&NiFpga_stopFifo, 1}, - {"NiFpgaDll_UnreserveFifo", (NiFpga_FunctionPointer*)&NiFpga_unreserveFifo, 0}, - {"NiFpgaDll_ReadFifoBool", (NiFpga_FunctionPointer*)&NiFpga_readFifoBool, 1}, - {"NiFpgaDll_ReadFifoI8", (NiFpga_FunctionPointer*)&NiFpga_readFifoI8, 1}, - {"NiFpgaDll_ReadFifoU8", (NiFpga_FunctionPointer*)&NiFpga_readFifoU8, 1}, - {"NiFpgaDll_ReadFifoI16", (NiFpga_FunctionPointer*)&NiFpga_readFifoI16, 1}, - {"NiFpgaDll_ReadFifoU16", (NiFpga_FunctionPointer*)&NiFpga_readFifoU16, 1}, - {"NiFpgaDll_ReadFifoI32", (NiFpga_FunctionPointer*)&NiFpga_readFifoI32, 1}, - {"NiFpgaDll_ReadFifoU32", (NiFpga_FunctionPointer*)&NiFpga_readFifoU32, 1}, - {"NiFpgaDll_ReadFifoI64", (NiFpga_FunctionPointer*)&NiFpga_readFifoI64, 1}, - {"NiFpgaDll_ReadFifoU64", (NiFpga_FunctionPointer*)&NiFpga_readFifoU64, 1}, - {"NiFpgaDll_ReadFifoSgl", (NiFpga_FunctionPointer*)&NiFpga_readFifoSgl, 1}, - {"NiFpgaDll_ReadFifoDbl", (NiFpga_FunctionPointer*)&NiFpga_readFifoDbl, 1}, - {"NiFpgaDll_ReadFifoComposite", (NiFpga_FunctionPointer*)&NiFpga_readFifoComposite, 0}, - {"NiFpgaDll_WriteFifoBool", (NiFpga_FunctionPointer*)&NiFpga_writeFifoBool, 1}, - {"NiFpgaDll_WriteFifoI8", (NiFpga_FunctionPointer*)&NiFpga_writeFifoI8, 1}, - {"NiFpgaDll_WriteFifoU8", (NiFpga_FunctionPointer*)&NiFpga_writeFifoU8, 1}, - {"NiFpgaDll_WriteFifoI16", (NiFpga_FunctionPointer*)&NiFpga_writeFifoI16, 1}, - {"NiFpgaDll_WriteFifoU16", (NiFpga_FunctionPointer*)&NiFpga_writeFifoU16, 1}, - {"NiFpgaDll_WriteFifoI32", (NiFpga_FunctionPointer*)&NiFpga_writeFifoI32, 1}, - {"NiFpgaDll_WriteFifoU32", (NiFpga_FunctionPointer*)&NiFpga_writeFifoU32, 1}, - {"NiFpgaDll_WriteFifoI64", (NiFpga_FunctionPointer*)&NiFpga_writeFifoI64, 1}, - {"NiFpgaDll_WriteFifoU64", (NiFpga_FunctionPointer*)&NiFpga_writeFifoU64, 1}, - {"NiFpgaDll_WriteFifoSgl", (NiFpga_FunctionPointer*)&NiFpga_writeFifoSgl, 1}, - {"NiFpgaDll_WriteFifoDbl", (NiFpga_FunctionPointer*)&NiFpga_writeFifoDbl, 1}, - {"NiFpgaDll_WriteFifoComposite", (NiFpga_FunctionPointer*)&NiFpga_writeFifoComposite, 0}, - {"NiFpgaDll_AcquireFifoReadElementsBool", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsBool, 1}, - {"NiFpgaDll_AcquireFifoReadElementsI8", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsI8, 1}, - {"NiFpgaDll_AcquireFifoReadElementsU8", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsU8, 1}, - {"NiFpgaDll_AcquireFifoReadElementsI16", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsI16, 1}, - {"NiFpgaDll_AcquireFifoReadElementsU16", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsU16, 1}, - {"NiFpgaDll_AcquireFifoReadElementsI32", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsI32, 1}, - {"NiFpgaDll_AcquireFifoReadElementsU32", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsU32, 1}, - {"NiFpgaDll_AcquireFifoReadElementsI64", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsI64, 1}, - {"NiFpgaDll_AcquireFifoReadElementsU64", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsU64, 1}, - {"NiFpgaDll_AcquireFifoReadElementsSgl", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsSgl, 1}, - {"NiFpgaDll_AcquireFifoReadElementsDbl", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsDbl, 1}, - {"NiFpgaDll_AcquireFifoWriteElementsBool", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsBool, 1}, - {"NiFpgaDll_AcquireFifoWriteElementsI8", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsI8, 1}, - {"NiFpgaDll_AcquireFifoWriteElementsU8", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsU8, 1}, - {"NiFpgaDll_AcquireFifoWriteElementsI16", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsI16, 1}, - {"NiFpgaDll_AcquireFifoWriteElementsU16", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsU16, 1}, - {"NiFpgaDll_AcquireFifoWriteElementsI32", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsI32, 1}, - {"NiFpgaDll_AcquireFifoWriteElementsU32", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsU32, 1}, - {"NiFpgaDll_AcquireFifoWriteElementsI64", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsI64, 1}, - {"NiFpgaDll_AcquireFifoWriteElementsU64", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsU64, 1}, - {"NiFpgaDll_AcquireFifoWriteElementsSgl", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsSgl, 1}, - {"NiFpgaDll_AcquireFifoWriteElementsDbl", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsDbl, 1}, - {"NiFpgaDll_ReleaseFifoElements", (NiFpga_FunctionPointer*)&NiFpga_releaseFifoElements, 1}, - {"NiFpgaDll_GetPeerToPeerFifoEndpoint", (NiFpga_FunctionPointer*)&NiFpga_getPeerToPeerFifoEndpoint, 1}, - {"NiFpgaDll_MapP2PSinkFifo", (NiFpga_FunctionPointer*)&NiFpga_mapP2PSinkFifo, 0}, - {"NiFpgaDll_UnmapP2PSinkFifo", (NiFpga_FunctionPointer*)&NiFpga_unmapP2PSinkFifo, 0}, - {"NiFpgaDll_GetBitfileContents", (NiFpga_FunctionPointer*)&NiFpga_getBitfileContents, 1}, - {"NiFpgaDll_FindRegisterPrivate", (NiFpga_FunctionPointer*)&NiFpga_findRegisterPrivate, 0}, - {"NiFpgaDll_FindFifoPrivate", (NiFpga_FunctionPointer*)&NiFpga_findFifoPrivate, 0}, - {"NiFpgaDll_OpenHmb", (NiFpga_FunctionPointer*)&NiFpga_openHostMemoryBuffer, 0}, - {"NiFpgaDll_CloseHmb", (NiFpga_FunctionPointer*)&NiFpga_closeHostMemoryBuffer, 0}, - {"NiFpgaDll_OpenLlb", (NiFpga_FunctionPointer*)&NiFpga_openLowLatencyBuffer, 0}, - {"NiFpgaDll_CloseLlb", (NiFpga_FunctionPointer*)&NiFpga_closeLowLatencyBuffer, 0}, - {"NiFpgaDll_ClientFunctionCall", (NiFpga_FunctionPointer*)&NiFpga_clientFunctionCall, 0}, - {"NiFpgaDll_FindRegister", (NiFpga_FunctionPointer*)&NiFpga_findRegister, 0}, - {"NiFpgaDll_FindFifo", (NiFpga_FunctionPointer*)&NiFpga_findFifo, 0}, - {"NiFpgaDll_GetFpgaViState", (NiFpga_FunctionPointer*)&NiFpga_getFpgaViState, 0}, - {NULL, NULL, 0} -}; - -NiFpga_Status NiFpga_Initialize(void) -{ - /* if the library isn't already loaded */ - if (!NiFpga_library) - { - int i; - /* load the library */ - #if NiFpga_Windows - NiFpga_library = LoadLibraryA("NiFpga.dll"); - #elif NiFpga_Linux || NiFpga_MacOsX - #if NiFpga_Linux - const char* const library = "libNiFpga.so"; - #elif NiFpga_MacOsX - const char* const library = - "/Library/Frameworks/NiFpga.framework/NiFpga"; - #endif - NiFpga_library = dlopen(library, RTLD_LAZY); - if (!NiFpga_library) - fprintf(stderr, "Error opening %s: %s\n", library, dlerror()); - #else - #error - #endif - if (!NiFpga_library) - return NiFpga_Status_ResourceNotFound; - /* get each exported function */ - for (i = 0; NiFpga_functions[i].name; i++) - { - const char* const name = NiFpga_functions[i].name; - NiFpga_FunctionPointer* const address = NiFpga_functions[i].address; - #if NiFpga_Windows - *address = (NiFpga_FunctionPointer)GetProcAddress(NiFpga_library, - name); - if (!*address && NiFpga_functions[i].required) - return NiFpga_Status_VersionMismatch; - #elif NiFpga_Linux || NiFpga_MacOsX +static const struct { + const char* const name; + NiFpga_FunctionPointer* const address; + NiFpga_Bool required; +} NiFpga_functions[] = { + {"NiFpgaDll_Open", (NiFpga_FunctionPointer*)&NiFpga_open, 1}, + {"NiFpgaDll_Close", (NiFpga_FunctionPointer*)&NiFpga_close, 1}, + {"NiFpgaDll_Run", (NiFpga_FunctionPointer*)&NiFpga_run, 1}, + {"NiFpgaDll_Abort", (NiFpga_FunctionPointer*)&NiFpga_abort, 1}, + {"NiFpgaDll_Reset", (NiFpga_FunctionPointer*)&NiFpga_reset, 1}, + {"NiFpgaDll_Download", (NiFpga_FunctionPointer*)&NiFpga_download, 1}, + {"NiFpgaDll_ReadBool", (NiFpga_FunctionPointer*)&NiFpga_readBool, 1}, + {"NiFpgaDll_ReadI8", (NiFpga_FunctionPointer*)&NiFpga_readI8, 1}, + {"NiFpgaDll_ReadU8", (NiFpga_FunctionPointer*)&NiFpga_readU8, 1}, + {"NiFpgaDll_ReadI16", (NiFpga_FunctionPointer*)&NiFpga_readI16, 1}, + {"NiFpgaDll_ReadU16", (NiFpga_FunctionPointer*)&NiFpga_readU16, 1}, + {"NiFpgaDll_ReadI32", (NiFpga_FunctionPointer*)&NiFpga_readI32, 1}, + {"NiFpgaDll_ReadU32", (NiFpga_FunctionPointer*)&NiFpga_readU32, 1}, + {"NiFpgaDll_ReadI64", (NiFpga_FunctionPointer*)&NiFpga_readI64, 1}, + {"NiFpgaDll_ReadU64", (NiFpga_FunctionPointer*)&NiFpga_readU64, 1}, + {"NiFpgaDll_ReadSgl", (NiFpga_FunctionPointer*)&NiFpga_readSgl, 1}, + {"NiFpgaDll_ReadDbl", (NiFpga_FunctionPointer*)&NiFpga_readDbl, 1}, + {"NiFpgaDll_WriteBool", (NiFpga_FunctionPointer*)&NiFpga_writeBool, 1}, + {"NiFpgaDll_WriteI8", (NiFpga_FunctionPointer*)&NiFpga_writeI8, 1}, + {"NiFpgaDll_WriteU8", (NiFpga_FunctionPointer*)&NiFpga_writeU8, 1}, + {"NiFpgaDll_WriteI16", (NiFpga_FunctionPointer*)&NiFpga_writeI16, 1}, + {"NiFpgaDll_WriteU16", (NiFpga_FunctionPointer*)&NiFpga_writeU16, 1}, + {"NiFpgaDll_WriteI32", (NiFpga_FunctionPointer*)&NiFpga_writeI32, 1}, + {"NiFpgaDll_WriteU32", (NiFpga_FunctionPointer*)&NiFpga_writeU32, 1}, + {"NiFpgaDll_WriteI64", (NiFpga_FunctionPointer*)&NiFpga_writeI64, 1}, + {"NiFpgaDll_WriteU64", (NiFpga_FunctionPointer*)&NiFpga_writeU64, 1}, + {"NiFpgaDll_WriteSgl", (NiFpga_FunctionPointer*)&NiFpga_writeSgl, 1}, + {"NiFpgaDll_WriteDbl", (NiFpga_FunctionPointer*)&NiFpga_writeDbl, 1}, + {"NiFpgaDll_ReadArrayBool", (NiFpga_FunctionPointer*)&NiFpga_readArrayBool, 1}, + {"NiFpgaDll_ReadArrayI8", (NiFpga_FunctionPointer*)&NiFpga_readArrayI8, 1}, + {"NiFpgaDll_ReadArrayU8", (NiFpga_FunctionPointer*)&NiFpga_readArrayU8, 1}, + {"NiFpgaDll_ReadArrayI16", (NiFpga_FunctionPointer*)&NiFpga_readArrayI16, 1}, + {"NiFpgaDll_ReadArrayU16", (NiFpga_FunctionPointer*)&NiFpga_readArrayU16, 1}, + {"NiFpgaDll_ReadArrayI32", (NiFpga_FunctionPointer*)&NiFpga_readArrayI32, 1}, + {"NiFpgaDll_ReadArrayU32", (NiFpga_FunctionPointer*)&NiFpga_readArrayU32, 1}, + {"NiFpgaDll_ReadArrayI64", (NiFpga_FunctionPointer*)&NiFpga_readArrayI64, 1}, + {"NiFpgaDll_ReadArrayU64", (NiFpga_FunctionPointer*)&NiFpga_readArrayU64, 1}, + {"NiFpgaDll_ReadArraySgl", (NiFpga_FunctionPointer*)&NiFpga_readArraySgl, 1}, + {"NiFpgaDll_ReadArrayDbl", (NiFpga_FunctionPointer*)&NiFpga_readArrayDbl, 1}, + {"NiFpgaDll_WriteArrayBool", (NiFpga_FunctionPointer*)&NiFpga_writeArrayBool, 1}, + {"NiFpgaDll_WriteArrayI8", (NiFpga_FunctionPointer*)&NiFpga_writeArrayI8, 1}, + {"NiFpgaDll_WriteArrayU8", (NiFpga_FunctionPointer*)&NiFpga_writeArrayU8, 1}, + {"NiFpgaDll_WriteArrayI16", (NiFpga_FunctionPointer*)&NiFpga_writeArrayI16, 1}, + {"NiFpgaDll_WriteArrayU16", (NiFpga_FunctionPointer*)&NiFpga_writeArrayU16, 1}, + {"NiFpgaDll_WriteArrayI32", (NiFpga_FunctionPointer*)&NiFpga_writeArrayI32, 1}, + {"NiFpgaDll_WriteArrayU32", (NiFpga_FunctionPointer*)&NiFpga_writeArrayU32, 1}, + {"NiFpgaDll_WriteArrayI64", (NiFpga_FunctionPointer*)&NiFpga_writeArrayI64, 1}, + {"NiFpgaDll_WriteArrayU64", (NiFpga_FunctionPointer*)&NiFpga_writeArrayU64, 1}, + {"NiFpgaDll_WriteArraySgl", (NiFpga_FunctionPointer*)&NiFpga_writeArraySgl, 1}, + {"NiFpgaDll_WriteArrayDbl", (NiFpga_FunctionPointer*)&NiFpga_writeArrayDbl, 1}, + {"NiFpgaDll_ReserveIrqContext", (NiFpga_FunctionPointer*)&NiFpga_reserveIrqContext, 1}, + {"NiFpgaDll_UnreserveIrqContext", (NiFpga_FunctionPointer*)&NiFpga_unreserveIrqContext, 1}, + {"NiFpgaDll_WaitOnIrqs", (NiFpga_FunctionPointer*)&NiFpga_waitOnIrqs, 1}, + {"NiFpgaDll_AcknowledgeIrqs", (NiFpga_FunctionPointer*)&NiFpga_acknowledgeIrqs, 1}, + {"NiFpgaDll_ConfigureFifo", (NiFpga_FunctionPointer*)&NiFpga_configureFifo, 1}, + {"NiFpgaDll_ConfigureFifo2", (NiFpga_FunctionPointer*)&NiFpga_configureFifo2, 1}, + {"NiFpgaDll_SetFifoPropertyU32", (NiFpga_FunctionPointer*)&NiFpga_setFifoPropertyU32, 0}, + {"NiFpgaDll_SetFifoPropertyI32", (NiFpga_FunctionPointer*)&NiFpga_setFifoPropertyI32, 0}, + {"NiFpgaDll_SetFifoPropertyU64", (NiFpga_FunctionPointer*)&NiFpga_setFifoPropertyU64, 0}, + {"NiFpgaDll_SetFifoPropertyI64", (NiFpga_FunctionPointer*)&NiFpga_setFifoPropertyI64, 0}, + {"NiFpgaDll_SetFifoPropertyPtr", (NiFpga_FunctionPointer*)&NiFpga_setFifoPropertyPtr, 0}, + {"NiFpgaDll_GetFifoPropertyU32", (NiFpga_FunctionPointer*)&NiFpga_getFifoPropertyU32, 0}, + {"NiFpgaDll_GetFifoPropertyI32", (NiFpga_FunctionPointer*)&NiFpga_getFifoPropertyI32, 0}, + {"NiFpgaDll_GetFifoPropertyU64", (NiFpga_FunctionPointer*)&NiFpga_getFifoPropertyU64, 0}, + {"NiFpgaDll_GetFifoPropertyI64", (NiFpga_FunctionPointer*)&NiFpga_getFifoPropertyI64, 0}, + {"NiFpgaDll_GetFifoPropertyPtr", (NiFpga_FunctionPointer*)&NiFpga_getFifoPropertyPtr, 0}, + {"NiFpgaDll_CommitFifoConfiguration", (NiFpga_FunctionPointer*)&NiFpga_commitFifoConfiguration, 0}, + {"NiFpgaDll_StartFifo", (NiFpga_FunctionPointer*)&NiFpga_startFifo, 1}, + {"NiFpgaDll_StopFifo", (NiFpga_FunctionPointer*)&NiFpga_stopFifo, 1}, + {"NiFpgaDll_UnreserveFifo", (NiFpga_FunctionPointer*)&NiFpga_unreserveFifo, 0}, + {"NiFpgaDll_ReadFifoBool", (NiFpga_FunctionPointer*)&NiFpga_readFifoBool, 1}, + {"NiFpgaDll_ReadFifoI8", (NiFpga_FunctionPointer*)&NiFpga_readFifoI8, 1}, + {"NiFpgaDll_ReadFifoU8", (NiFpga_FunctionPointer*)&NiFpga_readFifoU8, 1}, + {"NiFpgaDll_ReadFifoI16", (NiFpga_FunctionPointer*)&NiFpga_readFifoI16, 1}, + {"NiFpgaDll_ReadFifoU16", (NiFpga_FunctionPointer*)&NiFpga_readFifoU16, 1}, + {"NiFpgaDll_ReadFifoI32", (NiFpga_FunctionPointer*)&NiFpga_readFifoI32, 1}, + {"NiFpgaDll_ReadFifoU32", (NiFpga_FunctionPointer*)&NiFpga_readFifoU32, 1}, + {"NiFpgaDll_ReadFifoI64", (NiFpga_FunctionPointer*)&NiFpga_readFifoI64, 1}, + {"NiFpgaDll_ReadFifoU64", (NiFpga_FunctionPointer*)&NiFpga_readFifoU64, 1}, + {"NiFpgaDll_ReadFifoSgl", (NiFpga_FunctionPointer*)&NiFpga_readFifoSgl, 1}, + {"NiFpgaDll_ReadFifoDbl", (NiFpga_FunctionPointer*)&NiFpga_readFifoDbl, 1}, + {"NiFpgaDll_ReadFifoComposite", (NiFpga_FunctionPointer*)&NiFpga_readFifoComposite, 0}, + {"NiFpgaDll_WriteFifoBool", (NiFpga_FunctionPointer*)&NiFpga_writeFifoBool, 1}, + {"NiFpgaDll_WriteFifoI8", (NiFpga_FunctionPointer*)&NiFpga_writeFifoI8, 1}, + {"NiFpgaDll_WriteFifoU8", (NiFpga_FunctionPointer*)&NiFpga_writeFifoU8, 1}, + {"NiFpgaDll_WriteFifoI16", (NiFpga_FunctionPointer*)&NiFpga_writeFifoI16, 1}, + {"NiFpgaDll_WriteFifoU16", (NiFpga_FunctionPointer*)&NiFpga_writeFifoU16, 1}, + {"NiFpgaDll_WriteFifoI32", (NiFpga_FunctionPointer*)&NiFpga_writeFifoI32, 1}, + {"NiFpgaDll_WriteFifoU32", (NiFpga_FunctionPointer*)&NiFpga_writeFifoU32, 1}, + {"NiFpgaDll_WriteFifoI64", (NiFpga_FunctionPointer*)&NiFpga_writeFifoI64, 1}, + {"NiFpgaDll_WriteFifoU64", (NiFpga_FunctionPointer*)&NiFpga_writeFifoU64, 1}, + {"NiFpgaDll_WriteFifoSgl", (NiFpga_FunctionPointer*)&NiFpga_writeFifoSgl, 1}, + {"NiFpgaDll_WriteFifoDbl", (NiFpga_FunctionPointer*)&NiFpga_writeFifoDbl, 1}, + {"NiFpgaDll_WriteFifoComposite", (NiFpga_FunctionPointer*)&NiFpga_writeFifoComposite, 0}, + {"NiFpgaDll_AcquireFifoReadElementsBool", + (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsBool, 1}, + {"NiFpgaDll_AcquireFifoReadElementsI8", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsI8, + 1}, + {"NiFpgaDll_AcquireFifoReadElementsU8", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsU8, + 1}, + {"NiFpgaDll_AcquireFifoReadElementsI16", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsI16, + 1}, + {"NiFpgaDll_AcquireFifoReadElementsU16", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsU16, + 1}, + {"NiFpgaDll_AcquireFifoReadElementsI32", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsI32, + 1}, + {"NiFpgaDll_AcquireFifoReadElementsU32", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsU32, + 1}, + {"NiFpgaDll_AcquireFifoReadElementsI64", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsI64, + 1}, + {"NiFpgaDll_AcquireFifoReadElementsU64", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsU64, + 1}, + {"NiFpgaDll_AcquireFifoReadElementsSgl", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsSgl, + 1}, + {"NiFpgaDll_AcquireFifoReadElementsDbl", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoReadElementsDbl, + 1}, + {"NiFpgaDll_AcquireFifoWriteElementsBool", + (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsBool, 1}, + {"NiFpgaDll_AcquireFifoWriteElementsI8", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsI8, + 1}, + {"NiFpgaDll_AcquireFifoWriteElementsU8", (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsU8, + 1}, + {"NiFpgaDll_AcquireFifoWriteElementsI16", + (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsI16, 1}, + {"NiFpgaDll_AcquireFifoWriteElementsU16", + (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsU16, 1}, + {"NiFpgaDll_AcquireFifoWriteElementsI32", + (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsI32, 1}, + {"NiFpgaDll_AcquireFifoWriteElementsU32", + (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsU32, 1}, + {"NiFpgaDll_AcquireFifoWriteElementsI64", + (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsI64, 1}, + {"NiFpgaDll_AcquireFifoWriteElementsU64", + (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsU64, 1}, + {"NiFpgaDll_AcquireFifoWriteElementsSgl", + (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsSgl, 1}, + {"NiFpgaDll_AcquireFifoWriteElementsDbl", + (NiFpga_FunctionPointer*)&NiFpga_acquireFifoWriteElementsDbl, 1}, + {"NiFpgaDll_ReleaseFifoElements", (NiFpga_FunctionPointer*)&NiFpga_releaseFifoElements, 1}, + {"NiFpgaDll_GetPeerToPeerFifoEndpoint", (NiFpga_FunctionPointer*)&NiFpga_getPeerToPeerFifoEndpoint, + 1}, + {"NiFpgaDll_MapP2PSinkFifo", (NiFpga_FunctionPointer*)&NiFpga_mapP2PSinkFifo, 0}, + {"NiFpgaDll_UnmapP2PSinkFifo", (NiFpga_FunctionPointer*)&NiFpga_unmapP2PSinkFifo, 0}, + {"NiFpgaDll_GetBitfileContents", (NiFpga_FunctionPointer*)&NiFpga_getBitfileContents, 1}, + {"NiFpgaDll_FindRegisterPrivate", (NiFpga_FunctionPointer*)&NiFpga_findRegisterPrivate, 0}, + {"NiFpgaDll_FindFifoPrivate", (NiFpga_FunctionPointer*)&NiFpga_findFifoPrivate, 0}, + {"NiFpgaDll_OpenHmb", (NiFpga_FunctionPointer*)&NiFpga_openHostMemoryBuffer, 0}, + {"NiFpgaDll_CloseHmb", (NiFpga_FunctionPointer*)&NiFpga_closeHostMemoryBuffer, 0}, + {"NiFpgaDll_OpenLlb", (NiFpga_FunctionPointer*)&NiFpga_openLowLatencyBuffer, 0}, + {"NiFpgaDll_CloseLlb", (NiFpga_FunctionPointer*)&NiFpga_closeLowLatencyBuffer, 0}, + {"NiFpgaDll_ClientFunctionCall", (NiFpga_FunctionPointer*)&NiFpga_clientFunctionCall, 0}, + {"NiFpgaDll_FindRegister", (NiFpga_FunctionPointer*)&NiFpga_findRegister, 0}, + {"NiFpgaDll_FindFifo", (NiFpga_FunctionPointer*)&NiFpga_findFifo, 0}, + {"NiFpgaDll_GetFpgaViState", (NiFpga_FunctionPointer*)&NiFpga_getFpgaViState, 0}, + {NULL, NULL, 0}}; + +NiFpga_Status NiFpga_Initialize(void) { + /* if the library isn't already loaded */ + if (!NiFpga_library) { + int i; +/* load the library */ +#if NiFpga_Windows + NiFpga_library = LoadLibraryA("NiFpga.dll"); +#elif NiFpga_Linux || NiFpga_MacOsX +#if NiFpga_Linux + const char* const library = "libNiFpga.so"; +#elif NiFpga_MacOsX + const char* const library = "/Library/Frameworks/NiFpga.framework/NiFpga"; +#endif + NiFpga_library = dlopen(library, RTLD_LAZY); + if (!NiFpga_library) fprintf(stderr, "Error opening %s: %s\n", library, dlerror()); +#else +#error +#endif + if (!NiFpga_library) return NiFpga_Status_ResourceNotFound; + /* get each exported function */ + for (i = 0; NiFpga_functions[i].name; i++) { + const char* const name = NiFpga_functions[i].name; + NiFpga_FunctionPointer* const address = NiFpga_functions[i].address; +#if NiFpga_Windows + *address = (NiFpga_FunctionPointer)GetProcAddress(NiFpga_library, name); + if (!*address && NiFpga_functions[i].required) return NiFpga_Status_VersionMismatch; +#elif NiFpga_Linux || NiFpga_MacOsX *address = (NiFpga_FunctionPointer)dlsym(NiFpga_library, name); - if (!*address && NiFpga_functions[i].required) - return NiFpga_Status_VersionMismatch; - #else - #error - #endif - } - /* enable CVI Resource Tracking, if available */ - #if NiFpga_CviResourceTracking - { - HMODULE engine = GetModuleHandle("cvirte.dll"); - if (!engine) - engine = GetModuleHandle("cvi_lvrt.dll"); - if (!engine) - engine = GetModuleHandle("instrsup.dll"); - if (engine) - { - NiFpga_acquireCviResource = - (NiFpga_AcquireCviResource) - GetProcAddress(engine, "__CVI_Resource_Acquire"); - NiFpga_releaseCviResource = - (NiFpga_ReleaseCviResource) - GetProcAddress(engine, "__CVI_Resource_Release"); - if (!NiFpga_acquireCviResource - || !NiFpga_releaseCviResource) - { - NiFpga_acquireCviResource = NULL; - NiFpga_releaseCviResource = NULL; + if (!*address && NiFpga_functions[i].required) return NiFpga_Status_VersionMismatch; +#else +#error +#endif + } +/* enable CVI Resource Tracking, if available */ +#if NiFpga_CviResourceTracking + { + HMODULE engine = GetModuleHandle("cvirte.dll"); + if (!engine) engine = GetModuleHandle("cvi_lvrt.dll"); + if (!engine) engine = GetModuleHandle("instrsup.dll"); + if (engine) { + NiFpga_acquireCviResource = + (NiFpga_AcquireCviResource)GetProcAddress(engine, "__CVI_Resource_Acquire"); + NiFpga_releaseCviResource = + (NiFpga_ReleaseCviResource)GetProcAddress(engine, "__CVI_Resource_Release"); + if (!NiFpga_acquireCviResource || !NiFpga_releaseCviResource) { + NiFpga_acquireCviResource = NULL; + NiFpga_releaseCviResource = NULL; + } } - } - } - #endif - } - return NiFpga_Status_Success; -} - -NiFpga_Status NiFpga_Finalize(void) -{ - /* if the library is currently loaded */ - if (NiFpga_library) - { - int i; - NiFpga_Status status = NiFpga_Status_Success; - /* unload the library */ - #if NiFpga_Windows - if (!FreeLibrary(NiFpga_library)) - status = NiFpga_Status_ResourceNotInitialized; - #elif NiFpga_Linux || NiFpga_MacOsX - if (dlclose(NiFpga_library)) - status = NiFpga_Status_ResourceNotInitialized; - #else - #error - #endif - /* null out the library and each exported function */ - NiFpga_library = NULL; - for (i = 0; NiFpga_functions[i].name; i++) - *NiFpga_functions[i].address = NULL; - /* null out the CVI Resource Tracking functions */ - #if NiFpga_CviResourceTracking - NiFpga_acquireCviResource = NULL; - NiFpga_releaseCviResource = NULL; - #endif - return status; - } - else - return NiFpga_Status_ResourceNotInitialized; + } +#endif + } + return NiFpga_Status_Success; +} + +NiFpga_Status NiFpga_Finalize(void) { + /* if the library is currently loaded */ + if (NiFpga_library) { + int i; + NiFpga_Status status = NiFpga_Status_Success; +/* unload the library */ +#if NiFpga_Windows + if (!FreeLibrary(NiFpga_library)) status = NiFpga_Status_ResourceNotInitialized; +#elif NiFpga_Linux || NiFpga_MacOsX + if (dlclose(NiFpga_library)) status = NiFpga_Status_ResourceNotInitialized; +#else +#error +#endif + /* null out the library and each exported function */ + NiFpga_library = NULL; + for (i = 0; NiFpga_functions[i].name; i++) *NiFpga_functions[i].address = NULL; +/* null out the CVI Resource Tracking functions */ +#if NiFpga_CviResourceTracking + NiFpga_acquireCviResource = NULL; + NiFpga_releaseCviResource = NULL; +#endif + return status; + } else + return NiFpga_Status_ResourceNotInitialized; } diff --git a/src/NiFpga/NiFpga.h b/src/NiFpga/NiFpga.h index 59842f1..437e64d 100644 --- a/src/NiFpga/NiFpga.h +++ b/src/NiFpga/NiFpga.h @@ -6,198 +6,143 @@ * All rights reserved. */ - #ifndef __NiFpga_h__ #define __NiFpga_h__ /* * Determine platform details. */ -#if defined(_M_IX86) \ - || defined(_M_X64) \ - || defined(_M_AMD64) \ - || defined(i386) \ - || defined(__i386) \ - || defined(__i386__) \ - || defined(__i486__) \ - || defined(__i586__) \ - || defined(__i686__) \ - || defined(__amd64__) \ - || defined(__amd64) \ - || defined(__x86_64__) \ - || defined(__x86_64) \ - || defined(__IA32__) \ - || defined(_X86_) \ - || defined(__THW_INTEL__) \ - || defined(__I86__) \ - || defined(__INTEL__) \ - || defined(__X86__) \ - || defined(__386__) \ - || defined(__I86__) \ - || defined(M_I386) \ - || defined(M_I86) \ - || defined(_M_I386) \ - || defined(_M_I86) - #if defined(_WIN32) \ - || defined(_WIN64) \ - || defined(__WIN32__) \ - || defined(__TOS_WIN__) \ - || defined(__WINDOWS__) \ - || defined(_WINDOWS) \ - || defined(__WINDOWS_386__) \ - || defined(__CYGWIN__) - /* Either Windows or Phar Lap ETS. */ - #define NiFpga_Windows 1 - #elif defined(__linux__) \ - || defined(__linux) \ - || defined(linux) \ - || defined(__gnu_linux__) - #define NiFpga_Linux 1 - #elif defined(__APPLE__) && defined(__MACH__) - #define NiFpga_MacOsX 1 - #else - #error Unsupported OS. - #endif -#elif defined(__powerpc) \ - || defined(__powerpc__) \ - || defined(__POWERPC__) \ - || defined(__ppc__) \ - || defined(__PPC) \ - || defined(_M_PPC) \ - || defined(_ARCH_PPC) \ - || defined(__PPC__) \ - || defined(__ppc) - #if defined(__vxworks) - #define NiFpga_VxWorks 1 - #error VxWorks is no longer supported by the FPGA Interface C API - #else - #error Unsupported OS. - #endif -#elif defined(__arm__) \ - || defined(__thumb__) \ - || defined(__TARGET_ARCH_ARM) \ - || defined(__TARGET_ARCH_THUMB) \ - || defined(_ARM) \ - || defined(_M_ARM) \ - || defined(_M_ARMT) -#if defined(__linux__) \ - || defined(__linux) \ - || defined(linux) \ - || defined(__gnu_linux__) - #define NiFpga_Linux 1 +#if defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) || defined(i386) || defined(__i386) || \ + defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || \ + defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || \ + defined(__IA32__) || defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) || \ + defined(__INTEL__) || defined(__X86__) || defined(__386__) || defined(__I86__) || defined(M_I386) || \ + defined(M_I86) || defined(_M_I386) || defined(_M_I86) +#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || \ + defined(__WINDOWS__) || defined(_WINDOWS) || defined(__WINDOWS_386__) || defined(__CYGWIN__) +/* Either Windows or Phar Lap ETS. */ +#define NiFpga_Windows 1 +#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__) +#define NiFpga_Linux 1 +#elif defined(__APPLE__) && defined(__MACH__) +#define NiFpga_MacOsX 1 #else - #error Unsupported OS. - #endif +#error Unsupported OS. +#endif +#elif defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) || defined(__ppc__) || \ + defined(__PPC) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(__PPC__) || defined(__ppc) +#if defined(__vxworks) +#define NiFpga_VxWorks 1 +#error VxWorks is no longer supported by the FPGA Interface C API #else - #error Unsupported architecture. +#error Unsupported OS. +#endif +#elif defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) || \ + defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) || defined(_M_ARMT) +#if defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__) +#define NiFpga_Linux 1 +#else +#error Unsupported OS. +#endif +#else +#error Unsupported architecture. #endif /* * Determine compiler. */ #if defined(_MSC_VER) - #define NiFpga_Msvc 1 +#define NiFpga_Msvc 1 #elif defined(__GNUC__) - #define NiFpga_Gcc 1 +#define NiFpga_Gcc 1 #elif defined(_CVI_) && !defined(_TPC_) - #define NiFpga_Cvi 1 - /* Enables CVI Library Protection Errors. */ - #pragma EnableLibraryRuntimeChecking +#define NiFpga_Cvi 1 +/* Enables CVI Library Protection Errors. */ +#pragma EnableLibraryRuntimeChecking #else - /* Unknown compiler. */ +/* Unknown compiler. */ #endif /* * Determine compliance with different C/C++ language standards. */ #if defined(__cplusplus) - #define NiFpga_Cpp 1 - #if __cplusplus >= 199707L - #define NiFpga_Cpp98 1 - #if __cplusplus >= 201103L - #define NiFpga_Cpp11 1 - #endif - #endif +#define NiFpga_Cpp 1 +#if __cplusplus >= 199707L +#define NiFpga_Cpp98 1 +#if __cplusplus >= 201103L +#define NiFpga_Cpp11 1 +#endif +#endif #endif #if defined(__STDC__) - #define NiFpga_C89 1 - #if defined(__STDC_VERSION__) - #define NiFpga_C90 1 - #if __STDC_VERSION__ >= 199409L - #define NiFpga_C94 1 - #if __STDC_VERSION__ >= 199901L - #define NiFpga_C99 1 - #if __STDC_VERSION__ >= 201112L - #define NiFpga_C11 1 - #endif - #endif - #endif - #endif +#define NiFpga_C89 1 +#if defined(__STDC_VERSION__) +#define NiFpga_C90 1 +#if __STDC_VERSION__ >= 199409L +#define NiFpga_C94 1 +#if __STDC_VERSION__ >= 199901L +#define NiFpga_C99 1 +#if __STDC_VERSION__ >= 201112L +#define NiFpga_C11 1 +#endif +#endif +#endif +#endif #endif /* * Determine ability to inline functions. */ #if NiFpga_Cpp || NiFpga_C99 - /* The inline keyword exists in C++ and C99. */ - #define NiFpga_Inline inline +/* The inline keyword exists in C++ and C99. */ +#define NiFpga_Inline inline #elif NiFpga_Msvc - /* Visual C++ (at least since 6.0) also supports an alternate keyword. */ - #define NiFpga_Inline __inline +/* Visual C++ (at least since 6.0) also supports an alternate keyword. */ +#define NiFpga_Inline __inline #elif NiFpga_Gcc - /* GCC (at least since 2.95.2) also supports an alternate keyword. */ - #define NiFpga_Inline __inline__ +/* GCC (at least since 2.95.2) also supports an alternate keyword. */ +#define NiFpga_Inline __inline__ #elif !defined(NiFpga_Inline) - /* - * Disable inlining if inline support is unknown. To manually enable - * inlining, #define the following macro before #including NiFpga.h: - * - * #define NiFpga_Inline inline - */ - #define NiFpga_Inline +/* + * Disable inlining if inline support is unknown. To manually enable + * inlining, #define the following macro before #including NiFpga.h: + * + * #define NiFpga_Inline inline + */ +#define NiFpga_Inline #endif /* * Define exact-width integer types, if they have not already been defined. */ -#if NiFpga_ExactWidthIntegerTypesDefined \ - || defined(_STDINT) \ - || defined(_STDINT_H) \ - || defined(_STDINT_H_) \ - || defined(_INTTYPES_H) \ - || defined(_INTTYPES_H_) \ - || defined(_SYS_STDINT_H) \ - || defined(_SYS_STDINT_H_) \ - || defined(_SYS_INTTYPES_H) \ - || defined(_SYS_INTTYPES_H_) \ - || defined(_STDINT_H_INCLUDED) \ - || defined(_MSC_STDINT_H_) \ - || defined(_PSTDINT_H_INCLUDED) - /* Assume that exact-width integer types have already been defined. */ -#elif NiFpga_C99 \ - || NiFpga_Gcc /* GCC (at least since 3.0) has a stdint.h. */ \ - || defined(HAVE_STDINT_H) - /* Assume that stdint.h can be included. */ - #include -#elif NiFpga_Msvc \ - || NiFpga_Cvi - /* Manually define exact-width integer types. */ - typedef signed char int8_t; - typedef unsigned char uint8_t; - typedef short int16_t; - typedef unsigned short uint16_t; - typedef int int32_t; - typedef unsigned int uint32_t; - typedef __int64 int64_t; - typedef unsigned __int64 uint64_t; +#if NiFpga_ExactWidthIntegerTypesDefined || defined(_STDINT) || defined(_STDINT_H) || defined(_STDINT_H_) || \ + defined(_INTTYPES_H) || defined(_INTTYPES_H_) || defined(_SYS_STDINT_H) || \ + defined(_SYS_STDINT_H_) || defined(_SYS_INTTYPES_H) || defined(_SYS_INTTYPES_H_) || \ + defined(_STDINT_H_INCLUDED) || defined(_MSC_STDINT_H_) || defined(_PSTDINT_H_INCLUDED) +/* Assume that exact-width integer types have already been defined. */ +#elif NiFpga_C99 || NiFpga_Gcc /* GCC (at least since 3.0) has a stdint.h. */ \ + || defined(HAVE_STDINT_H) +/* Assume that stdint.h can be included. */ +#include +#elif NiFpga_Msvc || NiFpga_Cvi +/* Manually define exact-width integer types. */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; #else - /* - * Exact-width integer types must be defined by the user, and the following - * macro must be #defined, before #including NiFpga.h: - * - * #define NiFpga_ExactWidthIntegerTypesDefined 1 - */ - #error Exact-width integer types must be defined by the user. See comment. +/* + * Exact-width integer types must be defined by the user, and the following + * macro must be #defined, before #including NiFpga.h: + * + * #define NiFpga_ExactWidthIntegerTypesDefined 1 + */ +#error Exact-width integer types must be defined by the user. See comment. #endif /* Included for definition of size_t. */ @@ -208,8 +153,7 @@ #include #if NiFpga_Cpp -extern "C" -{ +extern "C" { #endif /** @@ -451,387 +395,449 @@ static const NiFpga_Status NiFpga_Status_CloseAndResetCalledWithResetNotSupporte * An unexpected internal error occurred. */ static const NiFpga_Status NiFpga_Status_InternalError = -61499; - + /** * DMA from host to FPGA target is not supported for this remote system. Use - * another method for I/O or change the controller associated with the FPGA + * another method for I/O or + * change the controller associated with the FPGA * target. - */ -static const NiFpga_Status NiFpga_Status_DmaOutputNotSupported = -63001; - + */ +static const NiFpga_Status NiFpga_Status_DmaOutputNotSupported = -63001; + /** * The specified DMA FIFO depth is greater than the maximum size supported by * this system. - */ -static const NiFpga_Status NiFpga_Status_DmaFifoDepthNotSupported = -63002; - + */ +static const NiFpga_Status NiFpga_Status_DmaFifoDepthNotSupported = -63002; + /** * The NI-RIO driver was unable to allocate memory for a FIFO. This can happen - * when the combined depth of all DMA FIFOs exceeds the maximum depth for the - * controller, or when the controller runs out of system memory. You may be able + * when the combined depth + * of all DMA FIFOs exceeds the maximum depth for the + * controller, or when the controller runs out of system + * memory. You may be able * to reconfigure the controller with a greater maximum FIFO depth. For more + * * information, refer to the NI KnowledgeBase article 65OF2ERQ. - */ -static const NiFpga_Status NiFpga_Status_TotalDmaFifoDepthExceeded = -63003; - + */ +static const NiFpga_Status NiFpga_Status_TotalDmaFifoDepthExceeded = -63003; + /** * Operation failed due to device reconfiguration. Multiple sessions to FPGA - * devices are not supported. Close the other session and retry this operation. - */ -static const NiFpga_Status NiFpga_Status_DeviceReconfigured = -63030; - + * devices are not supported. + * Close the other session and retry this operation. + */ +static const NiFpga_Status NiFpga_Status_DeviceReconfigured = -63030; + /** * The operation could not be completed because another session is accessing the - * device. Close all other sessions and retry. - */ -static const NiFpga_Status NiFpga_Status_DeviceInvariant = -63031; - + * device. Close all + * other sessions and retry. + */ +static const NiFpga_Status NiFpga_Status_DeviceInvariant = -63031; + /** * Access to the remote system was denied. If you are trying to connect to an RT - * target, use MAX to check the Remote Device Access settings under - * Software>>[Recommended software set, such as "NI CompactRIO version - + * target, use MAX to + * check the Remote Device Access settings under + * Software>>[Recommended software set, such as "NI + * CompactRIO version - * date"]>>NI-RIO>>NI-RIO Settings on the remote system. If you are trying to + * * connect to a desktop Linux target, check the settings in - * /etc/natinst/nirio/nirio.ini on the Linux target. - */ -static const NiFpga_Status NiFpga_Status_AccessDenied = -63033; - + * /etc/natinst/nirio/nirio.ini on the Linux + * target. + */ +static const NiFpga_Status NiFpga_Status_AccessDenied = -63033; + /** * The attempt to open a RIO session failed because the driver was not yet * initialized. - */ -static const NiFpga_Status NiFpga_Status_DriverNotInitialized = -63035; - + */ +static const NiFpga_Status NiFpga_Status_DriverNotInitialized = -63035; + /** * The operation could not be completed because the device being accessed was - * unavailable, either because it was disconnected from the network or because - * power was removed (e.g., the system went into a low-power state). Close any - * RIO FPGA sessions; check network, USB, and power connections; power-cycle the + * unavailable, either + * because it was disconnected from the network or because + * power was removed (e.g., the system went into a + * low-power state). Close any + * RIO FPGA sessions; check network, USB, and power connections; power-cycle + * the * device if necessary; and open a new RIO session. - */ -static const NiFpga_Status NiFpga_Status_ResourceRemoved = -63036; - + */ +static const NiFpga_Status NiFpga_Status_ResourceRemoved = -63036; + /** * The NI-RIO software on the host is not compatible with the software on the - * target. Upgrade the NI-RIO software on the host in order to connect to this + * target. Upgrade the + * NI-RIO software on the host in order to connect to this * target. - */ -static const NiFpga_Status NiFpga_Status_HostVersionMismatch = -63038; - + */ +static const NiFpga_Status NiFpga_Status_HostVersionMismatch = -63038; + /** * A connection could not be established to the specified remote device. Ensure - * that the device is on and accessible over the network, that the device is not - * in safe mode, that NI-RIO software is installed, and that the RIO server is + * that the device is on + * and accessible over the network, that the device is not + * in safe mode, that NI-RIO software is installed, + * and that the RIO server is * running and properly configured. Refer to Software>>NI-RIO>>NI-RIO Settings - * under the system in MAX. - */ -static const NiFpga_Status NiFpga_Status_RpcConnectionError = -63040; - + + * * under the system in MAX. + */ +static const NiFpga_Status NiFpga_Status_RpcConnectionError = -63040; + /** * The connection to the remote device has been lost due to an error on the - * remote device. Retry the operation. If the remote device continues to report - * this error, check its power supply and look for diagnostic messages on the + * remote device. Retry the + * operation. If the remote device continues to report + * this error, check its power supply and look for + * diagnostic messages on the * console. - */ -static const NiFpga_Status NiFpga_Status_RpcServerError = -63041; - + */ +static const NiFpga_Status NiFpga_Status_RpcServerError = -63041; + /** * A fault on the network caused the operation to fail. - */ -static const NiFpga_Status NiFpga_Status_NetworkFault = -63042; - + */ +static const NiFpga_Status NiFpga_Status_NetworkFault = -63042; + /** * The session is invalid. The target may have been reset or rebooted, or the - * network connection may have timed out because of processor overuse. Check the - * network connection, reduce the demand on the processor, and decrease the + * network connection may + * have timed out because of processor overuse. Check the + * network connection, reduce the demand on the + * processor, and decrease the * timeout of the operation that failed. If the problem persists, visit + * * ni.com/info and enter the Info Code expd6p. - */ -static const NiFpga_Status NiFpga_Status_RpcSessionError = -63043; - + */ +static const NiFpga_Status NiFpga_Status_RpcSessionError = -63043; + /** * The RIO server could not be found on the specified remote device. Ensure that - * NI-RIO software is installed and that the RIO server is running and properly - * configured. Refer to Software>>NI-RIO>>NI-RIO Settings under the system in + * NI-RIO software is + * installed and that the RIO server is running and properly + * configured. Refer to Software>>NI-RIO>>NI-RIO + * Settings under the system in * MAX. - */ -static const NiFpga_Status NiFpga_Status_RpcServerMissing = -63044; - + */ +static const NiFpga_Status NiFpga_Status_RpcServerMissing = -63044; + /** * The requested feature is not supported when using a remote RIO session. - * Opening a remote RIO session occurs when the resource string is specified as - * rio://hostname/device_name. A local session can be opened by specifying just + * Opening a remote RIO session + * occurs when the resource string is specified as + * rio://hostname/device_name. A local session can be + * opened by specifying just * the device_name. - */ -static const NiFpga_Status NiFpga_Status_FeatureNotSupportedOverRpc = -63045; - + */ +static const NiFpga_Status NiFpga_Status_FeatureNotSupportedOverRpc = -63045; + /** * The specified trigger line is already reserved. Consult the MAX Trigger - * settings or the trigger reservations for each device within the system. - */ -static const NiFpga_Status NiFpga_Status_TriggerReserved = -63050; - + * settings or the trigger + * reservations for each device within the system. + */ +static const NiFpga_Status NiFpga_Status_TriggerReserved = -63050; + /** * The specified trigger line is not reserved in the current session. - */ -static const NiFpga_Status NiFpga_Status_TriggerNotReserved = -63051; - + */ +static const NiFpga_Status NiFpga_Status_TriggerNotReserved = -63051; + /** * Trigger lines are not supported or enabled. For PXI, identify the controller * and chassis using MAX. - */ -static const NiFpga_Status NiFpga_Status_TriggerNotSupported = -63052; - + + */ +static const NiFpga_Status NiFpga_Status_TriggerNotSupported = -63052; + /** * The specified event type is invalid. - */ -static const NiFpga_Status NiFpga_Status_EventInvalid = -63070; - + */ +static const NiFpga_Status NiFpga_Status_EventInvalid = -63070; + /** * The specified RIO event has already been enabled for this session. - */ -static const NiFpga_Status NiFpga_Status_EventEnabled = -63071; - + */ +static const NiFpga_Status NiFpga_Status_EventEnabled = -63071; + /** * The specified RIO event has not been enabled for this session. Attempting a - * Wait on IRQ after an Abort causes this error. - */ -static const NiFpga_Status NiFpga_Status_EventNotEnabled = -63072; - + * Wait on IRQ after an + * Abort causes this error. + */ +static const NiFpga_Status NiFpga_Status_EventNotEnabled = -63072; + /** * The specified event did not occur within the specified time period, in - * milliseconds. Extend the time period, or ignore if the result was expected. - */ -static const NiFpga_Status NiFpga_Status_EventTimedOut = -63073; - + * milliseconds. Extend the time + * period, or ignore if the result was expected. + */ +static const NiFpga_Status NiFpga_Status_EventTimedOut = -63073; + /** * The allocated buffer is too small. - */ -static const NiFpga_Status NiFpga_Status_BufferInvalidSize = -63080; - + */ +static const NiFpga_Status NiFpga_Status_BufferInvalidSize = -63080; + /** * The caller did not allocate a memory buffer. - */ -static const NiFpga_Status NiFpga_Status_BufferNotAllocated = -63081; - + */ +static const NiFpga_Status NiFpga_Status_BufferNotAllocated = -63081; + /** * The operation could not complete because another session is accessing the - * FIFO. Close the other session and retry. - */ -static const NiFpga_Status NiFpga_Status_FifoReserved = -63082; - + * FIFO. Close the other + * session and retry. + */ +static const NiFpga_Status NiFpga_Status_FifoReserved = -63082; + /** * A Configure FIFO, Stop FIFO, Read FIFO, or Write FIFO function was called - * while the host had acquired elements of the FIFO. Release all acquired - * elements before configuring, stopping, reading, or writing. - */ -static const NiFpga_Status NiFpga_Status_FifoElementsCurrentlyAcquired = -63083; - + * while the host had + * acquired elements of the FIFO. Release all acquired + * elements before configuring, stopping, reading, or + * writing. + */ +static const NiFpga_Status NiFpga_Status_FifoElementsCurrentlyAcquired = -63083; + /** * A function was called using a misaligned address. The address must be a - * multiple of the size of the datatype. - */ -static const NiFpga_Status NiFpga_Status_MisalignedAccess = -63084; - + * multiple of the size of the + * datatype. + */ +static const NiFpga_Status NiFpga_Status_MisalignedAccess = -63084; + /** * The FPGA Read/Write Control Function is accessing a control or indicator with - * data that exceeds the maximum size supported on the current target. Refer to - * the hardware documentation for the limitations on data types for this target. - */ -static const NiFpga_Status NiFpga_Status_ControlOrIndicatorTooLarge = -63085; - + * data that exceeds the + * maximum size supported on the current target. Refer to + * the hardware documentation for the limitations on + * data types for this target. + */ +static const NiFpga_Status NiFpga_Status_ControlOrIndicatorTooLarge = -63085; + /** * The FIFO function called cannot be used while the FIFO is running. To use - * this function, ensure the FIFO is stopped. - */ -static const NiFpga_Status NiFpga_Status_OperationNotSupportedWhileStarted = -63086; - + * this function, ensure the + * FIFO is stopped. + */ +static const NiFpga_Status NiFpga_Status_OperationNotSupportedWhileStarted = -63086; + /** * The function called does not match the datatype of the specified property. - * Ensure you are calling the correct function for the property. - */ -static const NiFpga_Status NiFpga_Status_TypesDoNotMatch = -63087; - + * Ensure you are calling + * the correct function for the property. + */ +static const NiFpga_Status NiFpga_Status_TypesDoNotMatch = -63087; + /** * Cannot acquire more regions from the selected FIFO. Release some regions and * try again. - */ -static const NiFpga_Status NiFpga_Status_OutOfFifoRegions = -63088; - + */ +static const NiFpga_Status NiFpga_Status_OutOfFifoRegions = -63088; + /** * A valid .lvbitx bitfile is required. If you are using a vaild .lvbitx - * bitfile, the bitfile may not be compatible with the software you are using. - * Determine which version of LabVIEW was used to make the bitfile, update your + * bitfile, the bitfile may not + * be compatible with the software you are using. + * Determine which version of LabVIEW was used to make the + * bitfile, update your * software to that version or later, and try again. - */ -static const NiFpga_Status NiFpga_Status_BitfileReadError = -63101; - + */ +static const NiFpga_Status NiFpga_Status_BitfileReadError = -63101; + /** * Invalid output directory. - */ -static const NiFpga_Status NiFpga_Status_InvalidOutputDirectory = -63102; - + */ +static const NiFpga_Status NiFpga_Status_InvalidOutputDirectory = -63102; + /** * Invalid prefix override. Prefixes must include only alphanumerics and * underscores. - */ -static const NiFpga_Status NiFpga_Status_InvalidPrefixOverride = -63103; - + */ +static const NiFpga_Status NiFpga_Status_InvalidPrefixOverride = -63103; + /** * Could not convert "%s" to a valid C/C++ identifier. - */ -static const NiFpga_Status NiFpga_Status_NoSuitableIdentifier = -63104; - + */ +static const NiFpga_Status NiFpga_Status_NoSuitableIdentifier = -63104; + /** * The C/C++ identifier "%s" is already in use and could not be created. - */ -static const NiFpga_Status NiFpga_Status_IdentifierConflict = -63105; - + */ +static const NiFpga_Status NiFpga_Status_IdentifierConflict = -63105; + /** * The specified bitfile is not the bitfile used to generate the C API. Specify - * the original bitfile or regenerate the C API for this bitfile. - */ -static const NiFpga_Status NiFpga_Status_SignatureMismatch = -63106; - + * the original bitfile or + * regenerate the C API for this bitfile. + */ +static const NiFpga_Status NiFpga_Status_SignatureMismatch = -63106; + /** * The bitfile you are trying to use is incompatible with the version of NI-RIO - * installed on the target and/or host. Update the version of NI-RIO on the - * target and/or host to the same version (or later) used to compile the + * installed on the target + * and/or host. Update the version of NI-RIO on the + * target and/or host to the same version (or later) used + * to compile the * bitfile. Alternatively, recompile the bitfile with the same version of NI-RIO - * that is currently installed on the target and/or host. - */ -static const NiFpga_Status NiFpga_Status_IncompatibleBitfile = -63107; - + * that is + * currently installed on the target and/or host. + */ +static const NiFpga_Status NiFpga_Status_IncompatibleBitfile = -63107; + /** * An unspecified hardware failure has occurred. The operation could not be * completed. - */ -static const NiFpga_Status NiFpga_Status_HardwareFault = -63150; - + */ +static const NiFpga_Status NiFpga_Status_HardwareFault = -63150; + /** * You must download the bitfile to the flash memory on the FPGA device before - * you can set when the bitfile is autoloaded. Download the bitfile to the flash + * you can set when the + * bitfile is autoloaded. Download the bitfile to the flash * memory then try again. - */ -static const NiFpga_Status NiFpga_Status_NoBitfilePresentOnFlash = -63160; - + */ +static const NiFpga_Status NiFpga_Status_NoBitfilePresentOnFlash = -63160; + /** * The device has shut down to protect against excessive power consumption. - * Check airflow and cooling and reboot the system. To avoid this error, monitor - * the power consumption, power shutdown threshold, and margin of the device. If + * Check airflow and cooling + * and reboot the system. To avoid this error, monitor + * the power consumption, power shutdown threshold, and + * margin of the device. If * necessary, reduce FPGA power consumption. - */ -static const NiFpga_Status NiFpga_Status_PowerShutdown = -63170; - + */ +static const NiFpga_Status NiFpga_Status_PowerShutdown = -63170; + /** * The device has shut down to protect against excessive FPGA temperature. Check - * airflow and cooling and reboot the system. To avoid this error, monitor the - * FPGA temperature, temperature shutdown threshold, and margin of the FPGA. If + * airflow and cooling + * and reboot the system. To avoid this error, monitor the + * FPGA temperature, temperature shutdown + * threshold, and margin of the FPGA. If * necessary, reduce FPGA temperature. - */ -static const NiFpga_Status NiFpga_Status_ThermalShutdown = -63171; - + */ +static const NiFpga_Status NiFpga_Status_ThermalShutdown = -63171; + /** * The alias name is invalid. A valid alias name must meet the following - * conditions: 1) Cannot be or contain a reserved word. 2) Can use only - * alphanumeric characters, hyphens, and underscores. 3) Cannot conflict with + * conditions: 1) Cannot be or + * contain a reserved word. 2) Can use only + * alphanumeric characters, hyphens, and underscores. 3) Cannot + * conflict with * the default alias of another device. A default alias is the name that the NI- - * RIO Device Driver assigns to a device based on its attributes if you have not - * assigned a custom alias to the device using MAX or the System Configuration - * API. For example, 'PXI1Slot3' is the default alias for the device at Slot 3 + * RIO + * Device Driver assigns to a device based on its attributes if you have not + * assigned a custom alias to the + * device using MAX or the System Configuration + * API. For example, 'PXI1Slot3' is the default alias for the + * device at Slot 3 * of PXI Chassis 1, and it cannot be used as an alias name for any other - * device. Refer to the LabVIEW Help for NI-RIO for more information about + * device. Refer + * to the LabVIEW Help for NI-RIO for more information about * aliases. - */ -static const NiFpga_Status NiFpga_Status_InvalidAliasName = -63180; - + */ +static const NiFpga_Status NiFpga_Status_InvalidAliasName = -63180; + /** * The supplied alias was not found. - */ -static const NiFpga_Status NiFpga_Status_AliasNotFound = -63181; - + */ +static const NiFpga_Status NiFpga_Status_AliasNotFound = -63181; + /** * An invalid device access setting was specified. RIO device access patterns - * may contain only alphanumerics, '-', '_', '.', and '*'. - */ -static const NiFpga_Status NiFpga_Status_InvalidDeviceAccess = -63182; - + * may contain only + * alphanumerics, '-', '_', '.', and '*'. + */ +static const NiFpga_Status NiFpga_Status_InvalidDeviceAccess = -63182; + /** * An invalid port was specified. The RIO server port must be between 0 and - * 65535, where 0 indicates a dynamically assigned port. Port 3580 is reserved + * 65535, where 0 indicates a + * dynamically assigned port. Port 3580 is reserved * and cannot be used. - */ -static const NiFpga_Status NiFpga_Status_InvalidPort = -63183; - + */ +static const NiFpga_Status NiFpga_Status_InvalidPort = -63183; + /** * The selected bitfile requires a driver that could not be loaded or that was - * invalid. Use MAX to install all necessary software to your target. Note that - * if your project includes modules under the chassis item, user-defined - * variables, or references to the Scan Clock Chassis I/O item, you must install + * invalid. Use MAX to + * install all necessary software to your target. Note that + * if your project includes modules under the + * chassis item, user-defined + * variables, or references to the Scan Clock Chassis I/O item, you must + * install * NI-RIO IO Scan software to the target. - */ -static const NiFpga_Status NiFpga_Status_ChildDeviceNotInserted = -63184; - + */ +static const NiFpga_Status NiFpga_Status_ChildDeviceNotInserted = -63184; + /** * This remote system does not support connections to other remote systems. - */ -static const NiFpga_Status NiFpga_Status_RemoteTarget = -63187; - + */ +static const NiFpga_Status NiFpga_Status_RemoteTarget = -63187; + /** * The operation is no longer supported. - */ -static const NiFpga_Status NiFpga_Status_DeprecatedFunction = -63188; - + */ +static const NiFpga_Status NiFpga_Status_DeprecatedFunction = -63188; + /** * The supplied search pattern is invalid. - */ -static const NiFpga_Status NiFpga_Status_InvalidPattern = -63189; - + */ +static const NiFpga_Status NiFpga_Status_InvalidPattern = -63189; + /** * The specified device was not found. Use MAX or System Designer to find the - * proper resource name for the intended device. - */ -static const NiFpga_Status NiFpga_Status_InvalidResourceName = -63192; - + * proper resource name for + * the intended device. + */ +static const NiFpga_Status NiFpga_Status_InvalidResourceName = -63192; + /** * The requested feature is not supported. - */ -static const NiFpga_Status NiFpga_Status_FeatureNotSupported = -63193; - + */ +static const NiFpga_Status NiFpga_Status_FeatureNotSupported = -63193; + /** * The NI-RIO software on the target system is not compatible with this - * software. Upgrade the NI-RIO software on the target system. - */ -static const NiFpga_Status NiFpga_Status_VersionMismatch = -63194; - + * software. Upgrade the NI-RIO + * software on the target system. + */ +static const NiFpga_Status NiFpga_Status_VersionMismatch = -63194; + /** * The handle for device communication is invalid or has been closed. Restart * the application. - */ -static const NiFpga_Status NiFpga_Status_InvalidSession = -63195; - + */ +static const NiFpga_Status NiFpga_Status_InvalidSession = -63195; + /** * An invalid attribute has been specified. - */ -static const NiFpga_Status NiFpga_Status_InvalidAttribute = -63196; - + */ +static const NiFpga_Status NiFpga_Status_InvalidAttribute = -63196; + /** * An invalid attribute value has been specified. - */ -static const NiFpga_Status NiFpga_Status_InvalidAttributeValue = -63197; - + */ +static const NiFpga_Status NiFpga_Status_InvalidAttributeValue = -63197; + /** * The system has run out of resources. Close a session and retry the operation. - */ -static const NiFpga_Status NiFpga_Status_OutOfHandles = -63198; - + */ +static const NiFpga_Status NiFpga_Status_OutOfHandles = -63198; + /** * The session could not be opened because another session with a different - * bitfile is already open on the device. Close the current session before + * bitfile is already open on + * the device. Close the current session before * opening another. - */ -static const NiFpga_Status NiFpga_Status_CannotDownloadDifferentBitfile = -63199; - + */ +static const NiFpga_Status NiFpga_Status_CannotDownloadDifferentBitfile = -63199; /** * Tests whether a status is an error. @@ -839,9 +845,8 @@ static const NiFpga_Status NiFpga_Status_CannotDownloadDifferentBitfile = -63199 * @param status status to check for an error * @return whether the status was an error */ -static NiFpga_Inline NiFpga_Bool NiFpga_IsError(const NiFpga_Status status) -{ - return status < NiFpga_Status_Success ? NiFpga_True : NiFpga_False; +static NiFpga_Inline NiFpga_Bool NiFpga_IsError(const NiFpga_Status status) { + return status < NiFpga_Status_Success ? NiFpga_True : NiFpga_False; } /** @@ -850,9 +855,8 @@ static NiFpga_Inline NiFpga_Bool NiFpga_IsError(const NiFpga_Status status) * @param status status to check for an error * @return whether the status was a success or warning */ -static NiFpga_Inline NiFpga_Bool NiFpga_IsNotError(const NiFpga_Status status) -{ - return status >= NiFpga_Status_Success ? NiFpga_True : NiFpga_False; +static NiFpga_Inline NiFpga_Bool NiFpga_IsNotError(const NiFpga_Status status) { + return status >= NiFpga_Status_Success ? NiFpga_True : NiFpga_False; } /** @@ -866,16 +870,12 @@ static NiFpga_Inline NiFpga_Bool NiFpga_IsNotError(const NiFpga_Status status) * @param newStatus new status value that may be set * @return the resulting status */ -static NiFpga_Inline NiFpga_Status NiFpga_MergeStatus( - NiFpga_Status* const status, - const NiFpga_Status newStatus) -{ - if (!status) - return NiFpga_Status_InvalidParameter; - if (NiFpga_IsNotError(*status) - && (*status == NiFpga_Status_Success || NiFpga_IsError(newStatus))) - *status = newStatus; - return *status; +static NiFpga_Inline NiFpga_Status NiFpga_MergeStatus(NiFpga_Status* const status, + const NiFpga_Status newStatus) { + if (!status) return NiFpga_Status_InvalidParameter; + if (NiFpga_IsNotError(*status) && (*status == NiFpga_Status_Success || NiFpga_IsError(newStatus))) + *status = newStatus; + return *status; } /** @@ -897,8 +897,7 @@ static NiFpga_Inline NiFpga_Status NiFpga_MergeStatus( * @param expression expression to call if the incoming status is not an error */ #define NiFpga_IfIsNotError(status, expression) \ - if (NiFpga_IsNotError(status)) \ - NiFpga_MergeStatus(&status, (expression)); \ + if (NiFpga_IsNotError(status)) NiFpga_MergeStatus(&status, (expression)); /** * @} @@ -920,11 +919,10 @@ static NiFpga_Inline NiFpga_Status NiFpga_MergeStatus( * - http://www.ni.com/newsletter/50303/en/ * - http://digital.ni.com/public.nsf/allkb/346CC529EC1092B3862574FA0053B9B2 */ -typedef struct NiFpga_FxpTypeInfo -{ - NiFpga_Bool isSigned; - uint8_t wordLength; - int16_t integerWordLength; +typedef struct NiFpga_FxpTypeInfo { + NiFpga_Bool isSigned; + uint8_t wordLength; + int16_t integerWordLength; } NiFpga_FxpTypeInfo; /** @@ -944,14 +942,12 @@ typedef struct NiFpga_FxpTypeInfo * @param typeInfo the information about the FXP type * @return delta the delta for the specified FXP type */ -static NiFpga_Inline float NiFpga_CalculateFxpDeltaFloat( - const NiFpga_FxpTypeInfo typeInfo) -{ - const int32_t exponent = typeInfo.integerWordLength - typeInfo.wordLength; +static NiFpga_Inline float NiFpga_CalculateFxpDeltaFloat(const NiFpga_FxpTypeInfo typeInfo) { + const int32_t exponent = typeInfo.integerWordLength - typeInfo.wordLength; #if NiFpga_C99 && !NiFpga_Cvi - return ldexpf(FLT_EPSILON, exponent + FLT_MANT_DIG - 1); + return ldexpf(FLT_EPSILON, exponent + FLT_MANT_DIG - 1); #else - return (float)ldexp((double)FLT_EPSILON, exponent + FLT_MANT_DIG - 1); + return (float)ldexp((double)FLT_EPSILON, exponent + FLT_MANT_DIG - 1); #endif } @@ -960,21 +956,19 @@ static NiFpga_Inline float NiFpga_CalculateFxpDeltaFloat( * This is not intended for external use and may be changed or modified in * future versions. */ -#define NiFpga_Private_FxpToFloatingPoint(typeInfo, delta, data) \ - const uint64_t wordLengthMask = typeInfo.wordLength != 64 \ - ? (1ULL << typeInfo.wordLength) - 1 : 0xFFFFFFFFFFFFFFFFULL; \ - data &= wordLengthMask; \ - if (typeInfo.isSigned) \ - { \ - const uint64_t signedMask = 1ULL << (typeInfo.wordLength - 1); \ - if (data & signedMask) \ - { \ - int64_t signedData = data ^ wordLengthMask; \ - signedData = (signedData + 1) * -1; \ - return delta * signedData; \ - } \ - } \ - return delta * data; +#define NiFpga_Private_FxpToFloatingPoint(typeInfo, delta, data) \ + const uint64_t wordLengthMask = \ + typeInfo.wordLength != 64 ? (1ULL << typeInfo.wordLength) - 1 : 0xFFFFFFFFFFFFFFFFULL; \ + data &= wordLengthMask; \ + if (typeInfo.isSigned) { \ + const uint64_t signedMask = 1ULL << (typeInfo.wordLength - 1); \ + if (data & signedMask) { \ + int64_t signedData = data ^ wordLengthMask; \ + signedData = (signedData + 1) * -1; \ + return delta * signedData; \ + } \ + } \ + return delta * data; /** * @} @@ -994,12 +988,9 @@ static NiFpga_Inline float NiFpga_CalculateFxpDeltaFloat( * @param data the raw FXP data from the FPGA * @return a float representation of the data */ -static NiFpga_Inline float NiFpga_ConvertFromFxpToFloat( - const NiFpga_FxpTypeInfo typeInfo, - uint64_t data) -{ - const float delta = NiFpga_CalculateFxpDeltaFloat(typeInfo); - NiFpga_Private_FxpToFloatingPoint(typeInfo, delta, data) +static NiFpga_Inline float NiFpga_ConvertFromFxpToFloat(const NiFpga_FxpTypeInfo typeInfo, uint64_t data) { + const float delta = NiFpga_CalculateFxpDeltaFloat(typeInfo); + NiFpga_Private_FxpToFloatingPoint(typeInfo, delta, data) } /** @@ -1015,11 +1006,9 @@ static NiFpga_Inline float NiFpga_ConvertFromFxpToFloat( * @param typeInfo the information about the FXP type * @return delta the delta for the specified FXP type */ -static NiFpga_Inline double NiFpga_CalculateFxpDeltaDouble( - const NiFpga_FxpTypeInfo typeInfo) -{ - const int32_t exponent = typeInfo.integerWordLength - typeInfo.wordLength; - return ldexp(DBL_EPSILON, exponent + DBL_MANT_DIG - 1); +static NiFpga_Inline double NiFpga_CalculateFxpDeltaDouble(const NiFpga_FxpTypeInfo typeInfo) { + const int32_t exponent = typeInfo.integerWordLength - typeInfo.wordLength; + return ldexp(DBL_EPSILON, exponent + DBL_MANT_DIG - 1); } /** \addtogroup FXP @@ -1036,12 +1025,9 @@ static NiFpga_Inline double NiFpga_CalculateFxpDeltaDouble( * @param data the raw FXP data from the FPGA * @return a double representation of the data */ -static NiFpga_Inline double NiFpga_ConvertFromFxpToDouble( - const NiFpga_FxpTypeInfo typeInfo, - uint64_t data) -{ - const double delta = NiFpga_CalculateFxpDeltaDouble(typeInfo); - NiFpga_Private_FxpToFloatingPoint(typeInfo, delta, data) +static NiFpga_Inline double NiFpga_ConvertFromFxpToDouble(const NiFpga_FxpTypeInfo typeInfo, uint64_t data) { + const double delta = NiFpga_CalculateFxpDeltaDouble(typeInfo); + NiFpga_Private_FxpToFloatingPoint(typeInfo, delta, data) } /** @@ -1053,46 +1039,34 @@ static NiFpga_Inline double NiFpga_ConvertFromFxpToDouble( * This is not intended for external use and may be changed or modified in * future versions. */ -#define NiFpga_Private_FloatingPointToFxp(typeInfo, delta, data) \ - const uint64_t wordLengthMask = typeInfo.wordLength != 64 \ - ? (1ULL << typeInfo.wordLength) - 1 : 0xFFFFFFFFFFFFFFFFULL; \ - if (data < 0) \ - { \ - if (typeInfo.isSigned) \ - { \ - int64_t fxpRepresentation = (int64_t)(data / delta); \ - fxpRepresentation ^= wordLengthMask; \ - fxpRepresentation += 1; \ - fxpRepresentation *= -1; \ - if ((int64_t)(fxpRepresentation & wordLengthMask) == fxpRepresentation) \ - { \ - return fxpRepresentation; \ - } \ - else /* minimum */ \ - { \ - return (-1LL * (1LL << (typeInfo.wordLength - 1))) \ - & wordLengthMask; \ - } \ - } \ - else \ - { \ - return 0; \ - } \ - } \ - else \ - { \ - const uint64_t fxpRepresentation = (uint64_t)(data / delta); \ - if ((fxpRepresentation & wordLengthMask) == fxpRepresentation) \ - { \ - return fxpRepresentation; \ - } \ - else /* maxmimum */ \ - { \ - const uint64_t magnitude = typeInfo.wordLength \ - - (typeInfo.isSigned ? 1 : 0); \ - return (1ULL << magnitude) - 1; \ - } \ - } +#define NiFpga_Private_FloatingPointToFxp(typeInfo, delta, data) \ + const uint64_t wordLengthMask = \ + typeInfo.wordLength != 64 ? (1ULL << typeInfo.wordLength) - 1 : 0xFFFFFFFFFFFFFFFFULL; \ + if (data < 0) { \ + if (typeInfo.isSigned) { \ + int64_t fxpRepresentation = (int64_t)(data / delta); \ + fxpRepresentation ^= wordLengthMask; \ + fxpRepresentation += 1; \ + fxpRepresentation *= -1; \ + if ((int64_t)(fxpRepresentation & wordLengthMask) == fxpRepresentation) { \ + return fxpRepresentation; \ + } else /* minimum */ \ + { \ + return (-1LL * (1LL << (typeInfo.wordLength - 1))) & wordLengthMask; \ + } \ + } else { \ + return 0; \ + } \ + } else { \ + const uint64_t fxpRepresentation = (uint64_t)(data / delta); \ + if ((fxpRepresentation & wordLengthMask) == fxpRepresentation) { \ + return fxpRepresentation; \ + } else /* maxmimum */ \ + { \ + const uint64_t magnitude = typeInfo.wordLength - (typeInfo.isSigned ? 1 : 0); \ + return (1ULL << magnitude) - 1; \ + } \ + } /** \addtogroup FXP * @{ @@ -1108,12 +1082,9 @@ static NiFpga_Inline double NiFpga_ConvertFromFxpToDouble( * @param data the value to be converted to FXP * @return a value containing the FXP representation of data */ -static NiFpga_Inline uint64_t NiFpga_ConvertFromFloatToFxp( - const NiFpga_FxpTypeInfo typeInfo, - float data) -{ - const float delta = NiFpga_CalculateFxpDeltaFloat(typeInfo); - NiFpga_Private_FloatingPointToFxp(typeInfo, delta, data) +static NiFpga_Inline uint64_t NiFpga_ConvertFromFloatToFxp(const NiFpga_FxpTypeInfo typeInfo, float data) { + const float delta = NiFpga_CalculateFxpDeltaFloat(typeInfo); + NiFpga_Private_FloatingPointToFxp(typeInfo, delta, data) } /** @@ -1126,12 +1097,9 @@ static NiFpga_Inline uint64_t NiFpga_ConvertFromFloatToFxp( * @param data the value to be converted to FXP * @return a value containing the FXP representation of data */ -static NiFpga_Inline uint64_t NiFpga_ConvertFromDoubleToFxp( - const NiFpga_FxpTypeInfo typeInfo, - double data) -{ - const double delta = NiFpga_CalculateFxpDeltaDouble(typeInfo); - NiFpga_Private_FloatingPointToFxp(typeInfo, delta, data) +static NiFpga_Inline uint64_t NiFpga_ConvertFromDoubleToFxp(const NiFpga_FxpTypeInfo typeInfo, double data) { + const double delta = NiFpga_CalculateFxpDeltaDouble(typeInfo); + NiFpga_Private_FloatingPointToFxp(typeInfo, delta, data) } /** @@ -1180,36 +1148,35 @@ typedef uint32_t NiFpga_Session; /** * Attributes that NiFpga_Open accepts. */ -typedef enum -{ - /** - * By default the FPGA VI will start running when Open is called. - * This attribute will ensure the bitfile is loaded to the FPGA, but does not - * run the VI. If the VI is already running on the FPGA, its state will not - * be changed. - */ - NiFpga_OpenAttribute_NoRun = 1, - /** - * On windows the bitfile path is assumed to be encoded as the current - * codepage. This attribute will specify that the bitfile path is encoded as - * UTF-8. This parameter has no effect on Linux systems. - */ - NiFpga_OpenAttribute_BitfilePathIsUTF8 = 2, - /** - * Causes the bitfile argument passed in to be interpreted as the contents - * of the lvbitx file rather than a path to an lvbitx file. - */ - NiFpga_OpenAttribute_BitfileContentsNotPath = 1u << 30, - /** - * Skips the check of the signature argument, which otherwise would ensure - * that users would not accidentally rebuild their bitfile (thereby getting - * new offsets, etc.) without also regenerating their C API and rebuilding - * their application with the new constants. This is useful if one is not - * using the FPGA Interface C API Generator to obtain resource information, - * such as by calling NiFpga_FindRegister or NiFpga_FindFifo. - * If using this attribute, pass `NULL` to `signature` instead. - */ - NiFpga_OpenAttribute_IgnoreSignatureArgument = 1u << 31 +typedef enum { + /** + * By default the FPGA VI will start running when Open is called. + * This attribute will ensure the bitfile is loaded to the FPGA, but does not + * run the VI. If the VI is already running on the FPGA, its state will not + * be changed. + */ + NiFpga_OpenAttribute_NoRun = 1, + /** + * On windows the bitfile path is assumed to be encoded as the current + * codepage. This attribute will specify that the bitfile path is encoded as + * UTF-8. This parameter has no effect on Linux systems. + */ + NiFpga_OpenAttribute_BitfilePathIsUTF8 = 2, + /** + * Causes the bitfile argument passed in to be interpreted as the contents + * of the lvbitx file rather than a path to an lvbitx file. + */ + NiFpga_OpenAttribute_BitfileContentsNotPath = 1u << 30, + /** + * Skips the check of the signature argument, which otherwise would ensure + * that users would not accidentally rebuild their bitfile (thereby getting + * new offsets, etc.) without also regenerating their C API and rebuilding + * their application with the new constants. This is useful if one is not + * using the FPGA Interface C API Generator to obtain resource information, + * such as by calling NiFpga_FindRegister or NiFpga_FindFifo. + * If using this attribute, pass `NULL` to `signature` instead. + */ + NiFpga_OpenAttribute_IgnoreSignatureArgument = 1u << 31 } NiFpga_OpenAttribute; /** @@ -1237,19 +1204,13 @@ typedef enum * longer needed * @return result of the call */ -NiFpga_Status NiFpga_Open(const char* bitfile, - const char* signature, - const char* resource, - uint32_t attribute, - NiFpga_Session* session); +NiFpga_Status NiFpga_Open(const char* bitfile, const char* signature, const char* resource, + uint32_t attribute, NiFpga_Session* session); /** * Attributes that NiFpga_Close accepts. */ -typedef enum -{ - NiFpga_CloseAttribute_NoResetIfLastSession = 1 -} NiFpga_CloseAttribute; +typedef enum { NiFpga_CloseAttribute_NoResetIfLastSession = 1 } NiFpga_CloseAttribute; /** * Closes the session to the FPGA. The FPGA resets unless either another session @@ -1260,8 +1221,7 @@ typedef enum * @param attribute bitwise OR of any NiFpga_CloseAttributes, or 0 * @return result of the call */ -NiFpga_Status NiFpga_Close(NiFpga_Session session, - uint32_t attribute); +NiFpga_Status NiFpga_Close(NiFpga_Session session, uint32_t attribute); /** * Returns the signature of the bitfile currently loaded on the FPGA. If the @@ -1273,9 +1233,7 @@ NiFpga_Status NiFpga_Close(NiFpga_Session session, * @param signatureSize the number of elements in signature * @return result of the call */ -NiFpga_Status NiFpga_GetBitfileSignature(NiFpga_Session session, - uint32_t* signature, - size_t* signatureSize); +NiFpga_Status NiFpga_GetBitfileSignature(NiFpga_Session session, uint32_t* signature, size_t* signatureSize); /** * Returns the offset of a control or indicator. This offset can be used as the @@ -1295,9 +1253,7 @@ NiFpga_Status NiFpga_GetBitfileSignature(NiFpga_Session session, * @param registerOffset outputs the offset of the register * @return result of the call */ -NiFpga_Status NiFpga_FindRegister(NiFpga_Session session, - const char* registerName, - uint32_t* registerOffset); +NiFpga_Status NiFpga_FindRegister(NiFpga_Session session, const char* registerName, uint32_t* registerOffset); /** * Returns the fifoNumber of a FIFO. This fifoNumber can be used as the @@ -1308,9 +1264,7 @@ NiFpga_Status NiFpga_FindRegister(NiFpga_Session session, * @param fifoNumber outputs the number of the FIFO * @return result of the call */ -NiFpga_Status NiFpga_FindFifo(NiFpga_Session session, - const char* fifoName, - uint32_t* fifoNumber); +NiFpga_Status NiFpga_FindFifo(NiFpga_Session session, const char* fifoName, uint32_t* fifoNumber); /** * @} @@ -1323,10 +1277,7 @@ NiFpga_Status NiFpga_FindFifo(NiFpga_Session session, /** * Attributes that NiFpga_Run accepts. */ -typedef enum -{ - NiFpga_RunAttribute_WaitUntilDone = 1 -} NiFpga_RunAttribute; +typedef enum { NiFpga_RunAttribute_WaitUntilDone = 1 } NiFpga_RunAttribute; /** * Runs the FPGA VI on the target. If you use NiFpga_RunAttribute_WaitUntilDone, @@ -1336,8 +1287,7 @@ typedef enum * @param attribute bitwise OR of any NiFpga_RunAttributes, or 0 * @return result of the call */ -NiFpga_Status NiFpga_Run(NiFpga_Session session, - uint32_t attribute); +NiFpga_Status NiFpga_Run(NiFpga_Session session, uint32_t attribute); /** * Aborts the FPGA VI. @@ -1366,26 +1316,25 @@ NiFpga_Status NiFpga_Download(NiFpga_Session session); /** * Possible FPGA VI States that GetFpgaViState will output. */ -typedef enum -{ - /** - * The FPGA VI has either been downloaded and not run, or the VI was aborted - * or reset. - */ - NiFpga_FpgaViState_NotRunning = 0, - /** - * An error has occurred. - */ - NiFpga_FpgaViState_Invalid = 1, - /** - * The FPGA VI is currently executing. - */ - NiFpga_FpgaViState_Running = 2, - /** - * The FPGA VI stopped normally. This indicates it was not aborted or reset, - * but instead reached the end of any loops it was executing and ended. - */ - NiFpga_FpgaViState_NaturallyStopped = 3 +typedef enum { + /** + * The FPGA VI has either been downloaded and not run, or the VI was aborted + * or reset. + */ + NiFpga_FpgaViState_NotRunning = 0, + /** + * An error has occurred. + */ + NiFpga_FpgaViState_Invalid = 1, + /** + * The FPGA VI is currently executing. + */ + NiFpga_FpgaViState_Running = 2, + /** + * The FPGA VI stopped normally. This indicates it was not aborted or reset, + * but instead reached the end of any loops it was executing and ended. + */ + NiFpga_FpgaViState_NaturallyStopped = 3 } NiFpga_FpgaViState; /** @@ -1395,8 +1344,7 @@ typedef enum * @param state the current state specified as NiFpga_FpgaViState * @return result of the call */ -NiFpga_Status NiFpga_GetFpgaViState(NiFpga_Session session, - uint32_t* state); +NiFpga_Status NiFpga_GetFpgaViState(NiFpga_Session session, uint32_t* state); /** * @} @@ -1414,9 +1362,7 @@ NiFpga_Status NiFpga_GetFpgaViState(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadBool(NiFpga_Session session, - uint32_t indicator, - NiFpga_Bool* value); +NiFpga_Status NiFpga_ReadBool(NiFpga_Session session, uint32_t indicator, NiFpga_Bool* value); /** * Reads a signed 8-bit integer value from a given indicator or control. @@ -1426,9 +1372,7 @@ NiFpga_Status NiFpga_ReadBool(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadI8(NiFpga_Session session, - uint32_t indicator, - int8_t* value); +NiFpga_Status NiFpga_ReadI8(NiFpga_Session session, uint32_t indicator, int8_t* value); /** * Reads an unsigned 8-bit integer value from a given indicator or control. @@ -1438,9 +1382,7 @@ NiFpga_Status NiFpga_ReadI8(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadU8(NiFpga_Session session, - uint32_t indicator, - uint8_t* value); +NiFpga_Status NiFpga_ReadU8(NiFpga_Session session, uint32_t indicator, uint8_t* value); /** * Reads a signed 16-bit integer value from a given indicator or control. @@ -1450,9 +1392,7 @@ NiFpga_Status NiFpga_ReadU8(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadI16(NiFpga_Session session, - uint32_t indicator, - int16_t* value); +NiFpga_Status NiFpga_ReadI16(NiFpga_Session session, uint32_t indicator, int16_t* value); /** * Reads an unsigned 16-bit integer value from a given indicator or control. @@ -1462,9 +1402,7 @@ NiFpga_Status NiFpga_ReadI16(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadU16(NiFpga_Session session, - uint32_t indicator, - uint16_t* value); +NiFpga_Status NiFpga_ReadU16(NiFpga_Session session, uint32_t indicator, uint16_t* value); /** * Reads a signed 32-bit integer value from a given indicator or control. @@ -1474,9 +1412,7 @@ NiFpga_Status NiFpga_ReadU16(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadI32(NiFpga_Session session, - uint32_t indicator, - int32_t* value); +NiFpga_Status NiFpga_ReadI32(NiFpga_Session session, uint32_t indicator, int32_t* value); /** * Reads an unsigned 32-bit integer value from a given indicator or control. @@ -1486,9 +1422,7 @@ NiFpga_Status NiFpga_ReadI32(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadU32(NiFpga_Session session, - uint32_t indicator, - uint32_t* value); +NiFpga_Status NiFpga_ReadU32(NiFpga_Session session, uint32_t indicator, uint32_t* value); /** * Reads a signed 64-bit integer value from a given indicator or control. @@ -1498,9 +1432,7 @@ NiFpga_Status NiFpga_ReadU32(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadI64(NiFpga_Session session, - uint32_t indicator, - int64_t* value); +NiFpga_Status NiFpga_ReadI64(NiFpga_Session session, uint32_t indicator, int64_t* value); /** * Reads an unsigned 64-bit integer value from a given indicator or control. @@ -1510,9 +1442,7 @@ NiFpga_Status NiFpga_ReadI64(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadU64(NiFpga_Session session, - uint32_t indicator, - uint64_t* value); +NiFpga_Status NiFpga_ReadU64(NiFpga_Session session, uint32_t indicator, uint64_t* value); /** * Reads a single-precision floating-point value from a given indicator or @@ -1523,9 +1453,7 @@ NiFpga_Status NiFpga_ReadU64(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadSgl(NiFpga_Session session, - uint32_t indicator, - float* value); +NiFpga_Status NiFpga_ReadSgl(NiFpga_Session session, uint32_t indicator, float* value); /** * Reads a double-precision floating-point value from a given indicator or @@ -1536,9 +1464,7 @@ NiFpga_Status NiFpga_ReadSgl(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadDbl(NiFpga_Session session, - uint32_t indicator, - double* value); +NiFpga_Status NiFpga_ReadDbl(NiFpga_Session session, uint32_t indicator, double* value); /** * Reads a FXP value with a wordlength greater than 32-bits from a given @@ -1550,10 +1476,8 @@ NiFpga_Status NiFpga_ReadDbl(NiFpga_Session session, * @param value outputs the value that was read * @return result of the call */ -NiFpga_Status NiFpga_ReadFxp64(NiFpga_Session session, - uint32_t indicator, - NiFpga_FxpTypeInfo typeInfo, - uint64_t* value); +NiFpga_Status NiFpga_ReadFxp64(NiFpga_Session session, uint32_t indicator, NiFpga_FxpTypeInfo typeInfo, + uint64_t* value); /** * @} @@ -1571,9 +1495,7 @@ NiFpga_Status NiFpga_ReadFxp64(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteBool(NiFpga_Session session, - uint32_t control, - NiFpga_Bool value); +NiFpga_Status NiFpga_WriteBool(NiFpga_Session session, uint32_t control, NiFpga_Bool value); /** * Writes a signed 8-bit integer value to a given control or indicator. @@ -1583,9 +1505,7 @@ NiFpga_Status NiFpga_WriteBool(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteI8(NiFpga_Session session, - uint32_t control, - int8_t value); +NiFpga_Status NiFpga_WriteI8(NiFpga_Session session, uint32_t control, int8_t value); /** * Writes an unsigned 8-bit integer value to a given control or indicator. @@ -1595,9 +1515,7 @@ NiFpga_Status NiFpga_WriteI8(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteU8(NiFpga_Session session, - uint32_t control, - uint8_t value); +NiFpga_Status NiFpga_WriteU8(NiFpga_Session session, uint32_t control, uint8_t value); /** * Writes a signed 16-bit integer value to a given control or indicator. @@ -1607,9 +1525,7 @@ NiFpga_Status NiFpga_WriteU8(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteI16(NiFpga_Session session, - uint32_t control, - int16_t value); +NiFpga_Status NiFpga_WriteI16(NiFpga_Session session, uint32_t control, int16_t value); /** * Writes an unsigned 16-bit integer value to a given control or indicator. @@ -1619,9 +1535,7 @@ NiFpga_Status NiFpga_WriteI16(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteU16(NiFpga_Session session, - uint32_t control, - uint16_t value); +NiFpga_Status NiFpga_WriteU16(NiFpga_Session session, uint32_t control, uint16_t value); /** * Writes a signed 32-bit integer value to a given control or indicator. @@ -1631,9 +1545,7 @@ NiFpga_Status NiFpga_WriteU16(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteI32(NiFpga_Session session, - uint32_t control, - int32_t value); +NiFpga_Status NiFpga_WriteI32(NiFpga_Session session, uint32_t control, int32_t value); /** * Writes an unsigned 32-bit integer value to a given control or indicator. @@ -1643,9 +1555,7 @@ NiFpga_Status NiFpga_WriteI32(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteU32(NiFpga_Session session, - uint32_t control, - uint32_t value); +NiFpga_Status NiFpga_WriteU32(NiFpga_Session session, uint32_t control, uint32_t value); /** * Writes a signed 64-bit integer value to a given control or indicator. @@ -1655,9 +1565,7 @@ NiFpga_Status NiFpga_WriteU32(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteI64(NiFpga_Session session, - uint32_t control, - int64_t value); +NiFpga_Status NiFpga_WriteI64(NiFpga_Session session, uint32_t control, int64_t value); /** * Writes an unsigned 64-bit integer value to a given control or indicator. @@ -1667,9 +1575,7 @@ NiFpga_Status NiFpga_WriteI64(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteU64(NiFpga_Session session, - uint32_t control, - uint64_t value); +NiFpga_Status NiFpga_WriteU64(NiFpga_Session session, uint32_t control, uint64_t value); /** * Writes a single-precision floating-point value to a given control or @@ -1680,9 +1586,7 @@ NiFpga_Status NiFpga_WriteU64(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteSgl(NiFpga_Session session, - uint32_t control, - float value); +NiFpga_Status NiFpga_WriteSgl(NiFpga_Session session, uint32_t control, float value); /** * Writes a double-precision floating-point value to a given control or @@ -1693,9 +1597,7 @@ NiFpga_Status NiFpga_WriteSgl(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteDbl(NiFpga_Session session, - uint32_t control, - double value); +NiFpga_Status NiFpga_WriteDbl(NiFpga_Session session, uint32_t control, double value); /** * Writes a FXP value with a wordlength greater than 32-bits to a given @@ -1707,10 +1609,8 @@ NiFpga_Status NiFpga_WriteDbl(NiFpga_Session session, * @param value value to write * @return result of the call */ -NiFpga_Status NiFpga_WriteFxp64(NiFpga_Session session, - uint32_t control, - NiFpga_FxpTypeInfo typeInfo, - uint64_t value); +NiFpga_Status NiFpga_WriteFxp64(NiFpga_Session session, uint32_t control, NiFpga_FxpTypeInfo typeInfo, + uint64_t value); /** * @} @@ -1733,10 +1633,8 @@ NiFpga_Status NiFpga_WriteFxp64(NiFpga_Session session, * @param size exact number of elements in the indicator or control * @return result of the call */ -NiFpga_Status NiFpga_ReadArrayBool(NiFpga_Session session, - uint32_t indicator, - NiFpga_Bool* array, - size_t size); +NiFpga_Status NiFpga_ReadArrayBool(NiFpga_Session session, uint32_t indicator, NiFpga_Bool* array, + size_t size); /** * Reads an entire array of signed 8-bit integer values from a given array @@ -1751,10 +1649,7 @@ NiFpga_Status NiFpga_ReadArrayBool(NiFpga_Session session, * @param size exact number of elements in the indicator or control * @return result of the call */ -NiFpga_Status NiFpga_ReadArrayI8(NiFpga_Session session, - uint32_t indicator, - int8_t* array, - size_t size); +NiFpga_Status NiFpga_ReadArrayI8(NiFpga_Session session, uint32_t indicator, int8_t* array, size_t size); /** * Reads an entire array of unsigned 8-bit integer values from a given array @@ -1769,10 +1664,7 @@ NiFpga_Status NiFpga_ReadArrayI8(NiFpga_Session session, * @param size exact number of elements in the indicator or control * @return result of the call */ -NiFpga_Status NiFpga_ReadArrayU8(NiFpga_Session session, - uint32_t indicator, - uint8_t* array, - size_t size); +NiFpga_Status NiFpga_ReadArrayU8(NiFpga_Session session, uint32_t indicator, uint8_t* array, size_t size); /** * Reads an entire array of signed 16-bit integer values from a given array @@ -1787,10 +1679,7 @@ NiFpga_Status NiFpga_ReadArrayU8(NiFpga_Session session, * @param size exact number of elements in the indicator or control * @return result of the call */ -NiFpga_Status NiFpga_ReadArrayI16(NiFpga_Session session, - uint32_t indicator, - int16_t* array, - size_t size); +NiFpga_Status NiFpga_ReadArrayI16(NiFpga_Session session, uint32_t indicator, int16_t* array, size_t size); /** * Reads an entire array of unsigned 16-bit integer values from a given array @@ -1805,10 +1694,7 @@ NiFpga_Status NiFpga_ReadArrayI16(NiFpga_Session session, * @param size exact number of elements in the indicator or control * @return result of the call */ -NiFpga_Status NiFpga_ReadArrayU16(NiFpga_Session session, - uint32_t indicator, - uint16_t* array, - size_t size); +NiFpga_Status NiFpga_ReadArrayU16(NiFpga_Session session, uint32_t indicator, uint16_t* array, size_t size); /** * Reads an entire array of signed 32-bit integer values from a given array @@ -1823,10 +1709,7 @@ NiFpga_Status NiFpga_ReadArrayU16(NiFpga_Session session, * @param size exact number of elements in the indicator or control * @return result of the call */ -NiFpga_Status NiFpga_ReadArrayI32(NiFpga_Session session, - uint32_t indicator, - int32_t* array, - size_t size); +NiFpga_Status NiFpga_ReadArrayI32(NiFpga_Session session, uint32_t indicator, int32_t* array, size_t size); /** * Reads an entire array of unsigned 32-bit integer values from a given array @@ -1841,10 +1724,7 @@ NiFpga_Status NiFpga_ReadArrayI32(NiFpga_Session session, * @param size exact number of elements in the indicator or control * @return result of the call */ -NiFpga_Status NiFpga_ReadArrayU32(NiFpga_Session session, - uint32_t indicator, - uint32_t* array, - size_t size); +NiFpga_Status NiFpga_ReadArrayU32(NiFpga_Session session, uint32_t indicator, uint32_t* array, size_t size); /** * Reads an entire array of signed 64-bit integer values from a given array @@ -1859,10 +1739,7 @@ NiFpga_Status NiFpga_ReadArrayU32(NiFpga_Session session, * @param size exact number of elements in the indicator or control * @return result of the call */ -NiFpga_Status NiFpga_ReadArrayI64(NiFpga_Session session, - uint32_t indicator, - int64_t* array, - size_t size); +NiFpga_Status NiFpga_ReadArrayI64(NiFpga_Session session, uint32_t indicator, int64_t* array, size_t size); /** * Reads an entire array of unsigned 64-bit integer values from a given array @@ -1877,10 +1754,7 @@ NiFpga_Status NiFpga_ReadArrayI64(NiFpga_Session session, * @param size exact number of elements in the indicator or control * @return result of the call */ -NiFpga_Status NiFpga_ReadArrayU64(NiFpga_Session session, - uint32_t indicator, - uint64_t* array, - size_t size); +NiFpga_Status NiFpga_ReadArrayU64(NiFpga_Session session, uint32_t indicator, uint64_t* array, size_t size); /** * Reads an entire array of single-precision floating-point values from a @@ -1895,10 +1769,7 @@ NiFpga_Status NiFpga_ReadArrayU64(NiFpga_Session session, * @param size exact number of elements in the indicator or control * @return result of the call */ -NiFpga_Status NiFpga_ReadArraySgl(NiFpga_Session session, - uint32_t indicator, - float* array, - size_t size); +NiFpga_Status NiFpga_ReadArraySgl(NiFpga_Session session, uint32_t indicator, float* array, size_t size); /** * Reads an entire array of double-precision floating-point values from a @@ -1913,10 +1784,7 @@ NiFpga_Status NiFpga_ReadArraySgl(NiFpga_Session session, * @param size exact number of elements in the indicator or control * @return result of the call */ -NiFpga_Status NiFpga_ReadArrayDbl(NiFpga_Session session, - uint32_t indicator, - double* array, - size_t size); +NiFpga_Status NiFpga_ReadArrayDbl(NiFpga_Session session, uint32_t indicator, double* array, size_t size); /** * @} @@ -1939,10 +1807,8 @@ NiFpga_Status NiFpga_ReadArrayDbl(NiFpga_Session session, * @param size exact number of elements in the control or indicator * @return result of the call */ -NiFpga_Status NiFpga_WriteArrayBool(NiFpga_Session session, - uint32_t control, - const NiFpga_Bool* array, - size_t size); +NiFpga_Status NiFpga_WriteArrayBool(NiFpga_Session session, uint32_t control, const NiFpga_Bool* array, + size_t size); /** * Writes an entire array of signed 8-bit integer values to a given array @@ -1957,10 +1823,7 @@ NiFpga_Status NiFpga_WriteArrayBool(NiFpga_Session session, * @param size exact number of elements in the control or indicator * @return result of the call */ -NiFpga_Status NiFpga_WriteArrayI8(NiFpga_Session session, - uint32_t control, - const int8_t* array, - size_t size); +NiFpga_Status NiFpga_WriteArrayI8(NiFpga_Session session, uint32_t control, const int8_t* array, size_t size); /** * Writes an entire array of unsigned 8-bit integer values to a given array @@ -1975,10 +1838,8 @@ NiFpga_Status NiFpga_WriteArrayI8(NiFpga_Session session, * @param size exact number of elements in the control or indicator * @return result of the call */ -NiFpga_Status NiFpga_WriteArrayU8(NiFpga_Session session, - uint32_t control, - const uint8_t* array, - size_t size); +NiFpga_Status NiFpga_WriteArrayU8(NiFpga_Session session, uint32_t control, const uint8_t* array, + size_t size); /** * Writes an entire array of signed 16-bit integer values to a given array @@ -1993,10 +1854,8 @@ NiFpga_Status NiFpga_WriteArrayU8(NiFpga_Session session, * @param size exact number of elements in the control or indicator * @return result of the call */ -NiFpga_Status NiFpga_WriteArrayI16(NiFpga_Session session, - uint32_t control, - const int16_t* array, - size_t size); +NiFpga_Status NiFpga_WriteArrayI16(NiFpga_Session session, uint32_t control, const int16_t* array, + size_t size); /** * Writes an entire array of unsigned 16-bit integer values to a given array @@ -2011,10 +1870,8 @@ NiFpga_Status NiFpga_WriteArrayI16(NiFpga_Session session, * @param size exact number of elements in the control or indicator * @return result of the call */ -NiFpga_Status NiFpga_WriteArrayU16(NiFpga_Session session, - uint32_t control, - const uint16_t* array, - size_t size); +NiFpga_Status NiFpga_WriteArrayU16(NiFpga_Session session, uint32_t control, const uint16_t* array, + size_t size); /** * Writes an entire array of signed 32-bit integer values to a given array @@ -2029,10 +1886,8 @@ NiFpga_Status NiFpga_WriteArrayU16(NiFpga_Session session, * @param size exact number of elements in the control or indicator * @return result of the call */ -NiFpga_Status NiFpga_WriteArrayI32(NiFpga_Session session, - uint32_t control, - const int32_t* array, - size_t size); +NiFpga_Status NiFpga_WriteArrayI32(NiFpga_Session session, uint32_t control, const int32_t* array, + size_t size); /** * Writes an entire array of unsigned 32-bit integer values to a given array @@ -2047,10 +1902,8 @@ NiFpga_Status NiFpga_WriteArrayI32(NiFpga_Session session, * @param size exact number of elements in the control or indicator * @return result of the call */ -NiFpga_Status NiFpga_WriteArrayU32(NiFpga_Session session, - uint32_t control, - const uint32_t* array, - size_t size); +NiFpga_Status NiFpga_WriteArrayU32(NiFpga_Session session, uint32_t control, const uint32_t* array, + size_t size); /** * Writes an entire array of signed 64-bit integer values to a given array @@ -2065,10 +1918,8 @@ NiFpga_Status NiFpga_WriteArrayU32(NiFpga_Session session, * @param size exact number of elements in the control or indicator * @return result of the call */ -NiFpga_Status NiFpga_WriteArrayI64(NiFpga_Session session, - uint32_t control, - const int64_t* array, - size_t size); +NiFpga_Status NiFpga_WriteArrayI64(NiFpga_Session session, uint32_t control, const int64_t* array, + size_t size); /** * Writes an entire array of unsigned 64-bit integer values to a given array @@ -2083,10 +1934,8 @@ NiFpga_Status NiFpga_WriteArrayI64(NiFpga_Session session, * @param size exact number of elements in the control or indicator * @return result of the call */ -NiFpga_Status NiFpga_WriteArrayU64(NiFpga_Session session, - uint32_t control, - const uint64_t* array, - size_t size); +NiFpga_Status NiFpga_WriteArrayU64(NiFpga_Session session, uint32_t control, const uint64_t* array, + size_t size); /** * Writes an entire array of single-precision floating-point values to a given @@ -2101,10 +1950,7 @@ NiFpga_Status NiFpga_WriteArrayU64(NiFpga_Session session, * @param size exact number of elements in the control or indicator * @return result of the call */ -NiFpga_Status NiFpga_WriteArraySgl(NiFpga_Session session, - uint32_t control, - const float* array, - size_t size); +NiFpga_Status NiFpga_WriteArraySgl(NiFpga_Session session, uint32_t control, const float* array, size_t size); /** * Writes an entire array of double-precision floating-point values to a given @@ -2119,10 +1965,8 @@ NiFpga_Status NiFpga_WriteArraySgl(NiFpga_Session session, * @param size exact number of elements in the control or indicator * @return result of the call */ -NiFpga_Status NiFpga_WriteArrayDbl(NiFpga_Session session, - uint32_t control, - const double* array, - size_t size); +NiFpga_Status NiFpga_WriteArrayDbl(NiFpga_Session session, uint32_t control, const double* array, + size_t size); /** * @} @@ -2143,46 +1987,45 @@ static const uint32_t NiFpga_InfiniteTimeout = 0xFFFFFFFF; * * NiFpga_Irq_3 | NiFpga_Irq_23 */ -typedef enum -{ - NiFpga_Irq_0 = 1 << 0, - NiFpga_Irq_1 = 1 << 1, - NiFpga_Irq_2 = 1 << 2, - NiFpga_Irq_3 = 1 << 3, - NiFpga_Irq_4 = 1 << 4, - NiFpga_Irq_5 = 1 << 5, - NiFpga_Irq_6 = 1 << 6, - NiFpga_Irq_7 = 1 << 7, - NiFpga_Irq_8 = 1 << 8, - NiFpga_Irq_9 = 1 << 9, - NiFpga_Irq_10 = 1 << 10, - NiFpga_Irq_11 = 1 << 11, - NiFpga_Irq_12 = 1 << 12, - NiFpga_Irq_13 = 1 << 13, - NiFpga_Irq_14 = 1 << 14, - NiFpga_Irq_15 = 1 << 15, - NiFpga_Irq_16 = 1 << 16, - NiFpga_Irq_17 = 1 << 17, - NiFpga_Irq_18 = 1 << 18, - NiFpga_Irq_19 = 1 << 19, - NiFpga_Irq_20 = 1 << 20, - NiFpga_Irq_21 = 1 << 21, - NiFpga_Irq_22 = 1 << 22, - NiFpga_Irq_23 = 1 << 23, - NiFpga_Irq_24 = 1 << 24, - NiFpga_Irq_25 = 1 << 25, - NiFpga_Irq_26 = 1 << 26, - NiFpga_Irq_27 = 1 << 27, - NiFpga_Irq_28 = 1 << 28, - NiFpga_Irq_29 = 1 << 29, - NiFpga_Irq_30 = 1 << 30, - NiFpga_Irq_31 = 1U << 31 +typedef enum { + NiFpga_Irq_0 = 1 << 0, + NiFpga_Irq_1 = 1 << 1, + NiFpga_Irq_2 = 1 << 2, + NiFpga_Irq_3 = 1 << 3, + NiFpga_Irq_4 = 1 << 4, + NiFpga_Irq_5 = 1 << 5, + NiFpga_Irq_6 = 1 << 6, + NiFpga_Irq_7 = 1 << 7, + NiFpga_Irq_8 = 1 << 8, + NiFpga_Irq_9 = 1 << 9, + NiFpga_Irq_10 = 1 << 10, + NiFpga_Irq_11 = 1 << 11, + NiFpga_Irq_12 = 1 << 12, + NiFpga_Irq_13 = 1 << 13, + NiFpga_Irq_14 = 1 << 14, + NiFpga_Irq_15 = 1 << 15, + NiFpga_Irq_16 = 1 << 16, + NiFpga_Irq_17 = 1 << 17, + NiFpga_Irq_18 = 1 << 18, + NiFpga_Irq_19 = 1 << 19, + NiFpga_Irq_20 = 1 << 20, + NiFpga_Irq_21 = 1 << 21, + NiFpga_Irq_22 = 1 << 22, + NiFpga_Irq_23 = 1 << 23, + NiFpga_Irq_24 = 1 << 24, + NiFpga_Irq_25 = 1 << 25, + NiFpga_Irq_26 = 1 << 26, + NiFpga_Irq_27 = 1 << 27, + NiFpga_Irq_28 = 1 << 28, + NiFpga_Irq_29 = 1 << 29, + NiFpga_Irq_30 = 1 << 30, + NiFpga_Irq_31 = 1U << 31 } NiFpga_Irq; /** * See NiFpga_ReserveIrqContext for more information. */ -typedef void *NiFpga_IrqContext; +typedef void* NiFpga_IrqContext; /** * IRQ contexts are single-threaded; only one thread can wait with a @@ -2197,8 +2040,7 @@ typedef void *NiFpga_IrqContext; * @param context outputs the IRQ context * @return result of the call */ -NiFpga_Status NiFpga_ReserveIrqContext(NiFpga_Session session, - NiFpga_IrqContext* context); +NiFpga_Status NiFpga_ReserveIrqContext(NiFpga_Session session, NiFpga_IrqContext* context); /** * Unreserves an IRQ context obtained from NiFpga_ReserveIrqContext. @@ -2207,8 +2049,7 @@ NiFpga_Status NiFpga_ReserveIrqContext(NiFpga_Session session, * @param context IRQ context to unreserve * @return result of the call */ -NiFpga_Status NiFpga_UnreserveIrqContext(NiFpga_Session session, - NiFpga_IrqContext context); +NiFpga_Status NiFpga_UnreserveIrqContext(NiFpga_Session session, NiFpga_IrqContext context); /** * This is a blocking function that stops the calling thread until the @@ -2229,12 +2070,8 @@ NiFpga_Status NiFpga_UnreserveIrqContext(NiFpga_Session session, * @param timedOut if non-NULL, outputs whether the timeout expired * @return result of the call */ -NiFpga_Status NiFpga_WaitOnIrqs(NiFpga_Session session, - NiFpga_IrqContext context, - uint32_t irqs, - uint32_t timeout, - uint32_t* irqsAsserted, - NiFpga_Bool* timedOut); +NiFpga_Status NiFpga_WaitOnIrqs(NiFpga_Session session, NiFpga_IrqContext context, uint32_t irqs, + uint32_t timeout, uint32_t* irqsAsserted, NiFpga_Bool* timedOut); /** * Acknowledges an IRQ or set of IRQs. @@ -2243,8 +2080,7 @@ NiFpga_Status NiFpga_WaitOnIrqs(NiFpga_Session session, * @param irqs bitwise OR of NiFpga_Irqs * @return result of the call */ -NiFpga_Status NiFpga_AcknowledgeIrqs(NiFpga_Session session, - uint32_t irqs); +NiFpga_Status NiFpga_AcknowledgeIrqs(NiFpga_Session session, uint32_t irqs); /** * @} @@ -2265,9 +2101,7 @@ NiFpga_Status NiFpga_AcknowledgeIrqs(NiFpga_Session session, * DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ConfigureFifo(NiFpga_Session session, - uint32_t fifo, - size_t depth); +NiFpga_Status NiFpga_ConfigureFifo(NiFpga_Session session, uint32_t fifo, size_t depth); /** * Specifies the depth of the host memory part of the DMA FIFO. This method is @@ -2282,10 +2116,8 @@ NiFpga_Status NiFpga_ConfigureFifo(NiFpga_Session session, * the requested number * @return result of the call */ -NiFpga_Status NiFpga_ConfigureFifo2(NiFpga_Session session, - uint32_t fifo, - size_t requestedDepth, - size_t* actualDepth); +NiFpga_Status NiFpga_ConfigureFifo2(NiFpga_Session session, uint32_t fifo, size_t requestedDepth, + size_t* actualDepth); /** * @} @@ -2300,192 +2132,186 @@ NiFpga_Status NiFpga_ConfigureFifo2(NiFpga_Session session, * supported on Pharlap. */ #if NiFpga_Linux || NiFpga_Windows || NiFpga_MacOsX -typedef enum -{ - /** - * BytesPerElement - * - * Type: U32 - * - * Specifies the number of bytes in a single element of the FIFO. Other - * FIFO Buffer related properties are specified in number of elements, so - * this property can be used to convert that number to a number of bytes. - * - * This property is only Getable and cannot be Set. - */ - NiFpga_FifoProperty_BytesPerElement = 1, - /** - * HostBufferAllocationGranularity - * - * Type: U32 - * - * Specifies the smallest discreet allocation unit that the HostBufferSize - * will be coerced too. By default, this value will be set to the most - * optimized setting for your hardware and system. This usually ends up - * being the system's page size. The only valid values for this property - * are powers of 2. - */ - NiFpga_FifoProperty_HostBufferAllocationGranularity = 2, - /** - * HostBufferSize - * - * Type: U64 - * - * The number of elements in the host memory part of the DMA FIFO. This size - * will be coerced to be a multiple of the HostBufferAllocationGranularity. - */ - NiFpga_FifoProperty_HostBufferSize = 3, - /** - * HostBufferMirrorSize - * - * Type: U64 - * - * Specifies the number of elements mirrored at the end of the host memory - * part of the DMA FIFO. By mirrored, we mean that the memory is mapped in - * such a way that these elements point to the same physical memory as the - * elements at the beginning of the host memory part of the DMA FIFO. - * - * Setting up memory like this improves use with the AcquireFifoElements API. - * When using AcquireFifoElements, you can hit the end of the buffer and - * recieve less elements than you attempted to acquire. This requires a - * second AcquireFifoElements call to get the remaining elements. - * Mirroring Elements avoids that second call. - * - * Example: - * ======== - * **Behavior without Mirrored Elements**: - * - * This is a Target to Host FIFO of 10 elements: - * - * 0-1-2-3-4-5-6-7-8-9 - * ^ - * Current FIFO pointer here. - * - * 1. Acquire, use and Release 7 elements. - * - * 0-1-2-3-4-5-6-7-8-9 - * ^ - * Current FIFO pointer here. - * - * 2. The device writes to those 7 elements, filling up the FIFO. - * 3. Attempt to acquire 7 elements, get back 3 because we can only give a - * pointer to 3 elements. - * - * **Behavior with Mirrored Elements**: - * - * If instead we had mirrored 4 elements, it would act like this. - * - * 0-1-2-3-4-5-6-7-8-9{0-1-2-3} - * ^ ^mirrored elements - * Current FIFO pointer here. - * - * 1. Acquire, use and Release 7 elements. - * - * 0-1-2-3-4-5-6-7-8-9{0-1-2-3} - * ^ ^mirrored elements - * Current FIFO pointer here. - * - * 2. The device writes to those 7 elements, filling up the FIFO. - * 3. Acquire, use and Release 7 elements. No problems are encountered - * because the driver gives back a pointer to the 7 elements requested. - */ - NiFpga_FifoProperty_HostBufferMirrorSize = 4, - /** - * HostBufferType - * - * Type: I32 - * - * Specifies the type of memory used in the host memory part of the DMA FIFO. - * See NiFpga_HostBufferType for the valid values of this property. - */ - NiFpga_FifoProperty_HostBufferType = 5, - /** - * HostBuffer - * - * Type: Ptr - * - * Specifies a pointer to the start of the host memory part of the DMA FIFO. - * Can only be set if the HostBufferType is set to - * NiFpga_HostBufferType_AllocatedByUser. - * - * Note, if the buffer is user supplied, the buffer will be pagelocked - * by the driver. When the user has finished with the buffer, the user must - * do one of the following before deallocating the buffer: - * 1. Call NiFpga_Close on the NiFpga_Session - * 2. Set the buffer type to NiFpga_HostBufferType_AllocatedByRIO and call - * NiFpga_CommitFifoConfiguration. - * 3. Set the NiFpga_FifoProperty_HostBuffer to a different buffer. - * 4. End the process. - */ - NiFpga_FifoProperty_HostBuffer= 6, - /** - * FlowControl - * - * Type: I32 - * - * Specifies the flow control behavior of the DMA FIFO. - * See NiFpga_FifoFlowControl for specifics on the behaviors. - * Note, changing the behavior of a FIFO can make it work in a non-"first in - * first out" manner. - */ - NiFpga_FifoProperty_FlowControl = 7, - /** - * ElementsCurrentlyAcquired - * - * Type: U64 - * - * Specifies the number of elements that are currently acquired by the user - * using the NiFpga_AcquireFifoReadElements* functions that have not yet - * been released. - * - * This property is only Getable and cannot be Set. - */ - NiFpga_FifoProperty_ElementsCurrentlyAcquired = 8 +typedef enum { + /** + * BytesPerElement + * + * Type: U32 + * + * Specifies the number of bytes in a single element of the FIFO. Other + * FIFO Buffer related properties are specified in number of elements, so + * this property can be used to convert that number to a number of bytes. + * + * This property is only Getable and cannot be Set. + */ + NiFpga_FifoProperty_BytesPerElement = 1, + /** + * HostBufferAllocationGranularity + * + * Type: U32 + * + * Specifies the smallest discreet allocation unit that the HostBufferSize + * will be coerced too. By default, this value will be set to the most + * optimized setting for your hardware and system. This usually ends up + * being the system's page size. The only valid values for this property + * are powers of 2. + */ + NiFpga_FifoProperty_HostBufferAllocationGranularity = 2, + /** + * HostBufferSize + * + * Type: U64 + * + * The number of elements in the host memory part of the DMA FIFO. This size + * will be coerced to be a multiple of the HostBufferAllocationGranularity. + */ + NiFpga_FifoProperty_HostBufferSize = 3, + /** + * HostBufferMirrorSize + * + * Type: U64 + * + * Specifies the number of elements mirrored at the end of the host memory + * part of the DMA FIFO. By mirrored, we mean that the memory is mapped in + * such a way that these elements point to the same physical memory as the + * elements at the beginning of the host memory part of the DMA FIFO. + * + * Setting up memory like this improves use with the AcquireFifoElements API. + * When using AcquireFifoElements, you can hit the end of the buffer and + * recieve less elements than you attempted to acquire. This requires a + * second AcquireFifoElements call to get the remaining elements. + * Mirroring Elements avoids that second call. + * + * Example: + * ======== + * **Behavior without Mirrored Elements**: + * + * This is a Target to Host FIFO of 10 elements: + * + * 0-1-2-3-4-5-6-7-8-9 + * ^ + * Current FIFO pointer here. + * + * 1. Acquire, use and Release 7 elements. + * + * 0-1-2-3-4-5-6-7-8-9 + * ^ + * Current FIFO pointer here. + * + * 2. The device writes to those 7 elements, filling up the FIFO. + * 3. Attempt to acquire 7 elements, get back 3 because we can only give a + * pointer to 3 elements. + * + * **Behavior with Mirrored Elements**: + * + * If instead we had mirrored 4 elements, it would act like this. + * + * 0-1-2-3-4-5-6-7-8-9{0-1-2-3} + * ^ ^mirrored elements + * Current FIFO pointer here. + * + * 1. Acquire, use and Release 7 elements. + * + * 0-1-2-3-4-5-6-7-8-9{0-1-2-3} + * ^ ^mirrored elements + * Current FIFO pointer here. + * + * 2. The device writes to those 7 elements, filling up the FIFO. + * 3. Acquire, use and Release 7 elements. No problems are encountered + * because the driver gives back a pointer to the 7 elements requested. + */ + NiFpga_FifoProperty_HostBufferMirrorSize = 4, + /** + * HostBufferType + * + * Type: I32 + * + * Specifies the type of memory used in the host memory part of the DMA FIFO. + * See NiFpga_HostBufferType for the valid values of this property. + */ + NiFpga_FifoProperty_HostBufferType = 5, + /** + * HostBuffer + * + * Type: Ptr + * + * Specifies a pointer to the start of the host memory part of the DMA FIFO. + * Can only be set if the HostBufferType is set to + * NiFpga_HostBufferType_AllocatedByUser. + * + * Note, if the buffer is user supplied, the buffer will be pagelocked + * by the driver. When the user has finished with the buffer, the user must + * do one of the following before deallocating the buffer: + * 1. Call NiFpga_Close on the NiFpga_Session + * 2. Set the buffer type to NiFpga_HostBufferType_AllocatedByRIO and call + * NiFpga_CommitFifoConfiguration. + * 3. Set the NiFpga_FifoProperty_HostBuffer to a different buffer. + * 4. End the process. + */ + NiFpga_FifoProperty_HostBuffer = 6, + /** + * FlowControl + * + * Type: I32 + * + * Specifies the flow control behavior of the DMA FIFO. + * See NiFpga_FifoFlowControl for specifics on the behaviors. + * Note, changing the behavior of a FIFO can make it work in a non-"first in + * first out" manner. + */ + NiFpga_FifoProperty_FlowControl = 7, + /** + * ElementsCurrentlyAcquired + * + * Type: U64 + * + * Specifies the number of elements that are currently acquired by the user + * using the NiFpga_AcquireFifoReadElements* functions that have not yet + * been released. + * + * This property is only Getable and cannot be Set. + */ + NiFpga_FifoProperty_ElementsCurrentlyAcquired = 8 } NiFpga_FifoProperty; -typedef enum -{ - /** - * Specifies that the DMA Buffer will be allocated by the NI-RIO driver - * according to the options specified in the other FIFO properties. - */ - NiFpga_HostBufferType_AllocatedByRIO = 1, - /** - * Specifies that the user has allocated the FIFO to the options specified - * in the other FIFO properties. After setting this property, the user - * should set NiFpga_FifoProperty_HostBuffer to their specified buffer. - */ - NiFpga_HostBufferType_AllocatedByUser = 2 +typedef enum { + /** + * Specifies that the DMA Buffer will be allocated by the NI-RIO driver + * according to the options specified in the other FIFO properties. + */ + NiFpga_HostBufferType_AllocatedByRIO = 1, + /** + * Specifies that the user has allocated the FIFO to the options specified + * in the other FIFO properties. After setting this property, the user + * should set NiFpga_FifoProperty_HostBuffer to their specified buffer. + */ + NiFpga_HostBufferType_AllocatedByUser = 2 } NiFpga_HostBufferType; -typedef enum -{ - /** - * When this option is specified, the FPGA will fully control data transfer - * without any action from the host. FIFOs will no longer act in a first - * in first out manner. It is up to the user to synchronize with the FPGA - * and ensure coherent data. - * - * For Target To Host FIFOs, data will being transferring on StartFifo. - * For Host To Target FIFOs, data will begin transferring when the entire - * host part of the DMA FIFO has been written once. This is intended to - * prevent the FPGA from reading garbage data from an uninitialized buffer - * on the host. - */ - NiFpga_FifoFlowControl_Disabled = 1, - /** - * This is the default options for FIFOs. When this option is specified, - * FIFOs act with First In First Out behavior and no data is ever lost. - * Data will stop transferring if the host memory part of the FIFO becomes - * full rather than overwriting it. - */ - NiFpga_FifoFlowControl_Enabled = 2 +typedef enum { + /** + * When this option is specified, the FPGA will fully control data transfer + * without any action from the host. FIFOs will no longer act in a first + * in first out manner. It is up to the user to synchronize with the FPGA + * and ensure coherent data. + * + * For Target To Host FIFOs, data will being transferring on StartFifo. + * For Host To Target FIFOs, data will begin transferring when the entire + * host part of the DMA FIFO has been written once. This is intended to + * prevent the FPGA from reading garbage data from an uninitialized buffer + * on the host. + */ + NiFpga_FifoFlowControl_Disabled = 1, + /** + * This is the default options for FIFOs. When this option is specified, + * FIFOs act with First In First Out behavior and no data is ever lost. + * Data will stop transferring if the host memory part of the FIFO becomes + * full rather than overwriting it. + */ + NiFpga_FifoFlowControl_Enabled = 2 } NiFpga_FifoFlowControl; #else -typedef enum -{ - NiFpga_FifoProperty_NotSupported -} NiFpga_FifoProperty; +typedef enum { NiFpga_FifoProperty_NotSupported } NiFpga_FifoProperty; #endif /* NiFpga_Linux || NiFpga_Windows || NiFpga_MacOsX */ /** @@ -2499,10 +2325,8 @@ typedef enum * @param value the desired value of the property * @return result of the call */ -NiFpga_Status NiFpga_SetFifoPropertyU32(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint32_t value); +NiFpga_Status NiFpga_SetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + uint32_t value); /** * Sets the specified I32 FIFO property to the requested value. The specified @@ -2515,10 +2339,8 @@ NiFpga_Status NiFpga_SetFifoPropertyU32(NiFpga_Session session, * @param value the desired value of the property * @return result of the call */ -NiFpga_Status NiFpga_SetFifoPropertyI32(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int32_t value); +NiFpga_Status NiFpga_SetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + int32_t value); /** * Sets the specified U64 FIFO property to the requested value. The specified @@ -2531,10 +2353,8 @@ NiFpga_Status NiFpga_SetFifoPropertyI32(NiFpga_Session session, * @param value the desired value of the property * @return result of the call */ -NiFpga_Status NiFpga_SetFifoPropertyU64(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint64_t value); +NiFpga_Status NiFpga_SetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + uint64_t value); /** * Sets the specified I64 FIFO property to the requested value. The specified @@ -2547,10 +2367,8 @@ NiFpga_Status NiFpga_SetFifoPropertyU64(NiFpga_Session session, * @param value the desired value of the property * @return result of the call */ -NiFpga_Status NiFpga_SetFifoPropertyI64(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int64_t value); +NiFpga_Status NiFpga_SetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + int64_t value); /** * Sets the specified pointer FIFO property to the requested value. The @@ -2563,10 +2381,8 @@ NiFpga_Status NiFpga_SetFifoPropertyI64(NiFpga_Session session, * @param value the desired value of the property * @return result of the call */ -NiFpga_Status NiFpga_SetFifoPropertyPtr(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - void* value); +NiFpga_Status NiFpga_SetFifoPropertyPtr(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + void* value); /** * Gets the value of the specified U32 FIFO property. The value returned may be @@ -2578,10 +2394,8 @@ NiFpga_Status NiFpga_SetFifoPropertyPtr(NiFpga_Session session, * @param value the actual value of the property * @return result of the call */ -NiFpga_Status NiFpga_GetFifoPropertyU32(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint32_t* value); +NiFpga_Status NiFpga_GetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + uint32_t* value); /** * Gets the value of the specified I32 FIFO property. The value returned may be @@ -2593,10 +2407,8 @@ NiFpga_Status NiFpga_GetFifoPropertyU32(NiFpga_Session session, * @param value the actual value of the property * @return result of the call */ -NiFpga_Status NiFpga_GetFifoPropertyI32(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int32_t* value); +NiFpga_Status NiFpga_GetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + int32_t* value); /** * Gets the value of the specified U64 FIFO property. The value returned may be @@ -2608,10 +2420,8 @@ NiFpga_Status NiFpga_GetFifoPropertyI32(NiFpga_Session session, * @param value the actual value of the property * @return result of the call */ -NiFpga_Status NiFpga_GetFifoPropertyU64(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - uint64_t* value); +NiFpga_Status NiFpga_GetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + uint64_t* value); /** * Gets the value of the specified I64 FIFO property. The value returned may be @@ -2623,10 +2433,8 @@ NiFpga_Status NiFpga_GetFifoPropertyU64(NiFpga_Session session, * @param value the actual value of the property * @return result of the call */ -NiFpga_Status NiFpga_GetFifoPropertyI64(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - int64_t* value); +NiFpga_Status NiFpga_GetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + int64_t* value); /** * Gets the value of the specified pointer FIFO property. The value returned may @@ -2638,10 +2446,8 @@ NiFpga_Status NiFpga_GetFifoPropertyI64(NiFpga_Session session, * @param value the actual value of the property * @return result of the call */ -NiFpga_Status NiFpga_GetFifoPropertyPtr(NiFpga_Session session, - uint32_t fifo, - NiFpga_FifoProperty property, - void** value); +NiFpga_Status NiFpga_GetFifoPropertyPtr(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, + void** value); /** * Commits the configuration of the FIFO. Resolves the host memory part of the @@ -2652,8 +2458,7 @@ NiFpga_Status NiFpga_GetFifoPropertyPtr(NiFpga_Session session, * @param fifo FIFO to commit configuration * @return result of the call */ -NiFpga_Status NiFpga_CommitFifoConfiguration(NiFpga_Session session, - uint32_t fifo); +NiFpga_Status NiFpga_CommitFifoConfiguration(NiFpga_Session session, uint32_t fifo); /** * @} */ @@ -2669,8 +2474,7 @@ NiFpga_Status NiFpga_CommitFifoConfiguration(NiFpga_Session session, * @param fifo FIFO to start * @return result of the call */ -NiFpga_Status NiFpga_StartFifo(NiFpga_Session session, - uint32_t fifo); +NiFpga_Status NiFpga_StartFifo(NiFpga_Session session, uint32_t fifo); /** * Stops a FIFO. This method is optional. @@ -2679,8 +2483,7 @@ NiFpga_Status NiFpga_StartFifo(NiFpga_Session session, * @param fifo FIFO to stop * @return result of the call */ -NiFpga_Status NiFpga_StopFifo(NiFpga_Session session, - uint32_t fifo); +NiFpga_Status NiFpga_StopFifo(NiFpga_Session session, uint32_t fifo); /** * Unreserves a FIFO. This method is optional. FIFOs are only usable in the @@ -2691,8 +2494,7 @@ NiFpga_Status NiFpga_StopFifo(NiFpga_Session session, * @param fifo FIFO to unreserve * @return result of the call */ -NiFpga_Status NiFpga_UnreserveFifo(NiFpga_Session session, - uint32_t fifo); +NiFpga_Status NiFpga_UnreserveFifo(NiFpga_Session session, uint32_t fifo); /** * @} @@ -2714,12 +2516,8 @@ NiFpga_Status NiFpga_UnreserveFifo(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoBool(NiFpga_Session session, - uint32_t fifo, - NiFpga_Bool* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoBool(NiFpga_Session session, uint32_t fifo, NiFpga_Bool* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining); /** * Reads from a target-to-host FIFO of signed 8-bit integers. @@ -2733,12 +2531,8 @@ NiFpga_Status NiFpga_ReadFifoBool(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoI8(NiFpga_Session session, - uint32_t fifo, - int8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoI8(NiFpga_Session session, uint32_t fifo, int8_t* data, size_t numberOfElements, + uint32_t timeout, size_t* elementsRemaining); /** * Reads from a target-to-host FIFO of unsigned 8-bit integers. @@ -2752,12 +2546,8 @@ NiFpga_Status NiFpga_ReadFifoI8(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoU8(NiFpga_Session session, - uint32_t fifo, - uint8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoU8(NiFpga_Session session, uint32_t fifo, uint8_t* data, size_t numberOfElements, + uint32_t timeout, size_t* elementsRemaining); /** * Reads from a target-to-host FIFO of signed 16-bit integers. @@ -2771,12 +2561,8 @@ NiFpga_Status NiFpga_ReadFifoU8(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoI16(NiFpga_Session session, - uint32_t fifo, - int16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoI16(NiFpga_Session session, uint32_t fifo, int16_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining); /** * Reads from a target-to-host FIFO of unsigned 16-bit integers. @@ -2790,12 +2576,8 @@ NiFpga_Status NiFpga_ReadFifoI16(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoU16(NiFpga_Session session, - uint32_t fifo, - uint16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoU16(NiFpga_Session session, uint32_t fifo, uint16_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining); /** * Reads from a target-to-host FIFO of signed 32-bit integers. @@ -2809,12 +2591,8 @@ NiFpga_Status NiFpga_ReadFifoU16(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoI32(NiFpga_Session session, - uint32_t fifo, - int32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoI32(NiFpga_Session session, uint32_t fifo, int32_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining); /** * Reads from a target-to-host FIFO of unsigned 32-bit integers. @@ -2828,12 +2606,8 @@ NiFpga_Status NiFpga_ReadFifoI32(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoU32(NiFpga_Session session, - uint32_t fifo, - uint32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoU32(NiFpga_Session session, uint32_t fifo, uint32_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining); /** * Reads from a target-to-host FIFO of signed 64-bit integers. @@ -2847,12 +2621,8 @@ NiFpga_Status NiFpga_ReadFifoU32(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoI64(NiFpga_Session session, - uint32_t fifo, - int64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoI64(NiFpga_Session session, uint32_t fifo, int64_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining); /** * Reads from a target-to-host FIFO of unsigned 64-bit integers. @@ -2866,12 +2636,8 @@ NiFpga_Status NiFpga_ReadFifoI64(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoU64(NiFpga_Session session, - uint32_t fifo, - uint64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoU64(NiFpga_Session session, uint32_t fifo, uint64_t* data, + size_t numberOfElements, uint32_t timeout, size_t* elementsRemaining); /** * Reads from a target-to-host FIFO of single-precision floating-point values. @@ -2885,12 +2651,8 @@ NiFpga_Status NiFpga_ReadFifoU64(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoSgl(NiFpga_Session session, - uint32_t fifo, - float* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoSgl(NiFpga_Session session, uint32_t fifo, float* data, size_t numberOfElements, + uint32_t timeout, size_t* elementsRemaining); /** * Reads from a target-to-host FIFO of double-precision floating-point values. @@ -2904,12 +2666,8 @@ NiFpga_Status NiFpga_ReadFifoSgl(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoDbl(NiFpga_Session session, - uint32_t fifo, - double* data, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoDbl(NiFpga_Session session, uint32_t fifo, double* data, size_t numberOfElements, + uint32_t timeout, size_t* elementsRemaining); /** * Reads from a target-to-host FIFO of composite types such as clusters. @@ -2924,13 +2682,9 @@ NiFpga_Status NiFpga_ReadFifoDbl(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_ReadFifoComposite(NiFpga_Session session, - uint32_t fifo, - void* data, - uint32_t bytesPerElement, - size_t numberOfElements, - uint32_t timeout, - size_t* elementsRemaining); +NiFpga_Status NiFpga_ReadFifoComposite(NiFpga_Session session, uint32_t fifo, void* data, + uint32_t bytesPerElement, size_t numberOfElements, uint32_t timeout, + size_t* elementsRemaining); /** * @} @@ -2953,12 +2707,8 @@ NiFpga_Status NiFpga_ReadFifoComposite(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoBool(NiFpga_Session session, - uint32_t fifo, - const NiFpga_Bool* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoBool(NiFpga_Session session, uint32_t fifo, const NiFpga_Bool* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining); /** * Writes to a host-to-target FIFO of signed 8-bit integers. @@ -2973,12 +2723,8 @@ NiFpga_Status NiFpga_WriteFifoBool(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoI8(NiFpga_Session session, - uint32_t fifo, - const int8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoI8(NiFpga_Session session, uint32_t fifo, const int8_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining); /** * Writes to a host-to-target FIFO of unsigned 8-bit integers. @@ -2993,12 +2739,8 @@ NiFpga_Status NiFpga_WriteFifoI8(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoU8(NiFpga_Session session, - uint32_t fifo, - const uint8_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoU8(NiFpga_Session session, uint32_t fifo, const uint8_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining); /** * Writes to a host-to-target FIFO of signed 16-bit integers. @@ -3013,12 +2755,8 @@ NiFpga_Status NiFpga_WriteFifoU8(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoI16(NiFpga_Session session, - uint32_t fifo, - const int16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoI16(NiFpga_Session session, uint32_t fifo, const int16_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining); /** * Writes to a host-to-target FIFO of unsigned 16-bit integers. @@ -3033,12 +2771,8 @@ NiFpga_Status NiFpga_WriteFifoI16(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoU16(NiFpga_Session session, - uint32_t fifo, - const uint16_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoU16(NiFpga_Session session, uint32_t fifo, const uint16_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining); /** * Writes to a host-to-target FIFO of signed 32-bit integers. @@ -3053,12 +2787,8 @@ NiFpga_Status NiFpga_WriteFifoU16(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoI32(NiFpga_Session session, - uint32_t fifo, - const int32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoI32(NiFpga_Session session, uint32_t fifo, const int32_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining); /** * Writes to a host-to-target FIFO of unsigned 32-bit integers. @@ -3073,12 +2803,8 @@ NiFpga_Status NiFpga_WriteFifoI32(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoU32(NiFpga_Session session, - uint32_t fifo, - const uint32_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoU32(NiFpga_Session session, uint32_t fifo, const uint32_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining); /** * Writes to a host-to-target FIFO of signed 64-bit integers. @@ -3093,12 +2819,8 @@ NiFpga_Status NiFpga_WriteFifoU32(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoI64(NiFpga_Session session, - uint32_t fifo, - const int64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoI64(NiFpga_Session session, uint32_t fifo, const int64_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining); /** * Writes to a host-to-target FIFO of unsigned 64-bit integers. @@ -3113,12 +2835,8 @@ NiFpga_Status NiFpga_WriteFifoI64(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoU64(NiFpga_Session session, - uint32_t fifo, - const uint64_t* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoU64(NiFpga_Session session, uint32_t fifo, const uint64_t* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining); /** * Writes to a host-to-target FIFO of single-precision floating-point values. @@ -3133,12 +2851,8 @@ NiFpga_Status NiFpga_WriteFifoU64(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoSgl(NiFpga_Session session, - uint32_t fifo, - const float* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoSgl(NiFpga_Session session, uint32_t fifo, const float* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining); /** * Writes to a host-to-target FIFO of double-precision floating-point values. @@ -3153,12 +2867,8 @@ NiFpga_Status NiFpga_WriteFifoSgl(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoDbl(NiFpga_Session session, - uint32_t fifo, - const double* data, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoDbl(NiFpga_Session session, uint32_t fifo, const double* data, + size_t numberOfElements, uint32_t timeout, size_t* emptyElementsRemaining); /** * Writes to a host-to-target FIFO of composite types such as clusters. @@ -3174,13 +2884,9 @@ NiFpga_Status NiFpga_WriteFifoDbl(NiFpga_Session session, * the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_WriteFifoComposite(NiFpga_Session session, - uint32_t fifo, - const void* data, - uint32_t bytesPerElement, - size_t numberOfElements, - uint32_t timeout, - size_t* emptyElementsRemaining); +NiFpga_Status NiFpga_WriteFifoComposite(NiFpga_Session session, uint32_t fifo, const void* data, + uint32_t bytesPerElement, size_t numberOfElements, uint32_t timeout, + size_t* emptyElementsRemaining); /** * @} @@ -3214,14 +2920,10 @@ NiFpga_Status NiFpga_WriteFifoComposite(NiFpga_Session session, * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoReadElementsBool( - NiFpga_Session session, - uint32_t fifo, - NiFpga_Bool** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoReadElementsBool(NiFpga_Session session, uint32_t fifo, + NiFpga_Bool** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, + size_t* elementsRemaining); /** * Acquires elements for reading from a target-to-host FIFO of signed 8-bit @@ -3248,14 +2950,9 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsBool( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoReadElementsI8( - NiFpga_Session session, - uint32_t fifo, - int8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoReadElementsI8(NiFpga_Session session, uint32_t fifo, int8_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for reading from a target-to-host FIFO of unsigned 8-bit @@ -3282,14 +2979,9 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsI8( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoReadElementsU8( - NiFpga_Session session, - uint32_t fifo, - uint8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoReadElementsU8(NiFpga_Session session, uint32_t fifo, uint8_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for reading from a target-to-host FIFO of signed 16-bit @@ -3316,14 +3008,9 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsU8( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoReadElementsI16( - NiFpga_Session session, - uint32_t fifo, - int16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoReadElementsI16(NiFpga_Session session, uint32_t fifo, int16_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for reading from a target-to-host FIFO of unsigned 16-bit @@ -3350,14 +3037,9 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsI16( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoReadElementsU16( - NiFpga_Session session, - uint32_t fifo, - uint16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoReadElementsU16(NiFpga_Session session, uint32_t fifo, uint16_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for reading from a target-to-host FIFO of signed 32-bit @@ -3384,14 +3066,9 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsU16( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoReadElementsI32( - NiFpga_Session session, - uint32_t fifo, - int32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoReadElementsI32(NiFpga_Session session, uint32_t fifo, int32_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for reading from a target-to-host FIFO of unsigned 32-bit @@ -3418,14 +3095,9 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsI32( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoReadElementsU32( - NiFpga_Session session, - uint32_t fifo, - uint32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoReadElementsU32(NiFpga_Session session, uint32_t fifo, uint32_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for reading from a target-to-host FIFO of signed 64-bit @@ -3452,14 +3124,9 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsU32( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoReadElementsI64( - NiFpga_Session session, - uint32_t fifo, - int64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoReadElementsI64(NiFpga_Session session, uint32_t fifo, int64_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for reading from a target-to-host FIFO of unsigned 64-bit @@ -3486,14 +3153,9 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsI64( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoReadElementsU64( - NiFpga_Session session, - uint32_t fifo, - uint64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoReadElementsU64(NiFpga_Session session, uint32_t fifo, uint64_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for reading from a target-to-host FIFO of single-precision @@ -3520,14 +3182,9 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsU64( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoReadElementsSgl( - NiFpga_Session session, - uint32_t fifo, - float** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoReadElementsSgl(NiFpga_Session session, uint32_t fifo, float** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for reading from a target-to-host FIFO of double-precision @@ -3554,14 +3211,9 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsSgl( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoReadElementsDbl( - NiFpga_Session session, - uint32_t fifo, - double** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoReadElementsDbl(NiFpga_Session session, uint32_t fifo, double** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * @} @@ -3595,14 +3247,10 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsDbl( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoWriteElementsBool( - NiFpga_Session session, - uint32_t fifo, - NiFpga_Bool** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoWriteElementsBool(NiFpga_Session session, uint32_t fifo, + NiFpga_Bool** elements, size_t elementsRequested, + uint32_t timeout, size_t* elementsAcquired, + size_t* elementsRemaining); /** * Acquires elements for writing to a host-to-target FIFO of signed 8-bit @@ -3629,14 +3277,9 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsBool( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoWriteElementsI8( - NiFpga_Session session, - uint32_t fifo, - int8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoWriteElementsI8(NiFpga_Session session, uint32_t fifo, int8_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for writing to a host-to-target FIFO of unsigned 8-bit @@ -3663,14 +3306,9 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsI8( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoWriteElementsU8( - NiFpga_Session session, - uint32_t fifo, - uint8_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoWriteElementsU8(NiFpga_Session session, uint32_t fifo, uint8_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for writing to a host-to-target FIFO of signed 16-bit @@ -3697,14 +3335,9 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsU8( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoWriteElementsI16( - NiFpga_Session session, - uint32_t fifo, - int16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoWriteElementsI16(NiFpga_Session session, uint32_t fifo, int16_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for writing to a host-to-target FIFO of unsigned 16-bit @@ -3731,14 +3364,9 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsI16( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoWriteElementsU16( - NiFpga_Session session, - uint32_t fifo, - uint16_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoWriteElementsU16(NiFpga_Session session, uint32_t fifo, uint16_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for writing to a host-to-target FIFO of signed 32-bit @@ -3765,14 +3393,9 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsU16( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoWriteElementsI32( - NiFpga_Session session, - uint32_t fifo, - int32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoWriteElementsI32(NiFpga_Session session, uint32_t fifo, int32_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for writing to a host-to-target FIFO of unsigned 32-bit @@ -3799,14 +3422,9 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsI32( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoWriteElementsU32( - NiFpga_Session session, - uint32_t fifo, - uint32_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoWriteElementsU32(NiFpga_Session session, uint32_t fifo, uint32_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for writing to a host-to-target FIFO of signed 64-bit @@ -3833,14 +3451,9 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsU32( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoWriteElementsI64( - NiFpga_Session session, - uint32_t fifo, - int64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoWriteElementsI64(NiFpga_Session session, uint32_t fifo, int64_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for writing to a host-to-target FIFO of unsigned 64-bit @@ -3867,14 +3480,9 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsI64( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoWriteElementsU64( - NiFpga_Session session, - uint32_t fifo, - uint64_t** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoWriteElementsU64(NiFpga_Session session, uint32_t fifo, uint64_t** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for writing to a host-to-target FIFO of single-precision @@ -3901,14 +3509,9 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsU64( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoWriteElementsSgl( - NiFpga_Session session, - uint32_t fifo, - float** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoWriteElementsSgl(NiFpga_Session session, uint32_t fifo, float** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * Acquires elements for writing to a host-to-target FIFO of single-precision @@ -3935,14 +3538,9 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsSgl( * remaining in the host memory part of the DMA FIFO * @return result of the call */ -NiFpga_Status NiFpga_AcquireFifoWriteElementsDbl( - NiFpga_Session session, - uint32_t fifo, - double** elements, - size_t elementsRequested, - uint32_t timeout, - size_t* elementsAcquired, - size_t* elementsRemaining); +NiFpga_Status NiFpga_AcquireFifoWriteElementsDbl(NiFpga_Session session, uint32_t fifo, double** elements, + size_t elementsRequested, uint32_t timeout, + size_t* elementsAcquired, size_t* elementsRemaining); /** * @} @@ -3965,9 +3563,7 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsDbl( * @param elements number of elements to release * @return result of the call */ -NiFpga_Status NiFpga_ReleaseFifoElements(NiFpga_Session session, - uint32_t fifo, - size_t elements); +NiFpga_Status NiFpga_ReleaseFifoElements(NiFpga_Session session, uint32_t fifo, size_t elements); /** * Gets an endpoint reference to a peer-to-peer FIFO. @@ -3979,9 +3575,7 @@ NiFpga_Status NiFpga_ReleaseFifoElements(NiFpga_Session session, * the NI Peer-to-Peer Streaming C/C++ API. * @return result of the call */ -NiFpga_Status NiFpga_GetPeerToPeerFifoEndpoint(NiFpga_Session session, - uint32_t fifo, - uint32_t* endpoint); +NiFpga_Status NiFpga_GetPeerToPeerFifoEndpoint(NiFpga_Session session, uint32_t fifo, uint32_t* endpoint); /** * Maps the write window of a peer-to-peer reader FIFO. @@ -4000,10 +3594,8 @@ NiFpga_Status NiFpga_GetPeerToPeerFifoEndpoint(NiFpga_Session session, * @param virtualAddress Outputs the base address of the mapped region. * @return result of the call */ -NiFpga_Status NiFpga_MapP2PSinkFifo(const NiFpga_Session session, - const uint32_t fifo, - size_t* size, - void** virtualAddress); +NiFpga_Status NiFpga_MapP2PSinkFifo(const NiFpga_Session session, const uint32_t fifo, size_t* size, + void** virtualAddress); /** * Unmaps the write window of a peer-to-peer reader FIFO. @@ -4011,8 +3603,7 @@ NiFpga_Status NiFpga_MapP2PSinkFifo(const NiFpga_Session session, * @param session handle used to map the FIFO * @param fifo peer-to-peer Sink FIFO */ -NiFpga_Status NiFpga_UnmapP2PSinkFifo(const NiFpga_Session session, - const uint32_t fifo); +NiFpga_Status NiFpga_UnmapP2PSinkFifo(const NiFpga_Session session, const uint32_t fifo); /** * Open a Host Memory Buffer @@ -4028,10 +3619,8 @@ NiFpga_Status NiFpga_UnmapP2PSinkFifo(const NiFpga_Session session, * @param virtualAddress Outputs the base address of the mapped region. * @return result of the call */ -NiFpga_Status NiFpga_OpenHostMemoryBuffer(const NiFpga_Session session, - const char* memoryName, - size_t* memorySize, - void** virtualAddress); +NiFpga_Status NiFpga_OpenHostMemoryBuffer(const NiFpga_Session session, const char* memoryName, + size_t* memorySize, void** virtualAddress); /** * Unmaps and closes the Host Memory Buffer @@ -4039,8 +3628,7 @@ NiFpga_Status NiFpga_OpenHostMemoryBuffer(const NiFpga_Session session, * @param session handle used to open the HMB * @param memoryName Name given to the memory in the FPGA target */ -NiFpga_Status NiFpga_CloseHostMemoryBuffer(const NiFpga_Session session, - const char* memoryName); +NiFpga_Status NiFpga_CloseHostMemoryBuffer(const NiFpga_Session session, const char* memoryName); /** * Open a Low Latency Buffer @@ -4061,12 +3649,9 @@ NiFpga_Status NiFpga_CloseHostMemoryBuffer(const NiFpga_Session session, * @param virtualAddressToFpga Outputs the base address of the mapped region the Host writes to the FPGA. * @return result of the call */ -NiFpga_Status NiFpga_OpenLowLatencyBuffer(const NiFpga_Session session, - const char* memoryName, - size_t* memorySizeToHost, - void** virtualAddressToHost, - size_t* memorySizeToFpga, - void** virtualAddressToFpga); +NiFpga_Status NiFpga_OpenLowLatencyBuffer(const NiFpga_Session session, const char* memoryName, + size_t* memorySizeToHost, void** virtualAddressToHost, + size_t* memorySizeToFpga, void** virtualAddressToFpga); /** * Unmaps and closes the Low Latency Buffer @@ -4074,8 +3659,7 @@ NiFpga_Status NiFpga_OpenLowLatencyBuffer(const NiFpga_Session session, * @param session handle used to open the LLB * @param memoryName Name given to the memory in the FPGA target */ -NiFpga_Status NiFpga_CloseLowLatencyBuffer(const NiFpga_Session session, - const char* memoryName); +NiFpga_Status NiFpga_CloseLowLatencyBuffer(const NiFpga_Session session, const char* memoryName); /** * @} diff --git a/src/NiFpga/NiFpga_VMS_CameraRotator_Controller.h b/src/NiFpga/NiFpga_VMS_CameraRotator_Controller.h index a4533fb..b1c3901 100644 --- a/src/NiFpga/NiFpga_VMS_CameraRotator_Controller.h +++ b/src/NiFpga/NiFpga_VMS_CameraRotator_Controller.h @@ -6,7 +6,7 @@ #define __NiFpga_VMS_CameraRotator_Controller_h__ #ifndef NiFpga_Version - #define NiFpga_Version 230 +#define NiFpga_Version 230 #endif #include "NiFpga.h" @@ -26,56 +26,43 @@ static const char* const NiFpga_VMS_CameraRotator_Controller_Signature = "169D4461AEDED1E13CA9524BF84BFE18"; #if NiFpga_Cpp -extern "C" -{ +extern "C" { #endif -typedef enum -{ - NiFpga_VMS_CameraRotator_Controller_IndicatorBool_FIFOfull = 0x1803A, - NiFpga_VMS_CameraRotator_Controller_IndicatorBool_Ready = 0x1802E, - NiFpga_VMS_CameraRotator_Controller_IndicatorBool_Stopped = 0x1801E, - NiFpga_VMS_CameraRotator_Controller_IndicatorBool_Timeouted = 0x1802A +typedef enum { + NiFpga_VMS_CameraRotator_Controller_IndicatorBool_FIFOfull = 0x1803A, + NiFpga_VMS_CameraRotator_Controller_IndicatorBool_Ready = 0x1802E, + NiFpga_VMS_CameraRotator_Controller_IndicatorBool_Stopped = 0x1801E, + NiFpga_VMS_CameraRotator_Controller_IndicatorBool_Timeouted = 0x1802A } NiFpga_VMS_CameraRotator_Controller_IndicatorBool; -typedef enum -{ - NiFpga_VMS_CameraRotator_Controller_IndicatorU64_Ticks = 0x18034 +typedef enum { + NiFpga_VMS_CameraRotator_Controller_IndicatorU64_Ticks = 0x18034 } NiFpga_VMS_CameraRotator_Controller_IndicatorU64; -typedef enum -{ - NiFpga_VMS_CameraRotator_Controller_ControlBool_Operate = 0x1801A +typedef enum { + NiFpga_VMS_CameraRotator_Controller_ControlBool_Operate = 0x1801A } NiFpga_VMS_CameraRotator_Controller_ControlBool; -typedef enum -{ - NiFpga_VMS_CameraRotator_Controller_ControlI16_Outputtype = 0x18022 +typedef enum { + NiFpga_VMS_CameraRotator_Controller_ControlI16_Outputtype = 0x18022 } NiFpga_VMS_CameraRotator_Controller_ControlI16; -typedef enum -{ - NiFpga_VMS_CameraRotator_Controller_ControlU32_Periodms = 0x18024 +typedef enum { + NiFpga_VMS_CameraRotator_Controller_ControlU32_Periodms = 0x18024 } NiFpga_VMS_CameraRotator_Controller_ControlU32; -typedef enum -{ - NiFpga_VMS_CameraRotator_Controller_TargetToHostFifoU32_ResponseFIFO = 0 +typedef enum { + NiFpga_VMS_CameraRotator_Controller_TargetToHostFifoU32_ResponseFIFO = 0 } NiFpga_VMS_CameraRotator_Controller_TargetToHostFifoU32; /* Indicator: ChassisTemperature */ static const NiFpga_FxpTypeInfo NiFpga_VMS_CameraRotator_Controller_IndicatorFxp_ChassisTemperature_TypeInfo = -{ - 1, - 32, - 16 -}; + {1, 32, 16}; /* Use NiFpga_ReadU32() to access ChassisTemperature */ static const uint32_t NiFpga_VMS_CameraRotator_Controller_IndicatorFxp_ChassisTemperature_Resource = 0x18030; - - #if NiFpga_Cpp } #endif diff --git a/src/NiFpga/NiFpga_VMS_CameraRotator_Responder.h b/src/NiFpga/NiFpga_VMS_CameraRotator_Responder.h index 3d1e51f..90d144d 100644 --- a/src/NiFpga/NiFpga_VMS_CameraRotator_Responder.h +++ b/src/NiFpga/NiFpga_VMS_CameraRotator_Responder.h @@ -6,7 +6,7 @@ #define __NiFpga_VMS_CameraRotator_Responder_h__ #ifndef NiFpga_Version - #define NiFpga_Version 230 +#define NiFpga_Version 230 #endif #include "NiFpga.h" @@ -26,51 +26,39 @@ static const char* const NiFpga_VMS_CameraRotator_Responder_Signature = "7DE6F668C4E3253A35E00FFC6AA3703F"; #if NiFpga_Cpp -extern "C" -{ +extern "C" { #endif -typedef enum -{ - NiFpga_VMS_CameraRotator_Responder_IndicatorBool_FIFOfull = 0x18032, - NiFpga_VMS_CameraRotator_Responder_IndicatorBool_Ready = 0x18026, - NiFpga_VMS_CameraRotator_Responder_IndicatorBool_Stopped = 0x1801A, - NiFpga_VMS_CameraRotator_Responder_IndicatorBool_Timeouted = 0x1801E +typedef enum { + NiFpga_VMS_CameraRotator_Responder_IndicatorBool_FIFOfull = 0x18032, + NiFpga_VMS_CameraRotator_Responder_IndicatorBool_Ready = 0x18026, + NiFpga_VMS_CameraRotator_Responder_IndicatorBool_Stopped = 0x1801A, + NiFpga_VMS_CameraRotator_Responder_IndicatorBool_Timeouted = 0x1801E } NiFpga_VMS_CameraRotator_Responder_IndicatorBool; -typedef enum -{ - NiFpga_VMS_CameraRotator_Responder_IndicatorU64_Ticks = 0x18020 +typedef enum { + NiFpga_VMS_CameraRotator_Responder_IndicatorU64_Ticks = 0x18020 } NiFpga_VMS_CameraRotator_Responder_IndicatorU64; -typedef enum -{ - NiFpga_VMS_CameraRotator_Responder_ControlI16_Outputtype = 0x1802E +typedef enum { + NiFpga_VMS_CameraRotator_Responder_ControlI16_Outputtype = 0x1802E } NiFpga_VMS_CameraRotator_Responder_ControlI16; -typedef enum -{ - NiFpga_VMS_CameraRotator_Responder_ControlU32_Periodms = 0x18028 +typedef enum { + NiFpga_VMS_CameraRotator_Responder_ControlU32_Periodms = 0x18028 } NiFpga_VMS_CameraRotator_Responder_ControlU32; -typedef enum -{ - NiFpga_VMS_CameraRotator_Responder_TargetToHostFifoU32_ResponseFIFO = 0 +typedef enum { + NiFpga_VMS_CameraRotator_Responder_TargetToHostFifoU32_ResponseFIFO = 0 } NiFpga_VMS_CameraRotator_Responder_TargetToHostFifoU32; /* Indicator: ChassisTemperature */ static const NiFpga_FxpTypeInfo NiFpga_VMS_CameraRotator_Responder_IndicatorFxp_ChassisTemperature_TypeInfo = -{ - 1, - 32, - 16 -}; + {1, 32, 16}; /* Use NiFpga_ReadU32() to access ChassisTemperature */ static const uint32_t NiFpga_VMS_CameraRotator_Responder_IndicatorFxp_ChassisTemperature_Resource = 0x18034; - - #if NiFpga_Cpp } #endif diff --git a/src/ts-VMSd.cpp b/src/ts-VMSd.cpp index 2bec8b4..7913d62 100644 --- a/src/ts-VMSd.cpp +++ b/src/ts-VMSd.cpp @@ -31,13 +31,13 @@ #include #include -#include #include #include #include #include #include #include +#include #include #include #include @@ -64,7 +64,7 @@ class MTVMSd : public LSST::cRIO::CSC { // SAL object to receive all events from other VMS std::shared_ptr _allvmsSAL; - Accelerometer *accelerometer; + SALAccelerometer *accelerometer; }; SALSinkMacro(MTVMS); @@ -124,7 +124,7 @@ void MTVMSd::init() { // spdlog::apply_all([&](std::shared_ptr l) { l->flush(); }); - accelerometer = new Accelerometer(&_vmsApplicationSettings); + accelerometer = new SALAccelerometer(&_vmsApplicationSettings); SPDLOG_INFO("Main: Setting publisher"); VMSPublisher::instance().setSAL(_vmsSAL); diff --git a/src/vmscli.cpp b/src/vmscli.cpp new file mode 100644 index 0000000..2d340f6 --- /dev/null +++ b/src/vmscli.cpp @@ -0,0 +1,159 @@ +/* + * Command line Vibration Monitoring System client. + * + * Developed for the Vera C. Rubin Observatory Telescope & Site Software Systems. + * This product includes software developed by the Vera C.Rubin Observatory Project + * (https://www.lsst.org). See the COPYRIGHT file at the top-level directory of + * this distribution for details of code ownership. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +using namespace LSST::cRIO; +using namespace LSST::VMS; + +class VMScli : public SimpleFPGACliApp { +public: + VMScli(const char* name, const char* description); + + void processArg(int opt, char* optarg) override; + command_vec processArgs(int argc, char* const argv[]) override; + + int temperature(command_vec cmds); + int record(command_vec cmds); + +protected: + virtual SimpleFPGA* newFPGA(const char* dir, bool& fpga_singleton) override; + +private: + std::string _subsystem = ""; + VMSApplicationSettings _settings; +}; + +VMScli::VMScli(const char* name, const char* description) : SimpleFPGACliApp(name, description) { + Events::FPGAState::instance().setPublish(false); + + addArgument('c', " use given configuration directory", ':'); + + addCommand("temperature", std::bind(&VMScli::temperature, this, std::placeholders::_1), "", NEED_FPGA, + NULL, "Reads cRIO temperature"); + + addCommand("record", std::bind(&VMScli::record, this, std::placeholders::_1), "S", NEED_FPGA, + "", "Record VMS values to a file"); +} + +void VMScli::processArg(int opt, char* optarg) { + switch (opt) { + case 'c': + SPDLOG_DEBUG("Loading configuration from {}", optarg); + SettingReader::instance().setRootPath(optarg); + break; + default: + SimpleFPGACliApp::processArg(opt, optarg); + } +} + +command_vec VMScli::processArgs(int argc, char* const argv[]) { + auto ret = SimpleFPGACliApp::processArgs(argc, argv); + if (ret.size() != 1) { + SPDLOG_CRITICAL( + "Subsystem (M1M3, M2 or CameraRotator) needs to be " + "provided on command line"); + exit(EXIT_FAILURE); + } + _subsystem = ret[0]; +#ifdef SIMULATOR + SPDLOG_INFO("Initiliaze simulator for {}", _subsystem); +#else + SPDLOG_INFO("Initiliaze VMScli FPGA for {}", _subsystem); +#endif + setDebugLevel(getDebugLevel()); + ret.erase(ret.begin()); + return ret; +} + +int VMScli::temperature(command_vec cmds) { + std::cout << "cRIO temperature is " << std::fixed << std::setprecision(2) + << FPGA::instance().chassisTemperature() << "\u00b0C" << std::endl; + return 0; +} + +std::atomic recordVMS = false; + +void sig_int(int signal) { recordVMS = false; } + +int VMScli::record(command_vec cmds) { + recordVMS = true; + + std::filesystem::path file_path(cmds[0]); + + std::cout << "Recording to " << file_path.string() << ", hit ctrl+c to end" << std::endl; + + auto previous = signal(SIGINT, sig_int); + + try { + FileAccelerometer filea(&_settings, file_path); + filea.enableAccelerometers(); + + int counter = 21; + + while (recordVMS) { + if (counter > 10) { + std::cout << "Ticks: " << FPGA::instance().chassisTicks() << "\r"; + std::cout.flush(); + filea.flush(); + counter = 0; + } + for (int i = 0; i < _settings.sensors; i++) { + filea.sampleData(); + } + counter++; + } + + filea.disableAccelerometers(); + + } catch (const std::ios_base::failure& e) { + std::cerr << std::endl << "Error writing to " << file_path.string() << ": " << e.what() << std::endl; + } + + signal(SIGINT, previous); + + return 0; +} + +SimpleFPGA* VMScli::newFPGA(const char* dir, bool& fpga_singleton) { + _settings = SettingReader::instance().loadVMSApplicationSettings(_subsystem); + SPDLOG_INFO("Creating FPGA"); + FPGA::instance().populate(&_settings); + fpga_singleton = true; + + return &FPGA::instance(); +} + +VMScli cli("VMS", "VMS Command Line Interface"); + +int main(int argc, char* const argv[]) { return cli.run(argc, argv); } diff --git a/utils/Makefile b/utils/Makefile new file mode 100644 index 0000000..94e0079 --- /dev/null +++ b/utils/Makefile @@ -0,0 +1,17 @@ +include ../Makefile.inc + +all: vmsrawdump + +CPPFLAGS := -I../src/NiFpga + +vmsrawdump: vmsrawdump.cpp.o + @echo '[LD ] $@' + ${co}$(CPP) -o $@ $^ + +%.cpp.o: %.cpp.d + @echo '[CPP] $(patsubst %.d,%,$<)' + ${co}$(CPP) ${CPPFLAGS} -c -o $@ $(patsubst %.d,%,$<) + +%.cpp.d: %.cpp + @echo '[DPP] $<' + ${co}$(CPP) ${CPPFLAGS} -M $< -MF $@ -MT '$(patsubst %.cpp,%.o,$<) $@' diff --git a/utils/vmsrawdump.cpp b/utils/vmsrawdump.cpp new file mode 100644 index 0000000..16dbb31 --- /dev/null +++ b/utils/vmsrawdump.cpp @@ -0,0 +1,192 @@ +/* + * This file is part of LSST VMS package. + * + * Developed for the Vera C. Rubin Telescope and Site System. + * This product includes software developed by the LSST Project + * (https://www.lsst.org). + * See the COPYRIGHT file at the top-level directory of this distribution + * for details of code ownership. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__) + +#define __WINDOWS__ + +#endif + +#if defined(__linux__) || defined(__CYGWIN__) + +#include + +#elif defined(__APPLE__) + +#include + +#define be64toh(x) OSSwapBigToHostInt64(x) + +#define __BYTE_ORDER BYTE_ORDER +#define __BIG_ENDIAN BIG_ENDIAN +#define __LITTLE_ENDIAN LITTLE_ENDIAN +#define __PDP_ENDIAN PDP_ENDIAN + +#elif defined(__OpenBSD__) + +#include + +#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) + +#include + +#define be64toh(x) betoh64(x) + +#elif defined(__WINDOWS__) + +#include + +#if BYTE_ORDER == LITTLE_ENDIAN + +#if defined(_MSC_VER) +#include +#define be64toh(x) _byteswap_uint64(x) + +#elif defined(__GNUC__) || defined(__clang__) + +#define be64toh(x) __builtin_bswap64(x) +#else +#error platform not supported +#endif + +#else + +#error byte order not supported + +#endif + +#define __BYTE_ORDER BYTE_ORDER +#define __BIG_ENDIAN BIG_ENDIAN +#define __LITTLE_ENDIAN LITTLE_ENDIAN +#define __PDP_ENDIAN PDP_ENDIAN + +#else + +#error platform not supported + +#endif + +#include +#include +#include +#include +#include + +using namespace std::chrono; + +void dump_file(const char *filename) { + std::ifstream file; + + try { + // auto file = std::ifstream(argv[i], std::ifstream::in | + // std::fstream::binary); + file.open(filename, std::ifstream::binary); + file.exceptions(std::ios::eofbit | std::ios::badbit | std::ios::failbit); + + // parse file header + char header[4]; + + file.read(header, 4); + uint8_t len = header[3]; + header[3] = 0; + if (strcmp(header, "VMS") != 0) { + std::cerr << "File " << filename << " doesn't look like VMS dump file, skipping." << std::endl; + return; + } + + char subsystem[len]; + file.read(subsystem, len); + + uint8_t sensors = subsystem[len - 1]; + subsystem[len - 1] = 0; + + if (!(sensors == 3 || sensors == 6)) { + std::cerr << "Expect to see 3 or 6 sensors in " << filename << ", saw " << +sensors << "." + << std::endl; + } + + std::cout << subsystem << " time (UTC)"; + + int i; + + for (i = 0; i < sensors; i++) { + for (char ax = 'X'; ax <= 'Z'; ax++) { + std::cout << ", " << +(i + 1) << ax; + } + } + + std::cout << std::endl; + + auto micros_d = duration_cast(system_clock::now().time_since_epoch()).count(); + long int old_micros = 0; + + while (!file.eof()) { + file.read(reinterpret_cast(µs_d), sizeof(micros_d)); + + if (old_micros >= micros_d) { + std::cerr << "Recorded timestamps in file " << filename << " aren't increasing (" + << old_micros << " >= " << micros_d << "), skipping rest of the file!" << std::endl; + return; + } + + microseconds micros(micros_d); + seconds sec = duration_cast(micros); + micros -= sec; + + system_clock::time_point tp{seconds(sec)}; + std::time_t ttp = system_clock::to_time_t(tp); + auto time = gmtime(&ttp); + std::printf("%04u-%02u-%02uT%02u:%02u:%02u.%06u", time->tm_year + 1900, time->tm_mon + 1, + time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec, + static_cast(micros.count())); + + for (i = 0; i < sensors * 3; i++) { + float value; + file.read(reinterpret_cast(&value), sizeof(value)); + std::cout << ", " << value; + } + + std::cout << std::endl; + + old_micros = micros_d; + } + } catch (const std::ios_base::failure &e) { + if (file.eof()) { + return; + } + std::cerr << "Cannot read raw DC accelerometer file " << filename << ": " << e.what() << std::endl; + } +} + +int main(int argc, char **argv) { + if (argc == 1) { + std::cerr << "Decodes raw VMS accelerometer output. Needs at least one file " + "as an argument." + << std::endl; + return -1; + } + + for (int i = 1; i < argc; i++) { + dump_file(argv[1]); + } +}