diff options
| author | Martin Braun <martin.braun@ettus.com> | 2019-05-20 18:37:42 -0700 | 
|---|---|---|
| committer | michael-west <michael.west@ettus.com> | 2019-06-03 18:18:04 -0700 | 
| commit | 6393e921d6b75b2f77be7ff0c0762c605e76c9eb (patch) | |
| tree | 118739c73cd1cdb9a1a30c79d1f3a53b323e23fe /host/lib | |
| parent | 1ea6160a84659a8dd1f919afc2edfb6fe2d1b952 (diff) | |
| download | uhd-6393e921d6b75b2f77be7ff0c0762c605e76c9eb.tar.gz uhd-6393e921d6b75b2f77be7ff0c0762c605e76c9eb.tar.bz2 uhd-6393e921d6b75b2f77be7ff0c0762c605e76c9eb.zip | |
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.
Diffstat (limited to 'host/lib')
| -rw-r--r-- | host/lib/usrp/cores/rx_dsp_core_3000.cpp | 22 | ||||
| -rw-r--r-- | host/lib/usrp/cores/tx_dsp_core_3000.cpp | 17 | 
2 files changed, 16 insertions, 23 deletions
| diff --git a/host/lib/usrp/cores/rx_dsp_core_3000.cpp b/host/lib/usrp/cores/rx_dsp_core_3000.cpp index 191232541..46fce3f69 100644 --- a/host/lib/usrp/cores/rx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_3000.cpp @@ -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( diff --git a/host/lib/usrp/cores/tx_dsp_core_3000.cpp b/host/lib/usrp/cores/tx_dsp_core_3000.cpp index 029ca5c3d..be7593841 100644 --- a/host/lib/usrp/cores/tx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/tx_dsp_core_3000.cpp @@ -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) | 
