aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils/usrp_cal_utils.hpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-11-15 14:54:18 -0800
committerJosh Blum <josh@joshknows.com>2011-11-15 14:54:18 -0800
commit317bff29a5358c7bfc576359ab5a3b3fcf30ad10 (patch)
treef08b092049c9dc33786088c62d9baf689622ab66 /host/utils/usrp_cal_utils.hpp
parentff2e730a0dc7f67241942143c120e02a838f932e (diff)
downloaduhd-317bff29a5358c7bfc576359ab5a3b3fcf30ad10.tar.gz
uhd-317bff29a5358c7bfc576359ab5a3b3fcf30ad10.tar.bz2
uhd-317bff29a5358c7bfc576359ab5a3b3fcf30ad10.zip
uhd: added freq options and common gain setter
Diffstat (limited to 'host/utils/usrp_cal_utils.hpp')
-rw-r--r--host/utils/usrp_cal_utils.hpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/host/utils/usrp_cal_utils.hpp b/host/utils/usrp_cal_utils.hpp
index c08d869ed..5378b0d69 100644
--- a/host/utils/usrp_cal_utils.hpp
+++ b/host/utils/usrp_cal_utils.hpp
@@ -39,10 +39,35 @@ static const size_t wave_table_len = 8192;
static const size_t num_search_steps = 5;
static const size_t num_search_iters = 7;
static const size_t skip_initial_samps = 20;
-static const double default_freq_step = 13.7e6;
+static const double default_freq_step = 7.3e6;
static const size_t default_num_samps = 10000;
/***********************************************************************
+ * Determine gain settings
+ **********************************************************************/
+static inline void set_optimum_gain(uhd::usrp::multi_usrp::sptr usrp){
+ uhd::property_tree::sptr tree = usrp->get_device()->get_tree();
+ const uhd::fs_path tx_fe_path = "/mboards/0/dboards/A/tx_frontends/0";
+ const std::string tx_name = tree->access<std::string>(tx_fe_path / "name").get();
+ if (tx_name.find("WBX") != std::string::npos or tx_name.find("SBX") != std::string::npos){
+ usrp->set_tx_gain(0);
+ }
+ else{
+ throw std::runtime_error("self-calibration is not supported for this hardware");
+ }
+
+ const uhd::fs_path rx_fe_path = "/mboards/0/dboards/A/tx_frontends/0";
+ const std::string rx_name = tree->access<std::string>(rx_fe_path / "name").get();
+ if (rx_name.find("WBX") != std::string::npos or rx_name.find("SBX") != std::string::npos){
+ usrp->set_rx_gain(25);
+ }
+ else{
+ throw std::runtime_error("self-calibration is not supported for this hardware");
+ }
+
+}
+
+/***********************************************************************
* Sinusoid wave table
**********************************************************************/
static inline std::vector<std::complex<float> > gen_table(void){