18 #ifndef INCLUDED_UHD_TRANSPORT_NIRIO_NIRIO_INTERFACE_H 19 #define INCLUDED_UHD_TRANSPORT_NIRIO_NIRIO_INTERFACE_H 22 #include <boost/smart_ptr.hpp> 23 #include <boost/noncopyable.hpp> 24 #include <boost/thread/shared_mutex.hpp> 25 #include <boost/thread/locks.hpp> 29 #define NI_VENDOR_NUM 0x1093 31 #define VERSION_BUILD_SHIFT 0 32 #define VERSION_PHASE_SHIFT 14 33 #define VERSION_MAINT_SHIFT 16 34 #define VERSION_UPGRD_SHIFT 20 35 #define VERSION_MAJOR_SHIFT 24 36 #define VERSION_BUILD_MASK 0x00003FFF 37 #define VERSION_PHASE_MASK 0x0000C000 38 #define VERSION_MAINT_MASK 0x000F0000 39 #define VERSION_UPGRD_MASK 0x00F00000 40 #define VERSION_MAJOR_MASK 0xFF000000 42 #define GET_FIFO_MEMORY_TYPE(fifo_inst) (static_cast<uint16_t>(0x0100 | static_cast<uint16_t>(fifo_inst))) 45 boost::shared_lock<boost::shared_mutex> reader_lock(_synchronization); 48 boost::upgrade_lock<boost::shared_mutex> write_upgrade_lock(_synchronization);\ 49 boost::upgrade_to_unique_lock<boost::shared_mutex> write_unique_lock(write_upgrade_lock); 52 namespace uhd {
namespace niusrprio
92 static inline nirio_scalar_type_t map_int_to_scalar_type(uint32_t scalar_type_as_int)
94 switch (scalar_type_as_int)
115 uint32_t arg_channel,
116 const char* arg_name,
118 uint32_t arg_base_addr,
120 nirio_scalar_type_t arg_scalar_type,
121 uint32_t arg_bitWidth,
122 int32_t arg_integerWordLength,
123 uint32_t arg_version) :
151 const uint32_t _outSize,
152 const int32_t _statusCode)
154 outBuf._64BitField = 0;
155 outBuf.pointer = _outBuf;
157 statusCode = _statusCode;
168 typedef boost::shared_ptr<niriok_proxy>
sptr;
170 static sptr make_and_open(
const std::string& interface_path);
176 virtual nirio_status open(
const std::string& interface_path) = 0;
177 virtual void close(
void) = 0;
184 uint32_t& session) = 0;
190 uint32_t& maintenance,
192 uint32_t& build) = 0;
195 const nirio_device_attribute32_t attribute,
196 uint32_t& attrValue) = 0;
199 const nirio_device_attribute32_t attribute,
200 const uint32_t value) = 0;
202 virtual nirio_status peek(uint32_t offset, uint32_t& value) = 0;
204 virtual nirio_status peek(uint32_t offset, uint64_t& value) = 0;
206 virtual nirio_status poke(uint32_t offset,
const uint32_t& value) = 0;
208 virtual nirio_status poke(uint32_t offset,
const uint64_t& value) = 0;
211 uint32_t fifo_instance,
232 uint32_t channel) = 0;
236 uint32_t requested_depth,
237 uint8_t requires_actuals,
238 uint32_t& actual_depth,
239 uint32_t& actual_size) = 0;
243 uint32_t elements_requested,
249 uint32_t& elements_acquired,
250 uint32_t& elements_remaining) = 0;
254 uint32_t elements_to_grant) = 0;
258 uint32_t elements_to_read,
260 uint32_t buffer_datatype_width,
261 uint32_t scalar_type,
264 uint32_t& number_read,
265 uint32_t& number_remaining) = 0;
269 uint32_t elements_to_write,
271 uint32_t buffer_datatype_width,
272 uint32_t scalar_type,
275 uint32_t& number_remaining) = 0;
285 virtual void _close() = 0;
293 cache_status = driver_proxy->get_attribute(
RIO_ADDRESS_SPACE, cached_addr_space);
304 uint32_t cached_addr_space;
void * pointer
Definition: niriok_proxy.h:161
Definition: niriok_proxy.h:148
Definition: niriok_proxy.h:88
Definition: niriok_proxy.h:109
Definition: niriok_proxy.h:58
Definition: niriok_proxy.h:74
int32_t nirio_i32_t
Definition: niriok_proxy.h:67
Definition: niriok_proxy.h:84
nirio_version_t
Definition: niriok_proxy.h:54
boost::shared_ptr< niriok_proxy > sptr
Definition: niriok_proxy.h:168
nirio_ioctl_packet_t(void *const _outBuf, const uint32_t _outSize, const int32_t _statusCode)
Definition: niriok_proxy.h:149
Definition: niriok_proxy.h:288
uint64_t nirio_u64_t
Definition: niriok_proxy.h:63
Definition: niriok_proxy.h:72
Definition: niriok_proxy.h:54
nirio_quirks _rio_quirks
Definition: niriok_proxy.h:280
Definition: nirio_quirks.h:33
io_connect_t rio_dev_handle_t
Definition: nirio_driver_iface.h:85
Definition: niriok_proxy.h:87
nirio_addr_space_t
Definition: niriok_proxy.h:56
Definition: niriok_proxy.h:70
niriok_scoped_addr_space(niriok_proxy::sptr proxy, nirio_addr_space_t addr_space, nirio_status &status)
Definition: niriok_proxy.h:290
#define UHD_ASSERT_THROW(code)
Definition: exception.hpp:160
uint32_t nirio_u32_t
Definition: niriok_proxy.h:64
std::string name
Definition: niriok_proxy.h:136
Definition: niriok_proxy.h:113
uint32_t outSize
Definition: niriok_proxy.h:165
#define UHD_API
Definition: config.hpp:79
uint32_t get_interface_num()
Definition: niriok_proxy.h:181
nirio_scalar_type_t
Definition: niriok_proxy.h:81
Definition: convert.hpp:28
~niriok_scoped_addr_space()
Definition: niriok_proxy.h:297
Definition: niriok_proxy.h:85
uint32_t _interface_num
Definition: niriok_proxy.h:279
uint32_t version
Definition: niriok_proxy.h:143
Definition: niriok_proxy.h:71
Definition: nirio_driver_iface.h:130
uint64_t _64BitField
Definition: niriok_proxy.h:162
int32_t nirio_status
Definition: status.h:30
static boost::shared_mutex _synchronization
Definition: niriok_proxy.h:282
Definition: niriok_proxy.h:75
#define nirio_status_not_fatal(status)
Definition: status.h:49
Definition: niriok_proxy.h:82
Definition: niriok_proxy.h:59
#define nirio_status_chain(func, status)
Definition: status.h:51
Definition: niriok_proxy.h:54
uint32_t channel
Definition: niriok_proxy.h:135
Definition: niriok_proxy.h:146
uint32_t bitWidth
Definition: niriok_proxy.h:141
Definition: niriok_proxy.h:73
fifo_direction_t
Definition: niriok_proxy.h:108
int32_t integerWordLength
Definition: niriok_proxy.h:142
uint32_t depth
Definition: niriok_proxy.h:139
nirio_driver_iface::rio_dev_handle_t _device_handle
Definition: niriok_proxy.h:278
nirio_fifo_info_t(uint32_t arg_channel, const char *arg_name, fifo_direction_t arg_direction, uint32_t arg_base_addr, uint32_t arg_depth, nirio_scalar_type_t arg_scalar_type, uint32_t arg_bitWidth, int32_t arg_integerWordLength, uint32_t arg_version)
Definition: niriok_proxy.h:114
fifo_direction_t direction
Definition: niriok_proxy.h:137
uint8_t nirio_u8_t
Definition: niriok_proxy.h:66
Definition: niriok_proxy.h:86
uint16_t nirio_u16_t
Definition: niriok_proxy.h:65
Definition: niriok_proxy.h:60
Definition: niriok_proxy.h:57
uint32_t base_addr
Definition: niriok_proxy.h:138
Definition: niriok_proxy.h:83
nirio_quirks & get_rio_quirks()
Definition: niriok_proxy.h:220
Definition: niriok_proxy.h:110
int32_t statusCode
Definition: niriok_proxy.h:166
nirio_scalar_type_t scalar_type
Definition: niriok_proxy.h:140
Definition: niriok_proxy.h:89
nirio_device_attribute32_t
Definition: niriok_proxy.h:69