USRP Hardware Driver and USRP Manual  Version: 004.000.000.HEAD-0-g8773fb2c
UHD and USRP Manual
source_node_ctrl.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_LIBUHD_SOURCE_NODE_CTRL_BASE_HPP
19 #define INCLUDED_LIBUHD_SOURCE_NODE_CTRL_BASE_HPP
20 
22 #include <uhd/rfnoc/constants.hpp>
23 #include <uhd/types/stream_cmd.hpp>
24 #include <boost/thread.hpp>
25 
26 namespace uhd {
27  namespace rfnoc {
28 
34 class source_node_ctrl : virtual public node_ctrl_base
35 {
36 public:
37  /***********************************************************************
38  * Types
39  **********************************************************************/
40  typedef boost::shared_ptr<source_node_ctrl> sptr;
41  typedef std::map< size_t, boost::weak_ptr<source_node_ctrl> > node_map_t;
42  typedef std::pair< size_t, boost::weak_ptr<source_node_ctrl> > node_map_pair_t;
43 
44  /***********************************************************************
45  * Source block controls
46  **********************************************************************/
51  virtual void issue_stream_cmd(
52  const uhd::stream_cmd_t &stream_cmd,
53  const size_t chan=0
54  ) = 0;
55 
70  size_t connect_downstream(
71  node_ctrl_base::sptr downstream_node,
72  size_t port=ANY_PORT,
74  );
75 
82  virtual void set_rx_streamer(bool active, const size_t port);
83 
84 protected:
85 
93  std::map<size_t, bool> _rx_streamer_active;
94 
105  virtual size_t _request_output_port(
106  const size_t suggested_port,
107  const uhd::device_addr_t &args
108  ) const;
109 
110 
111 private:
114  boost::mutex _output_mutex;
115 
126  void _register_downstream_node(
127  node_ctrl_base::sptr downstream_node,
128  size_t port
129  );
130 
131 }; /* class source_node_ctrl */
132 
133 }} /* namespace uhd::rfnoc */
134 
135 #endif /* INCLUDED_LIBUHD_SOURCE_NODE_CTRL_BASE_HPP */
136 // vim: sw=4 et:
Definition: stream_cmd.hpp:46
std::pair< size_t, boost::weak_ptr< source_node_ctrl > > node_map_pair_t
Definition: source_node_ctrl.hpp:42
Definition: source_node_ctrl.hpp:34
boost::shared_ptr< source_node_ctrl > sptr
Definition: source_node_ctrl.hpp:40
virtual void issue_stream_cmd(const uhd::stream_cmd_t &stream_cmd, const size_t chan=0)=0
Definition: build_info.hpp:25
boost::shared_ptr< node_ctrl_base > sptr
Definition: node_ctrl_base.hpp:46
#define UHD_RFNOC_API
Definition: config.hpp:103
virtual size_t _request_output_port(const size_t suggested_port, const uhd::device_addr_t &args) const
size_t connect_downstream(node_ctrl_base::sptr downstream_node, size_t port=ANY_PORT, const uhd::device_addr_t &args=uhd::device_addr_t())
virtual void set_rx_streamer(bool active, const size_t port)
std::map< size_t, bool > _rx_streamer_active
Definition: source_node_ctrl.hpp:93
std::map< size_t, boost::weak_ptr< source_node_ctrl > > node_map_t
Definition: source_node_ctrl.hpp:41
Definition: device_addr.hpp:47
Definition: node_ctrl_base.hpp:40