USRP Hardware Driver and USRP Manual Version: 4.1.0.1
UHD and USRP Manual
uhd::rfnoc::replay_block_control Class Referenceabstract

#include <uhd/rfnoc/replay_block_control.hpp>

Inheritance diagram for uhd::rfnoc::replay_block_control:
uhd::rfnoc::noc_block_base uhd::rfnoc::node_t uhd::rfnoc::register_iface_holder

Public Member Functions

virtual void record (const uint64_t offset, const uint64_t size, const size_t port=0)=0
 
virtual void record_restart (const size_t port=0)=0
 
virtual void play (const uint64_t offset, const uint64_t size, const size_t port=0, const uhd::time_spec_t time_spec=uhd::time_spec_t(0.0), const bool repeat=false)=0
 
virtual void stop (const size_t port=0)=0
 
virtual uint64_t get_mem_size () const =0
 
virtual uint64_t get_word_size () const =0
 
virtual uint64_t get_record_offset (const size_t port=0) const =0
 
virtual uint64_t get_record_size (const size_t port=0) const =0
 
virtual uint64_t get_record_fullness (const size_t port=0)=0
 
virtual io_type_t get_record_type (const size_t port=0) const =0
 
virtual size_t get_record_item_size (const size_t port=0) const =0
 
virtual uint64_t get_play_offset (const size_t port=0) const =0
 
virtual uint64_t get_play_size (const size_t port=0) const =0
 
virtual uint32_t get_max_items_per_packet (const size_t port=0) const =0
 
virtual uint32_t get_max_packet_size (const size_t port=0) const =0
 
virtual io_type_t get_play_type (const size_t port=0) const =0
 
virtual size_t get_play_item_size (const size_t port=0) const =0
 
virtual void set_record_type (const io_type_t type, const size_t port=0)=0
 
virtual void config_play (const uint64_t offset, const uint64_t size, const size_t port=0)=0
 
virtual void set_play_type (const io_type_t type, const size_t port=0)=0
 
virtual void set_max_items_per_packet (const uint32_t ipp, const size_t port=0)=0
 
virtual void set_max_packet_size (const uint32_t size, const size_t port=0)=0
 
virtual void issue_stream_cmd (const uhd::stream_cmd_t &stream_cmd, const size_t port=0)=0
 
- Public Member Functions inherited from uhd::rfnoc::noc_block_base
 ~noc_block_base () override
 
std::string get_unique_id () const override
 Unique ID for an RFNoC block is its block ID. More...
 
size_t get_num_input_ports () const override
 Number of input ports. Note: This gets passed into this block from the. More...
 
size_t get_num_output_ports () const override
 Number of output ports. Note: This gets passed outto this block from the. More...
 
noc_id_t get_noc_id () const
 
const block_id_tget_block_id () const
 
double get_tick_rate () const
 
size_t get_mtu (const res_source_info &edge)
 
uhd::device_addr_t get_block_args () const
 
uhd::property_tree::sptrget_tree () const
 Return a reference to this block's subtree. More...
 
uhd::property_tree::sptrget_tree ()
 Return a reference to this block's subtree (non-const version) More...
 
- Public Member Functions inherited from uhd::rfnoc::node_t
 node_t ()
 
virtual ~node_t ()
 
virtual std::string get_unique_id () const
 Return a unique identifier string for this node. In every RFNoC graph,. More...
 
virtual size_t get_num_input_ports () const =0
 
virtual size_t get_num_output_ports () const =0
 
std::vector< std::string > get_property_ids () const
 
template<typename prop_data_t >
void set_property (const std::string &id, const prop_data_t &val, const size_t instance=0)
 
void set_properties (const uhd::device_addr_t &props, const size_t instance=0)
 
template<typename prop_data_t >
const prop_data_t & get_property (const std::string &id, const size_t instance=0)
 
virtual void set_command_time (uhd::time_spec_t time, const size_t instance)
 
