From 09e06246984546ad29c159a64f8c0419b81f8013 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 10 Jan 2011 17:11:09 -0800 Subject: usrp: removed old includes that didnt need to be there --- host/lib/usrp/usrp1/io_impl.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'host/lib/usrp/usrp1') diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index 6728d9b15..7107294b6 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -19,7 +19,6 @@ #include "usrp_commands.h" #include "usrp1_impl.hpp" #include -#include #include #include #include -- cgit v1.2.3 From 395bbbbc1118b061262a10d5c847f17a4fd0c6ae Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 11 Jan 2011 19:46:45 -0800 Subject: uhd: replace all the instances of float not pertaining to io types with double, simplifies life --- host/examples/rx_ascii_art_dft.cpp | 6 +++--- host/examples/rx_samples_to_file.cpp | 5 ++--- host/examples/rx_samples_to_udp.cpp | 5 ++--- host/examples/tx_from_file.cpp | 7 +++---- host/examples/tx_waveforms.cpp | 6 +++--- host/include/uhd/usrp/codec_props.hpp | 4 ++-- host/include/uhd/usrp/dboard_iface.hpp | 6 ++---- host/include/uhd/usrp/multi_usrp.hpp | 18 ++++++++-------- host/include/uhd/usrp/single_usrp.hpp | 18 ++++++++-------- host/include/uhd/usrp/subdev_props.hpp | 4 ++-- host/include/uhd/utils/gain_group.hpp | 11 ++++------ host/lib/usrp/dboard/db_basic_and_lf.cpp | 8 +++---- host/lib/usrp/dboard/db_dbsrx.cpp | 22 +++++++++---------- host/lib/usrp/dboard/db_dbsrx2.cpp | 22 +++++++++---------- host/lib/usrp/dboard/db_rfx.cpp | 28 ++++++++++++------------- host/lib/usrp/dboard/db_tvrx.cpp | 20 +++++++++--------- host/lib/usrp/dboard/db_unknown.cpp | 8 +++---- host/lib/usrp/dboard/db_wbx.cpp | 34 +++++++++++++++--------------- host/lib/usrp/dboard/db_xcvr2450.cpp | 36 ++++++++++++++++---------------- host/lib/usrp/misc_utils.cpp | 20 +++++++++--------- host/lib/usrp/multi_usrp.cpp | 12 +++++------ host/lib/usrp/single_usrp.cpp | 12 +++++------ host/lib/usrp/usrp1/codec_ctrl.cpp | 30 +++++++++++++------------- host/lib/usrp/usrp1/codec_ctrl.hpp | 12 +++++------ host/lib/usrp/usrp1/codec_impl.cpp | 6 +++--- host/lib/usrp/usrp1/dboard_iface.cpp | 8 +++---- host/lib/usrp/usrp2/codec_ctrl.cpp | 4 ++-- host/lib/usrp/usrp2/codec_ctrl.hpp | 4 ++-- host/lib/usrp/usrp2/codec_impl.cpp | 10 ++++----- host/lib/usrp/usrp2/dboard_iface.cpp | 10 ++++----- host/lib/usrp/usrp2/mboard_impl.cpp | 2 +- host/lib/usrp/usrp2/usrp2_impl.hpp | 4 ++-- host/lib/usrp/usrp_e100/codec_ctrl.cpp | 30 +++++++++++++------------- host/lib/usrp/usrp_e100/codec_ctrl.hpp | 12 +++++------ host/lib/usrp/usrp_e100/codec_impl.cpp | 6 +++--- host/lib/usrp/usrp_e100/dboard_iface.cpp | 8 +++---- host/lib/utils/gain_group.cpp | 18 ++++++++-------- host/test/gain_group_test.cpp | 16 +++++++------- 38 files changed, 242 insertions(+), 250 deletions(-) (limited to 'host/lib/usrp/usrp1') diff --git a/host/examples/rx_ascii_art_dft.cpp b/host/examples/rx_ascii_art_dft.cpp index 5a24867b4..b677bcb07 100644 --- a/host/examples/rx_ascii_art_dft.cpp +++ b/host/examples/rx_ascii_art_dft.cpp @@ -34,8 +34,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //variables to be set by po std::string args; size_t num_bins; - double rate, freq, frame_rate; - float gain, ref_lvl, dyn_rng; + double rate, freq, gain, frame_rate; + float ref_lvl, dyn_rng; //setup the program options po::options_description desc("Allowed options"); @@ -45,7 +45,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ // hardware parameters ("rate", po::value(&rate), "rate of incoming samples (sps)") ("freq", po::value(&freq)->default_value(0), "RF center frequency in Hz") - ("gain", po::value(&gain)->default_value(0), "gain for the RF chain") + ("gain", po::value(&gain)->default_value(0), "gain for the RF chain") // display parameters ("num-bins", po::value(&num_bins)->default_value(512), "the number of bins in the DFT") ("frame-rate", po::value(&frame_rate)->default_value(5), "frame rate of the display (fps)") diff --git a/host/examples/rx_samples_to_file.cpp b/host/examples/rx_samples_to_file.cpp index c80d2a6de..6a6528a12 100644 --- a/host/examples/rx_samples_to_file.cpp +++ b/host/examples/rx_samples_to_file.cpp @@ -33,8 +33,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //variables to be set by po std::string args, file; size_t total_num_samps; - double rate, freq; - float gain; + double rate, freq, gain; //setup the program options po::options_description desc("Allowed options"); @@ -45,7 +44,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("nsamps", po::value(&total_num_samps)->default_value(1000), "total number of samples to receive") ("rate", po::value(&rate)->default_value(100e6/16), "rate of incoming samples") ("freq", po::value(&freq)->default_value(0), "rf center frequency in Hz") - ("gain", po::value(&gain)->default_value(0), "gain for the RF chain") + ("gain", po::value(&gain)->default_value(0), "gain for the RF chain") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); diff --git a/host/examples/rx_samples_to_udp.cpp b/host/examples/rx_samples_to_udp.cpp index 488c95494..5f1cd4a57 100644 --- a/host/examples/rx_samples_to_udp.cpp +++ b/host/examples/rx_samples_to_udp.cpp @@ -33,8 +33,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //variables to be set by po std::string args; size_t total_num_samps; - double rate, freq; - float gain; + double rate, freq, gain; std::string addr, port; //setup the program options @@ -45,7 +44,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("nsamps", po::value(&total_num_samps)->default_value(1000), "total number of samples to receive") ("rate", po::value(&rate)->default_value(100e6/16), "rate of incoming samples") ("freq", po::value(&freq)->default_value(0), "rf center frequency in Hz") - ("gain", po::value(&gain)->default_value(0), "gain for the RF chain") + ("gain", po::value(&gain)->default_value(0), "gain for the RF chain") ("port", po::value(&port)->default_value("7124"), "server udp port") ("addr", po::value(&addr)->default_value("192.168.1.10"), "resolvable server address") ; diff --git a/host/examples/tx_from_file.cpp b/host/examples/tx_from_file.cpp index 40ce6db6b..392924c05 100644 --- a/host/examples/tx_from_file.cpp +++ b/host/examples/tx_from_file.cpp @@ -34,9 +34,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ time_t seconds_in_future; size_t total_num_samps; size_t samps_per_packet; - double tx_rate, freq; + double tx_rate, freq, gain; float ampl; - float tx_gain; //setup the program options po::options_description desc("Allowed options"); @@ -48,7 +47,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("txrate", po::value(&tx_rate)->default_value(100e6/16), "rate of outgoing samples") ("freq", po::value(&freq)->default_value(0), "rf center frequency in Hz") ("ampl", po::value(&l)->default_value(float(0.3)), "amplitude of each sample") - ("gain", po::value(&tx_gain)->default_value(float(0)), "amplitude of each sample") + ("gain", po::value(&gain)->default_value(0), "amplitude of each sample") ("dilv", "specify to disable inner-loop verbose") ; po::variables_map vm; @@ -78,7 +77,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ sdev->set_tx_freq(freq); sdev->set_time_now(uhd::time_spec_t(0.0)); - sdev->set_tx_gain(tx_gain); + sdev->set_gain(gain); //allocate data to send std::vector > buff; diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp index 751b79cf5..238a24b88 100644 --- a/host/examples/tx_waveforms.cpp +++ b/host/examples/tx_waveforms.cpp @@ -63,8 +63,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //variables to be set by po std::string args, wave_type; size_t total_duration, spb; - double rate, freq, wave_freq; - float ampl, gain; + double rate, freq, gain, wave_freq; + float ampl; //setup the program options po::options_description desc("Allowed options"); @@ -76,7 +76,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("rate", po::value(&rate)->default_value(1.5e6), "rate of outgoing samples") ("freq", po::value(&freq)->default_value(0), "rf center frequency in Hz") ("ampl", po::value(&l)->default_value(float(0.3)), "amplitude of the waveform") - ("gain", po::value(&gain)->default_value(float(0)), "gain for the RF chain") + ("gain", po::value(&gain)->default_value(0), "gain for the RF chain") ("wave-type", po::value(&wave_type)->default_value("CONST"), "waveform type (CONST, SQUARE, RAMP, SINE)") ("wave-freq", po::value(&wave_freq)->default_value(0), "waveform frequency in Hz") ; diff --git a/host/include/uhd/usrp/codec_props.hpp b/host/include/uhd/usrp/codec_props.hpp index ab09b1703..c3aba143f 100644 --- a/host/include/uhd/usrp/codec_props.hpp +++ b/host/include/uhd/usrp/codec_props.hpp @@ -30,8 +30,8 @@ namespace uhd{ namespace usrp{ enum codec_prop_t{ CODEC_PROP_NAME = 'n', //ro, std::string CODEC_PROP_OTHERS = 'o', //ro, prop_names_t - CODEC_PROP_GAIN_I = 'i', //rw, float - CODEC_PROP_GAIN_Q = 'q', //rw, float + CODEC_PROP_GAIN_I = 'i', //rw, double + CODEC_PROP_GAIN_Q = 'q', //rw, double CODEC_PROP_GAIN_RANGE = 'r', //ro, gain_range_t CODEC_PROP_GAIN_NAMES = 'G' //ro, prop_names_t }; diff --git a/host/include/uhd/usrp/dboard_iface.hpp b/host/include/uhd/usrp/dboard_iface.hpp index b04756c47..3ac170b52 100644 --- a/host/include/uhd/usrp/dboard_iface.hpp +++ b/host/include/uhd/usrp/dboard_iface.hpp @@ -102,7 +102,7 @@ public: * \param which_dac the dac index 0, 1, 2, 3... * \param value the value in volts */ - virtual void write_aux_dac(unit_t unit, aux_dac_t which_dac, float value) = 0; + virtual void write_aux_dac(unit_t unit, aux_dac_t which_dac, double value) = 0; /*! * Read from an aux adc. @@ -111,7 +111,7 @@ public: * \param which_adc the adc index 0, 1, 2, 3... * \return the value in volts */ - virtual float read_aux_adc(unit_t unit, aux_adc_t which_adc) = 0; + virtual double read_aux_adc(unit_t unit, aux_adc_t which_adc) = 0; /*! * Set a daughterboard output pin control source. @@ -191,8 +191,6 @@ public: */ virtual boost::uint16_t get_gpio_out(unit_t unit); - UHD_DEPRECATED void write_gpio(unit_t unit, boost::uint16_t value){set_gpio_out(unit, value);} - /*! * Setup the GPIO debug mux. * diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index 1db96a27e..b603d4324 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -257,10 +257,10 @@ public: * \param name the name of the gain element * \param chan the channel index 0 to N-1 */ - virtual void set_rx_gain(float gain, const std::string &name, size_t chan) = 0; + virtual void set_rx_gain(double gain, const std::string &name, size_t chan) = 0; //! A convenience wrapper for setting overall RX gain - void set_rx_gain(float gain, size_t chan){ + void set_rx_gain(double gain, size_t chan){ return this->set_rx_gain(gain, ALL_GAINS, chan); } @@ -271,10 +271,10 @@ public: * \param chan the channel index 0 to N-1 * \return the gain in dB */ - virtual float get_rx_gain(const std::string &name, size_t chan) = 0; + virtual double get_rx_gain(const std::string &name, size_t chan) = 0; //! A convenience wrapper for getting overall RX gain - float get_rx_gain(size_t chan){ + double get_rx_gain(size_t chan){ return this->get_rx_gain(ALL_GAINS, chan); } @@ -348,7 +348,7 @@ public: * \return the rssi in dB * \throw exception if RSSI readback not supported */ - virtual float read_rssi(size_t chan) = 0; + virtual double read_rssi(size_t chan) = 0; /*! * Get the dboard interface object for the RX subdevice. @@ -436,10 +436,10 @@ public: * \param name the name of the gain element * \param chan the channel index 0 to N-1 */ - virtual void set_tx_gain(float gain, const std::string &name, size_t chan) = 0; + virtual void set_tx_gain(double gain, const std::string &name, size_t chan) = 0; //! A convenience wrapper for setting overall TX gain - void set_tx_gain(float gain, size_t chan){ + void set_tx_gain(double gain, size_t chan){ return this->set_tx_gain(gain, ALL_GAINS, chan); } @@ -450,10 +450,10 @@ public: * \param chan the channel index 0 to N-1 * \return the gain in dB */ - virtual float get_tx_gain(const std::string &name, size_t chan) = 0; + virtual double get_tx_gain(const std::string &name, size_t chan) = 0; //! A convenience wrapper for getting overall TX gain - float get_tx_gain(size_t chan){ + double get_tx_gain(size_t chan){ return this->get_tx_gain(ALL_GAINS, chan); } diff --git a/host/include/uhd/usrp/single_usrp.hpp b/host/include/uhd/usrp/single_usrp.hpp index bfbb90912..d56b0a47a 100644 --- a/host/include/uhd/usrp/single_usrp.hpp +++ b/host/include/uhd/usrp/single_usrp.hpp @@ -190,10 +190,10 @@ public: * \param name the name of the gain element * \param chan the channel index 0 to N-1 */ - virtual void set_rx_gain(float gain, const std::string &name, size_t chan = 0) = 0; + virtual void set_rx_gain(double gain, const std::string &name, size_t chan = 0) = 0; //! A convenience wrapper for setting overall RX gain - void set_rx_gain(float gain, size_t chan = 0){ + void set_rx_gain(double gain, size_t chan = 0){ return this->set_rx_gain(gain, ALL_GAINS, chan); } @@ -204,10 +204,10 @@ public: * \param chan the channel index 0 to N-1 * \return the gain in dB */ - virtual float get_rx_gain(const std::string &name, size_t chan = 0) = 0; + virtual double get_rx_gain(const std::string &name, size_t chan = 0) = 0; //! A convenience wrapper for getting overall RX gain - float get_rx_gain(size_t chan = 0){ + double get_rx_gain(size_t chan = 0){ return this->get_rx_gain(ALL_GAINS, chan); } @@ -281,7 +281,7 @@ public: * \return the rssi in dB * \throw exception if RSSI readback not supported */ - virtual float read_rssi(size_t chan = 0) = 0; + virtual double read_rssi(size_t chan = 0) = 0; /*! * Get the dboard interface object for the RX subdevice. @@ -359,10 +359,10 @@ public: * \param name the name of the gain element * \param chan the channel index 0 to N-1 */ - virtual void set_tx_gain(float gain, const std::string &name, size_t chan = 0) = 0; + virtual void set_tx_gain(double gain, const std::string &name, size_t chan = 0) = 0; //! A convenience wrapper for setting overall TX gain - void set_tx_gain(float gain, size_t chan = 0){ + void set_tx_gain(double gain, size_t chan = 0){ return this->set_tx_gain(gain, ALL_GAINS, chan); } @@ -373,10 +373,10 @@ public: * \param chan the channel index 0 to N-1 * \return the gain in dB */ - virtual float get_tx_gain(const std::string &name, size_t chan = 0) = 0; + virtual double get_tx_gain(const std::string &name, size_t chan = 0) = 0; //! A convenience wrapper for getting overall TX gain - float get_tx_gain(size_t chan = 0){ + double get_tx_gain(size_t chan = 0){ return this->get_tx_gain(ALL_GAINS, chan); } diff --git a/host/include/uhd/usrp/subdev_props.hpp b/host/include/uhd/usrp/subdev_props.hpp index 8f096ffe4..fb4b5fc15 100644 --- a/host/include/uhd/usrp/subdev_props.hpp +++ b/host/include/uhd/usrp/subdev_props.hpp @@ -44,7 +44,7 @@ namespace uhd{ namespace usrp{ enum subdev_prop_t{ SUBDEV_PROP_NAME = 'n', //ro, std::string SUBDEV_PROP_OTHERS = 'o', //ro, prop_names_t - SUBDEV_PROP_GAIN = 'g', //rw, float + SUBDEV_PROP_GAIN = 'g', //rw, double SUBDEV_PROP_GAIN_RANGE = 'r', //ro, gain_range_t SUBDEV_PROP_GAIN_NAMES = 'G', //ro, prop_names_t SUBDEV_PROP_FREQ = 'f', //rw, double @@ -55,7 +55,7 @@ namespace uhd{ namespace usrp{ SUBDEV_PROP_CONNECTION = 'c', //ro, subdev_conn_t SUBDEV_PROP_ENABLED = 'e', //rw, bool SUBDEV_PROP_USE_LO_OFFSET = 'l', //ro, bool - SUBDEV_PROP_RSSI = 'R', //ro, float + SUBDEV_PROP_RSSI = 'R', //ro, double SUBDEV_PROP_BANDWIDTH = 'B' //rw, double }; diff --git a/host/include/uhd/utils/gain_group.hpp b/host/include/uhd/utils/gain_group.hpp index 3d22b9118..7ef7bdcf5 100644 --- a/host/include/uhd/utils/gain_group.hpp +++ b/host/include/uhd/utils/gain_group.hpp @@ -28,16 +28,13 @@ namespace uhd{ -//! the data type that represents a gain -typedef double gain_t; - /*! * A set of function to control a gain element. */ struct UHD_API gain_fcns_t{ boost::function get_range; - boost::function get_value; - boost::function set_value; + boost::function get_value; + boost::function set_value; }; class UHD_API gain_group : boost::noncopyable{ @@ -59,7 +56,7 @@ public: * \param name name of the gain element (optional) * \return a gain value of the element or all elements */ - virtual gain_t get_value(const std::string &name = "") = 0; + virtual double get_value(const std::string &name = "") = 0; /*! * Set the gain value for the gain element specified by name. @@ -69,7 +66,7 @@ public: * \param gain the gain to set for the lement or across the group * \param name name of the gain element (optional) */ - virtual void set_value(gain_t gain, const std::string &name = "") = 0; + virtual void set_value(double gain, const std::string &name = "") = 0; /*! * Get a list of names of registered gain elements. diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp index f771595b6..745c2d8e6 100644 --- a/host/lib/usrp/dboard/db_basic_and_lf.cpp +++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp @@ -134,7 +134,7 @@ void basic_rx::rx_get(const wax::obj &key_, wax::obj &val){ return; case SUBDEV_PROP_GAIN: - val = float(0); + val = double(0); return; case SUBDEV_PROP_GAIN_RANGE: @@ -192,7 +192,7 @@ void basic_rx::rx_set(const wax::obj &key_, const wax::obj &val){ switch(key.as()){ case SUBDEV_PROP_GAIN: - UHD_ASSERT_THROW(val.as() == float(0)); + UHD_ASSERT_THROW(val.as() == double(0)); return; case SUBDEV_PROP_ANTENNA: @@ -245,7 +245,7 @@ void basic_tx::tx_get(const wax::obj &key_, wax::obj &val){ return; case SUBDEV_PROP_GAIN: - val = float(0); + val = double(0); return; case SUBDEV_PROP_GAIN_RANGE: @@ -303,7 +303,7 @@ void basic_tx::tx_set(const wax::obj &key_, const wax::obj &val){ switch(key.as()){ case SUBDEV_PROP_GAIN: - UHD_ASSERT_THROW(val.as() == float(0)); + UHD_ASSERT_THROW(val.as() == double(0)); return; case SUBDEV_PROP_ANTENNA: diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp index 7250136f5..491c282ad 100644 --- a/host/lib/usrp/dboard/db_dbsrx.cpp +++ b/host/lib/usrp/dboard/db_dbsrx.cpp @@ -70,7 +70,7 @@ public: private: double _lo_freq; double _bandwidth; - uhd::dict _gains; + uhd::dict _gains; max2118_write_regs_t _max2118_write_regs; max2118_read_regs_t _max2118_read_regs; boost::uint8_t _max2118_addr(void){ @@ -78,7 +78,7 @@ private: }; void set_lo_freq(double target_freq); - void set_gain(float gain, const std::string &name); + void set_gain(double gain, const std::string &name); void set_bandwidth(double bandwidth); void send_reg(boost::uint8_t start_reg, boost::uint8_t stop_reg){ @@ -418,17 +418,17 @@ void dbsrx::set_lo_freq(double target_freq){ * \param gain the requested gain in dB * \return 5 bit the register value */ -static int gain_to_gc2_vga_reg(float &gain){ +static int gain_to_gc2_vga_reg(double &gain){ int reg = 0; gain = dbsrx_gain_ranges["GC2"].clip(gain); // Half dB steps from 0-5dB, 1dB steps from 5-24dB if (gain < 5) { reg = boost::math::iround(31.0 - gain/0.5); - gain = float(boost::math::iround(gain) * 0.5); + gain = double(boost::math::iround(gain) * 0.5); } else { reg = boost::math::iround(22.0 - (gain - 4.0)); - gain = float(boost::math::iround(gain)); + gain = double(boost::math::iround(gain)); } if (dbsrx_debug) std::cerr << boost::format( @@ -444,16 +444,16 @@ static int gain_to_gc2_vga_reg(float &gain){ * \param gain the requested gain in dB * \return dac voltage value */ -static float gain_to_gc1_rfvga_dac(float &gain){ +static double gain_to_gc1_rfvga_dac(double &gain){ //clip the input gain = dbsrx_gain_ranges["GC1"].clip(gain); //voltage level constants - static const float max_volts = float(1.2), min_volts = float(2.7); - static const float slope = (max_volts-min_volts)/dbsrx_gain_ranges["GC1"].stop(); + static const double max_volts = 1.2, min_volts = 2.7; + static const double slope = (max_volts-min_volts)/dbsrx_gain_ranges["GC1"].stop(); //calculate the voltage for the aux dac - float dac_volts = gain*slope + min_volts; + double dac_volts = gain*slope + min_volts; if (dbsrx_debug) std::cerr << boost::format( "DBSRX GC1 Gain: %f dB, dac_volts: %f V" @@ -465,7 +465,7 @@ static float gain_to_gc1_rfvga_dac(float &gain){ return dac_volts; } -void dbsrx::set_gain(float gain, const std::string &name){ +void dbsrx::set_gain(double gain, const std::string &name){ assert_has(dbsrx_gain_ranges.keys(), name, "dbsrx gain name"); if (name == "GC2"){ _max2118_write_regs.gc2 = gain_to_gc2_vga_reg(gain); @@ -584,7 +584,7 @@ void dbsrx::rx_set(const wax::obj &key_, const wax::obj &val){ return; case SUBDEV_PROP_GAIN: - this->set_gain(val.as(), key.name); + this->set_gain(val.as(), key.name); return; case SUBDEV_PROP_ENABLED: diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp index cdafd6a78..1da9b5ff3 100644 --- a/host/lib/usrp/dboard/db_dbsrx2.cpp +++ b/host/lib/usrp/dboard/db_dbsrx2.cpp @@ -48,7 +48,7 @@ static const int dbsrx2_ref_divider = 4; // Hitachi HMC426 divider (U7) static const prop_names_t dbsrx2_antennas = list_of("J3"); static const uhd::dict dbsrx2_gain_ranges = map_list_of - ("GC1", gain_range_t(0, 73, float(0.05))) + ("GC1", gain_range_t(0, 73, 0.05)) ("BBG", gain_range_t(0, 15, 1)) ; @@ -66,7 +66,7 @@ public: private: double _lo_freq; double _bandwidth; - uhd::dict _gains; + uhd::dict _gains; max2112_write_regs_t _max2112_write_regs; max2112_read_regs_t _max2112_read_regs; boost::uint8_t _max2112_addr(){ //0x60 or 0x61 depending on which side @@ -74,7 +74,7 @@ private: } void set_lo_freq(double target_freq); - void set_gain(float gain, const std::string &name); + void set_gain(double gain, const std::string &name); void set_bandwidth(double bandwidth); void send_reg(boost::uint8_t start_reg, boost::uint8_t stop_reg){ @@ -269,10 +269,10 @@ void dbsrx2::set_lo_freq(double target_freq){ * \param gain the requested gain in dB * \return 4 bit the register value */ -static int gain_to_bbg_vga_reg(float &gain){ +static int gain_to_bbg_vga_reg(double &gain){ int reg = boost::math::iround(dbsrx2_gain_ranges["BBG"].clip(gain)); - gain = float(reg); + gain = double(reg); if (dbsrx2_debug) std::cerr << boost::format("DBSRX2 BBG Gain:\n") @@ -288,16 +288,16 @@ static int gain_to_bbg_vga_reg(float &gain){ * \param gain the requested gain in dB * \return dac voltage value */ -static float gain_to_gc1_rfvga_dac(float &gain){ +static double gain_to_gc1_rfvga_dac(double &gain){ //clip the input gain = dbsrx2_gain_ranges["GC1"].clip(gain); //voltage level constants - static const float max_volts = float(0.5), min_volts = float(2.7); - static const float slope = (max_volts-min_volts)/dbsrx2_gain_ranges["GC1"].stop(); + static const double max_volts = 0.5, min_volts = 2.7; + static const double slope = (max_volts-min_volts)/dbsrx2_gain_ranges["GC1"].stop(); //calculate the voltage for the aux dac - float dac_volts = gain*slope + min_volts; + double dac_volts = gain*slope + min_volts; if (dbsrx2_debug) std::cerr << boost::format("DBSRX2 GC1 Gain:\n") @@ -310,7 +310,7 @@ static float gain_to_gc1_rfvga_dac(float &gain){ return dac_volts; } -void dbsrx2::set_gain(float gain, const std::string &name){ +void dbsrx2::set_gain(double gain, const std::string &name){ assert_has(dbsrx2_gain_ranges.keys(), name, "dbsrx2 gain name"); if (name == "BBG"){ _max2112_write_regs.bbg = gain_to_bbg_vga_reg(gain); @@ -423,7 +423,7 @@ void dbsrx2::rx_set(const wax::obj &key_, const wax::obj &val){ return; case SUBDEV_PROP_GAIN: - this->set_gain(val.as(), key.name); + this->set_gain(val.as(), key.name); return; case SUBDEV_PROP_ENABLED: diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 74a9fb37b..3b66b6939 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -67,11 +67,11 @@ static const prop_names_t rfx_rx_antennas = list_of("TX/RX")("RX2"); static const uhd::dict rfx_tx_gain_ranges; //empty static const uhd::dict rfx_rx_gain_ranges = map_list_of - ("PGA0", gain_range_t(0, 70, float(0.022))) + ("PGA0", gain_range_t(0, 70, 0.022)) ; static const uhd::dict rfx400_rx_gain_ranges = map_list_of - ("PGA0", gain_range_t(0, 45, float(0.022))) + ("PGA0", gain_range_t(0, 45, 0.022)) ; /*********************************************************************** @@ -98,14 +98,14 @@ private: const uhd::dict _div2; double _rx_lo_freq, _tx_lo_freq; std::string _rx_ant; - uhd::dict _rx_gains; + uhd::dict _rx_gains; void set_rx_lo_freq(double freq); void set_tx_lo_freq(double freq); void set_rx_ant(const std::string &ant); void set_tx_ant(const std::string &ant); - void set_rx_gain(float gain, const std::string &name); - void set_tx_gain(float gain, const std::string &name); + void set_rx_gain(double gain, const std::string &name); + void set_tx_gain(double gain, const std::string &name); /*! * Set the LO frequency for the particular dboard unit. @@ -240,13 +240,13 @@ void rfx_xcvr::set_tx_ant(const std::string &ant){ /*********************************************************************** * Gain Handling **********************************************************************/ -static float rx_pga0_gain_to_dac_volts(float &gain, float range){ +static double rx_pga0_gain_to_dac_volts(double &gain, double range){ //voltage level constants (negative slope) - static const float max_volts = float(.2), min_volts = float(1.2); - static const float slope = (max_volts-min_volts)/(range); + static const double max_volts = .2, min_volts = 1.2; + static const double slope = (max_volts-min_volts)/(range); //calculate the voltage for the aux dac - float dac_volts = std::clip(gain*slope + min_volts, max_volts, min_volts); + double dac_volts = std::clip(gain*slope + min_volts, max_volts, min_volts); //the actual gain setting gain = (dac_volts - min_volts)/slope; @@ -254,15 +254,15 @@ static float rx_pga0_gain_to_dac_volts(float &gain, float range){ return dac_volts; } -void rfx_xcvr::set_tx_gain(float, const std::string &name){ +void rfx_xcvr::set_tx_gain(double, const std::string &name){ assert_has(rfx_tx_gain_ranges.keys(), name, "rfx tx gain name"); UHD_THROW_INVALID_CODE_PATH(); //no gains to set } -void rfx_xcvr::set_rx_gain(float gain, const std::string &name){ +void rfx_xcvr::set_rx_gain(double gain, const std::string &name){ assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name"); if(name == "PGA0"){ - float dac_volts = rx_pga0_gain_to_dac_volts(gain, + double dac_volts = rx_pga0_gain_to_dac_volts(gain, (_rx_gain_ranges["PGA0"].stop() - _rx_gain_ranges["PGA0"].start())); _rx_gains[name] = gain; @@ -474,7 +474,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(), key.name); + this->set_rx_gain(val.as(), key.name); return; case SUBDEV_PROP_ANTENNA: @@ -571,7 +571,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(), key.name); + this->set_tx_gain(val.as(), key.name); return; case SUBDEV_PROP_ANTENNA: diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp index 2508555d0..f034f0ef6 100644 --- a/host/lib/usrp/dboard/db_tvrx.cpp +++ b/host/lib/usrp/dboard/db_tvrx.cpp @@ -119,8 +119,8 @@ static uhd::dict get_tvrx_gain_ranges(void) { double ifmax = tvrx_if_gains_db.back(); return map_list_of - ("RF", gain_range_t(float(rfmin), float(rfmax), float((rfmax-rfmin)/4096.0))) - ("IF", gain_range_t(float(ifmin), float(ifmax), float((ifmax-ifmin)/4096.0))) + ("RF", gain_range_t(rfmin, rfmax, (rfmax-rfmin)/4096.0)) + ("IF", gain_range_t(ifmin, ifmax, (ifmax-ifmin)/4096.0)) ; } @@ -141,14 +141,14 @@ public: void rx_set(const wax::obj &key, const wax::obj &val); private: - uhd::dict _gains; + uhd::dict _gains; double _lo_freq; tuner_4937di5_regs_t _tuner_4937di5_regs; boost::uint8_t _tuner_4937di5_addr(void){ return (this->get_iface()->get_special_props().mangle_i2c_addrs)? 0x61 : 0x60; //ok really? we could rename that call }; - void set_gain(float gain, const std::string &name); + void set_gain(double gain, const std::string &name); void set_freq(double freq); void update_regs(void){ @@ -275,7 +275,7 @@ static double gain_interp(double gain, boost::array db_vector, boost * \return dac voltage value */ -static float rf_gain_to_voltage(float gain, double lo_freq){ +static double rf_gain_to_voltage(double gain, double lo_freq){ //clip the input gain = get_tvrx_gain_ranges()["RF"].clip(gain); @@ -293,7 +293,7 @@ static float rf_gain_to_voltage(float gain, double lo_freq){ "tvrx RF AGC gain: %f dB, dac_volts: %f V" ) % gain % dac_volts << std::endl; - return float(dac_volts); + return dac_volts; } /*! @@ -303,7 +303,7 @@ static float rf_gain_to_voltage(float gain, double lo_freq){ * \return dac voltage value */ -static float if_gain_to_voltage(float gain){ +static double if_gain_to_voltage(double gain){ //clip the input gain = get_tvrx_gain_ranges()["IF"].clip(gain); @@ -316,10 +316,10 @@ static float if_gain_to_voltage(float gain){ "tvrx IF AGC gain: %f dB, dac_volts: %f V" ) % gain % dac_volts << std::endl; - return float(dac_volts); + return dac_volts; } -void tvrx::set_gain(float gain, const std::string &name){ +void tvrx::set_gain(double gain, const std::string &name){ assert_has(get_tvrx_gain_ranges().keys(), name, "tvrx gain name"); if (name == "RF"){ this->get_iface()->write_aux_dac(dboard_iface::UNIT_RX, dboard_iface::AUX_DAC_B, rf_gain_to_voltage(gain, _lo_freq)); @@ -473,7 +473,7 @@ void tvrx::rx_set(const wax::obj &key_, const wax::obj &val){ //handle the get request conditioned on the key switch(key.as()){ case SUBDEV_PROP_GAIN: - this->set_gain(val.as(), key.name); + this->set_gain(val.as(), key.name); return; case SUBDEV_PROP_FREQ: diff --git a/host/lib/usrp/dboard/db_unknown.cpp b/host/lib/usrp/dboard/db_unknown.cpp index 168e1971c..ccda93c04 100644 --- a/host/lib/usrp/dboard/db_unknown.cpp +++ b/host/lib/usrp/dboard/db_unknown.cpp @@ -115,7 +115,7 @@ void unknown_rx::rx_get(const wax::obj &key_, wax::obj &val){ return; case SUBDEV_PROP_GAIN: - val = float(0); + val = double(0); return; case SUBDEV_PROP_GAIN_RANGE: @@ -173,7 +173,7 @@ void unknown_rx::rx_set(const wax::obj &key_, const wax::obj &val){ switch(key.as()){ case SUBDEV_PROP_GAIN: - UHD_ASSERT_THROW(val.as() == float(0)); + UHD_ASSERT_THROW(val.as() == double(0)); return; case SUBDEV_PROP_ANTENNA: @@ -217,7 +217,7 @@ void unknown_tx::tx_get(const wax::obj &key_, wax::obj &val){ return; case SUBDEV_PROP_GAIN: - val = float(0); + val = double(0); return; case SUBDEV_PROP_GAIN_RANGE: @@ -275,7 +275,7 @@ void unknown_tx::tx_set(const wax::obj &key_, const wax::obj &val){ switch(key.as()){ case SUBDEV_PROP_GAIN: - UHD_ASSERT_THROW(val.as() == float(0)); + UHD_ASSERT_THROW(val.as() == double(0)); return; case SUBDEV_PROP_ANTENNA: diff --git a/host/lib/usrp/dboard/db_wbx.cpp b/host/lib/usrp/dboard/db_wbx.cpp index dd5bd600b..cdf23836b 100644 --- a/host/lib/usrp/dboard/db_wbx.cpp +++ b/host/lib/usrp/dboard/db_wbx.cpp @@ -94,11 +94,11 @@ static const prop_names_t wbx_tx_antennas = list_of("TX/RX"); static const prop_names_t wbx_rx_antennas = list_of("TX/RX")("RX2"); static const uhd::dict wbx_tx_gain_ranges = map_list_of - ("PGA0", gain_range_t(0, 25, float(0.05))) + ("PGA0", gain_range_t(0, 25, 0.05)) ; static const uhd::dict wbx_rx_gain_ranges = map_list_of - ("PGA0", gain_range_t(0, 31.5, float(0.5))) + ("PGA0", gain_range_t(0, 31.5, 0.5)) ; /*********************************************************************** @@ -116,7 +116,7 @@ public: void tx_set(const wax::obj &key, const wax::obj &val); private: - uhd::dict _tx_gains, _rx_gains; + uhd::dict _tx_gains, _rx_gains; double _rx_lo_freq, _tx_lo_freq; std::string _tx_ant, _rx_ant; @@ -124,8 +124,8 @@ private: void set_tx_lo_freq(double freq); void set_rx_ant(const std::string &ant); void set_tx_ant(const std::string &ant); - void set_rx_gain(float gain, const std::string &name); - void set_tx_gain(float gain, const std::string &name); + void set_rx_gain(double gain, const std::string &name); + void set_tx_gain(double gain, const std::string &name); void update_atr(void); @@ -196,12 +196,12 @@ wbx_xcvr::~wbx_xcvr(void){ /*********************************************************************** * Gain Handling **********************************************************************/ -static int rx_pga0_gain_to_iobits(float &gain){ +static int rx_pga0_gain_to_iobits(double &gain){ //clip the input gain = wbx_rx_gain_ranges["PGA0"].clip(gain); //convert to attenuation and update iobits for atr - float attn = wbx_rx_gain_ranges["PGA0"].stop() - gain; + double attn = wbx_rx_gain_ranges["PGA0"].stop() - gain; //calculate the attenuation int attn_code = boost::math::iround(attn*2); @@ -212,21 +212,21 @@ static int rx_pga0_gain_to_iobits(float &gain){ ) % attn % attn_code % (iobits & RX_ATTN_MASK) % RX_ATTN_MASK << std::endl; //the actual gain setting - gain = wbx_rx_gain_ranges["PGA0"].stop() - float(attn_code)/2; + gain = wbx_rx_gain_ranges["PGA0"].stop() - double(attn_code)/2; return iobits; } -static float tx_pga0_gain_to_dac_volts(float &gain){ +static double tx_pga0_gain_to_dac_volts(double &gain){ //clip the input gain = wbx_tx_gain_ranges["PGA0"].clip(gain); //voltage level constants - static const float max_volts = float(0.5), min_volts = float(1.4); - static const float slope = (max_volts-min_volts)/wbx_tx_gain_ranges["PGA0"].stop(); + static const double max_volts = 0.5, min_volts = 1.4; + static const double slope = (max_volts-min_volts)/wbx_tx_gain_ranges["PGA0"].stop(); //calculate the voltage for the aux dac - float dac_volts = gain*slope + min_volts; + double dac_volts = gain*slope + min_volts; if (wbx_debug) std::cerr << boost::format( "WBX TX Gain: %f dB, dac_volts: %f V" @@ -238,10 +238,10 @@ static float tx_pga0_gain_to_dac_volts(float &gain){ return dac_volts; } -void wbx_xcvr::set_tx_gain(float gain, const std::string &name){ +void wbx_xcvr::set_tx_gain(double gain, const std::string &name){ assert_has(wbx_tx_gain_ranges.keys(), name, "wbx tx gain name"); if(name == "PGA0"){ - float dac_volts = tx_pga0_gain_to_dac_volts(gain); + double dac_volts = tx_pga0_gain_to_dac_volts(gain); _tx_gains[name] = gain; //write the new voltage to the aux dac @@ -250,7 +250,7 @@ void wbx_xcvr::set_tx_gain(float gain, const std::string &name){ else UHD_THROW_INVALID_CODE_PATH(); } -void wbx_xcvr::set_rx_gain(float gain, const std::string &name){ +void wbx_xcvr::set_rx_gain(double gain, const std::string &name){ assert_has(wbx_rx_gain_ranges.keys(), name, "wbx rx gain name"); if(name == "PGA0"){ rx_pga0_gain_to_iobits(gain); @@ -544,7 +544,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(), key.name); + this->set_rx_gain(val.as(), key.name); return; case SUBDEV_PROP_ANTENNA: @@ -645,7 +645,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(), key.name); + this->set_tx_gain(val.as(), 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 78eceff99..6fb5a26a8 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -109,7 +109,7 @@ public: private: double _lo_freq; double _rx_bandwidth, _tx_bandwidth; - uhd::dict _tx_gains, _rx_gains; + uhd::dict _tx_gains, _rx_gains; std::string _tx_ant, _rx_ant; int _ad9515div; max2829_regs_t _max2829_regs; @@ -117,8 +117,8 @@ private: void set_lo_freq(double target_freq); void set_tx_ant(const std::string &ant); void set_rx_ant(const std::string &ant); - void set_tx_gain(float gain, const std::string &name); - void set_rx_gain(float gain, const std::string &name); + void set_tx_gain(double gain, const std::string &name); + void set_rx_gain(double gain, const std::string &name); void set_rx_bandwidth(double bandwidth); void set_tx_bandwidth(double bandwidth); @@ -150,12 +150,12 @@ private: * Read the RSSI from the aux adc * \return the rssi in dB */ - float get_rssi(void){ + double get_rssi(void){ //constants for the rssi calculation - static const float min_v = float(0.5), max_v = float(2.5); - static const float rssi_dyn_range = 60; + static const double min_v = 0.5, max_v = 2.5; + static const double rssi_dyn_range = 60; //calculate the rssi from the voltage - float voltage = this->get_iface()->read_aux_adc(dboard_iface::UNIT_RX, dboard_iface::AUX_ADC_B); + double voltage = this->get_iface()->read_aux_adc(dboard_iface::UNIT_RX, dboard_iface::AUX_ADC_B); return rssi_dyn_range*(voltage - min_v)/(max_v - min_v); } }; @@ -355,14 +355,14 @@ void xcvr2450::set_rx_ant(const std::string &ant){ * \param gain the requested gain in dB * \return 6 bit the register value */ -static int gain_to_tx_vga_reg(float &gain){ +static int gain_to_tx_vga_reg(double &gain){ //calculate the register value int reg = std::clip(boost::math::iround(gain*60/30.0) + 3, 0, 63); //calculate the actual gain value if (reg < 4) gain = 0; - else if (reg < 48) gain = float(reg/2 - 1); - else gain = float(reg/2.0 - 1.5); + else if (reg < 48) gain = double(reg/2 - 1); + else gain = double(reg/2.0 - 1.5); //return register value return reg; @@ -374,7 +374,7 @@ static int gain_to_tx_vga_reg(float &gain){ * \param gain the requested gain in dB * \return gain enum value */ -static max2829_regs_t::tx_baseband_gain_t gain_to_tx_bb_reg(float &gain){ +static max2829_regs_t::tx_baseband_gain_t gain_to_tx_bb_reg(double &gain){ int reg = std::clip(boost::math::iround(gain*3/5.0), 0, 3); switch(reg){ case 0: @@ -399,9 +399,9 @@ static max2829_regs_t::tx_baseband_gain_t gain_to_tx_bb_reg(float &gain){ * \param gain the requested gain in dB * \return 5 bit the register value */ -static int gain_to_rx_vga_reg(float &gain){ +static int gain_to_rx_vga_reg(double &gain){ int reg = std::clip(boost::math::iround(gain/2.0), 0, 31); - gain = float(reg*2); + gain = double(reg*2); return reg; } @@ -411,7 +411,7 @@ static int gain_to_rx_vga_reg(float &gain){ * \param gain the requested gain in dB * \return 2 bit the register value */ -static int gain_to_rx_lna_reg(float &gain){ +static int gain_to_rx_lna_reg(double &gain){ int reg = std::clip(boost::math::iround(gain*2/30.5) + 1, 0, 3); switch(reg){ case 0: @@ -422,7 +422,7 @@ static int gain_to_rx_lna_reg(float &gain){ return reg; } -void xcvr2450::set_tx_gain(float gain, const std::string &name){ +void xcvr2450::set_tx_gain(double gain, const std::string &name){ assert_has(xcvr_tx_gain_ranges.keys(), name, "xcvr tx gain name"); if (name == "VGA"){ _max2829_regs.tx_vga_gain = gain_to_tx_vga_reg(gain); @@ -436,7 +436,7 @@ void xcvr2450::set_tx_gain(float gain, const std::string &name){ _tx_gains[name] = gain; } -void xcvr2450::set_rx_gain(float gain, const std::string &name){ +void xcvr2450::set_rx_gain(double gain, const std::string &name){ assert_has(xcvr_rx_gain_ranges.keys(), name, "xcvr rx gain name"); if (name == "VGA"){ _max2829_regs.rx_vga_gain = gain_to_rx_vga_reg(gain); @@ -643,7 +643,7 @@ void xcvr2450::rx_set(const wax::obj &key_, const wax::obj &val){ return; case SUBDEV_PROP_GAIN: - this->set_rx_gain(val.as(), key.name); + this->set_rx_gain(val.as(), key.name); return; case SUBDEV_PROP_ANTENNA: @@ -742,7 +742,7 @@ void xcvr2450::tx_set(const wax::obj &key_, const wax::obj &val){ return; case SUBDEV_PROP_GAIN: - this->set_tx_gain(val.as(), key.name); + this->set_tx_gain(val.as(), key.name); return; case SUBDEV_PROP_BANDWIDTH: diff --git a/host/lib/usrp/misc_utils.cpp b/host/lib/usrp/misc_utils.cpp index 5856d706f..0385187eb 100644 --- a/host/lib/usrp/misc_utils.cpp +++ b/host/lib/usrp/misc_utils.cpp @@ -39,24 +39,24 @@ static gain_range_t get_codec_gain_range(wax::obj codec, const std::string &name return codec[named_prop_t(CODEC_PROP_GAIN_RANGE, name)].as(); } -static float get_codec_gain_i(wax::obj codec, const std::string &name){ - return codec[named_prop_t(CODEC_PROP_GAIN_I, name)].as(); +static double get_codec_gain_i(wax::obj codec, const std::string &name){ + return codec[named_prop_t(CODEC_PROP_GAIN_I, name)].as(); } -static float get_codec_gain_q(wax::obj codec, const std::string &name){ - return codec[named_prop_t(CODEC_PROP_GAIN_Q, name)].as(); +static double get_codec_gain_q(wax::obj codec, const std::string &name){ + return codec[named_prop_t(CODEC_PROP_GAIN_Q, name)].as(); } -static void set_codec_gain_both(wax::obj codec, const std::string &name, float gain){ +static void set_codec_gain_both(wax::obj codec, const std::string &name, double gain){ codec[named_prop_t(CODEC_PROP_GAIN_I, name)] = gain; codec[named_prop_t(CODEC_PROP_GAIN_Q, name)] = gain; } -static void set_codec_gain_i(wax::obj codec, const std::string &name, float gain){ +static void set_codec_gain_i(wax::obj codec, const std::string &name, double gain){ codec[named_prop_t(CODEC_PROP_GAIN_I, name)] = gain; } -static void set_codec_gain_q(wax::obj codec, const std::string &name, float gain){ +static void set_codec_gain_q(wax::obj codec, const std::string &name, double gain){ codec[named_prop_t(CODEC_PROP_GAIN_Q, name)] = gain; } @@ -64,15 +64,15 @@ static void set_codec_gain_q(wax::obj codec, const std::string &name, float gain * subdev gain group helper functions: * do this so we dont have to bind a templated function **********************************************************************/ -static float get_subdev_gain(wax::obj subdev, const std::string &name){ - return subdev[named_prop_t(SUBDEV_PROP_GAIN, name)].as(); +static double get_subdev_gain(wax::obj subdev, const std::string &name){ + return subdev[named_prop_t(SUBDEV_PROP_GAIN, name)].as(); } static gain_range_t get_subdev_gain_range(wax::obj subdev, const std::string &name){ return subdev[named_prop_t(SUBDEV_PROP_GAIN_RANGE, name)].as(); } -static void set_subdev_gain(wax::obj subdev, const std::string &name, float gain){ +static void set_subdev_gain(wax::obj subdev, const std::string &name, double gain){ subdev[named_prop_t(SUBDEV_PROP_GAIN, name)] = gain; } diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index baf87ced5..ab78fb4b6 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -239,11 +239,11 @@ public: return add_dsp_shift(_rx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as(), _rx_dsp(chan/rx_cpm())); } - void set_rx_gain(float gain, const std::string &name, size_t chan){ + void set_rx_gain(double gain, const std::string &name, size_t chan){ return _rx_gain_group(chan)->set_value(gain, name); } - float get_rx_gain(const std::string &name, size_t chan){ + double get_rx_gain(const std::string &name, size_t chan){ return _rx_gain_group(chan)->get_value(name); } @@ -279,8 +279,8 @@ public: return _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH].as(); } - float read_rssi(size_t chan){ - return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as(); + double read_rssi(size_t chan){ + return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as(); } dboard_iface::sptr get_rx_dboard_iface(size_t chan){ @@ -337,11 +337,11 @@ public: return add_dsp_shift(_tx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as(), _tx_dsp(chan/tx_cpm())); } - void set_tx_gain(float gain, const std::string &name, size_t chan){ + void set_tx_gain(double gain, const std::string &name, size_t chan){ return _tx_gain_group(chan)->set_value(gain, name); } - float get_tx_gain(const std::string &name, size_t chan){ + double get_tx_gain(const std::string &name, size_t chan){ return _tx_gain_group(chan)->get_value(name); } diff --git a/host/lib/usrp/single_usrp.cpp b/host/lib/usrp/single_usrp.cpp index 12730929a..e63cdaea9 100644 --- a/host/lib/usrp/single_usrp.cpp +++ b/host/lib/usrp/single_usrp.cpp @@ -164,11 +164,11 @@ public: return add_dsp_shift(_rx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as(), _rx_dsp()); } - void set_rx_gain(float gain, const std::string &name, size_t chan){ + void set_rx_gain(double gain, const std::string &name, size_t chan){ return _rx_gain_group(chan)->set_value(gain, name); } - float get_rx_gain(const std::string &name, size_t chan){ + double get_rx_gain(const std::string &name, size_t chan){ return _rx_gain_group(chan)->get_value(name); } @@ -204,8 +204,8 @@ public: return _rx_subdev(chan)[SUBDEV_PROP_BANDWIDTH].as(); } - float read_rssi(size_t chan){ - return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as(); + double read_rssi(size_t chan){ + return _rx_subdev(chan)[SUBDEV_PROP_RSSI].as(); } dboard_iface::sptr get_rx_dboard_iface(size_t chan){ @@ -250,11 +250,11 @@ public: return add_dsp_shift(_tx_subdev(chan)[SUBDEV_PROP_FREQ_RANGE].as(), _tx_dsp()); } - void set_tx_gain(float gain, const std::string &name, size_t chan){ + void set_tx_gain(double gain, const std::string &name, size_t chan){ return _tx_gain_group(chan)->set_value(gain, name); } - float get_tx_gain(const std::string &name, size_t chan){ + double get_tx_gain(const std::string &name, size_t chan){ return _tx_gain_group(chan)->get_value(name); } diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp index 18f794632..553f78ef8 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.cpp +++ b/host/lib/usrp/usrp1/codec_ctrl.cpp @@ -35,7 +35,7 @@ using namespace uhd; static const bool codec_debug = false; -const gain_range_t usrp1_codec_ctrl::tx_pga_gain_range(-20, 0, float(0.1)); +const gain_range_t usrp1_codec_ctrl::tx_pga_gain_range(-20, 0, double(0.1)); const gain_range_t usrp1_codec_ctrl::rx_pga_gain_range(0, 20, 1); /*********************************************************************** @@ -50,17 +50,17 @@ public: ~usrp1_codec_ctrl_impl(void); //aux adc and dac control - float read_aux_adc(aux_adc_t which); - void write_aux_dac(aux_dac_t which, float volts); + double read_aux_adc(aux_adc_t which); + void write_aux_dac(aux_dac_t which, double volts); //duc control void set_duc_freq(double freq); //pga gain control - void set_tx_pga_gain(float); - float get_tx_pga_gain(void); - void set_rx_pga_gain(float, char); - float get_rx_pga_gain(char); + void set_tx_pga_gain(double); + double get_tx_pga_gain(void); + void set_rx_pga_gain(double, char); + double get_rx_pga_gain(char); //rx adc buffer control void bypass_adc_buffers(bool bypass); @@ -159,19 +159,19 @@ usrp1_codec_ctrl_impl::~usrp1_codec_ctrl_impl(void) **********************************************************************/ static const int mtpgw = 255; //maximum tx pga gain word -void usrp1_codec_ctrl_impl::set_tx_pga_gain(float gain){ +void usrp1_codec_ctrl_impl::set_tx_pga_gain(double gain){ int gain_word = int(mtpgw*(gain - tx_pga_gain_range.start())/(tx_pga_gain_range.stop() - tx_pga_gain_range.start())); _ad9862_regs.tx_pga_gain = std::clip(gain_word, 0, mtpgw); this->send_reg(16); } -float usrp1_codec_ctrl_impl::get_tx_pga_gain(void){ +double usrp1_codec_ctrl_impl::get_tx_pga_gain(void){ return (_ad9862_regs.tx_pga_gain*(tx_pga_gain_range.stop() - tx_pga_gain_range.start())/mtpgw) + tx_pga_gain_range.start(); } static const int mrpgw = 0x14; //maximum rx pga gain word -void usrp1_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){ +void usrp1_codec_ctrl_impl::set_rx_pga_gain(double gain, char which){ int gain_word = int(mrpgw*(gain - rx_pga_gain_range.start())/(rx_pga_gain_range.stop() - rx_pga_gain_range.start())); gain_word = std::clip(gain_word, 0, mrpgw); switch(which){ @@ -187,7 +187,7 @@ void usrp1_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){ } } -float usrp1_codec_ctrl_impl::get_rx_pga_gain(char which){ +double usrp1_codec_ctrl_impl::get_rx_pga_gain(char which){ int gain_word; switch(which){ case 'A': gain_word = _ad9862_regs.rx_pga_a; break; @@ -200,12 +200,12 @@ float usrp1_codec_ctrl_impl::get_rx_pga_gain(char which){ /*********************************************************************** * Codec Control AUX ADC Methods **********************************************************************/ -static float aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low) +static double aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low) { - return float(((boost::uint16_t(high) << 2) | low)*3.3)/0x3ff; + return double(((boost::uint16_t(high) << 2) | low)*3.3)/0x3ff; } -float usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which) +double usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which) { //check to see if the switch needs to be set bool write_switch = false; @@ -259,7 +259,7 @@ float usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which) /*********************************************************************** * Codec Control AUX DAC Methods **********************************************************************/ -void usrp1_codec_ctrl_impl::write_aux_dac(aux_dac_t which, float volts) +void usrp1_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts) { //special case for aux dac d (aka sigma delta word) if (which == AUX_DAC_D) { diff --git a/host/lib/usrp/usrp1/codec_ctrl.hpp b/host/lib/usrp/usrp1/codec_ctrl.hpp index e2e8a010d..c0f44ebf4 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.hpp +++ b/host/lib/usrp/usrp1/codec_ctrl.hpp @@ -61,7 +61,7 @@ public: * \param which which of the 4 adcs * \return a value in volts */ - virtual float read_aux_adc(aux_adc_t which) = 0; + virtual double read_aux_adc(aux_adc_t which) = 0; //! aux dac identifier constants enum aux_dac_t{ @@ -76,19 +76,19 @@ public: * \param which which of the 4 dacs * \param volts the level in in volts */ - virtual void write_aux_dac(aux_dac_t which, float volts) = 0; + virtual void write_aux_dac(aux_dac_t which, double volts) = 0; //! Set the TX PGA gain - virtual void set_tx_pga_gain(float gain) = 0; + virtual void set_tx_pga_gain(double gain) = 0; //! Get the TX PGA gain - virtual float get_tx_pga_gain(void) = 0; + virtual double get_tx_pga_gain(void) = 0; //! Set the RX PGA gain ('A' or 'B') - virtual void set_rx_pga_gain(float gain, char which) = 0; + virtual void set_rx_pga_gain(double gain, char which) = 0; //! Get the RX PGA gain ('A' or 'B') - virtual float get_rx_pga_gain(char which) = 0; + virtual double get_rx_pga_gain(char which) = 0; //! Set the TX modulator frequency virtual void set_duc_freq(double freq) = 0; diff --git a/host/lib/usrp/usrp1/codec_impl.cpp b/host/lib/usrp/usrp1/codec_impl.cpp index db53be53e..fe60c8b9a 100644 --- a/host/lib/usrp/usrp1/codec_impl.cpp +++ b/host/lib/usrp/usrp1/codec_impl.cpp @@ -92,12 +92,12 @@ void usrp1_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val, dboard_ switch(key.as()) { case CODEC_PROP_GAIN_I: UHD_ASSERT_THROW(key.name == adc_pga_gain_name); - _codec_ctrls[dboard_slot]->set_rx_pga_gain(val.as(), 'A'); + _codec_ctrls[dboard_slot]->set_rx_pga_gain(val.as(), 'A'); return; case CODEC_PROP_GAIN_Q: UHD_ASSERT_THROW(key.name == adc_pga_gain_name); - _codec_ctrls[dboard_slot]->set_rx_pga_gain(val.as(), 'B'); + _codec_ctrls[dboard_slot]->set_rx_pga_gain(val.as(), 'B'); return; default: UHD_THROW_PROP_SET_ERROR(); @@ -151,7 +151,7 @@ void usrp1_impl::tx_codec_set(const wax::obj &key_, const wax::obj &val, dboard_ case CODEC_PROP_GAIN_I: //only one gain for I and Q case CODEC_PROP_GAIN_Q: UHD_ASSERT_THROW(key.name == dac_pga_gain_name); - _codec_ctrls[dboard_slot]->set_tx_pga_gain(val.as()); + _codec_ctrls[dboard_slot]->set_tx_pga_gain(val.as()); return; default: UHD_THROW_PROP_SET_ERROR(); diff --git a/host/lib/usrp/usrp1/dboard_iface.cpp b/host/lib/usrp/usrp1/dboard_iface.cpp index 4e47d6bf6..180faf1da 100644 --- a/host/lib/usrp/usrp1/dboard_iface.cpp +++ b/host/lib/usrp/usrp1/dboard_iface.cpp @@ -72,8 +72,8 @@ public: return props; } - void write_aux_dac(unit_t, aux_dac_t, float); - float read_aux_adc(unit_t, aux_adc_t); + void write_aux_dac(unit_t, aux_dac_t, double); + double read_aux_adc(unit_t, aux_adc_t); void _set_pin_ctrl(unit_t, boost::uint16_t); void _set_atr_reg(unit_t, atr_reg_t, boost::uint16_t); @@ -369,7 +369,7 @@ byte_vector_t usrp1_dboard_iface::read_i2c(boost::uint8_t addr, * Aux DAX/ADC **********************************************************************/ void usrp1_dboard_iface::write_aux_dac(dboard_iface::unit_t, - aux_dac_t which, float value) + aux_dac_t which, double value) { //same aux dacs for each unit static const uhd::dict @@ -382,7 +382,7 @@ void usrp1_dboard_iface::write_aux_dac(dboard_iface::unit_t, _codec->write_aux_dac(which_to_aux_dac[which], value); } -float usrp1_dboard_iface::read_aux_adc(dboard_iface::unit_t unit, +double usrp1_dboard_iface::read_aux_adc(dboard_iface::unit_t unit, aux_adc_t which) { static const diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp index 4f2cd88bb..7bd19cbe3 100644 --- a/host/lib/usrp/usrp2/codec_ctrl.cpp +++ b/host/lib/usrp/usrp2/codec_ctrl.cpp @@ -123,7 +123,7 @@ public: this->send_ad9777_reg(0x01); //set the register } - void set_rx_digital_gain(float gain) { //fine digital gain + void set_rx_digital_gain(double gain) { //fine digital gain switch(_iface->get_rev()){ case usrp2_iface::USRP_N200: case usrp2_iface::USRP_N210: @@ -135,7 +135,7 @@ public: } } - void set_rx_digital_fine_gain(float gain) { //gain correction + void set_rx_digital_fine_gain(double gain) { //gain correction switch(_iface->get_rev()){ case usrp2_iface::USRP_N200: case usrp2_iface::USRP_N210: diff --git a/host/lib/usrp/usrp2/codec_ctrl.hpp b/host/lib/usrp/usrp2/codec_ctrl.hpp index c8d977a1f..8ca5b4f42 100644 --- a/host/lib/usrp/usrp2/codec_ctrl.hpp +++ b/host/lib/usrp/usrp2/codec_ctrl.hpp @@ -54,14 +54,14 @@ public: * \param gain from 0-6dB */ - virtual void set_rx_digital_gain(float gain) = 0; + virtual void set_rx_digital_gain(double gain) = 0; /*! * Set the digital gain correction on the USRP2+ ADC (ADS62P44). * \param gain from 0-0.5dB */ - virtual void set_rx_digital_fine_gain(float gain) = 0; + virtual void set_rx_digital_fine_gain(double gain) = 0; }; diff --git a/host/lib/usrp/usrp2/codec_impl.cpp b/host/lib/usrp/usrp2/codec_impl.cpp index e417bc340..c52f0f46f 100644 --- a/host/lib/usrp/usrp2/codec_impl.cpp +++ b/host/lib/usrp/usrp2/codec_impl.cpp @@ -30,9 +30,9 @@ using namespace boost::assign; //this only applies to USRP2P static const uhd::dict codec_rx_gain_ranges = map_list_of - ("analog", gain_range_t(0, float(3.5), float(3.5))) - ("digital", gain_range_t(0, float(6.0), float(0.5))) - ("digital-fine", gain_range_t(0, float(0.5), float(0.05))); + ("analog", gain_range_t(0, 3.5, 3.5)) + ("digital", gain_range_t(0, 6.0, 0.5)) + ("digital-fine", gain_range_t(0, 0.5, 0.05)); /*********************************************************************** @@ -112,7 +112,7 @@ void usrp2_mboard_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val){ switch(key.as()) { case CODEC_PROP_GAIN_I: case CODEC_PROP_GAIN_Q: - this->rx_codec_set_gain(val.as(), key.name); + this->rx_codec_set_gain(val.as(), key.name); return; default: UHD_THROW_PROP_SET_ERROR(); @@ -123,7 +123,7 @@ void usrp2_mboard_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val){ * Helper function to set RX codec gain ***********************************************************************/ -void usrp2_mboard_impl::rx_codec_set_gain(float gain, const std::string &name){ +void usrp2_mboard_impl::rx_codec_set_gain(double gain, const std::string &name){ assert_has(codec_rx_gain_ranges.keys(), name, "codec rx gain name"); _codec_rx_gains[name] = gain; diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp index 54c1c735c..16bdd040c 100644 --- a/host/lib/usrp/usrp2/dboard_iface.cpp +++ b/host/lib/usrp/usrp2/dboard_iface.cpp @@ -44,8 +44,8 @@ public: return props; } - void write_aux_dac(unit_t, aux_dac_t, float); - float read_aux_adc(unit_t, aux_adc_t); + void write_aux_dac(unit_t, aux_dac_t, double); + double read_aux_adc(unit_t, aux_adc_t); void _set_pin_ctrl(unit_t, boost::uint16_t); void _set_atr_reg(unit_t, atr_reg_t, boost::uint16_t); @@ -294,7 +294,7 @@ void usrp2_dboard_iface::_write_aux_dac(unit_t unit){ ); } -void usrp2_dboard_iface::write_aux_dac(unit_t unit, aux_dac_t which, float value){ +void usrp2_dboard_iface::write_aux_dac(unit_t unit, aux_dac_t which, double value){ _dac_regs[unit].data = boost::math::iround(4095*value/3.3); _dac_regs[unit].cmd = ad5623_regs_t::CMD_WR_UP_DAC_CHAN_N; @@ -317,7 +317,7 @@ void usrp2_dboard_iface::write_aux_dac(unit_t unit, aux_dac_t which, float value this->_write_aux_dac(unit); } -float usrp2_dboard_iface::read_aux_adc(unit_t unit, aux_adc_t which){ +double usrp2_dboard_iface::read_aux_adc(unit_t unit, aux_adc_t which){ static const uhd::dict unit_to_spi_adc = map_list_of (UNIT_RX, SPI_SS_RX_ADC) (UNIT_TX, SPI_SS_TX_ADC) @@ -346,5 +346,5 @@ float usrp2_dboard_iface::read_aux_adc(unit_t unit, aux_adc_t which){ ))); //convert to voltage and return - return float(3.3*ad7922_regs.result/4095); + return 3.3*ad7922_regs.result/4095; } diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 6a25a8870..145353c1d 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -138,7 +138,7 @@ usrp2_mboard_impl::usrp2_mboard_impl( ); } else { - _mimo_clocking_mode_is_master = bool(_iface->peek32(_iface->regs.status) & (1 << 8)); + _mimo_clocking_mode_is_master = (_iface->peek32(_iface->regs.status) & (1 << 8)) != 0; } std::cout << boost::format("mboard%d MIMO %s") % _index % (_mimo_clocking_mode_is_master?"master":"slave") << std::endl; diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 3c937327b..4c85db168 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -132,8 +132,8 @@ private: wax_obj_proxy::sptr _rx_codec_proxy; wax_obj_proxy::sptr _tx_codec_proxy; - void rx_codec_set_gain(float, const std::string &); - uhd::dict _codec_rx_gains; + void rx_codec_set_gain(double, const std::string &); + uhd::dict _codec_rx_gains; //properties interface for rx dboard void rx_dboard_get(const wax::obj &, wax::obj &); diff --git a/host/lib/usrp/usrp_e100/codec_ctrl.cpp b/host/lib/usrp/usrp_e100/codec_ctrl.cpp index 18d9daca0..062c035a4 100644 --- a/host/lib/usrp/usrp_e100/codec_ctrl.cpp +++ b/host/lib/usrp/usrp_e100/codec_ctrl.cpp @@ -31,7 +31,7 @@ using namespace uhd; static const bool codec_debug = false; -const gain_range_t usrp_e100_codec_ctrl::tx_pga_gain_range(-20, 0, float(0.1)); +const gain_range_t usrp_e100_codec_ctrl::tx_pga_gain_range(-20, 0, double(0.1)); const gain_range_t usrp_e100_codec_ctrl::rx_pga_gain_range(0, 20, 1); /*********************************************************************** @@ -44,14 +44,14 @@ public: ~usrp_e100_codec_ctrl_impl(void); //aux adc and dac control - float read_aux_adc(aux_adc_t which); - void write_aux_dac(aux_dac_t which, float volts); + double read_aux_adc(aux_adc_t which); + void write_aux_dac(aux_dac_t which, double volts); //pga gain control - void set_tx_pga_gain(float); - float get_tx_pga_gain(void); - void set_rx_pga_gain(float, char); - float get_rx_pga_gain(char); + void set_tx_pga_gain(double); + double get_tx_pga_gain(void); + void set_rx_pga_gain(double, char); + double get_rx_pga_gain(char); private: usrp_e100_iface::sptr _iface; @@ -135,19 +135,19 @@ usrp_e100_codec_ctrl_impl::~usrp_e100_codec_ctrl_impl(void){ **********************************************************************/ static const int mtpgw = 255; //maximum tx pga gain word -void usrp_e100_codec_ctrl_impl::set_tx_pga_gain(float gain){ +void usrp_e100_codec_ctrl_impl::set_tx_pga_gain(double gain){ int gain_word = int(mtpgw*(gain - tx_pga_gain_range.start())/(tx_pga_gain_range.stop() - tx_pga_gain_range.start())); _ad9862_regs.tx_pga_gain = std::clip(gain_word, 0, mtpgw); this->send_reg(16); } -float usrp_e100_codec_ctrl_impl::get_tx_pga_gain(void){ +double usrp_e100_codec_ctrl_impl::get_tx_pga_gain(void){ return (_ad9862_regs.tx_pga_gain*(tx_pga_gain_range.stop() - tx_pga_gain_range.start())/mtpgw) + tx_pga_gain_range.start(); } static const int mrpgw = 0x14; //maximum rx pga gain word -void usrp_e100_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){ +void usrp_e100_codec_ctrl_impl::set_rx_pga_gain(double gain, char which){ int gain_word = int(mrpgw*(gain - rx_pga_gain_range.start())/(rx_pga_gain_range.stop() - rx_pga_gain_range.start())); gain_word = std::clip(gain_word, 0, mrpgw); switch(which){ @@ -163,7 +163,7 @@ void usrp_e100_codec_ctrl_impl::set_rx_pga_gain(float gain, char which){ } } -float usrp_e100_codec_ctrl_impl::get_rx_pga_gain(char which){ +double usrp_e100_codec_ctrl_impl::get_rx_pga_gain(char which){ int gain_word; switch(which){ case 'A': gain_word = _ad9862_regs.rx_pga_a; break; @@ -176,11 +176,11 @@ float usrp_e100_codec_ctrl_impl::get_rx_pga_gain(char which){ /*********************************************************************** * Codec Control AUX ADC Methods **********************************************************************/ -static float aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low){ - return float((boost::uint16_t(high) << 2) | low)*3.3/0x3ff; +static double aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low){ + return double((boost::uint16_t(high) << 2) | low)*3.3/0x3ff; } -float usrp_e100_codec_ctrl_impl::read_aux_adc(aux_adc_t which){ +double usrp_e100_codec_ctrl_impl::read_aux_adc(aux_adc_t which){ //check to see if the switch needs to be set bool write_switch = false; switch(which){ @@ -233,7 +233,7 @@ float usrp_e100_codec_ctrl_impl::read_aux_adc(aux_adc_t which){ /*********************************************************************** * Codec Control AUX DAC Methods **********************************************************************/ -void usrp_e100_codec_ctrl_impl::write_aux_dac(aux_dac_t which, float volts){ +void usrp_e100_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts){ //special case for aux dac d (aka sigma delta word) if (which == AUX_DAC_D){ boost::uint16_t dac_word = std::clip(boost::math::iround(volts*0xfff/3.3), 0, 0xfff); diff --git a/host/lib/usrp/usrp_e100/codec_ctrl.hpp b/host/lib/usrp/usrp_e100/codec_ctrl.hpp index 74ce9bd9a..fa66ed983 100644 --- a/host/lib/usrp/usrp_e100/codec_ctrl.hpp +++ b/host/lib/usrp/usrp_e100/codec_ctrl.hpp @@ -57,7 +57,7 @@ public: * \param which which of the 4 adcs * \return a value in volts */ - virtual float read_aux_adc(aux_adc_t which) = 0; + virtual double read_aux_adc(aux_adc_t which) = 0; //! aux dac identifier constants enum aux_dac_t{ @@ -72,19 +72,19 @@ public: * \param which which of the 4 dacs * \param volts the level in in volts */ - virtual void write_aux_dac(aux_dac_t which, float volts) = 0; + virtual void write_aux_dac(aux_dac_t which, double volts) = 0; //! Set the TX PGA gain - virtual void set_tx_pga_gain(float gain) = 0; + virtual void set_tx_pga_gain(double gain) = 0; //! Get the TX PGA gain - virtual float get_tx_pga_gain(void) = 0; + virtual double get_tx_pga_gain(void) = 0; //! Set the RX PGA gain ('A' or 'B') - virtual void set_rx_pga_gain(float gain, char which) = 0; + virtual void set_rx_pga_gain(double gain, char which) = 0; //! Get the RX PGA gain ('A' or 'B') - virtual float get_rx_pga_gain(char which) = 0; + virtual double get_rx_pga_gain(char which) = 0; }; #endif /* INCLUDED_USRP_E100_CODEC_CTRL_HPP */ diff --git a/host/lib/usrp/usrp_e100/codec_impl.cpp b/host/lib/usrp/usrp_e100/codec_impl.cpp index 6fd44bad3..dde77236c 100644 --- a/host/lib/usrp/usrp_e100/codec_impl.cpp +++ b/host/lib/usrp/usrp_e100/codec_impl.cpp @@ -86,12 +86,12 @@ void usrp_e100_impl::rx_codec_set(const wax::obj &key_, const wax::obj &val){ switch(key.as()){ case CODEC_PROP_GAIN_I: UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name); - _codec_ctrl->set_rx_pga_gain(val.as(), 'A'); + _codec_ctrl->set_rx_pga_gain(val.as(), 'A'); return; case CODEC_PROP_GAIN_Q: UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name); - _codec_ctrl->set_rx_pga_gain(val.as(), 'B'); + _codec_ctrl->set_rx_pga_gain(val.as(), 'B'); return; default: UHD_THROW_PROP_SET_ERROR(); @@ -141,7 +141,7 @@ void usrp_e100_impl::tx_codec_set(const wax::obj &key_, const wax::obj &val){ case CODEC_PROP_GAIN_I: //only one gain for I and Q case CODEC_PROP_GAIN_Q: UHD_ASSERT_THROW(key.name == ad9862_pga_gain_name); - _codec_ctrl->set_tx_pga_gain(val.as()); + _codec_ctrl->set_tx_pga_gain(val.as()); return; default: UHD_THROW_PROP_SET_ERROR(); diff --git a/host/lib/usrp/usrp_e100/dboard_iface.cpp b/host/lib/usrp/usrp_e100/dboard_iface.cpp index a5032f86f..6969ac718 100644 --- a/host/lib/usrp/usrp_e100/dboard_iface.cpp +++ b/host/lib/usrp/usrp_e100/dboard_iface.cpp @@ -60,8 +60,8 @@ public: return props; } - void write_aux_dac(unit_t, aux_dac_t, float); - float read_aux_adc(unit_t, aux_adc_t); + void write_aux_dac(unit_t, aux_dac_t, double); + double read_aux_adc(unit_t, aux_adc_t); void _set_pin_ctrl(unit_t, boost::uint16_t); void _set_atr_reg(unit_t, atr_reg_t, boost::uint16_t); @@ -270,7 +270,7 @@ byte_vector_t usrp_e100_dboard_iface::read_i2c(boost::uint8_t addr, size_t num_b /*********************************************************************** * Aux DAX/ADC **********************************************************************/ -void usrp_e100_dboard_iface::write_aux_dac(dboard_iface::unit_t, aux_dac_t which, float value){ +void usrp_e100_dboard_iface::write_aux_dac(dboard_iface::unit_t, aux_dac_t which, double value){ //same aux dacs for each unit static const uhd::dict which_to_aux_dac = map_list_of (AUX_DAC_A, usrp_e100_codec_ctrl::AUX_DAC_A) @@ -281,7 +281,7 @@ void usrp_e100_dboard_iface::write_aux_dac(dboard_iface::unit_t, aux_dac_t which _codec->write_aux_dac(which_to_aux_dac[which], value); } -float usrp_e100_dboard_iface::read_aux_adc(dboard_iface::unit_t unit, aux_adc_t which){ +double usrp_e100_dboard_iface::read_aux_adc(dboard_iface::unit_t unit, aux_adc_t which){ static const uhd::dict< unit_t, uhd::dict > unit_to_which_to_aux_adc = map_list_of diff --git a/host/lib/utils/gain_group.cpp b/host/lib/utils/gain_group.cpp index d577c71bc..07aa21115 100644 --- a/host/lib/utils/gain_group.cpp +++ b/host/lib/utils/gain_group.cpp @@ -39,7 +39,7 @@ static bool compare_by_step_size( * Get a multiple of step with the following relation: * result = step*floor(num/step) * - * Due to small gain_ting-point inaccuracies: + * Due to small doubleing-point inaccuracies: * num = n*step + e, where e is a small inaccuracy. * When e is negative, floor would yeild (n-1)*step, * despite that n*step is really the desired result. @@ -66,7 +66,7 @@ public: gain_range_t get_range(const std::string &name){ if (not name.empty()) return _name_to_fcns[name].get_range(); - gain_t overall_min = 0, overall_max = 0, overall_step = 0; + double overall_min = 0, overall_max = 0, overall_step = 0; BOOST_FOREACH(const gain_fcns_t &fcns, get_all_fcns()){ const gain_range_t range = fcns.get_range(); overall_min += range.start(); @@ -78,33 +78,33 @@ public: return gain_range_t(overall_min, overall_max, overall_step); } - gain_t get_value(const std::string &name){ + double get_value(const std::string &name){ if (not name.empty()) return _name_to_fcns[name].get_value(); - gain_t overall_gain = 0; + double overall_gain = 0; BOOST_FOREACH(const gain_fcns_t &fcns, get_all_fcns()){ overall_gain += fcns.get_value(); } return overall_gain; } - void set_value(gain_t gain, const std::string &name){ + void set_value(double gain, const std::string &name){ if (not name.empty()) return _name_to_fcns[name].set_value(gain); std::vector all_fcns = get_all_fcns(); if (all_fcns.size() == 0) return; //nothing to set! //get the max step size among the gains - gain_t max_step = 0; + double max_step = 0; BOOST_FOREACH(const gain_fcns_t &fcns, all_fcns){ max_step = std::max(max_step, fcns.get_range().step()); } //create gain bucket to distribute power - std::vector gain_bucket; + std::vector gain_bucket; //distribute power according to priority (round to max step) - gain_t gain_left_to_distribute = gain; + double gain_left_to_distribute = gain; BOOST_FOREACH(const gain_fcns_t &fcns, all_fcns){ const gain_range_t range = fcns.get_range(); gain_bucket.push_back(floor_step(std::clip( @@ -131,7 +131,7 @@ public: //fill in the largest step sizes first that are less than the remainder BOOST_FOREACH(size_t i, indexes_step_size_dec){ const gain_range_t range = all_fcns.at(i).get_range(); - gain_t additional_gain = floor_step(std::clip( + double additional_gain = floor_step(std::clip( gain_bucket.at(i) + gain_left_to_distribute, range.start(), range.stop() ), range.step()) - gain_bucket.at(i); gain_bucket.at(i) += additional_gain; diff --git a/host/test/gain_group_test.cpp b/host/test/gain_group_test.cpp index 57560aaa1..53142ef21 100644 --- a/host/test/gain_group_test.cpp +++ b/host/test/gain_group_test.cpp @@ -35,17 +35,17 @@ public: return gain_range_t(0, 90, 1); } - float get_value(void){ + double get_value(void){ return _gain; } - void set_value(float gain){ - float step = get_range().step(); + void set_value(double gain){ + double step = get_range().step(); _gain = step*rint(gain/step); } private: - float _gain; + double _gain; }; class gain_element2{ @@ -55,17 +55,17 @@ public: return gain_range_t(-20, 10, 0.1); } - float get_value(void){ + double get_value(void){ return _gain; } - void set_value(float gain){ - float step = get_range().step(); + void set_value(double gain){ + double step = get_range().step(); _gain = step*rint(gain/step); } private: - float _gain; + double _gain; }; //create static instances of gain elements to be shared by the tests -- cgit v1.2.3 From 41e774c7c38ed8498e8bfad877f237ed090238ce Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 13 Jan 2011 12:22:03 -0800 Subject: usrp1: implement soft time ctrl for send at, recv at --- host/lib/usrp/usrp1/CMakeLists.txt | 1 + host/lib/usrp/usrp1/io_impl.cpp | 2 + host/lib/usrp/usrp1/mboard_impl.cpp | 25 +++-- host/lib/usrp/usrp1/soft_time_ctrl.cpp | 179 +++++++++++++++++++++++++++++++++ host/lib/usrp/usrp1/soft_time_ctrl.hpp | 70 +++++++++++++ host/lib/usrp/usrp1/usrp1_impl.cpp | 4 + host/lib/usrp/usrp1/usrp1_impl.hpp | 6 +- 7 files changed, 275 insertions(+), 12 deletions(-) create mode 100644 host/lib/usrp/usrp1/soft_time_ctrl.cpp create mode 100644 host/lib/usrp/usrp1/soft_time_ctrl.hpp (limited to 'host/lib/usrp/usrp1') diff --git a/host/lib/usrp/usrp1/CMakeLists.txt b/host/lib/usrp/usrp1/CMakeLists.txt index 519e17bfa..d72d67c0a 100644 --- a/host/lib/usrp/usrp1/CMakeLists.txt +++ b/host/lib/usrp/usrp1/CMakeLists.txt @@ -38,6 +38,7 @@ IF(ENABLE_USRP1) ${CMAKE_CURRENT_SOURCE_DIR}/dsp_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/io_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mboard_impl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/soft_time_ctrl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_iface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_iface.hpp ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_impl.cpp diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index 7107294b6..a88b6503a 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -208,6 +208,7 @@ size_t usrp1_impl::send( const tx_metadata_t &metadata, const io_type_t &io_type, send_mode_t send_mode, double timeout ){ + _soft_time_ctrl->send_pre(metadata, timeout); size_t num_samps_sent = vrt_packet_handler::send( _io_impl->packet_handler_send_state, //last state of the send handler buffs, num_samps, //buffer to fill @@ -294,6 +295,7 @@ size_t usrp1_impl::recv( 0, //vrt header offset _rx_subdev_spec.size() //num channels ); + _soft_time_ctrl->recv_post(metadata, num_samps_recvd); //handle the polling for overflow conditions _io_impl->overflow_poll_samp_count += num_samps_recvd; diff --git a/host/lib/usrp/usrp1/mboard_impl.cpp b/host/lib/usrp/usrp1/mboard_impl.cpp index 4df5ada0a..6e10e86ce 100644 --- a/host/lib/usrp/usrp1/mboard_impl.cpp +++ b/host/lib/usrp/usrp1/mboard_impl.cpp @@ -240,16 +240,11 @@ void usrp1_impl::mboard_init(void) } } -void usrp1_impl::issue_stream_cmd(const stream_cmd_t &stream_cmd) -{ - switch(stream_cmd.stream_mode){ - case stream_cmd_t::STREAM_MODE_START_CONTINUOUS: - return _iface->write_firmware_cmd(VRQ_FPGA_SET_RX_ENABLE, true, 0, 0, 0); - - case stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS: - return _iface->write_firmware_cmd(VRQ_FPGA_SET_RX_ENABLE, false, 0, 0, 0); - - default: throw std::runtime_error("unsupported stream command type for USRP1"); +void usrp1_impl::stream_on_off(bool stream){ + return _iface->write_firmware_cmd(VRQ_FPGA_SET_RX_ENABLE, stream, 0, 0, 0); + //drain any junk in the receive transport after stop streaming command + while(not stream and _data_transport->get_recv_buff(0.0).get() != NULL){ + /* NOP */ } } @@ -326,6 +321,10 @@ void usrp1_impl::mboard_get(const wax::obj &key_, wax::obj &val) val = _iface->mb_eeprom; return; + case MBOARD_PROP_TIME_NOW: + val = _soft_time_ctrl->get_time(); + return; + default: UHD_THROW_PROP_GET_ERROR(); } } @@ -348,7 +347,7 @@ void usrp1_impl::mboard_set(const wax::obj &key, const wax::obj &val) switch(key.as()){ case MBOARD_PROP_STREAM_CMD: - issue_stream_cmd(val.as()); + _soft_time_ctrl->issue_stream_cmd(val.as()); return; case MBOARD_PROP_RX_SUBDEV_SPEC: @@ -384,6 +383,10 @@ void usrp1_impl::mboard_set(const wax::obj &key, const wax::obj &val) _iface->mb_eeprom = mboard_eeprom_t(*_iface, mboard_eeprom_t::MAP_B000); return; + case MBOARD_PROP_TIME_NOW: + _soft_time_ctrl->set_time(val.as()); + return; + default: UHD_THROW_PROP_SET_ERROR(); } } diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.cpp b/host/lib/usrp/usrp1/soft_time_ctrl.cpp new file mode 100644 index 000000000..8a6294690 --- /dev/null +++ b/host/lib/usrp/usrp1/soft_time_ctrl.cpp @@ -0,0 +1,179 @@ +// +// Copyright 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 +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include "soft_time_ctrl.hpp" +#include +#include +#include +#include +#include +#include + +using namespace uhd; +using namespace uhd::usrp; +using namespace uhd::transport; +namespace pt = boost::posix_time; +namespace lt = boost::local_time; + +/*********************************************************************** + * Utility helper functions + **********************************************************************/ + +//TODO put these in time_spec_t (maybe useful) + +time_spec_t time_dur_to_time_spec(const pt::time_duration &time_dur){ + return time_spec_t( + time_dur.total_seconds(), + time_dur.fractional_seconds(), + pt::time_duration::ticks_per_second() + ); +} + +pt::time_duration time_spec_to_time_dur(const time_spec_t &time_spec){ + return pt::time_duration( + 0, 0, time_spec.get_full_secs(), + time_spec.get_tick_count(pt::time_duration::ticks_per_second()) + ); +} + +/*********************************************************************** + * Soft time control implementation + **********************************************************************/ +class soft_time_ctrl_impl : public soft_time_ctrl{ +public: + soft_time_ctrl_impl(const cb_fcn_type &stream_on_off): + _nsamps_remaining(0), + _stream_mode(stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS), + _cmd_queue(bounded_buffer::make(2)), + _stream_on_off(stream_on_off) + { + //synchronously spawn a new thread + _update_mutex.lock(); //lock mutex before spawned + _thread_group.create_thread(boost::bind(&soft_time_ctrl_impl::recv_cmd_dispatcher, this)); + _update_mutex.lock(); //lock blocks until spawned + _update_mutex.unlock(); //unlock mutex before done + } + + ~soft_time_ctrl_impl(void){ + _thread_running = false; + _thread_group.join_all(); + } + + void set_time(const time_spec_t &time){ + _time_offset = pt::microsec_clock::universal_time() - time_spec_to_time_dur(time); + } + + time_spec_t get_time(void){ + return time_dur_to_time_spec(pt::microsec_clock::universal_time() - _time_offset); + } + + void recv_post(rx_metadata_t &md, size_t &nsamps){ + //load the metadata with the current time + md.has_time_spec = true; + md.time_spec = get_time(); + + //lock the mutex here before changing state + boost::mutex::scoped_lock lock(_update_mutex); + + //When to stop streaming: + //The samples have been received and the stream mode is non-continuous. + //Rewrite the sample count to clip to the requested number of samples. + if (_nsamps_remaining <= nsamps and + _stream_mode != stream_cmd_t::STREAM_MODE_START_CONTINUOUS + ){ + nsamps = _nsamps_remaining; //set nsamps, then stop + stream_on_off(false); + return; + } + + //update the consumed samples + _nsamps_remaining -= nsamps; + } + + void send_pre(const tx_metadata_t &md, double /*TODO timeout*/){ + if (not md.has_time_spec) return; + sleep_until_time(md.time_spec); //TODO late? + } + + void issue_stream_cmd(const stream_cmd_t &cmd){ + _cmd_queue->push_with_wait(cmd); + } + +private: + + void sleep_until_time(const time_spec_t &time){ + boost::this_thread::sleep(_time_offset + time_spec_to_time_dur(time)); + } + + void recv_cmd_handle_cmd(const stream_cmd_t &cmd){ + //handle the stream at time by sleeping + if (not cmd.stream_now) sleep_until_time(cmd.time_spec); //TODO late? + + //lock the mutex here before changing state + boost::mutex::scoped_lock lock(_update_mutex); + + //When to stop streaming: + //Stop streaming when the command is a stop and streaming. + if (cmd.stream_mode == stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS + and _stream_mode != stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS + ) stream_on_off(false); + + //When to start streaming: + //Start streaming when the command is not a stop and not streaming. + if (cmd.stream_mode != stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS + and _stream_mode == stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS + ) stream_on_off(true); + + //update the state + _nsamps_remaining += cmd.num_samps; + _stream_mode = cmd.stream_mode; + } + + void recv_cmd_dispatcher(void){ + _thread_running = true; + _update_mutex.unlock(); + + boost::any cmd; + while (_thread_running){ + if (_cmd_queue->pop_with_timed_wait(cmd, 1.0)){ + recv_cmd_handle_cmd(boost::any_cast(cmd)); + } + } + } + + void stream_on_off(bool stream){ + _stream_on_off(stream); + _nsamps_remaining = 0; + } + + boost::mutex _update_mutex; + size_t _nsamps_remaining; + stream_cmd_t::stream_mode_t _stream_mode; + + pt::ptime _time_offset; + bounded_buffer::sptr _cmd_queue; + const cb_fcn_type _stream_on_off; + boost::thread_group _thread_group; + bool _thread_running; +}; + +/*********************************************************************** + * Soft time control factor + **********************************************************************/ +soft_time_ctrl::sptr soft_time_ctrl::make(const cb_fcn_type &stream_on_off){ + return sptr(new soft_time_ctrl_impl(stream_on_off)); +} diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.hpp b/host/lib/usrp/usrp1/soft_time_ctrl.hpp new file mode 100644 index 000000000..42056c285 --- /dev/null +++ b/host/lib/usrp/usrp1/soft_time_ctrl.hpp @@ -0,0 +1,70 @@ +// +// Copyright 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 +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#ifndef INCLUDED_LIBUHD_USRP_USRP1_SOFT_TIME_CTRL_HPP +#define INCLUDED_LIBUHD_USRP_USRP1_SOFT_TIME_CTRL_HPP + +#include +#include +#include +#include +#include +#include + +namespace uhd{ namespace usrp{ + +/*! + * The soft time control emulates some of the + * advanced streaming capabilities of the later USRP models. + * Soft time control uses the system time to emulate + * timed transmits, timed receive commands, device time, + * and inline and async error messages. + */ +class soft_time_ctrl : boost::noncopyable{ +public: + typedef boost::shared_ptr sptr; + typedef boost::function cb_fcn_type; + + /*! + * Make a new soft time control. + * \param start_streaming a function callback to start streaming + * \param stop_streaming a function callback to stop streaming + * \return a new soft time control object + */ + static sptr make(const cb_fcn_type &stream_on_off); + //TODO pass in the error queue for async msgs + //TODO pass in the queue for inline msgs + + //! Set the current time + virtual void set_time(const time_spec_t &time) = 0; + + //! Get the current time + virtual time_spec_t get_time(void) = 0; + + //! Call after the internal recv function + virtual void recv_post(rx_metadata_t &md, size_t &nsamps) = 0; + + //! Call before the internal send function + virtual void send_pre(const tx_metadata_t &md, double timeout) = 0; + + //! Issue a stream command to receive + virtual void issue_stream_cmd(const stream_cmd_t &cmd) = 0; +}; + +}} //namespace + +#endif /* INCLUDED_LIBUHD_USRP_USRP1_SOFT_TIME_CTRL_HPP */ diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 6016b0979..21f2b148a 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -161,6 +161,10 @@ usrp1_impl::usrp1_impl(uhd::transport::usb_zero_copy::sptr data_transport, usrp_ctrl::sptr ctrl_transport) : _data_transport(data_transport), _ctrl_transport(ctrl_transport) { + _soft_time_ctrl = soft_time_ctrl::make( + boost::bind(&usrp1_impl::stream_on_off, this, _1) + ); + _iface = usrp1_iface::make(ctrl_transport); //create clock interface diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index ff4d40762..d92ce6e79 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -19,6 +19,7 @@ #include "usrp1_ctrl.hpp" #include "clock_ctrl.hpp" #include "codec_ctrl.hpp" +#include "soft_time_ctrl.hpp" #include #include #include @@ -114,13 +115,16 @@ private: const uhd::usrp::dboard_id_t &rx_dboard_id ); + //soft time control emulation + uhd::usrp::soft_time_ctrl::sptr _soft_time_ctrl; + //interface to ioctls and file descriptor usrp1_iface::sptr _iface; //handle io stuff UHD_PIMPL_DECL(io_impl) _io_impl; void io_init(void); - void issue_stream_cmd(const uhd::stream_cmd_t &stream_cmd); + void stream_on_off(bool); void handle_overrun(size_t); //underrun and overrun poll intervals -- cgit v1.2.3 From 261bb80d73d02f501acb6c0cd837570880c03043 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 13 Jan 2011 16:22:07 -0800 Subject: uhd: update copyright dates on host code --- host/CMakeLists.txt | 2 +- host/examples/rx_ascii_art_dft.cpp | 2 +- host/examples/rx_samples_to_file.cpp | 2 +- host/examples/rx_samples_to_udp.cpp | 2 +- host/examples/rx_timed_samples.cpp | 2 +- host/examples/tx_from_file.cpp | 2 +- host/examples/tx_timed_samples.cpp | 2 +- host/examples/tx_waveforms.cpp | 2 +- host/include/uhd/usrp/codec_props.hpp | 2 +- host/include/uhd/usrp/dboard_iface.hpp | 2 +- host/include/uhd/usrp/single_usrp.hpp | 2 +- host/include/uhd/usrp/subdev_props.hpp | 2 +- host/include/uhd/utils/algorithm.hpp | 2 +- host/lib/usrp/dboard/db_basic_and_lf.cpp | 2 +- host/lib/usrp/dboard/db_dbsrx.cpp | 2 +- host/lib/usrp/dboard/db_dbsrx2.cpp | 2 +- host/lib/usrp/dboard/db_rfx.cpp | 2 +- host/lib/usrp/dboard/db_tvrx.cpp | 2 +- host/lib/usrp/dboard/db_unknown.cpp | 2 +- host/lib/usrp/dboard/db_wbx.cpp | 2 +- host/lib/usrp/mboard_eeprom.cpp | 2 +- host/lib/usrp/misc_utils.cpp | 2 +- host/lib/usrp/multi_usrp.cpp | 2 +- host/lib/usrp/single_usrp.cpp | 2 +- host/lib/usrp/subdev_spec.cpp | 2 +- host/lib/usrp/usrp1/CMakeLists.txt | 2 +- host/lib/usrp/usrp1/codec_ctrl.cpp | 2 +- host/lib/usrp/usrp1/codec_ctrl.hpp | 2 +- host/lib/usrp/usrp1/codec_impl.cpp | 2 +- host/lib/usrp/usrp1/dboard_iface.cpp | 2 +- host/lib/usrp/usrp1/io_impl.cpp | 2 +- host/lib/usrp/usrp1/mboard_impl.cpp | 2 +- host/lib/usrp/usrp1/usrp1_impl.cpp | 2 +- host/lib/usrp/usrp1/usrp1_impl.hpp | 2 +- host/lib/usrp/usrp2/codec_ctrl.cpp | 2 +- host/lib/usrp/usrp2/codec_ctrl.hpp | 2 +- host/lib/usrp/usrp2/codec_impl.cpp | 2 +- host/lib/usrp/usrp2/dboard_iface.cpp | 2 +- host/lib/usrp/usrp2/usrp2_impl.cpp | 2 +- host/lib/usrp/usrp2/usrp2_impl.hpp | 2 +- host/lib/usrp/usrp_e100/codec_ctrl.cpp | 2 +- host/lib/usrp/usrp_e100/codec_ctrl.hpp | 2 +- host/lib/usrp/usrp_e100/codec_impl.cpp | 2 +- host/lib/usrp/usrp_e100/dboard_iface.cpp | 2 +- host/lib/usrp/usrp_e100/mboard_impl.cpp | 2 +- host/lib/utils/paths.cpp | 2 +- host/lib/utils/warning.cpp | 2 +- host/utils/uhd_usrp_probe.cpp | 2 +- 48 files changed, 48 insertions(+), 48 deletions(-) (limited to 'host/lib/usrp/usrp1') diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 6a2b62a6d..d7e6a6a50 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -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 diff --git a/host/examples/rx_ascii_art_dft.cpp b/host/examples/rx_ascii_art_dft.cpp index b677bcb07..260feca24 100644 --- a/host/examples/rx_ascii_art_dft.cpp +++ b/host/examples/rx_ascii_art_dft.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 diff --git a/host/examples/rx_samples_to_file.cpp b/host/examples/rx_samples_to_file.cpp index 6a6528a12..81977035e 100644 --- a/host/examples/rx_samples_to_file.cpp +++ b/host/examples/rx_samples_to_file.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 diff --git a/host/examples/rx_samples_to_udp.cpp b/host/examples/rx_samples_to_udp.cpp index 5f1cd4a57..55b9a50ba 100644 --- a/host/examples/rx_samples_to_udp.cpp +++ b/host/examples/rx_samples_to_udp.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 diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp index 7f2354afb..a19532f50 100644 --- a/host/examples/rx_timed_samples.cpp +++ b/host/examples/rx_timed_samples.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 diff --git a/host/examples/tx_from_file.cpp b/host/examples/tx_from_file.cpp index a84456718..8af9b0f4a 100644 --- a/host/examples/tx_from_file.cpp +++ b/host/examples/tx_from_file.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 diff --git a/host/examples/tx_timed_samples.cpp b/host/examples/tx_timed_samples.cpp index 4e83cf3ea..074b13e81 100644 --- a/host/examples/tx_timed_samples.cpp +++ b/host/examples/tx_timed_samples.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 diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp index 238a24b88..7cc1f5ae0 100644 --- a/host/examples/tx_waveforms.cpp +++ b/host/examples/tx_waveforms.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 diff --git a/host/include/uhd/usrp/codec_props.hpp b/host/include/uhd/usrp/codec_props.hpp index c3aba143f..5d0a2913c 100644 --- a/host/include/uhd/usrp/codec_props.hpp +++ b/host/include/uhd/usrp/codec_props.hpp @@ -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 diff --git a/host/include/uhd/usrp/dboard_iface.hpp b/host/include/uhd/usrp/dboard_iface.hpp index 3ac170b52..cfb727017 100644 --- a/host/include/uhd/usrp/dboard_iface.hpp +++ b/host/include/uhd/usrp/dboard_iface.hpp @@ -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 diff --git a/host/include/uhd/usrp/single_usrp.hpp b/host/include/uhd/usrp/single_usrp.hpp index d56b0a47a..d80999300 100644 --- a/host/include/uhd/usrp/single_usrp.hpp +++ b/host/include/uhd/usrp/single_usrp.hpp @@ -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 diff --git a/host/include/uhd/usrp/subdev_props.hpp b/host/include/uhd/usrp/subdev_props.hpp index fb4b5fc15..8d05f4c27 100644 --- a/host/include/uhd/usrp/subdev_props.hpp +++ b/host/include/uhd/usrp/subdev_props.hpp @@ -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 diff --git a/host/include/uhd/utils/algorithm.hpp b/host/include/uhd/utils/algorithm.hpp index ed0220a25..5e2230371 100644 --- a/host/include/uhd/utils/algorithm.hpp +++ b/host/include/uhd/utils/algorithm.hpp @@ -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 diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp index 745c2d8e6..b311576d2 100644 --- a/host/lib/usrp/dboard/db_basic_and_lf.cpp +++ b/host/lib/usrp/dboard/db_basic_and_lf.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 diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp index 491c282ad..3ea9cea80 100644 --- a/host/lib/usrp/dboard/db_dbsrx.cpp +++ b/host/lib/usrp/dboard/db_dbsrx.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 diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp index 1da9b5ff3..defb70ff5 100644 --- a/host/lib/usrp/dboard/db_dbsrx2.cpp +++ b/host/lib/usrp/dboard/db_dbsrx2.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 diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 3b66b6939..cd25ee9b7 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.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 diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp index f034f0ef6..4eb29c3e8 100644 --- a/host/lib/usrp/dboard/db_tvrx.cpp +++ b/host/lib/usrp/dboard/db_tvrx.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 diff --git a/host/lib/usrp/dboard/db_unknown.cpp b/host/lib/usrp/dboard/db_unknown.cpp index ccda93c04..d91d58409 100644 --- a/host/lib/usrp/dboard/db_unknown.cpp +++ b/host/lib/usrp/dboard/db_unknown.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 diff --git a/host/lib/usrp/dboard/db_wbx.cpp b/host/lib/usrp/dboard/db_wbx.cpp index cdf23836b..135997789 100644 --- a/host/lib/usrp/dboard/db_wbx.cpp +++ b/host/lib/usrp/dboard/db_wbx.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 diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp index 9cc252380..f7f4b2c68 100644 --- a/host/lib/usrp/mboard_eeprom.cpp +++ b/host/lib/usrp/mboard_eeprom.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 diff --git a/host/lib/usrp/misc_utils.cpp b/host/lib/usrp/misc_utils.cpp index 0385187eb..02f4b216d 100644 --- a/host/lib/usrp/misc_utils.cpp +++ b/host/lib/usrp/misc_utils.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 diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index ab78fb4b6..48eec28c1 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.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 diff --git a/host/lib/usrp/single_usrp.cpp b/host/lib/usrp/single_usrp.cpp index e63cdaea9..c37449c5f 100644 --- a/host/lib/usrp/single_usrp.cpp +++ b/host/lib/usrp/single_usrp.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 diff --git a/host/lib/usrp/subdev_spec.cpp b/host/lib/usrp/subdev_spec.cpp index c905eab7d..51c88bda3 100644 --- a/host/lib/usrp/subdev_spec.cpp +++ b/host/lib/usrp/subdev_spec.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 diff --git a/host/lib/usrp/usrp1/CMakeLists.txt b/host/lib/usrp/usrp1/CMakeLists.txt index d72d67c0a..9e50f5728 100644 --- a/host/lib/usrp/usrp1/CMakeLists.txt +++ b/host/lib/usrp/usrp1/CMakeLists.txt @@ -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 diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp index 553f78ef8..6342bb057 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.cpp +++ b/host/lib/usrp/usrp1/codec_ctrl.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 diff --git a/host/lib/usrp/usrp1/codec_ctrl.hpp b/host/lib/usrp/usrp1/codec_ctrl.hpp index c0f44ebf4..043acc8bd 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.hpp +++ b/host/lib/usrp/usrp1/codec_ctrl.hpp @@ -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 diff --git a/host/lib/usrp/usrp1/codec_impl.cpp b/host/lib/usrp/usrp1/codec_impl.cpp index fe60c8b9a..14ecd2d2e 100644 --- a/host/lib/usrp/usrp1/codec_impl.cpp +++ b/host/lib/usrp/usrp1/codec_impl.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 diff --git a/host/lib/usrp/usrp1/dboard_iface.cpp b/host/lib/usrp/usrp1/dboard_iface.cpp index 180faf1da..eec4a52db 100644 --- a/host/lib/usrp/usrp1/dboard_iface.cpp +++ b/host/lib/usrp/usrp1/dboard_iface.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 diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index a88b6503a..b5d4970c4 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.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 diff --git a/host/lib/usrp/usrp1/mboard_impl.cpp b/host/lib/usrp/usrp1/mboard_impl.cpp index 6e10e86ce..2804671b7 100644 --- a/host/lib/usrp/usrp1/mboard_impl.cpp +++ b/host/lib/usrp/usrp1/mboard_impl.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 diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 21f2b148a..04a199928 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.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 diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index d92ce6e79..18a8683a7 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -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 diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp index 7bd19cbe3..82174960c 100644 --- a/host/lib/usrp/usrp2/codec_ctrl.cpp +++ b/host/lib/usrp/usrp2/codec_ctrl.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 diff --git a/host/lib/usrp/usrp2/codec_ctrl.hpp b/host/lib/usrp/usrp2/codec_ctrl.hpp index 8ca5b4f42..ca300e2b1 100644 --- a/host/lib/usrp/usrp2/codec_ctrl.hpp +++ b/host/lib/usrp/usrp2/codec_ctrl.hpp @@ -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 diff --git a/host/lib/usrp/usrp2/codec_impl.cpp b/host/lib/usrp/usrp2/codec_impl.cpp index c52f0f46f..eda15697b 100644 --- a/host/lib/usrp/usrp2/codec_impl.cpp +++ b/host/lib/usrp/usrp2/codec_impl.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 diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp index 16bdd040c..c539b0058 100644 --- a/host/lib/usrp/usrp2/dboard_iface.cpp +++ b/host/lib/usrp/usrp2/dboard_iface.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 diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 06ca61e13..059ddf65f 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.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 diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 4c85db168..d0f5ecf37 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -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 diff --git a/host/lib/usrp/usrp_e100/codec_ctrl.cpp b/host/lib/usrp/usrp_e100/codec_ctrl.cpp index 062c035a4..b33c8ae65 100644 --- a/host/lib/usrp/usrp_e100/codec_ctrl.cpp +++ b/host/lib/usrp/usrp_e100/codec_ctrl.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 diff --git a/host/lib/usrp/usrp_e100/codec_ctrl.hpp b/host/lib/usrp/usrp_e100/codec_ctrl.hpp index fa66ed983..05d7aab38 100644 --- a/host/lib/usrp/usrp_e100/codec_ctrl.hpp +++ b/host/lib/usrp/usrp_e100/codec_ctrl.hpp @@ -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 diff --git a/host/lib/usrp/usrp_e100/codec_impl.cpp b/host/lib/usrp/usrp_e100/codec_impl.cpp index dde77236c..0d91fb42c 100644 --- a/host/lib/usrp/usrp_e100/codec_impl.cpp +++ b/host/lib/usrp/usrp_e100/codec_impl.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 diff --git a/host/lib/usrp/usrp_e100/dboard_iface.cpp b/host/lib/usrp/usrp_e100/dboard_iface.cpp index 6969ac718..e4c3856c9 100644 --- a/host/lib/usrp/usrp_e100/dboard_iface.cpp +++ b/host/lib/usrp/usrp_e100/dboard_iface.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 diff --git a/host/lib/usrp/usrp_e100/mboard_impl.cpp b/host/lib/usrp/usrp_e100/mboard_impl.cpp index 51625ed54..2c5699e08 100644 --- a/host/lib/usrp/usrp_e100/mboard_impl.cpp +++ b/host/lib/usrp/usrp_e100/mboard_impl.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 diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp index f2037a38d..93d15d290 100644 --- a/host/lib/utils/paths.cpp +++ b/host/lib/utils/paths.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 diff --git a/host/lib/utils/warning.cpp b/host/lib/utils/warning.cpp index 09a12aba5..bc4c79b6e 100644 --- a/host/lib/utils/warning.cpp +++ b/host/lib/utils/warning.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 diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp index 8b28e8280..b32131b2a 100644 --- a/host/utils/uhd_usrp_probe.cpp +++ b/host/utils/uhd_usrp_probe.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 -- cgit v1.2.3 From d71344091b324266975b58ec075d896fcb79aeb9 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 17 Jan 2011 15:18:46 -0800 Subject: usrp1: work on usrp1 hardware compat with the api today we added shutoff the DAC when not transmitting using EOB as an indicator added various other features and cleaned up code for soft time control --- host/docs/usrp1.rst | 3 +- host/lib/usrp/usrp1/codec_ctrl.cpp | 6 ++ host/lib/usrp/usrp1/codec_ctrl.hpp | 5 +- host/lib/usrp/usrp1/io_impl.cpp | 36 ++++++++-- host/lib/usrp/usrp1/mboard_impl.cpp | 8 --- host/lib/usrp/usrp1/soft_time_ctrl.cpp | 122 ++++++++++++++++++++++----------- host/lib/usrp/usrp1/soft_time_ctrl.hpp | 5 +- host/lib/usrp/usrp1/usrp1_ctrl.cpp | 29 +++++--- host/lib/usrp/usrp1/usrp1_ctrl.hpp | 17 +---- host/lib/usrp/usrp1/usrp1_impl.cpp | 8 +-- host/lib/usrp/usrp1/usrp1_impl.hpp | 3 +- 11 files changed, 156 insertions(+), 86 deletions(-) (limited to 'host/lib/usrp/usrp1') diff --git a/host/docs/usrp1.rst b/host/docs/usrp1.rst index 44ddb20ca..a8d3193fd 100644 --- a/host/docs/usrp1.rst +++ b/host/docs/usrp1.rst @@ -80,6 +80,7 @@ List of emulated features * Transmitting at a specific time * Receiving at a specific time * Receiving a specific number of samples +* Start and end burst flags on transmit **Note:** These emulated features rely on the host system's clock for timed operations, @@ -92,7 +93,7 @@ List of missing features * Notification on late transmit packet * Notification on broken chain error * Notification on underflow or overflow -* Transmit and receive burst flags +* Start and end burst flags for receive ------------------------------------------------------------------------ OS specific notes diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp index 6342bb057..f3816b377 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.cpp +++ b/host/lib/usrp/usrp1/codec_ctrl.cpp @@ -55,6 +55,7 @@ public: //duc control void set_duc_freq(double freq); + void enable_tx_digital(bool enb); //pga gain control void set_tx_pga_gain(double); @@ -421,6 +422,11 @@ void usrp1_codec_ctrl_impl::set_duc_freq(double freq) this->send_reg(23); } +void usrp1_codec_ctrl_impl::enable_tx_digital(bool enb){ + _ad9862_regs.tx_digital_pd = (enb)? 0 : 1; + this->send_reg(8); +} + /*********************************************************************** * Codec Control ADC buffer bypass * Disable this for AC-coupled daughterboards (TVRX) diff --git a/host/lib/usrp/usrp1/codec_ctrl.hpp b/host/lib/usrp/usrp1/codec_ctrl.hpp index 043acc8bd..20e4015c5 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.hpp +++ b/host/lib/usrp/usrp1/codec_ctrl.hpp @@ -92,7 +92,10 @@ public: //! Set the TX modulator frequency virtual void set_duc_freq(double freq) = 0; - + + //! Enable or disable the digital part of the DAC + virtual void enable_tx_digital(bool enb) = 0; + //! Enable or disable ADC buffer bypass virtual void bypass_adc_buffers(bool bypass) = 0; }; diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index b5d4970c4..9fa1b4f72 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -91,6 +91,7 @@ struct usrp1_impl::io_impl{ void commit_send_buff(offset_send_buffer::sptr, offset_send_buffer::sptr, size_t); void flush_send_buff(void); bool get_send_buffs(vrt_packet_handler::managed_send_buffs_t &, double); + bool transmitting_enb; }; /*! @@ -183,6 +184,28 @@ void usrp1_impl::io_init(void){ _tx_otw_type.byteorder = otw_type_t::BO_LITTLE_ENDIAN; _io_impl = UHD_PIMPL_MAKE(io_impl, (_data_transport)); + + _soft_time_ctrl = soft_time_ctrl::make( + boost::bind(&usrp1_impl::rx_stream_on_off, this, _1) + ); + + rx_stream_on_off(false); + tx_stream_on_off(false); +} + +void usrp1_impl::rx_stream_on_off(bool enb){ + return _iface->write_firmware_cmd(VRQ_FPGA_SET_RX_ENABLE, enb, 0, 0, 0); + //drain any junk in the receive transport after stop streaming command + while(not enb and _data_transport->get_recv_buff().get() != NULL){ + /* NOP */ + } +} + +void usrp1_impl::tx_stream_on_off(bool enb){ + if (not enb) _io_impl->flush_send_buff(); + _codec_ctrls[DBOARD_SLOT_A]->enable_tx_digital(enb); + _codec_ctrls[DBOARD_SLOT_B]->enable_tx_digital(enb); + _io_impl->transmitting_enb = enb; } /*********************************************************************** @@ -208,7 +231,9 @@ size_t usrp1_impl::send( const tx_metadata_t &metadata, const io_type_t &io_type, send_mode_t send_mode, double timeout ){ - _soft_time_ctrl->send_pre(metadata, timeout); + if (_soft_time_ctrl->send_pre(metadata, timeout)) return num_samps; + if (not _io_impl->transmitting_enb) tx_stream_on_off(true); + size_t num_samps_sent = vrt_packet_handler::send( _io_impl->packet_handler_send_state, //last state of the send handler buffs, num_samps, //buffer to fill @@ -222,9 +247,11 @@ size_t usrp1_impl::send( _tx_subdev_spec.size() //num channels ); - //Don't honor sob because it is normal to be always bursting... - //handle eob flag (commit the buffer) - if (metadata.end_of_burst) _io_impl->flush_send_buff(); + //handle eob flag (commit the buffer, disable the DACs) + //check num samps sent to avoid flush on incomplete/timeout + if (metadata.end_of_burst and num_samps_sent == num_samps){ + this->tx_stream_on_off(false); + } //handle the polling for underflow conditions _io_impl->underflow_poll_samp_count += num_samps_sent; @@ -295,6 +322,7 @@ size_t usrp1_impl::recv( 0, //vrt header offset _rx_subdev_spec.size() //num channels ); + _soft_time_ctrl->recv_post(metadata, num_samps_recvd); //handle the polling for overflow conditions diff --git a/host/lib/usrp/usrp1/mboard_impl.cpp b/host/lib/usrp/usrp1/mboard_impl.cpp index 2804671b7..23c8f03c4 100644 --- a/host/lib/usrp/usrp1/mboard_impl.cpp +++ b/host/lib/usrp/usrp1/mboard_impl.cpp @@ -240,14 +240,6 @@ void usrp1_impl::mboard_init(void) } } -void usrp1_impl::stream_on_off(bool stream){ - return _iface->write_firmware_cmd(VRQ_FPGA_SET_RX_ENABLE, stream, 0, 0, 0); - //drain any junk in the receive transport after stop streaming command - while(not stream and _data_transport->get_recv_buff(0.0).get() != NULL){ - /* NOP */ - } -} - /*********************************************************************** * Mboard Get **********************************************************************/ diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.cpp b/host/lib/usrp/usrp1/soft_time_ctrl.cpp index 8a6294690..512327150 100644 --- a/host/lib/usrp/usrp1/soft_time_ctrl.cpp +++ b/host/lib/usrp/usrp1/soft_time_ctrl.cpp @@ -29,24 +29,28 @@ using namespace uhd::transport; namespace pt = boost::posix_time; namespace lt = boost::local_time; +static const time_spec_t TWIDDLE(0.0015); + /*********************************************************************** * Utility helper functions **********************************************************************/ //TODO put these in time_spec_t (maybe useful) +static const double time_dur_tps = double(pt::time_duration::ticks_per_second()); + time_spec_t time_dur_to_time_spec(const pt::time_duration &time_dur){ return time_spec_t( time_dur.total_seconds(), - time_dur.fractional_seconds(), - pt::time_duration::ticks_per_second() + long(time_dur.fractional_seconds()), + time_dur_tps ); } pt::time_duration time_spec_to_time_dur(const time_spec_t &time_spec){ return pt::time_duration( - 0, 0, time_spec.get_full_secs(), - time_spec.get_tick_count(pt::time_duration::ticks_per_second()) + 0, 0, long(time_spec.get_full_secs()), + time_spec.get_tick_count(time_dur_tps) ); } @@ -55,6 +59,7 @@ pt::time_duration time_spec_to_time_dur(const time_spec_t &time_spec){ **********************************************************************/ class soft_time_ctrl_impl : public soft_time_ctrl{ public: + soft_time_ctrl_impl(const cb_fcn_type &stream_on_off): _nsamps_remaining(0), _stream_mode(stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS), @@ -69,32 +74,53 @@ public: } ~soft_time_ctrl_impl(void){ - _thread_running = false; + _thread_group.interrupt_all(); _thread_group.join_all(); } + /******************************************************************* + * Time control + ******************************************************************/ void set_time(const time_spec_t &time){ - _time_offset = pt::microsec_clock::universal_time() - time_spec_to_time_dur(time); + boost::mutex::scoped_lock lock(_update_mutex); + _time_offset = boost::get_system_time() - time_spec_to_time_dur(time); } time_spec_t get_time(void){ - return time_dur_to_time_spec(pt::microsec_clock::universal_time() - _time_offset); + boost::mutex::scoped_lock lock(_update_mutex); + return time_now(); } + UHD_INLINE time_spec_t time_now(void){ + //internal get time without scoped lock + return time_dur_to_time_spec(boost::get_system_time() - _time_offset); + } + + UHD_INLINE void sleep_until_time( + boost::mutex::scoped_lock &lock, const time_spec_t &time + ){ + boost::condition_variable cond; + //use a condition variable to unlock, sleep, lock + cond.timed_wait(lock, _time_offset + time_spec_to_time_dur(time)); + } + + /******************************************************************* + * Receive control + ******************************************************************/ void recv_post(rx_metadata_t &md, size_t &nsamps){ - //load the metadata with the current time + boost::mutex::scoped_lock lock(_update_mutex); + + //load the metadata with the expected time md.has_time_spec = true; - md.time_spec = get_time(); + md.time_spec = time_now(); - //lock the mutex here before changing state - boost::mutex::scoped_lock lock(_update_mutex); + //none of the stuff below matters in continuous streaming mode + if (_stream_mode == stream_cmd_t::STREAM_MODE_START_CONTINUOUS) return; //When to stop streaming: //The samples have been received and the stream mode is non-continuous. //Rewrite the sample count to clip to the requested number of samples. - if (_nsamps_remaining <= nsamps and - _stream_mode != stream_cmd_t::STREAM_MODE_START_CONTINUOUS - ){ + if (_nsamps_remaining <= nsamps){ nsamps = _nsamps_remaining; //set nsamps, then stop stream_on_off(false); return; @@ -104,28 +130,53 @@ public: _nsamps_remaining -= nsamps; } - void send_pre(const tx_metadata_t &md, double /*TODO timeout*/){ - if (not md.has_time_spec) return; - sleep_until_time(md.time_spec); //TODO late? - } - void issue_stream_cmd(const stream_cmd_t &cmd){ _cmd_queue->push_with_wait(cmd); } -private: + void stream_on_off(bool enb){ + _stream_on_off(enb); + _nsamps_remaining = 0; + } - void sleep_until_time(const time_spec_t &time){ - boost::this_thread::sleep(_time_offset + time_spec_to_time_dur(time)); + /******************************************************************* + * Transmit control + ******************************************************************/ + bool send_pre(const tx_metadata_t &md, double &timeout){ + if (not md.has_time_spec) return false; + + boost::mutex::scoped_lock lock(_update_mutex); + + time_spec_t time_at(md.time_spec - TWIDDLE); + + //handle late packets + if (time_at < time_now()){ + //TODO post async message + return true; + } + + timeout -= (time_at - time_now()).get_real_secs(); + sleep_until_time(lock, time_at); + return false; } + /******************************************************************* + * Thread control + ******************************************************************/ void recv_cmd_handle_cmd(const stream_cmd_t &cmd){ - //handle the stream at time by sleeping - if (not cmd.stream_now) sleep_until_time(cmd.time_spec); //TODO late? - - //lock the mutex here before changing state boost::mutex::scoped_lock lock(_update_mutex); + //handle the stream at time by sleeping + if (not cmd.stream_now){ + time_spec_t time_at(cmd.time_spec - TWIDDLE); + if (time_at < time_now()){ + //TODO inject late cmd inline error + } + else{ + sleep_until_time(lock, time_at); + } + } + //When to stop streaming: //Stop streaming when the command is a stop and streaming. if (cmd.stream_mode == stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS @@ -144,31 +195,24 @@ private: } void recv_cmd_dispatcher(void){ - _thread_running = true; _update_mutex.unlock(); - - boost::any cmd; - while (_thread_running){ - if (_cmd_queue->pop_with_timed_wait(cmd, 1.0)){ + try{ + boost::any cmd; + while (true){ + _cmd_queue->pop_with_wait(cmd); recv_cmd_handle_cmd(boost::any_cast(cmd)); } - } - } - - void stream_on_off(bool stream){ - _stream_on_off(stream); - _nsamps_remaining = 0; + } catch(const boost::thread_interrupted &){} } +private: boost::mutex _update_mutex; size_t _nsamps_remaining; stream_cmd_t::stream_mode_t _stream_mode; - pt::ptime _time_offset; bounded_buffer::sptr _cmd_queue; const cb_fcn_type _stream_on_off; boost::thread_group _thread_group; - bool _thread_running; }; /*********************************************************************** diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.hpp b/host/lib/usrp/usrp1/soft_time_ctrl.hpp index 42056c285..7fdac7fc8 100644 --- a/host/lib/usrp/usrp1/soft_time_ctrl.hpp +++ b/host/lib/usrp/usrp1/soft_time_ctrl.hpp @@ -41,8 +41,7 @@ public: /*! * Make a new soft time control. - * \param start_streaming a function callback to start streaming - * \param stop_streaming a function callback to stop streaming + * \param stream_on_off a function to enable/disable rx * \return a new soft time control object */ static sptr make(const cb_fcn_type &stream_on_off); @@ -59,7 +58,7 @@ public: virtual void recv_post(rx_metadata_t &md, size_t &nsamps) = 0; //! Call before the internal send function - virtual void send_pre(const tx_metadata_t &md, double timeout) = 0; + virtual bool send_pre(const tx_metadata_t &md, double &timeout) = 0; //! Issue a stream command to receive virtual void issue_stream_cmd(const stream_cmd_t &cmd) = 0; diff --git a/host/lib/usrp/usrp1/usrp1_ctrl.cpp b/host/lib/usrp/usrp1/usrp1_ctrl.cpp index 5043aed7d..09f854813 100644 --- a/host/lib/usrp/usrp1/usrp1_ctrl.cpp +++ b/host/lib/usrp/usrp1/usrp1_ctrl.cpp @@ -139,13 +139,6 @@ public: _ctrl_transport = ctrl_transport; } - - ~usrp_ctrl_impl(void) - { - /* NOP */ - } - - int usrp_load_firmware(std::string filestring, bool force) { const char *filename = filestring.c_str(); @@ -233,6 +226,20 @@ public: return -1; } + void usrp_init(void){ + /* not calling because this causes junk to come at init + * and it does not seem to be necessary to call anyway + usrp_rx_enable(false); + usrp_rx_reset(true); + usrp_rx_reset(false); + usrp_rx_enable(true); + */ + + usrp_tx_enable(false); + usrp_tx_reset(true); + usrp_tx_reset(false); + usrp_tx_enable(true); + } int usrp_load_fpga(std::string filestring) { @@ -288,7 +295,7 @@ public: usrp_set_fpga_hash(hash); file.close(); if (load_img_msg) std::cout << " done" << std::endl; - return 0; + return 0; } int usrp_load_eeprom(std::string filestring) @@ -393,6 +400,12 @@ public: } + int usrp_rx_reset(bool on) + { + return usrp_control_write_cmd(VRQ_FPGA_SET_RX_RESET, on, 0); + } + + int usrp_control_write(boost::uint8_t request, boost::uint16_t value, boost::uint16_t index, diff --git a/host/lib/usrp/usrp1/usrp1_ctrl.hpp b/host/lib/usrp/usrp1/usrp1_ctrl.hpp index a02d9f96c..8ccfacab7 100644 --- a/host/lib/usrp/usrp1/usrp1_ctrl.hpp +++ b/host/lib/usrp/usrp1/usrp1_ctrl.hpp @@ -33,6 +33,9 @@ public: */ static sptr make(uhd::transport::usb_control::sptr ctrl_transport); + //! Call init after the fpga is loaded + virtual void usrp_init(void) = 0; + /*! * Load firmware in Intel HEX Format onto device * \param filename name of firmware file @@ -92,20 +95,6 @@ public: */ virtual int usrp_set_fpga_hash(size_t hash) = 0; - /*! - * Set rx enable or disable - * \param on enable or disable value - * \return 0 on success, error code otherwise - */ - virtual int usrp_rx_enable(bool on) = 0; - - /*! - * Set rx enable or disable - * \param on enable or disable value - * \return 0 on success, error code otherwise - */ - virtual int usrp_tx_enable(bool on) = 0; - /*! * Submit an IN transfer * \param request device specific request diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 04a199928..c395db0b9 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -139,6 +139,7 @@ static device::sptr usrp1_make(const device_addr_t &device_addr){ usb_control::sptr ctrl_transport = usb_control::make(handle); usrp_ctrl::sptr usrp_ctrl = usrp_ctrl::make(ctrl_transport); usrp_ctrl->usrp_load_fpga(usrp1_fpga_image); + usrp_ctrl->usrp_init(); usb_zero_copy::sptr data_transport = usb_zero_copy::make( handle, // identifier 6, // IN endpoint @@ -161,10 +162,6 @@ usrp1_impl::usrp1_impl(uhd::transport::usb_zero_copy::sptr data_transport, usrp_ctrl::sptr ctrl_transport) : _data_transport(data_transport), _ctrl_transport(ctrl_transport) { - _soft_time_ctrl = soft_time_ctrl::make( - boost::bind(&usrp1_impl::stream_on_off, this, _1) - ); - _iface = usrp1_iface::make(ctrl_transport); //create clock interface @@ -196,9 +193,6 @@ usrp1_impl::usrp1_impl(uhd::transport::usb_zero_copy::sptr data_transport, //initialize the send/recv io_init(); - //turn on the transmitter - _ctrl_transport->usrp_tx_enable(true); - //init the subdev specs this->mboard_set(MBOARD_PROP_RX_SUBDEV_SPEC, subdev_spec_t()); this->mboard_set(MBOARD_PROP_TX_SUBDEV_SPEC, subdev_spec_t()); diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index 18a8683a7..057725394 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -124,7 +124,8 @@ private: //handle io stuff UHD_PIMPL_DECL(io_impl) _io_impl; void io_init(void); - void stream_on_off(bool); + void rx_stream_on_off(bool); + void tx_stream_on_off(bool); void handle_overrun(size_t); //underrun and overrun poll intervals -- cgit v1.2.3 From 8e0fbbe47b3c0b2805d2a638da7f363bee2240fd Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 18 Jan 2011 14:59:36 -0800 Subject: usrp1: set eob on md when shutting off receiver, because we can --- host/docs/usrp1.rst | 4 ++-- host/lib/usrp/usrp1/soft_time_ctrl.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp/usrp1') diff --git a/host/docs/usrp1.rst b/host/docs/usrp1.rst index a8d3193fd..0a8224850 100644 --- a/host/docs/usrp1.rst +++ b/host/docs/usrp1.rst @@ -80,7 +80,7 @@ List of emulated features * Transmitting at a specific time * Receiving at a specific time * Receiving a specific number of samples -* Start and end burst flags on transmit +* End of burst flags for transmit/receive **Note:** These emulated features rely on the host system's clock for timed operations, @@ -93,7 +93,7 @@ List of missing features * Notification on late transmit packet * Notification on broken chain error * Notification on underflow or overflow -* Start and end burst flags for receive +* Start of burst flags for transmit/receive ------------------------------------------------------------------------ OS specific notes diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.cpp b/host/lib/usrp/usrp1/soft_time_ctrl.cpp index 512327150..4d6abe218 100644 --- a/host/lib/usrp/usrp1/soft_time_ctrl.cpp +++ b/host/lib/usrp/usrp1/soft_time_ctrl.cpp @@ -122,6 +122,7 @@ public: //Rewrite the sample count to clip to the requested number of samples. if (_nsamps_remaining <= nsamps){ nsamps = _nsamps_remaining; //set nsamps, then stop + md.end_of_burst = true; stream_on_off(false); return; } -- cgit v1.2.3