aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-25 21:15:50 -0700
committerJosh Blum <josh@joshknows.com>2011-06-25 21:15:50 -0700
commitc96649d5c0e1b2dc17738b6904238eed66a3b9f0 (patch)
tree9364115bb7f40fcd2c1ff3c59b01f6b066eba374 /host/include
parentba2a6b4b39f66f0edaef710561019d7cd43cb417 (diff)
downloaduhd-c96649d5c0e1b2dc17738b6904238eed66a3b9f0.tar.gz
uhd-c96649d5c0e1b2dc17738b6904238eed66a3b9f0.tar.bz2
uhd-c96649d5c0e1b2dc17738b6904238eed66a3b9f0.zip
uhd: created uart iface to inherit from
Diffstat (limited to 'host/include')
-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;
-
};
}}