virtual uhd::time_spec_t get_command_time (const size_t instance) const
 
virtual void clear_command_time (const size_t instance)
 
- Public Member Functions inherited from uhd::rfnoc::register_iface_holder
 register_iface_holder (register_iface::sptr reg)
 
virtual ~register_iface_holder ()=default
 
register_ifaceregs ()
 

Static Public Attributes

static const uint16_t MINOR_COMPAT
 
static const uint16_t MAJOR_COMPAT
 
static const uint32_t REPLAY_ADDR_W
 
static const uint32_t REPLAY_BLOCK_OFFSET
 
static const uint32_t REG_COMPAT_ADDR
 
static const uint32_t REG_MEM_SIZE_ADDR
 
static const uint32_t REG_REC_RESTART_ADDR
 
static const uint32_t REG_REC_BASE_ADDR_LO_ADDR
 
static const uint32_t REG_REC_BASE_ADDR_HI_ADDR
 
static const uint32_t REG_REC_BUFFER_SIZE_LO_ADDR
 
static const uint32_t REG_REC_BUFFER_SIZE_HI_ADDR
 
static const uint32_t REG_REC_FULLNESS_LO_ADDR
 
static const uint32_t REG_REC_FULLNESS_HI_ADDR
 
static const uint32_t REG_PLAY_BASE_ADDR_LO_ADDR
 
static const uint32_t REG_PLAY_BASE_ADDR_HI_ADDR
 
static const uint32_t REG_PLAY_BUFFER_SIZE_LO_ADDR
 
static const uint32_t REG_PLAY_BUFFER_SIZE_HI_ADDR
 
static const uint32_t REG_PLAY_CMD_NUM_WORDS_LO_ADDR
 
static const uint32_t REG_PLAY_CMD_NUM_WORDS_HI_ADDR
 
static const uint32_t REG_PLAY_CMD_TIME_LO_ADDR
 
static const uint32_t REG_PLAY_CMD_TIME_HI_ADDR
 
static const uint32_t REG_PLAY_CMD_ADDR
 
static const uint32_t REG_PLAY_WORDS_PER_PKT_ADDR
 
static const uint32_t REG_PLAY_ITEM_SIZE_ADDR
 
static const uint32_t PLAY_CMD_STOP
 
static const uint32_t PLAY_CMD_FINITE
 
static const uint32_t PLAY_CMD_CONTINUOUS
 
- Static Public Attributes inherited from uhd::rfnoc::node_t
static const size_t ANY_PORT = size_t(~0)
 

Additional Inherited Members

- Public Types inherited from uhd::rfnoc::noc_block_base
using sptr = std::shared_ptr< noc_block_base >
 
using make_args_ptr = std::unique_ptr< make_args_t >
 Opaque pointer to the constructor arguments. More...
 
- Public Types inherited from uhd::rfnoc::node_t
enum class  forwarding_policy_t {
  ONE_TO_ONE , ONE_TO_FAN , ONE_TO_ALL_IN , ONE_TO_ALL_OUT ,
  ONE_TO_ALL , DROP , USE_MAP
}
 Types of property/action forwarding for those not defined by the block itself. More...
 
using resolver_fn_t = std::function< void(void)>
 
using resolve_callback_t = std::function< void(void)>
 
using action_handler_t = std::function< void(const res_source_info &, action_info::sptr)>
 
using forwarding_map_t = std::unordered_map< res_source_info, std::vector< res_source_info > >
 
- Protected Types inherited from uhd::rfnoc::node_t
using prop_ptrs_t = std::unordered_set< property_base_t * >
 
- Protected Member Functions inherited from uhd::rfnoc::noc_block_base
 noc_block_base (make_args_ptr make_args)
 
void set_num_input_ports (const size_t num_ports)
 Update number of input ports. More...
 
void set_num_output_ports (const size_t num_ports)
 Update number of output ports. More...
 
