summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-10-12 09:59:41 -0700
committerJosh Blum <josh@joshknows.com>2011-11-03 20:37:12 -0700
commit9369259177e5517e2b0e775804224c5467e14eab (patch)
tree06b717dae712517e9acbb2e6bbbacce620c55f8e /host/lib/usrp
parentc885da11389ee275f9c5206b9f8a2155a5393a8a (diff)
downloaduhd-9369259177e5517e2b0e775804224c5467e14eab.tar.gz
uhd-9369259177e5517e2b0e775804224c5467e14eab.tar.bz2
uhd-9369259177e5517e2b0e775804224c5467e14eab.zip
usrp: deprecated clock config, added time/clock source calls
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/multi_usrp.cpp72
1 files changed, 51 insertions, 21 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 73699dc81..ab841487f 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -359,34 +359,64 @@ public:
}
void set_clock_config(const clock_config_t &clock_config, size_t mboard){
+ //set the reference source...
+ std::string clock_source;
+ switch(clock_config.ref_source){
+ case clock_config_t::REF_INT: clock_source = "internal"; break;
+ case clock_config_t::PPS_SMA: clock_source = "external"; break;
+ case clock_config_t::PPS_MIMO: clock_source = "mimo"; break;
+ default: clock_source = "unknown";
+ }
+ this->set_clock_source(clock_source, mboard);
+
+ //set the time source
+ std::string time_source;
+ switch(clock_config.pps_source){
+ case clock_config_t::PPS_INT: time_source = "internal"; break;
+ case clock_config_t::PPS_SMA: time_source = "external"; break;
+ case clock_config_t::PPS_MIMO: time_source = "mimo"; break;
+ default: time_source = "unknown";
+ }
+ if (time_source == "external" and clock_config.pps_polarity == clock_config_t::PPS_NEG) time_source = "_external_";
+ this->set_time_source(time_source, mboard);
+ }
+
+ void set_time_source(const std::string &source, const size_t mboard){
if (mboard != ALL_MBOARDS){
- //set the reference source...
- std::string clock_source;
- switch(clock_config.ref_source){
- case clock_config_t::REF_INT: clock_source = "internal"; break;
- case clock_config_t::PPS_SMA: clock_source = "external"; break;
- case clock_config_t::PPS_MIMO: clock_source = "mimo"; break;
- default: clock_source = "unknown";
- }
- _tree->access<std::string>(mb_root(mboard) / "clock_source" / "value").set(clock_source);
-
- //set the time source
- std::string time_source;
- switch(clock_config.pps_source){
- case clock_config_t::PPS_INT: time_source = "internal"; break;
- case clock_config_t::PPS_SMA: time_source = "external"; break;
- case clock_config_t::PPS_MIMO: time_source = "mimo"; break;
- default: time_source = "unknown";
- }
- if (clock_source == "external" and clock_config.pps_polarity == clock_config_t::PPS_NEG) time_source = "_external_";
- _tree->access<std::string>(mb_root(mboard) / "time_source" / "value").set(time_source);
+ _tree->access<std::string>(mb_root(mboard) / "time_source" / "value").set(source);
return;
}
for (size_t m = 0; m < get_num_mboards(); m++){
- set_clock_config(clock_config, m);
+ return this->set_time_source(source, m);
}
}
+ std::string get_time_source(const size_t mboard){
+ return _tree->access<std::string>(mb_root(mboard) / "time_source" / "value").get();
+ }
+
+ std::vector<std::string> get_time_sources(const size_t mboard){
+ return _tree->access<std::vector<std::string> >(mb_root(mboard) / "time_source" / "options").get();
+ }
+
+ void set_clock_source(const std::string &source, const size_t mboard){
+ if (mboard != ALL_MBOARDS){
+ _tree->access<std::string>(mb_root(mboard) / "clock_source" / "value").set(source);
+ return;
+ }
+ for (size_t m = 0; m < get_num_mboards(); m++){
+ return this->set_clock_source(source, m);
+ }
+ }
+
+ std::string get_clock_source(const size_t mboard){
+ return _tree->access<std::string>(mb_root(mboard) / "clock_source" / "value").get();
+ }
+
+ std::vector<std::string> get_clock_sources(const size_t mboard){
+ return _tree->access<std::vector<std::string> >(mb_root(mboard) / "clock_source" / "options").get();
+ }
+
size_t get_num_mboards(void){
return _tree->list("/mboards").size();
}