Loading...
Searching...
No Matches
uhd Namespace Reference

## Namespaces

namespace | build_info
namespace | usrp
namespace | convert
namespace | experts
namespace | extension
namespace | features
namespace | rfnoc
namespace | transport
namespace | usrp_clock
namespace | cast
namespace | utils
namespace | csv
namespace | math
namespace | log
namespace | soft_reg_field
namespace | string

## Classes

class | device
struct | exception
struct | assertion_error
struct | lookup_error
struct | index_error
struct | key_error
struct | type_error
struct | value_error
struct | narrowing_error
struct | runtime_error
struct | usb_error
struct | not_implemented_error
struct | access_error
struct | environment_error
struct | io_error
struct | os_error
struct | system_error
struct | syntax_error
struct | rfnoc_error
struct | op_failed
struct | op_timeout
struct | op_seqerr
struct | op_timerr
struct | resolve_error
struct | routing_error
class | image_loader
class | property_iface
class | property
struct | fs_path
class | property_tree
struct | stream_args_t
class | rx_streamer
class | tx_streamer
class | device_addr_t
class | dict
class | filter_info_base
class | analog_filter_base
class | analog_filter_lp
class | digital_filter_base
class | digital_filter_fir
class | mac_addr_t
struct | memmap32_iface
| Represents a 32-bit, memory-mapped interface (peek/poke). More...
struct | memmap32_iface_timed
| Represents a 32-bit, memory-mapped interface (peek/poke). More...
struct | rx_metadata_t
struct | tx_metadata_t
struct | async_metadata_t
class | range_t
struct | meta_range_t
class | ref_vector
struct | sensor_value_t
class | i2c_iface
struct | spi_config_t
class | spi_iface
class | uart_iface
struct | stream_cmd_t
class | time_spec_t
struct | tune_request_t
struct | tune_result_t
class | wb_iface
class | timed_wb_iface
class | compat_num
| Compat number representation class. More...
class | compat_num16
| Specialization of the compat_num class for 16-bit compat numbers. More...
class | compat_num32
| Specialization of the compat_num class for 32-bit compat numbers. More...
class | dirty_tracked
struct | gain_fcns_t
class | gain_group
class | msg_task
class | soft_register_base
class | soft_register_t
class | soft_register_sync_t
class | soft_regmap_accessor_t
class | soft_regmap_t
class | soft_regmap_db_t
class | task

## Typedefs

typedef std::vector< uint8_t > | byte_vector_t
| Byte vector used for I2C data passing and EEPROM parsing.
typedef std::vector< device_addr_t > | device_addrs_t
| A typedef for a vector of device addresses.
typedef std::map< std::string, std::vector< uint8_t > > | eeprom_map_t
typedef meta_range_t | gain_range_t
typedef meta_range_t | freq_range_t
typedef boost::noncopyable | noncopyable
typedef uint32_t | soft_reg_field_t
typedef soft_register_t< uint32_t, false, true > | soft_reg32_wo_t
typedef soft_register_t< uint32_t, true, false > | soft_reg32_ro_t
typedef soft_register_t< uint32_t, true, true > | soft_reg32_rw_t
typedef soft_register_sync_t< uint32_t, false, true > | soft_reg32_wo_sync_t
typedef soft_register_sync_t< uint32_t, true, false > | soft_reg32_ro_sync_t
typedef soft_register_sync_t< uint32_t, true, true > | soft_reg32_rw_sync_t
typedef soft_register_t< uint64_t, false, true > | soft_reg64_wo_t
typedef soft_register_t< uint64_t, true, false > | soft_reg64_ro_t
typedef soft_register_t< uint64_t, true, true > | soft_reg64_rw_t
typedef soft_register_sync_t< uint64_t, false, true > | soft_reg64_wo_sync_t
typedef soft_register_sync_t< uint64_t, true, false > | soft_reg64_ro_sync_t
typedef soft_register_sync_t< uint64_t, true, true > | soft_reg64_rw_sync_t

## Enumerations