void set_tick_rate (const double tick_rate)
 
void set_mtu_forwarding_policy (const forwarding_policy_t policy)
 
void set_mtu (const res_source_info &edge, const size_t new_mtu)
 
property_base_tget_mtu_prop_ref (const res_source_info &edge)
 
std::shared_ptr< mb_controllerget_mb_controller ()
 
virtual void deinit ()
 
- Protected Member Functions inherited from uhd::rfnoc::node_t
void register_property (property_base_t *prop, resolve_callback_t &&clean_callback=nullptr)
 
void add_property_resolver (prop_ptrs_t &&inputs, prop_ptrs_t &&outputs, resolver_fn_t &&resolver_fn)
 
void set_prop_forwarding_policy (forwarding_policy_t policy, const std::string &prop_id="")
 
void set_prop_forwarding_map (const forwarding_map_t &map)
 
template<typename prop_data_t >
void set_property (const std::string &id, const prop_data_t &val, const res_source_info &src_info)
 
template<typename prop_data_t >
const prop_data_t & get_property (const std::string &id, const res_source_info &src_info)
 
void register_action_handler (const std::string &id, action_handler_t &&handler)
 
void set_action_forwarding_policy (forwarding_policy_t policy, const std::string &action_key="")
 
void set_action_forwarding_map (const forwarding_map_t &map)
 
void post_action (const res_source_info &edge_info, action_info::sptr action)
 
virtual bool check_topology (const std::vector< size_t > &connected_inputs, const std::vector< size_t > &connected_outputs)
 
virtual void shutdown ()
 
- Protected Member Functions inherited from uhd::rfnoc::register_iface_holder
void update_reg_iface (register_iface::sptr new_iface=nullptr)
 
- Static Protected Attributes inherited from uhd::rfnoc::node_t
static dirtifier_t ALWAYS_DIRTY
 A dirtifyer object, useful for properties that always need updating. More...
 

Detailed Description

Replay Block Control CLass

The Replay block records data to memory and plays back data from memory.

It is the responsibility of the user to manage the memory. Care must be taken to avoid unintentional overlaps in the memory across blocks and ports. Each port of the Replay block has access to the full memory space. This allows recording data on any input port of any Replay block and playback on any output port of any Replay block. The section of memory used by a record or play operation is controlled by setting the offset and size.

For both record and playback, the offset and the size must be aligned to the memory's word size. For playback, the size must also be aligned to the size of an item. An item is a single unit of data as defined by the data type of a port. For record, the data type is automatically determined by the connection to the upstream block by using the "type" edge property for the corresponding input port. For playback, this is automatically determined by the connection to the downstream block by using the "type" edge property for the corresponding output port. These can be explicitly set by the user, if necessary. It is the user's responsibility to manage the types of the individual record and the playback ports. Methods to get the word size and item sizes are provided to help calculate proper alignment.

One key configuration of playback is the packet size. Larger packet sizes provide for better throughput while smaller packet sizes provide for lower latency. By default, the "mtu" edge property of the output port is used to define the maximum packet size to achieve the best throughput to the downstream block without exceeding the supported packet size. The maximum packet size can be explicitly set in terms of bytes or number of items to allow users to tune the performance to suit their application.

Member Function Documentation

◆ config_play()

virtual void uhd::rfnoc::replay_block_control::config_play ( const uint64_t  offset,
const uint64_t  size,
const size_t  port = 0 
)
pure virtual

Configure the offsets and size of the playback buffer region

Specifies a buffer area in the memory for playback. In order to begin playback on this region, a stream command must be issued.

Parameters
offsetMemory offset of the data to be played. This value must be aligned to the size of the word in memory. Use get_word_size() to get the memory word size.
sizeSize of data to play back. This value must be aligned to the size of the memory word and item size. Use get_word_size() to get the memory word size and get_output_item_size() to get the item size.
portWhich output port of the replay block to use

