USRP Hardware Driver and Device Manual  Version: 4.11.0.0-0-g0d7ed3b1
UHD and USRP Manual
blockdef.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2014-2015 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 
8 #pragma once
9 
10 #include <uhd/config.hpp>
12 #include <stdint.h>
13 #include <memory>
14 #include <set>
15 #include <vector>
16 
17 namespace uhd { namespace rfnoc {
18 
21 class UHD_API blockdef : public std::enable_shared_from_this<blockdef>
22 {
23 public:
24  typedef std::shared_ptr<blockdef> sptr;
25 
34  class port_t : public uhd::dict<std::string, std::string>
35  {
36  public:
38  static const device_addr_t PORT_ARGS;
39 
40  port_t();
41 
43  bool is_variable(const std::string& key) const;
45  bool is_keyword(const std::string& key) const;
49  bool is_valid() const;
51  std::string to_string() const;
52  };
53  typedef std::vector<port_t> ports_t;
54 
56  class arg_t : public uhd::dict<std::string, std::string>
57  {
58  public:
60  static const device_addr_t ARG_ARGS;
61  static const std::set<std::string> VALID_TYPES;
62 
63  arg_t();
64 
66  bool is_valid() const;
68  std::string to_string() const;
69  };
70  typedef std::vector<arg_t> args_t;
71 
73 
80  static sptr make_from_noc_id(uint64_t noc_id);
81 
83  virtual bool is_block() const = 0;
84 
86  virtual bool is_component() const = 0;
87 
89  virtual std::string get_key() const = 0;
90 
92  virtual std::string get_name() const = 0;
93 
95  virtual uint64_t noc_id() const = 0;
96 
97  virtual ports_t get_input_ports() = 0;
98  virtual ports_t get_output_ports() = 0;
99 
101  virtual std::vector<size_t> get_all_port_numbers() = 0;
102 
107  virtual args_t get_args() = 0;
108 
111 
114 };
115 
116 }} /* namespace uhd::rfnoc */
Definition: device_addr.hpp:39
Definition: dict.hpp:25
Describes arguments in a block definition.
Definition: blockdef.hpp:57
bool is_valid() const
Basic validity check of this argument definition.
static const std::set< std::string > VALID_TYPES
Definition: blockdef.hpp:61
static const device_addr_t ARG_ARGS
A list of args an argument can have.
Definition: blockdef.hpp:60
std::string to_string() const
Returns a string with the most important keys.
Describes port options for a block definition.
Definition: blockdef.hpp:35
bool is_variable(const std::string &key) const
Checks if the value at key is a variable (e.g. '$fftlen')
static const device_addr_t PORT_ARGS
A list of args a port can have.
Definition: blockdef.hpp:38
bool is_keyword(const std::string &key) const
Checks if the value at key is a keyword (e.g. 'vlen')
std::string to_string() const
Returns a string with the most important keys.
Definition: blockdef.hpp:22
virtual std::string get_key() const =0
Returns block key (i.e. what is used for the registry)
static sptr make_from_noc_id(uint64_t noc_id)
virtual registers_t get_readback_registers()=0
Returns a list of readback (user) registers by name.
virtual uint64_t noc_id() const =0
Return the one NoC that is valid for this block.
virtual bool is_component() const =0
Returns true if this represents a component.
virtual ports_t get_input_ports()=0
virtual ports_t get_output_ports()=0
std::shared_ptr< blockdef > sptr
Definition: blockdef.hpp:24
virtual args_t get_args()=0
Returns the args for this block. Checks if args are valid.
virtual registers_t get_settings_registers()=0
Returns a list of settings registers by name.
virtual std::vector< size_t > get_all_port_numbers()=0
Returns the full list of port numbers used.
std::vector< arg_t > args_t
Definition: blockdef.hpp:70
virtual std::string get_name() const =0
For blocks, returns the block name. For components, returns it's canonical name.
uhd::dict< std::string, size_t > registers_t
Definition: blockdef.hpp:72
std::vector< port_t > ports_t
Definition: blockdef.hpp:53
virtual bool is_block() const =0
Returns true if this represents a NoC block.
#define UHD_API
Definition: config.h:87
Definition: build_info.hpp:12