cores: Use NSDMI consistently in ?x_dsp_core_3000.*

There are edge cases where the lack of initialization of _current_freq
could crash libuhd. To resolve this, we initialize all elements of those
cores to sensible values using NSDMI.
This commit is contained in:
Martin Braun 2019-05-20 18:37:42 -07:00 committed by michael-west
parent 1ea6160a84
commit 6393e921d6
2 changed files with 16 additions and 23 deletions

View File

@ -52,14 +52,6 @@ public:
rx_dsp_core_3000_impl(wb_iface::sptr iface, const size_t dsp_base, const bool is_b200)
: _iface(iface), _dsp_base(dsp_base), _is_b200(is_b200)
{
// previously uninitialized - assuming zero for all
_link_rate = _host_extra_scaling = _fxpt_scalar_correction = 0.0;
// init to something so update method has reasonable defaults
_scaling_adjustment = 1.0;
_dsp_extra_scaling = 1.0;
_tick_rate = 1.0;
_dsp_freq_offset = 0.0;
}
~rx_dsp_core_3000_impl(void)
@ -321,11 +313,15 @@ private:
wb_iface::sptr _iface;
const size_t _dsp_base;
const bool _is_b200; // TODO: Obsolete this when we switch to the new DDC on the B200
double _tick_rate, _link_rate;
double _scaling_adjustment, _dsp_extra_scaling, _host_extra_scaling,
_fxpt_scalar_correction;
double _dsp_freq_offset;
double _current_freq;
double _dsp_freq_offset = 0.0;
double _tick_rate = 1.0;
double _link_rate = 0.0;
double _scaling_adjustment = 1.0;
double _dsp_extra_scaling = 1.0;
double _host_extra_scaling = 0.0;
double _fxpt_scalar_correction = 0.0;
double _current_freq = 0.0;
};
rx_dsp_core_3000::sptr rx_dsp_core_3000::make(

View File

@ -43,12 +43,6 @@ public:
tx_dsp_core_3000_impl(wb_iface::sptr iface, const size_t dsp_base)
: _iface(iface), _dsp_base(dsp_base)
{
// previously uninitialized - assuming zero for all
_link_rate = _host_extra_scaling = _fxpt_scalar_correction = 0.0;
// init to something so update method has reasonable defaults
_scaling_adjustment = 1.0;
_dsp_extra_scaling = 1.0;
this->set_tick_rate(1.0);
}
@ -205,10 +199,13 @@ public:
private:
wb_iface::sptr _iface;
const size_t _dsp_base;
double _tick_rate, _link_rate;
double _scaling_adjustment, _dsp_extra_scaling, _host_extra_scaling,
_fxpt_scalar_correction;
double _current_freq;
double _tick_rate = 1.0;
double _link_rate = 0.0;
double _scaling_adjustment = 1.0;
double _dsp_extra_scaling = 1.0;
double _host_extra_scaling = 0.0;
double _fxpt_scalar_correction = 0.0;
double _current_freq = 0.0;
};
tx_dsp_core_3000::sptr tx_dsp_core_3000::make(wb_iface::sptr iface, const size_t dsp_base)