◆ get_max_items_per_packet()

virtual uint32_t uhd::rfnoc::replay_block_control::get_max_items_per_packet ( const size_t  port = 0) const
pure virtual

Get the maximum number of items in a packet

Parameters
portWhich output port of the replay block to use
Returns
the maximum number of items in a packet

◆ get_max_packet_size()

virtual uint32_t uhd::rfnoc::replay_block_control::get_max_packet_size ( const size_t  port = 0) const
pure virtual

Get the maximum size of a packet

Returns the maximum size of a packet, inclusive of headers and payload.

Parameters
portWhich output port of the replay block to use
Returns
the maximum size of a packet

◆ get_mem_size()

virtual uint64_t uhd::rfnoc::replay_block_control::get_mem_size ( ) const
pure virtual

Get the size of the memory

Returns the size of the shared memory space. Any record or playback buffers must be configured in this memory space.

Returns
the size of the shared Replay memory

◆ get_play_item_size()

virtual size_t uhd::rfnoc::replay_block_control::get_play_item_size ( const size_t  port = 0) const
pure virtual

Get the current play item size

Parameters
portWhich output port of the replay block to use
Returns
the size of an item in the current play buffer

◆ get_play_offset()

virtual uint64_t uhd::rfnoc::replay_block_control::get_play_offset ( const size_t  port = 0) const
pure virtual

Get the offset of the current playback buffer

Parameters
portWhich output port of the replay block to use
Returns
the offset of the current playback buffer

◆ get_play_size()

virtual uint64_t uhd::rfnoc::replay_block_control::get_play_size ( const size_t  port = 0) const
pure virtual

Get the current size of the playback space

Parameters
portWhich output port of the replay block to use
Returns
size of the playback buffer

◆ get_play_type()

virtual io_type_t uhd::rfnoc::replay_block_control::get_play_type ( const size_t  port = 0) const
pure virtual

Get the current play data type

Parameters
portWhich output port of the replay block to use
Returns
the current play data type

◆ get_record_fullness()

virtual uint64_t uhd::rfnoc::replay_block_control::get_record_fullness ( const size_t  port = 0)
pure virtual

Get the fullness of the current record buffer

Returns the number of bytes that have been recorded in the record buffer. A record restart will reset this number back to 0.

Parameters
portWhich input port of the replay block to use
Returns
fullness of the record buffer

◆ get_record_item_size()

virtual size_t uhd::rfnoc::replay_block_control::get_record_item_size ( const size_t  port = 0) const
pure virtual

Get the current record item size

Parameters
portWhich input port of the replay block to use
Returns
the size of an item in the current record buffer

◆ get_record_offset()

virtual uint64_t uhd::rfnoc::replay_block_control::get_record_offset ( const size_t  port = 0) const
pure virtual

Get the starting offset of the current record buffer

Parameters
portWhich input port of the replay block to use
Returns
starting offset of the record buffer

◆ get_record_size()

virtual uint64_t uhd::rfnoc::replay_block_control::get_record_size ( const size_t  port = 0) const
pure virtual

Get the current size of the record space

Parameters
portWhich input port of the replay block to use
Returns
size of the record buffer

◆ get_record_type()

virtual io_type_t uhd::rfnoc::replay_block_control::get_record_type ( const size_t  port = 0) const
pure virtual

Get the current record data type

Parameters
portWhich input port of the replay block to use
Returns
the current record data type

◆ get_word_size()

virtual uint64_t uhd::rfnoc::replay_block_control::get_word_size ( ) const
pure virtual

Get the size of a memory word

Returns
the size of a memory word

◆ issue_stream_cmd()

virtual void uhd::rfnoc::replay_block_control::issue_stream_cmd ( const uhd::stream_cmd_t stream_cmd,
const size_t  port = 0 
)
pure virtual

Issue a stream command to the replay block

