host: hbx: Improve log IDs

This improves the logging IDs of files related to HBX. It adds the radio
as prefix to the logging ID to make it easier to recognize which
component wrote a log message as we typically have (at least) two in a
UHD session. Improved behavior for ADMV1320, ADMV1420, LTC5594
(demodulator) and for the TX and RX LOs.
This commit is contained in:
Martin Anderseck 2026-03-30 13:16:15 +02:00 committed by mkoop-ni
parent 999b4862a9
commit 3293d06bc4
19 changed files with 127 additions and 74 deletions

View File

@ -37,7 +37,9 @@ public:
//
// \param write SPI write function object
// \param read SPI read function object
static sptr make(write_fn_t&& poke16, read_fn_t&& peek16);
// \param unique_id Unique ID string for logging purposes
static sptr make(
write_fn_t&& poke16, read_fn_t&& peek16, const std::string& unique_id);
//! Save state to chip
virtual void commit() = 0;

View File

@ -40,7 +40,9 @@ public:
//
// \param write SPI write function object
// \param read SPI read function object
static sptr make(write_fn_t&& poke16, read_fn_t&& peek16);
// \param unique_id Unique ID string for logging purposes
static sptr make(
write_fn_t&& poke16, read_fn_t&& peek16, const std::string& unique_id);
//! Save state to chip
virtual void commit() = 0;

View File

@ -41,7 +41,11 @@ public:
// \param write SPI write function object
// \param read SPI read function object
// \param sleep sleep function object
static sptr make(write_fn_t&& poke16, read_fn_t&& peek16, sleep_fn_t&& sleep);
// \param log_id Log identifier
static sptr make(write_fn_t&& poke16,
read_fn_t&& peek16,
sleep_fn_t&& sleep,
const std::string& log_id = "");
//! Save state to chip
virtual void commit() = 0;

View File

@ -28,7 +28,9 @@ public:
//
// \param write SPI write function object
// \param read SPI read function object
static sptr make(write_fn_t&& poke16, read_fn_t&& peek16);
// \param unique_id Unique identifier for logging purposes
static sptr make(
write_fn_t&& poke16, read_fn_t&& peek16, const std::string& unique_id);
//! Save state to chip
virtual void commit() = 0;

View File

@ -21,7 +21,7 @@ public:
hbx_cpld_ctrl::poke_fn_type&& poke_fn,
hbx_cpld_ctrl::peek_fn_type&& peek_fn,
hbx_cpld_ctrl::mixer_callback_t&& init_cb,
const std::string& log_id);
const std::string& unique_id);
// Set the RF band to be used.
void set_rf_band(const uint8_t band);

View File

@ -21,7 +21,7 @@ public:
hbx_cpld_ctrl::poke_fn_type&& poke_fn,
hbx_cpld_ctrl::peek_fn_type&& peek_fn,
hbx_cpld_ctrl::mixer_callback_t&& init_cb,
const std::string& log_id);
const std::string& unique_id);
//! The bands according to the HBX frequency plan
enum class hbx_band_t { BAND_0, BAND_1, BAND_2 };

View File