enum | direction_t { RX_DIRECTION , TX_DIRECTION , DX_DIRECTION }
enum | endianness_t { ENDIANNESS_BIG , ENDIANNESS_LITTLE }
enum class | trig_io_mode_t { PPS_OUTPUT , INPUT , OFF }
enum | soft_reg_flush_mode_t { OPTIMIZED_FLUSH , ALWAYS_FLUSH }

## Functions

UHD_API fs_path | operator/ (const fs_path &, const fs_path &)
UHD_API fs_path | operator/ (const fs_path &, size_t)
template<typename RangeSrc, typename RangeDst>
UHD_INLINE void | byte_copy (const RangeSrc &src, RangeDst &dst)
UHD_API std::string | bytes_to_string (const byte_vector_t &bytes)
| Create a string from a byte vector, terminate when invalid ASCII encountered.
UHD_API byte_vector_t | string_to_bytes (const std::string &str, size_t max_length)
| Create a byte vector from a string, end at null terminator or max length.
UHD_API device_addrs_t | separate_device_addr (const device_addr_t &dev_addr)
| Separate an indexed device address into a vector of device addresses.
UHD_API device_addr_t | combine_device_addrs (const device_addrs_t &dev_addrs)
| Combine a vector of device addresses into an indexed device address.
UHD_API_HEADER std::ostream & | operator<< (std::ostream &os, filter_info_base &f)
UHD_API bool | operator== (const time_spec_t &, const time_spec_t &)
| Implement equality_comparable interface.
UHD_API bool | operator< (const time_spec_t &, const time_spec_t &)
| Implement less_than_comparable interface.
template<typename Range>
UHD_INLINE Range | sorted (const Range &range)
template<typename Range>
UHD_INLINE Range | reversed (const Range &range)
template<typename Range, typename T>
UHD_INLINE bool | has (const Range &range, const T &value)
template<typename T>
UHD_INLINE T | clip (const T &val, const T &bound1, const T &bound2)
template<typename T, typename Range>
void | assert_has (const Range &range, const T &value, const std::string &what="unknown")
template<typename T, typename Range>
UHD_INLINE void | assert_has (const Range &range, const T &value, const std::string &what)
uint16_t | byteswap (uint16_t)
| perform a byteswap on a 16 bit integer
uint32_t | byteswap (uint32_t)
| perform a byteswap on a 32 bit integer
uint64_t | byteswap (uint64_t)
| perform a byteswap on a 64 bit integer
template<typename T>
T | ntohx (T)
| network to host: short, long, or long-long
template<typename T>
T | htonx (T)
| host to network: short, long, or long-long
template<typename T>
T | wtohx (T)
| worknet to host: short, long, or long-long
template<typename T>
T | htowx (T)
| host to worknet: short, long, or long-long
template<typename T>
UHD_INLINE T | ntohx (T num)
| network to host: short, long, or long-long
template<typename T>
UHD_INLINE T | htonx (T num)
| host to network: short, long, or long-long
template<typename T>
UHD_INLINE T | wtohx (T num)
| worknet to host: short, long, or long-long
template<typename T>
UHD_INLINE T | htowx (T num)
| host to worknet: short, long, or long-long
void UHD_API | assert_fpga_compat (const size_t uhd_major, const size_t uhd_minor, const uint64_t fpga_compat, const std::string &fpga_component, const std::string &log_component, const bool fail_on_minor_behind=false)
void UHD_API | assert_fpga_compat (const size_t uhd_major, const size_t uhd_minor, const uint32_t fpga_compat, const std::string &fpga_component, const std::string &log_component, const bool fail_on_minor_behind=false)
UHD_API std::string | get_tmp_path (void)
| Get a string representing the system's temporary directory.
UHD_API std::string | get_lib_path (void)
| Get a string representing the system's library directory.
UHD_API std::string | get_pkg_path (void)
| Get a string representing the system's pkg directory.
UHD_API std::string | get_pkg_data_path (void)
| Get a string representing the system's package data directory ("share").
UHD_API std::string | get_cal_data_path (void)
| Get a string representing the location of the calibration database.
UHD_API std::vector< fs::path > | get_module_paths (void)
| Get UHD library paths.
UHD_API std::string | find_image_path (const std::string &image_name, const std::string &search_paths="")
UHD_API std::string | find_utility (const std::string &name)
UHD_API std::string | print_utility_error (const std::string &name, const std::string &args="")
int32_t | get_process_id ()
uint32_t | get_host_id ()
uint32_t | get_process_hash ()
UHD_INLINE bool | likely (bool expr)
| hint for the branch prediction
UHD_INLINE bool | unlikely (bool expr)
| hint for the branch prediction
UHD_API void | set_thread_priority (float priority=DEFAULT_THREAD_PRIORITY, bool realtime=true)
UHD_API bool | set_thread_priority_safe (float priority=DEFAULT_THREAD_PRIORITY, bool realtime=true)
UHD_API void | set_thread_name (boost::thread *thread, const std::string &name)
UHD_API void | set_thread_name (std::thread *thread, const std::string &name)
UHD_API void | set_thread_affinity (const std::vector< size_t > &cpu_affinity_list)

