summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/usrp1')
-rw-r--r--host/lib/usrp/usrp1/io_impl.cpp18
-rw-r--r--host/lib/usrp/usrp1/soft_time_ctrl.cpp7
-rw-r--r--host/lib/usrp/usrp1/soft_time_ctrl.hpp2
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp2
4 files changed, 14 insertions, 15 deletions
diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp
index 7f20a8608..835c78ecc 100644
--- a/host/lib/usrp/usrp1/io_impl.cpp
+++ b/host/lib/usrp/usrp1/io_impl.cpp
@@ -22,6 +22,7 @@
#include "../../transport/super_send_packet_handler.hpp"
#include "usrp1_calc_mux.hpp"
#include "fpga_regs_standard.h"
+#include "fpga_regs_common.h"
#include "usrp_commands.h"
#include "usrp1_impl.hpp"
#include <uhd/utils/msg.hpp>
@@ -367,7 +368,7 @@ public:
const uhd::tx_metadata_t &metadata,
double timeout
){
- if (_stc->send_pre(metadata, timeout)) return 0;
+ _stc->send_pre(metadata, timeout);
_tx_enb_fcn(true); //always enable (it will do the right thing)
size_t num_samps_sent = sph::send_packet_handler::send(
@@ -440,13 +441,14 @@ void usrp1_impl::update_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec){
double usrp1_impl::update_rx_samp_rate(size_t dspno, const double samp_rate){
+ const size_t div = 2;
const size_t rate = uhd::clip<size_t>(
- boost::math::iround(_master_clock_rate / samp_rate), size_t(std::ceil(_master_clock_rate / 16e6)), 256
- );
+ boost::math::iround(_master_clock_rate / samp_rate), 4, 256) & ~(div-1);
if (dspno == 0){ //only care if dsp0 is set since its homogeneous
bool s = this->disable_rx();
- _iface->poke32(FR_DECIM_RATE, rate/2 - 1);
+ _iface->poke32(FR_RX_SAMPLE_RATE_DIV, div - 1);
+ _iface->poke32(FR_DECIM_RATE, rate/div - 1);
this->restore_rx(s);
//update the streamer if created
@@ -462,13 +464,14 @@ double usrp1_impl::update_rx_samp_rate(size_t dspno, const double samp_rate){
double usrp1_impl::update_tx_samp_rate(size_t dspno, const double samp_rate){
+ const size_t div = 2;
const size_t rate = uhd::clip<size_t>(
- boost::math::iround(_master_clock_rate / samp_rate), size_t(std::ceil(_master_clock_rate / 8e6)), 256
- );
+ boost::math::iround(_master_clock_rate / samp_rate), 8, 256) & ~(div-1);
if (dspno == 0){ //only care if dsp0 is set since its homogeneous
bool s = this->disable_tx();
- _iface->poke32(FR_INTERP_RATE, rate/2 - 1);
+ _iface->poke32(FR_TX_SAMPLE_RATE_DIV, div - 1);
+ _iface->poke32(FR_INTERP_RATE, rate/div - 1);
this->restore_tx(s);
//update the streamer if created
@@ -544,7 +547,6 @@ rx_streamer::sptr usrp1_impl::get_rx_stream(const uhd::stream_args_t &args){
| (8 << bmFR_RX_FORMAT_SHIFT_SHIFT)
| (8 << bmFR_RX_FORMAT_WIDTH_SHIFT)
| bmFR_RX_FORMAT_WANT_Q
- | bmFR_RX_FORMAT_BYPASS_HB //needed for 16Msps
);
}
else{
diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.cpp b/host/lib/usrp/usrp1/soft_time_ctrl.cpp
index 78481c3ff..b8af8af06 100644
--- a/host/lib/usrp/usrp1/soft_time_ctrl.cpp
+++ b/host/lib/usrp/usrp1/soft_time_ctrl.cpp
@@ -131,8 +131,8 @@ public:
/*******************************************************************
* Transmit control
******************************************************************/
- bool send_pre(const tx_metadata_t &md, double &timeout){
- if (not md.has_time_spec) return false;
+ void send_pre(const tx_metadata_t &md, double &timeout){
+ if (not md.has_time_spec) return;
boost::mutex::scoped_lock lock(_update_mutex);
@@ -146,12 +146,11 @@ public:
metadata.time_spec = this->time_now();
metadata.event_code = async_metadata_t::EVENT_CODE_TIME_ERROR;
_async_msg_queue.push_with_pop_on_full(metadata);
- return true;
+ return;
}
timeout -= (time_at - time_now()).get_real_secs();
sleep_until_time(lock, time_at);
- return false;
}
/*******************************************************************
diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.hpp b/host/lib/usrp/usrp1/soft_time_ctrl.hpp
index e91aaf6a2..b92b51252 100644
--- a/host/lib/usrp/usrp1/soft_time_ctrl.hpp
+++ b/host/lib/usrp/usrp1/soft_time_ctrl.hpp
@@ -57,7 +57,7 @@ public:
virtual size_t recv_post(rx_metadata_t &md, const size_t nsamps) = 0;
//! Call before the internal send function
- virtual bool send_pre(const tx_metadata_t &md, double &timeout) = 0;
+ virtual void send_pre(const tx_metadata_t &md, double &timeout) = 0;
//! Issue a stream command to receive
virtual void issue_stream_cmd(const stream_cmd_t &cmd) = 0;
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index 93a301c02..108fdc9ac 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -187,8 +187,6 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){
// Normal mode with no loopback or Rx counting
_iface->poke32(FR_MODE, 0x00000000);
_iface->poke32(FR_DEBUG_EN, 0x00000000);
- _iface->poke32(FR_RX_SAMPLE_RATE_DIV, 0x00000001); //divide by 2
- _iface->poke32(FR_TX_SAMPLE_RATE_DIV, 0x00000001); //divide by 2
_iface->poke32(FR_DC_OFFSET_CL_EN, 0x0000000f);
// Reset offset correction registers