aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorWade Fife <wade.fife@ettus.com>2018-07-16 07:39:30 -0500
committerBrent Stapleton <brent.stapleton@ettus.com>2018-08-29 15:45:55 -0700
commitbed75f0ccbb6da139283a07c1442293bef95f26a (patch)
tree54cda1bbb73bd291d264bf995d0b0bdf8de737d7 /host/include
parent639797e5924b42764711b69b09e48ee07ed3d683 (diff)
downloaduhd-bed75f0ccbb6da139283a07c1442293bef95f26a.tar.gz
uhd-bed75f0ccbb6da139283a07c1442293bef95f26a.tar.bz2
uhd-bed75f0ccbb6da139283a07c1442293bef95f26a.zip
RFNoC: Add Replay API and example
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/rfnoc/CMakeLists.txt1
-rw-r--r--host/include/uhd/rfnoc/blocks/replay.xml64
-rw-r--r--host/include/uhd/rfnoc/blocks/replay_x2.xml72
-rw-r--r--host/include/uhd/rfnoc/blocks/replay_x4.xml87
-rw-r--r--host/include/uhd/rfnoc/replay_block_ctrl.hpp67
5 files changed, 291 insertions, 0 deletions
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 @@
+<!--This defines one NoC-Block.-->
+<nocblock>
+ <name>Replay</name>
+ <blockname>Replay</blockname>
+ <key>Replay</key>
+ <!--There can be several of these:-->
+ <ids>
+ <id revision="0">4E91A00000000000</id>
+ </ids>
+ <!-- Registers -->
+ <registers>
+ <setreg>
+ <name>REC_BASE_ADDR</name>
+ <address>128</address>
+ </setreg>
+ <setreg>
+ <name>REC_BUFFER_SIZE</name>
+ <address>129</address>
+ </setreg>
+ <setreg>
+ <name>REC_RESTART</name>
+ <address>130</address>
+ </setreg>
+ <readback>
+ <name>REC_FULLNESS</name>
+ <address>131</address>
+ </readback>
+ <setreg>
+ <name>PLAY_BASE_ADDR</name>
+ <address>132</address>
+ </setreg>
+ <setreg>
+ <name>PLAY_BUFFER_SIZE</name>
+ <address>133</address>
+ </setreg>
+ <setreg>
+ <name>RX_CTRL_COMMAND</name>
+ <address>152</address>
+ </setreg>
+ <setreg>
+ <name>RX_CTRL_HALT</name>
+ <address>155</address>
+ </setreg>
+ <setreg>
+ <name>RX_CTRL_MAXLEN</name>
+ <address>156</address>
+ </setreg>
+ </registers>
+ <!-- Args -->
+ <args>
+ </args>
+ <!--All the connections to the outside world are listed in 'ports':-->
+ <ports>
+ <sink>
+ <name>in0</name>
+ <type>sc16</type>
+ </sink>
+ <source>
+ <name>out0</name>
+ <type>sc16</type>
+ </source>
+ </ports>
+</nocblock>
+
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 @@
+<!--This defines one NoC-Block.-->
+<nocblock>
+ <name>Replay</name>
+ <blockname>Replay</blockname>
+ <key>Replay</key>
+ <!--There can be several of these:-->
+ <ids>
+ <id revision="0">4E91A00000000002</id>
+ </ids>
+ <!-- Registers -->
+ <registers>
+ <setreg>
+ <name>REC_BASE_ADDR</name>
+ <address>128</address>
+ </setreg>
+ <setreg>
+ <name>REC_BUFFER_SIZE</name>
+ <address>129</address>
+ </setreg>
+ <setreg>
+ <name>REC_RESTART</name>
+ <address>130</address>
+ </setreg>
+ <readback>
+ <name>REC_FULLNESS</name>
+ <address>131</address>
+ </readback>
+ <setreg>
+ <name>PLAY_BASE_ADDR</name>
+ <address>132</address>
+ </setreg>
+ <setreg>
+ <name>PLAY_BUFFER_SIZE</name>
+ <address>133</address>
+ </setreg>
+ <setreg>
+ <name>RX_CTRL_COMMAND</name>
+ <address>152</address>
+ </setreg>
+ <setreg>
+ <name>RX_CTRL_HALT</name>
+ <address>155</address>
+ </setreg>
+ <setreg>
+ <name>RX_CTRL_MAXLEN</name>
+ <address>156</address>
+ </setreg>
+ </registers>
+ <!-- Args -->
+ <args>
+ </args>
+ <!--All the connections to the outside world are listed in 'ports':-->
+ <ports>
+ <sink>
+ <name>in0</name>
+ <type>sc16</type>
+ </sink>
+ <sink>
+ <name>in1</name>
+ <type>sc16</type>
+ </sink>
+ <source>
+ <name>out0</name>
+ <type>sc16</type>
+ </source>
+ <source>
+ <name>out1</name>
+ <type>sc16</type>
+ </source>
+ </ports>
+</nocblock>
+
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 @@
+<!--This defines one NoC-Block.-->
+<nocblock>
+ <name>Replay</name>
+ <blockname>Replay</blockname>
+ <key>Replay</key>
+ <!--There can be several of these:-->
+ <ids>
+ <id revision="0">4E91A00000000004</id>
+ </ids>
+ <!-- Registers -->
+ <registers>
+ <setreg>
+ <name>REC_BASE_ADDR</name>
+ <address>128</address>
+ </setreg>
+ <setreg>
+ <name>REC_BUFFER_SIZE</name>
+ <address>129</address>
+ </setreg>
+ <setreg>
+ <name>REC_RESTART</name>
+ <address>130</address>
+ </setreg>
+ <readback>
+ <name>REC_FULLNESS</name>
+ <address>131</address>
+ </readback>
+ <setreg>
+ <name>PLAY_BASE_ADDR</name>
+ <address>132</address>
+ </setreg>
+ <setreg>
+ <name>PLAY_BUFFER_SIZE</name>
+ <address>133</address>
+ </setreg>
+ <setreg>
+ <name>RX_CTRL_COMMAND</name>
+ <address>152</address>
+ </setreg>
+ <setreg>
+ <name>RX_CTRL_HALT</name>
+ <address>155</address>
+ </setreg>
+ <setreg>
+ <name>RX_CTRL_MAXLEN</name>
+ <address>156</address>
+ </setreg>
+ </registers>
+ <!-- Args -->
+ <args>
+ </args>
+ <!--All the connections to the outside world are listed in 'ports':-->
+ <ports>
+ <sink>
+ <name>in0</name>
+ <type>sc16</type>
+ </sink>
+ <sink>
+ <name>in1</name>
+ <type>sc16</type>
+ </sink>
+ <sink>
+ <name>in2</name>
+ <type>sc16</type>
+ </sink>
+ <sink>
+ <name>in3</name>
+ <type>sc16</type>
+ </sink>
+ <source>
+ <name>out0</name>
+ <type>sc16</type>
+ </source>
+ <source>
+ <name>out1</name>
+ <type>sc16</type>
+ </source>
+ <source>
+ <name>out2</name>
+ <type>sc16</type>
+ </source>
+ <source>
+ <name>out3</name>
+ <type>sc16</type>
+ </source> </ports>
+</nocblock>
+
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 <uhd/rfnoc/source_block_ctrl_base.hpp>
+#include <uhd/rfnoc/sink_block_ctrl_base.hpp>
+
+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 */