diff options
author | Moritz Fischer <moritz.fischer@ettus.com> | 2015-07-07 14:28:20 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2015-07-14 12:19:41 -0700 |
commit | 850251d4ec31f515b99e2f5f2c128c3ce78c2b76 (patch) | |
tree | 7678cf91b0f02394081b4457111ae458540e1018 /host | |
parent | 4a731f6c1d6b71a501c98d745f4e2721e5f3e5c5 (diff) | |
download | uhd-850251d4ec31f515b99e2f5f2c128c3ce78c2b76.tar.gz uhd-850251d4ec31f515b99e2f5f2c128c3ce78c2b76.tar.bz2 uhd-850251d4ec31f515b99e2f5f2c128c3ce78c2b76.zip |
e3xx: Load idle image on shutdown.
This commit will have UHD load the idle fpga image on
destruction of e300_impl.
Note: This requires usrp_e310_idle_fpga.bit to be present
in the UHD images directory.
Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/e300/e300_impl.cpp | 51 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_impl.hpp | 5 |
2 files changed, 33 insertions, 23 deletions
diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 41e8eacf3..515fccc08 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -284,32 +284,36 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) // load the fpga image //////////////////////////////////////////////////////////////////// if (_xport_path == AXI) { - if (not device_addr.has_key("no_reload_fpga")) { + _do_not_reload = device_addr.has_key("no_reload_fpga"); + if (not _do_not_reload) { // Load FPGA image if provided via args - if (device_addr.has_key("fpga")) { - common::load_fpga_image(device_addr["fpga"]); - // Else load the FPGA image based on the product ID - } else { - //extract the FPGA path for the e300 - const boost::uint16_t pid = boost::lexical_cast<boost::uint16_t>( + const boost::uint16_t pid = boost::lexical_cast<boost::uint16_t>( device_addr["product"]); - std::string fpga_image; - switch(e300_eeprom_manager::get_mb_type(pid)) { - case e300_eeprom_manager::USRP_E310_MB: - fpga_image = find_image_path(E310_FPGA_FILE_NAME); - break; - case e300_eeprom_manager::USRP_E300_MB: - fpga_image = find_image_path(E300_FPGA_FILE_NAME); - break; - case e300_eeprom_manager::UNKNOWN: - default: - UHD_MSG(warning) << "Unknown motherboard type, loading e300 image." + + std::string fpga_image; + + //extract the FPGA path for the e300 + switch(e300_eeprom_manager::get_mb_type(pid)) { + case e300_eeprom_manager::USRP_E310_MB: + fpga_image = device_addr.cast<std::string>("fpga", + find_image_path(E310_FPGA_FILE_NAME)); + _idle_image = find_image_path(E310_FPGA_IDLE_FILE_NAME); + break; + case e300_eeprom_manager::USRP_E300_MB: + fpga_image = device_addr.cast<std::string>("fpga", + find_image_path(E300_FPGA_FILE_NAME)); + _idle_image = find_image_path(E300_FPGA_IDLE_FILE_NAME); + break; + case e300_eeprom_manager::UNKNOWN: + default: + UHD_MSG(warning) << "Unknown motherboard type, loading e300 image." << std::endl; - fpga_image = find_image_path(E300_FPGA_FILE_NAME); - break; - } - common::load_fpga_image(fpga_image); + fpga_image = device_addr.cast<std::string>("fpga", + find_image_path(E300_FPGA_FILE_NAME)); + _idle_image = find_image_path(E300_FPGA_IDLE_FILE_NAME); + break; } + common::load_fpga_image(fpga_image); } } @@ -621,7 +625,8 @@ uhd::sensor_value_t e300_impl::_get_fe_pll_lock(const bool is_tx) e300_impl::~e300_impl(void) { - /* NOP */ + if (_xport_path == AXI and not _do_not_reload) + common::load_fpga_image(_idle_image); } void e300_impl::_enforce_tick_rate_limits( diff --git a/host/lib/usrp/e300/e300_impl.hpp b/host/lib/usrp/e300/e300_impl.hpp index c7d683f58..196c5fdd8 100644 --- a/host/lib/usrp/e300/e300_impl.hpp +++ b/host/lib/usrp/e300/e300_impl.hpp @@ -51,6 +51,9 @@ namespace uhd { namespace usrp { namespace e300 { static const std::string E300_FPGA_FILE_NAME = "usrp_e300_fpga.bit"; static const std::string E310_FPGA_FILE_NAME = "usrp_e310_fpga.bit"; +static const std::string E300_FPGA_IDLE_FILE_NAME = "usrp_e300_idle_fpga.bit"; +static const std::string E310_FPGA_IDLE_FILE_NAME = "usrp_e310_idle_fpga.bit"; + static const std::string E300_TEMP_SYSFS = "iio:device0"; static const std::string E300_SPIDEV_DEVICE = "/dev/spidev0.1"; static const std::string E300_I2CDEV_DEVICE = "/dev/i2c-0"; @@ -287,6 +290,8 @@ private: // members e300_eeprom_manager::sptr _eeprom_manager; uhd::transport::zero_copy_xport_params _data_xport_params; uhd::transport::zero_copy_xport_params _ctrl_xport_params; + std::string _idle_image; + bool _do_not_reload; gpio_t _misc; gps::ublox::ubx::control::sptr _gps; }; |