diff options
Diffstat (limited to 'host/include')
38 files changed, 196 insertions, 137 deletions
diff --git a/host/include/uhd/convert.hpp b/host/include/uhd/convert.hpp index b94c46851..785e1a696 100644 --- a/host/include/uhd/convert.hpp +++ b/host/include/uhd/convert.hpp @@ -10,8 +10,8 @@ #include <uhd/config.hpp> #include <uhd/types/ref_vector.hpp> -#include <functional> #include <boost/operators.hpp> +#include <functional> #include <memory> #include <string> diff --git a/host/include/uhd/property_tree.hpp b/host/include/uhd/property_tree.hpp index 9e4bcd57a..e59d1a126 100644 --- a/host/include/uhd/property_tree.hpp +++ b/host/include/uhd/property_tree.hpp @@ -13,9 +13,9 @@ #include <uhd/utils/noncopyable.hpp> #include <functional> #include <memory> +#include <string> #include <typeindex> #include <vector> -#include <string> namespace uhd { @@ -246,14 +246,15 @@ public: //! Pop a property off the tree, and returns the property template <typename T> - std::shared_ptr<property<T> > pop(const fs_path& path); + std::shared_ptr<property<T>> pop(const fs_path& path); private: //! Internal pop function virtual std::shared_ptr<void> _pop(const fs_path& path) = 0; //! Internal create property with wild-card type - virtual void _create(const fs_path& path, const std::shared_ptr<void>& prop, + virtual void _create(const fs_path& path, + const std::shared_ptr<void>& prop, std::type_index prop_type) = 0; //! Internal access property with wild-card type diff --git a/host/include/uhd/rfnoc/block_id.hpp b/host/include/uhd/rfnoc/block_id.hpp index 7e6310820..2af1e8948 100644 --- a/host/include/uhd/rfnoc/block_id.hpp +++ b/host/include/uhd/rfnoc/block_id.hpp @@ -10,8 +10,8 @@ #include <uhd/config.hpp> #include <stdint.h> -#include <memory> #include <iostream> +#include <memory> #include <string> namespace uhd { diff --git a/host/include/uhd/rfnoc/blockdef.hpp b/host/include/uhd/rfnoc/blockdef.hpp index d6bcec414..7a15dcfa4 100644 --- a/host/include/uhd/rfnoc/blockdef.hpp +++ b/host/include/uhd/rfnoc/blockdef.hpp @@ -11,9 +11,9 @@ #include <uhd/config.hpp> #include <uhd/types/device_addr.hpp> #include <stdint.h> +#include <memory> #include <set> #include <vector> -#include <memory> namespace uhd { namespace rfnoc { diff --git a/host/include/uhd/rfnoc/constants.hpp b/host/include/uhd/rfnoc/constants.hpp index 6aeef1522..923091739 100644 --- a/host/include/uhd/rfnoc/constants.hpp +++ b/host/include/uhd/rfnoc/constants.hpp @@ -8,16 +8,16 @@ #ifndef INCLUDED_LIBUHD_RFNOC_CONSTANTS_HPP #define INCLUDED_LIBUHD_RFNOC_CONSTANTS_HPP -#include <uhd/types/dict.hpp> #include <uhd/rfnoc/defaults.hpp> +#include <uhd/types/dict.hpp> #include <stdint.h> #include <boost/assign/list_of.hpp> #include <string> namespace uhd { namespace rfnoc { -static const size_t NOC_SHELL_COMPAT_MAJOR = 5; -static const size_t NOC_SHELL_COMPAT_MINOR = 1; +static const size_t NOC_SHELL_COMPAT_MAJOR = 5; +static const size_t NOC_SHELL_COMPAT_MINOR = 1; static const size_t MAX_PACKET_SIZE = 8000; // bytes static const size_t DEFAULT_PACKET_SIZE = 1456; // bytes @@ -74,7 +74,7 @@ static const uint32_t AXIS_CONFIG_BUS = static const uint32_t AXIS_CONFIG_BUS_TLAST = AXI_WRAPPER_BASE + 2; // tdata with tvalid & tlast asserted -static const size_t CMD_FIFO_SIZE = 256; // Lines == multiples of 8 bytes +static const size_t CMD_FIFO_SIZE = 256; // Lines == multiples of 8 bytes static const size_t MAX_CMD_PKT_SIZE = 3; // Lines == multiples of 8 bytes // Named settings registers diff --git a/host/include/uhd/rfnoc/ddc_block_control.hpp b/host/include/uhd/rfnoc/ddc_block_control.hpp index 8cf90ed28..be0acc32c 100644 --- a/host/include/uhd/rfnoc/ddc_block_control.hpp +++ b/host/include/uhd/rfnoc/ddc_block_control.hpp @@ -8,8 +8,8 @@ #define INCLUDED_LIBUHD_DDC_BLOCK_CONTROL_HPP #include <uhd/config.hpp> -#include <uhd/types/ranges.hpp> #include <uhd/rfnoc/noc_block_base.hpp> +#include <uhd/types/ranges.hpp> #include <boost/optional.hpp> namespace uhd { namespace rfnoc { @@ -130,6 +130,6 @@ public: const uhd::stream_cmd_t& stream_cmd, const size_t port) = 0; }; -}} /* uhd::rfnoc */ +}} // namespace uhd::rfnoc #endif /* INCLUDED_LIBUHD_DDC_BLOCK_CONTROL_HPP */ diff --git a/host/include/uhd/rfnoc/fft_block_control.hpp b/host/include/uhd/rfnoc/fft_block_control.hpp index c865dce78..e3e8c6b85 100644 --- a/host/include/uhd/rfnoc/fft_block_control.hpp +++ b/host/include/uhd/rfnoc/fft_block_control.hpp @@ -44,7 +44,6 @@ public: static const uint32_t SR_FFT_DIRECTION; static const uint32_t SR_FFT_SCALING; static const uint32_t SR_FFT_SHIFT_CONFIG; - }; }} // namespace uhd::rfnoc diff --git a/host/include/uhd/rfnoc/mb_controller.hpp b/host/include/uhd/rfnoc/mb_controller.hpp index e6276d39c..cf214c285 100644 --- a/host/include/uhd/rfnoc/mb_controller.hpp +++ b/host/include/uhd/rfnoc/mb_controller.hpp @@ -40,7 +40,7 @@ public: class UHD_API timekeeper { public: - using sptr = std::shared_ptr<timekeeper>; + using sptr = std::shared_ptr<timekeeper>; using write_period_fn_t = std::function<void(uint64_t)>; timekeeper(); @@ -83,7 +83,7 @@ public: /*! Set the time "now" from a time spec */ - void set_time_now(const uhd::time_spec_t &time); + void set_time_now(const uhd::time_spec_t& time); /*! Set the ticks "now" */ @@ -91,7 +91,7 @@ public: /*! Set the time at next PPS from a time spec */ - void set_time_next_pps(const uhd::time_spec_t &time); + void set_time_next_pps(const uhd::time_spec_t& time); /*! Set the ticks at next PPS */ @@ -99,7 +99,10 @@ public: /*! Return the current tick rate */ - double get_tick_rate() { return _tick_rate; } + double get_tick_rate() + { + return _tick_rate; + } protected: /*! Set the tick rate @@ -399,4 +402,3 @@ private: }} // namespace uhd::rfnoc #endif /* INCLUDED_LIBUHD_MB_CONTROLLER_HPP */ - diff --git a/host/include/uhd/rfnoc/mock_block.hpp b/host/include/uhd/rfnoc/mock_block.hpp index 18c614d07..ab7a79f42 100644 --- a/host/include/uhd/rfnoc/mock_block.hpp +++ b/host/include/uhd/rfnoc/mock_block.hpp @@ -162,7 +162,7 @@ struct UHD_API mock_block_container //! Use this to retrieve a reference to the block controller. Make sure that // the register space is appropiately primed before doing so. - template<typename block_type = noc_block_base> + template <typename block_type = noc_block_base> std::shared_ptr<block_type> get_block() { return std::dynamic_pointer_cast<block_type>(factory(std::move(make_args))); @@ -175,7 +175,6 @@ struct UHD_API mock_block_container // but std::functions need to be CopyConstructible, and this struct doesn't, // so it needs to live out here in the open. noc_block_base::make_args_ptr make_args; - }; /*! Factory function for mock block controllers @@ -185,7 +184,7 @@ UHD_API mock_block_container get_mock_block(const noc_id_t noc_id, const size_t num_outputs = 1, const uhd::device_addr_t& args = uhd::device_addr_t(), const size_t mtu = 8000, - const device_type_t device_id = ANY_DEVICE); + const device_type_t device_id = ANY_DEVICE); }}; // namespace uhd::rfnoc diff --git a/host/include/uhd/rfnoc/noc_block_base.hpp b/host/include/uhd/rfnoc/noc_block_base.hpp index 4a8d2965f..19d4e63a3 100644 --- a/host/include/uhd/rfnoc/noc_block_base.hpp +++ b/host/include/uhd/rfnoc/noc_block_base.hpp @@ -19,8 +19,8 @@ #define RFNOC_BLOCK_CONSTRUCTOR(CLASS_NAME) \ CLASS_NAME##_impl(make_args_ptr make_args) : CLASS_NAME(std::move(make_args)) -#define RFNOC_DECLARE_BLOCK(CLASS_NAME) \ - using sptr = std::shared_ptr<CLASS_NAME>;\ +#define RFNOC_DECLARE_BLOCK(CLASS_NAME) \ + using sptr = std::shared_ptr<CLASS_NAME>; \ CLASS_NAME(make_args_ptr make_args) : noc_block_base(std::move(make_args)) {} namespace uhd { namespace rfnoc { @@ -59,7 +59,10 @@ public: * node_t API calls *************************************************************************/ //! Unique ID for an RFNoC block is its block ID - std::string get_unique_id() const { return get_block_id().to_string(); } + std::string get_unique_id() const + { + return get_block_id().to_string(); + } //! Number of input ports. Note: This gets passed into this block from the // information stored in the global register space. @@ -67,7 +70,10 @@ public: // Note: This may be overridden by the block (e.g., the X300 radio may not // have all ports available if no TwinRX board is plugged in), but the // subclassed version may never report more ports than this. - size_t get_num_input_ports() const { return _num_input_ports; } + size_t get_num_input_ports() const + { + return _num_input_ports; + } //! Number of output ports. Note: This gets passed outto this block from the // information stored in the global register space. @@ -75,7 +81,10 @@ public: // Note: This may be overridden by the block (e.g., the X300 radio may not // have all ports available if no TwinRX board is plugged in), but the // subclassed version may never report more ports than this. - size_t get_num_output_ports() const { return _num_output_ports; } + size_t get_num_output_ports() const + { + return _num_output_ports; + } /************************************************************************** * RFNoC-block specific API calls @@ -84,13 +93,19 @@ public: * * \return noc_id The 32-bit NoC ID of this block */ - noc_id_t get_noc_id() const { return _noc_id; } + noc_id_t get_noc_id() const + { + return _noc_id; + } /*! Returns the unique block ID for this block. * * \return block_id The block ID of this block (e.g. "0/FFT#1") */ - const block_id_t& get_block_id() const { return _block_id; } + const block_id_t& get_block_id() const + { + return _block_id; + } /*! Returns the tick rate of the current time base * @@ -114,13 +129,22 @@ public: /*! Return the arguments that were passed into this block from the framework */ - uhd::device_addr_t get_block_args() const { return _block_args; } + uhd::device_addr_t get_block_args() const + { + return _block_args; + } //! Return a reference to this block's subtree - uhd::property_tree::sptr& get_tree() const { return _tree; } + uhd::property_tree::sptr& get_tree() const + { + return _tree; + } //! Return a reference to this block's subtree (non-const version) - uhd::property_tree::sptr& get_tree() { return _tree; } + uhd::property_tree::sptr& get_tree() + { + return _tree; + } protected: noc_block_base(make_args_ptr make_args); @@ -267,7 +291,7 @@ private: //! Container for the 'mtu' property. This will hold one edge property // for all in- and output edges. - std::vector<property_t<size_t> > _mtu_props; + std::vector<property_t<size_t>> _mtu_props; //! The actual MTU value std::unordered_map<res_source_info, size_t> _mtu; diff --git a/host/include/uhd/rfnoc/noc_block_make_args.hpp b/host/include/uhd/rfnoc/noc_block_make_args.hpp index 8878cc1a8..52feb71c0 100644 --- a/host/include/uhd/rfnoc/noc_block_make_args.hpp +++ b/host/include/uhd/rfnoc/noc_block_make_args.hpp @@ -7,9 +7,9 @@ #ifndef INCLUDED_LIBUHD_NOC_BLOCK_MAKE_ARGS_HPP #define INCLUDED_LIBUHD_NOC_BLOCK_MAKE_ARGS_HPP +#include <uhd/property_tree.hpp> #include <uhd/rfnoc/noc_block_base.hpp> #include <uhd/rfnoc/register_iface.hpp> -#include <uhd/property_tree.hpp> namespace uhd { namespace rfnoc { diff --git a/host/include/uhd/rfnoc/node.hpp b/host/include/uhd/rfnoc/node.hpp index 9424a6b58..c680deef8 100644 --- a/host/include/uhd/rfnoc/node.hpp +++ b/host/include/uhd/rfnoc/node.hpp @@ -35,7 +35,7 @@ namespace uhd { namespace rfnoc { class UHD_API node_t { public: - using resolver_fn_t = std::function<void(void)>; + using resolver_fn_t = std::function<void(void)>; using resolve_callback_t = std::function<void(void)>; using action_handler_t = std::function<void(const res_source_info&, action_info::sptr)>; @@ -574,7 +574,7 @@ private: //! Stores a reference to every registered property (Property Registry) std::unordered_map<res_source_info::source_t, std::vector<property_base_t*>, - std::hash<size_t> > + std::hash<size_t>> _props; //! Stores a clean callback for some properties @@ -602,8 +602,8 @@ private: //! Forwarding policy for specific properties // // The entry with the empty-string-key is the default policy. - std::unordered_map<std::string, forwarding_policy_t> _prop_fwd_policies{{ - "", forwarding_policy_t::ONE_TO_ONE}}; + std::unordered_map<std::string, forwarding_policy_t> _prop_fwd_policies{ + {"", forwarding_policy_t::ONE_TO_ONE}}; /************************************************************************** * Action-related attributes @@ -614,8 +614,8 @@ private: std::unordered_map<std::string, action_handler_t> _action_handlers; //! Default action forwarding policies - std::unordered_map<std::string, forwarding_policy_t> _action_fwd_policies{{ - "", forwarding_policy_t::ONE_TO_ONE}}; + std::unordered_map<std::string, forwarding_policy_t> _action_fwd_policies{ + {"", forwarding_policy_t::ONE_TO_ONE}}; //! Callback which allows us to post actions to other nodes in the graph // diff --git a/host/include/uhd/rfnoc/null_block_control.hpp b/host/include/uhd/rfnoc/null_block_control.hpp index 74f6db2a3..4844946d5 100644 --- a/host/include/uhd/rfnoc/null_block_control.hpp +++ b/host/include/uhd/rfnoc/null_block_control.hpp @@ -85,4 +85,3 @@ public: }} // namespace uhd::rfnoc #endif /* INCLUDED_LIBUHD_NULL_BLOCK_CONTROL_HPP */ - diff --git a/host/include/uhd/rfnoc/radio_control.hpp b/host/include/uhd/rfnoc/radio_control.hpp index 01fcb1d48..2ae80ff9b 100644 --- a/host/include/uhd/rfnoc/radio_control.hpp +++ b/host/include/uhd/rfnoc/radio_control.hpp @@ -242,11 +242,13 @@ public: /*! Return a list of TX gain profiles for this radio */ - virtual std::vector<std::string> get_tx_gain_profile_names(const size_t chan) const = 0; + virtual std::vector<std::string> get_tx_gain_profile_names( + const size_t chan) const = 0; /*! Return a list of TX gain profiles for this radio */ - virtual std::vector<std::string> get_rx_gain_profile_names(const size_t chan) const = 0; + virtual std::vector<std::string> get_rx_gain_profile_names( + const size_t chan) const = 0; /*! Set the TX gain profile */ @@ -583,9 +585,8 @@ public: * \param attr the name of a GPIO attribute (e.g., CTRL) * \param value the new value for this GPIO bank */ - virtual void set_gpio_attr(const std::string& bank, - const std::string& attr, - const uint32_t value) = 0; + virtual void set_gpio_attr( + const std::string& bank, const std::string& attr, const uint32_t value) = 0; /*! * Get a GPIO attribute on a particular GPIO bank. diff --git a/host/include/uhd/rfnoc/registry.hpp b/host/include/uhd/rfnoc/registry.hpp index d4256b542..931b4a1dd 100644 --- a/host/include/uhd/rfnoc/registry.hpp +++ b/host/include/uhd/rfnoc/registry.hpp @@ -16,29 +16,33 @@ //! This macro must be placed inside a block implementation file // after the class definition -#define UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT(CLASS_NAME, \ - NOC_ID, DEVICE_ID, BLOCK_NAME, MB_ACCESS, TB_CLOCK, CTRL_CLOCK) \ - uhd::rfnoc::noc_block_base::sptr CLASS_NAME##_make( \ - uhd::rfnoc::noc_block_base::make_args_ptr make_args) \ - { \ - return std::make_shared<CLASS_NAME##_impl>(std::move(make_args)); \ - } \ - UHD_STATIC_BLOCK(register_rfnoc_##CLASS_NAME) \ - { \ - uhd::rfnoc::registry::register_block_direct(NOC_ID, DEVICE_ID, \ - BLOCK_NAME, MB_ACCESS, \ - TB_CLOCK, CTRL_CLOCK, &CLASS_NAME##_make); \ +#define UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT( \ + CLASS_NAME, NOC_ID, DEVICE_ID, BLOCK_NAME, MB_ACCESS, TB_CLOCK, CTRL_CLOCK) \ + uhd::rfnoc::noc_block_base::sptr CLASS_NAME##_make( \ + uhd::rfnoc::noc_block_base::make_args_ptr make_args) \ + { \ + return std::make_shared<CLASS_NAME##_impl>(std::move(make_args)); \ + } \ + UHD_STATIC_BLOCK(register_rfnoc_##CLASS_NAME) \ + { \ + uhd::rfnoc::registry::register_block_direct(NOC_ID, \ + DEVICE_ID, \ + BLOCK_NAME, \ + MB_ACCESS, \ + TB_CLOCK, \ + CTRL_CLOCK, \ + &CLASS_NAME##_make); \ } -#define UHD_RFNOC_BLOCK_REGISTER_DIRECT( \ - CLASS_NAME, NOC_ID, BLOCK_NAME, TB_CLOCK, CTRL_CLOCK) \ - UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT(CLASS_NAME, \ - NOC_ID, ANY_DEVICE, BLOCK_NAME, false, TB_CLOCK, CTRL_CLOCK) +#define UHD_RFNOC_BLOCK_REGISTER_DIRECT( \ + CLASS_NAME, NOC_ID, BLOCK_NAME, TB_CLOCK, CTRL_CLOCK) \ + UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT( \ + CLASS_NAME, NOC_ID, ANY_DEVICE, BLOCK_NAME, false, TB_CLOCK, CTRL_CLOCK) -#define UHD_RFNOC_BLOCK_REGISTER_DIRECT_MB_ACCESS( \ - CLASS_NAME, NOC_ID, BLOCK_NAME, TB_CLOCK, CTRL_CLOCK) \ - UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT(CLASS_NAME, \ - NOC_ID, ANY_DEVICE, BLOCK_NAME, true, TB_CLOCK, CTRL_CLOCK) +#define UHD_RFNOC_BLOCK_REGISTER_DIRECT_MB_ACCESS( \ + CLASS_NAME, NOC_ID, BLOCK_NAME, TB_CLOCK, CTRL_CLOCK) \ + UHD_RFNOC_BLOCK_REGISTER_FOR_DEVICE_DIRECT( \ + CLASS_NAME, NOC_ID, ANY_DEVICE, BLOCK_NAME, true, TB_CLOCK, CTRL_CLOCK) namespace uhd { namespace rfnoc { @@ -100,9 +104,8 @@ public: * found, it will be used to find a block that was previously registered * here. */ - static void register_block_descriptor(const std::string& block_key, - factory_t factory_fn); - + static void register_block_descriptor( + const std::string& block_key, factory_t factory_fn); }; }} /* namespace uhd::rfnoc */ diff --git a/host/include/uhd/rfnoc/res_source_info.hpp b/host/include/uhd/rfnoc/res_source_info.hpp index 37371009d..9ac978f18 100644 --- a/host/include/uhd/rfnoc/res_source_info.hpp +++ b/host/include/uhd/rfnoc/res_source_info.hpp @@ -14,15 +14,16 @@ namespace uhd { namespace rfnoc { /*! Describes the source of a particular resource (property or action) -*/ -struct res_source_info { + */ +struct res_source_info +{ /*! Source type - */ + */ enum source_t { - USER, ///< The user API sources this resource - INPUT_EDGE, ///< An input edge sources this resource + USER, ///< The user API sources this resource + INPUT_EDGE, ///< An input edge sources this resource OUTPUT_EDGE, ///< An input edge sources this resource - FRAMEWORK ///< This is a special resource, only accessed by the framework + FRAMEWORK ///< This is a special resource, only accessed by the framework }; // No default ctor: The source type must be specified @@ -49,9 +50,11 @@ struct res_source_info { //! Returns a string representation of the source std::string to_string() const { - const std::string type_repr = type == USER ? "USER" : - type == INPUT_EDGE ? "INPUT_EDGE" : - type == OUTPUT_EDGE ? "OUTPUT_EDGE" : "INVALID"; + const std::string type_repr = + type == USER + ? "USER" + : type == INPUT_EDGE ? "INPUT_EDGE" + : type == OUTPUT_EDGE ? "OUTPUT_EDGE" : "INVALID"; return type_repr + ":" + std::to_string(instance); } @@ -86,4 +89,3 @@ struct hash<uhd::rfnoc::res_source_info> } // namespace std #endif /* INCLUDED_LIBUHD_RES_SRC_INFO_HPP */ - diff --git a/host/include/uhd/stream.hpp b/host/include/uhd/stream.hpp index 4a4ec4453..22eb8f4dd 100644 --- a/host/include/uhd/stream.hpp +++ b/host/include/uhd/stream.hpp @@ -14,8 +14,8 @@ #include <uhd/types/ref_vector.hpp> #include <uhd/types/stream_cmd.hpp> #include <uhd/utils/noncopyable.hpp> -#include <memory> #include <boost/utility.hpp> +#include <memory> #include <string> #include <vector> diff --git a/host/include/uhd/transport/bounded_buffer.hpp b/host/include/uhd/transport/bounded_buffer.hpp index 354cff5e2..9368cdfba 100644 --- a/host/include/uhd/transport/bounded_buffer.hpp +++ b/host/include/uhd/transport/bounded_buffer.hpp @@ -19,7 +19,8 @@ namespace uhd { namespace transport { * The pop operation blocks on the bounded_buffer to become non empty. * The push operation blocks on the bounded_buffer to become non full. */ -template <typename elem_type> class bounded_buffer +template <typename elem_type> +class bounded_buffer { public: /*! diff --git a/host/include/uhd/transport/muxed_zero_copy_if.hpp b/host/include/uhd/transport/muxed_zero_copy_if.hpp index b2527db10..d8d77fccc 100644 --- a/host/include/uhd/transport/muxed_zero_copy_if.hpp +++ b/host/include/uhd/transport/muxed_zero_copy_if.hpp @@ -10,9 +10,9 @@ #include <uhd/config.hpp> #include <uhd/transport/zero_copy.hpp> +#include <uhd/utils/noncopyable.hpp> #include <stdint.h> #include <functional> -#include <uhd/utils/noncopyable.hpp> namespace uhd { namespace transport { diff --git a/host/include/uhd/transport/nirio/rpc/rpc_common.hpp b/host/include/uhd/transport/nirio/rpc/rpc_common.hpp index 9be1d024c..debb5c959 100644 --- a/host/include/uhd/transport/nirio/rpc/rpc_common.hpp +++ b/host/include/uhd/transport/nirio/rpc/rpc_common.hpp @@ -72,12 +72,14 @@ class func_args_writer_t public: func_args_writer_t() : _stream(), _archive(_stream, boost::archive::no_header) {} - template <typename data_t> void push(const data_t& d) + template <typename data_t> + void push(const data_t& d) { _archive << d; } - template <typename data_t> func_args_writer_t& operator<<(const data_t& data) + template <typename data_t> + func_args_writer_t& operator<<(const data_t& data) { push(data); return *this; @@ -105,13 +107,15 @@ class func_args_reader_t public: func_args_reader_t() : _stream(), _archive() {} - template <typename data_t> void pull(data_t& d) const + template <typename data_t> + void pull(data_t& d) const { if (_archive) (*_archive) >> d; } - template <typename data_t> const func_args_reader_t& operator>>(data_t& data) const + template <typename data_t> + const func_args_reader_t& operator>>(data_t& data) const { pull(data); return *this; diff --git a/host/include/uhd/transport/nirio/rpc/usrprio_rpc_common.hpp b/host/include/uhd/transport/nirio/rpc/usrprio_rpc_common.hpp index 71d8f7047..bbb44f2d6 100644 --- a/host/include/uhd/transport/nirio/rpc/usrprio_rpc_common.hpp +++ b/host/include/uhd/transport/nirio/rpc/usrprio_rpc_common.hpp @@ -33,7 +33,8 @@ struct usrprio_device_info std::string pcie_serial_num; std::string interface_path; - template <typename Archive> void serialize(Archive& ar, const unsigned int version) + template <typename Archive> + void serialize(Archive& ar, const unsigned int version) { if (version || !version) { // Suppress unused warning ar& interface_num; diff --git a/host/include/uhd/transport/zero_copy.hpp b/host/include/uhd/transport/zero_copy.hpp index a28398445..af4e88ee0 100644 --- a/host/include/uhd/transport/zero_copy.hpp +++ b/host/include/uhd/transport/zero_copy.hpp @@ -12,8 +12,8 @@ #include <uhd/utils/noncopyable.hpp> #include <boost/detail/atomic_count.hpp> #include <boost/intrusive_ptr.hpp> -#include <memory> #include <boost/utility.hpp> +#include <memory> namespace uhd { namespace transport { @@ -21,9 +21,7 @@ namespace uhd { namespace transport { class UHD_API managed_buffer { public: - managed_buffer(void) : _ref_count(0), _buffer(NULL), _length(0) - { - } + managed_buffer(void) : _ref_count(0), _buffer(NULL), _length(0) {} virtual ~managed_buffer(void) {} @@ -47,7 +45,8 @@ public: * Get a pointer to the underlying buffer. * \return a pointer into memory */ - template <class T> UHD_INLINE T cast(void) const + template <class T> + UHD_INLINE T cast(void) const { return static_cast<T>(_buffer); } diff --git a/host/include/uhd/types/device_addr.hpp b/host/include/uhd/types/device_addr.hpp index 93a5d345f..8751b3ad4 100644 --- a/host/include/uhd/types/device_addr.hpp +++ b/host/include/uhd/types/device_addr.hpp @@ -71,7 +71,8 @@ public: * \return the casted value as type T or the default * \throw error when the parameter cannot be casted */ - template <typename T> T cast(const std::string& key, const T& def) const + template <typename T> + T cast(const std::string& key, const T& def) const { if (not this->has_key(key)) return def; diff --git a/host/include/uhd/types/dict.hpp b/host/include/uhd/types/dict.hpp index b5858d61c..269308c54 100644 --- a/host/include/uhd/types/dict.hpp +++ b/host/include/uhd/types/dict.hpp @@ -18,7 +18,8 @@ namespace uhd { /*! * A templated dictionary class with a python-like interface. */ -template <typename Key, typename Val> class dict +template <typename Key, typename Val> +class dict { public: /*! @@ -32,7 +33,8 @@ public: * \param first the begin iterator * \param last the end iterator */ - template <typename InputIterator> dict(InputIterator first, InputIterator last); + template <typename InputIterator> + dict(InputIterator first, InputIterator last); /*! * Get the number of elements in this dict. diff --git a/host/include/uhd/types/eeprom.hpp b/host/include/uhd/types/eeprom.hpp index d2b29fe6b..ab8dfe590 100644 --- a/host/include/uhd/types/eeprom.hpp +++ b/host/include/uhd/types/eeprom.hpp @@ -13,7 +13,7 @@ namespace uhd { -typedef std::map<std::string, std::vector<uint8_t> > eeprom_map_t; +typedef std::map<std::string, std::vector<uint8_t>> eeprom_map_t; } /* namespace uhd */ diff --git a/host/include/uhd/types/filters.hpp b/host/include/uhd/types/filters.hpp index d15002c0e..076e55e89 100644 --- a/host/include/uhd/types/filters.hpp +++ b/host/include/uhd/types/filters.hpp @@ -12,8 +12,8 @@ #include <uhd/utils/log.hpp> #include <stdint.h> #include <boost/scoped_array.hpp> -#include <memory> #include <iostream> +#include <memory> #include <ostream> #include <sstream> #include <string> @@ -119,7 +119,8 @@ public: virtual std::string to_pp_string(); }; -template <typename tap_t> class UHD_API digital_filter_base : public filter_info_base +template <typename tap_t> +class UHD_API digital_filter_base : public filter_info_base { protected: double _rate; @@ -208,7 +209,7 @@ template <typename tap_t> class UHD_API digital_filter_fir : public digital_filter_base<tap_t> { public: - typedef std::shared_ptr<digital_filter_fir<tap_t> > sptr; + typedef std::shared_ptr<digital_filter_fir<tap_t>> sptr; digital_filter_fir(filter_info_base::filter_type type, bool bypass, diff --git a/host/include/uhd/types/metadata.hpp b/host/include/uhd/types/metadata.hpp index 8ec321e5f..d46123cf8 100644 --- a/host/include/uhd/types/metadata.hpp +++ b/host/include/uhd/types/metadata.hpp @@ -187,7 +187,7 @@ struct UHD_API tx_metadata_t * for the array and for indicating the maximum number of elements in * the array via the `eov_positions_size` value below. */ - size_t* eov_positions = nullptr; + size_t* eov_positions = nullptr; size_t eov_positions_size = 0; /*! diff --git a/host/include/uhd/types/ref_vector.hpp b/host/include/uhd/types/ref_vector.hpp index 2a1fc0aad..6e710eecc 100644 --- a/host/include/uhd/types/ref_vector.hpp +++ b/host/include/uhd/types/ref_vector.hpp @@ -18,7 +18,8 @@ namespace uhd { * - Provides a std::vector-like interface for an array. * - Statically sized, and does not manage the memory. */ -template <typename T> class UHD_API ref_vector +template <typename T> +class UHD_API ref_vector { public: /*! diff --git a/host/include/uhd/usrp/dboard_base.hpp b/host/include/uhd/usrp/dboard_base.hpp index 9575e6bc9..f6defa073 100644 --- a/host/include/uhd/usrp/dboard_base.hpp +++ b/host/include/uhd/usrp/dboard_base.hpp @@ -12,9 +12,9 @@ #include <uhd/usrp/dboard_eeprom.hpp> #include <uhd/usrp/dboard_id.hpp> #include <uhd/usrp/dboard_iface.hpp> +#include <uhd/utils/noncopyable.hpp> #include <uhd/utils/pimpl.hpp> #include <memory> -#include <uhd/utils/noncopyable.hpp> namespace uhd { namespace usrp { diff --git a/host/include/uhd/usrp/dboard_iface.hpp b/host/include/uhd/usrp/dboard_iface.hpp index 9a25fb607..aef65f3d7 100644 --- a/host/include/uhd/usrp/dboard_iface.hpp +++ b/host/include/uhd/usrp/dboard_iface.hpp @@ -15,8 +15,8 @@ #include <uhd/usrp/gpio_defs.hpp> #include <uhd/utils/pimpl.hpp> #include <stdint.h> -#include <memory> #include <boost/thread/thread.hpp> +#include <memory> #include <string> #include <vector> diff --git a/host/include/uhd/usrp/dboard_manager.hpp b/host/include/uhd/usrp/dboard_manager.hpp index 737c24add..36f6094df 100644 --- a/host/include/uhd/usrp/dboard_manager.hpp +++ b/host/include/uhd/usrp/dboard_manager.hpp @@ -12,8 +12,8 @@ #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_eeprom.hpp> #include <uhd/usrp/dboard_id.hpp> -#include <memory> #include <uhd/utils/noncopyable.hpp> +#include <memory> #include <string> #include <vector> diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index f6a68ef3e..ac80cc15a 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -35,9 +35,9 @@ #include <uhd/types/wb_iface.hpp> #include <uhd/usrp/dboard_iface.hpp> #include <uhd/usrp/subdev_spec.hpp> -#include <memory> #include <uhd/utils/noncopyable.hpp> #include <complex> +#include <memory> #include <string> #include <vector> @@ -1564,12 +1564,14 @@ public: /******************************************************************* * Filter API methods ******************************************************************/ - // TODO: This should be a const function, but I don't want to wrestle with the compiler right now + // TODO: This should be a const function, but I don't want to wrestle with the + // compiler right now /*! * Enumerate the available filters in the RX signal path. * \param chan RX channel index 0 to N-1 * \return a vector of strings representing the selected filter names. - * \return Filter names will follow the pattern BLOCK_ID:FILTER_NAME. For example, "0/Radio#0:HB_0" + * \return Filter names will follow the pattern BLOCK_ID:FILTER_NAME. For example, + * "0/Radio#0:HB_0" */ virtual std::vector<std::string> get_rx_filter_names(const size_t chan) = 0; @@ -1579,7 +1581,8 @@ public: * \param chan RX channel index 0 to N-1 * \return a filter_info_base::sptr. */ - virtual uhd::filter_info_base::sptr get_rx_filter(const std::string& name, const size_t chan) = 0; + virtual uhd::filter_info_base::sptr get_rx_filter( + const std::string& name, const size_t chan) = 0; /*! * Write back a filter obtained by get_rx_filter() to the signal path. @@ -1588,15 +1591,18 @@ public: * \param filter the filter_info_base::sptr of the filter object to be written * \param chan RX channel index 0 to N-1 */ - virtual void set_rx_filter( - const std::string& name, uhd::filter_info_base::sptr filter, const size_t chan) = 0; + virtual void set_rx_filter(const std::string& name, + uhd::filter_info_base::sptr filter, + const size_t chan) = 0; - // TODO: This should be a const function, but I don't want to wrestle with the compiler right now + // TODO: This should be a const function, but I don't want to wrestle with the + // compiler right now /*! * Enumerate the available filters in the TX signal path. * \param chan TX channel index 0 to N-1 * \return a vector of strings representing the selected filter names. - * \return Filter names will follow the pattern BLOCK_ID:FILTER_NAME. For example, "0/Radio#0:HB_0" + * \return Filter names will follow the pattern BLOCK_ID:FILTER_NAME. For example, + * "0/Radio#0:HB_0" */ virtual std::vector<std::string> get_tx_filter_names(const size_t chan) = 0; @@ -1606,7 +1612,8 @@ public: * \param chan TX channel index 0 to N-1 * \return a filter_info_base::sptr. */ - virtual uhd::filter_info_base::sptr get_tx_filter(const std::string& name, const size_t chan) = 0; + virtual uhd::filter_info_base::sptr get_tx_filter( + const std::string& name, const size_t chan) = 0; /*! * Write back a filter obtained by get_tx_filter() to the signal path. @@ -1615,8 +1622,9 @@ public: * \param filter the filter_info_base::sptr of the filter object to be written * \param chan TX channel index 0 to N-1 */ - virtual void set_tx_filter( - const std::string& name, uhd::filter_info_base::sptr filter, const size_t chan) = 0; + virtual void set_tx_filter(const std::string& name, + uhd::filter_info_base::sptr filter, + const size_t chan) = 0; }; } // namespace usrp diff --git a/host/include/uhd/utils/algorithm.hpp b/host/include/uhd/utils/algorithm.hpp index 855f30d59..54946f8da 100644 --- a/host/include/uhd/utils/algorithm.hpp +++ b/host/include/uhd/utils/algorithm.hpp @@ -30,7 +30,8 @@ namespace uhd { * \param range the range of elements to be sorted * \return a new range with the elements sorted */ -template <typename Range> UHD_INLINE Range sorted(const Range& range) +template <typename Range> +UHD_INLINE Range sorted(const Range& range) { Range r(range); std::sort(boost::begin(r), boost::end(r)); @@ -47,7 +48,8 @@ template <typename Range> UHD_INLINE Range sorted(const Range& range) * \param range the range of elements to be reversed * \return a new range with the elements reversed */ -template <typename Range> UHD_INLINE Range reversed(const Range& range) +template <typename Range> +UHD_INLINE Range reversed(const Range& range) { Range r(range); std::reverse(boost::begin(r), boost::end(r)); @@ -76,7 +78,8 @@ UHD_INLINE bool has(const Range& range, const T& value) * \param bound2 the upper or lower bound * \return the value clipped at the bounds */ -template <typename T> UHD_INLINE T clip(const T& val, const T& bound1, const T& bound2) +template <typename T> +UHD_INLINE T clip(const T& val, const T& bound1, const T& bound2) { const T minimum = std::min(bound1, bound2); if (val < minimum) diff --git a/host/include/uhd/utils/byteswap.hpp b/host/include/uhd/utils/byteswap.hpp index 07b25b4e9..3c90a6c3e 100644 --- a/host/include/uhd/utils/byteswap.hpp +++ b/host/include/uhd/utils/byteswap.hpp @@ -29,22 +29,26 @@ uint32_t byteswap(uint32_t); uint64_t byteswap(uint64_t); //! network to host: short, long, or long-long -template <typename T> T ntohx(T); +template <typename T> +T ntohx(T); //! host to network: short, long, or long-long -template <typename T> T htonx(T); +template <typename T> +T htonx(T); //! worknet to host: short, long, or long-long // // The argument is assumed to be little-endian (i.e, the inverse // of typical network endianness). -template <typename T> T wtohx(T); +template <typename T> +T wtohx(T); //! host to worknet: short, long, or long-long // // The return value is little-endian (i.e, the inverse // of typical network endianness). -template <typename T> T htowx(T); +template <typename T> +T htowx(T); } // namespace uhd diff --git a/host/include/uhd/utils/dirty_tracked.hpp b/host/include/uhd/utils/dirty_tracked.hpp index f01593d50..2d5403ce6 100644 --- a/host/include/uhd/utils/dirty_tracked.hpp +++ b/host/include/uhd/utils/dirty_tracked.hpp @@ -21,7 +21,8 @@ namespace uhd { * - Must have an assignment operator (=) * - Must have an equality operator (==) */ -template <typename data_t> class dirty_tracked +template <typename data_t> +class dirty_tracked { public: /*! diff --git a/host/include/uhd/utils/math.hpp b/host/include/uhd/utils/math.hpp index 944e9a951..60b34bef0 100644 --- a/host/include/uhd/utils/math.hpp +++ b/host/include/uhd/utils/math.hpp @@ -64,7 +64,8 @@ namespace fp_compare { * // Compare doubles 'x' and 'y'. * bool x_equals_y = (fp_compare_epsilon<double>(x) == y); */ -template <typename float_t> class fp_compare_epsilon +template <typename float_t> +class fp_compare_epsilon { public: UHD_INLINE fp_compare_epsilon(float_t value); @@ -170,7 +171,8 @@ namespace fp_compare { * // Compare doubles 'x' and 'y'. * bool x_equals_y = (fp_compare_delta<double>(x) == y); */ -template <typename float_t> class fp_compare_delta +template <typename float_t> +class fp_compare_delta { public: UHD_INLINE fp_compare_delta(float_t value); @@ -233,14 +235,16 @@ UHD_INLINE bool frequencies_are_equal(double lhs, double rhs) } //! Portable version of lcm() across Boost versions -template <typename IntegerType> inline IntegerType lcm(IntegerType x, IntegerType y) +template <typename IntegerType> +inline IntegerType lcm(IntegerType x, IntegerType y) { // Note: _bmint is defined conditionally at the top of the file return _bmint::lcm<IntegerType>(x, y); } //! Portable version of gcd() across Boost versions -template <typename IntegerType> inline IntegerType gcd(IntegerType x, IntegerType y) +template <typename IntegerType> +inline IntegerType gcd(IntegerType x, IntegerType y) { // Note: _bmint is defined conditionally at the top of the file return _bmint::gcd<IntegerType>(x, y); diff --git a/host/include/uhd/utils/scope_exit.hpp b/host/include/uhd/utils/scope_exit.hpp index 953e5e47d..0e4a01382 100644 --- a/host/include/uhd/utils/scope_exit.hpp +++ b/host/include/uhd/utils/scope_exit.hpp @@ -23,7 +23,7 @@ namespace uhd { namespace utils { class scope_exit { public: - using uptr = std::unique_ptr<scope_exit>; + using uptr = std::unique_ptr<scope_exit>; using exit_cb_t = std::function<void(void)>; // \param exit_b The function object ("exit callback") that gets executed @@ -49,7 +49,6 @@ private: std::function<void(void)> _exit_cb; }; -}} /* namespace uhd::rfnoc */ +}} // namespace uhd::utils #endif /* INCLUDED_UHD_SCOPE_EXIT_HPP */ - diff --git a/host/include/uhd/utils/soft_register.hpp b/host/include/uhd/utils/soft_register.hpp index ee80caab3..7e7916f62 100644 --- a/host/include/uhd/utils/soft_register.hpp +++ b/host/include/uhd/utils/soft_register.hpp @@ -11,13 +11,13 @@ #include <uhd/exception.hpp> #include <uhd/types/wb_iface.hpp> #include <uhd/utils/dirty_tracked.hpp> -#include <stdint.h> #include <uhd/utils/noncopyable.hpp> +#include <stdint.h> +#include <unordered_map> #include <boost/thread/locks.hpp> #include <boost/thread/mutex.hpp> #include <boost/tokenizer.hpp> #include <list> -#include <unordered_map> /*! \file soft_register.hpp * Utilities to access and index hardware registers. @@ -84,7 +84,8 @@ UHD_INLINE size_t shift(const soft_reg_field_t field) return ((field >> 8) & 0xFF); } -template <typename data_t> UHD_INLINE data_t mask(const soft_reg_field_t field) +template <typename data_t> +UHD_INLINE data_t mask(const soft_reg_field_t field) { constexpr data_t ONE = static_cast<data_t>(1); constexpr data_t ALL_ONES = ~static_cast<data_t>(0); @@ -137,7 +138,7 @@ template <typename reg_data_t, bool readable, bool writable> class UHD_API soft_register_t : public soft_register_base { public: - typedef std::shared_ptr<soft_register_t<reg_data_t, readable, writable> > sptr; + typedef std::shared_ptr<soft_register_t<reg_data_t, readable, writable>> sptr; // Reserved field. Represents all bits in the register. UHD_DEFINE_SOFT_REG_FIELD(REGISTER, sizeof(reg_data_t) * 8, 0); //[WIDTH-1:0] @@ -311,7 +312,7 @@ class UHD_API soft_register_sync_t : public soft_register_t<reg_data_t, readable, writable> { public: - typedef std::shared_ptr<soft_register_sync_t<reg_data_t, readable, writable> > sptr; + typedef std::shared_ptr<soft_register_sync_t<reg_data_t, readable, writable>> sptr; soft_register_sync_t(wb_iface::wb_addr_type wr_addr, wb_iface::wb_addr_type rd_addr, @@ -642,9 +643,8 @@ public: { // Turn the slash separated path string into tokens std::list<std::string> tokens; - for (const std::string& node : - boost::tokenizer<boost::char_separator<char> >( - path, boost::char_separator<char>("/"))) { + for (const std::string& node : boost::tokenizer<boost::char_separator<char>>( + path, boost::char_separator<char>("/"))) { tokens.push_back(node); } if ((tokens.size() > 2 && tokens.front() == _name) || // If this is a nested DB |