|
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 uint64_t | get_record_position (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 bool | get_record_async_metadata (uhd::rx_metadata_t &metadata, const double timeout=0.1)=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 uint64_t | get_play_position (const size_t port=0)=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 bool | get_play_async_metadata (uhd::async_metadata_t &metadata, const double timeout=0.1)=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 |
|
| ~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_t & | get_block_id () const |
|
double | get_tick_rate () const |
|
size_t | get_mtu (const res_source_info &edge) |
|
size_t | get_chdr_hdr_len (const bool account_for_ts=true) const |
|
size_t | get_max_payload_size (const res_source_info &edge, const bool account_for_ts=true) |
|
uhd::device_addr_t | get_block_args () const |
|
uhd::property_tree::sptr & | get_tree () const |
| Return a reference to this block's subtree. More...
|
|
uhd::property_tree::sptr & | get_tree () |
| Return a reference to this block's subtree (non-const version) More...
|
|
std::shared_ptr< mb_controller > | get_mb_controller () |
|
| 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) |
|
| register_iface_holder (register_iface::sptr reg) |
|
virtual | ~register_iface_holder ()=default |
|
register_iface & | regs () |
|
|
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...
|
|
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 > > |
|
using | prop_ptrs_t = std::unordered_set< property_base_t * > |
|
| 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_t * | get_mtu_prop_ref (const res_source_info &edge) |
|
virtual void | deinit () |
|
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 () |
|
void | update_reg_iface (register_iface::sptr new_iface=nullptr) |
|
static dirtifier_t | ALWAYS_DIRTY |
| A dirtifyer object, useful for properties that always need updating. More...
|
|
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.
Block Properties
User Properties:
Key | Description |
record_offset | The base address for recordings (data will be written here). Will be set by record(). |
record_size | Size of the record buffer. Will be set by record(). |
play_offset | Base address for playback (streaming will start from here). Set by play() or config_play(). |
play_size | Size of the playback buffer. Set by play() or config_play(). |
packet_size | Size of outgoing packets (in bytes). Gets set by set_max_items_per_packet(). |
Edge properties:
Recording Data
Before streaming data to the replay block, it must be configured to record by calling record(), which will also configure the size of the record buffer for the indicated input port. After calling this method, the block will accept incoming data until its record buffer is full (use the get_record_fullness() method to query the fullness). Unlike the radio, the replay block does not care about end-of-burst flags, and will not report underruns if subsequent packets are not streamed to this block back-to-back.
Once the record buffer is full, the block will no longer accept incoming data and will back-pressure. If, for example, the radio block is connected to the replay block, the radio could overrun in this scenario. By calling record() again, the write-pointer of the block is reset, and it will accept new data. To reset the write-pointer and buffer size to the same values as before, it is sufficient to call record_restart().
Playing back Data
To playback data from a given port, there are two options with basically the same functionality: Either call config_play() to configure the playback region on memory, and then call issue_stream_cmd() to start streaming.
A shorthand version of this is to call play(), which is equivalent to calling config_play() and issue_stream_cmd() together.
In either case, the replay block will start streaming the requested number of samples, or until it is stopped. If a specific number of samples is requested, then it will tag the last outgoing packet with an end-of-burst flag. If more samples were requested than stored in the playback buffer, it will wrap around.
To stop a continuous playback, either call stop(), or issue a stream command with uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS.
Action Handling
If this block receives TX or RX actions (uhd::rfnoc::tx_event_action_info o uhd::rfnoc::rx_event_action_info), it will store them in a circular buffer. The API calls get_record_async_metadata() and get_play_async_metadata() can be used to read them back out asynchronously. To avoid the block controller continously expanding in memory, the total number of messages that will be stored is limited. If this block receives more event info objects than it can store before get_record_async_metadata() or get_play_async_metadata() is called, the oldest message will be dropped.