summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/dboard')
-rw-r--r--host/lib/usrp/dboard/db_basic_and_lf.cpp12
-rw-r--r--host/lib/usrp/dboard/db_dbsrx.cpp60
-rw-r--r--host/lib/usrp/dboard/db_rfx.cpp26
-rw-r--r--host/lib/usrp/dboard/db_unknown.cpp12
-rw-r--r--host/lib/usrp/dboard/db_wbx.cpp32
-rw-r--r--host/lib/usrp/dboard/db_xcvr2450.cpp32
6 files changed, 68 insertions, 106 deletions
diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp
index 9180828d8..f8236d598 100644
--- a/host/lib/usrp/dboard/db_basic_and_lf.cpp
+++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp
@@ -95,8 +95,7 @@ basic_rx::~basic_rx(void){
}
void basic_rx::rx_get(const wax::obj &key_, wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -161,8 +160,7 @@ void basic_rx::rx_get(const wax::obj &key_, wax::obj &val){
}
void basic_rx::rx_set(const wax::obj &key_, const wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -194,8 +192,7 @@ basic_tx::~basic_tx(void){
}
void basic_tx::tx_get(const wax::obj &key_, wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -252,8 +249,7 @@ void basic_tx::tx_get(const wax::obj &key_, wax::obj &val){
}
void basic_tx::tx_set(const wax::obj &key_, const wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp
index 03e6b6255..06cf91d3b 100644
--- a/host/lib/usrp/dboard/db_dbsrx.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx.cpp
@@ -61,7 +61,7 @@ static const uhd::dict<std::string, gain_range_t> dbsrx_gain_ranges = map_list_o
**********************************************************************/
class dbsrx : public rx_dboard_base{
public:
- dbsrx(ctor_args_t args, boost::uint8_t max2118_addr);
+ dbsrx(ctor_args_t args);
~dbsrx(void);
void rx_get(const wax::obj &key, wax::obj &val);
@@ -73,7 +73,9 @@ private:
uhd::dict<std::string, float> _gains;
max2118_write_regs_t _max2118_write_regs;
max2118_read_regs_t _max2118_read_regs;
- boost::uint8_t _max2118_addr; //0x67 or 0x65 depending on which side
+ boost::uint8_t _max2118_addr(void){
+ return (this->get_iface()->get_special_props().mangle_i2c_addrs)? 0x65 : 0x67;
+ };
void set_lo_freq(double target_freq);
void set_gain(float gain, const std::string &name);
@@ -102,7 +104,7 @@ private:
//send the data
this->get_iface()->write_i2c(
- _max2118_addr, regs_vector
+ _max2118_addr(), regs_vector
);
}
}
@@ -120,7 +122,7 @@ private:
//read from i2c
regs_vector = this->get_iface()->read_i2c(
- _max2118_addr, num_bytes
+ _max2118_addr(), num_bytes
);
for(boost::uint8_t i=0; i < num_bytes; i++){
@@ -156,10 +158,8 @@ private:
/***********************************************************************
* Register the DBSRX dboard
**********************************************************************/
-// FIXME 0x67 is the default i2c address on USRP2
-// need to handle which side for USRP1 with different address
static dboard_base::sptr make_dbsrx(dboard_base::ctor_args_t args){
- return dboard_base::sptr(new dbsrx(args, 0x67));
+ return dboard_base::sptr(new dbsrx(args));
}
//dbid for USRP2 version
@@ -177,27 +177,27 @@ UHD_STATIC_BLOCK(reg_dbsrx_on_usrp1_dboard){
/***********************************************************************
* Structors
**********************************************************************/
-dbsrx::dbsrx(ctor_args_t args, boost::uint8_t max2118_addr) : rx_dboard_base(args){
+dbsrx::dbsrx(ctor_args_t args) : rx_dboard_base(args){
//warn user about incorrect DBID on USRP1, requires R193 populated
- if (this->get_iface()->get_mboard_name() == "usrp1" and this->get_rx_id() == 0x000D)
+ if (this->get_iface()->get_special_props().soft_clock_divider and this->get_rx_id() == 0x000D)
uhd::print_warning(
str(boost::format(
"DBSRX: incorrect dbid\n"
- "%s expects dbid 0x0002 and R193\n"
+ "Expected dbid 0x0002 and R193\n"
"found dbid == %d\n"
"Please see the daughterboard app notes"
- ) % (this->get_iface()->get_mboard_name()) % (this->get_rx_id().to_pp_string()))
+ ) % this->get_rx_id().to_pp_string())
);
//warn user about incorrect DBID on non-USRP1, requires R194 populated
- if (this->get_iface()->get_mboard_name() != "usrp1" and this->get_rx_id() == 0x0002)
+ if (not this->get_iface()->get_special_props().soft_clock_divider and this->get_rx_id() == 0x0002)
uhd::print_warning(
str(boost::format(
"DBSRX: incorrect dbid\n"
- "%s expects dbid 0x000D and R194\n"
+ "Expected dbid 0x000D and R194\n"
"found dbid == %d\n"
"Please see the daughterboard app notes"
- ) % (this->get_iface()->get_mboard_name()) % (this->get_rx_id().to_pp_string()))
+ ) % this->get_rx_id().to_pp_string())
);
//enable only the clocks we need
@@ -207,9 +207,6 @@ dbsrx::dbsrx(ctor_args_t args, boost::uint8_t max2118_addr) : rx_dboard_base(arg
this->get_iface()->set_pin_ctrl(dboard_iface::UNIT_RX, 0x0); // All unused in atr
this->get_iface()->set_gpio_ddr(dboard_iface::UNIT_RX, 0x0); // All Inputs
- //set the i2c address for the max2118
- _max2118_addr = max2118_addr;
-
//send initial register settings
this->send_reg(0x0, 0x5);
@@ -503,8 +500,7 @@ void dbsrx::set_bandwidth(float bandwidth){
* RX Get and Set
**********************************************************************/
void dbsrx::rx_get(const wax::obj &key_, wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -517,13 +513,13 @@ void dbsrx::rx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- assert_has(_gains.keys(), name, "dbsrx gain name");
- val = _gains[name];
+ assert_has(_gains.keys(), key.name, "dbsrx gain name");
+ val = _gains[key.name];
return;
case SUBDEV_PROP_GAIN_RANGE:
- assert_has(dbsrx_gain_ranges.keys(), name, "dbsrx gain name");
- val = dbsrx_gain_ranges[name];
+ assert_has(dbsrx_gain_ranges.keys(), key.name, "dbsrx gain name");
+ val = dbsrx_gain_ranges[key.name];
return;
case SUBDEV_PROP_GAIN_NAMES:
@@ -546,19 +542,6 @@ void dbsrx::rx_get(const wax::obj &key_, wax::obj &val){
val = dbsrx_antennas;
return;
-/*
- case SUBDEV_PROP_QUADRATURE:
- val = true;
- return;
-
- case SUBDEV_PROP_IQ_SWAPPED:
- val = false;
- return;
-
- case SUBDEV_PROP_SPECTRUM_INVERTED:
- val = false;
- return;
-*/
case SUBDEV_PROP_CONNECTION:
val = SUBDEV_CONN_COMPLEX_IQ;
return;
@@ -586,8 +569,7 @@ void dbsrx::rx_get(const wax::obj &key_, wax::obj &val){
}
void dbsrx::rx_set(const wax::obj &key_, const wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -597,7 +579,7 @@ void dbsrx::rx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_gain(val.as<float>(), name);
+ this->set_gain(val.as<float>(), key.name);
return;
case SUBDEV_PROP_BANDWIDTH:
diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp
index b6b44199a..c3ab96e59 100644
--- a/host/lib/usrp/dboard/db_rfx.cpp
+++ b/host/lib/usrp/dboard/db_rfx.cpp
@@ -398,8 +398,7 @@ double rfx_xcvr::set_lo_freq(
* RX Get and Set
**********************************************************************/
void rfx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -412,13 +411,13 @@ void rfx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- assert_has(_rx_gains.keys(), name, "rfx rx gain name");
- val = _rx_gains[name];
+ assert_has(_rx_gains.keys(), key.name, "rfx rx gain name");
+ val = _rx_gains[key.name];
return;
case SUBDEV_PROP_GAIN_RANGE:
- assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name");
- val = _rx_gain_ranges[name];
+ assert_has(_rx_gain_ranges.keys(), key.name, "rfx rx gain name");
+ val = _rx_gain_ranges[key.name];
return;
case SUBDEV_PROP_GAIN_NAMES:
@@ -458,8 +457,7 @@ void rfx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
}
void rfx_xcvr::rx_set(const wax::obj &key_, const wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -469,7 +467,7 @@ void rfx_xcvr::rx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_rx_gain(val.as<float>(), name);
+ this->set_rx_gain(val.as<float>(), key.name);
return;
case SUBDEV_PROP_ANTENNA:
@@ -484,8 +482,7 @@ void rfx_xcvr::rx_set(const wax::obj &key_, const wax::obj &val){
* TX Get and Set
**********************************************************************/
void rfx_xcvr::tx_get(const wax::obj &key_, wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -499,7 +496,7 @@ void rfx_xcvr::tx_get(const wax::obj &key_, wax::obj &val){
case SUBDEV_PROP_GAIN:
case SUBDEV_PROP_GAIN_RANGE:
- assert_has(rfx_tx_gain_ranges.keys(), name, "rfx tx gain name");
+ assert_has(rfx_tx_gain_ranges.keys(), key.name, "rfx tx gain name");
//no controllable tx gains, will not get here
return;
@@ -540,8 +537,7 @@ void rfx_xcvr::tx_get(const wax::obj &key_, wax::obj &val){
}
void rfx_xcvr::tx_set(const wax::obj &key_, const wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -551,7 +547,7 @@ void rfx_xcvr::tx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_tx_gain(val.as<float>(), name);
+ this->set_tx_gain(val.as<float>(), key.name);
return;
case SUBDEV_PROP_ANTENNA:
diff --git a/host/lib/usrp/dboard/db_unknown.cpp b/host/lib/usrp/dboard/db_unknown.cpp
index 9dd9b550b..f6f4f4a61 100644
--- a/host/lib/usrp/dboard/db_unknown.cpp
+++ b/host/lib/usrp/dboard/db_unknown.cpp
@@ -78,8 +78,7 @@ unknown_rx::~unknown_rx(void){
}
void unknown_rx::rx_get(const wax::obj &key_, wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -136,8 +135,7 @@ void unknown_rx::rx_get(const wax::obj &key_, wax::obj &val){
}
void unknown_rx::rx_set(const wax::obj &key_, const wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -169,8 +167,7 @@ unknown_tx::~unknown_tx(void){
}
void unknown_tx::tx_get(const wax::obj &key_, wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -227,8 +224,7 @@ void unknown_tx::tx_get(const wax::obj &key_, wax::obj &val){
}
void unknown_tx::tx_set(const wax::obj &key_, const wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
diff --git a/host/lib/usrp/dboard/db_wbx.cpp b/host/lib/usrp/dboard/db_wbx.cpp
index 3038ce30b..ccd897674 100644
--- a/host/lib/usrp/dboard/db_wbx.cpp
+++ b/host/lib/usrp/dboard/db_wbx.cpp
@@ -467,8 +467,7 @@ double wbx_xcvr::set_lo_freq(
* RX Get and Set
**********************************************************************/
void wbx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -481,13 +480,13 @@ void wbx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- assert_has(_rx_gains.keys(), name, "wbx rx gain name");
- val = _rx_gains[name];
+ assert_has(_rx_gains.keys(), key.name, "wbx rx gain name");
+ val = _rx_gains[key.name];
return;
case SUBDEV_PROP_GAIN_RANGE:
- assert_has(wbx_rx_gain_ranges.keys(), name, "wbx rx gain name");
- val = wbx_rx_gain_ranges[name];
+ assert_has(wbx_rx_gain_ranges.keys(), key.name, "wbx rx gain name");
+ val = wbx_rx_gain_ranges[key.name];
return;
case SUBDEV_PROP_GAIN_NAMES:
@@ -527,8 +526,7 @@ void wbx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
}
void wbx_xcvr::rx_set(const wax::obj &key_, const wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -538,7 +536,7 @@ void wbx_xcvr::rx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_rx_gain(val.as<float>(), name);
+ this->set_rx_gain(val.as<float>(), key.name);
return;
case SUBDEV_PROP_ANTENNA:
@@ -553,8 +551,7 @@ void wbx_xcvr::rx_set(const wax::obj &key_, const wax::obj &val){
* TX Get and Set
**********************************************************************/
void wbx_xcvr::tx_get(const wax::obj &key_, wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -567,13 +564,13 @@ void wbx_xcvr::tx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- assert_has(_tx_gains.keys(), name, "wbx tx gain name");
- val = _tx_gains[name];
+ assert_has(_tx_gains.keys(), key.name, "wbx tx gain name");
+ val = _tx_gains[key.name];
return;
case SUBDEV_PROP_GAIN_RANGE:
- assert_has(wbx_tx_gain_ranges.keys(), name, "wbx tx gain name");
- val = wbx_tx_gain_ranges[name];
+ assert_has(wbx_tx_gain_ranges.keys(), key.name, "wbx tx gain name");
+ val = wbx_tx_gain_ranges[key.name];
return;
case SUBDEV_PROP_GAIN_NAMES:
@@ -613,8 +610,7 @@ void wbx_xcvr::tx_get(const wax::obj &key_, wax::obj &val){
}
void wbx_xcvr::tx_set(const wax::obj &key_, const wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -624,7 +620,7 @@ void wbx_xcvr::tx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_tx_gain(val.as<float>(), name);
+ this->set_tx_gain(val.as<float>(), key.name);
return;
case SUBDEV_PROP_ANTENNA:
diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp
index 2c94bcd2d..798ff74a3 100644
--- a/host/lib/usrp/dboard/db_xcvr2450.cpp
+++ b/host/lib/usrp/dboard/db_xcvr2450.cpp
@@ -438,8 +438,7 @@ void xcvr2450::set_rx_gain(float gain, const std::string &name){
* RX Get and Set
**********************************************************************/
void xcvr2450::rx_get(const wax::obj &key_, wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -452,13 +451,13 @@ void xcvr2450::rx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- assert_has(_rx_gains.keys(), name, "xcvr rx gain name");
- val = _rx_gains[name];
+ assert_has(_rx_gains.keys(), key.name, "xcvr rx gain name");
+ val = _rx_gains[key.name];
return;
case SUBDEV_PROP_GAIN_RANGE:
- assert_has(xcvr_rx_gain_ranges.keys(), name, "xcvr rx gain name");
- val = xcvr_rx_gain_ranges[name];
+ assert_has(xcvr_rx_gain_ranges.keys(), key.name, "xcvr rx gain name");
+ val = xcvr_rx_gain_ranges[key.name];
return;
case SUBDEV_PROP_GAIN_NAMES:
@@ -502,8 +501,7 @@ void xcvr2450::rx_get(const wax::obj &key_, wax::obj &val){
}
void xcvr2450::rx_set(const wax::obj &key_, const wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -513,7 +511,7 @@ void xcvr2450::rx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_rx_gain(val.as<float>(), name);
+ this->set_rx_gain(val.as<float>(), key.name);
return;
case SUBDEV_PROP_ANTENNA:
@@ -528,8 +526,7 @@ void xcvr2450::rx_set(const wax::obj &key_, const wax::obj &val){
* TX Get and Set
**********************************************************************/
void xcvr2450::tx_get(const wax::obj &key_, wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -542,13 +539,13 @@ void xcvr2450::tx_get(const wax::obj &key_, wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- assert_has(_tx_gains.keys(), name, "xcvr tx gain name");
- val = _tx_gains[name];
+ assert_has(_tx_gains.keys(), key.name, "xcvr tx gain name");
+ val = _tx_gains[key.name];
return;
case SUBDEV_PROP_GAIN_RANGE:
- assert_has(xcvr_tx_gain_ranges.keys(), name, "xcvr tx gain name");
- val = xcvr_tx_gain_ranges[name];
+ assert_has(xcvr_tx_gain_ranges.keys(), key.name, "xcvr tx gain name");
+ val = xcvr_tx_gain_ranges[key.name];
return;
case SUBDEV_PROP_GAIN_NAMES:
@@ -588,8 +585,7 @@ void xcvr2450::tx_get(const wax::obj &key_, wax::obj &val){
}
void xcvr2450::tx_set(const wax::obj &key_, const wax::obj &val){
- wax::obj key; std::string name;
- boost::tie(key, name) = extract_named_prop(key_);
+ named_prop_t key = named_prop_t::extract(key_);
//handle the get request conditioned on the key
switch(key.as<subdev_prop_t>()){
@@ -599,7 +595,7 @@ void xcvr2450::tx_set(const wax::obj &key_, const wax::obj &val){
return;
case SUBDEV_PROP_GAIN:
- this->set_tx_gain(val.as<float>(), name);
+ this->set_tx_gain(val.as<float>(), key.name);
return;
case SUBDEV_PROP_ANTENNA: