UHD defines a set of portable, clock-domain-agnostic types used throughout the API for specifying frequencies, times, address strings, sensor readings, and value ranges. Understanding these types is essential for writing correct tuning, timing, and configuration code.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/EttusResearch/uhd/llms.txt
Use this file to discover all available pages before exploring further.
tune_request_t
tune_request_t instructs the driver how to tune the full RF chain. It separates control of the hardware LO (RF frequency) from the DSP NCO (DSP frequency), allowing precise placement of the signal relative to the LO — for example, to move the LO offset and eliminate DC bias at the center of the spectrum.
Constructors
Frequency Policies
The driver places the LO and DSP offset automatically. For
rf_freq_policy = AUTO, the RF LO is placed at target_freq + default_LO_offset. For dsp_freq_policy = AUTO, the DSP offset makes up the difference.Use the explicitly provided
rf_freq or dsp_freq value. Set rf_freq_policy = POLICY_MANUAL and assign rf_freq to pin the LO to a specific frequency.Do not change this element of the chain. Useful for updating only the DSP offset without moving the hardware LO.
DSP Frequency Sign Convention
The relationship between the three frequencies is:sign = +1 for RX and sign = -1 for TX. Setting rf_freq = 1 GHz and dsp_freq = 10 MHz gives a target of 1010 MHz for RX and 990 MHz for TX.
Usage Examples
time_spec_t
time_spec_t represents a point in time as a 64-bit integer seconds part plus a double-precision fractional seconds part. It provides sub-nanosecond precision without accumulated floating-point error over long intervals.
Constructors
Constructs from a real-valued seconds count. Convenient but may lose precision for absolute times beyond a few tens of years.
Constructs from an integer seconds part and a fractional seconds part
[0.0, 1.0). Preferred for absolute timestamps where precision matters.Constructs from a tick count within a given second, at the specified clock rate. Useful when working in clock-domain units.
Static Factory
Accessors
| Method | Return Type | Description |
|---|---|---|
get_full_secs() | int64_t | Whole seconds (epoch seconds) |
get_frac_secs() | double | Fractional seconds [0.0, 1.0) |
get_real_secs() | double | Combined as a single double (may lose precision) |
get_tick_count(rate) | long | Fractional part converted to clock ticks |
to_ticks(rate) | long long | Full time as a 64-bit tick count |
Arithmetic
time_spec_t supports +, -, +=, -= with other time_spec_t objects or double values, and comparison operators ==, !=, <, <=, >, >=.
device_addr_t
device_addr_t is a key/value string map used to specify device addresses, transport options, and miscellaneous arguments throughout the UHD API.
Common Device Address Keys
| Key | Example | Description |
|---|---|---|
"addr" | "192.168.10.2" | IP address for Ethernet-connected devices |
"type" | "b200", "x300" | Device type filter |
"serial" | "30C419A" | Target a specific serial number |
"addr0", "addr1" | "192.168.10.2" | Multi-device MIMO addresses |
"recv_buff_size" | "50e6" | Receive socket buffer size in bytes |
"send_buff_size" | "50e6" | Transmit socket buffer size in bytes |
"master_clock_rate" | "200e6" | Override master clock rate |
sensor_value_t
sensor_value_t holds a named hardware measurement with a value string, unit, and data type.
Human-readable sensor name, e.g.,
"lo_locked", "ref_locked", "temp".Sensor value as a string. For booleans:
"true" or "false". For numeric types: formatted by the sensor’s format string.Unit string. For booleans, contains the appropriate label (
"unlocked" / "locked"). For reals, e.g., "C" or "dBm".One of
BOOLEAN, INTEGER, REALNUM, or STRING.meta_range_t and range_t
range_t describes a continuous numeric interval with optional step resolution. meta_range_t is a collection of range_t objects that together represent all valid values for a parameter.
clip()
value to the nearest valid point within the range. When clip_step = true, also snaps to the nearest step boundary.
Summary Table
| Type | Header | Primary Use |
|---|---|---|
tune_request_t | uhd/types/tune_request.hpp | Specify LO and DSP tuning policy |
time_spec_t | uhd/types/time_spec.hpp | Absolute and relative timestamps |
device_addr_t | uhd/types/device_addr.hpp | Device discovery and transport options |
sensor_value_t | uhd/types/sensors.hpp | Hardware sensor readings |
meta_range_t / range_t | uhd/types/ranges.hpp | Valid value ranges for RF parameters |
gain_range_t | uhd/types/ranges.hpp | Alias for meta_range_t, used for gain |
freq_range_t | uhd/types/ranges.hpp | Alias for meta_range_t, used for frequency |