Issue stream commands to start or stop playback from the configured playback buffer. Supports STREAM_MODE_START_CONTINUOUS to start continuous repeating playback, STREAM_MODE_START_NUM_SAMPS_AND_DONE to play the given number of samples once, and STREAM_MODE_STOP_CONTINUOUS to stop all playback immediately. If a time_spec is supplied, it is placed in the header of the first packet produced for that command. Commands are queued and executed in order. A STREAM_MODE_STOP_CONTINUOUS command will halt all playback and purge all commands in the queue for a given output port.

Parameters
stream_cmdThe command to execute
portWhich output port of the replay block to use

◆ play()

virtual void uhd::rfnoc::replay_block_control::play ( const uint64_t  offset,
const uint64_t  size,
const size_t  port = 0,
const uhd::time_spec_t  time_spec = uhd::time_spec_t(0.0),
const bool  repeat = false 
)
pure virtual

Play

Play back data. The offset and size define what data is played back on an output port. The data can be played once or repeated continuously until a stop command is issued. If a time_spec is supplied, it will be placed in the header of the first packet. Typically, this is used to tell a downstream Radio block when to start transmitting the data. If the data type on the output port is not defined, this function will throw an error.

Parameters
offsetMemory offset of the data to be played. This value must be aligned to the size of the word in memory. Use get_word_size() to get the memory word size.
sizeSize of data to play back. This value must be aligned to the size of the memory word and item size. Use get_word_size() to get the memory word size and get_output_item_size() to get the item size.
portWhich output port of the replay block to use
time_specSet the time for the first item. Any non-zero value is used to set the time in the header of the first packet. Most commonly, this is used to set the start time of a transmission.
repeatDetermines whether the data should be played repeatedly or just once. If set to true, stop() must be called to stop the play back.

◆ record()

virtual void uhd::rfnoc::replay_block_control::record ( const uint64_t  offset,
const uint64_t  size,
const size_t  port = 0 
)
pure virtual

Record

Begin recording. The offset sets the starting location in memory and the size limits the length of the recording. The flow of data is controlled by upstream RFNoC blocks.

Parameters
offsetMemory offset where to start recording the data. This value must be aligned to the memory word size. Use get_word_size() to get the size of the memory word.
sizeSize limit, in bytes. This value must be aligned to the memory word size and the item size. Use get_word_size() to get the size of the memory word and get_item_size() to get the item size. A value of 0 means to use all available space.
portWhich input port of the replay block to use

◆ record_restart()

virtual void uhd::rfnoc::replay_block_control::record_restart ( const size_t  port = 0)
pure virtual

Restarts recording from the record offset

Parameters
portWhich input port of the replay block to use

◆ set_max_items_per_packet()

virtual void uhd::rfnoc::replay_block_control::set_max_items_per_packet ( const uint32_t  ipp,
const size_t  port = 0 
)
pure virtual

Set the maximum number of items in a packet

Sets the maximum number of items that can be in a packet's payload. An actual packet may be smaller in order to coerce to mtu values, or to align with memory word size.

Parameters
ippNumber of items per packet
portWhich output port of the replay block to use

◆ set_max_packet_size()

virtual void uhd::rfnoc::replay_block_control::set_max_packet_size ( const uint32_t  size,
const size_t  port = 0 
)
pure virtual

Set the maximum size of a packet

Sets the maximum packet size, inclusive of headers and payload.

Parameters
sizeThe size of the packet
portWhich output port of the replay block to use

◆ set_play_type()

virtual void uhd::rfnoc::replay_block_control::set_play_type ( const io_type_t  type,
const size_t  port = 0 
)
pure virtual

Explicitly set the current play data type

Sets the data type for items in the current play buffer for the given output port.

Parameters
typeThe data type
portWhich output port of the replay block to use

◆ set_record_type()

virtual void uhd::rfnoc::replay_block_control::set_record_type ( const io_type_t  type,
const size_t  port = 0 
)
pure virtual

