summaryrefslogtreecommitdiffstats
path: root/host/examples
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-11-07 14:34:40 -0800
committerJosh Blum <josh@joshknows.com>2011-11-07 14:34:40 -0800
commit7c503ad1fab5fd6218847b1d030881b4d048379f (patch)
treed6abbbc47ad99a508c91777985f5a97bdd296981 /host/examples
parentf13e6effb973bcd35896f58af952f6192faae252 (diff)
downloaduhd-7c503ad1fab5fd6218847b1d030881b4d048379f.tar.gz
uhd-7c503ad1fab5fd6218847b1d030881b4d048379f.tar.bz2
uhd-7c503ad1fab5fd6218847b1d030881b4d048379f.zip
uhd: modify examples to use new time/clock source API
Diffstat (limited to 'host/examples')
-rw-r--r--host/examples/rx_ascii_art_dft.cpp15
-rw-r--r--host/examples/rx_multi_samples.cpp7
-rw-r--r--host/examples/rx_samples_to_file.cpp15
-rw-r--r--host/examples/rx_samples_to_udp.cpp15
-rw-r--r--host/examples/tx_samples_from_file.cpp15
-rw-r--r--host/examples/tx_waveforms.cpp15
6 files changed, 13 insertions, 69 deletions
diff --git a/host/examples/rx_ascii_art_dft.cpp b/host/examples/rx_ascii_art_dft.cpp
index 2e5bbba9d..cba72472a 100644
--- a/host/examples/rx_ascii_art_dft.cpp
+++ b/host/examples/rx_ascii_art_dft.cpp
@@ -54,7 +54,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("frame-rate", po::value<double>(&frame_rate)->default_value(5), "frame rate of the display (fps)")
("ref-lvl", po::value<float>(&ref_lvl)->default_value(0), "reference level for the display (dB)")
("dyn-rng", po::value<float>(&dyn_rng)->default_value(60), "dynamic range for the display (dB)")
- ("ref", po::value<std::string>(&ref)->default_value("INTERNAL"), "waveform type (INTERNAL, EXTERNAL, MIMO)")
+ ("ref", po::value<std::string>(&ref)->default_value("internal"), "waveform type (internal, external, mimo)")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -72,18 +72,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
//Lock mboard clocks
- if (ref == "MIMO") {
- uhd::clock_config_t clock_config;
- clock_config.ref_source = uhd::clock_config_t::REF_MIMO;
- clock_config.pps_source = uhd::clock_config_t::PPS_MIMO;
- usrp->set_clock_config(clock_config, 0);
- }
- else if (ref == "EXTERNAL") {
- usrp->set_clock_config(uhd::clock_config_t::external(), 0);
- }
- else if (ref == "INTERNAL") {
- usrp->set_clock_config(uhd::clock_config_t::internal(), 0);
- }
+ usrp->set_clock_source(ref);
//always select the subdevice first, the channel mapping affects the other settings
if (vm.count("subdev")) usrp->set_rx_subdev_spec(subdev);
diff --git a/host/examples/rx_multi_samples.cpp b/host/examples/rx_multi_samples.cpp
index 7561f1285..42ef33d70 100644
--- a/host/examples/rx_multi_samples.cpp
+++ b/host/examples/rx_multi_samples.cpp
@@ -92,6 +92,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
usrp->set_time_now(uhd::time_spec_t(0.0));
}
else if (sync == "pps"){
+ usrp->set_time_source("external");
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
boost::this_thread::sleep(boost::posix_time::seconds(1)); //wait for pps sync pulse
}
@@ -99,10 +100,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
UHD_ASSERT_THROW(usrp->get_num_mboards() == 2);
//make mboard 1 a slave over the MIMO Cable
- uhd::clock_config_t clock_config;
- clock_config.ref_source = uhd::clock_config_t::REF_MIMO;
- clock_config.pps_source = uhd::clock_config_t::PPS_MIMO;
- usrp->set_clock_config(clock_config, 1);
+ usrp->set_clock_source("mimo", 1);
+ usrp->set_time_source("mimo", 1);
//set time on the master (mboard 0)
usrp->set_time_now(uhd::time_spec_t(0.0), 0);
diff --git a/host/examples/rx_samples_to_file.cpp b/host/examples/rx_samples_to_file.cpp
index 605439748..ed242b07a 100644
--- a/host/examples/rx_samples_to_file.cpp
+++ b/host/examples/rx_samples_to_file.cpp
@@ -99,7 +99,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("ant", po::value<std::string>(&ant), "daughterboard antenna selection")
("subdev", po::value<std::string>(&subdev), "daughterboard subdevice specification")
("bw", po::value<double>(&bw), "daughterboard IF filter bandwidth in Hz")
- ("ref", po::value<std::string>(&ref)->default_value("INTERNAL"), "waveform type (INTERNAL, EXTERNAL, MIMO)")
+ ("ref", po::value<std::string>(&ref)->default_value("internal"), "waveform type (internal, external, mimo)")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -117,18 +117,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
//Lock mboard clocks
- if (ref == "MIMO") {
- uhd::clock_config_t clock_config;
- clock_config.ref_source = uhd::clock_config_t::REF_MIMO;
- clock_config.pps_source = uhd::clock_config_t::PPS_MIMO;
- usrp->set_clock_config(clock_config, 0);
- }
- else if (ref == "EXTERNAL") {
- usrp->set_clock_config(uhd::clock_config_t::external(), 0);
- }
- else if (ref == "INTERNAL") {
- usrp->set_clock_config(uhd::clock_config_t::internal(), 0);
- }
+ usrp->set_clock_source(ref);
//always select the subdevice first, the channel mapping affects the other settings
if (vm.count("subdev")) usrp->set_rx_subdev_spec(subdev);
diff --git a/host/examples/rx_samples_to_udp.cpp b/host/examples/rx_samples_to_udp.cpp
index cf7fd493a..c456f05c3 100644
--- a/host/examples/rx_samples_to_udp.cpp
+++ b/host/examples/rx_samples_to_udp.cpp
@@ -51,7 +51,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("bw", po::value<double>(&bw), "daughterboard IF filter bandwidth in Hz")
("port", po::value<std::string>(&port)->default_value("7124"), "server udp port")
("addr", po::value<std::string>(&addr)->default_value("192.168.1.10"), "resolvable server address")
- ("ref", po::value<std::string>(&ref)->default_value("INTERNAL"), "waveform type (INTERNAL, EXTERNAL, MIMO)")
+ ("ref", po::value<std::string>(&ref)->default_value("internal"), "waveform type (internal, external, mimo)")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -70,18 +70,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << boost::format("Using Device: %s") % usrp->get_pp_string() << std::endl;
//Lock mboard clocks
- if (ref == "MIMO") {
- uhd::clock_config_t clock_config;
- clock_config.ref_source = uhd::clock_config_t::REF_MIMO;
- clock_config.pps_source = uhd::clock_config_t::PPS_MIMO;
- usrp->set_clock_config(clock_config, 0);
- }
- else if (ref == "EXTERNAL") {
- usrp->set_clock_config(uhd::clock_config_t::external(), 0);
- }
- else if (ref == "INTERNAL") {
- usrp->set_clock_config(uhd::clock_config_t::internal(), 0);
- }
+ usrp->set_clock_source(ref);
//set the rx sample rate
std::cout << boost::format("Setting RX Rate: %f Msps...") % (rate/1e6) << std::endl;
diff --git a/host/examples/tx_samples_from_file.cpp b/host/examples/tx_samples_from_file.cpp
index 964c6cea8..8e3614f6c 100644
--- a/host/examples/tx_samples_from_file.cpp
+++ b/host/examples/tx_samples_from_file.cpp
@@ -79,7 +79,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("ant", po::value<std::string>(&ant), "daughterboard antenna selection")
("subdev", po::value<std::string>(&subdev), "daughterboard subdevice specification")
("bw", po::value<double>(&bw), "daughterboard IF filter bandwidth in Hz")
- ("ref", po::value<std::string>(&ref)->default_value("INTERNAL"), "waveform type (INTERNAL, EXTERNAL, MIMO)")
+ ("ref", po::value<std::string>(&ref)->default_value("internal"), "waveform type (internal, external, mimo)")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -97,18 +97,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
//Lock mboard clocks
- if (ref == "MIMO") {
- uhd::clock_config_t clock_config;
- clock_config.ref_source = uhd::clock_config_t::REF_MIMO;
- clock_config.pps_source = uhd::clock_config_t::PPS_MIMO;
- usrp->set_clock_config(clock_config, 0);
- }
- else if (ref == "EXTERNAL") {
- usrp->set_clock_config(uhd::clock_config_t::external(), 0);
- }
- else if (ref == "INTERNAL") {
- usrp->set_clock_config(uhd::clock_config_t::internal(), 0);
- }
+ usrp->set_clock_source(ref);
//always select the subdevice first, the channel mapping affects the other settings
if (vm.count("subdev")) usrp->set_tx_subdev_spec(subdev);
diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp
index 4abca5dae..5b17e0595 100644
--- a/host/examples/tx_waveforms.cpp
+++ b/host/examples/tx_waveforms.cpp
@@ -110,7 +110,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("bw", po::value<double>(&bw), "daughterboard IF filter bandwidth in Hz")
("wave-type", po::value<std::string>(&wave_type)->default_value("CONST"), "waveform type (CONST, SQUARE, RAMP, SINE)")
("wave-freq", po::value<double>(&wave_freq)->default_value(0), "waveform frequency in Hz")
- ("ref", po::value<std::string>(&ref)->default_value("INTERNAL"), "waveform type (INTERNAL, EXTERNAL, MIMO)")
+ ("ref", po::value<std::string>(&ref)->default_value("internal"), "waveform type (internal, external, mimo)")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -128,18 +128,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
//Lock mboard clocks
- if (ref == "MIMO") {
- uhd::clock_config_t clock_config;
- clock_config.ref_source = uhd::clock_config_t::REF_MIMO;
- clock_config.pps_source = uhd::clock_config_t::PPS_MIMO;
- usrp->set_clock_config(clock_config, 0);
- }
- else if (ref == "EXTERNAL") {
- usrp->set_clock_config(uhd::clock_config_t::external(), 0);
- }
- else if (ref == "INTERNAL") {
- usrp->set_clock_config(uhd::clock_config_t::internal(), 0);
- }
+ usrp->set_clock_source(ref);
//always select the subdevice first, the channel mapping affects the other settings
if (vm.count("subdev")) usrp->set_tx_subdev_spec(subdev);