summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/include/uhd/types/serial.hpp22
-rw-r--r--host/include/uhd/usrp/mboard_iface.hpp16
2 files changed, 23 insertions, 15 deletions
diff --git a/host/include/uhd/types/serial.hpp b/host/include/uhd/types/serial.hpp
index cf7e494f9..8a5ed1c32 100644
--- a/host/include/uhd/types/serial.hpp
+++ b/host/include/uhd/types/serial.hpp
@@ -175,6 +175,28 @@ namespace uhd{
);
};
+ /*!
+ * UART interface to write and read bytes.
+ */
+ class UHD_API uart_iface{
+ public:
+ typedef boost::shared_ptr<uart_iface> sptr;
+
+ /*!
+ * Write to a serial port.
+ * \param dev which UART to write to
+ * \param buf the data to write
+ */
+ virtual void write_uart(boost::uint8_t dev, const std::string &buf) = 0;
+
+ /*!
+ * Read from a serial port.
+ * \param dev which UART to read from
+ * \return the data read from the serial port
+ */
+ virtual std::string read_uart(boost::uint8_t dev) = 0;
+ };
+
} //namespace uhd
#endif /* INCLUDED_UHD_TYPES_SERIAL_HPP */
diff --git a/host/include/uhd/usrp/mboard_iface.hpp b/host/include/uhd/usrp/mboard_iface.hpp
index 784fbc7c5..bbee8f2de 100644
--- a/host/include/uhd/usrp/mboard_iface.hpp
+++ b/host/include/uhd/usrp/mboard_iface.hpp
@@ -33,7 +33,7 @@ namespace uhd{ namespace usrp{
* Provides a set of functions to implementation layer.
* Including spi, peek, poke, control...
*/
-class mboard_iface : public uhd::i2c_iface, public uhd::spi_iface {
+class mboard_iface : public uhd::i2c_iface, public uhd::spi_iface, public uhd::uart_iface {
public:
typedef boost::shared_ptr<mboard_iface> sptr;
/*!
@@ -64,20 +64,6 @@ public:
*/
virtual boost::uint16_t peek16(boost::uint32_t addr) = 0;
- /*!
- * Write to a serial port.
- * \param dev which UART to write to
- * \param buf the data to write
- */
- virtual void write_uart(boost::uint8_t dev, const std::string &buf) = 0;
-
- /*!
- * Read from a serial port.
- * \param dev which UART to read from
- * \return the data read from the serial port
- */
- virtual std::string read_uart(boost::uint8_t dev) = 0;
-
};
}}