USRP Hardware Driver and USRP Manual Version: 3.15.0.0-MacPorts-Release
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#ifndef INCLUDED_LIBUHD_RFNOC_BLOCKDEF_HPP
9#define INCLUDED_LIBUHD_RFNOC_BLOCKDEF_HPP
10
11#include <uhd/config.hpp>
13#include <stdint.h>
14#include <boost/enable_shared_from_this.hpp>
15#include <set>
16#include <vector>
17
18namespace uhd { namespace rfnoc {
19
22class UHD_RFNOC_API blockdef : public boost::enable_shared_from_this<blockdef>
23{
24public:
25 typedef boost::shared_ptr<blockdef> sptr;
26
28 //
29 // This is not the same as a uhd::rfnoc::stream_sig_t. This is used
30 // to describe which ports are defined in a block definition, and
31 // to describe what kind of connection is allowed for this port.
32 //
33 // All the keys listed in PORT_ARGS will be available in this class.
34 class port_t : public uhd::dict<std::string, std::string>
35 {
36 public:
39
41
43 bool is_variable(const std::string& key) const;
45 bool is_keyword(const std::string& key) const;
47 // keywords are not resolved.
48 bool is_valid() const;
50 std::string to_string() const;
51 };
52 typedef std::vector<port_t> ports_t;
53
55 class arg_t : public uhd::dict<std::string, std::string>
56 {
57 public:
59 static const device_addr_t ARG_ARGS;
60 static const std::set<std::string> VALID_TYPES;
61
63
65 bool is_valid() const;
67 std::string to_string() const;
68 };
69 typedef std::vector<arg_t> args_t;
70
72
79 static sptr make_from_noc_id(uint64_t noc_id);
80
82 virtual bool is_block() const = 0;
83
85 virtual bool is_component() const = 0;
86
88 virtual std::string get_key() const = 0;
89
91 virtual std::string get_name() const = 0;
92
94 virtual uint64_t noc_id() const = 0;
95
96 virtual ports_t get_input_ports() = 0;
98
100 virtual std::vector<size_t> get_all_port_numbers() = 0;
101
103 //
104 // \throws uhd::runtime_error if args are invalid.
105 virtual args_t get_args() = 0;
106
109
112};
113
114}} /* namespace uhd::rfnoc */
115
116#endif /* INCLUDED_LIBUHD_RFNOC_BLOCKDEF_HPP */
Definition: device_addr.hpp:39
Definition: dict.hpp:22
Describes arguments in a block definition.
Definition: blockdef.hpp:56
bool is_valid() const
Basic validity check of this argument definition.
static const std::set< std::string > VALID_TYPES
Definition: blockdef.hpp:60
static const device_addr_t ARG_ARGS
A list of args an argument can have.
Definition: blockdef.hpp:59
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')
bool is_valid() const
Basic validity check of this port definition. Variables and.
std::string to_string() const
Returns a string with the most important keys.
Definition: blockdef.hpp:23
boost::shared_ptr< blockdef > sptr
Definition: blockdef.hpp:25
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
virtual std::vector< size_t > get_all_port_numbers()=0
Returns the full list of port numbers used.
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.
std::vector< arg_t > args_t
Definition: blockdef.hpp:69
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:71
std::vector< port_t > ports_t
Definition: blockdef.hpp:52
virtual bool is_block() const =0
Returns true if this represents a NoC block.
#define UHD_RFNOC_API
Definition: config.hpp:117
Definition: build_info.hpp:13