[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9752 - gnuradio/branches/developers/eb/cppdb-wip/usrp
From: |
eb |
Subject: |
[Commit-gnuradio] r9752 - gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy |
Date: |
Wed, 8 Oct 2008 15:53:44 -0600 (MDT) |
Author: eb
Date: 2008-10-08 15:53:42 -0600 (Wed, 08 Oct 2008)
New Revision: 9752
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.h
Log:
more work-in-progress on cppdb. Made db_base abstract, some return
values changed.
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
2008-10-08 20:17:18 UTC (rev 9751)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
2008-10-08 21:53:42 UTC (rev 9752)
@@ -113,11 +113,12 @@
db_flexrf_mimo.cc \
db_dbs_rx.cc \
db_xcvr2450.cc \
- db_wbx.cc \
db_dtt754.cc \
db_dtt768.cc
+# db_wbx.cc
+
if FUSB_TECH_generic
libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(generic_CODE)
endif
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
2008-10-08 20:17:18 UTC (rev 9751)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
2008-10-08 21:53:42 UTC (rev 9752)
@@ -37,11 +37,9 @@
db_base::db_base(usrp_basic *usrp, int which, bool tx)
+ : d_usrp(usrp), d_which(which), d_tx(tx),
+ d_lo_offset(0.0)
{
- d_which = which;
- d_tx = tx;
- d_usrp = usrp;
-
if(d_tx) {
d_slot = d_which * 2;
}
@@ -81,21 +79,25 @@
// Function to bypass ADC buffers. Any board which is DC-coupled
// should bypass the buffers
-void
+
+bool
db_base::bypass_adc_buffers(bool bypass)
{
if(d_tx) {
throw std::runtime_error("TX Board has no adc buffers\n");
}
+
+ bool ok = true;
if(d_which==0) {
- d_usrp->set_adc_buffer_bypass(0, bypass);
- d_usrp->set_adc_buffer_bypass(1, bypass);
+ ok &= d_usrp->set_adc_buffer_bypass(0, bypass);
+ ok &= d_usrp->set_adc_buffer_bypass(1, bypass);
}
else {
- d_usrp->set_adc_buffer_bypass(2, bypass);
- d_usrp->set_adc_buffer_bypass(3, bypass);
+ ok &= d_usrp->set_adc_buffer_bypass(2, bypass);
+ ok &= d_usrp->set_adc_buffer_bypass(3, bypass);
}
+ return ok;
}
bool
@@ -161,46 +163,7 @@
throw std::runtime_error("set_freq() called from base class\n");
}
-
-float
-db_base::gain_min()
-{
- throw std::runtime_error("gain_min() called from base class\n");
-}
-
-float
-db_base::gain_max()
-{
- throw std::runtime_error("gain_max() called from base class\n");
-}
-
-float
-db_base::gain_db_per_step()
-{
- throw std::runtime_error("gain_db_per_step() called from base class\n");
-}
-
-bool
-db_base::set_gain(float gain)
-{
- // Set the gain.
- //
- // @param gain: gain in decibels
- // @returns True/False
- throw std::runtime_error("set_gain() called from base class\n");
-}
-
-bool
-db_base::is_quadrature()
-{
- // Return True if this daughterboard does quadrature up or down conversion.
- // That is, return True if this board requires both I & Q analog channels.
- //
- // This bit of info is useful when setting up the USRP Rx mux register.
- throw std::runtime_error("is_quadrature() called from base class\n");
-}
-
-bool
+bool
db_base::i_and_q_swapped()
{
// Return True if this is a quadrature device and (for RX) ADC 0 is Q
@@ -216,43 +179,41 @@
return false;
}
-void
+bool
db_base::set_enable(bool on)
{
// For tx daughterboards, this controls the transmitter enable.
+
+ return true; // default is nop
}
-void
+bool
db_base::set_auto_tr(bool on)
{
// Enable automatic Transmit/Receive switching (ATR).
//
// Should be overridden in subclasses that care. This will typically
// set the atr_mask, txval and rxval.
+
+ return true;
}
-void
+bool
db_base::set_lo_offset(double offset)
{
// Set how much LO is offset from requested frequency
- //
- // Should be overriden by daughterboards that care.
-}
-double
-db_base::lo_offset()
-{
- // Get how much LO is offset from requested frequency
- //
- // Should be overriden by daughterboards that care.
- return 0.0;
+ d_lo_offset = offset;
+ return true;
}
-void
+bool
db_base::select_rx_antenna(int which_antenna)
{
// Specify which antenna port to use for reception.
// Should be overriden by daughterboards that care.
+
+ return which_antenna == 0;
}
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
2008-10-08 20:17:18 UTC (rev 9751)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
2008-10-08 21:53:42 UTC (rev 9752)
@@ -30,7 +30,6 @@
#include <usrp_spi_defs.h>
#include <usrp_standard.h>
-#define NUM_DAUGHTERBOARDS 1
class tune_result
{
@@ -64,31 +63,31 @@
std::string name();
std::string side_and_name();
- void bypass_adc_buffers(bool bypass);
+ bool bypass_adc_buffers(bool bypass);
bool set_atr_mask(int v);
bool set_atr_txval(int v);
bool set_atr_rxval(int v);
bool set_atr_tx_delay(int v);
bool set_atr_rx_delay(int v);
+ bool set_lo_offset(double offset);
+ double lo_offset() { return d_lo_offset; }
////////////////////////////////////////////////////////
// derived classes should override the following methods
- virtual float gain_min();
- virtual float gain_max();
- virtual float gain_db_per_step();
- virtual double freq_min();
- virtual double freq_max();
- virtual struct freq_result_t set_freq(double target_freq);
- virtual bool set_gain(float gain);
- virtual bool is_quadrature();
+ virtual float gain_min() = 0;
+ virtual float gain_max() = 0;
+ virtual float gain_db_per_step() = 0;
+ virtual double freq_min() = 0;
+ virtual double freq_max() = 0;
+ virtual struct freq_result_t set_freq(double target_freq) = 0;
+ virtual bool set_gain(float gain) = 0;
+ virtual bool is_quadrature() = 0;
virtual bool i_and_q_swapped();
virtual bool spectrum_inverted();
- virtual void set_enable(bool on);
- virtual void set_auto_tr(bool on);
- virtual void set_lo_offset(double offset);
- virtual double lo_offset();
- virtual void select_rx_antenna(int which_antenna);
+ virtual bool set_enable(bool on);
+ virtual bool set_auto_tr(bool on);
+ virtual bool select_rx_antenna(int which_antenna);
// FIXME tune shouldn't be a method of db_base
// tune_result tune(int chan, double target_freq);
@@ -103,8 +102,9 @@
usrp_basic *d_usrp;
int d_which;
bool d_tx;
+ int d_slot;
int d_refclk_reg;
- int d_slot;
+ double d_lo_offset;
};
#endif
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.cc
2008-10-08 20:17:18 UTC (rev 9751)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.cc
2008-10-08 21:53:42 UTC (rev 9752)
@@ -169,12 +169,14 @@
db.push_back(db_base_sptr(new db_xcvr2450_rx(usrp, which_side)));
break;
+#if 0 // FIXME wbx doesn't compile
case(USRP_DBID_WBX_LO_TX):
db.push_back(db_base_sptr(new db_wbx_lo_tx(usrp, which_side)));
break;
case(USRP_DBID_WBX_LO_RX):
db.push_back(db_base_sptr(new db_wbx_lo_rx(usrp, which_side)));
break;
+#endif
case(USRP_DBID_DTT754):
db.push_back(db_base_sptr(new db_dtt754(usrp, which_side)));
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
2008-10-08 20:17:18 UTC (rev 9751)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
2008-10-08 21:53:42 UTC (rev 9752)
@@ -286,28 +286,6 @@
return true;
}
-void
-flexrf_base::set_lo_offset(double offset)
-{
- /*
- Set amount by which LO is offset from requested tuning frequency.
-
- @param offset: offset in Hz
- */
- d_lo_offset = offset;
-}
-
-double
-flexrf_base::lo_offset()
-{
- /*
- Get amount by which LO is offset from requested tuning frequency.
-
- @returns Offset in Hz
- */
- return d_lo_offset;
-}
-
// ----------------------------------------------------------------
flexrf_base_tx::flexrf_base_tx(usrp_basic *usrp, int which, int _power_on)
@@ -347,22 +325,24 @@
set_auto_tr(false);
}
-void
+bool
flexrf_base_tx::set_auto_tr(bool on)
{
+ bool ok = true;
if(on) {
- set_atr_mask (RX_TXN | ENABLE);
- set_atr_txval(0 | ENABLE);
- set_atr_rxval(RX_TXN | 0);
+ ok &= set_atr_mask (RX_TXN | ENABLE);
+ ok &= set_atr_txval(0 | ENABLE);
+ ok &= set_atr_rxval(RX_TXN | 0);
}
else {
- set_atr_mask (0);
- set_atr_txval(0);
- set_atr_rxval(0);
+ ok &= set_atr_mask (0);
+ ok &= set_atr_txval(0);
+ ok &= set_atr_rxval(0);
}
+ return ok;
}
-void
+bool
flexrf_base_tx::set_enable(bool on)
{
/*
@@ -377,7 +357,7 @@
else {
v = RX_TXN;
}
- d_usrp->write_io(d_which, v, mask);
+ return d_usrp->write_io(d_which, v, mask);
}
float
@@ -458,23 +438,24 @@
}
-
-void
+bool
flexrf_base_rx::set_auto_tr(bool on)
{
+ bool ok = true;
if(on) {
- set_atr_mask (ENABLE);
- set_atr_txval( 0);
- set_atr_rxval(ENABLE);
+ ok &= set_atr_mask (ENABLE);
+ ok &= set_atr_txval( 0);
+ ok &= set_atr_rxval(ENABLE);
}
else {
- set_atr_mask (0);
- set_atr_txval(0);
- set_atr_rxval(0);
+ ok &= set_atr_mask (0);
+ ok &= set_atr_txval(0);
+ ok &= set_atr_rxval(0);
}
+ return true;
}
-void
+bool
flexrf_base_rx::select_rx_antenna(int which_antenna)
{
/*
@@ -489,11 +470,13 @@
d_usrp->write_io(d_which, RX2_RX1N, RX2_RX1N);
}
else {
- throw std::invalid_argument("which_antenna must be either 'TX/RX' or
'RX2'\n");
+ return false;
+ // throw std::invalid_argument("which_antenna must be either 'TX/RX' or
'RX2'\n");
}
+ return true;
}
-void
+bool
flexrf_base_rx::select_rx_antenna(const std::string &which_antenna)
{
/*
@@ -508,8 +491,10 @@
d_usrp->write_io(d_which, RX2_RX1N, RX2_RX1N);
}
else {
- throw std::invalid_argument("which_antenna must be either 'TX/RX' or
'RX2'\n");
+ // throw std::invalid_argument("which_antenna must be either 'TX/RX' or
'RX2'\n");
+ return false;
}
+ return true;
}
bool
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h
2008-10-08 20:17:18 UTC (rev 9751)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.h
2008-10-08 21:53:42 UTC (rev 9752)
@@ -42,8 +42,6 @@
float gain_db_per_step();
bool set_gain(float gain);
bool is_quadrature();
- double lo_offset();
- void set_lo_offset(double offset);
protected:
void _write_all(int R, int control, int N);
@@ -64,7 +62,6 @@
int power_on() { return d_power_on; }
int power_off() { return 0; }
- double d_lo_offset;
bool d_first;
int d_spi_format;
int d_spi_enable;
@@ -82,11 +79,12 @@
flexrf_base_tx(usrp_basic *usrp, int which, int _power_on=0);
~flexrf_base_tx();
- void set_auto_tr(bool on);
- void set_enable(bool on);
float gain_min();
float gain_max();
float gain_db_per_step();
+
+ bool set_auto_tr(bool on);
+ bool set_enable(bool on);
bool set_gain(float gain);
protected:
@@ -99,9 +97,9 @@
flexrf_base_rx(usrp_basic *usrp, int which, int _power_on=0);
~flexrf_base_rx();
- void set_auto_tr(bool on);
- void select_rx_antenna(int which_antenna);
- void select_rx_antenna(const std::string &which_antenna);
+ bool set_auto_tr(bool on);
+ bool select_rx_antenna(int which_antenna);
+ bool select_rx_antenna(const std::string &which_antenna);
bool set_gain(float gain);
protected:
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.h
2008-10-08 20:17:18 UTC (rev 9751)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.h
2008-10-08 21:53:42 UTC (rev 9752)
@@ -87,10 +87,8 @@
wbx_base_tx(usrp_basic *usrp, int which);
~wbx_base_tx();
- void set_auto_tr(bool on);
- void set_enable(bool on);
- void set_lo_offset(double offset);
- double lo_offset();
+ bool set_auto_tr(bool on);
+ bool set_enable(bool on);
};
@@ -103,12 +101,10 @@
wbx_base_rx(usrp_basic *usrp, int which);
~wbx_base_rx();
- void set_auto_tr(bool on);
- void select_rx_antenna(int which_antenna);
- void select_rx_antenna(const std::string &which_antenna);
+ bool set_auto_tr(bool on);
+ bool select_rx_antenna(int which_antenna);
+ bool select_rx_antenna(const std::string &which_antenna);
bool set_gain(float gain);
- void set_lo_offset(double offset);
- double lo_offset();
bool i_and_q_swapped();
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9752 - gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy,
eb <=