lib: x400: Add fail-flag APIs to RFDC control

Two new APIs are added to x400_rfdc_control:
- get_nco_good(): Combines the reset and FAIL flags into a single "good"
  value
- get_nco_no_fail(): Provides information on the current status of the
  NCO reset FAIL flag
This commit is contained in:
Martin Braun 2026-06-19 14:56:17 +02:00 committed by Martin Braun
parent 5faa6888f1
commit 6cb25a298b
3 changed files with 28 additions and 1 deletions

View File

@ -77,6 +77,17 @@ public:
//! Return true if the NCO is out of reset
bool get_nco_reset_done();
//! Return true if the failure flag is NOT set and the NCO is out of reset
bool get_nco_good();
/*! Return true if the NCO fail flag is NOT set
*
* Note: The logic inversion is to stay consistent with the previous
* get_nco_*() methods; in all three cases we return 'true' if we have a
* positive status.
*/
bool get_nco_no_fail();
/*! \brief Set an NCO to a specific frequency.
*
* \param nco Which NCO to re-tune

View File

@ -629,7 +629,8 @@ void zbx_dboard_impl::_init_lo_prop_tree(uhd::property_tree::sptr subtree,
// The NCO gets a sub-node called 'reset'. It is read/write: Write will
// perform a reset, and read will return the reset status. The latter is
// also returned in the 'locked' sensor for the NCO, but the 'nco_locked'
// sensor node is read-only, and returns a sensor_value_t (not a bool).
// sensor node is read-only, and returns a sensor_value_t (not a bool), and
// it also includes the sync-fail flag (which this node does not).
// This node is primarily used for debugging, but can also serve as a manual
// reset line for the NCOs.
const auto nco = (trx == TX_DIRECTION)

View File

@ -75,6 +75,21 @@ bool rfdc_control::get_nco_reset_done()
return bool(_iface.peek32(regmap::NCO_RESET) & (1 << regmap::NCO_RESET_DONE_MSB));
}
bool rfdc_control::get_nco_good()
{
constexpr uint32_t flag_mask = (uint32_t(1) << regmap::NCO_RESET_DONE_MSB)
| (uint32_t(1) << regmap::NCO_SYNC_FAILED_MSB);
const uint32_t nco_flags = _iface.peek32(regmap::NCO_RESET) & flag_mask;
return nco_flags == (uint32_t(1) << regmap::NCO_RESET_DONE_MSB);
}
bool rfdc_control::get_nco_no_fail()
{
const uint32_t fail_flag = _iface.peek32(regmap::NCO_RESET)
& (uint32_t(1) << regmap::NCO_SYNC_FAILED_MSB);
return fail_flag == 0;
}
double rfdc_control::set_nco_freq(const rfdc_type, const double freq)
{
UHD_LOG_WARNING(_log_id, "set_nco_freq() called but not yet implemented!");