aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-05-18 17:46:34 -0700
committerJosh Blum <josh@joshknows.com>2010-05-18 17:46:34 -0700
commit21e9cf4bece884ced5b7294e012be971e941c511 (patch)
tree634f4b8b27d9dc8a6ebfc2ab731bddf62d0bbe22 /host/include
parent7c98884eda041b676584059ca3a63b11f1bbd505 (diff)
parent4ea8822a50073b01ede9e0b0f7c8c713767ea1b8 (diff)
downloaduhd-21e9cf4bece884ced5b7294e012be971e941c511.tar.gz
uhd-21e9cf4bece884ced5b7294e012be971e941c511.tar.bz2
uhd-21e9cf4bece884ced5b7294e012be971e941c511.zip
Merge branch 'work'
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/config.hpp9
-rw-r--r--host/include/uhd/device.hpp57
-rw-r--r--host/include/uhd/transport/zero_copy.hpp12
-rw-r--r--host/include/uhd/types/mac_addr.hpp2
-rw-r--r--host/include/uhd/types/otw_type.hpp6
-rw-r--r--host/include/uhd/usrp/device_props.hpp4
6 files changed, 72 insertions, 18 deletions
diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp
index 32eafc89b..fea95145c 100644
--- a/host/include/uhd/config.hpp
+++ b/host/include/uhd/config.hpp
@@ -76,4 +76,13 @@
#define UHD_LOCAL
#endif // UHD_DLL
+// Define force inline macro
+#ifdef BOOST_MSVC
+ #define UHD_INLINE __forceinline
+#elif defined(__GNUG__) && __GNUG__ >= 4
+ #define UHD_INLINE inline __attribute__((always_inline))
+#else
+ #define UHD_INLINE inline
+#endif
+
#endif /* INCLUDED_UHD_CONFIG_HPP */
diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp
index ae75e6dc8..27b461184 100644
--- a/host/include/uhd/device.hpp
+++ b/host/include/uhd/device.hpp
@@ -77,15 +77,35 @@ 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
+ };
+
+ /*!
+ * 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
+ };
+
+ /*!
* Send a buffer containing IF data with its metadata.
*
* Send handles fragmentation as follows:
- * If the buffer has more samples than the maximum supported,
- * the send method will send the maximum number of samples
- * as supported by the transport and return the number sent.
- * In this case, the end of burst flag will be forced to false.
- * It is up to the caller to call send again on the un-sent
- * portions of the buffer, until the buffer is exhausted.
+ * If the buffer has more samples than the maximum per packet,
+ * the send method will fragment the samples across several packets.
+ * 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.
@@ -93,12 +113,14 @@ 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;
/*!
@@ -123,16 +145,35 @@ 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;
+
+ /*!
+ * Get the maximum number of samples per packet on send.
+ * \return the number of samples
+ */
+ virtual size_t get_max_send_samps_per_packet(void) const = 0;
+
+ /*!
+ * Get the maximum number of samples per packet on recv.
+ * \return the number of samples
+ */
+ virtual size_t get_max_recv_samps_per_packet(void) const = 0;
+
};
} //namespace uhd
diff --git a/host/include/uhd/transport/zero_copy.hpp b/host/include/uhd/transport/zero_copy.hpp
index 4fc1df9de..fdc5b141c 100644
--- a/host/include/uhd/transport/zero_copy.hpp
+++ b/host/include/uhd/transport/zero_copy.hpp
@@ -45,7 +45,7 @@ public:
* Get the size of the underlying buffer.
* \return the number of bytes
*/
- size_t size(void){
+ size_t size(void) const{
return boost::asio::buffer_size(this->get());
}
@@ -53,7 +53,7 @@ public:
* Get a pointer to the underlying buffer.
* \return a pointer into memory
*/
- template <class T> T cast(void){
+ template <class T> T cast(void) const{
return boost::asio::buffer_cast<T>(this->get());
}
@@ -63,7 +63,7 @@ private:
* The buffer has a reference to memory and a size.
* \return a boost asio const buffer
*/
- virtual const boost::asio::const_buffer &get(void) = 0;
+ virtual const boost::asio::const_buffer &get(void) const = 0;
};
/*!
@@ -87,7 +87,7 @@ public:
* Get the size of the underlying buffer.
* \return the number of bytes
*/
- size_t size(void){
+ size_t size(void) const{
return boost::asio::buffer_size(this->get());
}
@@ -95,7 +95,7 @@ public:
* Get a pointer to the underlying buffer.
* \return a pointer into memory
*/
- template <class T> T cast(void){
+ template <class T> T cast(void) const{
return boost::asio::buffer_cast<T>(this->get());
}
@@ -105,7 +105,7 @@ private:
* The buffer has a reference to memory and a size.
* \return a boost asio mutable buffer
*/
- virtual const boost::asio::mutable_buffer &get(void) = 0;
+ virtual const boost::asio::mutable_buffer &get(void) const = 0;
};
/*!
diff --git a/host/include/uhd/types/mac_addr.hpp b/host/include/uhd/types/mac_addr.hpp
index 034b6a348..0ced2e734 100644
--- a/host/include/uhd/types/mac_addr.hpp
+++ b/host/include/uhd/types/mac_addr.hpp
@@ -58,7 +58,7 @@ namespace uhd{
private:
mac_addr_t(const byte_vector_t &bytes); //private constructor
- byte_vector_t _bytes; //internal representation
+ const byte_vector_t _bytes; //internal representation
};
} //namespace uhd
diff --git a/host/include/uhd/types/otw_type.hpp b/host/include/uhd/types/otw_type.hpp
index f10664584..8e3e65d78 100644
--- a/host/include/uhd/types/otw_type.hpp
+++ b/host/include/uhd/types/otw_type.hpp
@@ -55,6 +55,12 @@ namespace uhd{
BO_NOT_APPLICABLE = '|'
} byteorder;
+ /*!
+ * Get the sample size of this otw type.
+ * \return the size of a sample in bytes
+ */
+ size_t get_sample_size(void) const;
+
otw_type_t(void);
};
diff --git a/host/include/uhd/usrp/device_props.hpp b/host/include/uhd/usrp/device_props.hpp
index b8f6f5cd4..983bcb672 100644
--- a/host/include/uhd/usrp/device_props.hpp
+++ b/host/include/uhd/usrp/device_props.hpp
@@ -31,9 +31,7 @@ namespace uhd{ namespace usrp{
enum device_prop_t{
DEVICE_PROP_NAME = 'n', //ro, std::string
DEVICE_PROP_MBOARD = 'm', //ro, wax::obj
- DEVICE_PROP_MBOARD_NAMES = 'M', //ro, prop_names_t
- DEVICE_PROP_MAX_RX_SAMPLES = 'r', //ro, size_t
- DEVICE_PROP_MAX_TX_SAMPLES = 't' //ro, size_t
+ DEVICE_PROP_MBOARD_NAMES = 'M' //ro, prop_names_t
};
////////////////////////////////////////////////////////////////////////