USRP Hardware Driver and USRP Manual  Version: 004.000.000.HEAD-0-g8773fb2c
UHD and USRP Manual
blockdef.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2014-2015 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_LIBUHD_RFNOC_BLOCKDEF_HPP
19 #define INCLUDED_LIBUHD_RFNOC_BLOCKDEF_HPP
20 
21 #include <boost/cstdint.hpp>
22 #include <boost/enable_shared_from_this.hpp>
23 #include <uhd/config.hpp>
25 #include <vector>
26 #include <set>
27 
28 namespace uhd { namespace rfnoc {
29 
32 class UHD_RFNOC_API blockdef : public boost::enable_shared_from_this<blockdef>
33 {
34 public:
35  typedef boost::shared_ptr<blockdef> sptr;
36 
38  //
39  // This is not the same as a uhd::rfnoc::stream_sig_t. This is used
40  // to describe which ports are defined in a block definition, and
41  // to describe what kind of connection is allowed for this port.
42  //
43  // All the keys listed in PORT_ARGS will be available in this class.
44  class port_t : public uhd::dict<std::string, std::string> {
45  public:
47  static const device_addr_t PORT_ARGS;
48 
49  port_t();
50 
52  bool is_variable(const std::string &key) const;
54  bool is_keyword(const std::string &key) const;
56  // keywords are not resolved.
57  bool is_valid() const;
59  std::string to_string() const;
60  };
61  typedef std::vector<port_t> ports_t;
62 
64  class arg_t : public uhd::dict<std::string, std::string> {
65  public:
67  static const device_addr_t ARG_ARGS;
68  static const std::set<std::string> VALID_TYPES;
69 
70  arg_t();
71 
73  bool is_valid() const;
75  std::string to_string() const;
76 
77  };
78  typedef std::vector<arg_t> args_t;
79 
81 
88  static sptr make_from_noc_id(boost::uint64_t noc_id);
89 
91  virtual bool is_block() const = 0;
92 
94  virtual bool is_component() const = 0;
95 
97  virtual std::string get_key() const = 0;
98 
100  virtual std::string get_name() const = 0;
101 
103  virtual boost::uint64_t noc_id() const = 0;
104 
105  virtual ports_t get_input_ports() = 0;
106  virtual ports_t get_output_ports() = 0;
107 
109  virtual std::vector<size_t> get_all_port_numbers() = 0;
110 
112  //
113  // \throws uhd::runtime_error if args are invalid.
114  virtual args_t get_args() = 0;
115 
117  virtual registers_t get_settings_registers() = 0;
118 
120  virtual registers_t get_readback_registers() = 0;
121 };
122 
123 }} /* namespace uhd::rfnoc */
124 
125 #endif /* INCLUDED_LIBUHD_RFNOC_BLOCKDEF_HPP */
126 // vim: sw=4 et:
Definition: blockdef.hpp:32
uhd::dict< std::string, size_t > registers_t
Definition: blockdef.hpp:80
Definition: dict.hpp:30
static const std::set< std::string > VALID_TYPES
Definition: blockdef.hpp:68
std::vector< arg_t > args_t
Definition: blockdef.hpp:78
Definition: build_info.hpp:25
#define UHD_RFNOC_API
Definition: config.hpp:103
boost::shared_ptr< blockdef > sptr
Definition: blockdef.hpp:35
Describes port options for a block definition.
Definition: blockdef.hpp:44
static const device_addr_t PORT_ARGS
A list of args a port can have.
Definition: blockdef.hpp:47
static const device_addr_t ARG_ARGS
A list of args an argument can have.
Definition: blockdef.hpp:67
Describes arguments in a block definition.
Definition: blockdef.hpp:64
std::vector< port_t > ports_t
Definition: blockdef.hpp:61
Definition: device_addr.hpp:47