## Variables

constexpr float | DEFAULT_THREAD_PRIORITY = float(0.5)

## Detailed Description

Define common exceptions used throughout the code:

- The python built-in exceptions were used as inspiration.
- Exceptions inherit from std::exception to provide what().
- Exceptions inherit from uhd::exception to provide code().

The code() provides an error code which allows the application the option of printing a cryptic error message from the 1990s.

The dynamic_clone() and dynamic_throw() methods allow us to: catch an exception by dynamic type (i.e. derived class), save it, and later rethrow it, knowing only the static type (i.e. base class), and then finally to catch it again using the derived type.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2106.html

Useful templated functions, classes, and constants. Some of these overlap with the STL, but these are created with Boost for portability. Many of the range wrapper functions come with versions of boost >= 1.43.

## Typedef Documentation

## byte_vector_t

typedef std::vector< uint8_t > uhd::byte_vector_t

Byte vector used for I2C data passing and EEPROM parsing.

Byte vector typedef for passing data in and out of I2C interfaces.

## device_addrs_t

typedef std::vector<device_addr_t> uhd::device_addrs_t

A typedef for a vector of device addresses.

## eeprom_map_t

typedef std::map<std::string, std::vector<uint8_t> > uhd::eeprom_map_t

## freq_range_t

typedef meta_range_t uhd::freq_range_t

## gain_range_t

typedef meta_range_t uhd::gain_range_t

## noncopyable

typedef boost::noncopyable uhd::noncopyable

## soft_reg32_ro_sync_t

typedef soft_register_sync_t<uint32_t, true, false> uhd::soft_reg32_ro_sync_t

## soft_reg32_ro_t

typedef soft_register_t<uint32_t, true, false> uhd::soft_reg32_ro_t

## soft_reg32_rw_sync_t

typedef soft_register_sync_t<uint32_t, true, true> uhd::soft_reg32_rw_sync_t

## soft_reg32_rw_t

typedef soft_register_t<uint32_t, true, true> uhd::soft_reg32_rw_t

## soft_reg32_wo_sync_t

typedef soft_register_sync_t<uint32_t, false, true> uhd::soft_reg32_wo_sync_t

## soft_reg32_wo_t

typedef soft_register_t<uint32_t, false, true> uhd::soft_reg32_wo_t

## soft_reg64_ro_sync_t

typedef soft_register_sync_t<uint64_t, true, false> uhd::soft_reg64_ro_sync_t

## soft_reg64_ro_t

typedef soft_register_t<uint64_t, true, false> uhd::soft_reg64_ro_t

## soft_reg64_rw_sync_t

typedef soft_register_sync_t<uint64_t, true, true> uhd::soft_reg64_rw_sync_t

## soft_reg64_rw_t

typedef soft_register_t<uint64_t, true, true> uhd::soft_reg64_rw_t

## soft_reg64_wo_sync_t

typedef soft_register_sync_t<uint64_t, false, true> uhd::soft_reg64_wo_sync_t

## soft_reg64_wo_t

typedef soft_register_t<uint64_t, false, true> uhd::soft_reg64_wo_t

## soft_reg_field_t

typedef uint32_t uhd::soft_reg_field_t

A register field is defined as a tuple of the mask and the shift. It can be used to make read-modify-write operations more convenient For efficiency reasons, it is recommended to always use a constant of this type because it will get optimized out by the compiler and will result in zero memory overhead

