USRP Hardware Driver and USRP Manual  Version: 4.9.0.0
UHD and USRP Manual
stream.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2011-2013 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>
11 #include <uhd/rfnoc/actions.hpp>
13 #include <uhd/types/ref_vector.hpp>
14 #include <uhd/types/stream_cmd.hpp>
16 #include <cstddef>
17 #include <memory>
18 #include <string>
19 #include <vector>
20 
21 namespace uhd {
22 struct async_metadata_t;
23 struct rx_metadata_t;
24 struct tx_metadata_t;
25 
51 {
53  stream_args_t(const std::string& cpu = "", const std::string& otw = "")
54  {
55  cpu_format = cpu;
56  otw_format = otw;
57  }
58 
75  std::string cpu_format;
76 
95  std::string otw_format;
96 
133 
161  std::vector<size_t> channels;
162 };
163 
170 {
171 public:
172  typedef std::shared_ptr<rx_streamer> sptr;
173 
174  virtual ~rx_streamer(void);
175 
177  virtual size_t get_num_channels(void) const = 0;
178 
180  virtual size_t get_max_num_samps(void) const = 0;
181 
184 
289  virtual size_t recv(const buffs_type& buffs,
290  const size_t nsamps_per_buff,
291  rx_metadata_t& metadata,
292  const double timeout = 0.1,
293  const bool one_packet = false) = 0;
294 
306  virtual void issue_stream_cmd(const stream_cmd_t& stream_cmd) = 0;
307 
313  virtual void post_input_action(
314  const std::shared_ptr<uhd::rfnoc::action_info>& action, const size_t port) = 0;
315 };
316 
323 {
324 public:
325  typedef std::shared_ptr<tx_streamer> sptr;
326 
327  virtual ~tx_streamer(void);
328 
330  virtual size_t get_num_channels(void) const = 0;
331 
333  virtual size_t get_max_num_samps(void) const = 0;
334 
337 
366  virtual size_t send(const buffs_type& buffs,
367  const size_t nsamps_per_buff,
368  const tx_metadata_t& metadata,
369  const double timeout = 0.1) = 0;
370 
377  virtual bool recv_async_msg(
378  async_metadata_t& async_metadata, double timeout = 0.1) = 0;
379 
385  virtual void post_output_action(
386  const std::shared_ptr<uhd::rfnoc::action_info>& action, const size_t port) = 0;
387 };
388 
389 } // namespace uhd
uhd::rx_streamer
Definition: stream.hpp:169
device_addr.hpp
uhd::tx_streamer
Definition: stream.hpp:322
config.hpp
actions.hpp
uhd::tx_streamer::buffs_type
ref_vector< const void * > buffs_type
Typedef for a pointer to a single, or a collection of send buffers.
Definition: stream.hpp:336
uhd::rx_streamer::sptr
std::shared_ptr< rx_streamer > sptr
Definition: stream.hpp:172
uhd::tx_streamer::sptr
std::shared_ptr< tx_streamer > sptr
Definition: stream.hpp:325
UHD_API
#define UHD_API
Definition: config.h:87
uhd::stream_args_t::channels
std::vector< size_t > channels
Definition: stream.hpp:161
noncopyable.hpp
uhd::stream_args_t::stream_args_t
stream_args_t(const std::string &cpu="", const std::string &otw="")
Convenience constructor for streamer args.
Definition: stream.hpp:53
stream_cmd.hpp
uhd::device_addr_t
Definition: device_addr.hpp:38
uhd::stream_args_t::args
device_addr_t args
Definition: stream.hpp:132
uhd::async_metadata_t
Definition: metadata.hpp:202
uhd::stream_args_t::cpu_format
std::string cpu_format
Definition: stream.hpp:75
ref_vector.hpp
uhd::stream_args_t::otw_format
std::string otw_format
Definition: stream.hpp:95
uhd
Definition: build_info.hpp:12
uhd::rx_streamer::buffs_type
ref_vector< void * > buffs_type
Typedef for a pointer to a single, or a collection of recv buffers.
Definition: stream.hpp:183
uhd::stream_cmd_t
Definition: stream_cmd.hpp:39
uhd::stream_args_t
Definition: stream.hpp:50
uhd::ref_vector
Definition: ref_vector.hpp:21
uhd::noncopyable
boost::noncopyable noncopyable
Definition: noncopyable.hpp:45
uhd::rx_metadata_t
Definition: metadata.hpp:22
uhd::tx_metadata_t
Definition: metadata.hpp:162