summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-02-22 11:55:54 -0800
committerJosh Blum <josh@joshknows.com>2011-02-22 11:55:54 -0800
commit76ebda895cae3bd0014a5e428b07440445f3b631 (patch)
treeb788354f6fd4cd5786bd6539cf5c77e37fd4300f /host/lib/usrp
parent557d62ee648cef2a8edfd15602544064550f82fc (diff)
downloaduhd-76ebda895cae3bd0014a5e428b07440445f3b631.tar.gz
uhd-76ebda895cae3bd0014a5e428b07440445f3b631.tar.bz2
uhd-76ebda895cae3bd0014a5e428b07440445f3b631.zip
uhd: switch dboard id prop to whole eeprom struct
modified implementation code and burner app also made dboard manager use safe constructor that will use none ids if construction fails
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/dboard_manager.cpp21
-rw-r--r--host/lib/usrp/misc_utils.cpp4
-rw-r--r--host/lib/usrp/usrp1/dboard_impl.cpp16
-rw-r--r--host/lib/usrp/usrp2/dboard_impl.cpp16
-rw-r--r--host/lib/usrp/usrp_e100/dboard_impl.cpp16
5 files changed, 43 insertions, 30 deletions
diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp
index 72bfd89e8..75594e670 100644
--- a/host/lib/usrp/dboard_manager.cpp
+++ b/host/lib/usrp/dboard_manager.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -146,6 +146,7 @@ public:
wax::obj get_tx_subdev(const std::string &subdev_name);
private:
+ void init(dboard_id_t, dboard_id_t);
//list of rx and tx dboards in this dboard_manager
//each dboard here is actually a subdevice proxy
//the subdevice proxy is internal to the cpp file
@@ -203,9 +204,21 @@ dboard_manager_impl::dboard_manager_impl(
dboard_id_t rx_dboard_id,
dboard_id_t tx_dboard_id,
dboard_iface::sptr iface
-){
- _iface = iface;
+):
+ _iface(iface)
+{
+ try{
+ this->init(rx_dboard_id, tx_dboard_id);
+ }
+ catch(const std::exception &e){
+ uhd::warning::post(e.what());
+ this->init(dboard_id_t::none(), dboard_id_t::none());
+ }
+}
+void dboard_manager_impl::init(
+ dboard_id_t rx_dboard_id, dboard_id_t tx_dboard_id
+){
//determine xcvr status
bool rx_dboard_is_xcvr = get_xcvr_id_to_id_map().has_key(rx_dboard_id);
bool tx_dboard_is_xcvr = get_xcvr_id_to_id_map().has_key(tx_dboard_id);
@@ -240,7 +253,7 @@ dboard_manager_impl::dboard_manager_impl(
//dboard constructor args
dboard_ctor_args_t db_ctor_args;
- db_ctor_args.db_iface = iface;
+ db_ctor_args.db_iface = _iface;
//make xcvr subdevs (make one subdev for both rx and tx dboards)
if (this_dboard_is_xcvr){
diff --git a/host/lib/usrp/misc_utils.cpp b/host/lib/usrp/misc_utils.cpp
index 02f4b216d..2bad83b3c 100644
--- a/host/lib/usrp/misc_utils.cpp
+++ b/host/lib/usrp/misc_utils.cpp
@@ -19,7 +19,7 @@
#include <uhd/utils/assert.hpp>
#include <uhd/utils/algorithm.hpp>
#include <uhd/utils/gain_group.hpp>
-#include <uhd/usrp/dboard_id.hpp>
+#include <uhd/usrp/dboard_eeprom.hpp>
#include <uhd/usrp/subdev_props.hpp>
#include <uhd/usrp/mboard_props.hpp>
#include <uhd/usrp/dboard_props.hpp>
@@ -147,7 +147,7 @@ static void verify_xx_subdev_spec(
wax::obj dboard = mboard[named_prop_t(dboard_prop, db_name)];
//if the dboard slot is populated, take the first subdevice
- if (dboard[DBOARD_PROP_DBOARD_ID].as<dboard_id_t>() != dboard_id_t::none()){
+ if (dboard[DBOARD_PROP_DBOARD_EEPROM].as<dboard_eeprom_t>().id != dboard_id_t::none()){
std::string sd_name = dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>().front();
subdev_spec.push_back(subdev_spec_pair_t(db_name, sd_name));
break;
diff --git a/host/lib/usrp/usrp1/dboard_impl.cpp b/host/lib/usrp/usrp1/dboard_impl.cpp
index d794b8653..2130960fb 100644
--- a/host/lib/usrp/usrp1/dboard_impl.cpp
+++ b/host/lib/usrp/usrp1/dboard_impl.cpp
@@ -105,8 +105,8 @@ void usrp1_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val, dboard_slot_
val = _dboard_managers[dboard_slot]->get_rx_subdev_names();
return;
- case DBOARD_PROP_DBOARD_ID:
- val = _rx_db_eeproms[dboard_slot].id;
+ case DBOARD_PROP_DBOARD_EEPROM:
+ val = _rx_db_eeproms[dboard_slot];
return;
case DBOARD_PROP_DBOARD_IFACE:
@@ -136,8 +136,8 @@ void usrp1_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val, dboard_slot_
void usrp1_impl::rx_dboard_set(const wax::obj &key, const wax::obj &val, dboard_slot_t dboard_slot)
{
switch(key.as<dboard_prop_t>()) {
- case DBOARD_PROP_DBOARD_ID:
- _rx_db_eeproms[dboard_slot].id = val.as<dboard_id_t>();
+ case DBOARD_PROP_DBOARD_EEPROM:
+ _rx_db_eeproms[dboard_slot] = val.as<dboard_eeprom_t>();
_rx_db_eeproms[dboard_slot].store(*_iface, get_rx_ee_addr(dboard_slot));
return;
@@ -167,8 +167,8 @@ void usrp1_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val, dboard_slot_
val = _dboard_managers[dboard_slot]->get_tx_subdev_names();
return;
- case DBOARD_PROP_DBOARD_ID:
- val = _tx_db_eeproms[dboard_slot].id;
+ case DBOARD_PROP_DBOARD_EEPROM:
+ val = _tx_db_eeproms[dboard_slot];
return;
case DBOARD_PROP_DBOARD_IFACE:
@@ -198,8 +198,8 @@ void usrp1_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val, dboard_slot_
void usrp1_impl::tx_dboard_set(const wax::obj &key, const wax::obj &val, dboard_slot_t dboard_slot)
{
switch(key.as<dboard_prop_t>()) {
- case DBOARD_PROP_DBOARD_ID:
- _tx_db_eeproms[dboard_slot].id = val.as<dboard_id_t>();
+ case DBOARD_PROP_DBOARD_EEPROM:
+ _tx_db_eeproms[dboard_slot] = val.as<dboard_eeprom_t>();
_tx_db_eeproms[dboard_slot].store(*_iface, get_tx_ee_addr(dboard_slot));
return;
diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp
index 52da50132..b668d435b 100644
--- a/host/lib/usrp/usrp2/dboard_impl.cpp
+++ b/host/lib/usrp/usrp2/dboard_impl.cpp
@@ -75,8 +75,8 @@ void usrp2_mboard_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
val = _dboard_manager->get_rx_subdev_names();
return;
- case DBOARD_PROP_DBOARD_ID:
- val = _rx_db_eeprom.id;
+ case DBOARD_PROP_DBOARD_EEPROM:
+ val = _rx_db_eeprom;
return;
case DBOARD_PROP_DBOARD_IFACE:
@@ -103,8 +103,8 @@ void usrp2_mboard_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
void usrp2_mboard_impl::rx_dboard_set(const wax::obj &key, const wax::obj &val){
switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_DBOARD_ID:
- _rx_db_eeprom.id = val.as<dboard_id_t>();
+ case DBOARD_PROP_DBOARD_EEPROM:
+ _rx_db_eeprom = val.as<dboard_eeprom_t>();
_rx_db_eeprom.store(*_iface, USRP2_I2C_ADDR_RX_DB);
return;
@@ -132,8 +132,8 @@ void usrp2_mboard_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
val = _dboard_manager->get_tx_subdev_names();
return;
- case DBOARD_PROP_DBOARD_ID:
- val = _tx_db_eeprom.id;
+ case DBOARD_PROP_DBOARD_EEPROM:
+ val = _tx_db_eeprom;
return;
case DBOARD_PROP_DBOARD_IFACE:
@@ -160,8 +160,8 @@ void usrp2_mboard_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
void usrp2_mboard_impl::tx_dboard_set(const wax::obj &key, const wax::obj &val){
switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_DBOARD_ID:
- _tx_db_eeprom.id = val.as<dboard_id_t>();
+ case DBOARD_PROP_DBOARD_EEPROM:
+ _tx_db_eeprom = val.as<dboard_eeprom_t>();
_tx_db_eeprom.store(*_iface, USRP2_I2C_ADDR_TX_DB);
return;
diff --git a/host/lib/usrp/usrp_e100/dboard_impl.cpp b/host/lib/usrp/usrp_e100/dboard_impl.cpp
index 4297d41f1..b533c2657 100644
--- a/host/lib/usrp/usrp_e100/dboard_impl.cpp
+++ b/host/lib/usrp/usrp_e100/dboard_impl.cpp
@@ -73,8 +73,8 @@ void usrp_e100_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
val = _dboard_manager->get_rx_subdev_names();
return;
- case DBOARD_PROP_DBOARD_ID:
- val = _rx_db_eeprom.id;
+ case DBOARD_PROP_DBOARD_EEPROM:
+ val = _rx_db_eeprom;
return;
case DBOARD_PROP_DBOARD_IFACE:
@@ -103,8 +103,8 @@ void usrp_e100_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
**********************************************************************/
void usrp_e100_impl::rx_dboard_set(const wax::obj &key, const wax::obj &val){
switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_DBOARD_ID:
- _rx_db_eeprom.id = val.as<dboard_id_t>();
+ case DBOARD_PROP_DBOARD_EEPROM:
+ _rx_db_eeprom = val.as<dboard_eeprom_t>();
_rx_db_eeprom.store(*_iface, I2C_ADDR_RX_DB);
return;
@@ -132,8 +132,8 @@ void usrp_e100_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
val = _dboard_manager->get_tx_subdev_names();
return;
- case DBOARD_PROP_DBOARD_ID:
- val = _tx_db_eeprom.id;
+ case DBOARD_PROP_DBOARD_EEPROM:
+ val = _tx_db_eeprom;
return;
case DBOARD_PROP_DBOARD_IFACE:
@@ -162,8 +162,8 @@ void usrp_e100_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
**********************************************************************/
void usrp_e100_impl::tx_dboard_set(const wax::obj &key, const wax::obj &val){
switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_DBOARD_ID:
- _tx_db_eeprom.id = val.as<dboard_id_t>();
+ case DBOARD_PROP_DBOARD_EEPROM:
+ _tx_db_eeprom = val.as<dboard_eeprom_t>();
_tx_db_eeprom.store(*_iface, I2C_ADDR_TX_DB);
return;