diff options
author | Josh Blum <josh@joshknows.com> | 2013-07-15 15:44:42 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2013-07-15 15:44:42 -0700 |
commit | c464a63e87e32bea2b4c430ff29b0b5e0829893a (patch) | |
tree | 9e6967a7e9f1e4d2b17c43d3bb497709f2fdeb8a /host/include | |
parent | 1f97c6c1e1ed05dbef94f74f52f1ed3370ebfd26 (diff) | |
download | uhd-c464a63e87e32bea2b4c430ff29b0b5e0829893a.tar.gz uhd-c464a63e87e32bea2b4c430ff29b0b5e0829893a.tar.bz2 uhd-c464a63e87e32bea2b4c430ff29b0b5e0829893a.zip |
uhd: added new calls to streamer object + support work
* The transmit streamer gives access to the async msg queue.
* The receive streamer gives access to the issue stream cmd.
* Supporting usrp implementation files updated.
* Example applications updated to use this API.
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/device.hpp | 10 | ||||
-rw-r--r-- | host/include/uhd/device_deprecated.ipp | 10 | ||||
-rw-r--r-- | host/include/uhd/exception.hpp | 4 | ||||
-rw-r--r-- | host/include/uhd/stream.hpp | 26 | ||||
-rw-r--r-- | host/include/uhd/transport/bounded_buffer.ipp | 6 | ||||
-rw-r--r-- | host/include/uhd/transport/vrt_if_packet.hpp | 43 |
6 files changed, 77 insertions, 22 deletions
diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp index 89c6332da..de39383c9 100644 --- a/host/include/uhd/device.hpp +++ b/host/include/uhd/device.hpp @@ -82,16 +82,6 @@ public: //! Make a new transmit streamer from the streamer arguments virtual tx_streamer::sptr get_tx_stream(const stream_args_t &args) = 0; - /*! - * Receive and asynchronous message from the device. - * \param async_metadata the metadata to be filled in - * \param timeout the timeout in seconds to wait for a message - * \return true when the async_metadata is valid, false for timeout - */ - virtual bool recv_async_msg( - async_metadata_t &async_metadata, double timeout = 0.1 - ) = 0; - //! Get access to the underlying property structure virtual boost::shared_ptr<property_tree> get_tree(void) const = 0; diff --git a/host/include/uhd/device_deprecated.ipp b/host/include/uhd/device_deprecated.ipp index 0ee1cd706..58c43a876 100644 --- a/host/include/uhd/device_deprecated.ipp +++ b/host/include/uhd/device_deprecated.ipp @@ -184,6 +184,16 @@ size_t get_max_recv_samps_per_packet(void){ return _rx_streamer->get_max_num_samps(); } +/*! + * Receive and asynchronous message from the device. + * \param async_metadata the metadata to be filled in + * \param timeout the timeout in seconds to wait for a message + * \return true when the async_metadata is valid, false for timeout + */ +virtual bool recv_async_msg( + async_metadata_t &async_metadata, double timeout = 0.1 +) = 0; + private: rx_streamer::sptr _rx_streamer; io_type_t::tid_t _recv_tid; diff --git a/host/include/uhd/exception.hpp b/host/include/uhd/exception.hpp index c05861788..69e902fd5 100644 --- a/host/include/uhd/exception.hpp +++ b/host/include/uhd/exception.hpp @@ -157,9 +157,9 @@ namespace uhd{ * If the code evaluates to false, throw an assertion error. * \param code the code that resolved to a boolean */ - #define UHD_ASSERT_THROW(code) if (not (code)) \ + #define UHD_ASSERT_THROW(code) {if (not (code)) \ throw uhd::assertion_error(UHD_THROW_SITE_INFO(#code)); \ - else void(0) + } } //namespace uhd diff --git a/host/include/uhd/stream.hpp b/host/include/uhd/stream.hpp index c05e8a1e9..75b097ded 100644 --- a/host/include/uhd/stream.hpp +++ b/host/include/uhd/stream.hpp @@ -1,5 +1,5 @@ // -// Copyright 2011-2012 Ettus Research LLC +// Copyright 2011-2013 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 @@ -21,6 +21,7 @@ #include <uhd/config.hpp> #include <uhd/types/metadata.hpp> #include <uhd/types/device_addr.hpp> +#include <uhd/types/stream_cmd.hpp> #include <uhd/types/ref_vector.hpp> #include <boost/utility.hpp> #include <boost/shared_ptr.hpp> @@ -172,6 +173,19 @@ public: const double timeout = 0.1, const bool one_packet = false ) = 0; + + /*! + * Issue a stream command to the usrp device. + * This tells the usrp to send samples into the host. + * See the documentation for stream_cmd_t for more info. + * + * With multiple devices, the first stream command in a chain of commands + * should have a time spec in the near future and stream_now = false; + * to ensure that the packets can be aligned by their time specs. + * + * \param stream_cmd the stream command to issue + */ + virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd) = 0; }; /*! @@ -221,6 +235,16 @@ public: const tx_metadata_t &metadata, const double timeout = 0.1 ) = 0; + + /*! + * Receive and asynchronous message from this TX stream. + * \param async_metadata the metadata to be filled in + * \param timeout the timeout in seconds to wait for a message + * \return true when the async_metadata is valid, false for timeout + */ + virtual bool recv_async_msg( + async_metadata_t &async_metadata, double timeout = 0.1 + ) = 0; }; } //namespace uhd diff --git a/host/include/uhd/transport/bounded_buffer.ipp b/host/include/uhd/transport/bounded_buffer.ipp index 9c24005b7..35ffb293b 100644 --- a/host/include/uhd/transport/bounded_buffer.ipp +++ b/host/include/uhd/transport/bounded_buffer.ipp @@ -1,5 +1,5 @@ // -// Copyright 2010-2011 Ettus Research LLC +// Copyright 2010-2013 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 @@ -26,7 +26,7 @@ #include <boost/thread/condition.hpp> #include <boost/thread/locks.hpp> -namespace uhd{ namespace transport{ namespace{ /*anon*/ +namespace uhd{ namespace transport{ template <typename elem_type> class bounded_buffer_detail : boost::noncopyable{ public: @@ -142,6 +142,6 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ } }; -}}} //namespace +}} //namespace #endif /* INCLUDED_UHD_TRANSPORT_BOUNDED_BUFFER_IPP */ diff --git a/host/include/uhd/transport/vrt_if_packet.hpp b/host/include/uhd/transport/vrt_if_packet.hpp index 1be480874..d16892281 100644 --- a/host/include/uhd/transport/vrt_if_packet.hpp +++ b/host/include/uhd/transport/vrt_if_packet.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2013 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 @@ -26,6 +26,9 @@ namespace uhd{ namespace transport{ namespace vrt{ + //! The maximum number of 32-bit words in the vrlp link layer + static const size_t num_vrl_words32 = 3; + //! The maximum number of 32-bit words in a vrt if packet header static const size_t max_if_hdr_words32 = 7; //hdr+sid+cid+tsi+tsf @@ -34,12 +37,24 @@ namespace vrt{ * The size fields are used for input and output depending upon * the operation used (ie the pack or unpack function call). */ - struct UHD_API if_packet_info_t{ - //packet type (pack only supports data) - enum packet_type_t { + struct UHD_API if_packet_info_t + { + if_packet_info_t(void); + + //link layer type - always set for pack and unpack + enum link_type_t + { + LINK_TYPE_NONE = 0x0, + LINK_TYPE_CHDR = 0x1, + LINK_TYPE_VRLP = 0x2, + } link_type; + + //packet type + enum packet_type_t + { PACKET_TYPE_DATA = 0x0, - PACKET_TYPE_EXTENSION = 0x1, - PACKET_TYPE_CONTEXT = 0x2 + PACKET_TYPE_IF_EXT = 0x1, + PACKET_TYPE_CONTEXT = 0x2, //extension context: has_sid = true } packet_type; //size fields @@ -100,6 +115,22 @@ namespace vrt{ if_packet_info_t &if_packet_info ); + UHD_INLINE if_packet_info_t::if_packet_info_t(void): + link_type(LINK_TYPE_NONE), + packet_type(PACKET_TYPE_DATA), + num_payload_words32(0), + num_payload_bytes(0), + num_header_words32(0), + num_packet_words32(0), + packet_count(0), + sob(false), eob(false), + has_sid(false), sid(0), + has_cid(false), cid(0), + has_tsi(false), tsi(0), + has_tsf(false), tsf(0), + has_tlr(false), tlr(0) + {} + } //namespace vrt }} //namespace |