USRP Hardware Driver and USRP Manual Version: 4.1.0.3
UHD and USRP Manual
register_iface.hpp
Go to the documentation of this file.
1//
2// Copyright 2019 Ettus Research, a National Instruments Brand
3//
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6
7#pragma once
8
11#include <cstdint>
12#include <functional>
13#include <memory>
14#include <vector>
15
16namespace uhd { namespace rfnoc {
17
28{
29public:
30 using sptr = std::shared_ptr<register_iface>;
31
32 virtual ~register_iface() = default;
33
43 std::function<bool(uint32_t addr, const std::vector<uint32_t>& data)>;
44
55 using async_msg_callback_t = std::function<void(
56 uint32_t addr, const std::vector<uint32_t>& data, boost::optional<uint64_t>)>;
57
70 virtual void poke32(uint32_t addr,
71 uint32_t data,
73 bool ack = false) = 0;
74
92 void poke64(uint32_t addr,
93 uint64_t data,
95 bool ack = false)
96 {
97 block_poke32(addr,
98 {uint32_t(data & 0xFFFFFFFF), uint32_t((data >> 32) & 0xFFFFFFFF)},
99 time,
100 ack);
101 }
102
121 virtual void multi_poke32(const std::vector<uint32_t> addrs,
122 const std::vector<uint32_t> data,
124 bool ack = false) = 0;
125
146 virtual void block_poke32(uint32_t first_addr,
147 const std::vector<uint32_t> data,
149 bool ack = false) = 0;
150
160 virtual uint32_t peek32(uint32_t addr, time_spec_t time = uhd::time_spec_t::ASAP) = 0;
161
177 uint64_t peek64(uint32_t addr, time_spec_t time = uhd::time_spec_t::ASAP)
178 {
179 const auto vals = block_peek32(addr, 2, time);
180 return uint64_t(vals[0]) | (uint64_t(vals[1]) << 32);
181 }
182
202 virtual std::vector<uint32_t> block_peek32(uint32_t first_addr,
203 size_t length,
205
243 virtual void poll32(uint32_t addr,
244 uint32_t data,
245 uint32_t mask,
246 time_spec_t timeout,
248 bool ack = false) = 0;
249
250
261 virtual void sleep(time_spec_t duration, bool ack = false) = 0;
262
283
292
300 virtual void set_policy(const std::string& name, const uhd::device_addr_t& args) = 0;
301
307 virtual uint16_t get_src_epid() const = 0;
308
314 virtual uint16_t get_port_num() const = 0;
315
316}; // class register_iface
317
318}} /* namespace uhd::rfnoc */
Definition: device_addr.hpp:38
Definition: register_iface.hpp:28
virtual void register_async_msg_handler(async_msg_callback_t callback_f)=0
virtual void block_poke32(uint32_t first_addr, const std::vector< uint32_t > data, uhd::time_spec_t time=uhd::time_spec_t::ASAP, bool ack=false)=0
uint64_t peek64(uint32_t addr, time_spec_t time=uhd::time_spec_t::ASAP)
Definition: register_iface.hpp:177
std::shared_ptr< register_iface > sptr
Definition: register_iface.hpp:30
std::function< void(uint32_t addr, const std::vector< uint32_t > &data, boost::optional< uint64_t >)> async_msg_callback_t
Definition: register_iface.hpp:56
virtual void poll32(uint32_t addr, uint32_t data, uint32_t mask, time_spec_t timeout, time_spec_t time=uhd::time_spec_t::ASAP, bool ack=false)=0
virtual void multi_poke32(const std::vector< uint32_t > addrs, const std::vector< uint32_t > data, uhd::time_spec_t time=uhd::time_spec_t::ASAP, bool ack=false)=0
virtual void register_async_msg_validator(async_msg_validator_t callback_f)=0
std::function< bool(uint32_t addr, const std::vector< uint32_t > &data)> async_msg_validator_t
Definition: register_iface.hpp:43
virtual uint16_t get_port_num() const =0
virtual std::vector< uint32_t > block_peek32(uint32_t first_addr, size_t length, time_spec_t time=uhd::time_spec_t::ASAP)=0
virtual ~register_iface()=default
virtual void set_policy(const std::string &name, const uhd::device_addr_t &args)=0
virtual uint32_t peek32(uint32_t addr, time_spec_t time=uhd::time_spec_t::ASAP)=0
virtual uint16_t get_src_epid() const =0
void poke64(uint32_t addr, uint64_t data, time_spec_t time=uhd::time_spec_t::ASAP, bool ack=false)
Definition: register_iface.hpp:92
virtual void sleep(time_spec_t duration, bool ack=false)=0
virtual void poke32(uint32_t addr, uint32_t data, uhd::time_spec_t time=uhd::time_spec_t::ASAP, bool ack=false)=0
Definition: time_spec.hpp:31
static constexpr double ASAP
Definition: time_spec.hpp:34
UHD_INLINE data_t mask(const soft_reg_field_t field)
Definition: soft_register.hpp:87
Definition: build_info.hpp:12