aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-09-29 18:27:08 -0700
committerNick Foster <nick@nerdnetworks.org>2010-09-29 18:27:08 -0700
commit56751efbe6e0751a2b8cd0f7a31d5dfd07fec5dd (patch)
treec0276e51f4ba46193dbddf3e1441787d918d7681
parent9c58df56e805cc924aef980f466cd45a42b2d1a4 (diff)
downloaduhd-56751efbe6e0751a2b8cd0f7a31d5dfd07fec5dd.tar.gz
uhd-56751efbe6e0751a2b8cd0f7a31d5dfd07fec5dd.tar.bz2
uhd-56751efbe6e0751a2b8cd0f7a31d5dfd07fec5dd.zip
TVRX: works for USRP and USRP2.
-rw-r--r--host/lib/usrp/dboard/db_tvrx.cpp11
-rw-r--r--host/lib/usrp/usrp1/codec_ctrl.cpp3
-rw-r--r--host/lib/usrp/usrp1/dboard_iface.cpp6
3 files changed, 18 insertions, 2 deletions
diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp
index 71aff1680..6b71a3c6e 100644
--- a/host/lib/usrp/dboard/db_tvrx.cpp
+++ b/host/lib/usrp/dboard/db_tvrx.cpp
@@ -377,6 +377,7 @@ void tvrx::set_freq(double freq) {
**********************************************************************/
void tvrx::rx_get(const wax::obj &key_, wax::obj &val){
named_prop_t key = named_prop_t::extract(key_);
+ int codec_rate;
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -403,7 +404,15 @@ void tvrx::rx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_FREQ:
- val = _lo_freq;
+ /*
+ * so here we have to do some magic. because the TVRX uses a relatively high IF,
+ * we have to watch the sample rate to see if the IF will be aliased
+ * or if it will fall within Nyquist.
+ */
+ codec_rate = this->get_iface()->get_codec_rate(dboard_iface::UNIT_RX);
+ if(codec_rate/2 > tvrx_if_freq) val = _lo_freq;
+ //ok take a deep breath i am positive there is an easier way to get this number
+ else val = _lo_freq - tvrx_if_freq - (tvrx_if_freq-codec_rate)*int(tvrx_if_freq / (codec_rate/2));
return;
case SUBDEV_PROP_FREQ_RANGE:
diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp
index 33b18b196..4aa730573 100644
--- a/host/lib/usrp/usrp1/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp1/codec_ctrl.cpp
@@ -423,7 +423,8 @@ void usrp1_codec_ctrl_impl::set_duc_freq(double freq)
/***********************************************************************
* Codec Control ADC buffer bypass
- * Enable this for DC-coupled daughterboards (TVRX)
+ * Disable this for AC-coupled daughterboards (TVRX)
+ * By default it is initialized TRUE.
**********************************************************************/
void usrp1_codec_ctrl_impl::bypass_adc_buffers(bool bypass) {
_ad9862_regs.byp_buffer_a = bypass;
diff --git a/host/lib/usrp/usrp1/dboard_iface.cpp b/host/lib/usrp/usrp1/dboard_iface.cpp
index 4f0549a37..1ac15a46a 100644
--- a/host/lib/usrp/usrp1/dboard_iface.cpp
+++ b/host/lib/usrp/usrp1/dboard_iface.cpp
@@ -32,6 +32,8 @@ using namespace uhd;
using namespace uhd::usrp;
using namespace boost::assign;
+static const dboard_id_t tvrx_id(0x0040);
+
class usrp1_dboard_iface : public dboard_iface {
public:
@@ -51,6 +53,10 @@ public:
//init the clock rate shadows
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());
+
+ //yes this is evil but it's necessary for TVRX to work on USRP1
+ if(_rx_dboard_id == tvrx_id) _codec->bypass_adc_buffers(false);
+ //else _codec->bypass_adc_buffers(false); //don't think this is necessary
}
~usrp1_dboard_iface()