From bed75f0ccbb6da139283a07c1442293bef95f26a Mon Sep 17 00:00:00 2001 From: Wade Fife Date: Mon, 16 Jul 2018 07:39:30 -0500 Subject: RFNoC: Add Replay API and example --- host/include/uhd/rfnoc/CMakeLists.txt | 1 + host/include/uhd/rfnoc/blocks/replay.xml | 64 ++++++++++++++++++++ host/include/uhd/rfnoc/blocks/replay_x2.xml | 72 +++++++++++++++++++++++ host/include/uhd/rfnoc/blocks/replay_x4.xml | 87 ++++++++++++++++++++++++++++ host/include/uhd/rfnoc/replay_block_ctrl.hpp | 67 +++++++++++++++++++++ 5 files changed, 291 insertions(+) create mode 100644 host/include/uhd/rfnoc/blocks/replay.xml create mode 100644 host/include/uhd/rfnoc/blocks/replay_x2.xml create mode 100644 host/include/uhd/rfnoc/blocks/replay_x4.xml create mode 100644 host/include/uhd/rfnoc/replay_block_ctrl.hpp (limited to 'host/include') diff --git a/host/include/uhd/rfnoc/CMakeLists.txt b/host/include/uhd/rfnoc/CMakeLists.txt index 44d0490f4..137ec3024 100644 --- a/host/include/uhd/rfnoc/CMakeLists.txt +++ b/host/include/uhd/rfnoc/CMakeLists.txt @@ -31,6 +31,7 @@ IF(ENABLE_RFNOC) fir_block_ctrl.hpp null_block_ctrl.hpp radio_ctrl.hpp + replay_block_ctrl.hpp siggen_block_ctrl.hpp window_block_ctrl.hpp DESTINATION ${INCLUDE_DIR}/uhd/rfnoc diff --git a/host/include/uhd/rfnoc/blocks/replay.xml b/host/include/uhd/rfnoc/blocks/replay.xml new file mode 100644 index 000000000..3ffc5c01a --- /dev/null +++ b/host/include/uhd/rfnoc/blocks/replay.xml @@ -0,0 +1,64 @@ + + + Replay + Replay + Replay + + + 4E91A00000000000 + + + + + REC_BASE_ADDR +
128
+
+ + REC_BUFFER_SIZE +
129
+
+ + REC_RESTART +
130
+
+ + REC_FULLNESS +
131
+
+ + PLAY_BASE_ADDR +
132
+
+ + PLAY_BUFFER_SIZE +
133
+
+ + RX_CTRL_COMMAND +
152
+
+ + RX_CTRL_HALT +
155
+
+ + RX_CTRL_MAXLEN +
156
+
+
+ + + + + + + in0 + sc16 + + + out0 + sc16 + + +
+ diff --git a/host/include/uhd/rfnoc/blocks/replay_x2.xml b/host/include/uhd/rfnoc/blocks/replay_x2.xml new file mode 100644 index 000000000..a267a85de --- /dev/null +++ b/host/include/uhd/rfnoc/blocks/replay_x2.xml @@ -0,0 +1,72 @@ + + + Replay + Replay + Replay + + + 4E91A00000000002 + + + + + REC_BASE_ADDR +
128
+
+ + REC_BUFFER_SIZE +
129
+
+ + REC_RESTART +
130
+
+ + REC_FULLNESS +
131
+
+ + PLAY_BASE_ADDR +
132
+
+ + PLAY_BUFFER_SIZE +
133
+
+ + RX_CTRL_COMMAND +
152
+
+ + RX_CTRL_HALT +
155
+
+ + RX_CTRL_MAXLEN +
156
+
+
+ + + + + + + in0 + sc16 + + + in1 + sc16 + + + out0 + sc16 + + + out1 + sc16 + + +
+ diff --git a/host/include/uhd/rfnoc/blocks/replay_x4.xml b/host/include/uhd/rfnoc/blocks/replay_x4.xml new file mode 100644 index 000000000..e12b5f0df --- /dev/null +++ b/host/include/uhd/rfnoc/blocks/replay_x4.xml @@ -0,0 +1,87 @@ + + + Replay + Replay + Replay + + + 4E91A00000000004 + + + + + REC_BASE_ADDR +
128
+
+ + REC_BUFFER_SIZE +
129
+
+ + REC_RESTART +
130
+
+ + REC_FULLNESS +
131
+
+ + PLAY_BASE_ADDR +
132
+
+ + PLAY_BUFFER_SIZE +
133
+
+ + RX_CTRL_COMMAND +
152
+
+ + RX_CTRL_HALT +
155
+
+ + RX_CTRL_MAXLEN +
156
+
+
+ + + + + + + in0 + sc16 + + + in1 + sc16 + + + in2 + sc16 + + + in3 + sc16 + + + out0 + sc16 + + + out1 + sc16 + + + out2 + sc16 + + + out3 + sc16 + +
+ diff --git a/host/include/uhd/rfnoc/replay_block_ctrl.hpp b/host/include/uhd/rfnoc/replay_block_ctrl.hpp new file mode 100644 index 000000000..bd5c47739 --- /dev/null +++ b/host/include/uhd/rfnoc/replay_block_ctrl.hpp @@ -0,0 +1,67 @@ +// +// Copyright 2018 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_LIBUHD_RFNOC_REPLAY_BLOCK_HPP +#define INCLUDED_LIBUHD_RFNOC_REPLAY_BLOCK_HPP + +#include +#include + +namespace uhd { + namespace rfnoc { + +/*! \brief Replay block controller + * + * The replay block has the following features: + * - One input and one output + * - The ability to record and playback data + * - Configurable base addresses and buffer sizes + * - Independent record and playback controls + * - Radio-like playback interface + * - The storage for the replay data can be any + * memory, usually an off-chip DRAM. + * + */ +class UHD_RFNOC_API replay_block_ctrl : public source_block_ctrl_base, public sink_block_ctrl_base +{ +public: + UHD_RFNOC_BLOCK_OBJECT(replay_block_ctrl) + + //! Configure the base address and size of the record buffer region (in bytes). + virtual void config_record(const uint32_t base_addr, const uint32_t size, const size_t chan) = 0; + + //! Configure the base address and size of the playback buffer region (in bytes). + virtual void config_play(const uint32_t base_addr, const uint32_t size, const size_t chan) = 0; + + //! Restarts recording at the beginning of the record buffer + virtual void record_restart(const size_t chan) = 0; + + //! Returns the base address of the record buffer (in bytes). + virtual uint32_t get_record_addr(const size_t chan) = 0; + + //! Returns the base address of the playback buffer (in bytes). + virtual uint32_t get_play_addr(const size_t chan) = 0; + + //! Returns the size of the record buffer (in bytes). + virtual uint32_t get_record_size(const size_t chan) = 0; + + //! Returns the current fullness of the record buffer (in bytes). + virtual uint32_t get_record_fullness(const size_t chan) = 0; + + //! Returns the size of the playback buffer (in bytes). + virtual uint32_t get_play_size(const size_t chan) = 0; + + //! Sets the size of the packets played by the Replay block (in 64-bit words) + virtual void set_words_per_packet(const uint32_t num_words, const size_t chan) = 0; + + //! Returns the size of the packets played by the Replay block (in 64-bit words) + virtual uint32_t get_words_per_packet(const size_t chan) = 0; + +}; /* class replay_block_ctrl*/ + +}} /* namespace uhd::rfnoc */ + +#endif /* INCLUDED_LIBUHD_RFNOC_REPLAY_BLOCK_HPP */ -- cgit v1.2.3