## Enumeration Type Documentation

## direction_t

enum uhd::direction_t

Enumerator
RX_DIRECTION | Receive.
TX_DIRECTION | Transmit.
DX_DIRECTION | Duplex.

## endianness_t

enum uhd::endianness_t

Enumerator
ENDIANNESS_BIG |
ENDIANNESS_LITTLE |

## soft_reg_flush_mode_t

enum uhd::soft_reg_flush_mode_t

Enumerator
OPTIMIZED_FLUSH |
ALWAYS_FLUSH |

## trig_io_mode_t

enum class uhd::trig_io_mode_t

strong

Enumerator
PPS_OUTPUT | Output PPS signal from port.
INPUT | Use port as input.
OFF | Port is turned off.

## Function Documentation

## assert_fpga_compat() [1/2]

void UHD_API uhd::assert_fpga_compat | ( | const size_t | uhd_major,
|  | const size_t | uhd_minor,
|  | const uint32_t | fpga_compat,
|  | const std::string & | fpga_component,
|  | const std::string & | log_component,
|  | const bool | fail_on_minor_behind = false )

Checks for FPGA compatibility, and throws an exception on mismatch.

Exceptions

  uhd::runtime_error | on mismatch.

## assert_fpga_compat() [2/2]

void UHD_API uhd::assert_fpga_compat | ( | const size_t | uhd_major,
|  | const size_t | uhd_minor,
|  | const uint64_t | fpga_compat,
|  | const std::string & | fpga_component,
|  | const std::string & | log_component,
|  | const bool | fail_on_minor_behind = false )

Checks for FPGA compatibility, and throws an exception on mismatch.

Exceptions

  uhd::runtime_error | on mismatch.

## assert_has() [1/2]

template<typename T, typename Range>

UHD_INLINE void uhd::assert_has | ( | const Range & | range,
|  | const T & | value,
|  | const std::string & | what = "unknown" )

Check that an element is found in a container. If not, throw a meaningful assertion error. The "what" in the error will show what is being set and a list of known good values.

Parameters

  range | a list of possible settings
  value | an element that may be in the list
  what | a description of what the value is

Exceptions

  assertion_error | when elem not in list

## assert_has() [2/2]

template<typename T, typename Range>

void uhd::assert_has | ( | const Range & | range,
|  | const T & | value,
|  | const std::string & | what = "unknown" )

Check that an element is found in a container. If not, throw a meaningful assertion error. The "what" in the error will show what is being set and a list of known good values.

Parameters

  range | a list of possible settings
  value | an element that may be in the list
  what | a description of what the value is

Exceptions

  assertion_error | when elem not in list

## byte_copy()

template<typename RangeSrc, typename RangeDst>

UHD_INLINE void uhd::byte_copy | ( | const RangeSrc & | src,
|  | RangeDst & | dst )

## bytes_to_string()

UHD_API std::string uhd::bytes_to_string | ( | const byte_vector_t & | bytes | ) |

Create a string from a byte vector, terminate when invalid ASCII encountered.

## byteswap() [1/3]

UHD_INLINE uint16_t uhd::byteswap | ( | uint16_t | x | ) |

perform a byteswap on a 16 bit integer

## byteswap() [2/3]

UHD_INLINE uint32_t uhd::byteswap | ( | uint32_t | x | ) |

perform a byteswap on a 32 bit integer

## byteswap() [3/3]

UHD_INLINE uint64_t uhd::byteswap | ( | uint64_t | x | ) |

perform a byteswap on a 64 bit integer

## clip()

template<typename T>

UHD_INLINE T uhd::clip | ( | const T & | val,
|  | const T & | bound1,
|  | const T & | bound2 )

A templated clip implementation.

Parameters

  val | the value to clip between an upper and lower limit
  bound1 | the upper or lower bound
  bound2 | the upper or lower bound

Returns
  the value clipped at the bounds

## combine_device_addrs()

UHD_API device_addr_t uhd::combine_device_addrs | ( | const device_addrs_t & | dev_addrs | ) |

Combine a vector of device addresses into an indexed device address.

## find_image_path()

UHD_API std::string uhd::find_image_path | ( | const std::string & | image_name,
|  | const std::string & | search_paths = "" )

