aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/transport/nirio/nirio_driver_iface.h101
-rw-r--r--host/include/uhd/transport/nirio/niriok_proxy.h29
-rw-r--r--host/include/uhd/transport/nirio/niriok_proxy_impl_v1.h339
-rw-r--r--host/include/uhd/transport/nirio/niriok_proxy_impl_v2.h269
-rw-r--r--host/lib/transport/nirio/nirio_driver_iface_linux.cpp10
-rw-r--r--host/lib/transport/nirio/niriok_proxy_impl_v1.cpp421
-rw-r--r--host/lib/transport/nirio/niriok_proxy_impl_v2.cpp270
7 files changed, 721 insertions, 718 deletions
diff --git a/host/include/uhd/transport/nirio/nirio_driver_iface.h b/host/include/uhd/transport/nirio/nirio_driver_iface.h
index 2668c10b9..6804f6171 100644
--- a/host/include/uhd/transport/nirio/nirio_driver_iface.h
+++ b/host/include/uhd/transport/nirio/nirio_driver_iface.h
@@ -34,51 +34,74 @@
#endif
#elif defined(UHD_PLATFORM_MACOS)
#include <IOKit/IOKitLib.h>
+#elif defined(UHD_PLATFORM_LINUX)
+ #include <linux/ioctl.h>
#endif
-// CTL_CODE macro for non-win OSes
-#ifndef UHD_PLATFORM_WIN32
- #define CTL_CODE(a,controlCode,b,c) (controlCode)
+#if __GNUC__
+ typedef uint64_t aligned_uint64_t __attribute__ ((aligned(8)));
+#else
+ typedef uint64_t aligned_uint64_t;
#endif
-namespace nirio_driver_iface {
+//IOCTL Definitions
+
+#if defined(UHD_PLATFORM_WIN32)
+
+ #define IOCTL_ACCESS_ANY (FILE_ANY_ACCESS)
+ #define IOCTL_ACCESS_READ (FILE_READ_ACCESS)
+ #define IOCTL_ACCESS_WRITE (FILE_WRITE_ACCESS)
+ #define IOCTL_ACCESS_RW (FILE_READ_ACCESS | FILE_WRITE_ACCESS)
-const uint32_t NIRIO_IOCTL_BASE = 0x800;
-
-const uint32_t NIRIO_IOCTL_SYNCOP =
- CTL_CODE(FILE_DEVICE_UNKNOWN,
- NIRIO_IOCTL_BASE + 4,
- METHOD_OUT_DIRECT,
- FILE_READ_DATA | FILE_WRITE_DATA);
- ///< The synchronous operation code. Note: We
- /// must use METHOD_OUT_DIRECT on the syncOp()
- /// IOCTL to ensure the contents of the output
- /// block are available in the kernel.
-
-const uint32_t NIRIO_IOCTL_GET_IFACE_NUM =
- CTL_CODE(FILE_DEVICE_UNKNOWN,
- NIRIO_IOCTL_BASE + 6,
- METHOD_BUFFERED,
- FILE_READ_DATA); ///< Get the interface number for a device
-
-const uint32_t NIRIO_IOCTL_GET_SESSION =
- CTL_CODE(FILE_DEVICE_UNKNOWN,
- NIRIO_IOCTL_BASE + 8,
- METHOD_BUFFERED,
- FILE_READ_ACCESS); ///< Gets a previously opened session to a device
-
-const uint32_t NIRIO_IOCTL_POST_OPEN =
- CTL_CODE(FILE_DEVICE_UNKNOWN,
- NIRIO_IOCTL_BASE + 9,
- METHOD_BUFFERED,
- FILE_READ_ACCESS); ///< Called after opening a session
-
-const uint32_t NIRIO_IOCTL_PRE_CLOSE =
- CTL_CODE(FILE_DEVICE_UNKNOWN,
- NIRIO_IOCTL_BASE + 10,
- METHOD_BUFFERED,
- FILE_READ_ACCESS); ///< Called before closing a session
+ #define IOCTL(type, function, access) \
+ CTL_CODE((0x8000+type), (0x800+function), METHOD_BUFFERED, access)
+
+#elif defined(UHD_PLATFORM_MACOS)
+
+ #define IOCTL_ACCESS_ANY (0U)
+ #define IOCTL_ACCESS_READ (1U)
+ #define IOCTL_ACCESS_WRITE (2U)
+ #define IOCTL_ACCESS_RW (3U)
+
+ #define IOCTL(type, function, access) \
+ (((access & 0x0003) << 30) | \
+ ((type & 0x00FF) << 16) | \
+ ((function & 0xFFFF) << 0))
+
+#elif defined(UHD_PLATFORM_LINUX)
+
+ #define IOCTL_ACCESS_ANY (_IOC_NONE)
+ #define IOCTL_ACCESS_READ (_IOC_READ)
+ #define IOCTL_ACCESS_WRITE (_IOC_WRITE)
+ #define IOCTL_ACCESS_RW (_IOC_READ | _IOC_WRITE)
+
+ struct nirio_ioctl_block_t {
+ aligned_uint64_t in_buf;
+ aligned_uint64_t out_buf;
+ uint32_t in_buf_len;
+ uint32_t out_buf_len;
+ uint32_t bytes_returned;
+ uint32_t padding;
+ };
+ #define IOCTL(type, function, access) \
+ _IOC(access, type, function, sizeof(nirio_ioctl_block_t))
+
+#else
+
+ #define IOCTL_ACCESS_ANY (0U)
+ #define IOCTL_ACCESS_READ (1U)
+ #define IOCTL_ACCESS_WRITE (2U)
+ #define IOCTL_ACCESS_RW (3U)
+
+ #define IOCTL(type, function, access) \
+ (((access & 0x0003) << 30) | \
+ ((type & 0x00FF) << 16) | \
+ ((function & 0xFFFF) << 0))
+
+#endif
+
+namespace nirio_driver_iface {
//Device handle definition
#if defined(UHD_PLATFORM_LINUX)
diff --git a/host/include/uhd/transport/nirio/niriok_proxy.h b/host/include/uhd/transport/nirio/niriok_proxy.h
index 07bcb59b6..bb112dd8a 100644
--- a/host/include/uhd/transport/nirio/niriok_proxy.h
+++ b/host/include/uhd/transport/nirio/niriok_proxy.h
@@ -145,29 +145,9 @@ namespace uhd { namespace niusrprio
class UHD_API niriok_proxy : public boost::noncopyable {
public:
- struct nirio_ioctl_packet_t {
- nirio_ioctl_packet_t(
- void* const _outBuf,
- const uint32_t _outSize,
- const int32_t _statusCode)
- {
- outBuf._64BitField = 0;
- outBuf.pointer = _outBuf;
- outSize = _outSize;
- statusCode = _statusCode;
- };
-
- union {
- void* pointer;
- uint64_t _64BitField;
- } outBuf;
-
- uint32_t outSize;
- int32_t statusCode;
- };
- typedef boost::shared_ptr<niriok_proxy> sptr;
-
- static sptr make_and_open(const std::string& interface_path);
+ typedef boost::shared_ptr<niriok_proxy> sptr;
+
+ static sptr make_and_open(const std::string& interface_path);
niriok_proxy();
virtual ~niriok_proxy();
@@ -180,9 +160,6 @@ namespace uhd { namespace niusrprio
uint32_t get_interface_num() { return _interface_num; }
- virtual nirio_status get_cached_session(
- uint32_t& session) = 0;
-
virtual nirio_status get_version(
nirio_version_t type,
uint32_t& major,
diff --git a/host/include/uhd/transport/nirio/niriok_proxy_impl_v1.h b/host/include/uhd/transport/nirio/niriok_proxy_impl_v1.h
index 173d43ed6..a10d1aaff 100644
--- a/host/include/uhd/transport/nirio/niriok_proxy_impl_v1.h
+++ b/host/include/uhd/transport/nirio/niriok_proxy_impl_v1.h
@@ -33,341 +33,8 @@ namespace uhd { namespace niusrprio
are not compatible with NI-RIO 14.0 and later.
*/
- class UHD_API niriok_proxy_impl_v1 : virtual public niriok_proxy {
+ class UHD_API niriok_proxy_impl_v1 : virtual public niriok_proxy {
public:
-
- // -------------------------------
- // Function Codes: defined as integers rather than enums because they
- // are going to be carried accross boundaries so size matters
-
- struct NIRIO_FUNC
- {
- static const uint32_t GET32 = 0x00000001;
- static const uint32_t SET32 = 0x00000002;
- static const uint32_t SET_DRIVER_CONFIG = 0x00000007;
- static const uint32_t FIFO = 0x00000008;
- static const uint32_t IO = 0x0000000A;
- static const uint32_t FIFO_STOP_ALL = 0x0000000C;
- static const uint32_t ADD_RESOURCE = 0x0000000D;
- static const uint32_t GET_STRING = 0x0000000E;
- static const uint32_t SET_STRING = 0x0000000F;
- static const uint32_t DOWNLOAD = 0x00000013;
- static const uint32_t RESET = 0x00000014;
- };
-
- struct NIRIO_RESOURCE
- {
- static const uint32_t INPUT_FIFO = 0xD0000001;
- static const uint32_t OUTPUT_FIFO = 0xD0000002;
- };
-
- struct NIRIO_FIFO
- {
- static const uint32_t CONFIGURE = 0x80000001;
- static const uint32_t START = 0x80000002;
- static const uint32_t STOP = 0x80000003;
- static const uint32_t READ = 0x80000004;
- static const uint32_t WRITE = 0x80000005;
- static const uint32_t WAIT = 0x80000006;
- static const uint32_t GRANT = 0x80000007;
- };
-
- struct NIRIO_IO
- {
- static const uint32_t POKE64 = 0xA0000005;
- static const uint32_t POKE32 = 0xA0000006;
- static const uint32_t POKE16 = 0xA0000007;
- static const uint32_t POKE8 = 0xA0000008;
- static const uint32_t PEEK64 = 0xA0000009;
- static const uint32_t PEEK32 = 0xA000000A;
- static const uint32_t PEEK16 = 0xA000000B;
- static const uint32_t PEEK8 = 0xA000000C;
- static const uint32_t READ_BLOCK = 0xA000000D;
- static const uint32_t WRITE_BLOCK = 0xA000000E;
- static const uint32_t GET_IO_WINDOW = 0xA000000F;
- static const uint32_t GET_IO_WINDOW_SIZE = 0xA0000010;
- };
-
- struct nirio_syncop_in_params_t
- {
- uint32_t function;
- uint32_t subfunction;
-
- union
- {
- struct
- {
- uint32_t attribute;
- uint32_t value;
- } attribute32;
-
- struct
- {
- uint32_t attribute;
- uint64_t value;
- } attribute64;
-
- struct
- {
- uint32_t attribute;
- } attributeStr;
-
- struct
- {
- uint32_t attribute;
- } download;
-
- union
- {
- struct
- {
- uint32_t reserved_field_0_0_0;
- } reserved_field_0_0;
- struct
- {
- uint32_t reserved_field_0_1_0;
- uint32_t reserved_field_0_1_1;
- } reserved_field_0_1;
- struct
- {
- uint32_t reserved_field_0_2_0;
- } reserved_field_0_2;
- } reserved_field_0;
-
- union
- {
- struct
- {
- uint32_t channel;
- uint32_t baseAddress;
- uint32_t depthInSamples;
- uint32_t version;
- } fifo;
- struct
- {
- uint32_t channel;
- uint32_t baseAddress;
- uint32_t depthInSamples;
- uint32_t version;
- uint32_t scalarType;
- uint32_t bitWidth;
- } fifoWithDataType;
- struct
- {
- uint64_t rangeBaseAddress;
- uint32_t rangeSizeInBytes;
- uint32_t rangeAttribute;
- } atomic; // obsolete
- } add;
-
- struct
- {
- uint32_t channel;
-
- union
- {
- struct
- {
- uint32_t requestedDepth;
- uint8_t requiresActuals;
- } config;
- struct
- {
- uint32_t timeout;
- } read;
- struct
- {
- uint32_t timeout;
- uint32_t scalarType;
- uint32_t bitWidth;
- } readWithDataType;
- struct
- {
- uint32_t timeout;
- } write;
- struct
- {
- uint32_t timeout;
- uint32_t scalarType;
- uint32_t bitWidth;
- } writeWithDataType;
- struct
- {
- uint32_t elementsRequested;
- uint32_t scalarType;
- uint32_t bitWidth;
- uint32_t timeout;
- uint8_t output;
- } wait;
- struct
- {
- uint32_t elements;
- } grant;
- } op;
- } fifo;
-
- struct
- {
- uint64_t reserved_field_1_0;
- uint32_t reserved_field_1_1;
- uint32_t reserved_field_1_2;
- } reserved_field_1; // Obsolete
-
- struct
- {
- uint32_t offset;
- union
- {
- uint64_t value64;
- uint32_t value32;
- uint16_t value16;
- uint8_t value8;
- } value;
- union
- {
- uint32_t sizeToMap;
- } memoryMappedIoWindow;
- } io;
-
- struct
- {
- uint32_t reserved_field_2_0;
- uint32_t reserved_field_2_1;
- } reserved_field_2;
-
- struct
- {
- uint32_t reserved_field_3_0;
- } reserved_field_3;
-
- union
- {
- struct
- {
- uint32_t reserved_field_4_0;
- int32_t reserved_field_4_1;
- } wait;
- } reserved_field_4;
-
- } params;
-
- uint32_t inbufByteLen;
-
- union
- {
- const void* pointer;
- uint64_t _64BitField;
- } inbuf;
- };
-
- static inline void init_syncop_in_params(nirio_syncop_in_params_t& param, const void* const buf, const uint32_t len)
- {
- param.inbuf._64BitField = 0;
- param.inbuf.pointer = buf;
- param.inbufByteLen = len;
- }
-
-
- struct nirio_syncop_out_params_t
- {
- union
- {
- struct
- {
- uint32_t value;
- } attribute32;
-
- struct
- {
- uint64_t value;
- } attribute64;
-
- union
- {
- struct
- {
- uint32_t reserved_field_0_0;
- } enable;
- } reserved_field_0;
-
- struct
- {
- union
- {
- struct
- {
- uint32_t actualDepth;
- uint32_t actualSize;
- } config;
- struct
- {
- uint32_t numberRead;
- uint32_t numberRemaining;
- } read;
- struct
- {
- uint32_t numberRemaining;
- } write;
- struct
- {
- union
- {
- void* pointer;
- uint64_t _64BitField;
- } elements;
- } wait;
- } op;
- } fifo;
-
- struct
- {
- union
- {
- union
- {
- uint64_t value64;
- uint32_t value32;
- uint16_t value16;
- uint8_t value8;
- } value;
- union
- {
- void* memoryMappedAddress;
- uint64_t _64BitField;
- } memoryMappedIoWindow;
- union
- {
- uint32_t size;
- } memoryMappedIoWindowSize;
- };
- } io;
-
- uint32_t stringLength;
-
- struct
- {
- uint32_t reserved_field_1_0;
- } reserved_field_1;
-
- } params;
-
- uint32_t outbufByteLen;
-
- union
- {
- void* pointer;
- uint64_t _64BitField;
- } outbuf;
- };
-
-
- static inline void init_syncop_out_params(nirio_syncop_out_params_t& param, void* buf, uint32_t len)
- {
- param.outbuf._64BitField = 0;
- param.outbuf.pointer = buf;
- param.outbufByteLen = len;
- }
-
niriok_proxy_impl_v1();
virtual ~niriok_proxy_impl_v1();
@@ -377,9 +44,6 @@ namespace uhd { namespace niusrprio
virtual nirio_status reset();
- virtual nirio_status get_cached_session(
- uint32_t& session);
-
virtual nirio_status get_version(
nirio_version_t type,
uint32_t& major,
@@ -477,7 +141,6 @@ namespace uhd { namespace niusrprio
size_t writeBufferLength,
void *readBuffer,
size_t readBufferLength);
-
};
}}
diff --git a/host/include/uhd/transport/nirio/niriok_proxy_impl_v2.h b/host/include/uhd/transport/nirio/niriok_proxy_impl_v2.h
index 333ab4348..c0183502a 100644
--- a/host/include/uhd/transport/nirio/niriok_proxy_impl_v2.h
+++ b/host/include/uhd/transport/nirio/niriok_proxy_impl_v2.h
@@ -24,12 +24,6 @@
#include <uhd/transport/nirio/nirio_quirks.h>
#include <uhd/transport/nirio/niriok_proxy.h>
-#if __GNUC__
- typedef uint64_t tAlignedU64 __attribute__ ((aligned(8)));
-#else
- typedef uint64_t tAlignedU64;
-#endif
-
namespace uhd { namespace niusrprio
{
/*
@@ -39,267 +33,8 @@ namespace uhd { namespace niusrprio
are not compatible with NI-RIO versions older than 14.0.
*/
- #define IOCTL(type, function, access) \
- CTL_CODE((0x8000+type), (0x800+function), METHOD_BUFFERED, access)
-
- #define IOCTL_ACCESS_ANY (FILE_ANY_ACCESS)
- #define IOCTL_ACCESS_READ (FILE_READ_ACCESS)
- #define IOCTL_ACCESS_WRITE (FILE_WRITE_ACCESS)
- #define IOCTL_ACCESS_RW (FILE_READ_ACCESS | FILE_WRITE_ACCESS)
-
- #define IOCTL_TRANSPORT_GET32 IOCTL(0, 0, IOCTL_ACCESS_READ)
- #define IOCTL_TRANSPORT_SET32 IOCTL(0, 1, IOCTL_ACCESS_WRITE)
- #define IOCTL_TRANSPORT_GET_STRING IOCTL(0, 2, IOCTL_ACCESS_READ)
- #define IOCTL_TRANSPORT_SET_STRING IOCTL(0, 3, IOCTL_ACCESS_WRITE)
- #define IOCTL_TRANSPORT_RESET IOCTL(1, 1, IOCTL_ACCESS_WRITE)
- #define IOCTL_TRANSPORT_ADD_INPUT_FIFO_RESOURCE IOCTL(2, 0, IOCTL_ACCESS_ANY)
- #define IOCTL_TRANSPORT_ADD_OUTPUT_FIFO_RESOURCE IOCTL(2, 1, IOCTL_ACCESS_ANY)
- #define IOCTL_TRANSPORT_SET_DEVICE_CONFIG IOCTL(2, 3, IOCTL_ACCESS_WRITE)
- #define IOCTL_TRANSPORT_FIFO_CONFIG IOCTL(4, 0, IOCTL_ACCESS_ANY)
- #define IOCTL_TRANSPORT_FIFO_START IOCTL(4, 1, IOCTL_ACCESS_ANY)
- #define IOCTL_TRANSPORT_FIFO_STOP IOCTL(4, 2, IOCTL_ACCESS_ANY)
- #define IOCTL_TRANSPORT_FIFO_READ IOCTL(4, 3, IOCTL_ACCESS_READ)
- #define IOCTL_TRANSPORT_FIFO_WRITE IOCTL(4, 4, IOCTL_ACCESS_WRITE)
- #define IOCTL_TRANSPORT_FIFO_WAIT IOCTL(4, 5, IOCTL_ACCESS_ANY)
- #define IOCTL_TRANSPORT_FIFO_GRANT IOCTL(4, 6, IOCTL_ACCESS_ANY)
- #define IOCTL_TRANSPORT_FIFO_STOP_ALL IOCTL(4, 7, IOCTL_ACCESS_ANY)
- #define IOCTL_TRANSPORT_PEEK64 IOCTL(5, 2, IOCTL_ACCESS_READ)
- #define IOCTL_TRANSPORT_PEEK32 IOCTL(5, 3, IOCTL_ACCESS_READ)
- #define IOCTL_TRANSPORT_POKE64 IOCTL(5, 6, IOCTL_ACCESS_WRITE)
- #define IOCTL_TRANSPORT_POKE32 IOCTL(5, 7, IOCTL_ACCESS_WRITE)
- #define IOCTL_TRANSPORT_POST_OPEN IOCTL(8, 0, IOCTL_ACCESS_ANY)
- #define IOCTL_TRANSPORT_PRE_CLOSE IOCTL(8, 1, IOCTL_ACCESS_ANY)
-
- typedef struct {
- nirio_scalar_type_t scalarType;
- nirio_u32_t bitWidth;
- nirio_i32_t integerWordLength;
- } nirio_fifo_data_type_t;
-
class UHD_API niriok_proxy_impl_v2 : virtual public niriok_proxy {
public:
- typedef struct in_transport_get32
- {
- nirio_device_attribute32_t attribute;
- int32_t status;
- } in_transport_get32_t;
- typedef struct out_transport_get32
- {
- uint32_t retVal__;
- int32_t status;
- } out_transport_get32_t;
- typedef struct in_transport_set32
- {
- nirio_device_attribute32_t attribute;
- uint32_t value;
- int32_t status;
- } in_transport_set32_t;
- typedef struct out_transport_set32
- {
- int32_t status;
- } out_transport_set32_t;
- typedef struct out_transport_get_string
- {
- uint32_t stringLen;
- int32_t status;
- } out_transport_get_string_t;
- typedef struct out_transport_set_string
- {
- int32_t status;
- } out_transport_set_string_t;
- typedef struct in_transport_reset
- {
- int32_t status;
- } in_transport_reset_t;
- typedef struct out_transport_reset
- {
- int32_t status;
- } out_transport_reset_t;
- typedef struct in_transport_add_input_fifo_resource
- {
- uint32_t channel;
- uint32_t baseAddress;
- uint32_t depthInSamples;
- nirio_fifo_data_type_t dataType;
- uint32_t version;
- int32_t status;
- } in_transport_add_input_fifo_resource_t;
- typedef struct out_transport_addInputFifo_resource
- {
- int32_t status;
- } out_transport_add_input_fifo_resource_t;
- typedef struct in_transport_addOutputFifo_resource
- {
- uint32_t channel;
- uint32_t baseAddress;
- uint32_t depthInSamples;
- nirio_fifo_data_type_t dataType;
- uint32_t version;
- int32_t status;
- } in_transport_add_output_fifo_resource_t;
- typedef struct out_transport_addOutputFifo_resource
- {
- int32_t status;
- } out_transport_add_output_fifo_resource_t;
- typedef struct in_transport_setDevice_config
- {
- uint32_t attribute;
- int32_t status;
- } in_transport_set_device_config_t;
- typedef struct out_transport_setDevice_config
- {
- int32_t status;
- } out_transport_set_device_config_t;
- typedef struct in_transport_fifo_config
- {
- uint32_t channel;
- tAlignedU64 requestedDepth;
- int32_t status;
- } in_transport_fifo_config_t;
- typedef struct out_transport_fifo_config
- {
- tAlignedU64 actualDepth;
- tAlignedU64 actualSize;
- int32_t status;
- } out_transport_fifo_config_t;
- typedef struct in_transport_fifo_start
- {
- uint32_t channel;
- int32_t status;
- } in_transport_fifo_start_t;
- typedef struct out_transport_fifo_start
- {
- int32_t status;
- } out_transport_fifo_start_t;
- typedef struct in_transport_fifo_stop
- {
- uint32_t channel;
- int32_t status;
- } in_transport_fifo_stop_t;
- typedef struct out_transport_fifo_stop
- {
- int32_t status;
- } out_transport_fifo_stop_t;
- typedef struct in_transport_fifo_read
- {
- uint32_t channel;
- tAlignedU64 buf;
- uint32_t numberElements;
- nirio_fifo_data_type_t dataType;
- uint32_t timeout;
- int32_t status;
- } in_transport_fifo_read_t;
- typedef struct out_transport_fifo_read
- {
- uint32_t read;
- uint32_t remaining;
- int32_t status;
- } out_transport_fifo_read_t;
- typedef struct in_transport_fifo_write
- {
- uint32_t channel;
- tAlignedU64 buf;
- uint32_t numberElements;
- nirio_fifo_data_type_t dataType;
- uint32_t timeout;
- int32_t status;
- } in_transport_fifo_write_t;
- typedef struct out_transport_fifo_write
- {
- uint32_t remaining;
- int32_t status;
- } out_transport_fifo_write_t;
- typedef struct in_transport_fifo_wait
- {
- uint32_t channel;
- tAlignedU64 elementsRequested;
- nirio_fifo_data_type_t dataType;
- bool output;
- uint32_t timeout;
- int32_t status;
- } in_transport_fifo_wait_t;
- typedef struct out_transport_fifo_wait
- {
- tAlignedU64 elements;
- tAlignedU64 elementsAcquired;
- tAlignedU64 elementsRemaining;
- int32_t status;
- } out_transport_fifo_wait_t;
- typedef struct in_transport_fifo_grant
- {
- uint32_t channel;
- tAlignedU64 elements;
- int32_t status;
- } in_transport_fifo_grant_t;
- typedef struct out_transport_fifo_grant
- {
- int32_t status;
- } out_transport_fifo_grant_t;
- typedef struct in_transport_fifoStop_all
- {
- int32_t status;
- } in_transport_fifo_stop_all_t;
- typedef struct out_transport_fifoStop_all
- {
- int32_t status;
- } out_transport_fifo_stop_all_t;
- typedef struct in_transport_peek64
- {
- uint32_t offset;
- int32_t status;
- } in_transport_peek64_t;
- typedef struct out_transport_peek64
- {
- tAlignedU64 retVal__;
- int32_t status;
- } out_transport_peek64_t;
- typedef struct in_transport_peek32
- {
- uint32_t offset;
- int32_t status;
- } in_transport_peek32_t;
- typedef struct out_transport_peek32
- {
- uint32_t retVal__;
- int32_t status;
- } out_transport_peek32_t;
- typedef struct in_transport_poke64
- {
- uint32_t offset;
- tAlignedU64 value;
- int32_t status;
- } in_transport_poke64_t;
- typedef struct out_transport_poke64
- {
- int32_t status;
- } out_transport_poke64_t;
- typedef struct in_transport_poke32
- {
- uint32_t offset;
- uint32_t value;
- int32_t status;
- } in_transport_poke32_t;
- typedef struct out_transport_poke32
- {
- int32_t status;
- } out_transport_poke32_t;
- typedef struct in_transport_post_open
- {
- int32_t status;
- } in_transport_post_open_t;
- typedef struct out_transport_post_open
- {
- int32_t status;
- } out_transport_post_open_t;
- typedef struct in_transport_pre_close
- {
- int32_t status;
- } in_transport_pre_close_t;
- typedef struct out_transport_pre_close
- {
- int32_t status;
- } out_transport_pre_close_t;
-
niriok_proxy_impl_v2();
virtual ~niriok_proxy_impl_v2();
@@ -309,9 +44,6 @@ namespace uhd { namespace niusrprio
virtual nirio_status reset();
- virtual nirio_status get_cached_session(
- uint32_t& session);
-
virtual nirio_status get_version(
nirio_version_t type,
uint32_t& major,
@@ -402,7 +134,6 @@ namespace uhd { namespace niusrprio
protected:
// protected close function that doesn't acquire synchronization lock
virtual void _close();
-
};
}}
diff --git a/host/lib/transport/nirio/nirio_driver_iface_linux.cpp b/host/lib/transport/nirio/nirio_driver_iface_linux.cpp
index 4afc1579f..4d983de17 100644
--- a/host/lib/transport/nirio/nirio_driver_iface_linux.cpp
+++ b/host/lib/transport/nirio/nirio_driver_iface_linux.cpp
@@ -25,16 +25,6 @@
namespace nirio_driver_iface {
-struct nirio_ioctl_block_t
-{
- uint64_t in_buf;
- uint64_t out_buf;
- uint32_t in_buf_len;
- uint32_t out_buf_len;
- uint32_t bytes_returned;
- uint32_t padding;
-};
-
nirio_status rio_open(
const std::string& device_path,
rio_dev_handle_t& device_handle)
diff --git a/host/lib/transport/nirio/niriok_proxy_impl_v1.cpp b/host/lib/transport/nirio/niriok_proxy_impl_v1.cpp
index f0ffe2ffc..444e98f1b 100644
--- a/host/lib/transport/nirio/niriok_proxy_impl_v1.cpp
+++ b/host/lib/transport/nirio/niriok_proxy_impl_v1.cpp
@@ -26,8 +26,397 @@
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
+// CTL_CODE macro for non-win OSes
+#ifndef UHD_PLATFORM_WIN32
+ #define CTL_CODE(a,controlCode,b,c) (controlCode)
+#endif
+
+const uint32_t NIRIO_IOCTL_BASE = 0x800;
+
+const uint32_t NIRIO_IOCTL_SYNCOP =
+ CTL_CODE(FILE_DEVICE_UNKNOWN,
+ NIRIO_IOCTL_BASE + 4,
+ METHOD_OUT_DIRECT,
+ FILE_READ_DATA | FILE_WRITE_DATA);
+ ///< The synchronous operation code. Note: We
+ /// must use METHOD_OUT_DIRECT on the syncOp()
+ /// IOCTL to ensure the contents of the output
+ /// block are available in the kernel.
+
+const uint32_t NIRIO_IOCTL_GET_IFACE_NUM =
+ CTL_CODE(FILE_DEVICE_UNKNOWN,
+ NIRIO_IOCTL_BASE + 6,
+ METHOD_BUFFERED,
+ FILE_READ_DATA); ///< Get the interface number for a device
+
+const uint32_t NIRIO_IOCTL_GET_SESSION =
+ CTL_CODE(FILE_DEVICE_UNKNOWN,
+ NIRIO_IOCTL_BASE + 8,
+ METHOD_BUFFERED,
+ FILE_READ_ACCESS); ///< Gets a previously opened session to a device
+
+const uint32_t NIRIO_IOCTL_POST_OPEN =
+ CTL_CODE(FILE_DEVICE_UNKNOWN,
+ NIRIO_IOCTL_BASE + 9,
+ METHOD_BUFFERED,
+ FILE_READ_ACCESS); ///< Called after opening a session
+
+const uint32_t NIRIO_IOCTL_PRE_CLOSE =
+ CTL_CODE(FILE_DEVICE_UNKNOWN,
+ NIRIO_IOCTL_BASE + 10,
+ METHOD_BUFFERED,
+ FILE_READ_ACCESS); ///< Called before closing a session
+
namespace uhd { namespace niusrprio
{
+ // -------------------------------
+ // Function Codes: defined as integers rather than enums because they
+ // are going to be carried accross boundaries so size matters
+
+ struct NIRIO_FUNC
+ {
+ static const uint32_t GET32 = 0x00000001;
+ static const uint32_t SET32 = 0x00000002;
+ static const uint32_t SET_DRIVER_CONFIG = 0x00000007;
+ static const uint32_t FIFO = 0x00000008;
+ static const uint32_t IO = 0x0000000A;
+ static const uint32_t FIFO_STOP_ALL = 0x0000000C;
+ static const uint32_t ADD_RESOURCE = 0x0000000D;
+ static const uint32_t GET_STRING = 0x0000000E;
+ static const uint32_t SET_STRING = 0x0000000F;
+ static const uint32_t DOWNLOAD = 0x00000013;
+ static const uint32_t RESET = 0x00000014;
+ };
+
+ struct NIRIO_RESOURCE
+ {
+ static const uint32_t INPUT_FIFO = 0xD0000001;
+ static const uint32_t OUTPUT_FIFO = 0xD0000002;
+ };
+
+ struct NIRIO_FIFO
+ {
+ static const uint32_t CONFIGURE = 0x80000001;
+ static const uint32_t START = 0x80000002;
+ static const uint32_t STOP = 0x80000003;
+ static const uint32_t READ = 0x80000004;
+ static const uint32_t WRITE = 0x80000005;
+ static const uint32_t WAIT = 0x80000006;
+ static const uint32_t GRANT = 0x80000007;
+ };
+
+ struct NIRIO_IO
+ {
+ static const uint32_t POKE64 = 0xA0000005;
+ static const uint32_t POKE32 = 0xA0000006;
+ static const uint32_t POKE16 = 0xA0000007;
+ static const uint32_t POKE8 = 0xA0000008;
+ static const uint32_t PEEK64 = 0xA0000009;
+ static const uint32_t PEEK32 = 0xA000000A;
+ static const uint32_t PEEK16 = 0xA000000B;
+ static const uint32_t PEEK8 = 0xA000000C;
+ static const uint32_t READ_BLOCK = 0xA000000D;
+ static const uint32_t WRITE_BLOCK = 0xA000000E;
+ static const uint32_t GET_IO_WINDOW = 0xA000000F;
+ static const uint32_t GET_IO_WINDOW_SIZE = 0xA0000010;
+ };
+
+ struct nirio_ioctl_packet_t {
+ nirio_ioctl_packet_t(void* const _outBuf, const uint32_t _outSize, const int32_t _statusCode)
+ {
+ outBuf._64BitField = 0;
+ outBuf.pointer = _outBuf;
+ outSize = _outSize;
+ statusCode = _statusCode;
+ };
+
+ union {
+ void* pointer;
+ uint64_t _64BitField;
+ } outBuf;
+
+ uint32_t outSize;
+ int32_t statusCode;
+ };
+
+ struct nirio_syncop_in_params_t
+ {
+ uint32_t function;
+ uint32_t subfunction;
+
+ union
+ {
+ struct
+ {
+ uint32_t attribute;
+ uint32_t value;
+ } attribute32;
+
+ struct
+ {
+ uint32_t attribute;
+ uint64_t value;
+ } attribute64;
+
+ struct
+ {
+ uint32_t attribute;
+ } attributeStr;
+
+ struct
+ {
+ uint32_t attribute;
+ } download;
+
+ union
+ {
+ struct
+ {
+ uint32_t reserved_field_0_0_0;
+ } reserved_field_0_0;
+ struct
+ {
+ uint32_t reserved_field_0_1_0;
+ uint32_t reserved_field_0_1_1;
+ } reserved_field_0_1;
+ struct
+ {
+ uint32_t reserved_field_0_2_0;
+ } reserved_field_0_2;
+ } reserved_field_0;
+
+ union
+ {
+ struct
+ {
+ uint32_t channel;
+ uint32_t baseAddress;
+ uint32_t depthInSamples;
+ uint32_t version;
+ } fifo;
+ struct
+ {
+ uint32_t channel;
+ uint32_t baseAddress;
+ uint32_t depthInSamples;
+ uint32_t version;
+ uint32_t scalarType;
+ uint32_t bitWidth;
+ } fifoWithDataType;
+ struct
+ {
+ uint64_t rangeBaseAddress;
+ uint32_t rangeSizeInBytes;
+ uint32_t rangeAttribute;
+ } atomic; // obsolete
+ } add;
+
+ struct
+ {
+ uint32_t channel;
+
+ union
+ {
+ struct
+ {
+ uint32_t requestedDepth;
+ uint8_t requiresActuals;
+ } config;
+ struct
+ {
+ uint32_t timeout;
+ } read;
+ struct
+ {
+ uint32_t timeout;
+ uint32_t scalarType;
+ uint32_t bitWidth;
+ } readWithDataType;
+ struct
+ {
+ uint32_t timeout;
+ } write;
+ struct
+ {
+ uint32_t timeout;
+ uint32_t scalarType;
+ uint32_t bitWidth;
+ } writeWithDataType;
+ struct
+ {
+ uint32_t elementsRequested;
+ uint32_t scalarType;
+ uint32_t bitWidth;
+ uint32_t timeout;
+ uint8_t output;
+ } wait;
+ struct
+ {
+ uint32_t elements;
+ } grant;
+ } op;
+ } fifo;
+
+ struct
+ {
+ uint64_t reserved_field_1_0;
+ uint32_t reserved_field_1_1;
+ uint32_t reserved_field_1_2;
+ } reserved_field_1; // Obsolete
+
+ struct
+ {
+ uint32_t offset;
+ union
+ {
+ uint64_t value64;
+ uint32_t value32;
+ uint16_t value16;
+ uint8_t value8;
+ } value;
+ union
+ {
+ uint32_t sizeToMap;
+ } memoryMappedIoWindow;
+ } io;
+
+ struct
+ {
+ uint32_t reserved_field_2_0;
+ uint32_t reserved_field_2_1;
+ } reserved_field_2;
+
+ struct
+ {
+ uint32_t reserved_field_3_0;
+ } reserved_field_3;
+
+ union
+ {
+ struct
+ {
+ uint32_t reserved_field_4_0;
+ int32_t reserved_field_4_1;
+ } wait;
+ } reserved_field_4;
+
+ } params;
+
+ uint32_t inbufByteLen;
+
+ union
+ {
+ const void* pointer;
+ uint64_t _64BitField;
+ } inbuf;
+ };
+
+ static inline void init_syncop_in_params(nirio_syncop_in_params_t& param, const void* const buf, const uint32_t len)
+ {
+ param.inbuf._64BitField = 0;
+ param.inbuf.pointer = buf;
+ param.inbufByteLen = len;
+ }
+
+ struct nirio_syncop_out_params_t
+ {
+ union
+ {
+ struct
+ {
+ uint32_t value;
+ } attribute32;
+
+ struct
+ {
+ uint64_t value;
+ } attribute64;
+
+ union
+ {
+ struct
+ {
+ uint32_t reserved_field_0_0;
+ } enable;
+ } reserved_field_0;
+
+ struct
+ {
+ union
+ {
+ struct
+ {
+ uint32_t actualDepth;
+ uint32_t actualSize;
+ } config;
+ struct
+ {
+ uint32_t numberRead;
+ uint32_t numberRemaining;
+ } read;
+ struct
+ {
+ uint32_t numberRemaining;
+ } write;
+ struct
+ {
+ union
+ {
+ void* pointer;
+ uint64_t _64BitField;
+ } elements;
+ } wait;
+ } op;
+ } fifo;
+
+ struct
+ {
+ union
+ {
+ union
+ {
+ uint64_t value64;
+ uint32_t value32;
+ uint16_t value16;
+ uint8_t value8;
+ } value;
+ union
+ {
+ void* memoryMappedAddress;
+ uint64_t _64BitField;
+ } memoryMappedIoWindow;
+ union
+ {
+ uint32_t size;
+ } memoryMappedIoWindowSize;
+ };
+ } io;
+
+ uint32_t stringLength;
+
+ struct
+ {
+ uint32_t reserved_field_1_0;
+ } reserved_field_1;
+
+ } params;
+
+ uint32_t outbufByteLen;
+
+ union
+ {
+ void* pointer;
+ uint64_t _64BitField;
+ } outbuf;
+ };
+
+ static inline void init_syncop_out_params(nirio_syncop_out_params_t& param, void* buf, uint32_t len)
+ {
+ param.outbuf._64BitField = 0;
+ param.outbuf.pointer = buf;
+ param.outbufByteLen = len;
+ }
+
//-------------------------------------------------------
// niriok_proxy_impl_v1
//-------------------------------------------------------
@@ -55,11 +444,11 @@ namespace uhd { namespace niusrprio
interface_path, _device_handle), status);
if (nirio_status_not_fatal(status)) {
nirio_status_chain(nirio_driver_iface::rio_ioctl(_device_handle,
- nirio_driver_iface::NIRIO_IOCTL_POST_OPEN,
+ NIRIO_IOCTL_POST_OPEN,
NULL, 0, NULL, 0), status);
nirio_ioctl_packet_t out(&_interface_num, sizeof(_interface_num), 0);
nirio_status_chain(nirio_driver_iface::rio_ioctl(_device_handle,
- nirio_driver_iface::NIRIO_IOCTL_GET_IFACE_NUM,
+ NIRIO_IOCTL_GET_IFACE_NUM,
NULL, 0,
&out, sizeof(out)), status);
@@ -83,7 +472,7 @@ namespace uhd { namespace niusrprio
if(nirio_driver_iface::rio_isopen(_device_handle))
{
nirio_driver_iface::rio_ioctl(
- _device_handle, nirio_driver_iface::NIRIO_IOCTL_PRE_CLOSE, NULL, 0, NULL, 0);
+ _device_handle, NIRIO_IOCTL_PRE_CLOSE, NULL, 0, NULL, 0);
nirio_driver_iface::rio_close(_device_handle);
}
}
@@ -100,18 +489,6 @@ namespace uhd { namespace niusrprio
return sync_operation(&in, sizeof(in), &out, sizeof(out));
}
- nirio_status niriok_proxy_impl_v1::get_cached_session(
- uint32_t& session)
- {
- READER_LOCK
-
- nirio_ioctl_packet_t out(&session, sizeof(session), 0);
- return nirio_driver_iface::rio_ioctl(_device_handle,
- nirio_driver_iface::NIRIO_IOCTL_GET_SESSION,
- NULL, 0,
- &out, sizeof(out));
- }
-
nirio_status niriok_proxy_impl_v1::get_version(
nirio_version_t type,
uint32_t& major,
@@ -150,7 +527,7 @@ namespace uhd { namespace niusrprio
nirio_ioctl_packet_t out(readBuffer, readBufferLength, 0);
nirio_status ioctl_status = nirio_driver_iface::rio_ioctl(_device_handle,
- nirio_driver_iface::NIRIO_IOCTL_SYNCOP,
+ NIRIO_IOCTL_SYNCOP,
writeBuffer, writeBufferLength,
&out, sizeof(out));
if (nirio_status_fatal(ioctl_status)) return ioctl_status;
@@ -282,14 +659,14 @@ namespace uhd { namespace niusrprio
nirio_status niriok_proxy_impl_v1::add_fifo_resource(const nirio_fifo_info_t& fifo_info)
{
- niriok_proxy_impl_v1::nirio_syncop_in_params_t in = {};
- niriok_proxy_impl_v1::nirio_syncop_out_params_t out = {};
+ nirio_syncop_in_params_t in = {};
+ nirio_syncop_out_params_t out = {};
- in.function = niriok_proxy_impl_v1::NIRIO_FUNC::ADD_RESOURCE;
+ in.function = NIRIO_FUNC::ADD_RESOURCE;
if (fifo_info.direction == OUTPUT_FIFO)
- in.subfunction = niriok_proxy_impl_v1::NIRIO_RESOURCE::OUTPUT_FIFO;
+ in.subfunction = NIRIO_RESOURCE::OUTPUT_FIFO;
else
- in.subfunction = niriok_proxy_impl_v1::NIRIO_RESOURCE::INPUT_FIFO;
+ in.subfunction = NIRIO_RESOURCE::INPUT_FIFO;
in.params.add.fifoWithDataType.channel = fifo_info.channel;
in.params.add.fifoWithDataType.baseAddress = fifo_info.base_addr;
@@ -307,7 +684,7 @@ namespace uhd { namespace niusrprio
nirio_syncop_in_params_t in = {};
nirio_syncop_out_params_t out = {};
- in.function = niriok_proxy_impl_v1::NIRIO_FUNC::SET_DRIVER_CONFIG;
+ in.function = NIRIO_FUNC::SET_DRIVER_CONFIG;
in.subfunction = 0;
return sync_operation(&in, sizeof(in), &out, sizeof(out));
diff --git a/host/lib/transport/nirio/niriok_proxy_impl_v2.cpp b/host/lib/transport/nirio/niriok_proxy_impl_v2.cpp
index 748db5cf8..f75de01e1 100644
--- a/host/lib/transport/nirio/niriok_proxy_impl_v2.cpp
+++ b/host/lib/transport/nirio/niriok_proxy_impl_v2.cpp
@@ -27,9 +27,263 @@
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
+#define IOCTL_TRANSPORT_GET32 IOCTL(0, 0, IOCTL_ACCESS_READ)
+#define IOCTL_TRANSPORT_SET32 IOCTL(0, 1, IOCTL_ACCESS_WRITE)
+#define IOCTL_TRANSPORT_GET_STRING IOCTL(0, 2, IOCTL_ACCESS_READ)
+#define IOCTL_TRANSPORT_SET_STRING IOCTL(0, 3, IOCTL_ACCESS_WRITE)
+#define IOCTL_TRANSPORT_RESET IOCTL(1, 1, IOCTL_ACCESS_WRITE)
+#define IOCTL_TRANSPORT_ADD_INPUT_FIFO_RESOURCE IOCTL(2, 0, IOCTL_ACCESS_ANY)
+#define IOCTL_TRANSPORT_ADD_OUTPUT_FIFO_RESOURCE IOCTL(2, 1, IOCTL_ACCESS_ANY)
+#define IOCTL_TRANSPORT_SET_DEVICE_CONFIG IOCTL(2, 3, IOCTL_ACCESS_WRITE)
+#define IOCTL_TRANSPORT_FIFO_CONFIG IOCTL(4, 0, IOCTL_ACCESS_ANY)
+#define IOCTL_TRANSPORT_FIFO_START IOCTL(4, 1, IOCTL_ACCESS_ANY)
+#define IOCTL_TRANSPORT_FIFO_STOP IOCTL(4, 2, IOCTL_ACCESS_ANY)
+#define IOCTL_TRANSPORT_FIFO_READ IOCTL(4, 3, IOCTL_ACCESS_READ)
+#define IOCTL_TRANSPORT_FIFO_WRITE IOCTL(4, 4, IOCTL_ACCESS_WRITE)
+#define IOCTL_TRANSPORT_FIFO_WAIT IOCTL(4, 5, IOCTL_ACCESS_ANY)
+#define IOCTL_TRANSPORT_FIFO_GRANT IOCTL(4, 6, IOCTL_ACCESS_ANY)
+#define IOCTL_TRANSPORT_FIFO_STOP_ALL IOCTL(4, 7, IOCTL_ACCESS_ANY)
+#define IOCTL_TRANSPORT_PEEK64 IOCTL(5, 2, IOCTL_ACCESS_READ)
+#define IOCTL_TRANSPORT_PEEK32 IOCTL(5, 3, IOCTL_ACCESS_READ)
+#define IOCTL_TRANSPORT_POKE64 IOCTL(5, 6, IOCTL_ACCESS_WRITE)
+#define IOCTL_TRANSPORT_POKE32 IOCTL(5, 7, IOCTL_ACCESS_WRITE)
+#define IOCTL_TRANSPORT_POST_OPEN IOCTL(8, 0, IOCTL_ACCESS_ANY)
+#define IOCTL_TRANSPORT_PRE_CLOSE IOCTL(8, 1, IOCTL_ACCESS_ANY)
+
namespace uhd { namespace niusrprio
{
//-------------------------------------------------------
+ // ioctl param typedefs
+ //-------------------------------------------------------
+ typedef struct {
+ nirio_scalar_type_t scalarType;
+ nirio_u32_t bitWidth;
+ nirio_i32_t integerWordLength;
+ } nirio_fifo_data_type_t;
+
+ typedef struct in_transport_get32
+ {
+ nirio_device_attribute32_t attribute;
+ int32_t status;
+ } in_transport_get32_t;
+ typedef struct out_transport_get32
+ {
+ uint32_t retVal__;
+ int32_t status;
+ } out_transport_get32_t;
+ typedef struct in_transport_set32
+ {
+ nirio_device_attribute32_t attribute;
+ uint32_t value;
+ int32_t status;
+ } in_transport_set32_t;
+ typedef struct out_transport_set32
+ {
+ int32_t status;
+ } out_transport_set32_t;
+ typedef struct out_transport_get_string
+ {
+ uint32_t stringLen;
+ int32_t status;
+ } out_transport_get_string_t;
+ typedef struct out_transport_set_string
+ {
+ int32_t status;
+ } out_transport_set_string_t;
+ typedef struct in_transport_reset
+ {
+ int32_t status;
+ } in_transport_reset_t;
+ typedef struct out_transport_reset
+ {
+ int32_t status;
+ } out_transport_reset_t;
+ typedef struct in_transport_add_input_fifo_resource
+ {
+ uint32_t channel;
+ uint32_t baseAddress;
+ uint32_t depthInSamples;
+ nirio_fifo_data_type_t dataType;
+ uint32_t version;
+ int32_t status;
+ } in_transport_add_input_fifo_resource_t;
+ typedef struct out_transport_addInputFifo_resource
+ {
+ int32_t status;
+ } out_transport_add_input_fifo_resource_t;
+ typedef struct in_transport_addOutputFifo_resource
+ {
+ uint32_t channel;
+ uint32_t baseAddress;
+ uint32_t depthInSamples;
+ nirio_fifo_data_type_t dataType;
+ uint32_t version;
+ int32_t status;
+ } in_transport_add_output_fifo_resource_t;
+ typedef struct out_transport_addOutputFifo_resource
+ {
+ int32_t status;
+ } out_transport_add_output_fifo_resource_t;
+ typedef struct in_transport_setDevice_config
+ {
+ uint32_t attribute;
+ int32_t status;
+ } in_transport_set_device_config_t;
+ typedef struct out_transport_setDevice_config
+ {
+ int32_t status;
+ } out_transport_set_device_config_t;
+ typedef struct in_transport_fifo_config
+ {
+ uint32_t channel;
+ aligned_uint64_t requestedDepth;
+ int32_t status;
+ } in_transport_fifo_config_t;
+ typedef struct out_transport_fifo_config
+ {
+ aligned_uint64_t actualDepth;
+ aligned_uint64_t actualSize;
+ int32_t status;
+ } out_transport_fifo_config_t;
+ typedef struct in_transport_fifo_start
+ {
+ uint32_t channel;
+ int32_t status;
+ } in_transport_fifo_start_t;
+ typedef struct out_transport_fifo_start
+ {
+ int32_t status;
+ } out_transport_fifo_start_t;
+ typedef struct in_transport_fifo_stop
+ {
+ uint32_t channel;
+ int32_t status;
+ } in_transport_fifo_stop_t;
+ typedef struct out_transport_fifo_stop
+ {
+ int32_t status;
+ } out_transport_fifo_stop_t;
+ typedef struct in_transport_fifo_read
+ {
+ uint32_t channel;
+ aligned_uint64_t buf;
+ uint32_t numberElements;
+ nirio_fifo_data_type_t dataType;
+ uint32_t timeout;
+ int32_t status;
+ } in_transport_fifo_read_t;
+ typedef struct out_transport_fifo_read
+ {
+ uint32_t read;
+ uint32_t remaining;
+ int32_t status;
+ } out_transport_fifo_read_t;
+ typedef struct in_transport_fifo_write
+ {
+ uint32_t channel;
+ aligned_uint64_t buf;
+ uint32_t numberElements;
+ nirio_fifo_data_type_t dataType;
+ uint32_t timeout;
+ int32_t status;
+ } in_transport_fifo_write_t;
+ typedef struct out_transport_fifo_write
+ {
+ uint32_t remaining;
+ int32_t status;
+ } out_transport_fifo_write_t;
+ typedef struct in_transport_fifo_wait
+ {
+ uint32_t channel;
+ aligned_uint64_t elementsRequested;
+ nirio_fifo_data_type_t dataType;
+ bool output;
+ uint32_t timeout;
+ int32_t status;
+ } in_transport_fifo_wait_t;
+ typedef struct out_transport_fifo_wait
+ {
+ aligned_uint64_t elements;
+ aligned_uint64_t elementsAcquired;
+ aligned_uint64_t elementsRemaining;
+ int32_t status;
+ } out_transport_fifo_wait_t;
+ typedef struct in_transport_fifo_grant
+ {
+ uint32_t channel;
+ aligned_uint64_t elements;
+ int32_t status;
+ } in_transport_fifo_grant_t;
+ typedef struct out_transport_fifo_grant
+ {
+ int32_t status;
+ } out_transport_fifo_grant_t;
+ typedef struct in_transport_fifoStop_all
+ {
+ int32_t status;
+ } in_transport_fifo_stop_all_t;
+ typedef struct out_transport_fifoStop_all
+ {
+ int32_t status;
+ } out_transport_fifo_stop_all_t;
+ typedef struct in_transport_peek64
+ {
+ uint32_t offset;
+ int32_t status;
+ } in_transport_peek64_t;
+ typedef struct out_transport_peek64
+ {
+ aligned_uint64_t retVal__;
+ int32_t status;
+ } out_transport_peek64_t;
+ typedef struct in_transport_peek32
+ {
+ uint32_t offset;
+ int32_t status;
+ } in_transport_peek32_t;
+ typedef struct out_transport_peek32
+ {
+ uint32_t retVal__;
+ int32_t status;
+ } out_transport_peek32_t;
+ typedef struct in_transport_poke64
+ {
+ uint32_t offset;
+ aligned_uint64_t value;
+ int32_t status;
+ } in_transport_poke64_t;
+ typedef struct out_transport_poke64
+ {
+ int32_t status;
+ } out_transport_poke64_t;
+ typedef struct in_transport_poke32
+ {
+ uint32_t offset;
+ uint32_t value;
+ int32_t status;
+ } in_transport_poke32_t;
+ typedef struct out_transport_poke32
+ {
+ int32_t status;
+ } out_transport_poke32_t;
+ typedef struct in_transport_post_open
+ {
+ int32_t status;
+ } in_transport_post_open_t;
+ typedef struct out_transport_post_open
+ {
+ int32_t status;
+ } out_transport_post_open_t;
+ typedef struct in_transport_pre_close
+ {
+ int32_t status;
+ } in_transport_pre_close_t;
+ typedef struct out_transport_pre_close
+ {
+ int32_t status;
+ } out_transport_pre_close_t;
+
+ //-------------------------------------------------------
// niriok_proxy_impl_v2
//-------------------------------------------------------
niriok_proxy_impl_v2::niriok_proxy_impl_v2()
@@ -110,18 +364,6 @@ namespace uhd { namespace niusrprio
return out.status;
}
- nirio_status niriok_proxy_impl_v2::get_cached_session(
- uint32_t& session)
- {
- READER_LOCK
-
- nirio_ioctl_packet_t out(&session, sizeof(session), 0);
- return nirio_driver_iface::rio_ioctl(_device_handle,
- nirio_driver_iface::NIRIO_IOCTL_GET_SESSION,
- NULL, 0,
- &out, sizeof(out));
- }
-
nirio_status niriok_proxy_impl_v2::get_version(
nirio_version_t type,
uint32_t& major,
@@ -580,7 +822,7 @@ namespace uhd { namespace niusrprio
out_transport_fifo_read_t out = {};
in.channel = channel;
- in.buf = reinterpret_cast<tAlignedU64>(buffer);
+ in.buf = reinterpret_cast<aligned_uint64_t>(buffer);
in.numberElements = elements_to_read;
in.dataType.scalarType = map_int_to_scalar_type(scalar_type);
in.dataType.bitWidth = bit_width;
@@ -620,7 +862,7 @@ namespace uhd { namespace niusrprio
out_transport_fifo_write_t out = {};
in.channel = channel;
- in.buf = reinterpret_cast<tAlignedU64>(buffer);
+ in.buf = reinterpret_cast<aligned_uint64_t>(buffer);
in.numberElements = elements_to_write;
in.dataType.scalarType = map_int_to_scalar_type(scalar_type);
in.dataType.bitWidth = bit_width;