[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9258 - gnuradio/branches/developers/trondeau/dbs/usrp
From: |
trondeau |
Subject: |
[Commit-gnuradio] r9258 - gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy |
Date: |
Tue, 12 Aug 2008 15:08:53 -0600 (MDT) |
Author: trondeau
Date: 2008-08-12 15:08:52 -0600 (Tue, 12 Aug 2008)
New Revision: 9258
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.cc
Log:
wip: fixed power-up issue for RFX400. DB code mostly working. Lots of cleanup
here.
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
2008-08-12 20:02:35 UTC (rev 9257)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
2008-08-12 21:08:52 UTC (rev 9258)
@@ -41,8 +41,6 @@
d_which = which;
d_tx = tx;
d_usrp = usrp;
-
- printf("Creating db_base usrp_basic usrp: %p\n", d_usrp);
}
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.cc
2008-08-12 20:02:35 UTC (rev 9257)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.cc
2008-08-12 21:08:52 UTC (rev 9258)
@@ -32,8 +32,6 @@
{
std::vector<db_base_sptr> db;
- printf("instantiating DB with dbid: %d\n", dbid);
-
switch(dbid) {
case(USRP_DBID_BASIC_TX):
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc
2008-08-12 20:02:35 UTC (rev 9257)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc
2008-08-12 21:08:52 UTC (rev 9258)
@@ -24,8 +24,8 @@
#include <stdexcept>
-flexrf_base::flexrf_base(usrp_basic *usrp, int which)
- : db_base(usrp, which)
+flexrf_base::flexrf_base(usrp_basic *usrp, int which, int _power_on)
+ : db_base(usrp, which), d_power_on(_power_on)
{
/*
@param usrp: instance of usrp.source_c
@@ -33,8 +33,6 @@
@type which: int
*/
- printf("flexrf_base::flexrf_base\n");
-
d_first = true;
d_spi_format = SPI_FMT_MSB | SPI_FMT_HDR_0;
@@ -60,7 +58,7 @@
flexrf_base::~flexrf_base()
{
- d_usrp->write_io(d_which, d_power_off, POWER_UP); // turn off power to
board
+ d_usrp->write_io(d_which, power_off(), POWER_UP); // turn off power to
board
// Power down VCO/PLL
d_PD = 3;
@@ -126,11 +124,6 @@
s[1] = (char)((v >> 8) & 0xff);
s[2] = (char)(v & 0xff);
std::string str(s, 3);
- printf("s[0]: %d s[1]: %d s[2]: %d\n",
- ((v >> 16) & 0xff),
- ((v >> 8) & 0xff),
- (v & 0xff));
- printf("spi_enable: %d spi_format: %d\n", d_spi_enable, d_spi_format);
d_usrp->_write_spi(0, d_spi_enable, d_spi_format, str);
}
@@ -148,7 +141,7 @@
// FIXME: make portable sleep
timespec t;
t.tv_sec = 0;
- t.tv_nsec = 10000000;
+ t.tv_nsec = 100000000;
nanosleep(&t, NULL);
if(d_usrp->read_io(d_which) & PLL_LOCK_DETECT) {
@@ -303,8 +296,8 @@
// ----------------------------------------------------------------
-flexrf_base_tx::flexrf_base_tx(usrp_basic *usrp, int which)
- : flexrf_base(usrp, which)
+flexrf_base_tx::flexrf_base_tx(usrp_basic *usrp, int which, int _power_on)
+ : flexrf_base(usrp, which, _power_on)
{
/*
@param usrp: instance of usrp.sink_c
@@ -321,14 +314,14 @@
// power up the transmit side, but don't enable the mixer
d_usrp->_write_oe(d_which,(POWER_UP|RX_TXN|ENABLE), 0xffff);
- d_usrp->write_io(d_which, (d_power_on|RX_TXN), (POWER_UP|RX_TXN|ENABLE));
+ d_usrp->write_io(d_which, (power_on()|RX_TXN), (POWER_UP|RX_TXN|ENABLE));
set_lo_offset(4e6);
}
flexrf_base_tx::~flexrf_base_tx()
{
// Power down and leave the T/R switch in the R position
- d_usrp->write_io(d_which, (d_power_off|RX_TXN), (POWER_UP|RX_TXN|ENABLE));
+ d_usrp->write_io(d_which, (power_off()|RX_TXN), (POWER_UP|RX_TXN|ENABLE));
}
void
@@ -398,8 +391,8 @@
/******************************************************************************/
-flexrf_base_rx::flexrf_base_rx(usrp_basic *usrp, int which)
- : flexrf_base(usrp, which)
+flexrf_base_rx::flexrf_base_rx(usrp_basic *usrp, int which, int _power_on)
+ : flexrf_base(usrp, which, _power_on)
{
/*
@param usrp: instance of usrp.source_c
@@ -415,9 +408,10 @@
else {
d_spi_enable = SPI_ENABLE_RX_B;
}
-
+
d_usrp->_write_oe(d_which, (POWER_UP|RX2_RX1N|ENABLE), 0xffff);
- d_usrp->write_io(d_which, (d_power_on|RX2_RX1N|ENABLE),
(POWER_UP|RX2_RX1N|ENABLE));
+ d_usrp->write_io(d_which, (power_on()|RX2_RX1N|ENABLE),
(POWER_UP|RX2_RX1N|ENABLE));
+ //d_usrp->write_io(d_which, (POWER_UP|RX2_RX1N|ENABLE),
(POWER_UP|RX2_RX1N|ENABLE));
// set up for RX on TX/RX port
select_rx_antenna("TX/RX");
@@ -430,9 +424,11 @@
flexrf_base_rx::~flexrf_base_rx()
{
// Power down
- d_usrp->write_io(d_which, d_power_off, (POWER_UP|ENABLE));
+ d_usrp->write_io(d_which, power_off(), (POWER_UP|ENABLE));
}
-
+
+
+
void
flexrf_base_rx::set_auto_tr(bool on)
{
@@ -482,9 +478,7 @@
d_usrp->write_io(d_which, RX2_RX1N, RX2_RX1N);
}
else {
- //raise ValueError, "which_antenna must be either 'TX/RX' or 'RX2'";
- printf("which_antenna must be either 'TX/RX' or 'RX2'\n");
- throw 0;
+ throw std::invalid_argument("which_antenna must be either 'TX/RX' or
'RX2'\n");
}
}
@@ -529,8 +523,6 @@
_AD4360_common::_AD4360_common(bool tx)
: d_tx(tx)
{
- printf("_AD4360_common::_AD4360_common\n");
-
// R-Register Common Values
d_R_RSV = 0; // bits 23,22
d_BSC = 3; // bits 21,20 Div by 8 to be safe
@@ -592,7 +584,6 @@
int R = (d_R_RSV<<22) | (d_BSC<<20) | (d_TEST<<19) |
(d_LDP<<18) | (d_ABP<<16) | (d_R_DIV<<2);
- printf("computing control reg\n");
int control = _compute_control_reg();
int N = (d_DIVSEL<<23) | (d_DIV2<<22) | (d_CPGAIN<<21) |
@@ -612,7 +603,6 @@
| (d_MTLD<<11) | (d_CPG<<10) | (d_CP3S<<9) | (d_PDP<<8) |
(d_MUXOUT<<5) | (d_CR<<4) | (d_PC<<2);
- printf("_AD4360_common::_compute_control_reg\n");
return control;
}
@@ -823,11 +813,6 @@
: flexrf_base_tx(usrp, which)
{
d_common = new _2400_common(d_tx);
-
- d_power_on = 0;
- d_power_off = 0; // powering it off kills the serial bus
-
- printf("built RFX2400tx\n");
}
db_flexrf_2400_tx::~db_flexrf_2400_tx()
@@ -850,7 +835,6 @@
bool
db_flexrf_2400_tx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- printf("db_flexrf_2400_tx::_compute_regs\n");
return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
@@ -860,9 +844,6 @@
: flexrf_base_rx(usrp, which)
{
d_common = new _2400_common(d_tx);
- d_power_on = 0;
- d_power_off = 0; // Powering it off kills the serial bus
- printf("built RFX2400rx\n");
}
db_flexrf_2400_rx::~db_flexrf_2400_rx()
@@ -910,14 +891,12 @@
bool
db_flexrf_2400_rx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- printf("db_flexrf_2400_rx::_compute_regs\n");
return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
int
db_flexrf_2400_rx::_compute_control_reg()
{
- printf("db_flexrf_2400_rx::_compute_control_reg\n");
return d_common->_compute_control_reg();
}
@@ -935,8 +914,6 @@
: flexrf_base_tx(usrp, which)
{
d_common = new _1200_common(d_tx);
- d_power_on = 0;
- d_power_off = 0; // powering it off kills the serial bus
}
db_flexrf_1200_tx::~db_flexrf_1200_tx()
@@ -969,8 +946,6 @@
: flexrf_base_rx(usrp, which)
{
d_common = new _1200_common(d_tx);
- d_power_on = 0;
- d_power_off = 0; // Powering it off kills the serial bus
}
db_flexrf_1200_rx::~db_flexrf_1200_rx()
@@ -1023,7 +998,6 @@
int
db_flexrf_1200_rx::_compute_control_reg()
{
- printf("db_flexrf_1200_rx::_compute_control_reg\n");
return d_common->_compute_control_reg();
}
@@ -1041,8 +1015,6 @@
: flexrf_base_tx(usrp, which)
{
d_common = new _1800_common(d_tx);
- d_power_on = 0;
- d_power_off = 0; // powering it off kills the serial bus
}
db_flexrf_1800_tx::~db_flexrf_1800_tx()
@@ -1074,8 +1046,6 @@
: flexrf_base_rx(usrp, which)
{
d_common = new _1800_common(d_tx);
- d_power_on = 0;
- d_power_off = 0; // Powering it off kills the serial bus
}
db_flexrf_1800_rx::~db_flexrf_1800_rx()
@@ -1129,7 +1099,6 @@
int
db_flexrf_1800_rx::_compute_control_reg()
{
- printf("db_flexrf_1800_rx::_compute_control_reg\n");
return d_common->_compute_control_reg();
}
@@ -1147,8 +1116,6 @@
: flexrf_base_tx(usrp, which)
{
d_common = new _900_common(d_tx);
- d_power_on = 0;
- d_power_off = 0; // powering it off kills the serial bus
}
db_flexrf_900_tx::~db_flexrf_900_tx()
@@ -1171,7 +1138,6 @@
bool
db_flexrf_900_tx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- printf("db_flexrf_900_tx::_compute_regs\n");
return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
@@ -1180,8 +1146,6 @@
: flexrf_base_rx(usrp, which)
{
d_common = new _900_common(d_tx);
- d_power_on = 0;
- d_power_off = 0; // Powering it off kills the serial bus
}
db_flexrf_900_rx::~db_flexrf_900_rx()
@@ -1228,14 +1192,12 @@
bool
db_flexrf_900_rx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- printf("db_flexrf_900_rx::_compute_regs\n");
return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
int
db_flexrf_900_rx::_compute_control_reg()
{
- printf("db_flexrf_900_rx::_compute_control_reg\n");
return d_common->_compute_control_reg();
}
@@ -1250,13 +1212,9 @@
db_flexrf_400_tx::db_flexrf_400_tx(usrp_basic *usrp, int which)
- : flexrf_base_tx(usrp, which)
+ : flexrf_base_tx(usrp, which, POWER_UP)
{
d_common = new _400_common(d_tx);
- d_power_on = POWER_UP;
- d_power_off = 0; // powering it off kills the serial bus
-
- printf("built RFX400tx\n");
}
db_flexrf_400_tx::~db_flexrf_400_tx()
@@ -1279,22 +1237,15 @@
bool
db_flexrf_400_tx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- printf("db_flexrf_400_tx::_compute_regs\n");
return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
db_flexrf_400_rx::db_flexrf_400_rx(usrp_basic *usrp, int which)
- : flexrf_base_rx(usrp, which)
+ : flexrf_base_rx(usrp, which, POWER_UP)
{
d_common = new _400_common(d_tx);
- d_power_on = POWER_UP;
- d_power_off = 0; // Powering it off kills the serial bus
-
- printf("built RFX400rx\n");
- printf("flexrf_400_rx name: %s\n", name().c_str());
- printf("flexrf_400_rx which: %d\n", d_which);
}
db_flexrf_400_rx::~db_flexrf_400_rx()
@@ -1343,14 +1294,12 @@
bool
db_flexrf_400_rx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- printf("db_flexrf_400_rx::_compute_regs\n");
return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
int
db_flexrf_400_rx::_compute_control_reg()
{
- printf("db_flexrf_400_rx::_compute_control_reg\n");
return d_common->_compute_control_reg();
}
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h
2008-08-12 20:02:35 UTC (rev 9257)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h
2008-08-12 21:08:52 UTC (rev 9258)
@@ -44,7 +44,7 @@
class flexrf_base : public db_base
{
public:
- flexrf_base(usrp_basic *usrp, int which);
+ flexrf_base(usrp_basic *usrp, int which, int _power_on=0);
~flexrf_base();
struct freq_result_t set_freq(float freq);
@@ -70,12 +70,14 @@
bool _set_pga(float pga_gain);
+ int power_on() { return d_power_on; }
+ int power_off() { return 0; }
+
float d_lo_offset;
bool d_first;
int d_spi_format;
int d_spi_enable;
- char d_power_off;
- char d_power_on;
+ int d_power_on;
int d_PD;
};
@@ -84,7 +86,7 @@
class flexrf_base_tx : public flexrf_base
{
public:
- flexrf_base_tx(usrp_basic *usrp, int which);
+ flexrf_base_tx(usrp_basic *usrp, int which, int _power_on=0);
~flexrf_base_tx();
void set_auto_tr(bool on);
@@ -101,7 +103,7 @@
class flexrf_base_rx : public flexrf_base
{
public:
- flexrf_base_rx(usrp_basic *usrp, int which);
+ flexrf_base_rx(usrp_basic *usrp, int which, int _power_on=0);
~flexrf_base_rx();
void set_auto_tr(bool on);
@@ -382,7 +384,7 @@
public:
db_flexrf_400_rx(usrp_basic *usrp, int which);
~db_flexrf_400_rx();
-
+
float gain_min();
float gain_max();
float gain_db_per_step();
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.cc
2008-08-12 20:02:35 UTC (rev 9257)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_tv_rx.cc
2008-08-12 21:08:52 UTC (rev 9258)
@@ -280,7 +280,6 @@
pgagain = gain;
_set_rfagc(rfgain);
- printf("db_tv_rx::set_gain\n");
_set_ifagc(ifgain);
_set_pga(pgagain);
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
===================================================================
---
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
2008-08-12 20:02:35 UTC (rev 9257)
+++
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
2008-08-12 21:08:52 UTC (rev 9258)
@@ -245,9 +245,8 @@
std::vector<db_base_sptr>
usrp_basic::db(int which)
{
- printf("calling db: %s\n", d_db[which][0]->name().c_str());
if(which > 3) {
- throw std::invalid_argument("usrp_standard_commond::db which must be
0, 1, 2, or 3");
+ throw std::invalid_argument("usrp_standard_commond::db which must be 0, 1,
2, or 3");
}
return d_db[which];
}
@@ -629,7 +628,6 @@
bool
usrp_basic::_write_spi (int optional_header, int enables, int format,
std::string buf)
{
- printf("buf length: %d\n", buf.size());
return usrp_spi_write (d_udh, optional_header, enables, format,
buf.data(), buf.size());
}
@@ -690,7 +688,6 @@
int t;
int reg = which_dboard + 1; // FIXME, *very* magic number (fix in
serial_io.v)
bool ok = _read_fpga_reg (reg, &t);
- printf("read_fpga_reg ret: %d\n", ok);
if (!ok)
return false;
@@ -750,8 +747,6 @@
{
// initialize rx specific registers
- printf("usrp_basic_rx::usrp_basic_rx\n");
-
if (!usrp_9862_write_many_all (d_udh, rx_init_regs, sizeof (rx_init_regs))){
fprintf (stderr, "usrp_basic_rx: failed to init AD9862 RX regs\n");
throw std::runtime_error ("usrp_basic_rx/init_9862");
@@ -771,10 +766,7 @@
set_dc_offset_cl_enable(0xf, 0xf); // enable DC offset removal control
loops
- printf("probing rx slots\n");
probe_rx_slots (false);
- printf("rx slot A: %d\n", d_dbid[SLOT_RX_A]);
- printf("rx slot B: %d\n", d_dbid[SLOT_RX_B]);
d_db[SLOT_RX_A] = instantiate_dbs(d_dbid[SLOT_RX_A], this, which_board);
d_db[SLOT_RX_B] = instantiate_dbs(d_dbid[SLOT_RX_B], this, which_board);
@@ -827,7 +819,6 @@
int
usrp_basic_rx::daughterboard_id (int which_dboard) const
{
- printf("called daughterboard_id in usrp_basic_rx with
which_dboard=%d\n",which_dboard);
return common_daughterboard_id(C_RX, which_dboard);
}
@@ -835,10 +826,8 @@
std::vector<db_base_sptr>
usrp_basic_rx::db(int which)
{
- printf("usrp_basic_rx::db which: %d\n", which);
// When called from here, only return if the RX side
if(which == 0) {
- printf(" name: %s\n", d_db[SLOT_RX_A][0]->name().c_str());
return d_db[SLOT_RX_A];
}
else {
@@ -1034,8 +1023,6 @@
static int slot_id_map[2] = { SLOT_RX_A, SLOT_RX_B };
static const char *slot_name[2] = { "RX d'board A", "RX d'board B" };
- printf("usrp_basic_rx::probe_rx_slots\n");
-
for (int i = 0; i < 2; i++){
int slot_id = slot_id_map [i];
const char *msg = 0;
@@ -1074,9 +1061,6 @@
fflush (stdout);
fprintf (stderr, "%s: %s\n", slot_name[i], msg);
}
-
- printf("usrp_basic_rx::probe_rx_slots dbid[%d] = %d\n", slot_id,
d_dbid[slot_id]);
-
}
}
@@ -1176,10 +1160,7 @@
set_fpga_tx_sample_rate_divisor (4); // we're using interp x4
- printf("probing tx slots\n");
probe_tx_slots (false);
- printf("tx slot A: %d\n", d_dbid[SLOT_TX_A]);
- printf("tx slot B: %d\n", d_dbid[SLOT_TX_B]);
d_db[SLOT_TX_A] = instantiate_dbs(d_dbid[SLOT_TX_A], this, which_board);
d_db[SLOT_TX_B] = instantiate_dbs(d_dbid[SLOT_TX_B], this, which_board);
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.cc
===================================================================
---
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.cc
2008-08-12 20:02:35 UTC (rev 9257)
+++
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.cc
2008-08-12 21:08:52 UTC (rev 9258)
@@ -184,8 +184,6 @@
set_rx_freq(i, 0);
set_ddc_phase(i, 0);
}
-
- printf("usrp_standard_rx::usrp_standard_rx\n");
}
usrp_standard_rx::~usrp_standard_rx ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9258 - gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy,
trondeau <=