Return the UHD images directory path.

This function returns the UHD images installation path on this system. The returned directory path is guaranteed to exist (assuming a valid path is found). This function will look for a directory that exists using this order of precedence:

1) UHD_IMAGES_DIR environment variable 2) Any paths passed to this function via `search_paths' 3) /usr/share/uhd/images

The search_paths parameter may contain Windows registry keys. If no directory is found, an empty string is returned.

Parameters

  search_paths | A comma-separated list of hints for paths to include.

Returns
  A path string if one is found, or an empty string on failure. */ UHD_API std::string get_images_dir(const std::string& search_paths);

/*! Return the full path to particular UHD binary image.

This function searches for the passed image name, and returns an absolute path to it. The returned path is guaranteed to exist. The caller can also provide a full path to the image in the argument, and this function will validate it and convert it to an absolute system path.

Parameters

  image_name | The name of the file to search for, or the full path.
  search_paths | Hints / paths to use when calling get_images_dir

Returns
  the full system path to the file

Exceptions

  exception | uhd::io_error if the file was not found.

## find_utility()

UHD_API std::string uhd::find_utility | ( | const std::string & | name | ) |

Search for the location of a particular UHD utility. The utility must be installed in the uhd/utils directory.

Parameters

  name | the name of the utility to search for

Returns
  the full system path to the given utility

## get_cal_data_path()

UHD_API std::string uhd::get_cal_data_path | ( | void |  | ) |

Get a string representing the location of the calibration database.

## get_host_id()

uint32_t uhd::get_host_id | ( |  | ) |

## get_lib_path()

UHD_API std::string uhd::get_lib_path | ( | void |  | ) |

Get a string representing the system's library directory.

## get_module_paths()

UHD_API std::vector< fs::path > uhd::get_module_paths | ( | void |  | ) |

Get UHD library paths.

## get_pkg_data_path()

UHD_API std::string uhd::get_pkg_data_path | ( | void |  | ) |

Get a string representing the system's package data directory ("share").

## get_pkg_path()

UHD_API std::string uhd::get_pkg_path | ( | void |  | ) |

Get a string representing the system's pkg directory.

## get_process_hash()

uint32_t uhd::get_process_hash | ( |  | ) |

## get_process_id()

int32_t uhd::get_process_id | ( |  | ) |

## get_tmp_path()

UHD_API std::string uhd::get_tmp_path | ( | void |  | ) |

Get a string representing the system's temporary directory.

## has()

template<typename Range, typename T>

UHD_INLINE bool uhd::has | ( | const Range & | range,
|  | const T & | value )

Is the value found within the elements in this range?

Uses std::find to search the iterable for an element.

Parameters

  range | the elements to search through
  value | the match to look for in the range

Returns
  true when the value is found in the range

## htonx() [1/2]

template<typename T>

UHD_INLINE T uhd::htonx | ( | T | num | ) |

host to network: short, long, or long-long

## htonx() [2/2]

template<typename T>

T uhd::htonx | ( | T | num | ) |

host to network: short, long, or long-long

## htowx() [1/2]

template<typename T>

UHD_INLINE T uhd::htowx | ( | T | num | ) |

host to worknet: short, long, or long-long

## htowx() [2/2]

template<typename T>

T uhd::htowx | ( | T | num | ) |

host to worknet: short, long, or long-long

## likely()

UHD_INLINE bool uhd::likely | ( | bool | expr | ) |

hint for the branch prediction

## ntohx() [1/2]

template<typename T>

UHD_INLINE T uhd::ntohx | ( | T | num | ) |

network to host: short, long, or long-long

## ntohx() [2/2]

template<typename T>

T uhd::ntohx | ( | T | num | ) |

network to host: short, long, or long-long

## operator/() [1/2]

UHD_API fs_path uhd::operator/ | ( | const fs_path & | ,
|  | const fs_path & | )

## operator/() [2/2]

UHD_API fs_path uhd::operator/ | ( | const fs_path & | ,
|  | size_t | )

## operator<()

UHD_API bool uhd::operator< | ( | const time_spec_t & | ,
|  | const time_spec_t & | )

Implement less_than_comparable interface.

## operator<<()

UHD_API_HEADER std::ostream & uhd::operator<< | ( | std::ostream & | os,
|  | filter_info_base & | f )

## operator==()

UHD_API bool uhd::operator== | ( | const time_spec_t & | ,
|  | const time_spec_t & | )

Implement equality_comparable interface.

## print_utility_error()

UHD_API std::string uhd::print_utility_error | ( | const std::string & | name,
|  | const std::string & | args = "" )

Return an error string recommending the user run the utility. The error string will include the full path to the utility to run.

Returns
  the message suggesting the use of the named utility.

## reversed()

template<typename Range>

UHD_INLINE Range uhd::reversed | ( | const Range & | range | ) |

A wrapper around std::reverse that takes a range instead of an iterator.

The elements are reversed into descending order using the less-than operator. This wrapper reverses the elements non-destructively into a new range. Based on the builtin python function reversed(...)

Parameters

  range | the range of elements to be reversed

Returns
  a new range with the elements reversed

## separate_device_addr()

UHD_API device_addrs_t uhd::separate_device_addr | ( | const device_addr_t & | dev_addr | ) |

Separate an indexed device address into a vector of device addresses.

## set_thread_affinity()

UHD_API void uhd::set_thread_affinity | ( | const std::vector< size_t > & | cpu_affinity_list | ) |

Set the affinity of the current thread to a (set of) CPU(s).

Parameters

  cpu_affinity_list | list of CPU numbers to affinitize the thread to

## set_thread_name() [1/2]

UHD_API void uhd::set_thread_name | ( | boost::thread * | thread,
|  | const std::string & | name )

Set the thread name on the given boost thread.

Parameters

  thread | pointer to a boost thread
  name | thread name with maximum length of 16 characters

## set_thread_name() [2/2]

UHD_API void uhd::set_thread_name | ( | std::thread * | thread,
|  | const std::string & | name )

Set the thread name on the given std thread.

Parameters

  thread | pointer to a boost thread
  name | thread name with maximum length of 16 characters

## set_thread_priority()

UHD_API void uhd::set_thread_priority | ( | float | priority = DEFAULT_THREAD_PRIORITY,
|  | bool | realtime = true )

Set the scheduling priority on the current thread.

To enable realtime scheduling on a new thread, call this function with the default values. Warning: realtime scheduling can cause UHD worker threads to not share resources such as network interfaces fairly, potentially causing it to malfunction.

A priority of zero corresponds to normal priority. Positive priority values are higher than normal. Negative priority values are lower than normal.

Parameters

  priority | a value between -1 and 1
  realtime | true to use realtime mode

Exceptions

  exception | on set priority failure

## set_thread_priority_safe()

UHD_API bool uhd::set_thread_priority_safe | ( | float | priority = DEFAULT_THREAD_PRIORITY,
|  | bool | realtime = true )

Set the scheduling priority on the current thread. Same as set_thread_priority but does not throw on failure.

Returns
  true on success, false on failure

## sorted()

template<typename Range>

UHD_INLINE Range uhd::sorted | ( | const Range & | range | ) |

A wrapper around std::sort that takes a range instead of an iterator.

The elements are sorted into ascending order using the less-than operator. This wrapper sorts the elements non-destructively into a new range. Based on the builtin python function sorted(...)

Parameters

  range | the range of elements to be sorted

Returns
  a new range with the elements sorted

## string_to_bytes()

UHD_API byte_vector_t uhd::string_to_bytes | ( | const std::string & | str,
|  | size_t | max_length )

Create a byte vector from a string, end at null terminator or max length.

## unlikely()

UHD_INLINE bool uhd::unlikely | ( | bool | expr | ) |

hint for the branch prediction

## wtohx() [1/2]

template<typename T>

UHD_INLINE T uhd::wtohx | ( | T | num | ) |

worknet to host: short, long, or long-long

## wtohx() [2/2]

template<typename T>

T uhd::wtohx | ( | T | num | ) |

worknet to host: short, long, or long-long

## Variable Documentation

## DEFAULT_THREAD_PRIORITY

float uhd::DEFAULT_THREAD_PRIORITY = float(0.5)

constexpr