diff --git a/.gitignore b/.gitignore index 368af57..141a08a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ ts-VMSd .mypy.ini .ruff.toml src/version.c +towncrier.toml diff --git a/Bitfiles/NiFpga.c b/Bitfiles/NiFpga.c index d0cdb4d..5b5566d 100644 --- a/Bitfiles/NiFpga.c +++ b/Bitfiles/NiFpga.c @@ -14,16 +14,16 @@ #if NiFpga_Windows #include #elif NiFpga_VxWorks -#include -#include #include +#include #include -MODULE_ID VxLoadLibraryFromPath(const char* path, int flags); +#include +MODULE_ID VxLoadLibraryFromPath(const char *path, int flags); STATUS VxFreeLibrary(MODULE_ID library, int flags); #elif NiFpga_Linux || NiFpga_MacOsX -#include -#include #include +#include +#include #else #error #endif @@ -47,7 +47,7 @@ static HMODULE NiFpga_library = NULL; #elif NiFpga_VxWorks static MODULE_ID NiFpga_library = NULL; #elif NiFpga_Linux || NiFpga_MacOsX -static void* NiFpga_library = NULL; +static void *NiFpga_library = NULL; #else #error #endif @@ -58,13 +58,15 @@ static void* NiFpga_library = NULL; #if NiFpga_Cvi && NiFpga_Windows #define NiFpga_CviResourceTracking 1 -static char* const NiFpga_cviResourceType = "FPGA Interface C API"; +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 @@ -72,1451 +74,1874 @@ 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; +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); + if (NiFpga_acquireCviResource && NiFpga_IsNotError(result)) + NiFpga_acquireCviResource((void *)*session, NiFpga_cviResourceType, + "NiFpga_Session %#08x", *session); #endif - return result; + return result; } -static NiFpga_Status(NiFpga_CCall* NiFpga_close)(NiFpga_Session session, uint32_t attribute) = NULL; +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_close) + return NiFpga_Status_ResourceNotInitialized; #if NiFpga_CviResourceTracking - if (NiFpga_releaseCviResource) NiFpga_releaseCviResource((void*)session); + if (NiFpga_releaseCviResource) + NiFpga_releaseCviResource((void *)session); #endif - return NiFpga_close(session, attribute); + 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; + 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; + 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; + 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; + 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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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_ReadDbl(NiFpga_Session session, uint32_t indicator, + double *value) { + return NiFpga_readDbl ? NiFpga_readDbl(session, indicator, value) + : NiFpga_Status_ResourceNotInitialized; } /* * Functions to write to scalar controls and indicators. */ -static NiFpga_Status(NiFpga_CCall* NiFpga_writeBool)(NiFpga_Session session, uint32_t control, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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_WriteDbl(NiFpga_Session session, uint32_t control, + double value) { + return NiFpga_writeDbl ? NiFpga_writeDbl(session, control, value) + : NiFpga_Status_ResourceNotInitialized; } /* * 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_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_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_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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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_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_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_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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; - -NiFpga_Status NiFpga_ReserveIrqContext(NiFpga_Session session, NiFpga_IrqContext* context) { - const NiFpga_Status result = NiFpga_reserveIrqContext ? NiFpga_reserveIrqContext(session, context) - : NiFpga_Status_ResourceNotInitialized; +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); + if (NiFpga_acquireCviResource && NiFpga_IsNotError(result)) + NiFpga_acquireCviResource(*context, NiFpga_cviResourceType, + "NiFpga_IrqContext 0x%p", *context); #endif - return result; + return result; } -static NiFpga_Status(NiFpga_CCall* NiFpga_unreserveIrqContext)(NiFpga_Session session, - NiFpga_IrqContext context) = NULL; +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; +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); + if (NiFpga_releaseCviResource) + NiFpga_releaseCviResource(context); #endif - return NiFpga_unreserveIrqContext(session, context); + 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; +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; +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; +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; + 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, +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; +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; +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; +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; +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, +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; + 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; +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, +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; + 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; +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, +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; + 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; +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, +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; + 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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; + return NiFpga_startFifo ? NiFpga_startFifo(session, fifo) + : NiFpga_Status_ResourceNotInitialized; } -static NiFpga_Status(NiFpga_CCall* NiFpga_stopFifo)(NiFpga_Session session, uint32_t fifo) = NULL; +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; + return NiFpga_stopFifo ? NiFpga_stopFifo(session, fifo) + : NiFpga_Status_ResourceNotInitialized; } /* * 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; +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, +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_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_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 *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_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_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_ResourceNotInitialized; + return NiFpga_clientFunctionCall + ? NiFpga_clientFunctionCall(session, group, functionId, inBuffer, + inBufferSize, outBuffer, outBufferSize) + : NiFpga_Status_ResourceNotInitialized; } /** * 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; + 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_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_GetBitfileContents", (NiFpga_FunctionPointer*)&NiFpga_getBitfileContents, 1}, - {"NiFpgaDll_ClientFunctionCall", (NiFpga_FunctionPointer*)&NiFpga_clientFunctionCall, 1}, - {NULL, NULL, 0}}; + {"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_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_GetBitfileContents", + (NiFpga_FunctionPointer *)&NiFpga_getBitfileContents, 1}, + {"NiFpgaDll_ClientFunctionCall", + (NiFpga_FunctionPointer *)&NiFpga_clientFunctionCall, 1}, + {NULL, NULL, 0}}; NiFpga_Status NiFpga_Initialize(void) { - /* if the library isn't already loaded */ - if (!NiFpga_library) { - int i; + /* if the library isn't already loaded */ + if (!NiFpga_library) { + int i; /* load the library */ #if NiFpga_Windows - NiFpga_library = LoadLibraryA("NiFpga.dll"); + NiFpga_library = LoadLibraryA("NiFpga.dll"); #elif NiFpga_VxWorks - NiFpga_library = VxLoadLibraryFromPath("NiFpga.out", 0); + NiFpga_library = VxLoadLibraryFromPath("NiFpga.out", 0); #elif NiFpga_Linux || NiFpga_MacOsX #if NiFpga_Linux - const char* const library = "libNiFpga.so"; + const char *const library = "libNiFpga.so"; #elif NiFpga_MacOsX - const char* const library = "/Library/Frameworks/NiFpga.framework/NiFpga"; + 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()); + 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_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; + *address = (NiFpga_FunctionPointer)GetProcAddress(NiFpga_library, name); + if (!*address && NiFpga_functions[i].required) + return NiFpga_Status_VersionMismatch; #elif NiFpga_VxWorks - SYM_TYPE type; - STATUS symFindStatus = symFindByName(sysSymTbl, (char*)name, (char**)address, &type); - if (symFindStatus != OK && NiFpga_functions[i].required) return NiFpga_Status_VersionMismatch; + SYM_TYPE type; + STATUS symFindStatus = + symFindByName(sysSymTbl, (char *)name, (char **)address, &type); + if (symFindStatus != OK && 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; + *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; - } - } + { + 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; +#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; + /* 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; + if (!FreeLibrary(NiFpga_library)) + status = NiFpga_Status_ResourceNotInitialized; #elif NiFpga_VxWorks - if (VxFreeLibrary(NiFpga_library, 0) != OK) status = NiFpga_Status_ResourceNotInitialized; + if (VxFreeLibrary(NiFpga_library, 0) != OK) + status = NiFpga_Status_ResourceNotInitialized; #elif NiFpga_Linux || NiFpga_MacOsX - if (dlclose(NiFpga_library)) status = NiFpga_Status_ResourceNotInitialized; + 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 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; + NiFpga_acquireCviResource = NULL; + NiFpga_releaseCviResource = NULL; #endif - return status; - } else - return NiFpga_Status_ResourceNotInitialized; + return status; + } else + return NiFpga_Status_ResourceNotInitialized; } diff --git a/src/LSST/VMS/Accelerometer.cpp b/src/LSST/VMS/Accelerometer.cpp index 37b9f05..fe4cda4 100644 --- a/src/LSST/VMS/Accelerometer.cpp +++ b/src/LSST/VMS/Accelerometer.cpp @@ -36,117 +36,119 @@ namespace LSST { namespace 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); - } + 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; + delete[] _psds; + delete[] _sampleData; } void Accelerometer::enableAccelerometers() { - SPDLOG_INFO("Accelerometer: enableAccelerometers(), period {}, output type {}", - _vmsApplicationSettings->period, _vmsApplicationSettings->outputType); - FPGA::instance().setPeriodOutputType(_vmsApplicationSettings->period, - _vmsApplicationSettings->outputType); - FPGA::instance().setOperate(true); + SPDLOG_INFO( + "Accelerometer: enableAccelerometers(), period {}, output type {}", + _vmsApplicationSettings->period, _vmsApplicationSettings->outputType); + FPGA::instance().setPeriodOutputType(_vmsApplicationSettings->period, + _vmsApplicationSettings->outputType); + FPGA::instance().setOperate(true); } void Accelerometer::disableAccelerometers() { - SPDLOG_INFO("Accelerometer: disableAccelerometers()"); - FPGA::instance().setOperate(false); + SPDLOG_INFO("Accelerometer: disableAccelerometers()"); + FPGA::instance().setOperate(false); } void Accelerometer::sampleData() { - SPDLOG_TRACE("Accelerometer: sampleData() count {}", _dataIndex); - uint32_t buffer[_numberOfSensors * AXIS_PER_SENSOR]; + SPDLOG_TRACE("Accelerometer: sampleData() count {}", _dataIndex); + uint32_t buffer[_numberOfSensors * AXIS_PER_SENSOR]; - FPGA::instance().readResponseFIFO(buffer, _numberOfSensors * AXIS_PER_SENSOR, - _vmsApplicationSettings->period * 2); + FPGA::instance().readResponseFIFO(buffer, _numberOfSensors * AXIS_PER_SENSOR, + _vmsApplicationSettings->period * 2); - if (_dataIndex == 0) { - double data_timestamp = VMSPublisher::instance().getTimestamp(); + if (_dataIndex == 0) { + double data_timestamp = VMSPublisher::instance().getTimestamp(); - for (int s = 0; s < _numberOfSensors; s++) { - _sampleData[s].timestamp = data_timestamp; - } + for (int s = 0; s < _numberOfSensors; s++) { + _sampleData[s].timestamp = data_timestamp; } + } - uint32_t *dataBuffer = buffer; - for (int s = 0; s < _numberOfSensors; s++) { - float acc_x = _convert(&dataBuffer); - float acc_y = _convert(&dataBuffer); - float acc_z = _convert(&dataBuffer); + uint32_t *dataBuffer = buffer; + for (int s = 0; s < _numberOfSensors; 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; + _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); - } + _psds[s].append(acc_x, acc_y, acc_z); + } - _dataIndex++; + _dataIndex++; - if (_dataIndex >= MAX_SAMPLE_PER_PUBLISH) { - for (int s = 0; s < _numberOfSensors; s++) { - VMSPublisher::instance().putData(&(_sampleData[s])); - } - _dataIndex = 0; + if (_dataIndex >= MAX_SAMPLE_PER_PUBLISH) { + for (int s = 0; s < _numberOfSensors; s++) { + VMSPublisher::instance().putData(&(_sampleData[s])); } + _dataIndex = 0; + } } float Accelerometer::_convert(uint32_t **data) { - union { - uint32_t i; - float f; - } u32float; - switch (_vmsApplicationSettings->outputType) { - case 1: - case 2: - u32float.f = G2M_S_2(NiFpga_ConvertFromFxpToFloat(ResponseFxpTypeInfo, **data)); - ++*data; - return u32float.f; - case 3: - u32float.i = **data; - ++*data; - return u32float.f; - case 50: - *data += 3; - u32float.i = **data; - ++*data; - return u32float.f; - default: - return NAN; - } + union { + uint32_t i; + float f; + } u32float; + switch (_vmsApplicationSettings->outputType) { + case 1: + case 2: + u32float.f = + G2M_S_2(NiFpga_ConvertFromFxpToFloat(ResponseFxpTypeInfo, **data)); + ++*data; + return u32float.f; + case 3: + u32float.i = **data; + ++*data; + return u32float.f; + case 50: + *data += 3; + u32float.i = **data; + ++*data; + return u32float.f; + default: + return NAN; + } } } /* namespace VMS */ diff --git a/src/LSST/VMS/Accelerometer.h b/src/LSST/VMS/Accelerometer.h index 391838e..6df15c0 100644 --- a/src/LSST/VMS/Accelerometer.h +++ b/src/LSST/VMS/Accelerometer.h @@ -25,8 +25,8 @@ #define ACCELEROMETER_H_ #include -#include #include +#include namespace LSST { namespace VMS { @@ -36,24 +36,24 @@ namespace VMS { */ class Accelerometer { public: - Accelerometer(VMSApplicationSettings* vmsApplicationSettings); - virtual ~Accelerometer(void); + Accelerometer(VMSApplicationSettings *vmsApplicationSettings); + virtual ~Accelerometer(void); - void enableAccelerometers(); - void disableAccelerometers(); + void enableAccelerometers(); + void disableAccelerometers(); - void sampleData(); + void sampleData(); private: - enum { M1M3, M2, CameraRotator, TMA } _subsystem; + enum { M1M3, M2, CameraRotator, TMA } _subsystem; - int _numberOfSensors; - int _dataIndex; - MTVMS_dataC* _sampleData; - Telemetry::PSD* _psds; - VMSApplicationSettings* _vmsApplicationSettings; + int _numberOfSensors; + int _dataIndex; + MTVMS_dataC *_sampleData; + Telemetry::PSD *_psds; + VMSApplicationSettings *_vmsApplicationSettings; - float _convert(uint32_t** data); + float _convert(uint32_t **data); }; } /* namespace VMS */ diff --git a/src/LSST/VMS/Commands/EnterControl.h b/src/LSST/VMS/Commands/EnterControl.h index 4c6bad7..4196b43 100644 --- a/src/LSST/VMS/Commands/EnterControl.h +++ b/src/LSST/VMS/Commands/EnterControl.h @@ -1,10 +1,10 @@ /* * EnterControl command. * - * 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. + * 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 @@ -23,9 +23,9 @@ #ifndef _VMS_Command_EnterControl_ #define _VMS_Command_ENterControl_ -#include #include #include +#include #include @@ -35,16 +35,17 @@ namespace Commands { class EnterControl : public cRIO::Command { public: - void execute() override { - SPDLOG_DEBUG("EnterControl"); - VMSPublisher::instance().logSoftwareVersions(); - VMSPublisher::instance().logSimulationMode(); - Events::SummaryState::setState(MTVMS::MTVMS_shared_SummaryStates_StandbyState); - } + void execute() override { + SPDLOG_DEBUG("EnterControl"); + VMSPublisher::instance().logSoftwareVersions(); + VMSPublisher::instance().logSimulationMode(); + Events::SummaryState::setState( + MTVMS::MTVMS_shared_SummaryStates_StandbyState); + } }; -} // namespace Commands -} // namespace VMS -} // namespace LSST +} // namespace Commands +} // namespace VMS +} // namespace LSST -#endif // !_VMS_Command_EnterControl_ +#endif // !_VMS_Command_EnterControl_ diff --git a/src/LSST/VMS/Commands/SAL.cpp b/src/LSST/VMS/Commands/SAL.cpp index e9d65d8..4e6758f 100644 --- a/src/LSST/VMS/Commands/SAL.cpp +++ b/src/LSST/VMS/Commands/SAL.cpp @@ -1,10 +1,10 @@ /* * SAL command. * - * 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. + * 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 @@ -34,47 +34,47 @@ using namespace LSST::VMS::Commands; using namespace MTVMS; void SAL_start::execute() { - SPDLOG_INFO("Starting, settings={}", params.configurationOverride); + SPDLOG_INFO("Starting, settings={}", params.configurationOverride); - Events::SummaryState::setState(MTVMS_shared_SummaryStates_DisabledState); - ackComplete(); - SPDLOG_INFO("Started"); + Events::SummaryState::setState(MTVMS_shared_SummaryStates_DisabledState); + ackComplete(); + SPDLOG_INFO("Started"); } void SAL_enable::execute() { - Events::SummaryState::setState(MTVMS_shared_SummaryStates_EnabledState); - ackComplete(); - SPDLOG_INFO("Enabled"); + Events::SummaryState::setState(MTVMS_shared_SummaryStates_EnabledState); + ackComplete(); + SPDLOG_INFO("Enabled"); } void SAL_disable::execute() { - Events::SummaryState::setState(MTVMS_shared_SummaryStates_DisabledState); - ackComplete(); + Events::SummaryState::setState(MTVMS_shared_SummaryStates_DisabledState); + ackComplete(); } void SAL_standby::execute() { - Events::SummaryState::setState(MTVMS_shared_SummaryStates_StandbyState); - ackComplete(); - SPDLOG_INFO("Standby"); + Events::SummaryState::setState(MTVMS_shared_SummaryStates_StandbyState); + ackComplete(); + SPDLOG_INFO("Standby"); } void SAL_exitControl::execute() { - ControllerThread::setExitRequested(); - ackComplete(); + ControllerThread::setExitRequested(); + ackComplete(); } bool SAL_changeSamplePeriod::validate() { - if (Events::SummaryState::instance().enabled() == false) { - return false; - } - return true; + if (Events::SummaryState::instance().enabled() == false) { + return false; + } + return true; } void SAL_changeSamplePeriod::execute() { - FPGA::instance().setOperate(false); - ackComplete(); + FPGA::instance().setOperate(false); + ackComplete(); } void SAL_timeSynchronization::received() { - std::cerr << "TimeSynchronization " << params.baseClockOffset << std::endl; + std::cerr << "TimeSynchronization " << params.baseClockOffset << std::endl; } diff --git a/src/LSST/VMS/Commands/SAL.h b/src/LSST/VMS/Commands/SAL.h index aa06dea..bf7c960 100644 --- a/src/LSST/VMS/Commands/SAL.h +++ b/src/LSST/VMS/Commands/SAL.h @@ -1,10 +1,10 @@ /* * SAL commands * - * 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. + * 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 @@ -48,8 +48,8 @@ SAL_COMMAND_CLASS_validate(MTVMS, VMSPublisher::SAL(), changeSamplePeriod); SAL_EVENT_CLASS(MTVMS, VMSPublisher::SAL(), timeSynchronization); -} // namespace Commands -} // namespace VMS -} // namespace LSST +} // namespace Commands +} // namespace VMS +} // namespace LSST -#endif //! _VMS_Command_SAL +#endif //! _VMS_Command_SAL diff --git a/src/LSST/VMS/Commands/Update.cpp b/src/LSST/VMS/Commands/Update.cpp index 2561c9b..3e772e8 100644 --- a/src/LSST/VMS/Commands/Update.cpp +++ b/src/LSST/VMS/Commands/Update.cpp @@ -22,15 +22,12 @@ */ #include -#include #include #include -using namespace LSST::VMS; using namespace LSST::VMS::Commands; void Update::execute() { - VMSPublisher::instance().putMiscellaneous(FPGA::instance().chassisTemperature(), - FPGA::instance().chassisTicks()); - Events::Heartbeat::instance().tryToggle(); + VMSPublisher::instance().putMiscellaneous( + FPGA::instance().chassisTemperature(), FPGA::instance().chassisTicks()); } diff --git a/src/LSST/VMS/Commands/Update.h b/src/LSST/VMS/Commands/Update.h index add81cb..26962fc 100644 --- a/src/LSST/VMS/Commands/Update.h +++ b/src/LSST/VMS/Commands/Update.h @@ -38,10 +38,10 @@ namespace Commands { */ class Update : public cRIO::Command { public: - Update() {} - virtual ~Update() {} + Update() {} + virtual ~Update() {} - void execute() override; + void execute() override; }; } /* namespace Commands */ diff --git a/src/LSST/VMS/Events/FPGAState.cpp b/src/LSST/VMS/Events/FPGAState.cpp index c586b03..46a69a8 100644 --- a/src/LSST/VMS/Events/FPGAState.cpp +++ b/src/LSST/VMS/Events/FPGAState.cpp @@ -1,10 +1,10 @@ /* * AcquistionPeriod event handling class. * - * 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. + * 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 @@ -20,8 +20,8 @@ * this program. If not, see . */ -#include #include +#include #include @@ -30,44 +30,47 @@ using namespace LSST::VMS::Events; using namespace MTVMS; FPGAState::FPGAState(token) { - period = 0; - ready = false; - timeouted = false; - stopped = true; - fifoFull = false; + period = 0; + ready = false; + timeouted = false; + stopped = true; + fifoFull = false; } void FPGAState::send() { - salReturn ret = VMSPublisher::SAL()->putSample_logevent_fpgaState(&instance()); - if (ret != SAL__OK) { - SPDLOG_WARN("Can not send fpgaState: {}", ret); - return; - } + salReturn ret = + VMSPublisher::SAL()->putSample_logevent_fpgaState(&instance()); + if (ret != SAL__OK) { + SPDLOG_WARN("Can not send fpgaState: {}", ret); + return; + } } void FPGAState::setPeriodOutputType(int32_t newPeriod, int newOutputType) { - std::lock_guard lockG(_stateMutex); - if (period == newPeriod && outputType == newOutputType) { - return; - } - period = newPeriod; - outputType = newOutputType; - send(); + std::lock_guard lockG(_stateMutex); + if (period == newPeriod && outputType == newOutputType) { + return; + } + period = newPeriod; + outputType = newOutputType; + send(); } -void FPGAState::setMisc(bool newReady, bool newTimeouted, bool newStopped, bool newFIFOFull) { - std::lock_guard lockG(_stateMutex); - if (ready == newReady && timeouted == newTimeouted && stopped == newStopped && fifoFull == newFIFOFull) { - return; - } - ready = newReady; - timeouted = newTimeouted; - stopped = newStopped; - fifoFull = newFIFOFull; - send(); +void FPGAState::setMisc(bool newReady, bool newTimeouted, bool newStopped, + bool newFIFOFull) { + std::lock_guard lockG(_stateMutex); + if (ready == newReady && timeouted == newTimeouted && stopped == newStopped && + fifoFull == newFIFOFull) { + return; + } + ready = newReady; + timeouted = newTimeouted; + stopped = newStopped; + fifoFull = newFIFOFull; + send(); } void FPGAState::checkState() { - setMisc(FPGA::instance().ready(), FPGA::instance().timeouted(), FPGA::instance().stopped(), - FPGA::instance().FIFOFull()); + setMisc(FPGA::instance().ready(), FPGA::instance().timeouted(), + FPGA::instance().stopped(), FPGA::instance().FIFOFull()); } diff --git a/src/LSST/VMS/Events/FPGAState.h b/src/LSST/VMS/Events/FPGAState.h index c9668b9..44af2c5 100644 --- a/src/LSST/VMS/Events/FPGAState.h +++ b/src/LSST/VMS/Events/FPGAState.h @@ -1,10 +1,10 @@ /* * AcquisitionPeriod event handling class. * - * 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. + * 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 @@ -28,8 +28,8 @@ #include -#include #include +#include namespace LSST { namespace VMS { @@ -38,31 +38,33 @@ namespace Events { /** * Acquistion Period handling class. */ -class FPGAState final : MTVMS_logevent_fpgaStateC, public cRIO::Singleton { +class FPGAState final : MTVMS_logevent_fpgaStateC, + public cRIO::Singleton { public: - FPGAState(token); + FPGAState(token); - void setPeriodOutputType(int32_t newPeriod, int newOutputType); - void setMisc(bool newReady, bool newTimeouted, bool newStopped, bool newFIFOFull); + void setPeriodOutputType(int32_t newPeriod, int newOutputType); + void setMisc(bool newReady, bool newTimeouted, bool newStopped, + bool newFIFOFull); - /*** - * Readout state from FPGA, sends updates if data were changed - */ - void checkState(); + /*** + * Readout state from FPGA, sends updates if data were changed + */ + void checkState(); - int32_t getPeriod() { - std::lock_guard lockG(_stateMutex); - return period; - } + int32_t getPeriod() { + std::lock_guard lockG(_stateMutex); + return period; + } - static void send(); + static void send(); private: - std::mutex _stateMutex; + std::mutex _stateMutex; }; -} // namespace Events -} // namespace VMS -} // namespace LSST +} // namespace Events +} // namespace VMS +} // namespace LSST -#endif //! _VMS_Event_AcqusitionPeriod_ +#endif //! _VMS_Event_AcqusitionPeriod_ diff --git a/src/LSST/VMS/Events/Heartbeat.cpp b/src/LSST/VMS/Events/Heartbeat.cpp index 7b70cfc..8f82daa 100644 --- a/src/LSST/VMS/Events/Heartbeat.cpp +++ b/src/LSST/VMS/Events/Heartbeat.cpp @@ -29,25 +29,25 @@ using namespace LSST::VMS::Events; -const float HEARTBEAT_PERIOD = 1.0; //* Heartbeat period in seconds +const float HEARTBEAT_PERIOD = 1.0; //* Heartbeat period in seconds Heartbeat::Heartbeat(token) { _lastToggleTimestamp = 0; } void Heartbeat::tryToggle() { - SPDLOG_TRACE("Trying to toggle heartbeat"); - double timestamp = VMSPublisher::instance().getTimestamp(); - if (timestamp >= (_lastToggleTimestamp + HEARTBEAT_PERIOD)) { - SPDLOG_DEBUG("Toggling heartbeat"); - auto lag = timestamp - _lastToggleTimestamp; - if (_lastToggleTimestamp != 0 && lag > HEARTBEAT_PERIOD * 1.1) { - SPDLOG_WARN("Toggling heartbeat after {:0.03f} seconds!", lag); - } + SPDLOG_TRACE("Trying to toggle heartbeat"); + double timestamp = VMSPublisher::instance().getTimestamp(); + if (timestamp >= (_lastToggleTimestamp + HEARTBEAT_PERIOD)) { + SPDLOG_DEBUG("Toggling heartbeat"); + auto lag = timestamp - _lastToggleTimestamp; + if (_lastToggleTimestamp != 0 && lag > HEARTBEAT_PERIOD * 1.1) { + SPDLOG_WARN("Toggling heartbeat after {:0.03f} seconds!", lag); + } - heartbeat = !heartbeat; + heartbeat = !heartbeat; - // sends software heartbeat - VMSPublisher::instance().logHeartbeat(this); + // sends software heartbeat + VMSPublisher::instance().logHeartbeat(this); - _lastToggleTimestamp = timestamp; - } + _lastToggleTimestamp = timestamp; + } } diff --git a/src/LSST/VMS/Events/Heartbeat.h b/src/LSST/VMS/Events/Heartbeat.h index 531508b..dbfacf1 100644 --- a/src/LSST/VMS/Events/Heartbeat.h +++ b/src/LSST/VMS/Events/Heartbeat.h @@ -37,22 +37,26 @@ namespace Events { /** * Wrapper object for MTM1M3_logevent_heartbeatStatusC. */ -class Heartbeat : public MTVMS_logevent_heartbeatC, public cRIO::Singleton { +class Heartbeat : public MTVMS_logevent_heartbeatC, + public cRIO::Singleton { public: - /** - * Construct new InterlockStatus - */ - Heartbeat(token); + /** + * Construct new InterlockStatus + */ + Heartbeat(token); - /** - * Sets heartbeat, publish data if the last heartbeat was send more than 500ms in past. - */ - void tryToggle(); + /** + * Sets heartbeat, publish data if the last heartbeat was send more than 500ms + * in past. + */ + void tryToggle(); private: - double _lastToggleTimestamp; + double _lastToggleTimestamp; }; -}}} +} // namespace Events +} // namespace VMS +} // namespace LSST -#endif // LSST_INTERLOCKSTATUS_H +#endif // LSST_INTERLOCKSTATUS_H diff --git a/src/LSST/VMS/Events/SummaryState.cpp b/src/LSST/VMS/Events/SummaryState.cpp index bc385f7..613f14c 100644 --- a/src/LSST/VMS/Events/SummaryState.cpp +++ b/src/LSST/VMS/Events/SummaryState.cpp @@ -1,10 +1,10 @@ /* * SummaryState event handling class. * - * 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. + * 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 @@ -29,67 +29,72 @@ using namespace LSST::VMS::Events; using namespace MTVMS; SummaryState::SummaryState(token) : _updated(false) { - summaryState = MTVMS_shared_SummaryStates_OfflineState; + summaryState = MTVMS_shared_SummaryStates_OfflineState; } void SummaryState::send() { - if (instance()._updated == false) { - return; - } - salReturn ret = VMSPublisher::SAL()->putSample_logevent_summaryState(&instance()); - if (ret != SAL__OK) { - SPDLOG_WARN("Can not send summaryState: {}", ret); - return; - } - instance()._updated = false; + if (instance()._updated == false) { + return; + } + salReturn ret = + VMSPublisher::SAL()->putSample_logevent_summaryState(&instance()); + if (ret != SAL__OK) { + SPDLOG_WARN("Can not send summaryState: {}", ret); + return; + } + instance()._updated = false; } bool SummaryState::active() { - std::lock_guard lockG(_stateMutex); - return summaryState == MTVMS_shared_SummaryStates_DisabledState || - summaryState == MTVMS_shared_SummaryStates_EnabledState; + std::lock_guard lockG(_stateMutex); + return summaryState == MTVMS_shared_SummaryStates_DisabledState || + summaryState == MTVMS_shared_SummaryStates_EnabledState; } bool SummaryState::enabled() { - std::lock_guard lockG(_stateMutex); - return summaryState == MTVMS_shared_SummaryStates_EnabledState; + std::lock_guard lockG(_stateMutex); + return summaryState == MTVMS_shared_SummaryStates_EnabledState; } void SummaryState::_switchState(int newState) { - std::lock_guard lockG(_stateMutex); - SPDLOG_TRACE("SummaryState::_switchState from {} to {}", summaryState, newState); - if (summaryState == newState) { - throw std::runtime_error(fmt::format("Already in {} state", newState)); + std::lock_guard lockG(_stateMutex); + SPDLOG_TRACE("SummaryState::_switchState from {} to {}", summaryState, + newState); + if (summaryState == newState) { + throw std::runtime_error(fmt::format("Already in {} state", newState)); + } + switch (newState) { + case MTVMS_shared_SummaryStates_DisabledState: + if (summaryState != MTVMS_shared_SummaryStates_StandbyState && + summaryState != MTVMS_shared_SummaryStates_EnabledState) { + throw std::runtime_error( + fmt::format("Cannot switch to Disabled state from {}", summaryState)); + } + break; + case MTVMS_shared_SummaryStates_EnabledState: + if (summaryState != MTVMS_shared_SummaryStates_DisabledState) { + throw std::runtime_error( + fmt::format("Cannot switch to Enable state from {}", summaryState)); + } + break; + case MTVMS_shared_SummaryStates_FaultState: + break; + case MTVMS_shared_SummaryStates_OfflineState: + if (summaryState != MTVMS_shared_SummaryStates_StandbyState) { + throw std::runtime_error( + fmt::format("Cannot switch to Offline state from {}", summaryState)); } - switch (newState) { - case MTVMS_shared_SummaryStates_DisabledState: - if (summaryState != MTVMS_shared_SummaryStates_StandbyState && - summaryState != MTVMS_shared_SummaryStates_EnabledState) { - throw std::runtime_error( - fmt::format("Cannot switch to Disabled state from {}", summaryState)); - } - break; - case MTVMS_shared_SummaryStates_EnabledState: - if (summaryState != MTVMS_shared_SummaryStates_DisabledState) { - throw std::runtime_error(fmt::format("Cannot switch to Enable state from {}", summaryState)); - } - break; - case MTVMS_shared_SummaryStates_FaultState: - break; - case MTVMS_shared_SummaryStates_OfflineState: - if (summaryState != MTVMS_shared_SummaryStates_StandbyState) { - throw std::runtime_error(fmt::format("Cannot switch to Offline state from {}", summaryState)); - } - case MTVMS_shared_SummaryStates_StandbyState: - if (summaryState != MTVMS_shared_SummaryStates_DisabledState && - summaryState != MTVMS_shared_SummaryStates_OfflineState) { - throw std::runtime_error(fmt::format("Cannot switch to Standby state from {}", summaryState)); - } - break; - default: - throw std::runtime_error(fmt::format("Invalid target state: {}", newState)); + case MTVMS_shared_SummaryStates_StandbyState: + if (summaryState != MTVMS_shared_SummaryStates_DisabledState && + summaryState != MTVMS_shared_SummaryStates_OfflineState) { + throw std::runtime_error( + fmt::format("Cannot switch to Standby state from {}", summaryState)); } - instance()._updated = true; - summaryState = newState; - send(); + break; + default: + throw std::runtime_error(fmt::format("Invalid target state: {}", newState)); + } + instance()._updated = true; + summaryState = newState; + send(); } diff --git a/src/LSST/VMS/Events/SummaryState.h b/src/LSST/VMS/Events/SummaryState.h index 9e2a5ab..fe709a4 100644 --- a/src/LSST/VMS/Events/SummaryState.h +++ b/src/LSST/VMS/Events/SummaryState.h @@ -1,10 +1,10 @@ /* * SummaryState event handling class. * - * 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. + * 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 @@ -28,8 +28,8 @@ #include -#include #include +#include namespace LSST { namespace VMS { @@ -39,44 +39,46 @@ namespace Events { * State handling class. Inherits SAL/DDS summary state structure, adds * multi-thread safety for state changes. */ -class SummaryState final : MTVMS_logevent_summaryStateC, public cRIO::Singleton { +class SummaryState final : MTVMS_logevent_summaryStateC, + public cRIO::Singleton { public: - SummaryState(token); + SummaryState(token); - /** - * Returns true if summary state is disabled or enabled (e.g. not standby or fault). - * - * @return true if state is DISABLED or ENABLED - * - * @multithreading safe - */ - bool active(); + /** + * Returns true if summary state is disabled or enabled (e.g. not standby or + * fault). + * + * @return true if state is DISABLED or ENABLED + * + * @multithreading safe + */ + bool active(); - /** - * Returns true if summary state is enabled. - * - * @return true if state == ENABLED - * - * @multithreading safe - */ - bool enabled(); + /** + * Returns true if summary state is enabled. + * + * @return true if state == ENABLED + * + * @multithreading safe + */ + bool enabled(); - /** - * - * @multithreading safe - */ - static void setState(int newState) { instance()._switchState(newState); } - static void send(); + /** + * + * @multithreading safe + */ + static void setState(int newState) { instance()._switchState(newState); } + static void send(); private: - void _switchState(int newState); - bool _updated; + void _switchState(int newState); + bool _updated; - std::mutex _stateMutex; + std::mutex _stateMutex; }; -} // namespace Events -} // namespace VMS -} // namespace LSST +} // namespace Events +} // namespace VMS +} // namespace LSST -#endif //! _VMS_Event_SummaryState_ +#endif //! _VMS_Event_SummaryState_ diff --git a/src/LSST/VMS/FPGA.cpp b/src/LSST/VMS/FPGA.cpp index 66d1063..249e8fe 100644 --- a/src/LSST/VMS/FPGA.cpp +++ b/src/LSST/VMS/FPGA.cpp @@ -21,17 +21,16 @@ * along with this program. If not, see . */ -#include -#include #include +#include #include +#include #ifdef SIMULATOR -#include #include +#include #endif -#include #include #include #include @@ -42,6 +41,7 @@ #include #include #include +#include namespace LSST { namespace VMS { @@ -51,163 +51,179 @@ FPGA::FPGA(token) : SimpleFPGA(LSST::cRIO::VMS) {} #define NiFpga_VMS_6_Responder_ControlBool_Operate -1 #define NiFpga_VMS_3_Responder_ControlBool_Operate -1 -#define POPULATE_FPGA(type) \ - _bitFile = "/var/lib/MTVMS/" NiFpga_VMS_##type##_Bitfile; \ - _signature = NiFpga_VMS_##type##_Signature; \ - _responseFIFO = NiFpga_VMS_##type##_TargetToHostFifoU32_ResponseFIFO; \ - _operateResource = NiFpga_VMS_##type##_ControlBool_Operate; \ - _periodResource = NiFpga_VMS_##type##_ControlU32_Periodms; \ - _outputTypeResource = NiFpga_VMS_##type##_ControlI16_Outputtype; \ - _readyResource = NiFpga_VMS_##type##_IndicatorBool_Ready; \ - _stoppedResource = NiFpga_VMS_##type##_IndicatorBool_Stopped; \ - _timeoutedResource = NiFpga_VMS_##type##_IndicatorBool_Timeouted; \ - _fifoFullResource = NiFpga_VMS_##type##_IndicatorBool_FIFOfull; \ - _chasisTemperatureResource = NiFpga_VMS_##type##_IndicatorFxp_ChassisTemperature_Resource; \ - _chasisTemperatureTypeInfo = NiFpga_VMS_##type##_IndicatorFxp_ChassisTemperature_TypeInfo; \ - _ticksResource = NiFpga_VMS_##type##_IndicatorU64_Ticks; +#define POPULATE_FPGA(type) \ + _bitFile = "/var/lib/MTVMS/" NiFpga_VMS_##type##_Bitfile; \ + _signature = NiFpga_VMS_##type##_Signature; \ + _responseFIFO = NiFpga_VMS_##type##_TargetToHostFifoU32_ResponseFIFO; \ + _operateResource = NiFpga_VMS_##type##_ControlBool_Operate; \ + _periodResource = NiFpga_VMS_##type##_ControlU32_Periodms; \ + _outputTypeResource = NiFpga_VMS_##type##_ControlI16_Outputtype; \ + _readyResource = NiFpga_VMS_##type##_IndicatorBool_Ready; \ + _stoppedResource = NiFpga_VMS_##type##_IndicatorBool_Stopped; \ + _timeoutedResource = NiFpga_VMS_##type##_IndicatorBool_Timeouted; \ + _fifoFullResource = NiFpga_VMS_##type##_IndicatorBool_FIFOfull; \ + _chasisTemperatureResource = \ + NiFpga_VMS_##type##_IndicatorFxp_ChassisTemperature_Resource; \ + _chasisTemperatureTypeInfo = \ + NiFpga_VMS_##type##_IndicatorFxp_ChassisTemperature_TypeInfo; \ + _ticksResource = NiFpga_VMS_##type##_IndicatorU64_Ticks; void FPGA::populate(VMSApplicationSettings *vmsApplicationSettings) { - SPDLOG_TRACE("FPGA::FPGA()"); - _vmsApplicationSettings = vmsApplicationSettings; - session = 0; - remaining = 0; - if (_vmsApplicationSettings->Subsystem == "CameraRotator") { - _channels = 3; - POPULATE_FPGA(CameraRotator); - } else if (_vmsApplicationSettings->Subsystem == "M2") { - _channels = 6; - if (_vmsApplicationSettings->IsController) { - POPULATE_FPGA(6_Controller); - } else { - POPULATE_FPGA(6_Responder); - } - } else if (_vmsApplicationSettings->Subsystem == "M1M3") { - _channels = 3; - if (_vmsApplicationSettings->IsController) { - POPULATE_FPGA(3_Controller); - } else { - POPULATE_FPGA(3_Responder); - } + SPDLOG_TRACE("FPGA::FPGA()"); + _vmsApplicationSettings = vmsApplicationSettings; + session = 0; + remaining = 0; + if (_vmsApplicationSettings->Subsystem == "CameraRotator") { + _channels = 3; + POPULATE_FPGA(CameraRotator); + } else if (_vmsApplicationSettings->Subsystem == "M2") { + _channels = 6; + if (_vmsApplicationSettings->IsController) { + POPULATE_FPGA(6_Controller); + } else { + POPULATE_FPGA(6_Responder); + } + } else if (_vmsApplicationSettings->Subsystem == "M1M3") { + _channels = 3; + if (_vmsApplicationSettings->IsController) { + POPULATE_FPGA(3_Controller); + } else { + POPULATE_FPGA(3_Responder); } + } } void FPGA::initialize() { - SPDLOG_DEBUG("FPGA: initialize()"); + SPDLOG_DEBUG("FPGA: initialize()"); #ifndef SIMULATOR - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Initialize()); + cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Initialize()); #endif } void FPGA::open() { - SPDLOG_DEBUG("FPGA: open({},{},{})", _bitFile, _signature, _vmsApplicationSettings->RIO); + SPDLOG_DEBUG("FPGA: open({},{},{})", _bitFile, _signature, + _vmsApplicationSettings->RIO); #ifndef SIMULATOR - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Open(_bitFile, _signature, - _vmsApplicationSettings->RIO.c_str(), 0, &(session))); - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Download(session)); - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Reset(session)); - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Run(session, 0)); + cRIO::NiThrowError(__PRETTY_FUNCTION__, + NiFpga_Open(_bitFile, _signature, + _vmsApplicationSettings->RIO.c_str(), 0, + &(session))); + cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Download(session)); + cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Reset(session)); + cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Run(session, 0)); #endif } void FPGA::close() { - SPDLOG_DEBUG("FPGA: close()"); + SPDLOG_DEBUG("FPGA: close()"); #ifndef SIMULATOR - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Close(session, 0)); + cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Close(session, 0)); #endif } void FPGA::finalize() { - SPDLOG_DEBUG("FPGA: finalize()"); + SPDLOG_DEBUG("FPGA: finalize()"); #ifndef SIMULATOR - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Finalize()); + cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_Finalize()); #endif } float FPGA::chassisTemperature() { #ifndef SIMULATOR - uint64_t temperature; - cRIO::NiThrowError(__PRETTY_FUNCTION__, - NiFpga_ReadU64(session, _chasisTemperatureResource, &temperature)); - return NiFpga_ConvertFromFxpToFloat(_chasisTemperatureTypeInfo, temperature); + uint64_t temperature; + cRIO::NiThrowError( + __PRETTY_FUNCTION__, + NiFpga_ReadU64(session, _chasisTemperatureResource, &temperature)); + return NiFpga_ConvertFromFxpToFloat(_chasisTemperatureTypeInfo, temperature); #else - return 7.7 + 2.0 * (static_cast(random()) / RAND_MAX); + return 7.7 + 2.0 * (static_cast(random()) / RAND_MAX); #endif } uint64_t FPGA::chassisTicks() { #ifndef SIMULATOR - uint64_t ticks; - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_ReadU64(session, _ticksResource, &ticks)); - return ticks; + uint64_t ticks; + cRIO::NiThrowError(__PRETTY_FUNCTION__, + NiFpga_ReadU64(session, _ticksResource, &ticks)); + return ticks; #else - static uint64_t ticks = 0; - return ticks++; + static uint64_t ticks = 0; + return ticks++; #endif } void FPGA::setOperate(bool operate) { #ifndef SIMULATOR - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_WriteBool(session, _operateResource, operate)); + cRIO::NiThrowError(__PRETTY_FUNCTION__, + NiFpga_WriteBool(session, _operateResource, operate)); #else #endif - Events::FPGAState::instance().setMisc(operate, false, false, false); + Events::FPGAState::instance().setMisc(operate, false, false, false); } void FPGA::setPeriodOutputType(uint32_t period, int16_t outputType) { #ifndef SIMULATOR - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_WriteU32(session, _periodResource, period)); - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_WriteI16(session, _outputTypeResource, outputType)); + cRIO::NiThrowError(__PRETTY_FUNCTION__, + NiFpga_WriteU32(session, _periodResource, period)); + cRIO::NiThrowError(__PRETTY_FUNCTION__, + NiFpga_WriteI16(session, _outputTypeResource, outputType)); #else - // _ready = true; + // _ready = true; #endif - Events::FPGAState::instance().setPeriodOutputType(period, outputType); + Events::FPGAState::instance().setPeriodOutputType(period, outputType); } bool FPGA::ready() { #ifndef SIMULATOR - NiFpga_Bool ret = false; - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_ReadBool(session, _readyResource, &ret)); - return ret; + NiFpga_Bool ret = false; + cRIO::NiThrowError(__PRETTY_FUNCTION__, + NiFpga_ReadBool(session, _readyResource, &ret)); + return ret; #else - return true; + return true; #endif } bool FPGA::timeouted() { #ifndef SIMULATOR - NiFpga_Bool ret = false; - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_ReadBool(session, _timeoutedResource, &ret)); - return ret; + NiFpga_Bool ret = false; + cRIO::NiThrowError(__PRETTY_FUNCTION__, + NiFpga_ReadBool(session, _timeoutedResource, &ret)); + return ret; #else - return false; + return false; #endif } bool FPGA::stopped() { #ifndef SIMULATOR - NiFpga_Bool ret = false; - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_ReadBool(session, _stoppedResource, &ret)); - return ret; + NiFpga_Bool ret = false; + cRIO::NiThrowError(__PRETTY_FUNCTION__, + NiFpga_ReadBool(session, _stoppedResource, &ret)); + return ret; #else - return false; + return false; #endif } bool FPGA::FIFOFull() { #ifndef SIMULATOR - NiFpga_Bool ret = false; - cRIO::NiThrowError(__PRETTY_FUNCTION__, NiFpga_ReadBool(session, _fifoFullResource, &ret)); - return ret; + NiFpga_Bool ret = false; + cRIO::NiThrowError(__PRETTY_FUNCTION__, + NiFpga_ReadBool(session, _fifoFullResource, &ret)); + return ret; #else - return false; + return false; #endif } -void FPGA::readResponseFIFO(uint32_t *data, size_t length, int32_t timeoutInMs) { - SPDLOG_TRACE("FPGA: readResponseFIFO({}, {})", length, timeoutInMs); +void FPGA::readResponseFIFO(uint32_t *data, size_t length, + int32_t timeoutInMs) { + SPDLOG_TRACE("FPGA: readResponseFIFO({}, {})", length, timeoutInMs); #ifndef SIMULATOR - cRIO::NiThrowError(__PRETTY_FUNCTION__, - NiFpga_ReadFifoU32(session, _responseFIFO, data, length, timeoutInMs, &remaining)); + cRIO::NiThrowError(__PRETTY_FUNCTION__, + NiFpga_ReadFifoU32(session, _responseFIFO, data, length, + timeoutInMs, &remaining)); // enable this if you are looking for raw, at source accelerometers data #if 0 size_t i = length; @@ -222,35 +238,39 @@ void FPGA::readResponseFIFO(uint32_t *data, size_t length, int32_t timeoutInMs) } #endif #else - static long count = 0; - static auto start = std::chrono::steady_clock::now(); - size_t channels = _channels * 3; - int period = Events::FPGAState::instance().getPeriod(); - for (size_t i = 0; i < length; i += channels) { - double cv = (2 * M_PI * period * static_cast(count++)) / 1000.0f; - // data are produced at Events::FPGAState::instance().getPeriod() ms period - // scales target frequency into 0..2pi sin/cos period - auto frequency_to_period = [cv](double frequency) { return (cv * frequency); }; - for (size_t j = 0; j < channels; j++) { - size_t ch_index = i + j; - // introduce periodic signals with frequencies of 61.3, 50.2 + - // channel, 30.9 - channel and 17.5 Hz - double pv = 1.5 * cos(frequency_to_period(61.3)) + - ((20 + j) / 10.0) * sin(frequency_to_period(50 + j)) + - ((channels + 20 - j) / 10.0) * sin(frequency_to_period(30 - j)) + - 3 * cos(frequency_to_period(17.5)); - float d = ((0.0002 * static_cast(random()) / RAND_MAX) - 0.0001) + pv / 10.0; - uint64_t fxp = NiFpga_ConvertFromFloatToFxp(ResponseFxpTypeInfo, d); - data[ch_index] = fxp; + static long count = 0; + static auto start = std::chrono::steady_clock::now(); + size_t channels = _channels * 3; + int period = Events::FPGAState::instance().getPeriod(); + for (size_t i = 0; i < length; i += channels) { + double cv = (2 * M_PI * period * static_cast(count++)) / 1000.0f; + // data are produced at Events::FPGAState::instance().getPeriod() ms period + // scales target frequency into 0..2pi sin/cos period + auto frequency_to_period = [cv](double frequency) { + return (cv * frequency); + }; + for (size_t j = 0; j < channels; j++) { + size_t ch_index = i + j; + // introduce periodic signals with frequencies of 61.3, 50.2 + + // channel, 30.9 - channel and 17.5 Hz + double pv = + 1.5 * cos(frequency_to_period(61.3)) + + ((20 + j) / 10.0) * sin(frequency_to_period(50 + j)) + + ((channels + 20 - j) / 10.0) * sin(frequency_to_period(30 - j)) + + 3 * cos(frequency_to_period(17.5)); + float d = ((0.0002 * static_cast(random()) / RAND_MAX) - 0.0001) + + pv / 10.0; + uint64_t fxp = NiFpga_ConvertFromFloatToFxp(ResponseFxpTypeInfo, d); + data[ch_index] = fxp; #if 0 std::cout << pv << " " << count << " ch_index " << ch_index << " " << fxp << " " << d << " " << data[ch_index] << " " << Events::FPGAState::instance().getPeriod() << " " << frequency_to_period(200) << std::endl; #endif - } - start += std::chrono::milliseconds(period); - std::this_thread::sleep_until(start); } + start += std::chrono::milliseconds(period); + std::this_thread::sleep_until(start); + } #endif } diff --git a/src/LSST/VMS/FPGA.h b/src/LSST/VMS/FPGA.h index f1a0240..ac69649 100644 --- a/src/LSST/VMS/FPGA.h +++ b/src/LSST/VMS/FPGA.h @@ -41,48 +41,48 @@ class VMSApplicationSettings; */ class FPGA : public LSST::cRIO::SimpleFPGA, public LSST::cRIO::Singleton { public: - FPGA(token); + FPGA(token); - void populate(VMSApplicationSettings *vmsApplicationSettings); + void populate(VMSApplicationSettings *vmsApplicationSettings); - void initialize() override; - void open() override; - void close() override; - void finalize() override; + void initialize() override; + void open() override; + void close() override; + void finalize() override; - float chassisTemperature(); - uint64_t chassisTicks(); - void setOperate(bool operate); - void setPeriodOutputType(uint32_t period, int16_t outputType); + float chassisTemperature(); + uint64_t chassisTicks(); + void setOperate(bool operate); + void setPeriodOutputType(uint32_t period, int16_t outputType); - bool ready(); - bool timeouted(); - bool stopped(); - bool FIFOFull(); + bool ready(); + bool timeouted(); + bool stopped(); + bool FIFOFull(); - void readResponseFIFO(uint32_t *data, size_t length, int32_t timeoutInMs); + void readResponseFIFO(uint32_t *data, size_t length, int32_t timeoutInMs); private: - VMSApplicationSettings *_vmsApplicationSettings; - uint32_t session; - size_t remaining; - uint8_t _channels; - const char *_bitFile; - const char *_signature; - uint32_t _responseFIFO; - uint32_t _chasisTemperatureResource; - NiFpga_FxpTypeInfo _chasisTemperatureTypeInfo; - uint32_t _operateResource; - uint32_t _readyResource; - uint32_t _periodResource; - uint32_t _outputTypeResource; - uint32_t _stoppedResource; - uint32_t _timeoutedResource; - uint32_t _fifoFullResource; - uint32_t _ticksResource; + VMSApplicationSettings *_vmsApplicationSettings; + uint32_t session; + size_t remaining; + uint8_t _channels; + const char *_bitFile; + const char *_signature; + uint32_t _responseFIFO; + uint32_t _chasisTemperatureResource; + NiFpga_FxpTypeInfo _chasisTemperatureTypeInfo; + uint32_t _operateResource; + uint32_t _readyResource; + uint32_t _periodResource; + uint32_t _outputTypeResource; + uint32_t _stoppedResource; + uint32_t _timeoutedResource; + uint32_t _fifoFullResource; + uint32_t _ticksResource; }; -} // namespace VMS -} // namespace LSST +} // namespace VMS +} // namespace LSST #endif /* FPGA_H_ */ diff --git a/src/LSST/VMS/FPGAAddresses.h b/src/LSST/VMS/FPGAAddresses.h index de100cb..5ffcb03 100644 --- a/src/LSST/VMS/FPGAAddresses.h +++ b/src/LSST/VMS/FPGAAddresses.h @@ -15,12 +15,12 @@ namespace VMS { * An enumeration match FPGA signals to port numbers. */ struct FPGAAddresses { - enum Type { - NA = 0, - Accelerometers = 1, - Timestamp = 2, - ChasisTemperature = 3, - }; + enum Type { + NA = 0, + Accelerometers = 1, + Timestamp = 2, + ChasisTemperature = 3, + }; }; } /* namespace VMS */ diff --git a/src/LSST/VMS/SettingReader.cpp b/src/LSST/VMS/SettingReader.cpp index 5a12457..f008868 100644 --- a/src/LSST/VMS/SettingReader.cpp +++ b/src/LSST/VMS/SettingReader.cpp @@ -29,18 +29,22 @@ namespace LSST { namespace VMS { void SettingReader::setRootPath(std::string rootPath) { - SPDLOG_DEBUG("SettingReader: setRootPath(\"{}\")", rootPath); - _rootPath = rootPath; + SPDLOG_DEBUG("SettingReader: setRootPath(\"{}\")", rootPath); + _rootPath = rootPath; } -const VMSApplicationSettings SettingReader::loadVMSApplicationSettings(std::string subsystem) { - std::string applicationSettingsFile = _getBasePath("/" + subsystem + ".yaml"); - SPDLOG_DEBUG("SettingReader: loadVMSApplicationSettings({})", applicationSettingsFile); - _vmsApplicationSettings.load(applicationSettingsFile); - return _vmsApplicationSettings; +const VMSApplicationSettings +SettingReader::loadVMSApplicationSettings(std::string subsystem) { + std::string applicationSettingsFile = _getBasePath("/" + subsystem + ".yaml"); + SPDLOG_DEBUG("SettingReader: loadVMSApplicationSettings({})", + applicationSettingsFile); + _vmsApplicationSettings.load(applicationSettingsFile); + return _vmsApplicationSettings; } -std::string SettingReader::_getBasePath(std::string file) { return _rootPath + file; } +std::string SettingReader::_getBasePath(std::string file) { + return _rootPath + file; +} } /* namespace VMS */ } /* namespace LSST */ diff --git a/src/LSST/VMS/SettingReader.h b/src/LSST/VMS/SettingReader.h index edb38ef..0bcf736 100644 --- a/src/LSST/VMS/SettingReader.h +++ b/src/LSST/VMS/SettingReader.h @@ -35,17 +35,18 @@ namespace VMS { class SettingReader : public cRIO::Singleton { public: - SettingReader(token) : _rootPath("UNDEFINED") {} - void setRootPath(std::string rootPath); + SettingReader(token) : _rootPath("UNDEFINED") {} + void setRootPath(std::string rootPath); - const VMSApplicationSettings loadVMSApplicationSettings(std::string subsystem); + const VMSApplicationSettings + loadVMSApplicationSettings(std::string subsystem); private: - std::string _getBasePath(std::string file); + std::string _getBasePath(std::string file); - VMSApplicationSettings _vmsApplicationSettings; + VMSApplicationSettings _vmsApplicationSettings; - std::string _rootPath; + std::string _rootPath; }; } /* namespace VMS */ diff --git a/src/LSST/VMS/Telemetry/PSD.cpp b/src/LSST/VMS/Telemetry/PSD.cpp index e04501c..f9393df 100644 --- a/src/LSST/VMS/Telemetry/PSD.cpp +++ b/src/LSST/VMS/Telemetry/PSD.cpp @@ -1,10 +1,10 @@ /* * PSD telemetry handling class. * - * 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. + * 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 @@ -22,8 +22,8 @@ #include -#include "VMSPublisher.h" #include "PSD.h" +#include "VMSPublisher.h" // length of PSD array is defined in XML constexpr size_t MAX_DATAPOINTS = 200; @@ -31,109 +31,115 @@ constexpr size_t MAX_DATAPOINTS = 200; using namespace LSST::VMS::Telemetry; PSD::PSD() { - timestamp = 0; - interval = 1; - sensor = -1; + timestamp = 0; + interval = 1; + sensor = -1; - numDataPoints = 0; - interval = NAN; - _samplingPeriod = NAN; - minPSDFrequency = NAN; - maxPSDFrequency = NAN; + numDataPoints = 0; + interval = NAN; + _samplingPeriod = NAN; + minPSDFrequency = NAN; + maxPSDFrequency = NAN; - _clearPSDs(); + _clearPSDs(); - for (int i = 0; i < 3; i++) { - _cache[i] = NULL; - _output[i] = NULL; - _plans[i] = NULL; - } + for (int i = 0; i < 3; i++) { + _cache[i] = NULL; + _output[i] = NULL; + _plans[i] = NULL; + } - _cache_size = 0; + _cache_size = 0; } PSD::~PSD(void) { - for (int i = 0; i < 3; i++) { - if (_plans[i] != NULL) { - fftw_destroy_plan(_plans[i]); - _plans[i] = NULL; - } - if (_output[i] != NULL) { - fftw_free(_output[i]); - _output[i] = NULL; - } - if (_cache[i] != NULL) { - fftw_free(_cache[i]); - _cache[i] = NULL; - } + for (int i = 0; i < 3; i++) { + if (_plans[i] != NULL) { + fftw_destroy_plan(_plans[i]); + _plans[i] = NULL; + } + if (_output[i] != NULL) { + fftw_free(_output[i]); + _output[i] = NULL; + } + if (_cache[i] != NULL) { + fftw_free(_cache[i]); + _cache[i] = NULL; } + } } -void PSD::configure(short int sensorId, size_t dataPoints, float samplingPeriod) { - sensor = sensorId; - // maximal number of datapoints is defined in XML - numDataPoints = std::min(dataPoints, MAX_DATAPOINTS); - _samplingPeriod = samplingPeriod; - interval = _samplingPeriod * dataPoints; - minPSDFrequency = frequency(0); - maxPSDFrequency = frequency(numDataPoints); - _cache_size = 0; +void PSD::configure(short int sensorId, size_t dataPoints, + float samplingPeriod) { + sensor = sensorId; + // maximal number of datapoints is defined in XML + numDataPoints = std::min(dataPoints, MAX_DATAPOINTS); + _samplingPeriod = samplingPeriod; + interval = _samplingPeriod * dataPoints; + minPSDFrequency = frequency(0); + maxPSDFrequency = frequency(numDataPoints); + _cache_size = 0; + + for (int i = 0; i < 3; i++) { + if (_cache[i] != NULL) { + fftw_free(_cache[i]); + } + _cache[i] = fftw_alloc_real(numDataPoints * 2); - for (int i = 0; i < 3; i++) { - if (_cache[i] != NULL) { - fftw_free(_cache[i]); - } - _cache[i] = fftw_alloc_real(numDataPoints * 2); - - if (_output[i] != NULL) { - fftw_free(_output[i]); - } - _output[i] = fftw_alloc_complex(numDataPoints + 1); - - if (_plans[i] != NULL) { - fftw_free(_plans[i]); - } - _plans[i] = fftw_plan_dft_r2c_1d(numDataPoints * 2, _cache[i], _output[i], FFTW_MEASURE); + if (_output[i] != NULL) { + fftw_free(_output[i]); + } + _output[i] = fftw_alloc_complex(numDataPoints + 1); + + if (_plans[i] != NULL) { + fftw_free(_plans[i]); } + _plans[i] = fftw_plan_dft_r2c_1d(numDataPoints * 2, _cache[i], _output[i], + FFTW_MEASURE); + } } void PSD::append(float x, float y, float z) { - if (_cache[0] == NULL) { - throw std::runtime_error(fmt::format("unconfigured PSD for sensor {}", sensor)); - } - _cache[0][_cache_size] = x; - _cache[1][_cache_size] = y; - _cache[2][_cache_size] = z; + if (_cache[0] == NULL) { + throw std::runtime_error( + fmt::format("unconfigured PSD for sensor {}", sensor)); + } + _cache[0][_cache_size] = x; + _cache[1][_cache_size] = y; + _cache[2][_cache_size] = z; - _cache_size++; + _cache_size++; - if (_cache_size >= static_cast(numDataPoints) * 2) { - float *tels[3] = {accelerationPSDX, accelerationPSDY, accelerationPSDZ}; + if (_cache_size >= static_cast(numDataPoints) * 2) { + float *tels[3] = {accelerationPSDX, accelerationPSDY, accelerationPSDZ}; - for (int i = 0; i < 3; i++) { - fftw_execute(_plans[i]); + for (int i = 0; i < 3; i++) { + fftw_execute(_plans[i]); - float *tel_out = tels[i]; + float *tel_out = tels[i]; - fftw_complex *cur_out = _output[i]; - for (int j = 0; j < numDataPoints; j++, cur_out++, tel_out++) { - *tel_out = std::norm(std::complex((*cur_out)[0], (*cur_out)[1])); - } - } + fftw_complex *cur_out = _output[i]; + for (int j = 0; j < numDataPoints; j++, cur_out++, tel_out++) { + *tel_out = + std::norm(std::complex((*cur_out)[0], (*cur_out)[1])); + } + } - VMSPublisher::instance().putPsd(this); - _clearPSDs(); + VMSPublisher::instance().putPsd(this); + _clearPSDs(); - _cache_size = 0; - } + _cache_size = 0; + } } -float PSD::frequency(size_t index) { return index * (1 / (2.0f * _samplingPeriod)) / numDataPoints; } +float PSD::frequency(size_t index) { + return index * (1 / (2.0f * _samplingPeriod)) / numDataPoints; +} void PSD::_clearPSDs() { - for (size_t i = 0; i < MAX_DATAPOINTS; i++) { - accelerationPSDX[i] = NAN; - accelerationPSDY[i] = NAN; - accelerationPSDZ[i] = NAN; - } + for (size_t i = 0; i < MAX_DATAPOINTS; i++) { + accelerationPSDX[i] = NAN; + accelerationPSDY[i] = NAN; + accelerationPSDZ[i] = NAN; + } } diff --git a/src/LSST/VMS/Telemetry/PSD.h b/src/LSST/VMS/Telemetry/PSD.h index dafa1a1..9910996 100644 --- a/src/LSST/VMS/Telemetry/PSD.h +++ b/src/LSST/VMS/Telemetry/PSD.h @@ -1,10 +1,10 @@ /* * PSD telemetry handling class. * - * 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. + * 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 @@ -42,54 +42,55 @@ namespace Telemetry { */ class PSD final : public MTVMS_psdC { public: - PSD(); - ~PSD(void); + PSD(); + ~PSD(void); - /** - * Sets PSD configuration. - * - * @param sensorId - * - * @param dataPoints Number of points in PSD. According to Nyquist theorem, - * at least dataPoints * 2 samples must be provided (with append call) to - * compute PSD - * - * @param samplingFrequency sample frequency. Converts indices in output - * FFT into frequencies. - */ - void configure(short int sensorId, size_t dataPoints, float samplingFrequency); + /** + * Sets PSD configuration. + * + * @param sensorId + * + * @param dataPoints Number of points in PSD. According to Nyquist theorem, + * at least dataPoints * 2 samples must be provided (with append call) to + * compute PSD + * + * @param samplingFrequency sample frequency. Converts indices in output + * FFT into frequencies. + */ + void configure(short int sensorId, size_t dataPoints, + float samplingFrequency); - /** - * Append new data point. - * - * @param x measured X acceleration - * @param y measured Y acceleration - * @param z measured Z acceleration - */ - void append(float x, float y, float z); + /** + * Append new data point. + * + * @param x measured X acceleration + * @param y measured Y acceleration + * @param z measured Z acceleration + */ + void append(float x, float y, float z); - /** - * Calculate frequency from given index in the PSD array. - * - * @param index index of member in PSD - * - * @return frequency corresponding to the input index - */ - float frequency(size_t index); + /** + * Calculate frequency from given index in the PSD array. + * + * @param index index of member in PSD + * + * @return frequency corresponding to the input index + */ + float frequency(size_t index); private: - float _samplingPeriod; - // axis cache - size_t _cache_size; - double* _cache[3]; - fftw_complex* _output[3]; - fftw_plan _plans[3]; + float _samplingPeriod; + // axis cache + size_t _cache_size; + double *_cache[3]; + fftw_complex *_output[3]; + fftw_plan _plans[3]; - void _clearPSDs(); + void _clearPSDs(); }; -} // namespace Telemetry -} // namespace VMS -} // namespace LSST +} // namespace Telemetry +} // namespace VMS +} // namespace LSST #endif /** _VMS_Telemetry_PSD_ */ diff --git a/src/LSST/VMS/VMSApplicationSettings.cpp b/src/LSST/VMS/VMSApplicationSettings.cpp index 7a7bc26..2912df0 100644 --- a/src/LSST/VMS/VMSApplicationSettings.cpp +++ b/src/LSST/VMS/VMSApplicationSettings.cpp @@ -22,8 +22,8 @@ */ #include -#include #include +#include #include @@ -31,39 +31,40 @@ namespace LSST { namespace VMS { void VMSApplicationSettings::load(const std::string &filename) { - SPDLOG_TRACE("VMSApplicationSettings({})", filename); - try { - YAML::Node doc = YAML::LoadFile(filename); + SPDLOG_TRACE("VMSApplicationSettings({})", filename); + try { + YAML::Node doc = YAML::LoadFile(filename); - Subsystem = doc["Subsystem"].as(); - IsController = doc["IsController"].as(); - period = doc["Period"].as(5); - outputType = doc["OutputType"].as(3); - RIO = doc["RIO"].as("RIO0"); - XCoefficients = doc["XCoefficients"].as>(); - YCoefficients = doc["YCoefficients"].as>(); - ZCoefficients = doc["ZCoefficients"].as>(); - XOffsets = doc["XOffsets"].as>(); - YOffsets = doc["YOffsets"].as>(); - ZOffsets = doc["ZOffsets"].as>(); - } catch (YAML::Exception &ex) { - SPDLOG_CRITICAL("YAML Loading {}: {}", filename, ex.what()); - exit(EXIT_FAILURE); - } + Subsystem = doc["Subsystem"].as(); + IsController = doc["IsController"].as(); + period = doc["Period"].as(5); + outputType = doc["OutputType"].as(3); + RIO = doc["RIO"].as("RIO0"); + XCoefficients = doc["XCoefficients"].as>(); + YCoefficients = doc["YCoefficients"].as>(); + ZCoefficients = doc["ZCoefficients"].as>(); + XOffsets = doc["XOffsets"].as>(); + YOffsets = doc["YOffsets"].as>(); + ZOffsets = doc["ZOffsets"].as>(); + } catch (YAML::Exception &ex) { + SPDLOG_CRITICAL("YAML Loading {}: {}", filename, ex.what()); + exit(EXIT_FAILURE); + } - auto check_vector = [](const char *name, std::vector vec) { - if (vec.size() != 3) { - SPDLOG_CRITICAL("Invalid array {} length: {}, expected 3", name, vec.size()); - exit(EXIT_FAILURE); - } - }; + auto check_vector = [](const char *name, std::vector vec) { + if (vec.size() != 3) { + SPDLOG_CRITICAL("Invalid array {} length: {}, expected 3", name, + vec.size()); + exit(EXIT_FAILURE); + } + }; - check_vector("XCoefficients", XCoefficients); - check_vector("YCoefficients", YCoefficients); - check_vector("ZCoefficients", ZCoefficients); - check_vector("XOffsets", XOffsets); - check_vector("YOffsets", YOffsets); - check_vector("ZOffsets", ZOffsets); + check_vector("XCoefficients", XCoefficients); + check_vector("YCoefficients", YCoefficients); + check_vector("ZCoefficients", ZCoefficients); + check_vector("XOffsets", XOffsets); + check_vector("YOffsets", YOffsets); + check_vector("ZOffsets", ZOffsets); } } /* namespace VMS */ diff --git a/src/LSST/VMS/VMSApplicationSettings.h b/src/LSST/VMS/VMSApplicationSettings.h index 8cee4d3..c09fc93 100644 --- a/src/LSST/VMS/VMSApplicationSettings.h +++ b/src/LSST/VMS/VMSApplicationSettings.h @@ -32,19 +32,19 @@ namespace VMS { class VMSApplicationSettings { public: - std::string Subsystem; - bool IsController; - int32_t period; - int outputType; - std::string RIO; - std::vector XCoefficients; - std::vector YCoefficients; - std::vector ZCoefficients; - std::vector XOffsets; - std::vector YOffsets; - std::vector ZOffsets; + std::string Subsystem; + bool IsController; + int32_t period; + int outputType; + std::string RIO; + std::vector XCoefficients; + std::vector YCoefficients; + std::vector ZCoefficients; + std::vector XOffsets; + std::vector YOffsets; + std::vector ZOffsets; - void load(const std::string &filename); + void load(const std::string &filename); }; } /* namespace VMS */ diff --git a/src/LSST/VMS/VMSPublisher.cpp b/src/LSST/VMS/VMSPublisher.cpp index 8471de4..1860cdb 100644 --- a/src/LSST/VMS/VMSPublisher.cpp +++ b/src/LSST/VMS/VMSPublisher.cpp @@ -5,64 +5,64 @@ * Author: ccontaxis */ -#include #include #include +#include namespace LSST { namespace VMS { VMSPublisher::VMSPublisher(token) { - SPDLOG_DEBUG("VMSPublisher: VMSPublisher()"); - _vmsSAL = NULL; + SPDLOG_DEBUG("VMSPublisher: VMSPublisher()"); + _vmsSAL = NULL; } VMSPublisher::~VMSPublisher() {} void VMSPublisher::setSAL(std::shared_ptr sal) { - SPDLOG_DEBUG("VMSPublisher::setSAL()"); - _vmsSAL = sal; + SPDLOG_DEBUG("VMSPublisher::setSAL()"); + _vmsSAL = sal; - SPDLOG_DEBUG("VMSPublisher: Initializing SAL Telemetry"); - _vmsSAL->salTelemetryPub((char *)"MTVMS_data"); - _vmsSAL->salTelemetryPub((char *)"MTVMS_miscellaneous"); - _vmsSAL->salTelemetryPub((char *)"MTVMS_psd"); + SPDLOG_DEBUG("VMSPublisher: Initializing SAL Telemetry"); + _vmsSAL->salTelemetryPub((char *)"MTVMS_data"); + _vmsSAL->salTelemetryPub((char *)"MTVMS_miscellaneous"); + _vmsSAL->salTelemetryPub((char *)"MTVMS_psd"); - SPDLOG_DEBUG("VMSPublisher: Initializing SAL Events"); - _vmsSAL->salEventPub((char *)"MTVMS_logevent_heartbeat"); - _vmsSAL->salEventPub((char *)"MTVMS_logevent_logLevel"); - _vmsSAL->salEventPub((char *)"MTVMS_logevent_summaryState"); - _vmsSAL->salEventPub((char *)"MTVMS_logevent_softwareVersions"); - _vmsSAL->salEventPub((char *)"MTVMS_logevent_simulationMode"); - _vmsSAL->salEventPub((char *)"MTVMS_logevent_fpgaState"); + SPDLOG_DEBUG("VMSPublisher: Initializing SAL Events"); + _vmsSAL->salEventPub((char *)"MTVMS_logevent_heartbeat"); + _vmsSAL->salEventPub((char *)"MTVMS_logevent_logLevel"); + _vmsSAL->salEventPub((char *)"MTVMS_logevent_summaryState"); + _vmsSAL->salEventPub((char *)"MTVMS_logevent_softwareVersions"); + _vmsSAL->salEventPub((char *)"MTVMS_logevent_simulationMode"); + _vmsSAL->salEventPub((char *)"MTVMS_logevent_fpgaState"); } void VMSPublisher::setLogLevel(int newLevel) { - if (_logLevel.level != newLevel) { - SPDLOG_TRACE("logEvent_logLevel {}", newLevel); - _logLevel.level = newLevel; - _vmsSAL->logEvent_logLevel(&_logLevel, 0); - } + if (_logLevel.level != newLevel) { + SPDLOG_TRACE("logEvent_logLevel {}", newLevel); + _logLevel.level = newLevel; + _vmsSAL->logEvent_logLevel(&_logLevel, 0); + } } void VMSPublisher::logSoftwareVersions() { - MTVMS_logevent_softwareVersionsC versions; - versions.salVersion = SAL_MTVMS::getSALVersion(); - versions.xmlVersion = SAL_MTVMS::getXMLVersion(); - versions.openSpliceVersion = SAL_MTVMS::getOSPLVersion(); - versions.cscVersion = VERSION; - versions.subsystemVersions = ""; - _vmsSAL->logEvent_softwareVersions(&versions, 0); + MTVMS_logevent_softwareVersionsC versions; + versions.salVersion = SAL_MTVMS::getSALVersion(); + versions.xmlVersion = SAL_MTVMS::getXMLVersion(); + versions.openSpliceVersion = SAL_MTVMS::getOSPLVersion(); + versions.cscVersion = VERSION; + versions.subsystemVersions = ""; + _vmsSAL->logEvent_softwareVersions(&versions, 0); } void VMSPublisher::logSimulationMode() { - MTVMS_logevent_simulationModeC simulation; + MTVMS_logevent_simulationModeC simulation; #ifdef SIMULATOR - simulation.mode = 1; + simulation.mode = 1; #else - simulation.mode = 0; + simulation.mode = 0; #endif - _vmsSAL->logEvent_simulationMode(&simulation, 0); + _vmsSAL->logEvent_simulationMode(&simulation, 0); } double VMSPublisher::getTimestamp() { return _vmsSAL->getCurrentTime(); } diff --git a/src/LSST/VMS/VMSPublisher.h b/src/LSST/VMS/VMSPublisher.h index 0530339..37706d7 100644 --- a/src/LSST/VMS/VMSPublisher.h +++ b/src/LSST/VMS/VMSPublisher.h @@ -21,36 +21,38 @@ namespace VMS { */ class VMSPublisher : public cRIO::Singleton { public: - VMSPublisher(token); - ~VMSPublisher(); + VMSPublisher(token); + ~VMSPublisher(); - void setSAL(std::shared_ptr sal); + void setSAL(std::shared_ptr sal); - static std::shared_ptr SAL() { return instance()._vmsSAL; } + static std::shared_ptr SAL() { return instance()._vmsSAL; } - void setLogLevel(int newLevel); + void setLogLevel(int newLevel); - void logHeartbeat(MTVMS_logevent_heartbeatC *data) { _vmsSAL->logEvent_heartbeat(data, 0); } - void logSoftwareVersions(); - void logSimulationMode(); + void logHeartbeat(MTVMS_logevent_heartbeatC *data) { + _vmsSAL->logEvent_heartbeat(data, 0); + } + void logSoftwareVersions(); + void logSimulationMode(); - double getTimestamp(); + double getTimestamp(); - void putData(MTVMS_dataC *data) { _vmsSAL->putSample_data(data); } - void putPsd(MTVMS_psdC *psd) { _vmsSAL->putSample_psd(psd); } + void putData(MTVMS_dataC *data) { _vmsSAL->putSample_data(data); } + void putPsd(MTVMS_psdC *psd) { _vmsSAL->putSample_psd(psd); } - void putMiscellaneous(float chassisTemperature, int64_t ticks) { - _miscellaneous.chassisTemperature = chassisTemperature; - _miscellaneous.ticks = ticks; - _vmsSAL->putSample_miscellaneous(&_miscellaneous); - } + void putMiscellaneous(float chassisTemperature, int64_t ticks) { + _miscellaneous.chassisTemperature = chassisTemperature; + _miscellaneous.ticks = ticks; + _vmsSAL->putSample_miscellaneous(&_miscellaneous); + } private: - std::shared_ptr _vmsSAL; + std::shared_ptr _vmsSAL; - MTVMS_miscellaneousC _miscellaneous; + MTVMS_miscellaneousC _miscellaneous; - MTVMS_logevent_logLevelC _logLevel; + MTVMS_logevent_logLevelC _logLevel; }; } /* namespace VMS */ diff --git a/src/LSST/VMS/VMSSubscriber.cpp b/src/LSST/VMS/VMSSubscriber.cpp index 82194f4..7a3387b 100644 --- a/src/LSST/VMS/VMSSubscriber.cpp +++ b/src/LSST/VMS/VMSSubscriber.cpp @@ -1,10 +1,10 @@ /* * VMSSubscriber class. * - * 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. + * 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 @@ -20,105 +20,113 @@ * this program. If not, see . */ -#include #include +#include +#include #include #include -#include #include #include using namespace LSST::VMS; -constexpr int32_t ACK_INPROGRESS = 301; /// Acknowledges command reception, command is being executed. -constexpr int32_t ACK_COMPLETE = 303; /// Command is completed. -constexpr int32_t ACK_FAILED = -302; /// Command execution failed. - -VMSSubscriber::VMSSubscriber(std::shared_ptr vmsSAL, std::shared_ptr allvmsSAL) { -#define ADD_SAL_COMMAND(name) \ - _commands[#name] = [vmsSAL]() { \ - MTVMS_command_##name##C data; \ - int32_t commandID = vmsSAL->acceptCommand_##name(&data); \ - if (commandID <= 0) return; \ - cRIO::ControllerThread::instance().enqueue(new Commands::SAL_##name(commandID, &data)); \ - } - - ADD_SAL_COMMAND(start); - ADD_SAL_COMMAND(enable); - ADD_SAL_COMMAND(disable); - ADD_SAL_COMMAND(standby); - ADD_SAL_COMMAND(exitControl); - ADD_SAL_COMMAND(changeSamplePeriod); - -#define ADD_SAL_EVENT(name) \ - _events[#name] = [allvmsSAL]() { \ - MTVMS_logevent_##name##C data; \ - int32_t result = allvmsSAL->getEvent_##name(&data); \ - if (result == SAL__NO_UPDATES) return; \ - cRIO::ControllerThread::instance().enqueueEvent(new Commands::SAL_##name(&data)); \ - } - - ADD_SAL_EVENT(timeSynchronization); - - _commands["setLogLevel"] = [vmsSAL]() { - MTVMS_command_setLogLevelC data; - MTVMS_logevent_logLevelC newData; - int32_t commandID = vmsSAL->acceptCommand_setLogLevel(&data); - if (commandID <= 0) return; - - if (data.level >= 40) { - spdlog::set_level(spdlog::level::err); - newData.level = 40; - } else if (data.level >= 30) { - spdlog::set_level(spdlog::level::warn); - newData.level = 30; - } else if (data.level >= 20) { - spdlog::set_level(spdlog::level::info); - newData.level = 20; - } else if (data.level >= 10) { - spdlog::set_level(spdlog::level::debug); - newData.level = 10; - } else { - spdlog::set_level(spdlog::level::trace); - newData.level = 0; - } - vmsSAL->ackCommand_setLogLevel(commandID, ACK_COMPLETE, 0, (char *)"Complete"); - vmsSAL->logEvent_logLevel(&newData, 0); - }; - - // register all commands - for (auto c : _commands) { - SPDLOG_TRACE("Registering command {}", c.first); - vmsSAL->salProcessor((char *)("MTVMS_command_" + c.first).c_str()); - } - - // register events - for (auto e : _events) { - SPDLOG_TRACE("Registering event {}", e.first); - allvmsSAL->salEventSub((char *)("MTVMS_logevent_" + e.first).c_str()); +constexpr int32_t ACK_INPROGRESS = + 301; /// Acknowledges command reception, command is being executed. +constexpr int32_t ACK_COMPLETE = 303; /// Command is completed. +constexpr int32_t ACK_FAILED = -302; /// Command execution failed. + +VMSSubscriber::VMSSubscriber(std::shared_ptr vmsSAL, + std::shared_ptr allvmsSAL) { +#define ADD_SAL_COMMAND(name) \ + _commands[#name] = [vmsSAL]() { \ + MTVMS_command_##name##C data; \ + int32_t commandID = vmsSAL->acceptCommand_##name(&data); \ + if (commandID <= 0) \ + return; \ + cRIO::ControllerThread::instance().enqueue( \ + new Commands::SAL_##name(commandID, &data)); \ + } + + ADD_SAL_COMMAND(start); + ADD_SAL_COMMAND(enable); + ADD_SAL_COMMAND(disable); + ADD_SAL_COMMAND(standby); + ADD_SAL_COMMAND(exitControl); + ADD_SAL_COMMAND(changeSamplePeriod); + +#define ADD_SAL_EVENT(name) \ + _events[#name] = [allvmsSAL]() { \ + MTVMS_logevent_##name##C data; \ + int32_t result = allvmsSAL->getEvent_##name(&data); \ + if (result == SAL__NO_UPDATES) \ + return; \ + cRIO::ControllerThread::instance().enqueueEvent( \ + new Commands::SAL_##name(&data)); \ + } + + ADD_SAL_EVENT(timeSynchronization); + + _commands["setLogLevel"] = [vmsSAL]() { + MTVMS_command_setLogLevelC data; + MTVMS_logevent_logLevelC newData; + int32_t commandID = vmsSAL->acceptCommand_setLogLevel(&data); + if (commandID <= 0) + return; + + if (data.level >= 40) { + spdlog::set_level(spdlog::level::err); + newData.level = 40; + } else if (data.level >= 30) { + spdlog::set_level(spdlog::level::warn); + newData.level = 30; + } else if (data.level >= 20) { + spdlog::set_level(spdlog::level::info); + newData.level = 20; + } else if (data.level >= 10) { + spdlog::set_level(spdlog::level::debug); + newData.level = 10; + } else { + spdlog::set_level(spdlog::level::trace); + newData.level = 0; } + vmsSAL->ackCommand_setLogLevel(commandID, ACK_COMPLETE, 0, + (char *)"Complete"); + vmsSAL->logEvent_logLevel(&newData, 0); + }; + + // register all commands + for (auto c : _commands) { + SPDLOG_TRACE("Registering command {}", c.first); + vmsSAL->salProcessor((char *)("MTVMS_command_" + c.first).c_str()); + } + + // register events + for (auto e : _events) { + SPDLOG_TRACE("Registering event {}", e.first); + allvmsSAL->salEventSub((char *)("MTVMS_logevent_" + e.first).c_str()); + } } VMSSubscriber::~VMSSubscriber() {} void VMSSubscriber::run(std::unique_lock &lock) { - while (keepRunning) { - runCondition.wait_for(lock, 100ms); - tryCommands(); - tryEvents(); - } + while (keepRunning) { + runCondition.wait_for(lock, 100ms); + tryCommands(); + tryEvents(); + } } void VMSSubscriber::tryCommands() { - for (auto c : _commands) { - c.second(); - } + for (auto c : _commands) { + c.second(); + } } void VMSSubscriber::tryEvents() { - for (auto e : _events) { - e.second(); - } + for (auto e : _events) { + e.second(); + } } diff --git a/src/LSST/VMS/VMSSubscriber.h b/src/LSST/VMS/VMSSubscriber.h index 8f90bc7..41721d4 100644 --- a/src/LSST/VMS/VMSSubscriber.h +++ b/src/LSST/VMS/VMSSubscriber.h @@ -1,10 +1,10 @@ /* * Thread to subscribe to other CSC. * - * 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. + * 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 @@ -23,8 +23,8 @@ #ifndef _VMS_VMSSubscriber_h #define _VMS_VMSSubscriber_h -#include #include +#include #include #include @@ -36,21 +36,22 @@ namespace VMS { class VMSSubscriber : public cRIO::Thread { public: - VMSSubscriber(std::shared_ptr vmsSAL, std::shared_ptr allvmsSAL); - virtual ~VMSSubscriber(); + VMSSubscriber(std::shared_ptr vmsSAL, + std::shared_ptr allvmsSAL); + virtual ~VMSSubscriber(); protected: - void run(std::unique_lock& lock) override; + void run(std::unique_lock &lock) override; private: - std::map> _commands; - std::map> _events; + std::map> _commands; + std::map> _events; - void tryCommands(); - void tryEvents(); + void tryCommands(); + void tryEvents(); }; -} // namespace VMS -} // namespace LSST +} // namespace VMS +} // namespace LSST -#endif //! _VMS_VMSSubscriber_h +#endif //! _VMS_VMSSubscriber_h diff --git a/src/NiFpga/NiFpga.c b/src/NiFpga/NiFpga.c index d0cdb4d..5b5566d 100644 --- a/src/NiFpga/NiFpga.c +++ b/src/NiFpga/NiFpga.c @@ -14,16 +14,16 @@ #if NiFpga_Windows #include #elif NiFpga_VxWorks -#include -#include #include +#include #include -MODULE_ID VxLoadLibraryFromPath(const char* path, int flags); +#include +MODULE_ID VxLoadLibraryFromPath(const char *path, int flags); STATUS VxFreeLibrary(MODULE_ID library, int flags); #elif NiFpga_Linux || NiFpga_MacOsX -#include -#include #include +#include +#include #else #error #endif @@ -47,7 +47,7 @@ static HMODULE NiFpga_library = NULL; #elif NiFpga_VxWorks static MODULE_ID NiFpga_library = NULL; #elif NiFpga_Linux || NiFpga_MacOsX -static void* NiFpga_library = NULL; +static void *NiFpga_library = NULL; #else #error #endif @@ -58,13 +58,15 @@ static void* NiFpga_library = NULL; #if NiFpga_Cvi && NiFpga_Windows #define NiFpga_CviResourceTracking 1 -static char* const NiFpga_cviResourceType = "FPGA Interface C API"; +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 @@ -72,1451 +74,1874 @@ 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; +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); + if (NiFpga_acquireCviResource && NiFpga_IsNotError(result)) + NiFpga_acquireCviResource((void *)*session, NiFpga_cviResourceType, + "NiFpga_Session %#08x", *session); #endif - return result; + return result; } -static NiFpga_Status(NiFpga_CCall* NiFpga_close)(NiFpga_Session session, uint32_t attribute) = NULL; +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_close) + return NiFpga_Status_ResourceNotInitialized; #if NiFpga_CviResourceTracking - if (NiFpga_releaseCviResource) NiFpga_releaseCviResource((void*)session); + if (NiFpga_releaseCviResource) + NiFpga_releaseCviResource((void *)session); #endif - return NiFpga_close(session, attribute); + 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; + 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; + 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; + 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; + 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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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_ReadDbl(NiFpga_Session session, uint32_t indicator, + double *value) { + return NiFpga_readDbl ? NiFpga_readDbl(session, indicator, value) + : NiFpga_Status_ResourceNotInitialized; } /* * Functions to write to scalar controls and indicators. */ -static NiFpga_Status(NiFpga_CCall* NiFpga_writeBool)(NiFpga_Session session, uint32_t control, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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; +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, +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_WriteDbl(NiFpga_Session session, uint32_t control, + double value) { + return NiFpga_writeDbl ? NiFpga_writeDbl(session, control, value) + : NiFpga_Status_ResourceNotInitialized; } /* * 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_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_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_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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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_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_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_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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; - -NiFpga_Status NiFpga_ReserveIrqContext(NiFpga_Session session, NiFpga_IrqContext* context) { - const NiFpga_Status result = NiFpga_reserveIrqContext ? NiFpga_reserveIrqContext(session, context) - : NiFpga_Status_ResourceNotInitialized; +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); + if (NiFpga_acquireCviResource && NiFpga_IsNotError(result)) + NiFpga_acquireCviResource(*context, NiFpga_cviResourceType, + "NiFpga_IrqContext 0x%p", *context); #endif - return result; + return result; } -static NiFpga_Status(NiFpga_CCall* NiFpga_unreserveIrqContext)(NiFpga_Session session, - NiFpga_IrqContext context) = NULL; +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; +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); + if (NiFpga_releaseCviResource) + NiFpga_releaseCviResource(context); #endif - return NiFpga_unreserveIrqContext(session, context); + 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; +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; +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; +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; + 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, +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; +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; +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; +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; +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, +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; + 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; +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, +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; + 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; +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, +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; + 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; +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, +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; + 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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; +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; + return NiFpga_startFifo ? NiFpga_startFifo(session, fifo) + : NiFpga_Status_ResourceNotInitialized; } -static NiFpga_Status(NiFpga_CCall* NiFpga_stopFifo)(NiFpga_Session session, uint32_t fifo) = NULL; +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; + return NiFpga_stopFifo ? NiFpga_stopFifo(session, fifo) + : NiFpga_Status_ResourceNotInitialized; } /* * 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; +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, +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_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_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 *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_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_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_ResourceNotInitialized; + return NiFpga_clientFunctionCall + ? NiFpga_clientFunctionCall(session, group, functionId, inBuffer, + inBufferSize, outBuffer, outBufferSize) + : NiFpga_Status_ResourceNotInitialized; } /** * 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; + 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_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_GetBitfileContents", (NiFpga_FunctionPointer*)&NiFpga_getBitfileContents, 1}, - {"NiFpgaDll_ClientFunctionCall", (NiFpga_FunctionPointer*)&NiFpga_clientFunctionCall, 1}, - {NULL, NULL, 0}}; + {"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_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_GetBitfileContents", + (NiFpga_FunctionPointer *)&NiFpga_getBitfileContents, 1}, + {"NiFpgaDll_ClientFunctionCall", + (NiFpga_FunctionPointer *)&NiFpga_clientFunctionCall, 1}, + {NULL, NULL, 0}}; NiFpga_Status NiFpga_Initialize(void) { - /* if the library isn't already loaded */ - if (!NiFpga_library) { - int i; + /* if the library isn't already loaded */ + if (!NiFpga_library) { + int i; /* load the library */ #if NiFpga_Windows - NiFpga_library = LoadLibraryA("NiFpga.dll"); + NiFpga_library = LoadLibraryA("NiFpga.dll"); #elif NiFpga_VxWorks - NiFpga_library = VxLoadLibraryFromPath("NiFpga.out", 0); + NiFpga_library = VxLoadLibraryFromPath("NiFpga.out", 0); #elif NiFpga_Linux || NiFpga_MacOsX #if NiFpga_Linux - const char* const library = "libNiFpga.so"; + const char *const library = "libNiFpga.so"; #elif NiFpga_MacOsX - const char* const library = "/Library/Frameworks/NiFpga.framework/NiFpga"; + 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()); + 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_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; + *address = (NiFpga_FunctionPointer)GetProcAddress(NiFpga_library, name); + if (!*address && NiFpga_functions[i].required) + return NiFpga_Status_VersionMismatch; #elif NiFpga_VxWorks - SYM_TYPE type; - STATUS symFindStatus = symFindByName(sysSymTbl, (char*)name, (char**)address, &type); - if (symFindStatus != OK && NiFpga_functions[i].required) return NiFpga_Status_VersionMismatch; + SYM_TYPE type; + STATUS symFindStatus = + symFindByName(sysSymTbl, (char *)name, (char **)address, &type); + if (symFindStatus != OK && 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; + *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; - } - } + { + 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; +#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; + /* 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; + if (!FreeLibrary(NiFpga_library)) + status = NiFpga_Status_ResourceNotInitialized; #elif NiFpga_VxWorks - if (VxFreeLibrary(NiFpga_library, 0) != OK) status = NiFpga_Status_ResourceNotInitialized; + if (VxFreeLibrary(NiFpga_library, 0) != OK) + status = NiFpga_Status_ResourceNotInitialized; #elif NiFpga_Linux || NiFpga_MacOsX - if (dlclose(NiFpga_library)) status = NiFpga_Status_ResourceNotInitialized; + 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 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; + NiFpga_acquireCviResource = NULL; + NiFpga_releaseCviResource = NULL; #endif - return status; - } else - return NiFpga_Status_ResourceNotInitialized; + return status; + } else + return NiFpga_Status_ResourceNotInitialized; } diff --git a/src/NiFpga/NiFpga.h b/src/NiFpga/NiFpga.h index 8c3281b..a8424b4 100644 --- a/src/NiFpga/NiFpga.h +++ b/src/NiFpga/NiFpga.h @@ -12,33 +12,40 @@ /* * 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__) +#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__) +#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) +#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 #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__) +#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. @@ -115,16 +122,18 @@ /* * 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) +#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_VxWorks /* VxWorks (at least 6.3 and earlier) did not have stdint.h. */ #include -#elif NiFpga_C99 || NiFpga_Gcc /* GCC (at least since 3.0) has a stdint.h. */ \ - || defined(HAVE_STDINT_H) +#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 @@ -331,13 +340,15 @@ static const NiFpga_Status NiFpga_Status_FpgaBusyEmulation = -61204; * LabVIEW FPGA does not support the Reset method for bitfiles that allow * removal of implicit enable signals in single-cycle Timed Loops. */ -static const NiFpga_Status NiFpga_Status_ResetCalledWithImplicitEnableRemoval = -61211; +static const NiFpga_Status NiFpga_Status_ResetCalledWithImplicitEnableRemoval = + -61211; /** * LabVIEW FPGA does not support the Abort method for bitfiles that allow * removal of implicit enable signals in single-cycle Timed Loops. */ -static const NiFpga_Status NiFpga_Status_AbortCalledWithImplicitEnableRemoval = -61212; +static const NiFpga_Status NiFpga_Status_AbortCalledWithImplicitEnableRemoval = + -61212; /** * LabVIEW FPGA does not support Close and Reset if Last Reference for bitfiles @@ -345,20 +356,23 @@ static const NiFpga_Status NiFpga_Status_AbortCalledWithImplicitEnableRemoval = * Pass the NiFpga_CloseAttribute_NoResetIfLastSession attribute to NiFpga_Close * instead of 0. */ -static const NiFpga_Status NiFpga_Status_CloseAndResetCalledWithImplicitEnableRemoval = -61213; +static const NiFpga_Status + NiFpga_Status_CloseAndResetCalledWithImplicitEnableRemoval = -61213; /** * For bitfiles that allow removal of implicit enable signals in single-cycle * Timed Loops, LabVIEW FPGA does not support this method prior to running the * bitfile. */ -static const NiFpga_Status NiFpga_Status_ImplicitEnableRemovalButNotYetRun = -61214; +static const NiFpga_Status NiFpga_Status_ImplicitEnableRemovalButNotYetRun = + -61214; /** * Bitfiles that allow removal of implicit enable signals in single-cycle Timed * Loops can run only once. Download the bitfile again before re-running the VI. */ -static const NiFpga_Status NiFpga_Status_RunAfterStoppedCalledWithImplicitEnableRemoval = -61215; +static const NiFpga_Status + NiFpga_Status_RunAfterStoppedCalledWithImplicitEnableRemoval = -61215; /** * A gated clock has violated the handshaking protocol. If you are using @@ -366,7 +380,8 @@ static const NiFpga_Status NiFpga_Status_RunAfterStoppedCalledWithImplicitEnable * protocol. If you are generating your clocks internally, please contact * National Instruments Technical Support. */ -static const NiFpga_Status NiFpga_Status_GatedClockHandshakingViolation = -61216; +static const NiFpga_Status NiFpga_Status_GatedClockHandshakingViolation = + -61216; /** * The number of elements requested must be less than or equal to the number of @@ -374,7 +389,8 @@ static const NiFpga_Status NiFpga_Status_GatedClockHandshakingViolation = -61216 * fewer unacquired elements left in the FIFO than are being requested. Release * some acquired elements before acquiring more elements. */ -static const NiFpga_Status NiFpga_Status_ElementsNotPermissibleToBeAcquired = -61219; +static const NiFpga_Status NiFpga_Status_ElementsNotPermissibleToBeAcquired = + -61219; /** * The operation could not be performed because the FPGA is in configuration or @@ -389,7 +405,8 @@ static const NiFpga_Status NiFpga_Status_FpgaBusyConfiguration = -61252; * NiFpga_CloseAttribute_NoResetIfLastSession attribute to NiFpga_Close instead * of 0. */ -static const NiFpga_Status NiFpga_Status_CloseAndResetCalledWithResetNotSupported = -61253; +static const NiFpga_Status + NiFpga_Status_CloseAndResetCalledWithResetNotSupported = -61253; /** * An unexpected internal error occurred. @@ -525,7 +542,7 @@ static const NiFpga_Status NiFpga_Status_OutOfHandles = -63198; * @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; + return status < NiFpga_Status_Success ? NiFpga_True : NiFpga_False; } /** @@ -535,7 +552,7 @@ static NiFpga_Inline NiFpga_Bool NiFpga_IsError(const NiFpga_Status status) { * @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; + return status >= NiFpga_Status_Success ? NiFpga_True : NiFpga_False; } /** @@ -549,12 +566,14 @@ 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; } /** @@ -575,8 +594,9 @@ static NiFpga_Inline NiFpga_Status NiFpga_MergeStatus(NiFpga_Status* const statu * @param status status to check for an error * @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)); +#define NiFpga_IfIsNotError(status, expression) \ + if (NiFpga_IsNotError(status)) \ + NiFpga_MergeStatus(&status, (expression)); /** * @} @@ -599,9 +619,9 @@ static NiFpga_Inline NiFpga_Status NiFpga_MergeStatus(NiFpga_Status* const statu * - http://digital.ni.com/public.nsf/allkb/346CC529EC1092B3862574FA0053B9B2 */ typedef struct NiFpga_FxpTypeInfo { - NiFpga_Bool isSigned; - uint8_t wordLength; - int16_t integerWordLength; + NiFpga_Bool isSigned; + uint8_t wordLength; + int16_t integerWordLength; } NiFpga_FxpTypeInfo; /** @@ -617,33 +637,35 @@ 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; - /* - Constants taken from: - https://en.wikipedia.org/wiki/IEEE_754#Basic_and_interchange_formats - */ - const int32_t exponentBias = 127; - const int32_t subNormalBias = 126; - const int32_t maximumExponent = 127; - const int32_t minimumExponent = -149; - const int32_t minimumNormalExponent = -126; - const int32_t significandStorageWidth = 23; - const int32_t exponentStorageWidth = 8; - uint32_t delta = 0; - if (exponent < minimumExponent) { - return 0.0; - } - if (exponent > maximumExponent) { - return FLT_MAX; - } - if (exponent >= minimumNormalExponent) { - const uint32_t exponentMask = (1 << exponentStorageWidth) - 1; - delta = ((exponent + exponentBias) & exponentMask) << significandStorageWidth; - } else { - delta = 1 << (exponent + subNormalBias + significandStorageWidth); - } - return *((float*)(&delta)); +static NiFpga_Inline float +NiFpga_CalculateFxpDeltaFloat(const NiFpga_FxpTypeInfo typeInfo) { + const int32_t exponent = typeInfo.integerWordLength - typeInfo.wordLength; + /* + Constants taken from: + https://en.wikipedia.org/wiki/IEEE_754#Basic_and_interchange_formats + */ + const int32_t exponentBias = 127; + const int32_t subNormalBias = 126; + const int32_t maximumExponent = 127; + const int32_t minimumExponent = -149; + const int32_t minimumNormalExponent = -126; + const int32_t significandStorageWidth = 23; + const int32_t exponentStorageWidth = 8; + uint32_t delta = 0; + if (exponent < minimumExponent) { + return 0.0; + } + if (exponent > maximumExponent) { + return FLT_MAX; + } + if (exponent >= minimumNormalExponent) { + const uint32_t exponentMask = (1 << exponentStorageWidth) - 1; + delta = ((exponent + exponentBias) & exponentMask) + << significandStorageWidth; + } else { + delta = 1 << (exponent + subNormalBias + significandStorageWidth); + } + return *((float *)(&delta)); } /* @@ -651,18 +673,18 @@ static NiFpga_Inline float NiFpga_CalculateFxpDeltaFloat(const NiFpga_FxpTypeInf * 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 = (1ULL << typeInfo.wordLength) - 1; \ - 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 = (1ULL << typeInfo.wordLength) - 1; \ + 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; /** * @} @@ -682,9 +704,10 @@ static NiFpga_Inline float NiFpga_CalculateFxpDeltaFloat(const NiFpga_FxpTypeInf * @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) } /** @@ -700,33 +723,35 @@ static NiFpga_Inline float NiFpga_ConvertFromFxpToFloat(const NiFpga_FxpTypeInfo * @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; - /* - Constants taken from: - https://en.wikipedia.org/wiki/IEEE_754#Basic_and_interchange_formats - */ - const int32_t exponentBias = 1023; - const int32_t subNormalBias = 1022; - const int32_t maximumExponent = 1023; - const int32_t minimumExponent = -1074; - const int32_t minimumNormalExponent = -1022; - const int32_t significandStorageWidth = 52; - const int32_t exponentStorageWidth = 11; - uint64_t delta = 0; - if (exponent < minimumExponent) { - return 0.0; - } - if (exponent > maximumExponent) { - return DBL_MAX; - } - if (exponent >= minimumNormalExponent) { - const uint64_t exponentMask = (1 << exponentStorageWidth) - 1; - delta = ((exponent + exponentBias) & exponentMask) << significandStorageWidth; - } else { - delta = 1ULL << (exponent + subNormalBias + significandStorageWidth); - } - return *((double*)(&delta)); +static NiFpga_Inline double +NiFpga_CalculateFxpDeltaDouble(const NiFpga_FxpTypeInfo typeInfo) { + const int32_t exponent = typeInfo.integerWordLength - typeInfo.wordLength; + /* + Constants taken from: + https://en.wikipedia.org/wiki/IEEE_754#Basic_and_interchange_formats + */ + const int32_t exponentBias = 1023; + const int32_t subNormalBias = 1022; + const int32_t maximumExponent = 1023; + const int32_t minimumExponent = -1074; + const int32_t minimumNormalExponent = -1022; + const int32_t significandStorageWidth = 52; + const int32_t exponentStorageWidth = 11; + uint64_t delta = 0; + if (exponent < minimumExponent) { + return 0.0; + } + if (exponent > maximumExponent) { + return DBL_MAX; + } + if (exponent >= minimumNormalExponent) { + const uint64_t exponentMask = (1 << exponentStorageWidth) - 1; + delta = ((exponent + exponentBias) & exponentMask) + << significandStorageWidth; + } else { + delta = 1ULL << (exponent + subNormalBias + significandStorageWidth); + } + return *((double *)(&delta)); } /** \addtogroup FXP @@ -743,9 +768,11 @@ static NiFpga_Inline double NiFpga_CalculateFxpDeltaDouble(const NiFpga_FxpTypeI * @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) } /** @@ -757,33 +784,35 @@ static NiFpga_Inline double NiFpga_ConvertFromFxpToDouble(const NiFpga_FxpTypeIn * 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 = (1ULL << typeInfo.wordLength) - 1; \ - 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 = (1ULL << typeInfo.wordLength) - 1; \ + 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 * @{ @@ -799,9 +828,10 @@ static NiFpga_Inline double NiFpga_ConvertFromFxpToDouble(const NiFpga_FxpTypeIn * @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) } /** @@ -814,9 +844,10 @@ static NiFpga_Inline uint64_t NiFpga_ConvertFromFloatToFxp(const NiFpga_FxpTypeI * @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) } /** @@ -892,13 +923,16 @@ typedef enum { NiFpga_OpenAttribute_NoRun = 1 } NiFpga_OpenAttribute; * 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 @@ -974,7 +1008,8 @@ NiFpga_Status NiFpga_Download(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. @@ -984,7 +1019,8 @@ NiFpga_Status NiFpga_ReadBool(NiFpga_Session session, uint32_t indicator, NiFpga * @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. @@ -994,7 +1030,8 @@ NiFpga_Status NiFpga_ReadI8(NiFpga_Session session, uint32_t indicator, int8_t* * @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. @@ -1004,7 +1041,8 @@ NiFpga_Status NiFpga_ReadU8(NiFpga_Session session, uint32_t indicator, uint8_t* * @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. @@ -1014,7 +1052,8 @@ NiFpga_Status NiFpga_ReadI16(NiFpga_Session session, uint32_t indicator, int16_t * @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. @@ -1024,7 +1063,8 @@ NiFpga_Status NiFpga_ReadU16(NiFpga_Session session, uint32_t indicator, uint16_ * @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. @@ -1034,7 +1074,8 @@ NiFpga_Status NiFpga_ReadI32(NiFpga_Session session, uint32_t indicator, int32_t * @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. @@ -1044,7 +1085,8 @@ NiFpga_Status NiFpga_ReadU32(NiFpga_Session session, uint32_t indicator, uint32_ * @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. @@ -1054,7 +1096,8 @@ NiFpga_Status NiFpga_ReadI64(NiFpga_Session session, uint32_t indicator, int64_t * @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 @@ -1065,7 +1108,8 @@ NiFpga_Status NiFpga_ReadU64(NiFpga_Session session, uint32_t indicator, uint64_ * @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 @@ -1076,7 +1120,8 @@ NiFpga_Status NiFpga_ReadSgl(NiFpga_Session session, uint32_t indicator, float* * @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); /** * @} @@ -1094,7 +1139,8 @@ NiFpga_Status NiFpga_ReadDbl(NiFpga_Session session, uint32_t indicator, double* * @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. @@ -1104,7 +1150,8 @@ NiFpga_Status NiFpga_WriteBool(NiFpga_Session session, uint32_t control, NiFpga_ * @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. @@ -1114,7 +1161,8 @@ NiFpga_Status NiFpga_WriteI8(NiFpga_Session session, uint32_t control, int8_t va * @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. @@ -1124,7 +1172,8 @@ NiFpga_Status NiFpga_WriteU8(NiFpga_Session session, uint32_t control, uint8_t v * @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. @@ -1134,7 +1183,8 @@ NiFpga_Status NiFpga_WriteI16(NiFpga_Session session, uint32_t control, int16_t * @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. @@ -1144,7 +1194,8 @@ NiFpga_Status NiFpga_WriteU16(NiFpga_Session session, uint32_t control, uint16_t * @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. @@ -1154,7 +1205,8 @@ NiFpga_Status NiFpga_WriteI32(NiFpga_Session session, uint32_t control, int32_t * @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. @@ -1164,7 +1216,8 @@ NiFpga_Status NiFpga_WriteU32(NiFpga_Session session, uint32_t control, uint32_t * @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. @@ -1174,7 +1227,8 @@ NiFpga_Status NiFpga_WriteI64(NiFpga_Session session, uint32_t control, int64_t * @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 @@ -1185,7 +1239,8 @@ NiFpga_Status NiFpga_WriteU64(NiFpga_Session session, uint32_t control, uint64_t * @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 @@ -1196,7 +1251,8 @@ NiFpga_Status NiFpga_WriteSgl(NiFpga_Session session, uint32_t control, float va * @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); /** * @} @@ -1219,8 +1275,8 @@ NiFpga_Status NiFpga_WriteDbl(NiFpga_Session session, uint32_t control, double v * @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 @@ -1235,7 +1291,8 @@ NiFpga_Status NiFpga_ReadArrayBool(NiFpga_Session session, uint32_t indicator, N * @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 @@ -1250,7 +1307,8 @@ NiFpga_Status NiFpga_ReadArrayI8(NiFpga_Session session, uint32_t indicator, int * @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 @@ -1265,7 +1323,8 @@ NiFpga_Status NiFpga_ReadArrayU8(NiFpga_Session session, uint32_t indicator, uin * @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 @@ -1280,7 +1339,8 @@ NiFpga_Status NiFpga_ReadArrayI16(NiFpga_Session session, uint32_t indicator, in * @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 @@ -1295,7 +1355,8 @@ NiFpga_Status NiFpga_ReadArrayU16(NiFpga_Session session, uint32_t indicator, ui * @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 @@ -1310,7 +1371,8 @@ NiFpga_Status NiFpga_ReadArrayI32(NiFpga_Session session, uint32_t indicator, in * @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 @@ -1325,7 +1387,8 @@ NiFpga_Status NiFpga_ReadArrayU32(NiFpga_Session session, uint32_t indicator, ui * @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 @@ -1340,7 +1403,8 @@ NiFpga_Status NiFpga_ReadArrayI64(NiFpga_Session session, uint32_t indicator, in * @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 @@ -1355,7 +1419,8 @@ NiFpga_Status NiFpga_ReadArrayU64(NiFpga_Session session, uint32_t indicator, ui * @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 @@ -1370,7 +1435,8 @@ NiFpga_Status NiFpga_ReadArraySgl(NiFpga_Session session, uint32_t indicator, fl * @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); /** * @} @@ -1393,8 +1459,8 @@ NiFpga_Status NiFpga_ReadArrayDbl(NiFpga_Session session, uint32_t indicator, do * @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 @@ -1409,7 +1475,8 @@ NiFpga_Status NiFpga_WriteArrayBool(NiFpga_Session session, uint32_t control, co * @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 @@ -1424,8 +1491,8 @@ NiFpga_Status NiFpga_WriteArrayI8(NiFpga_Session session, uint32_t control, cons * @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 @@ -1440,8 +1507,8 @@ NiFpga_Status NiFpga_WriteArrayU8(NiFpga_Session session, uint32_t control, cons * @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 @@ -1456,8 +1523,8 @@ NiFpga_Status NiFpga_WriteArrayI16(NiFpga_Session session, uint32_t control, con * @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 @@ -1472,8 +1539,8 @@ NiFpga_Status NiFpga_WriteArrayU16(NiFpga_Session session, uint32_t control, con * @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 @@ -1488,8 +1555,8 @@ NiFpga_Status NiFpga_WriteArrayI32(NiFpga_Session session, uint32_t control, con * @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 @@ -1504,8 +1571,8 @@ NiFpga_Status NiFpga_WriteArrayU32(NiFpga_Session session, uint32_t control, con * @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 @@ -1520,8 +1587,8 @@ NiFpga_Status NiFpga_WriteArrayI64(NiFpga_Session session, uint32_t control, con * @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 @@ -1536,7 +1603,8 @@ NiFpga_Status NiFpga_WriteArrayU64(NiFpga_Session session, uint32_t control, con * @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 @@ -1551,8 +1619,8 @@ NiFpga_Status NiFpga_WriteArraySgl(NiFpga_Session session, uint32_t control, con * @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); /** * @} @@ -1574,44 +1642,44 @@ 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 + 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 @@ -1626,7 +1694,8 @@ 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. @@ -1635,7 +1704,8 @@ NiFpga_Status NiFpga_ReserveIrqContext(NiFpga_Session session, NiFpga_IrqContext * @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 @@ -1656,8 +1726,10 @@ NiFpga_Status NiFpga_UnreserveIrqContext(NiFpga_Session session, NiFpga_IrqConte * @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. @@ -1687,7 +1759,8 @@ NiFpga_Status NiFpga_AcknowledgeIrqs(NiFpga_Session session, uint32_t irqs); * 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 @@ -1702,8 +1775,8 @@ NiFpga_Status NiFpga_ConfigureFifo(NiFpga_Session session, uint32_t fifo, size_t * 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); /** * @} @@ -1719,182 +1792,182 @@ NiFpga_Status NiFpga_ConfigureFifo2(NiFpga_Session session, uint32_t fifo, size_ */ #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 + /** + * 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 + /** + * 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 + /** + * 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; @@ -1911,7 +1984,8 @@ typedef enum { NiFpga_FifoProperty_NotSupported } NiFpga_FifoProperty; * @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, +NiFpga_Status NiFpga_SetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, uint32_t value); /** @@ -1925,7 +1999,8 @@ NiFpga_Status NiFpga_SetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, N * @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, +NiFpga_Status NiFpga_SetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, int32_t value); /** @@ -1939,7 +2014,8 @@ NiFpga_Status NiFpga_SetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, N * @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, +NiFpga_Status NiFpga_SetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, uint64_t value); /** @@ -1953,7 +2029,8 @@ NiFpga_Status NiFpga_SetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, N * @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, +NiFpga_Status NiFpga_SetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, + NiFpga_FifoProperty property, int64_t value); /** @@ -1967,8 +2044,9 @@ NiFpga_Status NiFpga_SetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, N * @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 @@ -1980,8 +2058,9 @@ NiFpga_Status NiFpga_SetFifoPropertyPtr(NiFpga_Session session, uint32_t fifo, N * @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 @@ -1993,8 +2072,9 @@ NiFpga_Status NiFpga_GetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, N * @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 @@ -2006,8 +2086,9 @@ NiFpga_Status NiFpga_GetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, N * @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 @@ -2019,8 +2100,9 @@ NiFpga_Status NiFpga_GetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, N * @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 @@ -2032,8 +2114,9 @@ NiFpga_Status NiFpga_GetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, N * @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 @@ -2044,7 +2127,8 @@ NiFpga_Status NiFpga_GetFifoPropertyPtr(NiFpga_Session session, uint32_t fifo, N * @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); /** * @} */ @@ -2091,8 +2175,9 @@ NiFpga_Status NiFpga_StopFifo(NiFpga_Session session, uint32_t fifo); * 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. @@ -2106,8 +2191,9 @@ NiFpga_Status NiFpga_ReadFifoBool(NiFpga_Session session, uint32_t fifo, NiFpga_ * 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. @@ -2121,8 +2207,9 @@ NiFpga_Status NiFpga_ReadFifoI8(NiFpga_Session session, uint32_t fifo, int8_t* d * 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. @@ -2136,8 +2223,9 @@ NiFpga_Status NiFpga_ReadFifoU8(NiFpga_Session session, uint32_t fifo, uint8_t* * 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. @@ -2151,8 +2239,9 @@ NiFpga_Status NiFpga_ReadFifoI16(NiFpga_Session session, uint32_t fifo, int16_t* * 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. @@ -2166,8 +2255,9 @@ NiFpga_Status NiFpga_ReadFifoU16(NiFpga_Session session, uint32_t fifo, uint16_t * 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. @@ -2181,8 +2271,9 @@ NiFpga_Status NiFpga_ReadFifoI32(NiFpga_Session session, uint32_t fifo, int32_t* * 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. @@ -2196,8 +2287,9 @@ NiFpga_Status NiFpga_ReadFifoU32(NiFpga_Session session, uint32_t fifo, uint32_t * 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. @@ -2211,8 +2303,9 @@ NiFpga_Status NiFpga_ReadFifoI64(NiFpga_Session session, uint32_t fifo, int64_t* * 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. @@ -2226,8 +2319,9 @@ NiFpga_Status NiFpga_ReadFifoU64(NiFpga_Session session, uint32_t fifo, uint64_t * 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. @@ -2241,8 +2335,9 @@ NiFpga_Status NiFpga_ReadFifoSgl(NiFpga_Session session, uint32_t fifo, float* d * 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. @@ -2257,9 +2352,11 @@ NiFpga_Status NiFpga_ReadFifoDbl(NiFpga_Session session, uint32_t fifo, double* * 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); /** * @} @@ -2282,8 +2379,10 @@ NiFpga_Status NiFpga_ReadFifoComposite(NiFpga_Session session, uint32_t fifo, vo * 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. @@ -2298,8 +2397,10 @@ NiFpga_Status NiFpga_WriteFifoBool(NiFpga_Session session, uint32_t fifo, const * 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. @@ -2314,8 +2415,10 @@ NiFpga_Status NiFpga_WriteFifoI8(NiFpga_Session session, uint32_t fifo, const in * 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. @@ -2330,8 +2433,10 @@ NiFpga_Status NiFpga_WriteFifoU8(NiFpga_Session session, uint32_t fifo, const ui * 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. @@ -2346,8 +2451,10 @@ NiFpga_Status NiFpga_WriteFifoI16(NiFpga_Session session, uint32_t fifo, const i * 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. @@ -2362,8 +2469,10 @@ NiFpga_Status NiFpga_WriteFifoU16(NiFpga_Session session, uint32_t fifo, const u * 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. @@ -2378,8 +2487,10 @@ NiFpga_Status NiFpga_WriteFifoI32(NiFpga_Session session, uint32_t fifo, const i * 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. @@ -2394,8 +2505,10 @@ NiFpga_Status NiFpga_WriteFifoU32(NiFpga_Session session, uint32_t fifo, const u * 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. @@ -2410,8 +2523,10 @@ NiFpga_Status NiFpga_WriteFifoI64(NiFpga_Session session, uint32_t fifo, const i * 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. @@ -2426,8 +2541,10 @@ NiFpga_Status NiFpga_WriteFifoU64(NiFpga_Session session, uint32_t fifo, const u * 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. @@ -2442,8 +2559,10 @@ NiFpga_Status NiFpga_WriteFifoSgl(NiFpga_Session session, uint32_t fifo, const f * 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. @@ -2459,9 +2578,12 @@ NiFpga_Status NiFpga_WriteFifoDbl(NiFpga_Session session, uint32_t fifo, const d * 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); /** * @} @@ -2495,10 +2617,10 @@ NiFpga_Status NiFpga_WriteFifoComposite(NiFpga_Session session, uint32_t fifo, c * 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 @@ -2525,9 +2647,12 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsBool(NiFpga_Session session, uint32_ * 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 @@ -2554,9 +2679,11 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsI8(NiFpga_Session session, uint32_t * 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 @@ -2583,9 +2710,11 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsU8(NiFpga_Session session, uint32_t * 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 @@ -2612,9 +2741,11 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsI16(NiFpga_Session session, uint32_t * 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 @@ -2641,9 +2772,11 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsU16(NiFpga_Session session, uint32_t * 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 @@ -2670,9 +2803,11 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsI32(NiFpga_Session session, uint32_t * 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 @@ -2699,9 +2834,11 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsU32(NiFpga_Session session, uint32_t * 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 @@ -2728,9 +2865,11 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsI64(NiFpga_Session session, uint32_t * 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 @@ -2757,9 +2896,12 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsU64(NiFpga_Session session, uint32_t * 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 @@ -2786,9 +2928,11 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsSgl(NiFpga_Session session, uint32_t * 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); /** * @} @@ -2822,10 +2966,10 @@ NiFpga_Status NiFpga_AcquireFifoReadElementsDbl(NiFpga_Session session, uint32_t * 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 @@ -2852,9 +2996,11 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsBool(NiFpga_Session session, uint32 * 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 @@ -2881,9 +3027,11 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsI8(NiFpga_Session session, uint32_t * 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 @@ -2910,9 +3058,11 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsU8(NiFpga_Session session, uint32_t * 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 @@ -2939,9 +3089,10 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsI16(NiFpga_Session session, uint32_ * 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 @@ -2968,9 +3119,11 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsU16(NiFpga_Session session, uint32_ * 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 @@ -2997,9 +3150,10 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsI32(NiFpga_Session session, uint32_ * 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 @@ -3026,9 +3180,11 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsU32(NiFpga_Session session, uint32_ * 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 @@ -3055,9 +3211,10 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsI64(NiFpga_Session session, uint32_ * 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 @@ -3084,9 +3241,11 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsU64(NiFpga_Session session, uint32_ * 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 @@ -3113,9 +3272,11 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsSgl(NiFpga_Session session, uint32_ * 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); /** * @} @@ -3138,7 +3299,8 @@ NiFpga_Status NiFpga_AcquireFifoWriteElementsDbl(NiFpga_Session session, uint32_ * @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. @@ -3150,7 +3312,9 @@ NiFpga_Status NiFpga_ReleaseFifoElements(NiFpga_Session session, uint32_t fifo, * 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); /** * @} diff --git a/src/NiFpga/NiFpga_VMS_3_Controller.h b/src/NiFpga/NiFpga_VMS_3_Controller.h index eefec01..36ad5f3 100644 --- a/src/NiFpga/NiFpga_VMS_3_Controller.h +++ b/src/NiFpga/NiFpga_VMS_3_Controller.h @@ -23,46 +23,50 @@ /** * The signature of the FPGA bitfile. */ -static const char* const NiFpga_VMS_3_Controller_Signature = "58F5D57A89EEE9690C8BDF6EFBE30542"; +static const char *const NiFpga_VMS_3_Controller_Signature = + "58F5D57A89EEE9690C8BDF6EFBE30542"; #if NiFpga_Cpp extern "C" { #endif typedef enum { - NiFpga_VMS_3_Controller_IndicatorBool_FIFOfull = 0x1803A, - NiFpga_VMS_3_Controller_IndicatorBool_Ready = 0x1802E, - NiFpga_VMS_3_Controller_IndicatorBool_Stopped = 0x1801E, - NiFpga_VMS_3_Controller_IndicatorBool_Timeouted = 0x1802A, + NiFpga_VMS_3_Controller_IndicatorBool_FIFOfull = 0x1803A, + NiFpga_VMS_3_Controller_IndicatorBool_Ready = 0x1802E, + NiFpga_VMS_3_Controller_IndicatorBool_Stopped = 0x1801E, + NiFpga_VMS_3_Controller_IndicatorBool_Timeouted = 0x1802A, } NiFpga_VMS_3_Controller_IndicatorBool; typedef enum { - NiFpga_VMS_3_Controller_IndicatorU64_Ticks = 0x18034, + NiFpga_VMS_3_Controller_IndicatorU64_Ticks = 0x18034, } NiFpga_VMS_3_Controller_IndicatorU64; typedef enum { - NiFpga_VMS_3_Controller_ControlBool_Operate = 0x1801A, + NiFpga_VMS_3_Controller_ControlBool_Operate = 0x1801A, } NiFpga_VMS_3_Controller_ControlBool; typedef enum { - NiFpga_VMS_3_Controller_ControlI16_Outputtype = 0x18022, + NiFpga_VMS_3_Controller_ControlI16_Outputtype = 0x18022, } NiFpga_VMS_3_Controller_ControlI16; typedef enum { - NiFpga_VMS_3_Controller_ControlU32_Periodms = 0x18024, + NiFpga_VMS_3_Controller_ControlU32_Periodms = 0x18024, } NiFpga_VMS_3_Controller_ControlU32; typedef enum { - NiFpga_VMS_3_Controller_TargetToHostFifoU32_ResponseFIFO = 0, + NiFpga_VMS_3_Controller_TargetToHostFifoU32_ResponseFIFO = 0, } NiFpga_VMS_3_Controller_TargetToHostFifoU32; #if !NiFpga_VxWorks /* Indicator: ChassisTemperature */ -const NiFpga_FxpTypeInfo NiFpga_VMS_3_Controller_IndicatorFxp_ChassisTemperature_TypeInfo = {1, 32, 16}; +const NiFpga_FxpTypeInfo + NiFpga_VMS_3_Controller_IndicatorFxp_ChassisTemperature_TypeInfo = {1, 32, + 16}; /* Use NiFpga_ReadU32() to access ChassisTemperature */ -const uint32_t NiFpga_VMS_3_Controller_IndicatorFxp_ChassisTemperature_Resource = 0x18030; +const uint32_t + NiFpga_VMS_3_Controller_IndicatorFxp_ChassisTemperature_Resource = 0x18030; #endif /* !NiFpga_VxWorks */ diff --git a/src/NiFpga/NiFpga_VMS_3_Responder.h b/src/NiFpga/NiFpga_VMS_3_Responder.h index 169c14c..24c7bba 100644 --- a/src/NiFpga/NiFpga_VMS_3_Responder.h +++ b/src/NiFpga/NiFpga_VMS_3_Responder.h @@ -23,42 +23,46 @@ /** * The signature of the FPGA bitfile. */ -static const char* const NiFpga_VMS_3_Responder_Signature = "AF9CD1DCC916CE5298098C21EB399E23"; +static const char *const NiFpga_VMS_3_Responder_Signature = + "AF9CD1DCC916CE5298098C21EB399E23"; #if NiFpga_Cpp extern "C" { #endif typedef enum { - NiFpga_VMS_3_Responder_IndicatorBool_FIFOfull = 0x18032, - NiFpga_VMS_3_Responder_IndicatorBool_Ready = 0x18026, - NiFpga_VMS_3_Responder_IndicatorBool_Stopped = 0x1801A, - NiFpga_VMS_3_Responder_IndicatorBool_Timeouted = 0x1801E, + NiFpga_VMS_3_Responder_IndicatorBool_FIFOfull = 0x18032, + NiFpga_VMS_3_Responder_IndicatorBool_Ready = 0x18026, + NiFpga_VMS_3_Responder_IndicatorBool_Stopped = 0x1801A, + NiFpga_VMS_3_Responder_IndicatorBool_Timeouted = 0x1801E, } NiFpga_VMS_3_Responder_IndicatorBool; typedef enum { - NiFpga_VMS_3_Responder_IndicatorU64_Ticks = 0x18020, + NiFpga_VMS_3_Responder_IndicatorU64_Ticks = 0x18020, } NiFpga_VMS_3_Responder_IndicatorU64; typedef enum { - NiFpga_VMS_3_Responder_ControlI16_Outputtype = 0x1802E, + NiFpga_VMS_3_Responder_ControlI16_Outputtype = 0x1802E, } NiFpga_VMS_3_Responder_ControlI16; typedef enum { - NiFpga_VMS_3_Responder_ControlU32_Periodms = 0x18028, + NiFpga_VMS_3_Responder_ControlU32_Periodms = 0x18028, } NiFpga_VMS_3_Responder_ControlU32; typedef enum { - NiFpga_VMS_3_Responder_TargetToHostFifoU32_ResponseFIFO = 0, + NiFpga_VMS_3_Responder_TargetToHostFifoU32_ResponseFIFO = 0, } NiFpga_VMS_3_Responder_TargetToHostFifoU32; #if !NiFpga_VxWorks /* Indicator: ChassisTemperature */ -const NiFpga_FxpTypeInfo NiFpga_VMS_3_Responder_IndicatorFxp_ChassisTemperature_TypeInfo = {1, 32, 16}; +const NiFpga_FxpTypeInfo + NiFpga_VMS_3_Responder_IndicatorFxp_ChassisTemperature_TypeInfo = {1, 32, + 16}; /* Use NiFpga_ReadU32() to access ChassisTemperature */ -const uint32_t NiFpga_VMS_3_Responder_IndicatorFxp_ChassisTemperature_Resource = 0x18034; +const uint32_t NiFpga_VMS_3_Responder_IndicatorFxp_ChassisTemperature_Resource = + 0x18034; #endif /* !NiFpga_VxWorks */ diff --git a/src/NiFpga/NiFpga_VMS_6_Controller.h b/src/NiFpga/NiFpga_VMS_6_Controller.h index 3f0a961..93756db 100644 --- a/src/NiFpga/NiFpga_VMS_6_Controller.h +++ b/src/NiFpga/NiFpga_VMS_6_Controller.h @@ -23,46 +23,50 @@ /** * The signature of the FPGA bitfile. */ -static const char* const NiFpga_VMS_6_Controller_Signature = "857991AE74411689D8DB985696B5B3BB"; +static const char *const NiFpga_VMS_6_Controller_Signature = + "857991AE74411689D8DB985696B5B3BB"; #if NiFpga_Cpp extern "C" { #endif typedef enum { - NiFpga_VMS_6_Controller_IndicatorBool_FIFOfull = 0x18052, - NiFpga_VMS_6_Controller_IndicatorBool_Ready = 0x1803E, - NiFpga_VMS_6_Controller_IndicatorBool_Stopped = 0x18042, - NiFpga_VMS_6_Controller_IndicatorBool_Timeouted = 0x18036, + NiFpga_VMS_6_Controller_IndicatorBool_FIFOfull = 0x18052, + NiFpga_VMS_6_Controller_IndicatorBool_Ready = 0x1803E, + NiFpga_VMS_6_Controller_IndicatorBool_Stopped = 0x18042, + NiFpga_VMS_6_Controller_IndicatorBool_Timeouted = 0x18036, } NiFpga_VMS_6_Controller_IndicatorBool; typedef enum { - NiFpga_VMS_6_Controller_IndicatorU64_Ticks = 0x18038, + NiFpga_VMS_6_Controller_IndicatorU64_Ticks = 0x18038, } NiFpga_VMS_6_Controller_IndicatorU64; typedef enum { - NiFpga_VMS_6_Controller_ControlBool_Operate = 0x18032, + NiFpga_VMS_6_Controller_ControlBool_Operate = 0x18032, } NiFpga_VMS_6_Controller_ControlBool; typedef enum { - NiFpga_VMS_6_Controller_ControlI16_Outputtype = 0x1804E, + NiFpga_VMS_6_Controller_ControlI16_Outputtype = 0x1804E, } NiFpga_VMS_6_Controller_ControlI16; typedef enum { - NiFpga_VMS_6_Controller_ControlU32_Periodms = 0x18048, + NiFpga_VMS_6_Controller_ControlU32_Periodms = 0x18048, } NiFpga_VMS_6_Controller_ControlU32; typedef enum { - NiFpga_VMS_6_Controller_TargetToHostFifoU32_ResponseFIFO = 0, + NiFpga_VMS_6_Controller_TargetToHostFifoU32_ResponseFIFO = 0, } NiFpga_VMS_6_Controller_TargetToHostFifoU32; #if !NiFpga_VxWorks /* Indicator: ChassisTemperature */ -const NiFpga_FxpTypeInfo NiFpga_VMS_6_Controller_IndicatorFxp_ChassisTemperature_TypeInfo = {1, 32, 16}; +const NiFpga_FxpTypeInfo + NiFpga_VMS_6_Controller_IndicatorFxp_ChassisTemperature_TypeInfo = {1, 32, + 16}; /* Use NiFpga_ReadU32() to access ChassisTemperature */ -const uint32_t NiFpga_VMS_6_Controller_IndicatorFxp_ChassisTemperature_Resource = 0x18044; +const uint32_t + NiFpga_VMS_6_Controller_IndicatorFxp_ChassisTemperature_Resource = 0x18044; #endif /* !NiFpga_VxWorks */ diff --git a/src/NiFpga/NiFpga_VMS_6_Responder.h b/src/NiFpga/NiFpga_VMS_6_Responder.h index ee8e44a..ca040b3 100644 --- a/src/NiFpga/NiFpga_VMS_6_Responder.h +++ b/src/NiFpga/NiFpga_VMS_6_Responder.h @@ -23,42 +23,46 @@ /** * The signature of the FPGA bitfile. */ -static const char* const NiFpga_VMS_6_Responder_Signature = "BF60D31B1858EEFD155660346089640D"; +static const char *const NiFpga_VMS_6_Responder_Signature = + "BF60D31B1858EEFD155660346089640D"; #if NiFpga_Cpp extern "C" { #endif typedef enum { - NiFpga_VMS_6_Responder_IndicatorBool_FIFOfull = 0x1803E, - NiFpga_VMS_6_Responder_IndicatorBool_Ready = 0x1804E, - NiFpga_VMS_6_Responder_IndicatorBool_Stopped = 0x1803A, - NiFpga_VMS_6_Responder_IndicatorBool_Timeouted = 0x1804A, + NiFpga_VMS_6_Responder_IndicatorBool_FIFOfull = 0x1803E, + NiFpga_VMS_6_Responder_IndicatorBool_Ready = 0x1804E, + NiFpga_VMS_6_Responder_IndicatorBool_Stopped = 0x1803A, + NiFpga_VMS_6_Responder_IndicatorBool_Timeouted = 0x1804A, } NiFpga_VMS_6_Responder_IndicatorBool; typedef enum { - NiFpga_VMS_6_Responder_IndicatorU64_Ticks = 0x18030, + NiFpga_VMS_6_Responder_IndicatorU64_Ticks = 0x18030, } NiFpga_VMS_6_Responder_IndicatorU64; typedef enum { - NiFpga_VMS_6_Responder_ControlI16_Outputtype = 0x18042, + NiFpga_VMS_6_Responder_ControlI16_Outputtype = 0x18042, } NiFpga_VMS_6_Responder_ControlI16; typedef enum { - NiFpga_VMS_6_Responder_ControlU32_Periodms = 0x18044, + NiFpga_VMS_6_Responder_ControlU32_Periodms = 0x18044, } NiFpga_VMS_6_Responder_ControlU32; typedef enum { - NiFpga_VMS_6_Responder_TargetToHostFifoU32_ResponseFIFO = 0, + NiFpga_VMS_6_Responder_TargetToHostFifoU32_ResponseFIFO = 0, } NiFpga_VMS_6_Responder_TargetToHostFifoU32; #if !NiFpga_VxWorks /* Indicator: ChassisTemperature */ -const NiFpga_FxpTypeInfo NiFpga_VMS_6_Responder_IndicatorFxp_ChassisTemperature_TypeInfo = {1, 32, 16}; +const NiFpga_FxpTypeInfo + NiFpga_VMS_6_Responder_IndicatorFxp_ChassisTemperature_TypeInfo = {1, 32, + 16}; /* Use NiFpga_ReadU32() to access ChassisTemperature */ -const uint32_t NiFpga_VMS_6_Responder_IndicatorFxp_ChassisTemperature_Resource = 0x18034; +const uint32_t NiFpga_VMS_6_Responder_IndicatorFxp_ChassisTemperature_Resource = + 0x18034; #endif /* !NiFpga_VxWorks */ diff --git a/src/NiFpga/NiFpga_VMS_CameraRotator.h b/src/NiFpga/NiFpga_VMS_CameraRotator.h index 184ce4f..65003d5 100644 --- a/src/NiFpga/NiFpga_VMS_CameraRotator.h +++ b/src/NiFpga/NiFpga_VMS_CameraRotator.h @@ -16,53 +16,58 @@ * * This is a #define to allow for string literal concatenation. For example: * - * static const char* const Bitfile = "C:\\" NiFpga_VMS_CameraRotator_Bitfile; + * static const char* const Bitfile = "C:\\" + * NiFpga_VMS_CameraRotator_Bitfile; */ #define NiFpga_VMS_CameraRotator_Bitfile "NiFpga_VMS_CameraRotator.lvbitx" /** * The signature of the FPGA bitfile. */ -static const char* const NiFpga_VMS_CameraRotator_Signature = "E93A26E996D3EC1D81D0C490AD5EE3D1"; +static const char *const NiFpga_VMS_CameraRotator_Signature = + "E93A26E996D3EC1D81D0C490AD5EE3D1"; #if NiFpga_Cpp extern "C" { #endif typedef enum { - NiFpga_VMS_CameraRotator_IndicatorBool_FIFOfull = 0x8132, - NiFpga_VMS_CameraRotator_IndicatorBool_Ready = 0x8142, - NiFpga_VMS_CameraRotator_IndicatorBool_Stopped = 0x812E, - NiFpga_VMS_CameraRotator_IndicatorBool_Timeouted = 0x813E, + NiFpga_VMS_CameraRotator_IndicatorBool_FIFOfull = 0x8132, + NiFpga_VMS_CameraRotator_IndicatorBool_Ready = 0x8142, + NiFpga_VMS_CameraRotator_IndicatorBool_Stopped = 0x812E, + NiFpga_VMS_CameraRotator_IndicatorBool_Timeouted = 0x813E, } NiFpga_VMS_CameraRotator_IndicatorBool; typedef enum { - NiFpga_VMS_CameraRotator_IndicatorU64_Ticks = 0x8128, + NiFpga_VMS_CameraRotator_IndicatorU64_Ticks = 0x8128, } NiFpga_VMS_CameraRotator_IndicatorU64; typedef enum { - NiFpga_VMS_CameraRotator_ControlBool_Operate = 0x8146, + NiFpga_VMS_CameraRotator_ControlBool_Operate = 0x8146, } NiFpga_VMS_CameraRotator_ControlBool; typedef enum { - NiFpga_VMS_CameraRotator_ControlI16_Outputtype = 0x8136, + NiFpga_VMS_CameraRotator_ControlI16_Outputtype = 0x8136, } NiFpga_VMS_CameraRotator_ControlI16; typedef enum { - NiFpga_VMS_CameraRotator_ControlU32_Periodms = 0x8138, + NiFpga_VMS_CameraRotator_ControlU32_Periodms = 0x8138, } NiFpga_VMS_CameraRotator_ControlU32; typedef enum { - NiFpga_VMS_CameraRotator_TargetToHostFifoU32_ResponseFIFO = 0, + NiFpga_VMS_CameraRotator_TargetToHostFifoU32_ResponseFIFO = 0, } NiFpga_VMS_CameraRotator_TargetToHostFifoU32; #if !NiFpga_VxWorks /* Indicator: ChassisTemperature */ -const NiFpga_FxpTypeInfo NiFpga_VMS_CameraRotator_IndicatorFxp_ChassisTemperature_TypeInfo = {1, 32, 16}; +const NiFpga_FxpTypeInfo + NiFpga_VMS_CameraRotator_IndicatorFxp_ChassisTemperature_TypeInfo = {1, 32, + 16}; /* Use NiFpga_ReadU32() to access ChassisTemperature */ -const uint32_t NiFpga_VMS_CameraRotator_IndicatorFxp_ChassisTemperature_Resource = 0x8124; +const uint32_t + NiFpga_VMS_CameraRotator_IndicatorFxp_ChassisTemperature_Resource = 0x8124; #endif /* !NiFpga_VxWorks */ diff --git a/src/ts-VMSd.cpp b/src/ts-VMSd.cpp index 5032bb2..5198d14 100644 --- a/src/ts-VMSd.cpp +++ b/src/ts-VMSd.cpp @@ -23,22 +23,24 @@ #include -#include +#include + #include +#include #include #include #include -#include -#include -#include -#include -#include #include -#include -#include #include +#include #include +#include +#include +#include +#include +#include +#include using namespace std::chrono; using namespace std::chrono_literals; @@ -47,143 +49,149 @@ using namespace LSST::VMS; class MTVMSd : public LSST::cRIO::CSC { public: - MTVMSd(const char* name, const char* description) : CSC(name, description) {} + MTVMSd(const char *name, const char *description) : CSC(name, description) {} - cRIO::command_vec processArgs(int argc, char* const argv[]) override; + cRIO::command_vec processArgs(int argc, char *const argv[]) override; protected: - void init() override; - void done() override; - int runLoop() override; + void init() override; + void done() override; + int runLoop() override; private: - VMSApplicationSettings _vmsApplicationSettings; - std::shared_ptr _vmsSAL; - // SAL object to receive all events from other VMS - std::shared_ptr _allvmsSAL; + VMSApplicationSettings _vmsApplicationSettings; + std::shared_ptr _vmsSAL; + // SAL object to receive all events from other VMS + std::shared_ptr _allvmsSAL; - Accelerometer* accelerometer; + Accelerometer *accelerometer; }; SALSinkMacro(MTVMS); int getIndex(const std::string subsystem) { - const char* subsystems[] = {"M1M3", "M2", "CameraRotator", NULL}; - int index = 1; - for (const char** s = subsystems; *s != NULL; s++, index++) { - if (subsystem == *s) { - return index; - } + const char *subsystems[] = {"M1M3", "M2", "CameraRotator", NULL}; + int index = 1; + for (const char **s = subsystems; *s != NULL; s++, index++) { + if (subsystem == *s) { + return index; } - SPDLOG_CRITICAL("Unknown subsystem {}", subsystem); - exit(EXIT_FAILURE); + } + SPDLOG_CRITICAL("Unknown subsystem {}", subsystem); + exit(EXIT_FAILURE); } -cRIO::command_vec MTVMSd::processArgs(int argc, char* const argv[]) { - auto ret = CSC::processArgs(argc, argv); - if (ret.size() != 1) { - SPDLOG_CRITICAL("Subsystem (M1M3, M2 or CameraRotator) needs to be provided on command line"); - exit(EXIT_FAILURE); - } +cRIO::command_vec MTVMSd::processArgs(int argc, char *const argv[]) { + auto ret = CSC::processArgs(argc, argv); + if (ret.size() != 1) { + SPDLOG_CRITICAL("Subsystem (M1M3, M2 or CameraRotator) needs to be " + "provided on command line"); + exit(EXIT_FAILURE); + } - SPDLOG_INFO("Setting root path {}", getConfigRoot()); - LSST::cRIO::Settings::Path::setRootPath(getConfigRoot()); + SPDLOG_INFO("Setting root path {}", getConfigRoot()); + LSST::cRIO::Settings::Path::setRootPath(getConfigRoot()); #ifdef SIMULATOR - SPDLOG_WARN("Starting ts-VMSd simulator"); + SPDLOG_WARN("Starting ts-VMSd simulator. Version {}", VERSION); #else - SPDLOG_INFO("Starting ts-VMSd"); + SPDLOG_INFO("Starting cRIO/real ts-VMSd. Version {}", VERSION); #endif - SPDLOG_INFO("Main: Creating setting reader from {}", getConfigRoot()); - SettingReader::instance().setRootPath(getConfigRoot()); - SPDLOG_DEBUG("Main: Loading VMS application settings {}", ret[0]); - _vmsApplicationSettings = SettingReader::instance().loadVMSApplicationSettings(ret[0]); + SPDLOG_INFO("Main: Creating setting reader from {}", getConfigRoot()); + SettingReader::instance().setRootPath(getConfigRoot()); + SPDLOG_DEBUG("Main: Loading VMS application settings {}", ret[0]); + _vmsApplicationSettings = + SettingReader::instance().loadVMSApplicationSettings(ret[0]); - SPDLOG_INFO("Main: Creating FPGA"); - FPGA::instance().populate(&_vmsApplicationSettings); + SPDLOG_INFO("Main: Creating FPGA"); + FPGA::instance().populate(&_vmsApplicationSettings); - return ret; + return ret; } void MTVMSd::init() { - int index = getIndex(_vmsApplicationSettings.Subsystem); - SPDLOG_DEBUG("Subsystem: {}, Index: {}, IsController: {}, RIO: {}", - _vmsApplicationSettings.Subsystem.c_str(), index, _vmsApplicationSettings.IsController, - _vmsApplicationSettings.RIO); + int index = getIndex(_vmsApplicationSettings.Subsystem); + SPDLOG_DEBUG("Subsystem: {}, Index: {}, IsController: {}, RIO: {}", + _vmsApplicationSettings.Subsystem.c_str(), index, + _vmsApplicationSettings.IsController, + _vmsApplicationSettings.RIO); - SPDLOG_INFO("Initializing MTVMS SAL"); - _vmsSAL = std::make_shared(index); - _vmsSAL->setDebugLevel(getDebugLevelSAL()); + SPDLOG_INFO("Initializing MTVMS SAL"); + _vmsSAL = std::make_shared(index); + _vmsSAL->setDebugLevel(getDebugLevelSAL()); - _allvmsSAL = std::make_shared(0); - _allvmsSAL->setDebugLevel(getDebugLevelSAL()); + _allvmsSAL = std::make_shared(0); + _allvmsSAL->setDebugLevel(getDebugLevelSAL()); - addSink(std::make_shared(_vmsSAL)); + addSink(std::make_shared(_vmsSAL)); - // spdlog::apply_all([&](std::shared_ptr l) { l->flush(); }); + // spdlog::apply_all([&](std::shared_ptr l) { l->flush(); }); - accelerometer = new Accelerometer(&_vmsApplicationSettings); + accelerometer = new Accelerometer(&_vmsApplicationSettings); - SPDLOG_INFO("Main: Setting publisher"); - VMSPublisher::instance().setSAL(_vmsSAL); - VMSPublisher::instance().setLogLevel(getSpdLogLogLevel() * 10); + SPDLOG_INFO("Main: Setting publisher"); + VMSPublisher::instance().setSAL(_vmsSAL); + VMSPublisher::instance().setLogLevel(getSpdLogLogLevel() * 10); - SPDLOG_INFO("Starting controller thread"); - LSST::cRIO::ControllerThread::instance().start(10s); + SPDLOG_INFO("Starting controller thread"); + LSST::cRIO::ControllerThread::instance().start(10s); - SPDLOG_INFO("Creating subscriber"); - addThread(new VMSSubscriber(_vmsSAL, _allvmsSAL)); + SPDLOG_INFO("Creating subscriber"); + addThread(new VMSSubscriber(_vmsSAL, _allvmsSAL)); - accelerometer->enableAccelerometers(); - std::this_thread::sleep_for(1000ms); + accelerometer->enableAccelerometers(); + std::this_thread::sleep_for(1000ms); - LSST::cRIO::ControllerThread::instance().enqueue(new Commands::EnterControl()); + LSST::cRIO::ControllerThread::instance().enqueue( + new Commands::EnterControl()); - daemonOK(); + daemonOK(); } void MTVMSd::done() { - accelerometer->disableAccelerometers(); + accelerometer->disableAccelerometers(); - LSST::cRIO::ControllerThread::instance().stop(); + LSST::cRIO::ControllerThread::instance().stop(); - SPDLOG_INFO("Shutting down MTVMSd"); - removeSink(); + SPDLOG_INFO("Shutting down MTVMSd"); + removeSink(); - std::this_thread::sleep_for(10ms); + std::this_thread::sleep_for(10ms); - SPDLOG_INFO("Main: Shutting down MTVMS SAL"); - _vmsSAL->salShutdown(); + SPDLOG_INFO("Main: Shutting down MTVMS SAL"); + _vmsSAL->salShutdown(); - delete accelerometer; - accelerometer = NULL; + delete accelerometer; + accelerometer = NULL; } int MTVMSd::runLoop() { - static auto last = steady_clock::now() - 10s; - auto now = steady_clock::now(); - if (now - last > 1s) { - LSST::cRIO::ControllerThread::instance().enqueue(new Commands::Update()); - last = now; - } + static auto last = steady_clock::now() - 10s; + auto now = steady_clock::now(); + if (now - last > 1s) { + LSST::cRIO::ControllerThread::instance().enqueue(new Commands::Update()); + last = now; + } - accelerometer->sampleData(); - Events::FPGAState::instance().checkState(); + accelerometer->sampleData(); + Events::FPGAState::instance().checkState(); - return LSST::cRIO::ControllerThread::exitRequested() ? 0 : 1; + Events::Heartbeat::instance().tryToggle(); + + return LSST::cRIO::ControllerThread::exitRequested() ? 0 : 1; } -int main(int argc, char* const argv[]) { - MTVMSd csc("MTVMS", "Vibration Monitoring System CSC"); +int main(int argc, char *const argv[]) { + MTVMSd csc("MTVMS", "Vibration Monitoring System CSC"); - csc.processArgs(argc, argv); + csc.processArgs(argc, argv); - try { - csc.run(&(FPGA::instance())); - } catch (LSST::cRIO::NiError& nie) { - SPDLOG_CRITICAL("Main: Error initializing VMS FPGA: {}", nie.what()); - } + try { + csc.run(&(FPGA::instance())); + } catch (LSST::cRIO::NiError &nie) { + SPDLOG_CRITICAL("Main: Error initializing VMS FPGA: {}", nie.what()); + } - return 0; + return 0; } diff --git a/tests/test_PSD.cpp b/tests/test_PSD.cpp index 3f4d1af..270b321 100644 --- a/tests/test_PSD.cpp +++ b/tests/test_PSD.cpp @@ -25,87 +25,99 @@ #include #include -#include #include +#include #include using Catch::Approx; using namespace LSST::VMS::Telemetry; -void test_peaks(std::vector vec, std::vector peaks, float margin = 10e-3, float min_psd = 1000) { - for (auto p : peaks) { - auto m = std::max_element(vec.begin(), vec.end()); - REQUIRE(*m > min_psd); - REQUIRE(std::distance(vec.begin(), m) == p); - *m = 0.0; - } - - for (auto v : vec) { - REQUIRE(v == Approx(0).margin(margin)); - } +void test_peaks(std::vector vec, std::vector peaks, + float margin = 10e-3, float min_psd = 1000) { + for (auto p : peaks) { + auto m = std::max_element(vec.begin(), vec.end()); + REQUIRE(*m > min_psd); + REQUIRE(std::distance(vec.begin(), m) == p); + *m = 0.0; + } + + for (auto v : vec) { + REQUIRE(v == Approx(0).margin(margin)); + } } TEST_CASE("Calculate PSD @ 200 Hz sampling", "[PSD]") { - PSD psd; - psd.configure(1, 100, 0.005); - - REQUIRE(psd.frequency(0) == 0); - REQUIRE(psd.frequency(50) == 100.0); - REQUIRE(psd.frequency(100) == 200.0); - - for (size_t i = 0; i < 50; i++) { - REQUIRE(isnan(psd.accelerationPSDX[i])); - REQUIRE(isnan(psd.accelerationPSDY[i])); - REQUIRE(isnan(psd.accelerationPSDZ[i])); - } - - for (float i = 0; i < psd.numDataPoints * 2; i++) { - double theta = 2 * M_PI * i / psd.numDataPoints; - psd.append(1.0 * sin(5 * theta) + 0.5 * cos(13 * theta), 1.0 * cos(40 * theta) + 0.5 * sin(2 * theta), - 1.0 * sin(13.6 * theta) + 0.5 * cos(10.2 * theta) + 0.4 * sin(22 * theta)); - } - - test_peaks(std::vector(std::begin(psd.accelerationPSDX), - std::begin(psd.accelerationPSDX) + psd.numDataPoints), - {10, 26}); - test_peaks(std::vector(std::begin(psd.accelerationPSDY), - std::begin(psd.accelerationPSDY) + psd.numDataPoints), - {80, 4}); - test_peaks(std::vector(std::begin(psd.accelerationPSDZ), - std::begin(psd.accelerationPSDZ) + psd.numDataPoints), - {27, 44, 20, 21, 28, 26, 22, 25}, 100, 100); + PSD psd; + psd.configure(1, 100, 0.005); + + REQUIRE(psd.frequency(0) == 0); + REQUIRE(psd.frequency(50) == 100.0); + REQUIRE(psd.frequency(100) == 200.0); + + for (size_t i = 0; i < 50; i++) { + REQUIRE(isnan(psd.accelerationPSDX[i])); + REQUIRE(isnan(psd.accelerationPSDY[i])); + REQUIRE(isnan(psd.accelerationPSDZ[i])); + } + + for (float i = 0; i < psd.numDataPoints * 2; i++) { + double theta = 2 * M_PI * i / psd.numDataPoints; + psd.append(1.0 * sin(5 * theta) + 0.5 * cos(13 * theta), + 1.0 * cos(40 * theta) + 0.5 * sin(2 * theta), + 1.0 * sin(13.6 * theta) + 0.5 * cos(10.2 * theta) + + 0.4 * sin(22 * theta)); + } + + test_peaks( + std::vector(std::begin(psd.accelerationPSDX), + std::begin(psd.accelerationPSDX) + psd.numDataPoints), + {10, 26}); + test_peaks( + std::vector(std::begin(psd.accelerationPSDY), + std::begin(psd.accelerationPSDY) + psd.numDataPoints), + {80, 4}); + test_peaks( + std::vector(std::begin(psd.accelerationPSDZ), + std::begin(psd.accelerationPSDZ) + psd.numDataPoints), + {27, 44, 20, 21, 28, 26, 22, 25}, 100, 100); } TEST_CASE("Calculate PSD @ 50 Hz sampling", "[PSD]") { - PSD psd; - psd.configure(1, 200, 0.02); - - REQUIRE(psd.frequency(0) == 0); - REQUIRE(psd.frequency(1) == 0.25); - REQUIRE(psd.frequency(20) == 5); - REQUIRE(psd.frequency(200) == 50); - - for (size_t i = 0; i < 50; i++) { - REQUIRE(isnan(psd.accelerationPSDX[i])); - REQUIRE(isnan(psd.accelerationPSDY[i])); - REQUIRE(isnan(psd.accelerationPSDZ[i])); - } - - for (float i = 0; i < psd.numDataPoints * 2; i++) { - double theta = M_PI * i * 0.02; - psd.append(1.0 * sin(5 * theta) + 0.5 * cos(13 * theta), 1.0 * cos(40 * theta) + 0.5 * sin(2 * theta), - 1.0 * sin(13.6 * theta) + 0.5 * cos(10.2 * theta) + 0.4 * sin(22 * theta)); - } - - test_peaks(std::vector(std::begin(psd.accelerationPSDX), - std::begin(psd.accelerationPSDX) + psd.numDataPoints), - {20, 52}); - test_peaks(std::vector(std::begin(psd.accelerationPSDY), - std::begin(psd.accelerationPSDY) + psd.numDataPoints), - {160, 8}); - test_peaks(std::vector(std::begin(psd.accelerationPSDZ), - std::begin(psd.accelerationPSDZ) + psd.numDataPoints), - {54, 55, 41, 88, 53, 56, 52, 57, 42, 51, 40, 50, 58, 43, 49, 48, 59, 44, 47, 45, 46}, 100, - 100); + PSD psd; + psd.configure(1, 200, 0.02); + + REQUIRE(psd.frequency(0) == 0); + REQUIRE(psd.frequency(1) == 0.25); + REQUIRE(psd.frequency(20) == 5); + REQUIRE(psd.frequency(200) == 50); + + for (size_t i = 0; i < 50; i++) { + REQUIRE(isnan(psd.accelerationPSDX[i])); + REQUIRE(isnan(psd.accelerationPSDY[i])); + REQUIRE(isnan(psd.accelerationPSDZ[i])); + } + + for (float i = 0; i < psd.numDataPoints * 2; i++) { + double theta = M_PI * i * 0.02; + psd.append(1.0 * sin(5 * theta) + 0.5 * cos(13 * theta), + 1.0 * cos(40 * theta) + 0.5 * sin(2 * theta), + 1.0 * sin(13.6 * theta) + 0.5 * cos(10.2 * theta) + + 0.4 * sin(22 * theta)); + } + + test_peaks( + std::vector(std::begin(psd.accelerationPSDX), + std::begin(psd.accelerationPSDX) + psd.numDataPoints), + {20, 52}); + test_peaks( + std::vector(std::begin(psd.accelerationPSDY), + std::begin(psd.accelerationPSDY) + psd.numDataPoints), + {160, 8}); + test_peaks( + std::vector(std::begin(psd.accelerationPSDZ), + std::begin(psd.accelerationPSDZ) + psd.numDataPoints), + {54, 55, 41, 88, 53, 56, 52, 57, 42, 51, 40, + 50, 58, 43, 49, 48, 59, 44, 47, 45, 46}, + 100, 100); } diff --git a/tests/test_SettingsReader.cpp b/tests/test_SettingsReader.cpp index 06eed41..1db5a93 100644 --- a/tests/test_SettingsReader.cpp +++ b/tests/test_SettingsReader.cpp @@ -28,7 +28,8 @@ using namespace LSST::VMS; TEST_CASE("List available settings", "[SettingReader]") { - SettingReader::instance().setRootPath("../SettingFiles/"); - auto _vmsApplicationSettings = SettingReader::instance().loadVMSApplicationSettings("M1M3"); - REQUIRE(_vmsApplicationSettings.Subsystem == "M1M3"); + SettingReader::instance().setRootPath("../SettingFiles/"); + auto _vmsApplicationSettings = + SettingReader::instance().loadVMSApplicationSettings("M1M3"); + REQUIRE(_vmsApplicationSettings.Subsystem == "M1M3"); }