diff options
author | Josh Blum <josh@joshknows.com> | 2011-03-03 16:28:26 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-03-03 16:28:26 -0800 |
commit | 98028b366f840efc3b289cc7051bed73aad0963c (patch) | |
tree | 5d26773de13c4f78326896c6eb0ff78213d0912f /host/lib/usrp/usrp1 | |
parent | f938ed7938021c10bb0a0ce47e6d40d10f89abc2 (diff) | |
parent | 1b63cd2560886d851f3e2ba98bfddf772c44df34 (diff) | |
download | uhd-98028b366f840efc3b289cc7051bed73aad0963c.tar.gz uhd-98028b366f840efc3b289cc7051bed73aad0963c.tar.bz2 uhd-98028b366f840efc3b289cc7051bed73aad0963c.zip |
Merge branch 'mb_iface' into next
Conflicts:
host/lib/usrp/usrp2/usrp2_iface.hpp
Diffstat (limited to 'host/lib/usrp/usrp1')
-rw-r--r-- | host/lib/usrp/usrp1/codec_ctrl.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/dboard_iface.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_iface.cpp | 17 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_iface.hpp | 36 |
4 files changed, 27 insertions, 42 deletions
diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp index f9f923f38..1b4411002 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.cpp +++ b/host/lib/usrp/usrp1/codec_ctrl.cpp @@ -303,8 +303,8 @@ void usrp1_codec_ctrl_impl::send_reg(boost::uint8_t addr) std::cout << "codec control write reg: 0x"; std::cout << std::setw(8) << std::hex << reg << std::endl; } - _iface->transact_spi(_spi_slave, - spi_config_t::EDGE_RISE, reg, 16, false); + _iface->write_spi(_spi_slave, + spi_config_t::EDGE_RISE, reg, 16); } void usrp1_codec_ctrl_impl::recv_reg(boost::uint8_t addr) @@ -317,8 +317,8 @@ void usrp1_codec_ctrl_impl::recv_reg(boost::uint8_t addr) std::cout << std::setw(8) << std::hex << reg << std::endl; } - boost::uint32_t ret = _iface->transact_spi(_spi_slave, - spi_config_t::EDGE_RISE, reg, 16, true); + boost::uint32_t ret = _iface->read_spi(_spi_slave, + spi_config_t::EDGE_RISE, reg, 16); if (codec_debug) { std::cout.fill('0'); diff --git a/host/lib/usrp/usrp1/dboard_iface.cpp b/host/lib/usrp/usrp1/dboard_iface.cpp index 53ccd4d55..3f3a98b7a 100644 --- a/host/lib/usrp/usrp1/dboard_iface.cpp +++ b/host/lib/usrp/usrp1/dboard_iface.cpp @@ -337,8 +337,8 @@ void usrp1_dboard_iface::write_spi(unit_t unit, boost::uint32_t data, size_t num_bits) { - _iface->transact_spi(unit_to_otw_spi_dev(unit, _dboard_slot), - config, data, num_bits, false); + _iface->write_spi(unit_to_otw_spi_dev(unit, _dboard_slot), + config, data, num_bits); } boost::uint32_t usrp1_dboard_iface::read_write_spi(unit_t unit, @@ -346,8 +346,8 @@ boost::uint32_t usrp1_dboard_iface::read_write_spi(unit_t unit, boost::uint32_t data, size_t num_bits) { - return _iface->transact_spi(unit_to_otw_spi_dev(unit, _dboard_slot), - config, data, num_bits, true); + return _iface->read_spi(unit_to_otw_spi_dev(unit, _dboard_slot), + config, data, num_bits); } /*********************************************************************** diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index 947847044..491f76cef 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -93,6 +93,23 @@ public: return uhd::ntohx(value_out); } + + void poke16(boost::uint32_t addr, boost::uint16_t value) { + throw uhd::not_implemented_error("Unhandled command poke16()"); + } + + boost::uint16_t peek16(boost::uint32_t addr) { + throw uhd::not_implemented_error("Unhandled command peek16()"); + return 0; + } + + void write_uart(boost::uint8_t dev, const std::string &buf) { + throw uhd::not_implemented_error("Unhandled command write_uart()"); + } + + std::string read_uart(boost::uint8_t dev) { + throw uhd::not_implemented_error("Unhandled command read_uart()"); + } /******************************************************************* * I2C diff --git a/host/lib/usrp/usrp1/usrp1_iface.hpp b/host/lib/usrp/usrp1/usrp1_iface.hpp index 34a2330b5..e808e2959 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.hpp +++ b/host/lib/usrp/usrp1/usrp1_iface.hpp @@ -18,8 +18,7 @@ #ifndef INCLUDED_USRP1_IFACE_HPP #define INCLUDED_USRP1_IFACE_HPP -#include <uhd/usrp/mboard_eeprom.hpp> -#include <uhd/types/serial.hpp> +#include <uhd/usrp/mboard_iface.hpp> #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> #include "usrp1_ctrl.hpp" @@ -29,7 +28,7 @@ * Provides a set of functions to implementation layer. * Including spi, peek, poke, control... */ -class usrp1_iface : boost::noncopyable, public uhd::i2c_iface{ +class usrp1_iface : public uhd::usrp::mboard_iface, boost::noncopyable{ public: typedef boost::shared_ptr<usrp1_iface> sptr; @@ -41,35 +40,6 @@ public: static sptr make(usrp_ctrl::sptr ctrl_transport); /*! - * Write a register (32 bits) - * \param addr the address - * \param data the 32bit data - */ - virtual void poke32(boost::uint32_t addr, boost::uint32_t data) = 0; - - /*! - * Read a register (32 bits) - * \param addr the address - * \return the 32bit data - */ - virtual boost::uint32_t peek32(boost::uint32_t addr) = 0; - - /*! - * Perform an spi transaction. - * \param which_slave the slave device number - * \param config spi config args - * \param data the bits to write - * \param num_bits how many bits in data - * \param readback true to readback a value - * \return spi data if readback set - */ - virtual boost::uint32_t transact_spi(int which_slave, - const uhd::spi_config_t &config, - boost::uint32_t data, - size_t num_bits, - bool readback) = 0; - - /*! * Perform a general USB firmware OUT operation * \param request * \param value @@ -82,8 +52,6 @@ public: boost::uint16_t index, unsigned char* buff, boost::uint16_t length) = 0; - - uhd::usrp::mboard_eeprom_t mb_eeprom; }; #endif /* INCLUDED_USRP1_IFACE_HPP */ |