aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-03-02 23:56:19 -0800
committerJosh Blum <josh@joshknows.com>2010-03-02 23:56:19 -0800
commit8e8221dc380fb275a17dcd0abbfaea108f44505f (patch)
treef2e1c298f6131a48272b3e612dd3b21ed6eee129 /host/include
parent4efafcc2e20b9a980800a979edf5ea7a493b6462 (diff)
downloaduhd-8e8221dc380fb275a17dcd0abbfaea108f44505f.tar.gz
uhd-8e8221dc380fb275a17dcd0abbfaea108f44505f.tar.bz2
uhd-8e8221dc380fb275a17dcd0abbfaea108f44505f.zip
Added a vrt library to pack and unpack from metadata.
Added a vrt test app that packs and unpacks the data.
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/transport/CMakeLists.txt1
-rw-r--r--host/include/uhd/transport/vrt.hpp66
2 files changed, 67 insertions, 0 deletions
diff --git a/host/include/uhd/transport/CMakeLists.txt b/host/include/uhd/transport/CMakeLists.txt
index ba8b33cc5..7f5db2128 100644
--- a/host/include/uhd/transport/CMakeLists.txt
+++ b/host/include/uhd/transport/CMakeLists.txt
@@ -20,5 +20,6 @@ INSTALL(FILES
smart_buffer.hpp
udp_simple.hpp
udp_zero_copy.hpp
+ vrt.hpp
DESTINATION ${HEADER_DIR}/uhd/transport
)
diff --git a/host/include/uhd/transport/vrt.hpp b/host/include/uhd/transport/vrt.hpp
new file mode 100644
index 000000000..b56da4077
--- /dev/null
+++ b/host/include/uhd/transport/vrt.hpp
@@ -0,0 +1,66 @@
+//
+// Copyright 2010 Ettus Research LLC
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+#include <uhd/metadata.hpp>
+#include <cstddef>
+
+#ifndef INCLUDED_UHD_TRANSPORT_VRT_HPP
+#define INCLUDED_UHD_TRANSPORT_VRT_HPP
+
+namespace uhd{ namespace transport{
+
+namespace vrt{
+
+ static const size_t max_header_words32 = 7;
+
+ /*!
+ * Pack a vrt header from metadata.
+ * \param metadata the tx metadata with flags and timestamps
+ * \param header_buff memory to write the packed vrt header
+ * \param num_header_words32 number of words in the vrt header
+ * \param num_payload_words32 the length of the payload
+ * \param packet_count the packet count sequence number
+ */
+ void pack(
+ const metadata_t &metadata, //input
+ uint32_t *header_buff, //output
+ size_t &num_header_words32, //output
+ size_t num_payload_words32, //input
+ size_t packet_count //input
+ );
+
+ /*!
+ * Unpack a vrt header to metadata.
+ * \param metadata the rx metadata with flags and timestamps
+ * \param header_buff memory to read the packed vrt header
+ * \param num_header_words32 number of words in the vrt header
+ * \param num_payload_words32 the length of the payload
+ * \param packet_count the packet count sequence number
+ */
+ void unpack(
+ metadata_t &metadata, //output
+ const uint32_t *header_buff, //input
+ size_t &num_header_words32, //output
+ size_t &num_payload_words32, //output
+ size_t &packet_count //output
+ );
+
+} //namespace vrt
+
+}} //namespace
+
+#endif /* INCLUDED_UHD_TRANSPORT_VRT_HPP */