@ -16,7 +16,8 @@ public:
// Pass in our demod selection and poke/peek functions
hbx_demod_ctrl(size_t start_address,
hbx_cpld_ctrl::poke_fn_type&& poke_fn,
hbx_cpld_ctrl::peek_fn_type&& peek_fn);
hbx_cpld_ctrl::peek_fn_type&& peek_fn,
const std::string& unique_id);
/*! Sets the LO frequency
*
@ -26,7 +27,7 @@ public:
void set_lo_matching(const double lo_freq);
private:
const std::string _log_id = "HBX_DEMOD";
const std::string _log_id;
ltc5594_iface::sptr _ltc;
};
}}} // namespace uhd::usrp::hbx

View File

@ -21,6 +21,7 @@ public:
// Pass in our lo selection and poke/peek functions
hbx_lo_ctrl(direction_t trx,
const std::string& unique_id,
size_t start_address,
hbx_cpld_ctrl::poke_fn_type&& poke_fn,
hbx_cpld_ctrl::peek_fn_type&& peek_fn,

View File

@ -15,8 +15,12 @@ constexpr char LOG_ID[] = "ADMV1320";
class admv1320_impl : public admv1320_iface
{
public:
explicit admv1320_impl(write_fn_t&& poke_fn, read_fn_t&& peek_fn)
: _poke16(std::move(poke_fn)), _peek16(std::move(peek_fn)), _regs()
explicit admv1320_impl(
write_fn_t&& poke_fn, read_fn_t&& peek_fn, const std::string& unique_id)
: _poke16(std::move(poke_fn))
, _peek16(std::move(peek_fn))
, _regs()
, _log_id(unique_id + "::" + LOG_ID)
{
_regs.save_state();
// Create a clean state
@ -34,18 +38,18 @@ public:
const uint8_t random_value = static_cast<uint8_t>(time(NULL));
_poke16(_regs.get_addr("SCRATCH_PAD"), random_value);
UHD_ASSERT_THROW(_peek16(_regs.get_addr("SCRATCH_PAD")) == random_value);
UHD_LOG_DEBUG(LOG_ID, "Initialized TX mixer ADMV1320.");
UHD_LOG_DEBUG(_log_id, "Initialized TX mixer ADMV1320.");
}
void commit() override
{
UHD_LOG_TRACE(LOG_ID, "Storing register cache to ADMV1320...");
UHD_LOG_TRACE(_log_id, "Storing register cache to ADMV1320...");
const auto changed_addrs = _regs.get_changed_addrs<size_t>();
for (const auto addr : changed_addrs) {
_poke16(addr, _regs.get_reg(addr));
}
_regs.save_state();
UHD_LOG_TRACE(LOG_ID,
UHD_LOG_TRACE(_log_id,
"Storing cache complete: Updated " << changed_addrs.size() << " registers.");
}
@ -178,10 +182,13 @@ private:
write_fn_t _poke16;
read_fn_t _peek16;
admv1320_regs_t _regs = admv1320_regs_t();
const std::string _log_id;
};
admv1320_iface::sptr admv1320_iface::make(
admv1320_iface::write_fn_t&& poke_fn, admv1320_iface::read_fn_t&& peek_fn)
admv1320_iface::sptr admv1320_iface::make(admv1320_iface::write_fn_t&& poke_fn,
admv1320_iface::read_fn_t&& peek_fn,
const std::string& unique_id)
{
return std::make_unique<admv1320_impl>(std::move(poke_fn), std::move(peek_fn));
return std::make_unique<admv1320_impl>(
std::move(poke_fn), std::move(peek_fn), unique_id);
}

View File

@ -14,8 +14,12 @@ constexpr char LOG_ID[] = "ADMV1420";
class admv1420_impl : public admv1420_iface
{
public:
explicit admv1420_impl(write_fn_t&& poke_fn, read_fn_t&& peek_fn)
: _poke16(std::move(poke_fn)), _peek16(std::move(peek_fn)), _regs()
explicit admv1420_impl(
write_fn_t&& poke_fn, read_fn_t&& peek_fn, const std::string& unique_id)
: _poke16(std::move(poke_fn))
, _peek16(std::move(peek_fn))
, _regs()
, _log_id(unique_id + "::" + LOG_ID)
{
_regs.save_state();
// Create a clean state
@ -28,18 +32,18 @@ public:
const uint8_t random_value = static_cast<uint8_t>(time(NULL));
_poke16(_regs.get_addr("SCRATCH_PAD"), random_value);
UHD_ASSERT_THROW(_peek16(_regs.get_addr("SCRATCH_PAD")) == random_value);
UHD_LOG_DEBUG(LOG_ID, "Initialized RX mixer ADMV1420.");
UHD_LOG_DEBUG(_log_id, "Initialized RX mixer ADMV1420.");
}
void commit() override
{
UHD_LOG_TRACE(LOG_ID, "Storing register cache to ADMV1420...");
UHD_LOG_TRACE(_log_id, "Storing register cache to ADMV1420...");
const auto changed_addrs = _regs.get_changed_addrs<size_t>();
for (const auto addr : changed_addrs) {
_poke16(addr, _regs.get_reg(addr));
}
_regs.save_state();
UHD_LOG_TRACE(LOG_ID,
UHD_LOG_TRACE(_log_id,
"Storing cache complete: Updated " << changed_addrs.size() << " registers.");
}
@ -244,10 +248,13 @@ private:
write_fn_t _poke16;
read_fn_t _peek16;
admv1420_regs_t _regs = admv1420_regs_t();
const std::string _log_id;
};
admv1420_iface::sptr admv1420_iface::make(
admv1420_iface::write_fn_t&& poke_fn, admv1420_iface::read_fn_t&& peek_fn)
admv1420_iface::sptr admv1420_iface::make(admv1420_iface::write_fn_t&& poke_fn,
admv1420_iface::read_fn_t&& peek_fn,
const std::string& unique_id)
{
return std::make_unique<admv1420_impl>(std::move(poke_fn), std::move(peek_fn));
return std::make_unique<admv1420_impl>(
std::move(poke_fn), std::move(peek_fn), unique_id);
}

View File

@ -49,19 +49,22 @@ class lmx2572_impl : public lmx2572_iface
public:
enum class muxout_state_t { LOCKDETECT, SDO };
explicit lmx2572_impl(
write_fn_t&& poke_fn, read_fn_t&& peek_fn, sleep_fn_t&& sleep_fn)
explicit lmx2572_impl(write_fn_t&& poke_fn,
read_fn_t&& peek_fn,
sleep_fn_t&& sleep_fn,
const std::string& unique_id = "")
: _poke16(std::move(poke_fn))
, _peek16(std::move(peek_fn))
, _sleep(std::move(sleep_fn))
, _regs()
, _log_id(unique_id.empty() ? LOG_ID : unique_id + "::" + LOG_ID)
{
_regs.save_state();
}
void commit() override
{
UHD_LOG_TRACE(LOG_ID, "Storing register cache to LMX2572...");
UHD_LOG_TRACE(_log_id, "Storing register cache to LMX2572...");
const auto changed_addrs = _regs.get_changed_addrs<uint8_t>();
for (const auto addr : changed_addrs) {
// We write R0 last, for double-buffering
@ -72,7 +75,7 @@ public:
}
_poke16(0, _regs.get_reg(0));
_regs.save_state();
UHD_LOG_TRACE(LOG_ID,
UHD_LOG_TRACE(_log_id,
"Storing cache complete: Updated " << changed_addrs.size() << " registers.");
}
@ -116,12 +119,12 @@ public:
// magic constant:
const auto magic125 = _peek16(125);
if (magic125 != 0x2288) {
UHD_LOG_ERROR(LOG_ID,
UHD_LOG_ERROR(_log_id,
"Unable to communicate with LMX2572! Expected R125==0x2288, got: "
<< std::hex << magic125 << std::dec);
throw uhd::runtime_error("Unable to communicate to LMX2572!");
}
UHD_LOG_TRACE(LOG_ID, "Communication with LMX2572 successful.");
UHD_LOG_TRACE(_log_id, "Communication with LMX2572 successful.");
// Now set _regs into a sensible state
_set_defaults();
// Now write the regs in reverse order, skipping RO regs
@ -248,7 +251,7 @@ public:
{
// Sanity check
if (target_freq > MAX_OUT_FREQ || target_freq < MIN_OUT_FREQ) {
UHD_LOG_ERROR(LOG_ID,
UHD_LOG_ERROR(_log_id,
"Invalid LMX2572 target frequency! Must be in ["
<< (MIN_OUT_FREQ / 1e6) << " MHz, " << (MAX_OUT_FREQ / 1e6)
<< " MHz]!");
@ -318,7 +321,7 @@ public:
UHD_ASSERT_THROW(3200e6 <= fVCO_actual && fVCO_actual <= 6400e6);
const double actual_freq = fVCO_actual / out_D;
// clang-format off
UHD_LOG_TRACE(LOG_ID,
UHD_LOG_TRACE(_log_id,
"Calculating settings for fTARGET=" << (target_freq / 1e6)
<< " MHz, fOSC=" << (fOSC / 1e6)
<< " MHz: Target fVCO=" << (fVCO / 1e6)
@ -376,7 +379,8 @@ private:
read_fn_t _peek16;
sleep_fn_t _sleep;
lmx2572_regs_t _regs = lmx2572_regs_t();
bool _sync_mode = false;
const std::string _log_id;
bool _sync_mode = false;
/**************************************************************************
* Private Methods
@ -692,25 +696,25 @@ private:
// datasheet.
switch (cat) {
case CAT1A:
UHD_LOG_TRACE(LOG_ID, "Sync Category: 1A");
UHD_LOG_TRACE(_log_id, "Sync Category: 1A");
// Nothing required in this mode, input and output are always
// at a deterministic phase relationship.
break;
case CAT1B:
UHD_LOG_TRACE(LOG_ID, "Sync Category: 1B");
UHD_LOG_TRACE(_log_id, "Sync Category: 1B");
// Set VCO_PHASE_SYNC_EN = 1
_regs.vco_phase_sync_en = lmx2572_regs_t::vco_phase_sync_en_t::
VCO_PHASE_SYNC_EN_PHASE_SYNC_MODE;
P = 2;
break;
case CAT2:
UHD_LOG_TRACE(LOG_ID, "Sync Category: 2");
UHD_LOG_TRACE(_log_id, "Sync Category: 2");
// Note: We assume the existence and usage of the SYNC pin here.
// This means there are no more steps required (Steps 3-6 are
// skipped).
break;
case CAT3:
UHD_LOG_TRACE(LOG_ID, "Sync Category: 3");
UHD_LOG_TRACE(_log_id, "Sync Category: 3");
// In this category, we assume that the SYNC signal will be
// applied afterwards, and that timing requirements are met.
if (_regs.outa_mux == lmx2572_regs_t::outa_mux_t::OUTA_MUX_CHANNEL_DIVIDER
@ -722,8 +726,8 @@ private:
VCO_PHASE_SYNC_EN_PHASE_SYNC_MODE;
break;
case CAT4:
UHD_LOG_TRACE(LOG_ID, "Sync Category: 4");
UHD_LOG_WARNING(LOG_ID,
UHD_LOG_TRACE(_log_id, "Sync Category: 4");
UHD_LOG_WARNING(_log_id,
"PLL programming does not allow reliable phase synchronization!");
break;
case NONE:
@ -983,8 +987,9 @@ private:
lmx2572_iface::sptr lmx2572_iface::make(lmx2572_iface::write_fn_t&& poke_fn,
lmx2572_iface::read_fn_t&& peek_fn,
lmx2572_iface::sleep_fn_t&& sleep_fn)
lmx2572_iface::sleep_fn_t&& sleep_fn,
const std::string& log_id)
{
return std::make_shared<lmx2572_impl>(
std::move(poke_fn), std::move(peek_fn), std::move(sleep_fn));
std::move(poke_fn), std::move(peek_fn), std::move(sleep_fn), log_id);
}

View File

@ -26,8 +26,12 @@ constexpr double MAX_IQ_GAIN_ERR_ADJ = 0.475; // dB
class ltc5594_impl : public ltc5594_iface
{
public:
explicit ltc5594_impl(write_fn_t&& poke_fn, read_fn_t&& peek_fn)
: _poke16(std::move(poke_fn)), _peek16(std::move(peek_fn)), _regs()
explicit ltc5594_impl(
write_fn_t&& poke_fn, read_fn_t&& peek_fn, const std::string& unique_id)
: _poke16(std::move(poke_fn))
, _peek16(std::move(peek_fn))
, _regs()
, _log_id(unique_id + "::" + LOG_ID)
{
_regs = ltc5594_regs_t();
_regs.save_state();
@ -39,18 +43,18 @@ public:
UHD_ASSERT_THROW(_regs.HD2IX == random_value);
// We know that we can talk, now create a clean state
reset();
UHD_LOG_DEBUG(LOG_ID, "Initialized IQ demodulator LTC5594.");
UHD_LOG_DEBUG(_log_id, "Initialized IQ demodulator LTC5594.");
}
void commit() override
{
UHD_LOG_TRACE(LOG_ID, "Storing register cache to LTC5594...");
UHD_LOG_TRACE(_log_id, "Storing register cache to LTC5594...");
const auto changed_addrs = _regs.get_changed_addrs<uint8_t>();
for (const auto addr : changed_addrs) {
_poke16(addr, _regs.get_reg(addr));
}
_regs.save_state();
UHD_LOG_TRACE(LOG_ID,
UHD_LOG_TRACE(_log_id,
"Storing cache complete: Updated " << changed_addrs.size() << " registers.");
}
@ -63,7 +67,7 @@ public:
void reset() override
{
UHD_LOG_TRACE(LOG_ID, "Resetting LTC5594...");
UHD_LOG_TRACE(_log_id, "Resetting LTC5594...");
_regs = ltc5594_regs_t();
_regs.save_state();
_regs.SRST = 1;
@ -81,7 +85,7 @@ public:
_regs.CF1 = settings.cf1;
_regs.LF1 = settings.lf1;
_regs.CF2 = settings.cf2;
UHD_LOG_TRACE(LOG_ID,
UHD_LOG_TRACE(_log_id,
"Setting LO matching for frequency "
<< lo_freq / 1e6 << " MHz: "
<< "BAND=" << settings.band << ", CF1=" << settings.cf1
@ -91,7 +95,7 @@ public:
void enable_sdo_readback(const bool enable) override
{
UHD_LOG_TRACE(LOG_ID, (enable ? "Enabling" : "Disabling") << " SDO readback...");
UHD_LOG_TRACE(_log_id, (enable ? "Enabling" : "Disabling") << " SDO readback...");
_regs.SDO_MODE = enable ? 1 : 0;
commit();
}
@ -101,7 +105,7 @@ public:
// The datasheet is not completely clear on how to set the phase error adjustment
// value, so we are making some assumptions here based on the default value and
// the resolution of the register.
UHD_LOG_TRACE(LOG_ID,
UHD_LOG_TRACE(_log_id,
"Setting phase error adjustment to " << phase_error_adj << " degrees...");
UHD_ASSERT_THROW(phase_error_adj >= MIN_PHASE_ADJ);
UHD_ASSERT_THROW(phase_error_adj <= MAX_PHASE_ADJ);
@ -115,7 +119,7 @@ public:
void set_dc_offset_adj(const double dc_off_i_adj, const double dc_off_q_adj) override
{
UHD_LOG_TRACE(LOG_ID,
UHD_LOG_TRACE(_log_id,
"Setting the dc offset adjustment values to " << dc_off_i_adj << " and "
<< dc_off_q_adj << " mV.");
UHD_ASSERT_THROW(dc_off_i_adj >= MIN_DC_OFFSET_ADJ);
@ -133,7 +137,7 @@ public:
void set_gain_err_adj(const double gain_err_adj) override
{
UHD_LOG_TRACE(LOG_ID,
UHD_LOG_TRACE(_log_id,
"Setting the gain error adjustment value to " << gain_err_adj << " dB.");
UHD_ASSERT_THROW(gain_err_adj >= MIN_IQ_GAIN_ERR_ADJ);
UHD_ASSERT_THROW(gain_err_adj <= MAX_IQ_GAIN_ERR_ADJ);
@ -151,6 +155,7 @@ private:
write_fn_t _poke16;
read_fn_t _peek16;
ltc5594_regs_t _regs = ltc5594_regs_t();
const std::string _log_id;
/*********************************************
* Private Methods
@ -177,8 +182,10 @@ private:
}
};
ltc5594_iface::sptr ltc5594_iface::make(
ltc5594_iface::write_fn_t&& poke_fn, ltc5594_iface::read_fn_t&& peek_fn)
ltc5594_iface::sptr ltc5594_iface::make(ltc5594_iface::write_fn_t&& poke_fn,
ltc5594_iface::read_fn_t&& peek_fn,
const std::string& unique_id)
{
return std::make_shared<ltc5594_impl>(std::move(poke_fn), std::move(peek_fn));
return std::make_shared<ltc5594_impl>(
std::move(poke_fn), std::move(peek_fn), unique_id);
}

View File

@ -14,11 +14,11 @@ hbx_admv1320_ctrl::hbx_admv1320_ctrl(size_t start_address,
hbx_cpld_ctrl::poke_fn_type&& poke_fn,
hbx_cpld_ctrl::peek_fn_type&& peek_fn,
hbx_cpld_ctrl::mixer_callback_t&& init_cb,
const std::string& log_id)
const std::string& unique_id)
: hbx_cpld_ctrl::spi_transactor(
start_address, std::move(poke_fn), std::move(peek_fn), true)
, _init_cb(std::move(init_cb))
, _log_id(log_id)
, _log_id(unique_id + "::HBX_ADMV1320")
{
// Prepare in the callback to the CPLD regs
_init_cb(hbx_cpld_ctrl::INIT);
@ -26,7 +26,8 @@ hbx_admv1320_ctrl::hbx_admv1320_ctrl(size_t start_address,
// Create the ADMV object. This will set SDO active in its ctor
_admv = admv1320_iface::make(
[this](uint32_t addr, uint16_t data) { this->spi_write(addr, data); },
[this](uint32_t addr) -> uint16_t { return this->spi_read(addr); });
[this](uint32_t addr) -> uint16_t { return this->spi_read(addr); },
unique_id);
// Callback to CPLD for finalization.
_init_cb(hbx_cpld_ctrl::FINALIZE);

View File

@ -14,15 +14,16 @@ hbx_admv1420_ctrl::hbx_admv1420_ctrl(size_t start_address,
hbx_cpld_ctrl::poke_fn_type&& poke_fn,
hbx_cpld_ctrl::peek_fn_type&& peek_fn,
hbx_cpld_ctrl::mixer_callback_t&& init_cb,
const std::string& log_id)
const std::string& unique_id)
: hbx_cpld_ctrl::spi_transactor(
start_address, std::move(poke_fn), std::move(peek_fn), true)
, _init_cb(std::move(init_cb))
, _log_id(log_id)
, _log_id(unique_id + "::HBX_ADMV1420")
{
_admv = admv1420_iface::make(
[this](uint16_t addr, uint16_t data) { this->spi_write(addr, data); },
[this](uint16_t addr) -> uint16_t { return this->spi_read(addr); });
[this](uint16_t addr) -> uint16_t { return this->spi_read(addr); },
unique_id);
_init_cb(hbx_cpld_ctrl::init_t::INIT);
// SPI settings

View File

@ -64,7 +64,7 @@ void hbx_dboard_impl::_init_admv()
[this](const hbx_cpld_ctrl::init_t step) {
_cpld->mixer_init_callback(step, TX_DIRECTION);
},
_unique_id + "::ADMV1320");
_unique_id);
UHD_ASSERT_THROW(_admv1320);
RFNOC_LOG_TRACE("Initializing ADMV1420");
@ -83,13 +83,14 @@ void hbx_dboard_impl::_init_admv()
[this](const hbx_cpld_ctrl::init_t step) {
_cpld->mixer_init_callback(step, RX_DIRECTION);
},
_unique_id + "::ADMV1420");
_unique_id);
}
std::shared_ptr<hbx_lo_ctrl> hbx_dboard_impl::_init_lo_ctrl(const uhd::direction_t trx)
{
std::shared_ptr<hbx_lo_ctrl> lo_ctrl = std::make_shared<hbx_lo_ctrl>(
trx,
_unique_id,
trx == RX_DIRECTION ? _cpld->get_addr("RX_LO_SPI_INFO")
: _cpld->get_addr("TX_LO_SPI_INFO"),
[this](
@ -137,7 +138,8 @@ void hbx_dboard_impl::_init_demod()
[this](const uint32_t addr) {
// We don't do timed peeks, so no chan parameter here.
return _reg_iface.peek32(_reg_base_address + addr);
});
},
_unique_id);
}
void hbx_dboard_impl::_init_prop_tree()

View File

@ -12,13 +12,16 @@ namespace uhd { namespace usrp { namespace hbx {
hbx_demod_ctrl::hbx_demod_ctrl(size_t start_address,
hbx_cpld_ctrl::poke_fn_type&& poke_fn,
hbx_cpld_ctrl::peek_fn_type&& peek_fn)
hbx_cpld_ctrl::peek_fn_type&& peek_fn,
const std::string& unique_id)
: hbx_cpld_ctrl::spi_transactor(
start_address, std::move(poke_fn), std::move(peek_fn), true)
, _log_id(unique_id + "::HBX_DEMOD")
{
_ltc = ltc5594_iface::make(
[this](uint8_t addr, uint8_t data) { this->spi_write(addr, data); },
[this](uint8_t addr) -> uint8_t { return this->spi_read(addr); });
[this](uint8_t addr) -> uint8_t { return this->spi_read(addr); },
unique_id);
UHD_ASSERT_THROW(_ltc);
UHD_LOG_TRACE(_log_id, "Demodulator initialized...");

View File

@ -13,6 +13,7 @@
namespace uhd { namespace usrp { namespace hbx {
hbx_lo_ctrl::hbx_lo_ctrl(direction_t trx,
const std::string& unique_id,
size_t start_address,
hbx_cpld_ctrl::poke_fn_type&& poke_fn,
hbx_cpld_ctrl::peek_fn_type&& peek_fn,
@ -21,7 +22,7 @@ hbx_lo_ctrl::hbx_lo_ctrl(direction_t trx,
: hbx_cpld_ctrl::spi_transactor(
start_address, std::move(poke_fn), std::move(peek_fn), true)
, _time_accessor(std::move(time_accessor))
, _log_id(trx == RX_DIRECTION ? "RX_LO" : "TX_LO")
, _log_id(unique_id + "::" + (trx == RX_DIRECTION ? "RX_LO" : "TX_LO"))
, _lmx()
, _freq(LMX2572_DEFAULT_FREQ)
, _db_prc_rate(db_prc_rate)
@ -32,7 +33,8 @@ hbx_lo_ctrl::hbx_lo_ctrl(direction_t trx,
[](const uhd::time_spec_t& ts) {
std::this_thread::sleep_for(
std::chrono::milliseconds(static_cast<int>(ts.get_real_secs() * 1000)));
});
},
unique_id + "::" + (trx == RX_DIRECTION ? "RX" : "TX"));
UHD_ASSERT_THROW(_lmx);
UHD_LOG_TRACE(_log_id, "LO initialized...");
_lmx->reset();

View File

@ -60,7 +60,8 @@ BOOST_AUTO_TEST_CASE(admv1320_init_test)
auto mem = admv1320_mem{}; // Mock memory for the ADMV1320
auto admv1320 = admv1320_iface::make(
[&](const uint16_t addr, const uint16_t data) { mem.poke16(addr, data); },
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); });
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); },
"ADMV1320_TEST");
// Check against default register values
// In ADMV1320 we reset first (reg 0x0 = 0x81), but since those registers are latching
@ -80,7 +81,8 @@ BOOST_AUTO_TEST_CASE(admv1320_set_rf_band_test)
auto mem = admv1320_mem{}; // Mock memory for the ADMV1320
auto admv1320 = admv1320_iface::make(
[&](const uint16_t addr, const uint16_t data) { mem.poke16(addr, data); },
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); });
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); },
"ADMV1320_TEST");
admv1320->set_rf_band(admv1320_iface::rf_band_t::BAND_2);
admv1320->commit();
@ -109,7 +111,8 @@ BOOST_AUTO_TEST_CASE(admv1320_set_dsa_test)
auto mem = admv1320_mem{}; // Mock memory for the ADMV1320
auto admv1320 = admv1320_iface::make(
[&](const uint16_t addr, const uint16_t data) { mem.poke16(addr, data); },
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); });
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); },
"ADMV1320_TEST");
// Test setting DSA1 to a valid value
uint8_t result = admv1320->set_dsa(admv1320_iface::dsa_t::DSA1, 10);

View File

@ -60,7 +60,8 @@ BOOST_AUTO_TEST_CASE(admv1420_init_test)
auto mem = admv1420_mem{}; // Mock memory for the ADMV1420
auto admv1420 = admv1420_iface::make(
[&](const uint16_t addr, const uint16_t data) { mem.poke16(addr, data); },
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); });
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); },
"ADMV1420_TEST");
// In ADMV1420 we reset first (reg 0x0 = 0x81), but since those registers are latching
// in HW, we pull them down again in SW but don't actively write that to HW again.
@ -77,7 +78,8 @@ BOOST_AUTO_TEST_CASE(admv1420_set_rf_band_test)
auto mem = admv1420_mem{}; // Mock memory for the ADMV1420
auto admv1420 = admv1420_iface::make(
[&](const uint16_t addr, const uint16_t data) { mem.poke16(addr, data); },
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); });
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); },
"ADMV1420_TEST");
admv1420->set_rf_band(admv1420_iface::rf_band_t::BAND_2);
@ -107,7 +109,8 @@ BOOST_AUTO_TEST_CASE(admv1420_set_dsa_test)
auto mem = admv1420_mem{}; // Mock memory for the ADMV1420
auto admv1420 = admv1420_iface::make(
[&](const uint16_t addr, const uint16_t data) { mem.poke16(addr, data); },
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); });
[&](const uint16_t addr) -> uint16_t { return mem.peek16(addr); },
"ADMV1420_TEST");
// Test setting DSA1 to a valid value
uint8_t result = admv1420->set_dsa(admv1420_iface::dsa_t::DSA1, 10);