diff options
-rw-r--r-- | host/include/uhd/types/serial.hpp | 24 | ||||
-rw-r--r-- | host/lib/types/serial.cpp | 22 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 28 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/dboard_impl.cpp | 1 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 1 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.hpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 1 |
8 files changed, 49 insertions, 41 deletions
diff --git a/host/include/uhd/types/serial.hpp b/host/include/uhd/types/serial.hpp index 9b203324b..5c6de162b 100644 --- a/host/include/uhd/types/serial.hpp +++ b/host/include/uhd/types/serial.hpp @@ -134,7 +134,7 @@ namespace uhd{ */ virtual boost::uint32_t transact_spi( int which_slave, - const uhd::spi_config_t &config, + const spi_config_t &config, boost::uint32_t data, size_t num_bits, bool readback @@ -148,15 +148,12 @@ namespace uhd{ * \param num_bits how many bits in data * \return spi data */ - boost::uint32_t read_spi( + virtual boost::uint32_t read_spi( int which_slave, - const uhd::spi_config_t &config, + const spi_config_t &config, boost::uint16_t data, - size_t num_bits) { - return transact_spi( - which_slave, config, data, num_bits, true - ); - } + size_t num_bits + ); /*! * Write to the SPI bus. @@ -165,15 +162,12 @@ namespace uhd{ * \param data the bits to write * \param num_bits how many bits in data */ - void write_spi( + virtual void write_spi( int which_slave, - const uhd::spi_config_t &config, + const spi_config_t &config, boost::uint16_t data, - size_t num_bits) { - transact_spi( - which_slave, config, data, num_bits, false - ); - } + size_t num_bits + ); }; } //namespace uhd diff --git a/host/lib/types/serial.cpp b/host/lib/types/serial.cpp index 9acf7156a..aa1133e72 100644 --- a/host/lib/types/serial.cpp +++ b/host/lib/types/serial.cpp @@ -54,3 +54,25 @@ byte_vector_t i2c_iface::read_eeprom( } return bytes; } + +boost::uint32_t spi_iface::read_spi( + int which_slave, + const spi_config_t &config, + boost::uint16_t data, + size_t num_bits +){ + return transact_spi( + which_slave, config, data, num_bits, true + ); +} + +void spi_iface::write_spi( + int which_slave, + const spi_config_t &config, + boost::uint16_t data, + size_t num_bits +){ + transact_spi( + which_slave, config, data, num_bits, false + ); +} diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 1ec332a61..caea7c043 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -60,20 +60,6 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) //since an address is intended for a different, non-USB, device. if (hint.has_key("addr")) return usrp1_addrs; - //extract the firmware path for the USRP1 - std::string usrp1_fw_image; - try{ - usrp1_fw_image = find_image_path(hint.get("fw", "usrp1_fw.ihx")); - } - catch(...){ - uhd::warning::post( - "Could not locate USRP1 firmware.\n" - "Please install the images package.\n" - ); - return usrp1_addrs; - } - //std::cout << "USRP1 firmware image: " << usrp1_fw_image << std::endl; - boost::uint16_t vid = hint.has_key("uninit") ? FX2_VENDOR_ID : USRP1_VENDOR_ID; boost::uint16_t pid = hint.has_key("uninit") ? FX2_PRODUCT_ID : USRP1_PRODUCT_ID; @@ -85,6 +71,20 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) //find the usrps and load firmware BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) { + //extract the firmware path for the USRP1 + std::string usrp1_fw_image; + try{ + usrp1_fw_image = find_image_path(hint.get("fw", "usrp1_fw.ihx")); + } + catch(...){ + uhd::warning::post( + "Could not locate USRP1 firmware.\n" + "Please install the images package.\n" + ); + return usrp1_addrs; + } + //std::cout << "USRP1 firmware image: " << usrp1_fw_image << std::endl; + usrp_ctrl::make(usb_control::make(handle))->usrp_load_firmware(usrp1_fw_image); } diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp index e21fda074..3f41cddcf 100644 --- a/host/lib/usrp/usrp2/dboard_impl.cpp +++ b/host/lib/usrp/usrp2/dboard_impl.cpp @@ -17,6 +17,7 @@ #include "usrp2_impl.hpp" #include "usrp2_regs.hpp" +#include "fw_common.h" #include <uhd/usrp/misc_utils.hpp> #include <uhd/usrp/dsp_utils.hpp> #include <uhd/usrp/subdev_props.hpp> diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 9049d4025..5cb4e4d34 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -17,6 +17,7 @@ #include "usrp2_impl.hpp" #include "usrp2_regs.hpp" +#include "fw_common.h" #include <uhd/exception.hpp> #include <uhd/usrp/gps_ctrl.hpp> #include <uhd/usrp/misc_utils.hpp> diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 3a7ed8351..e3827233b 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -16,6 +16,7 @@ // #include "usrp2_regs.hpp" +#include "fw_common.h" #include "usrp2_iface.hpp" #include <uhd/exception.hpp> #include <uhd/types/dict.hpp> @@ -69,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 55fcdc0d2..75057ab96 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.hpp +++ b/host/lib/usrp/usrp2/usrp2_iface.hpp @@ -26,7 +26,6 @@ #include <boost/function.hpp> #include <utility> #include <string> -#include "fw_common.h" #include "usrp2_regs.hpp" @@ -49,13 +48,6 @@ public: */ static sptr make(uhd::transport::udp_simple::sptr ctrl_transport); - /*! - * Perform a control transaction. - * \param data a control data struct - * \return the result control data - */ - virtual usrp2_ctrl_data_t ctrl_send_and_recv(const usrp2_ctrl_data_t &data) = 0; - virtual gps_recv_fn_t get_gps_read_fn(void) = 0; virtual gps_send_fn_t get_gps_write_fn(void) = 0; diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 0a23e3eff..651e9a89b 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -16,6 +16,7 @@ // #include "usrp2_impl.hpp" +#include "fw_common.h" #include <uhd/exception.hpp> #include <uhd/transport/if_addrs.hpp> #include <uhd/transport/udp_zero_copy.hpp> |