From 5b0ae93c8f319bbc367254172719d40f11a0f55b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 6 Oct 2011 09:26:40 -0700 Subject: uhd: backwards compat work which support streamer API --- gr-uhd/include/gr_uhd_usrp_source.h | 43 ++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'gr-uhd/include/gr_uhd_usrp_source.h') diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index fecc6e94d..b194ba4a3 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -26,6 +26,20 @@ #include #include +#ifndef INCLUDED_UHD_STREAM_HPP +namespace uhd{ + struct GR_UHD_API stream_args_t{ + std::string cpu_format; + std::string otw_format; + std::string args; + std::vector channels; + }; +} +# define INCLUDED_UHD_STREAM_HPP +#else +# define GR_UHD_USE_STREAM_API +#endif + class uhd_usrp_source; /*! @@ -55,7 +69,34 @@ class uhd_usrp_source; GR_UHD_API boost::shared_ptr uhd_make_usrp_source( const uhd::device_addr_t &device_addr, const uhd::io_type_t &io_type, - size_t num_channels + size_t num_channels = 1 +); + +/*! + * \brief Make a new USRP source block. + * + * The USRP source block receives samples and writes to a stream. + * The source block also provides API calls for receiver settings. + * + * RX Stream tagging: + * + * The following tag keys will be produced by the work function: + * - pmt::pmt_string_to_symbol("rx_time") + * + * The timstamp tag value is a pmt tuple of the following: + * (uint64 seconds, and double fractional seconds). + * A timestamp tag is produced at start() and after overflows. + * + * See the UHD manual for more detailed documentation: + * http://code.ettus.com/redmine/ettus/projects/uhd/wiki + * + * \param device_addr the address to identify the hardware + * \param stream_args the IO format and channel specification + * \return a new USRP source block object + */ +GR_UHD_API boost::shared_ptr uhd_make_usrp_source( + const uhd::device_addr_t &device_addr, + const uhd::stream_args_t &stream_args ); class GR_UHD_API uhd_usrp_source : virtual public gr_sync_block{ -- cgit From 84c3e0e0fb2df99213ed238ac4f032411d003b30 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 6 Oct 2011 13:39:21 -0700 Subject: uhd: python/swig/grc tweaks until it works --- gr-uhd/include/gr_uhd_usrp_source.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-uhd/include/gr_uhd_usrp_source.h') diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index b194ba4a3..c2b310e44 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -69,7 +69,7 @@ class uhd_usrp_source; GR_UHD_API boost::shared_ptr uhd_make_usrp_source( const uhd::device_addr_t &device_addr, const uhd::io_type_t &io_type, - size_t num_channels = 1 + size_t num_channels ); /*! -- cgit From 011e784e1e51ae8a99ade2c95a43a463ab6902a9 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 8 Oct 2011 11:27:31 -0700 Subject: uhd: added convenience constructor to stream_args_t --- gr-uhd/include/gr_uhd_usrp_source.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gr-uhd/include/gr_uhd_usrp_source.h') diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index c2b310e44..2433d422d 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -29,6 +29,11 @@ #ifndef INCLUDED_UHD_STREAM_HPP namespace uhd{ struct GR_UHD_API stream_args_t{ + stream_args_t(void){} + stream_args_t(const std::string &cpu, const std::string &otw="sc16"){ + cpu_format = cpu; + otw_format = otw; + } std::string cpu_format; std::string otw_format; std::string args; -- cgit From 861a185c6f964d1c0057b341db332bf9b6387ffb Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 10 Oct 2011 20:49:01 -0700 Subject: uhd: preferable defaults for stream args --- gr-uhd/include/gr_uhd_usrp_source.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gr-uhd/include/gr_uhd_usrp_source.h') diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index 2433d422d..00747f161 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -29,8 +29,10 @@ #ifndef INCLUDED_UHD_STREAM_HPP namespace uhd{ struct GR_UHD_API stream_args_t{ - stream_args_t(void){} - stream_args_t(const std::string &cpu, const std::string &otw="sc16"){ + stream_args_t( + const std::string &cpu = "", + const std::string &otw = "" + ){ cpu_format = cpu; otw_format = otw; } -- cgit From d470318227a3275fe6cdc7ad6fd293c06da2a963 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 13 Oct 2011 15:29:56 -0700 Subject: uhd: grc xml tweaks + streamer args --- gr-uhd/include/gr_uhd_usrp_source.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-uhd/include/gr_uhd_usrp_source.h') diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index 00747f161..d22d67241 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -38,7 +38,7 @@ namespace uhd{ } std::string cpu_format; std::string otw_format; - std::string args; + device_addr_t args; std::vector channels; }; } -- cgit From f3d2a28dc8d1abfe42435a4b5040eb20dd295479 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 16 Oct 2011 11:49:11 -0700 Subject: uhd: added get_samp_rates calls --- gr-uhd/include/gr_uhd_usrp_source.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gr-uhd/include/gr_uhd_usrp_source.h') diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index d22d67241..e0c2cfe50 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -129,6 +129,12 @@ public: */ virtual double get_samp_rate(void) = 0; + /*! + * Get the possible sample rates for the usrp device. + * \return a range of rates in Sps + */ + virtual uhd::meta_range_t get_samp_rates(void) = 0; + /*! * Tune the usrp device to the desired center frequency. * \param tune_request the tune request instructions -- cgit From 8e60469acd6be356c64bfb27f58b393f3dd361cf Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 16 Oct 2011 12:11:40 -0700 Subject: uhd: added set/get time/clock source calls --- gr-uhd/include/gr_uhd_usrp_source.h | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'gr-uhd/include/gr_uhd_usrp_source.h') diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index e0c2cfe50..7a861e315 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -283,11 +283,59 @@ public: /*! * Set the clock configuration. + * DEPRECATED for set_time/clock_source. * \param clock_config the new configuration * \param mboard the motherboard index 0 to M-1 */ virtual void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard = 0) = 0; + /*! + * Set the time source for the usrp device. + * This sets the method of time synchronization, + * typically a pulse per second or an encoded time. + * Typical options for source: external, MIMO. + * \param source a string representing the time source + * \param mboard which motherboard to set the config + */ + virtual void set_time_source(const std::string &source, const size_t mboard = 0) = 0; + + /*! + * Get the currently set time source. + * \param mboard which motherboard to get the config + * \return the string representing the time source + */ + virtual std::string get_time_source(const size_t mboard) = 0; + + /*! + * Get a list of possible time sources. + * \param mboard which motherboard to get the list + * \return a vector of strings for possible settings + */ + virtual std::vector get_time_sources(const size_t mboard) = 0; + + /*! + * Set the clock source for the usrp device. + * This sets the source for a 10 Mhz reference clock. + * Typical options for source: internal, external, MIMO. + * \param source a string representing the clock source + * \param mboard which motherboard to set the config + */ + virtual void set_clock_source(const std::string &source, const size_t mboard = 0) = 0; + + /*! + * Get the currently set clock source. + * \param mboard which motherboard to get the config + * \return the string representing the clock source + */ + virtual std::string get_clock_source(const size_t mboard) = 0; + + /*! + * Get a list of possible clock sources. + * \param mboard which motherboard to get the list + * \return a vector of strings for possible settings + */ + virtual std::vector get_clock_sources(const size_t mboard) = 0; + /*! * Get the master clock rate. * \param mboard the motherboard index 0 to M-1 -- cgit From 9058109de812a5a8c45a180131531b5ad10a9d7a Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 24 Oct 2011 11:31:59 -0700 Subject: uhd: added set for RX/TX iq balance and dc offset --- gr-uhd/include/gr_uhd_usrp_source.h | 54 ++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) (limited to 'gr-uhd/include/gr_uhd_usrp_source.h') diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index 7a861e315..5830487bc 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -110,7 +110,7 @@ class GR_UHD_API uhd_usrp_source : virtual public gr_sync_block{ public: /*! - * Set the subdevice specification. + * Set the frontend specification. * \param spec the subdev spec markup string * \param mboard the motherboard index 0 to M-1 */ @@ -245,26 +245,68 @@ public: virtual std::vector get_antennas(size_t chan = 0) = 0; /*! - * Set the subdevice bandpass filter. + * Set the bandpass filter on the RF frontend. * \param bandwidth the filter bandwidth in Hz * \param chan the channel index 0 to N-1 */ virtual void set_bandwidth(double bandwidth, size_t chan = 0) = 0; /*! - * Get a daughterboard sensor value. + * Enable/disable the automatic DC offset correction. + * The automatic correction subtracts out the long-run average. + * + * When disabled, the averaging option operation is halted. + * Once halted, the average value will be held constant + * until the user re-enables the automatic correction + * or overrides the value by manually setting the offset. + * + * \param enb true to enable automatic DC offset correction + * \param chan the channel index 0 to N-1 + */ + virtual void set_dc_offset(const bool enb, size_t chan = 0) = 0; + + /*! + * Set a constant DC offset value. + * The value is complex to control both I and Q. + * Only set this when automatic correction is disabled. + * \param offset the dc offset (1.0 is full-scale) + * \param chan the channel index 0 to N-1 + */ + virtual void set_dc_offset(const std::complex &offset, size_t chan = 0) = 0; + + /*! + * Set the RX frontend IQ imbalance correction. + * Use this to adjust the magnitude and phase of I and Q. + * + * \param correction the complex correction value + * \param chan the channel index 0 to N-1 + */ + virtual void set_iq_balance(const std::complex &correction, size_t chan = 0) = 0; + + /*! + * Get a RF frontend sensor value. * \param name the name of the sensor * \param chan the channel index 0 to N-1 * \return a sensor value object */ - virtual uhd::sensor_value_t get_dboard_sensor(const std::string &name, size_t chan = 0) = 0; + virtual uhd::sensor_value_t get_sensor(const std::string &name, size_t chan = 0) = 0; /*! - * Get a list of possible daughterboard sensor names. + * Get a list of possible RF frontend sensor names. * \param chan the channel index 0 to N-1 * \return a vector of sensor names */ - virtual std::vector get_dboard_sensor_names(size_t chan = 0) = 0; + virtual std::vector get_sensor_names(size_t chan = 0) = 0; + + //! DEPRECATED use get_sensor + uhd::sensor_value_t get_dboard_sensor(const std::string &name, size_t chan = 0){ + return this->get_sensor(name, chan); + } + + //! DEPRECATED use get_sensor_names + std::vector get_dboard_sensor_names(size_t chan = 0){ + return this->get_sensor_names(chan); + } /*! * Get a motherboard sensor value. -- cgit From bf8984bac6551dc2a98d615431fb6c9b4bfb9f4e Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 3 Nov 2011 20:03:44 -0700 Subject: uhd: rebase tweaks + update on command feature --- gr-uhd/include/gr_uhd_usrp_source.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'gr-uhd/include/gr_uhd_usrp_source.h') diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index 5830487bc..e9fc41b93 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -425,6 +425,25 @@ public: */ virtual void set_time_unknown_pps(const uhd::time_spec_t &time_spec) = 0; + /*! + * Set the time at which the control commands will take effect. + * + * A timed command will back-pressure all subsequent timed commands, + * assuming that the subsequent commands occur within the time-window. + * If the time spec is late, the command will be activated upon arrival. + * + * \param time_spec the time at which the next command will activate + * \param mboard which motherboard to set the config + */ + virtual void set_command_time(const uhd::time_spec_t &time_spec, size_t mboard = 0) = 0; + + /*! + * Clear the command time so future commands are sent ASAP. + * + * \param mboard which motherboard to set the config + */ + virtual void clear_command_time(size_t mboard = 0) = 0; + /*! * Get access to the underlying uhd dboard iface object. * \return the dboard_iface object -- cgit