Explicitly set the current record data type

Sets the data type for items in the current record buffer for the given input port.

Parameters
typeThe data type
portWhich input port of the replay block to use

◆ stop()

virtual void uhd::rfnoc::replay_block_control::stop ( const size_t  port = 0)
pure virtual

Stops playback

Halts any currently executing play commands and cancels any other play commands that are waiting to be executed for that output port.

Parameters
portWhich output port of the replay block to use

Member Data Documentation

◆ MAJOR_COMPAT

const uint16_t uhd::rfnoc::replay_block_control::MAJOR_COMPAT
static

◆ MINOR_COMPAT

const uint16_t uhd::rfnoc::replay_block_control::MINOR_COMPAT
static

◆ PLAY_CMD_CONTINUOUS

const uint32_t uhd::rfnoc::replay_block_control::PLAY_CMD_CONTINUOUS
static

◆ PLAY_CMD_FINITE

const uint32_t uhd::rfnoc::replay_block_control::PLAY_CMD_FINITE
static

◆ PLAY_CMD_STOP

const uint32_t uhd::rfnoc::replay_block_control::PLAY_CMD_STOP
static

◆ REG_COMPAT_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_COMPAT_ADDR
static

◆ REG_MEM_SIZE_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_MEM_SIZE_ADDR
static

◆ REG_PLAY_BASE_ADDR_HI_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_PLAY_BASE_ADDR_HI_ADDR
static

◆ REG_PLAY_BASE_ADDR_LO_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_PLAY_BASE_ADDR_LO_ADDR
static

◆ REG_PLAY_BUFFER_SIZE_HI_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_PLAY_BUFFER_SIZE_HI_ADDR
static

◆ REG_PLAY_BUFFER_SIZE_LO_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_PLAY_BUFFER_SIZE_LO_ADDR
static

◆ REG_PLAY_CMD_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_PLAY_CMD_ADDR
static

◆ REG_PLAY_CMD_NUM_WORDS_HI_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_PLAY_CMD_NUM_WORDS_HI_ADDR
static

◆ REG_PLAY_CMD_NUM_WORDS_LO_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_PLAY_CMD_NUM_WORDS_LO_ADDR
static

◆ REG_PLAY_CMD_TIME_HI_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_PLAY_CMD_TIME_HI_ADDR
static

◆ REG_PLAY_CMD_TIME_LO_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_PLAY_CMD_TIME_LO_ADDR
static

◆ REG_PLAY_ITEM_SIZE_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_PLAY_ITEM_SIZE_ADDR
static

◆ REG_PLAY_WORDS_PER_PKT_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_PLAY_WORDS_PER_PKT_ADDR
static

◆ REG_REC_BASE_ADDR_HI_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_REC_BASE_ADDR_HI_ADDR
static

◆ REG_REC_BASE_ADDR_LO_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_REC_BASE_ADDR_LO_ADDR
static

◆ REG_REC_BUFFER_SIZE_HI_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_REC_BUFFER_SIZE_HI_ADDR
static

◆ REG_REC_BUFFER_SIZE_LO_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_REC_BUFFER_SIZE_LO_ADDR
static

◆ REG_REC_FULLNESS_HI_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_REC_FULLNESS_HI_ADDR
static

◆ REG_REC_FULLNESS_LO_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_REC_FULLNESS_LO_ADDR
static

◆ REG_REC_RESTART_ADDR

const uint32_t uhd::rfnoc::replay_block_control::REG_REC_RESTART_ADDR
static

◆ REPLAY_ADDR_W

const uint32_t uhd::rfnoc::replay_block_control::REPLAY_ADDR_W
static

◆ REPLAY_BLOCK_OFFSET

const uint32_t uhd::rfnoc::replay_block_control::REPLAY_BLOCK_OFFSET
static

The documentation for this class was generated from the following file: