summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-08-31 16:45:49 -0700
committerNick Foster <nick@nerdnetworks.org>2010-08-31 16:45:49 -0700
commit0616872e35ac6429c19c2495bf4e378551bdd60e (patch)
tree6116f992f4f6d1f8d701aca6bf1526a85d8bda89 /host/lib/usrp
parentb96088b692a5c44974919ee36e253b6ea8c51972 (diff)
parent9a3217cbbeb39d677a439fe0982a7ac4d7f251c2 (diff)
downloaduhd-0616872e35ac6429c19c2495bf4e378551bdd60e.tar.gz
uhd-0616872e35ac6429c19c2495bf4e378551bdd60e.tar.bz2
uhd-0616872e35ac6429c19c2495bf4e378551bdd60e.zip
Merge branch 'usrp1' of ettus.sourcerepo.com:ettus/uhdpriv into usrp1
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/dboard/db_dbsrx.cpp7
-rw-r--r--host/lib/usrp/misc_utils.cpp13
-rw-r--r--host/lib/usrp/usrp1/dboard_iface.cpp6
-rw-r--r--host/lib/usrp/usrp1/io_impl.cpp4
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp22
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp4
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp10
7 files changed, 48 insertions, 18 deletions
diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp
index 06cf91d3b..81434f054 100644
--- a/host/lib/usrp/dboard/db_dbsrx.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx.cpp
@@ -205,7 +205,12 @@ dbsrx::dbsrx(ctor_args_t args) : rx_dboard_base(args){
//set the gpio directions and atr controls (identically)
this->get_iface()->set_pin_ctrl(dboard_iface::UNIT_RX, 0x0); // All unused in atr
- this->get_iface()->set_gpio_ddr(dboard_iface::UNIT_RX, 0x0); // All Inputs
+ if (this->get_iface()->get_special_props().soft_clock_divider){
+ this->get_iface()->set_gpio_ddr(dboard_iface::UNIT_RX, 0x1); // GPIO0 is clock
+ }
+ else{
+ this->get_iface()->set_gpio_ddr(dboard_iface::UNIT_RX, 0x0); // All Inputs
+ }
//send initial register settings
this->send_reg(0x0, 0x5);
diff --git a/host/lib/usrp/misc_utils.cpp b/host/lib/usrp/misc_utils.cpp
index a1664d810..5cfcdc8d3 100644
--- a/host/lib/usrp/misc_utils.cpp
+++ b/host/lib/usrp/misc_utils.cpp
@@ -164,13 +164,22 @@ static void verify_xx_subdev_spec(
//empty db name means select dboard automatically
if (pair.db_name.empty()){
if (dboard_names.size() != 1) throw std::runtime_error(
- "A daughterboard name must be provided for multi-slot boards: " + subdev_spec.to_string()
+ "A daughterboard name must be provided for multi-slot motherboards: " + subdev_spec.to_string()
);
pair.db_name == dboard_names.front();
}
uhd::assert_has(dboard_names, pair.db_name, xx_type + " dboard name");
wax::obj dboard = mboard[named_prop_t(dboard_prop, pair.db_name)];
- uhd::assert_has(dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>(), pair.sd_name, xx_type + " subdev name");
+ prop_names_t subdev_names = dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>();
+
+ //empty sd name means select the subdev automatically
+ if (pair.sd_name.empty()){
+ if (subdev_names.size() != 1) throw std::runtime_error(
+ "A subdevice name must be provided for multi-subdev daughterboards: " + subdev_spec.to_string()
+ );
+ pair.sd_name == subdev_names.front();
+ }
+ uhd::assert_has(subdev_names, pair.sd_name, xx_type + " subdev name");
}
}catch(const std::exception &e){
throw std::runtime_error(str(boost::format(
diff --git a/host/lib/usrp/usrp1/dboard_iface.cpp b/host/lib/usrp/usrp1/dboard_iface.cpp
index b2221e221..4791b55ce 100644
--- a/host/lib/usrp/usrp1/dboard_iface.cpp
+++ b/host/lib/usrp/usrp1/dboard_iface.cpp
@@ -49,8 +49,8 @@ public:
_codec = codec;
//init the clock rate shadows
- this->set_clock_rate(UNIT_RX, _clock->get_master_clock_freq());
- this->set_clock_rate(UNIT_TX, _clock->get_master_clock_freq());
+ this->set_clock_rate(UNIT_RX, this->get_clock_rates(UNIT_RX).front());
+ this->set_clock_rate(UNIT_TX, this->get_clock_rates(UNIT_TX).front());
}
~usrp1_dboard_iface()
@@ -134,7 +134,7 @@ void usrp1_dboard_iface::set_clock_rate(unit_t unit, double rate)
_clock_rates[unit] = rate;
if (unit == UNIT_RX && _rx_dboard_id == dbsrx_classic_id){
- size_t divider = size_t(rate/_clock->get_master_clock_freq());
+ size_t divider = size_t(_clock->get_master_clock_freq()/rate);
switch(_dboard_slot){
case usrp1_impl::DBOARD_SLOT_A:
_iface->poke32(FR_RX_A_REFCLK, (divider & 0x7f) | 0x80);
diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp
index 920c47b30..92e8bc20a 100644
--- a/host/lib/usrp/usrp1/io_impl.cpp
+++ b/host/lib/usrp/usrp1/io_impl.cpp
@@ -189,7 +189,7 @@ bool usrp1_impl::io_impl::check_underrun(usrp_ctrl::sptr ctrl_if,
if (ret < 0)
std::cerr << "USRP: underrun check failed" << std::endl;
if (underrun)
- std::cerr << "Uu";
+ std::cerr << "U" << std::flush;
send_state.underrun_poll_samp_count = 0;
}
@@ -289,7 +289,7 @@ bool usrp1_impl::io_impl::check_overrun(usrp_ctrl::sptr ctrl_if,
if (ret < 0)
std::cerr << "USRP: overrrun check failed" << std::endl;
if (overrun)
- std::cerr << "Oo";
+ std::cerr << "O" << std::flush;
recv_state.overrun_poll_samp_count = 0;
}
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index 8ad148274..a18b697fb 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -21,6 +21,8 @@
#include "usrp_spi_defs.h"
#include <uhd/transport/usb_control.hpp>
#include <uhd/usrp/device_props.hpp>
+#include <uhd/usrp/mboard_props.hpp>
+#include <uhd/utils/warning.hpp>
#include <uhd/utils/assert.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/images.hpp>
@@ -54,9 +56,19 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
if (hint.has_key("type") and hint["type"] != "usrp1") return usrp1_addrs;
//extract the firmware path for the USRP1
- std::string usrp1_fw_image = find_image_path(
- hint.has_key("fw")? hint["fw"] : "usrp1_fw.ihx"
- );
+ std::string usrp1_fw_image;
+ try{
+ usrp1_fw_image = find_image_path(
+ hint.has_key("fw")? hint["fw"] : "usrp1_fw.ihx"
+ );
+ }
+ catch(const std::exception &e){
+ uhd::print_warning(
+ "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;
@@ -173,6 +185,10 @@ usrp1_impl::usrp1_impl(uhd::transport::usb_zero_copy::sptr data_transport,
//turn on the transmitter
_ctrl_transport->usrp_tx_enable(true);
+
+ //init the subdev specs
+ this->mboard_set(MBOARD_PROP_RX_SUBDEV_SPEC, subdev_spec_t());
+ this->mboard_set(MBOARD_PROP_TX_SUBDEV_SPEC, subdev_spec_t());
}
usrp1_impl::~usrp1_impl(void){
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index 9e29edd82..4e883cf81 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -113,7 +113,7 @@ void usrp2_impl::io_impl::recv_pirate_loop(
metadata.event_code = vrt_packet_handler::get_context_code<async_metadata_t::event_code_t>(vrt_hdr, if_packet_info);
//print the famous U, and push the metadata into the message queue
- if (metadata.event_code & underflow_flags) std::cerr << "U";
+ if (metadata.event_code & underflow_flags) std::cerr << "U" << std::flush;
async_msg_fifo->push_with_pop_on_full(metadata);
continue;
}
@@ -121,7 +121,7 @@ void usrp2_impl::io_impl::recv_pirate_loop(
//handle the packet count / sequence number
if (if_packet_info.packet_count != next_packet_seq){
//std::cerr << "S" << (if_packet_info.packet_count - next_packet_seq)%16;
- std::cerr << "O"; //report overflow (drops in the kernel)
+ std::cerr << "O" << std::flush; //report overflow (drops in the kernel)
}
next_packet_seq = (if_packet_info.packet_count+1)%16;
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index d5785f326..0b9f8ee83 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -69,6 +69,11 @@ usrp2_mboard_impl::usrp2_mboard_impl(
_allowed_decim_and_interp_rates.push_back(i);
}
+ //Issue a stop streaming command (in case it was left running).
+ //Since this command is issued before the networking is setup,
+ //most if not all junk packets will never make it to the socket.
+ this->issue_ddc_stream_cmd(stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
+
//init the rx control registers
_iface->poke32(U2_REG_RX_CTRL_NSAMPS_PER_PKT, _io_helper.get_max_recv_samps_per_packet());
_iface->poke32(U2_REG_RX_CTRL_NCHANNELS, 1);
@@ -107,11 +112,6 @@ usrp2_mboard_impl::usrp2_mboard_impl(
//set default subdev specs
(*this)[MBOARD_PROP_RX_SUBDEV_SPEC] = subdev_spec_t();
(*this)[MBOARD_PROP_TX_SUBDEV_SPEC] = subdev_spec_t();
-
- //Issue a stop streaming command (in case it was left running).
- //Since this command is issued before the networking is setup,
- //most if not all junk packets will never make it to the socket.
- this->issue_ddc_stream_cmd(stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
}
usrp2_mboard_impl::~usrp2_mboard_impl(void){