aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/clock_ctrl.cpp2
-rw-r--r--host/lib/usrp/usrp2/codec_ctrl.cpp8
-rw-r--r--host/lib/usrp/usrp2/dboard_iface.cpp16
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp4
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.hpp58
5 files changed, 15 insertions, 73 deletions
diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp
index aaafbae53..abda53bf2 100644
--- a/host/lib/usrp/usrp2/clock_ctrl.cpp
+++ b/host/lib/usrp/usrp2/clock_ctrl.cpp
@@ -305,7 +305,7 @@ private:
*/
void write_reg(boost::uint8_t addr){
boost::uint32_t data = _ad9510_regs.get_write_reg(addr);
- _iface->transact_spi(SPI_SS_AD9510, spi_config_t::EDGE_RISE, data, 24, false /*no rb*/);
+ _iface->write_spi(SPI_SS_AD9510, spi_config_t::EDGE_RISE, data, 24);
}
/*!
diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp
index be5c2c899..0fdcedf62 100644
--- a/host/lib/usrp/usrp2/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp2/codec_ctrl.cpp
@@ -168,17 +168,17 @@ private:
void send_ad9777_reg(boost::uint8_t addr){
boost::uint16_t reg = _ad9777_regs.get_write_reg(addr);
if (codec_ctrl_debug) std::cout << "send_ad9777_reg: " << std::hex << reg << std::endl;
- _iface->transact_spi(
+ _iface->write_spi(
SPI_SS_AD9777, spi_config_t::EDGE_RISE,
- reg, 16, false /*no rb*/
+ reg, 16
);
}
void send_ads62p44_reg(boost::uint8_t addr) {
boost::uint16_t reg = _ads62p44_regs.get_write_reg(addr);
- _iface->transact_spi(
+ _iface->write_spi(
SPI_SS_ADS62P44, spi_config_t::EDGE_FALL,
- reg, 16, false /*no rb*/
+ reg, 16
);
}
};
diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp
index 8b2df61d6..924a6e901 100644
--- a/host/lib/usrp/usrp2/dboard_iface.cpp
+++ b/host/lib/usrp/usrp2/dboard_iface.cpp
@@ -257,7 +257,7 @@ void usrp2_dboard_iface::write_spi(
boost::uint32_t data,
size_t num_bits
){
- _iface->transact_spi(unit_to_spi_dev[unit], config, data, num_bits, false /*no rb*/);
+ _iface->write_spi(unit_to_spi_dev[unit], config, data, num_bits);
}
boost::uint32_t usrp2_dboard_iface::read_write_spi(
@@ -266,7 +266,7 @@ boost::uint32_t usrp2_dboard_iface::read_write_spi(
boost::uint32_t data,
size_t num_bits
){
- return _iface->transact_spi(unit_to_spi_dev[unit], config, data, num_bits, true /*rb*/);
+ return _iface->read_spi(unit_to_spi_dev[unit], config, data, num_bits);
}
/***********************************************************************
@@ -288,9 +288,9 @@ void usrp2_dboard_iface::_write_aux_dac(unit_t unit){
(UNIT_RX, SPI_SS_RX_DAC)
(UNIT_TX, SPI_SS_TX_DAC)
;
- _iface->transact_spi(
+ _iface->write_spi(
unit_to_spi_dac[unit], spi_config_t::EDGE_FALL,
- _dac_regs[unit].get_reg(), 24, false /*no rb*/
+ _dac_regs[unit].get_reg(), 24
);
}
@@ -336,13 +336,13 @@ double usrp2_dboard_iface::read_aux_adc(unit_t unit, aux_adc_t which){
} ad7922_regs.chn = ad7922_regs.mod; //normal mode: mod == chn
//write and read spi
- _iface->transact_spi(
+ _iface->write_spi(
unit_to_spi_adc[unit], config,
- ad7922_regs.get_reg(), 16, false /*no rb*/
+ ad7922_regs.get_reg(), 16
);
- ad7922_regs.set_reg(boost::uint16_t(_iface->transact_spi(
+ ad7922_regs.set_reg(boost::uint16_t(_iface->read_spi(
unit_to_spi_adc[unit], config,
- ad7922_regs.get_reg(), 16, true /*rb*/
+ ad7922_regs.get_reg(), 16
)));
//convert to voltage and return
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp
index a872886a0..e3827233b 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -70,10 +70,6 @@ public:
}
}
- ~usrp2_iface_impl(void){
- /* NOP */
- }
-
/***********************************************************************
* Peek and Poke
**********************************************************************/
diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp
index ea42d019f..75057ab96 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.hpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.hpp
@@ -19,8 +19,7 @@
#define INCLUDED_USRP2_IFACE_HPP
#include <uhd/transport/udp_simple.hpp>
-#include <uhd/types/serial.hpp>
-#include <uhd/usrp/mboard_eeprom.hpp>
+#include <uhd/usrp/mboard_iface.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/cstdint.hpp>
@@ -39,10 +38,9 @@ typedef boost::function<std::string(void)> gps_recv_fn_t;
* Provides a set of functions to implementation layer.
* Including spi, peek, poke, control...
*/
-class usrp2_iface : public uhd::i2c_iface, boost::noncopyable{
+class usrp2_iface : public uhd::usrp::mboard_iface, boost::noncopyable{
public:
typedef boost::shared_ptr<usrp2_iface> sptr;
-
/*!
* Make a new usrp2 interface with the control transport.
* \param ctrl_transport the udp transport object
@@ -50,55 +48,6 @@ public:
*/
static sptr make(uhd::transport::udp_simple::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;
-
- /*!
- * Write a register (16 bits)
- * \param addr the address
- * \param data the 16bit data
- */
- virtual void poke16(boost::uint32_t addr, boost::uint16_t data) = 0;
-
- /*!
- * Read a register (16 bits)
- * \param addr the address
- * \return the 16bit data
- */
- virtual boost::uint16_t peek16(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;
-
- virtual void write_uart(boost::uint8_t dev, const std::string &buf) = 0;
-
- virtual std::string read_uart(boost::uint8_t dev) = 0;
-
virtual gps_recv_fn_t get_gps_read_fn(void) = 0;
virtual gps_send_fn_t get_gps_write_fn(void) = 0;
@@ -121,9 +70,6 @@ public:
* Register map selected from USRP2/USRP2+.
*/
usrp2_regs_t regs;
-
- //motherboard eeprom map structure
- uhd::usrp::mboard_eeprom_t mb_eeprom;
};
#endif /* INCLUDED_USRP2_IFACE_HPP */