summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-05-18 12:34:04 -0700
committerJosh Blum <josh@joshknows.com>2010-05-18 12:34:04 -0700
commiteaa1508dcf6ff32496838f593ba4eb9eb1aee2ff (patch)
treec11fff7251f7cabb1f67fc78b64325d336bb0c34 /host/include
parent527630cc9d51b17c7cf5ab6ca257a78a28284f6d (diff)
downloaduhd-eaa1508dcf6ff32496838f593ba4eb9eb1aee2ff.tar.gz
uhd-eaa1508dcf6ff32496838f593ba4eb9eb1aee2ff.tar.bz2
uhd-eaa1508dcf6ff32496838f593ba4eb9eb1aee2ff.zip
Added send and recv modes to the device class and packet handler implementation.
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/device.hpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp
index ecbe8c95c..a76b34ee2 100644
--- a/host/include/uhd/device.hpp
+++ b/host/include/uhd/device.hpp
@@ -77,6 +77,16 @@ public:
static sptr make(const device_addr_t &hint, size_t which = 0);
/*!
+ * Send modes for the device send routine.
+ */
+ enum send_mode_t{
+ //! Tells the send routine to send the entire buffer
+ SEND_MODE_FULL_BUFF = 0,
+ //! Tells the send routine to return after one packet
+ SEND_MODE_ONE_PACKET = 1
+ };
+
+ /*!
* Send a buffer containing IF data with its metadata.
*
* Send handles fragmentation as follows:
@@ -85,6 +95,7 @@ public:
* Send will respect the burst flags when fragmenting to ensure
* that start of burst can only be set on the first fragment and
* that end of burst can only be set on the final fragment.
+ * Fragmentation only applies in the full buffer send mode.
*
* This is a blocking call and will not return until the number
* of samples returned have been read out of the buffer.
@@ -92,15 +103,27 @@ public:
* \param buff a buffer pointing to some read-only memory
* \param metadata data describing the buffer's contents
* \param io_type the type of data loaded in the buffer
+ * \param send_mode tells send how to unload the buffer
* \return the number of samples sent
*/
virtual size_t send(
const boost::asio::const_buffer &buff,
const tx_metadata_t &metadata,
- const io_type_t &io_type
+ const io_type_t &io_type,
+ send_mode_t send_mode = SEND_MODE_ONE_PACKET
) = 0;
/*!
+ * Recv modes for the device recv routine.
+ */
+ enum recv_mode_t{
+ //! Tells the recv routine to recv the entire buffer
+ RECV_MODE_FULL_BUFF = 0,
+ //! Tells the recv routine to return after one packet
+ RECV_MODE_ONE_PACKET = 1
+ };
+
+ /*!
* Receive a buffer containing IF data and its metadata.
*
* Receive handles fragmentation as follows:
@@ -122,15 +145,21 @@ public:
* immediately when no packets are available to the transport layer,
* and that the timeout duration is reasonably tuned for performance.
*
+ * When using the full buffer recv mode, the metadata only applies
+ * to the first packet received and written into the recv buffer.
+ * Use the one packet recv mode to get per packet metadata.
+ *
* \param buff the buffer to fill with IF data
* \param metadata data to fill describing the buffer
* \param io_type the type of data to fill into the buffer
+ * \param recv_mode tells recv how to load the buffer
* \return the number of samples received
*/
virtual size_t recv(
const boost::asio::mutable_buffer &buff,
rx_metadata_t &metadata,
- const io_type_t &io_type
+ const io_type_t &io_type,
+ recv_mode_t recv_mode = RECV_MODE_ONE_PACKET
) = 0;
};