USRP Hardware Driver and USRP Manual  Version: 003.010.001.HEAD-0-g929e3b32
UHD and USRP Manual
soft_register.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2014 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_UHD_UTILS_SOFT_REGISTER_HPP
19 #define INCLUDED_UHD_UTILS_SOFT_REGISTER_HPP
20 
21 #include <boost/cstdint.hpp>
22 #include <boost/noncopyable.hpp>
23 #include <uhd/types/wb_iface.hpp>
24 #include <uhd/exception.hpp>
26 #include <boost/thread/mutex.hpp>
27 #include <boost/thread/locks.hpp>
28 #include <boost/unordered_map.hpp>
29 #include <boost/tokenizer.hpp>
30 #include <boost/foreach.hpp>
31 #include <boost/lexical_cast.hpp>
32 #include <list>
33 
48 //==================================================================
49 // Soft Register Definition
50 //==================================================================
51 
52 #define UHD_DEFINE_SOFT_REG_FIELD(name, width, shift) \
53  static const uhd::soft_reg_field_t name = (((shift & 0xFF) << 8) | (width & 0xFF))
54 
55 namespace uhd {
56 
57 //TODO: These hints were added to boost 1.53.
58 
60 UHD_INLINE bool likely(bool expr)
61 {
62 #ifdef __GNUC__
63  return __builtin_expect(expr, true);
64 #else
65  return expr;
66 #endif
67  }
68 
70 UHD_INLINE bool unlikely(bool expr)
71 {
72 #ifdef __GNUC__
73  return __builtin_expect(expr, false);
74 #else
75  return expr;
76 #endif
77 }
78 
86 typedef boost::uint32_t soft_reg_field_t;
87 
88 namespace soft_reg_field {
89  UHD_INLINE size_t width(const soft_reg_field_t field) {
90  return (field & 0xFF);
91  }
92 
93  UHD_INLINE size_t shift(const soft_reg_field_t field) {
94  return ((field >> 8) & 0xFF);
95  }
96 
97  template<typename data_t>
98  UHD_INLINE data_t mask(const soft_reg_field_t field) {
99  static const data_t ONE = static_cast<data_t>(1);
100  //Behavior for the left shift operation is undefined in C++
101  //if the shift amount is >= bitwidth of the datatype
102  //So we treat that as a special case with a branch predicition hint
103  if (likely((sizeof(data_t)*8) != width(field)))
104  return ((ONE<<width(field))-ONE)<<shift(field);
105  else
106  return (0-ONE)<<shift(field);
107  }
108 }
109 
110 class soft_register_base : public boost::noncopyable {
111 public:
112  virtual ~soft_register_base() {}
113 
114  virtual void initialize(wb_iface& iface, bool sync = false) = 0;
115  virtual void flush() = 0;
116  virtual void refresh() = 0;
117  virtual size_t get_bitwidth() = 0;
118  virtual bool is_readable() = 0;
119  virtual bool is_writable() = 0;
120 
124  template <typename soft_reg_t>
125  UHD_INLINE static soft_reg_t& cast(soft_register_base& reg) {
126  soft_reg_t* ptr = dynamic_cast<soft_reg_t*>(&reg);
127  if (ptr) {
128  return *ptr;
129  } else {
130  throw uhd::type_error("failed to cast register to specified type");
131  }
132  }
133 };
134 
136 
142 template<typename reg_data_t, bool readable, bool writable>
144 public:
145  typedef boost::shared_ptr< soft_register_t<reg_data_t, readable, writable> > sptr;
146 
147  //Reserved field. Represents all bits in the register.
148  UHD_DEFINE_SOFT_REG_FIELD(REGISTER, sizeof(reg_data_t)*8, 0); //[WIDTH-1:0]
149 
154  wb_iface::wb_addr_type wr_addr,
155  wb_iface::wb_addr_type rd_addr,
156  soft_reg_flush_mode_t mode = ALWAYS_FLUSH):
157  _iface(NULL), _wr_addr(wr_addr), _rd_addr(rd_addr), _soft_copy(0), _flush_mode(mode)
158  {}
159 
164  explicit soft_register_t(
166  soft_reg_flush_mode_t mode = ALWAYS_FLUSH):
167  _iface(NULL), _wr_addr(addr), _rd_addr(addr), _soft_copy(0), _flush_mode(mode)
168  {}
169 
175  UHD_INLINE void initialize(wb_iface& iface, bool sync = false)
176  {
177  _iface = &iface;
178 
179  //Synchronize with hardware. For RW register, flush THEN refresh.
180  if (sync && writable) flush();
181  if (sync && readable) refresh();
182  }
183 
189  UHD_INLINE void set(const soft_reg_field_t field, const reg_data_t value)
190  {
191  _soft_copy = (_soft_copy & ~soft_reg_field::mask<reg_data_t>(field)) |
192  ((value << soft_reg_field::shift(field)) & soft_reg_field::mask<reg_data_t>(field));
193  }
194 
199  UHD_INLINE reg_data_t get(const soft_reg_field_t field)
200  {
201  return (_soft_copy & soft_reg_field::mask<reg_data_t>(field)) >> soft_reg_field::shift(field);
202  }
203 
208  {
209  if (writable && _iface) {
210  //If optimized flush then poke only if soft copy is dirty
211  //If flush mode is ALWAYS, the dirty flag should get optimized
212  //out by the compiler because it is never read
213  if (_flush_mode == ALWAYS_FLUSH || _soft_copy.is_dirty()) {
214  if (get_bitwidth() <= 16) {
215  _iface->poke16(_wr_addr, static_cast<boost::uint16_t>(_soft_copy));
216  } else if (get_bitwidth() <= 32) {
217  _iface->poke32(_wr_addr, static_cast<boost::uint32_t>(_soft_copy));
218  } else if (get_bitwidth() <= 64) {
219  _iface->poke64(_wr_addr, static_cast<boost::uint64_t>(_soft_copy));
220  } else {
221  throw uhd::not_implemented_error("soft_register only supports up to 64 bits.");
222  }
223  _soft_copy.mark_clean();
224  }
225  } else {
226  throw uhd::not_implemented_error("soft_register is not writable or uninitialized.");
227  }
228  }
229 
234  {
235  if (readable && _iface) {
236  if (get_bitwidth() <= 16) {
237  _soft_copy = static_cast<reg_data_t>(_iface->peek16(_rd_addr));
238  } else if (get_bitwidth() <= 32) {
239  _soft_copy = static_cast<reg_data_t>(_iface->peek32(_rd_addr));
240  } else if (get_bitwidth() <= 64) {
241  _soft_copy = static_cast<reg_data_t>(_iface->peek64(_rd_addr));
242  } else {
243  throw uhd::not_implemented_error("soft_register only supports up to 64 bits.");
244  }
245  _soft_copy.mark_clean();
246  } else {
247  throw uhd::not_implemented_error("soft_register is not readable or uninitialized.");
248  }
249  }
250 
254  UHD_INLINE void write(const soft_reg_field_t field, const reg_data_t value)
255  {
256  set(field, value);
257  flush();
258  }
259 
263  UHD_INLINE reg_data_t read(const soft_reg_field_t field)
264  {
265  refresh();
266  return get(field);
267  }
268 
273  {
274  static const size_t BITS_IN_BYTE = 8;
275  return sizeof(reg_data_t) * BITS_IN_BYTE;
276  }
277 
282  {
283  return readable;
284  }
285 
290  {
291  return writable;
292  }
293 
294 private:
295  wb_iface* _iface;
296  const wb_iface::wb_addr_type _wr_addr;
297  const wb_iface::wb_addr_type _rd_addr;
298  dirty_tracked<reg_data_t> _soft_copy;
299  const soft_reg_flush_mode_t _flush_mode;
300 };
301 
306 template<typename reg_data_t, bool readable, bool writable>
307 class UHD_API soft_register_sync_t : public soft_register_t<reg_data_t, readable, writable> {
308 public:
309  typedef boost::shared_ptr< soft_register_sync_t<reg_data_t, readable, writable> > sptr;
310 
312  wb_iface::wb_addr_type wr_addr,
313  wb_iface::wb_addr_type rd_addr,
314  soft_reg_flush_mode_t mode = ALWAYS_FLUSH):
315  soft_register_t<reg_data_t, readable, writable>(wr_addr, rd_addr, mode), _mutex()
316  {}
317 
320  soft_reg_flush_mode_t mode = ALWAYS_FLUSH):
321  soft_register_t<reg_data_t, readable, writable>(addr, mode), _mutex()
322  {}
323 
324  UHD_INLINE void initialize(wb_iface& iface, bool sync = false)
325  {
326  boost::lock_guard<boost::mutex> lock(_mutex);
328  }
329 
330  UHD_INLINE void set(const soft_reg_field_t field, const reg_data_t value)
331  {
332  boost::lock_guard<boost::mutex> lock(_mutex);
334  }
335 
336  UHD_INLINE reg_data_t get(const soft_reg_field_t field)
337  {
338  boost::lock_guard<boost::mutex> lock(_mutex);
340  }
341 
343  {
344  boost::lock_guard<boost::mutex> lock(_mutex);
346  }
347 
349  {
350  boost::lock_guard<boost::mutex> lock(_mutex);
352  }
353 
354  UHD_INLINE void write(const soft_reg_field_t field, const reg_data_t value)
355  {
356  boost::lock_guard<boost::mutex> lock(_mutex);
358  }
359 
360  UHD_INLINE reg_data_t read(const soft_reg_field_t field)
361  {
362  boost::lock_guard<boost::mutex> lock(_mutex);
364  }
365 
366 private:
367  boost::mutex _mutex;
368 };
369 
370 /*
371  * Register Shortcut Formats:
372  * - soft_reg<bits>_<mode>_t: Soft register object with an unsynchronized soft-copy.
373  * Thread unsafe but lightweight. Mostly const propagated.
374  * - soft_reg<bits>_<mode>_sync_t: Soft register object with a synchronized soft-copy.
375  * Thread safe but with memory/speed overhead.
376  * where:
377  * - <bits> = {16, 32 or 64}
378  * - <mode> = {wo(write-only), rw(read-write) or ro(read-only)}
379  *
380  */
381 
382 //16-bit shortcuts
389 //32-bit shortcuts
396 //64-bit shortcuts
403 
404 
405 /*
406  * Usage example
407  *
408  //===Define bit width, RW mode, and synchronization using base class===
409  class example_reg_t : public soft_reg32_wo_sync_t (or soft_reg32_wo_t) {
410  public:
411  //===Define all the fields===
412  UHD_DEFINE_SOFT_REG_FIELD(FIELD0, 1, 0); //[0]
413  UHD_DEFINE_SOFT_REG_FIELD(FIELD1, 15, 1); //[15:1]
414  UHD_DEFINE_SOFT_REG_FIELD(FIELD2, 16, 16); //[31:16]
415 
416  example_reg_t(): //ctor with no args
417  soft_reg32_wo_t(SR_CORE_EXAMPLE_REG_OFFSET)) //===Bind to offset===
418  {
419  //===Set Initial values===
420  set(FIELD0, 0);
421  set(FIELD1, 1);
422  set(FIELD2, 0xFFFF);
423  }
424  }; //===Full register definition encapsulated in one class===
425 
426  void main() {
427  example_reg_t reg_obj;
428  reg_obj.initialize(iface);
429  reg_obj.write(example_reg_t::FIELD2, 0x1234);
430 
431  example_reg_t::sptr reg_sptr = boost::make_shared<example_reg_t>();
432  reg_obj->initialize(iface);
433  reg_obj->write(example_reg_t::FIELD2, 0x1234);
434  }
435 */
436 }
437 
438 //==================================================================
439 // Soft Register Map and Database Definition
440 //==================================================================
441 
442 namespace uhd {
443 
445 public:
446  typedef boost::shared_ptr<soft_regmap_accessor_t> sptr;
447 
449  virtual soft_register_base& lookup(const std::string& path) const = 0;
450  virtual std::vector<std::string> enumerate() const = 0;
451  virtual const std::string& get_name() const = 0;
452 };
453 
464 class UHD_API soft_regmap_t : public soft_regmap_accessor_t, public boost::noncopyable {
465 public:
466  soft_regmap_t(const std::string& name) : _name(name) {}
467  virtual ~soft_regmap_t() {};
468 
472  virtual UHD_INLINE const std::string& get_name() const { return _name; }
473 
480  void initialize(wb_iface& iface, bool sync = false) {
481  boost::lock_guard<boost::mutex> lock(_mutex);
482  BOOST_FOREACH(soft_register_base* reg, _reglist) {
483  reg->initialize(iface, sync);
484  }
485  }
486 
492  void flush() {
493  boost::lock_guard<boost::mutex> lock(_mutex);
494  BOOST_FOREACH(soft_register_base* reg, _reglist) {
495  reg->flush();
496  }
497  }
498 
504  void refresh() {
505  boost::lock_guard<boost::mutex> lock(_mutex);
506  BOOST_FOREACH(soft_register_base* reg, _reglist) {
507  reg->refresh();
508  }
509  }
510 
515  virtual soft_register_base& lookup(const std::string& name) const {
516  regmap_t::const_iterator iter = _regmap.find(name);
517  if (iter != _regmap.end()) {
518  return *(iter->second);
519  } else {
520  throw uhd::runtime_error("register not found in map: " + name);
521  }
522  }
523 
528  virtual std::vector<std::string> enumerate() const {
529  std::vector<std::string> temp;
530  BOOST_FOREACH(const regmap_t::value_type& reg, _regmap) {
531  temp.push_back(_name + "/" + reg.first);
532  }
533  return temp;
534  }
535 
536 protected:
538  PUBLIC, //Is accessible through the soft_regmap_accessor_t interface
539  PRIVATE //Is NOT accessible through the soft_regmap_accessor_t interface
540  };
541 
545  UHD_INLINE void add_to_map(soft_register_base& reg, const std::string& name, const visibility_t visible = PRIVATE) {
546  boost::lock_guard<boost::mutex> lock(_mutex);
547  if (visible == PUBLIC) {
548  //Only add to the map if this register is publicly visible
549  if (not _regmap.insert(regmap_t::value_type(name, &reg)).second) {
550  throw uhd::assertion_error("cannot add two registers with the same name to regmap: " + name);
551  }
552  }
553  _reglist.push_back(&reg);
554  }
555 
556 private:
557  typedef boost::unordered_map<std::string, soft_register_base*> regmap_t;
558  typedef std::list<soft_register_base*> reglist_t;
559 
560  const std::string _name;
561  regmap_t _regmap; //For lookups
562  reglist_t _reglist; //To maintain order
563  boost::mutex _mutex;
564 };
565 
566 
573 class UHD_API soft_regmap_db_t : public soft_regmap_accessor_t, public boost::noncopyable {
574 public:
575  typedef boost::shared_ptr<soft_regmap_db_t> sptr;
576 
580  soft_regmap_db_t() : _name("") {}
581 
585  soft_regmap_db_t(const std::string& name) : _name(name) {}
586 
590  const std::string& get_name() const { return _name; }
591 
595  void add(soft_regmap_t& regmap) {
596  boost::lock_guard<boost::mutex> lock(_mutex);
597  _regmaps.push_back(&regmap);
598  }
599 
603  void add(soft_regmap_db_t& db) {
604  boost::lock_guard<boost::mutex> lock(_mutex);
605  if (&db == this) {
606  throw uhd::assertion_error("cannot add regmap db to itself" + _name);
607  } else {
608  _regmap_dbs.push_back(&db);
609  }
610  }
611 
622  soft_register_base& lookup(const std::string& path) const
623  {
624  //Turn the slash separated path string into tokens
625  std::list<std::string> tokens;
626  BOOST_FOREACH(
627  const std::string& node,
628  boost::tokenizer< boost::char_separator<char> >(path, boost::char_separator<char>("/")))
629  {
630  tokens.push_back(node);
631  }
632  if ((tokens.size() > 2 && tokens.front() == _name) || //If this is a nested DB
633  (tokens.size() > 1 && _name == "")) { //If this is a top-level DB
634  if (_name != "") tokens.pop_front();
635  if (tokens.size() == 2) { //2 tokens => regmap/register path
636  BOOST_FOREACH(const soft_regmap_accessor_t* regmap, _regmaps) {
637  if (regmap->get_name() == tokens.front()) {
638  return regmap->lookup(tokens.back());
639  }
640  }
641  throw uhd::runtime_error("could not find register map: " + path);
642  } else if (not _regmap_dbs.empty()) { //>2 tokens => <1 or more dbs>/regmap/register
643  //Reconstruct path from tokens
644  std::string newpath;
645  BOOST_FOREACH(const std::string& node, tokens) {
646  newpath += ("/" + node);
647  }
648  //Dispatch path to hierarchical DB
649  BOOST_FOREACH(const soft_regmap_accessor_t* db, _regmap_dbs) {
650  try {
651  return db->lookup(newpath.substr(1));
652  } catch (std::exception&) {
653  continue;
654  }
655  }
656  }
657  }
658  throw uhd::runtime_error("could not find register: " + path);
659  }
660 
664  virtual std::vector<std::string> enumerate() const {
665  std::vector<std::string> paths;
666  BOOST_FOREACH(const soft_regmap_accessor_t* regmap, _regmaps) {
667  const std::vector<std::string>& regs = regmap->enumerate();
668  paths.insert(paths.end(), regs.begin(), regs.end());
669  }
670  BOOST_FOREACH(const soft_regmap_accessor_t* db, _regmap_dbs) {
671  const std::vector<std::string>& regs = db->enumerate();
672  paths.insert(paths.end(), regs.begin(), regs.end());
673  }
674  return paths;
675  }
676 
677 private:
678  typedef std::list<soft_regmap_accessor_t*> db_t;
679 
680  const std::string _name;
681  db_t _regmaps;
682  db_t _regmap_dbs;
683  boost::mutex _mutex;
684 };
685 
686 } //namespace uhd
687 
688 #endif /* INCLUDED_UHD_UTILS_SOFT_REGISTER_HPP */
void refresh()
Definition: soft_register.hpp:504
UHD_INLINE void flush()
Definition: soft_register.hpp:207
Definition: soft_register.hpp:135
soft_reg_flush_mode_t
Definition: soft_register.hpp:135
boost::shared_ptr< soft_register_t< reg_data_t, readable, writable > > sptr
Definition: soft_register.hpp:145
Definition: soft_register.hpp:307
virtual void flush()=0
Definition: exception.hpp:109
soft_register_t< boost::uint64_t, true, false > soft_reg64_ro_t
Definition: soft_register.hpp:398
soft_regmap_t(const std::string &name)
Definition: soft_register.hpp:466
UHD_INLINE bool unlikely(bool expr)
hint for the branch prediction
Definition: soft_register.hpp:70
UHD_INLINE void refresh()
Definition: soft_register.hpp:233
soft_register_sync_t< boost::uint16_t, true, false > soft_reg16_ro_sync_t
Definition: soft_register.hpp:387
virtual std::vector< std::string > enumerate() const
Definition: soft_register.hpp:528
soft_register_t(wb_iface::wb_addr_type addr, soft_reg_flush_mode_t mode=ALWAYS_FLUSH)
Definition: soft_register.hpp:164
#define UHD_DEFINE_SOFT_REG_FIELD(name, width, shift)
Definition: soft_register.hpp:52
UHD_INLINE size_t get_bitwidth()
Definition: soft_register.hpp:272
virtual soft_register_base & lookup(const std::string &name) const
Definition: soft_register.hpp:515
soft_register_t< boost::uint64_t, false, true > soft_reg64_wo_t
Definition: soft_register.hpp:397
soft_register_sync_t(wb_iface::wb_addr_type addr, soft_reg_flush_mode_t mode=ALWAYS_FLUSH)
Definition: soft_register.hpp:318
UHD_INLINE bool is_writable()
Definition: soft_register.hpp:289
Definition: exception.hpp:94
Definition: soft_register.hpp:573
soft_register_t< boost::uint32_t, true, false > soft_reg32_ro_t
Definition: soft_register.hpp:391
soft_register_sync_t< boost::uint32_t, true, false > soft_reg32_ro_sync_t
Definition: soft_register.hpp:394
boost::uint32_t wb_addr_type
Definition: wb_iface.hpp:33
soft_register_t< boost::uint16_t, true, false > soft_reg16_ro_t
Definition: soft_register.hpp:384
virtual std::vector< std::string > enumerate() const
Definition: soft_register.hpp:664
soft_register_t< boost::uint32_t, false, true > soft_reg32_wo_t
Definition: soft_register.hpp:390
UHD_INLINE size_t width(const soft_reg_field_t field)
Definition: soft_register.hpp:89
soft_register_sync_t< boost::uint16_t, false, true > soft_reg16_wo_sync_t
Definition: soft_register.hpp:386
Definition: soft_register.hpp:538
UHD_INLINE void set(const soft_reg_field_t field, const reg_data_t value)
Definition: soft_register.hpp:189
soft_regmap_db_t(const std::string &name)
Definition: soft_register.hpp:585
virtual ~soft_regmap_accessor_t()
Definition: soft_register.hpp:448
Definition: soft_register.hpp:143
UHD_INLINE reg_data_t get(const soft_reg_field_t field)
Definition: soft_register.hpp:199
Definition: build_info.hpp:25
soft_regmap_db_t()
Definition: soft_register.hpp:580
UHD_INLINE void write(const soft_reg_field_t field, const reg_data_t value)
Definition: soft_register.hpp:354
boost::uint32_t soft_reg_field_t
Definition: soft_register.hpp:86
virtual std::vector< std::string > enumerate() const =0
virtual soft_register_base & lookup(const std::string &path) const =0
virtual ~soft_register_base()
Definition: soft_register.hpp:112
void flush()
Definition: soft_register.hpp:492
visibility_t
Definition: soft_register.hpp:537
soft_register_sync_t< boost::uint16_t, true, true > soft_reg16_rw_sync_t
Definition: soft_register.hpp:388
UHD_INLINE void initialize(wb_iface &iface, bool sync=false)
Definition: soft_register.hpp:175
soft_register_t< boost::uint16_t, false, true > soft_reg16_wo_t
Definition: soft_register.hpp:383
virtual void refresh()=0
boost::shared_ptr< soft_register_sync_t< reg_data_t, readable, writable > > sptr
Definition: soft_register.hpp:309
void initialize(wb_iface &iface, bool sync=false)
Definition: soft_register.hpp:480
virtual const std::string & get_name() const =0
virtual ~soft_regmap_t()
Definition: soft_register.hpp:467
soft_register_sync_t(wb_iface::wb_addr_type wr_addr, wb_iface::wb_addr_type rd_addr, soft_reg_flush_mode_t mode=ALWAYS_FLUSH)
Definition: soft_register.hpp:311
boost::shared_ptr< soft_regmap_accessor_t > sptr
Definition: soft_register.hpp:446
Definition: soft_register.hpp:444
UHD_INLINE bool is_readable()
Definition: soft_register.hpp:281
soft_register_sync_t< boost::uint32_t, true, true > soft_reg32_rw_sync_t
Definition: soft_register.hpp:395
#define UHD_INLINE
Definition: config.h:63
UHD_INLINE void flush()
Definition: soft_register.hpp:342
UHD_INLINE reg_data_t read(const soft_reg_field_t field)
Definition: soft_register.hpp:263
soft_register_sync_t< boost::uint32_t, false, true > soft_reg32_wo_sync_t
Definition: soft_register.hpp:393
soft_register_t(wb_iface::wb_addr_type wr_addr, wb_iface::wb_addr_type rd_addr, soft_reg_flush_mode_t mode=ALWAYS_FLUSH)
Definition: soft_register.hpp:153
boost::shared_ptr< soft_regmap_db_t > sptr
Definition: soft_register.hpp:575
Definition: soft_register.hpp:464
Definition: soft_register.hpp:110
Definition: exception.hpp:52
soft_register_sync_t< boost::uint64_t, true, true > soft_reg64_rw_sync_t
Definition: soft_register.hpp:402
#define UHD_API
Definition: config.h:73
UHD_INLINE data_t mask(const soft_reg_field_t field)
Definition: soft_register.hpp:98
void add(soft_regmap_t &regmap)
Definition: soft_register.hpp:595
UHD_INLINE reg_data_t read(const soft_reg_field_t field)
Definition: soft_register.hpp:360
const std::string & get_name() const
Definition: soft_register.hpp:590
soft_register_t< boost::uint32_t, true, true > soft_reg32_rw_t
Definition: soft_register.hpp:392
soft_register_t< boost::uint16_t, true, true > soft_reg16_rw_t
Definition: soft_register.hpp:385
UHD_INLINE void refresh()
Definition: soft_register.hpp:348
soft_register_t< boost::uint64_t, true, true > soft_reg64_rw_t
Definition: soft_register.hpp:399
UHD_INLINE void write(const soft_reg_field_t field, const reg_data_t value)
Definition: soft_register.hpp:254
Definition: exception.hpp:80
void add(soft_regmap_db_t &db)
Definition: soft_register.hpp:603
virtual void initialize(wb_iface &iface, bool sync=false)=0
soft_register_base & lookup(const std::string &path) const
Definition: soft_register.hpp:622
UHD_INLINE void initialize(wb_iface &iface, bool sync=false)
Definition: soft_register.hpp:324
UHD_INLINE bool likely(bool expr)
hint for the branch prediction
Definition: soft_register.hpp:60
soft_register_sync_t< boost::uint64_t, true, false > soft_reg64_ro_sync_t
Definition: soft_register.hpp:401
soft_register_sync_t< boost::uint64_t, false, true > soft_reg64_wo_sync_t
Definition: soft_register.hpp:400
virtual UHD_INLINE const std::string & get_name() const
Definition: soft_register.hpp:472
UHD_INLINE void add_to_map(soft_register_base &reg, const std::string &name, const visibility_t visible=PRIVATE)
Definition: soft_register.hpp:545
UHD_INLINE size_t shift(const soft_reg_field_t field)
Definition: soft_register.hpp:93
Definition: soft_register.hpp:135
static UHD_INLINE soft_reg_t & cast(soft_register_base &reg)
Definition: soft_register.hpp:125
Definition: wb_iface.hpp:29