aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/lib/convert/gen_convert_general.py19
-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
5 files changed, 14 insertions, 34 deletions
diff --git a/host/lib/convert/gen_convert_general.py b/host/lib/convert/gen_convert_general.py
index a5c4d4cb7..0cd4155fa 100644
--- a/host/lib/convert/gen_convert_general.py
+++ b/host/lib/convert/gen_convert_general.py
@@ -84,25 +84,6 @@ DECLARE_CONVERTER(sc16_item16_usrp1, 1, $(cpu_type), $(width), PRIORITY_GENERAL)
}
}
-DECLARE_CONVERTER($(cpu_type), $(width), sc8_item16_usrp1, 1, PRIORITY_GENERAL){
- #for $w in range($width)
- const $(cpu_type)_t *input$(w) = reinterpret_cast<const $(cpu_type)_t *>(inputs[$(w)]);
- #end for
- boost::uint16_t *output = reinterpret_cast<boost::uint16_t *>(outputs[0]);
-
- if (scale_factor == 0){} //avoids unused warning
-
- for (size_t i = 0, j = 0; i < nsamps; i++){
- #for $w in range($width)
- {
- const boost::uint8_t real = boost::int8_t(input$(w)[i].real()$(do_scale));
- const boost::uint8_t imag = boost::int8_t(input$(w)[i].imag()$(do_scale));
- output[j++] = $(to_wire)((boost::uint16_t(imag) << 8) | real);
- }
- #end for
- }
-}
-
DECLARE_CONVERTER(sc8_item16_usrp1, 1, $(cpu_type), $(width), PRIORITY_GENERAL){
const boost::uint16_t *input = reinterpret_cast<const boost::uint16_t *>(inputs[0]);
#for $w in range($width)
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