mirror of
https://github.com/EttusResearch/uhd.git
synced 2026-10-25 17:36:10 +00:00
mpm: rfdc: Remove set_sample_rate() API call
This API call is superseded by configure_pll(), and now we match the RFDC API more closely.
This commit is contained in:
parent
0b65839d03
commit
62eb62c781
@ -99,9 +99,9 @@ public:
|
||||
CALIB_MODE2 = XRFDC_CALIB_MODE2
|
||||
};
|
||||
enum event_type_options {
|
||||
MIXER_EVENT = XRFDC_EVENT_MIXER,
|
||||
MIXER_EVENT = XRFDC_EVENT_MIXER,
|
||||
CRSE_DLY_EVENT = XRFDC_EVENT_CRSE_DLY,
|
||||
QMC_EVENT = XRFDC_EVENT_QMC,
|
||||
QMC_EVENT = XRFDC_EVENT_QMC,
|
||||
};
|
||||
enum interp_decim_options {
|
||||
INTERP_DECIM_OFF = XRFDC_INTERP_DECIM_OFF,
|
||||
@ -204,8 +204,8 @@ public:
|
||||
*
|
||||
* @return true if the operation was successful
|
||||
*/
|
||||
bool trigger_update_event(uint32_t tile_id, uint32_t block_id,
|
||||
bool is_dac, event_type_options event_type);
|
||||
bool trigger_update_event(
|
||||
uint32_t tile_id, uint32_t block_id, bool is_dac, event_type_options event_type);
|
||||
|
||||
/**
|
||||
* Enable/Disable gain correction for a given block.
|
||||
@ -424,18 +424,8 @@ public:
|
||||
bool enable_inverse_sinc_filter(uint32_t tile_id, uint32_t block_id, bool enable);
|
||||
|
||||
/**
|
||||
* Sets the sample rate for a given tile.
|
||||
*
|
||||
* @param tile_id the ID of the tile to set
|
||||
* @param is_dac whether the tile is a DAC (true) or ADC (false)
|
||||
* @param sample_rate the rate in Hz to sample at
|
||||
*
|
||||
* @return true if the operation was successful
|
||||
*/
|
||||
bool set_sample_rate(uint32_t tile_id, bool is_dac, double sample_rate);
|
||||
|
||||
/**
|
||||
* Gets the sample rate for a given block.
|
||||
* Gets the sample rate for a given block. To set the sample rate, call
|
||||
* configure_pll().
|
||||
*
|
||||
* @param tile_id the ID of the tile to set
|
||||
* @param block_id the ID of the block to set
|
||||
@ -692,13 +682,17 @@ public:
|
||||
*/
|
||||
bool get_cal_frozen(uint32_t tile_id, uint32_t block_id);
|
||||
|
||||
void set_adc_cal_coefficients(uint32_t tile_id, uint32_t block_id, uint32_t cal_block, std::vector<uint32_t> coefs);
|
||||
std::vector<uint32_t> get_adc_cal_coefficients(uint32_t tile_id, uint32_t block_id, uint32_t cal_block);
|
||||
void set_adc_cal_coefficients(uint32_t tile_id,
|
||||
uint32_t block_id,
|
||||
uint32_t cal_block,
|
||||
std::vector<uint32_t> coefs);
|
||||
std::vector<uint32_t> get_adc_cal_coefficients(
|
||||
uint32_t tile_id, uint32_t block_id, uint32_t cal_block);
|
||||
|
||||
/**
|
||||
* Resets an internal mixer with known valid settings.
|
||||
*/
|
||||
bool reset_mixer_settings( uint32_t tile_id, uint32_t block_id, bool is_dac);
|
||||
bool reset_mixer_settings(uint32_t tile_id, uint32_t block_id, bool is_dac);
|
||||
|
||||
private:
|
||||
/* Indicates whether libmetal was initialized successfully and can
|
||||
@ -753,7 +747,6 @@ void export_rfdc(py::module& top_module)
|
||||
.def("set_nyquist_zone", &rfdc_ctrl::set_nyquist_zone)
|
||||
.def("set_calibration_mode", &rfdc_ctrl::set_calibration_mode)
|
||||
.def("enable_inverse_sinc_filter", &rfdc_ctrl::enable_inverse_sinc_filter)
|
||||
.def("set_sample_rate", &rfdc_ctrl::set_sample_rate)
|
||||
.def("get_sample_rate", &rfdc_ctrl::get_sample_rate)
|
||||
.def("configure_pll", &rfdc_ctrl::configure_pll)
|
||||
.def("get_pll_config", &rfdc_ctrl::get_pll_config)
|
||||
|
||||
@ -138,9 +138,9 @@ bool rfdc_ctrl::reset_mixer_settings(uint32_t tile_id, uint32_t block_id, bool i
|
||||
mixer_settings.FineMixerScale = 0;
|
||||
mixer_settings.MixerType = XRFDC_MIXER_TYPE_FINE;
|
||||
|
||||
return (XRFdc_SetMixerSettings(
|
||||
rfdc_inst_ptr, is_dac, tile_id, block_id, &mixer_settings)
|
||||
== XRFDC_SUCCESS);
|
||||
return (
|
||||
XRFdc_SetMixerSettings(rfdc_inst_ptr, is_dac, tile_id, block_id, &mixer_settings)
|
||||
== XRFDC_SUCCESS);
|
||||
}
|
||||
|
||||
bool rfdc_ctrl::set_gain_enable(
|
||||
@ -159,7 +159,7 @@ bool rfdc_ctrl::set_gain_enable(
|
||||
qmc_settings.EventSource = XRFDC_EVNT_SRC_SYSREF;
|
||||
|
||||
return (XRFdc_SetQMCSettings(rfdc_inst_ptr, is_dac, tile_id, block_id, &qmc_settings)
|
||||
== XRFDC_SUCCESS);
|
||||
== XRFDC_SUCCESS);
|
||||
}
|
||||
|
||||
bool rfdc_ctrl::set_gain(uint32_t tile_id, uint32_t block_id, bool is_dac, double gain)
|
||||
@ -178,7 +178,7 @@ bool rfdc_ctrl::set_gain(uint32_t tile_id, uint32_t block_id, bool is_dac, doubl
|
||||
qmc_settings.EventSource = XRFDC_EVNT_SRC_SYSREF;
|
||||
|
||||
return (XRFdc_SetQMCSettings(rfdc_inst_ptr, is_dac, tile_id, block_id, &qmc_settings)
|
||||
== XRFDC_SUCCESS);
|
||||
== XRFDC_SUCCESS);
|
||||
}
|
||||
|
||||
bool rfdc_ctrl::set_threshold_settings(uint32_t tile_id,
|
||||
@ -362,8 +362,8 @@ bool rfdc_ctrl::reset_nco_phase(uint32_t tile_id, uint32_t block_id, bool is_dac
|
||||
return false;
|
||||
}
|
||||
|
||||
return (XRFdc_ResetNCOPhase(rfdc_inst_ptr, is_dac, tile_id, block_id)
|
||||
== XRFDC_SUCCESS);
|
||||
return (
|
||||
XRFdc_ResetNCOPhase(rfdc_inst_ptr, is_dac, tile_id, block_id) == XRFDC_SUCCESS);
|
||||
}
|
||||
|
||||
bool rfdc_ctrl::set_nco_freq(
|
||||
@ -387,7 +387,7 @@ bool rfdc_ctrl::set_nco_freq(
|
||||
return (XRFdc_SetMixerSettings(
|
||||
rfdc_inst_ptr, is_dac, tile_id, block_id, &mixer_settings)
|
||||
== XRFDC_SUCCESS)
|
||||
&& trigger_update_event(tile_id, block_id, is_dac, MIXER_EVENT);
|
||||
&& trigger_update_event(tile_id, block_id, is_dac, MIXER_EVENT);
|
||||
}
|
||||
|
||||
double rfdc_ctrl::get_nco_freq(uint32_t tile_id, uint32_t block_id, bool is_dac)
|
||||
@ -416,8 +416,9 @@ bool rfdc_ctrl::set_nco_event_src(uint32_t tile_id, uint32_t block_id, bool is_d
|
||||
mixer_settings.EventSource = XRFDC_EVNT_SRC_SYSREF;
|
||||
|
||||
// Set the mixer settings to set the NCO event source
|
||||
return (XRFdc_SetMixerSettings(rfdc_inst_ptr, is_dac, tile_id, block_id, &mixer_settings)
|
||||
== XRFDC_SUCCESS);
|
||||
return (
|
||||
XRFdc_SetMixerSettings(rfdc_inst_ptr, is_dac, tile_id, block_id, &mixer_settings)
|
||||
== XRFDC_SUCCESS);
|
||||
}
|
||||
|
||||
bool rfdc_ctrl::set_mixer_mode(
|
||||
@ -438,7 +439,7 @@ bool rfdc_ctrl::set_mixer_mode(
|
||||
return (XRFdc_SetMixerSettings(
|
||||
rfdc_inst_ptr, is_dac, tile_id, block_id, &mixer_settings)
|
||||
== XRFDC_SUCCESS)
|
||||
&& trigger_update_event(tile_id, block_id, is_dac, MIXER_EVENT);
|
||||
&& trigger_update_event(tile_id, block_id, is_dac, MIXER_EVENT);
|
||||
}
|
||||
|
||||
bool rfdc_ctrl::set_nyquist_zone(
|
||||
@ -461,19 +462,6 @@ bool rfdc_ctrl::enable_inverse_sinc_filter(
|
||||
return XRFdc_SetInvSincFIR(rfdc_inst_ptr, tile_id, block_id, enable) == XRFDC_SUCCESS;
|
||||
}
|
||||
|
||||
bool rfdc_ctrl::set_sample_rate(uint32_t tile_id, bool is_dac, double sample_rate)
|
||||
{
|
||||
// The XRFdc API expects the sample rate in MHz
|
||||
double sample_rate_mhz = sample_rate / 1e6;
|
||||
return XRFdc_DynamicPLLConfig(rfdc_inst_ptr,
|
||||
is_dac,
|
||||
tile_id,
|
||||
XRFDC_EXTERNAL_CLK,
|
||||
sample_rate_mhz,
|
||||
sample_rate_mhz)
|
||||
== XRFDC_SUCCESS;
|
||||
}
|
||||
|
||||
double rfdc_ctrl::get_sample_rate(uint32_t tile_id, uint32_t block_id, bool is_dac)
|
||||
{
|
||||
XRFdc_BlockStatus block_status;
|
||||
@ -737,11 +725,12 @@ bool rfdc_ctrl::get_cal_frozen(const uint32_t tile_id, const uint32_t block_id)
|
||||
return cal_freeze_settings.CalFrozen;
|
||||
}
|
||||
|
||||
void rfdc_ctrl::set_adc_cal_coefficients(uint32_t tile_id, uint32_t block_id, uint32_t cal_block, std::vector<uint32_t> coefs)
|
||||
void rfdc_ctrl::set_adc_cal_coefficients(
|
||||
uint32_t tile_id, uint32_t block_id, uint32_t cal_block, std::vector<uint32_t> coefs)
|
||||
{
|
||||
if (coefs.size() != 8)
|
||||
{
|
||||
throw mpm::runtime_error("set_adc_cal_coefficients requires that exactly 8 coefficients be passed");
|
||||
if (coefs.size() != 8) {
|
||||
throw mpm::runtime_error(
|
||||
"set_adc_cal_coefficients requires that exactly 8 coefficients be passed");
|
||||
}
|
||||
|
||||
XRFdc_Calibration_Coefficients cs;
|
||||
@ -754,16 +743,19 @@ void rfdc_ctrl::set_adc_cal_coefficients(uint32_t tile_id, uint32_t block_id, ui
|
||||
cs.Coeff6 = coefs[6];
|
||||
cs.Coeff7 = coefs[7];
|
||||
|
||||
if (XRFdc_SetCalCoefficients(&rfdc_inst, tile_id, block_id, cal_block, &cs) != XRFDC_SUCCESS) {
|
||||
if (XRFdc_SetCalCoefficients(&rfdc_inst, tile_id, block_id, cal_block, &cs)
|
||||
!= XRFDC_SUCCESS) {
|
||||
throw mpm::runtime_error("Error returned from XRFdc_SetCalCoefficients");
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint32_t> rfdc_ctrl::get_adc_cal_coefficients(uint32_t tile_id, uint32_t block_id, uint32_t cal_block)
|
||||
std::vector<uint32_t> rfdc_ctrl::get_adc_cal_coefficients(
|
||||
uint32_t tile_id, uint32_t block_id, uint32_t cal_block)
|
||||
{
|
||||
std::vector<uint32_t> result;
|
||||
XRFdc_Calibration_Coefficients cs;
|
||||
if (XRFdc_GetCalCoefficients(&rfdc_inst, tile_id, block_id, cal_block, &cs) != XRFDC_SUCCESS) {
|
||||
if (XRFdc_GetCalCoefficients(&rfdc_inst, tile_id, block_id, cal_block, &cs)
|
||||
!= XRFDC_SUCCESS) {
|
||||
throw mpm::runtime_error("Error returned from XRFdc_GetCalCoefficients");
|
||||
}
|
||||
|
||||
|
||||
@ -145,7 +145,12 @@ class X4xxRfdcCtrl:
|
||||
active_converters.add(active_converter_tuple)
|
||||
for tile, block, resampling_factor, is_dac in active_converters:
|
||||
self._rfdc_ctrl.reset_mixer_settings(tile, block, is_dac)
|
||||
self._rfdc_ctrl.set_sample_rate(tile, is_dac, self._get_spll_freq())
|
||||
self._rfdc_ctrl.configure_pll(
|
||||
tile,
|
||||
is_dac,
|
||||
0, # XRFDC_EXTERNAL_CLK == 0, means don't use RFDC PLL
|
||||
self._get_spll_freq(),
|
||||
self._get_spll_freq())
|
||||
self._set_interpolation_decimation(tile, block, is_dac, resampling_factor)
|
||||
|
||||
self._rfdc_regs.log_status()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user