mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Move general_work to the bottom of the file
This commit is contained in:
parent
31e634635c
commit
c01d8d0dd9
@ -158,41 +158,6 @@ rtl_tcp_signal_source_c::~rtl_tcp_signal_source_c()
|
||||
}
|
||||
|
||||
|
||||
int rtl_tcp_signal_source_c::work(int noutput_items,
|
||||
gr_vector_const_void_star & /*input_items*/,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
|
||||
int i = 0;
|
||||
if (io_service_.stopped())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(mutex_);
|
||||
not_empty_.wait(lock, boost::bind(&rtl_tcp_signal_source_c::not_empty,
|
||||
this));
|
||||
|
||||
for (; i < noutput_items && unread_ > 1; i++)
|
||||
{
|
||||
float re = buffer_[--unread_];
|
||||
float im = buffer_[--unread_];
|
||||
if (flip_iq_)
|
||||
{
|
||||
out[i] = gr_complex(im, re);
|
||||
}
|
||||
else
|
||||
{
|
||||
out[i] = gr_complex(re, im);
|
||||
}
|
||||
}
|
||||
}
|
||||
not_full_.notify_one();
|
||||
return i == 0 ? -1 : i;
|
||||
}
|
||||
|
||||
|
||||
void rtl_tcp_signal_source_c::set_frequency(int frequency)
|
||||
{
|
||||
boost::system::error_code ec =
|
||||
@ -359,3 +324,38 @@ void rtl_tcp_signal_source_c::handle_read(const boost::system::error_code &ec,
|
||||
this, _1, _2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int rtl_tcp_signal_source_c::work(int noutput_items,
|
||||
gr_vector_const_void_star & /*input_items*/,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
|
||||
int i = 0;
|
||||
if (io_service_.stopped())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(mutex_);
|
||||
not_empty_.wait(lock, boost::bind(&rtl_tcp_signal_source_c::not_empty,
|
||||
this));
|
||||
|
||||
for (; i < noutput_items && unread_ > 1; i++)
|
||||
{
|
||||
float re = buffer_[--unread_];
|
||||
float im = buffer_[--unread_];
|
||||
if (flip_iq_)
|
||||
{
|
||||
out[i] = gr_complex(im, re);
|
||||
}
|
||||
else
|
||||
{
|
||||
out[i] = gr_complex(re, im);
|
||||
}
|
||||
}
|
||||
}
|
||||
not_full_.notify_one();
|
||||
return i == 0 ? -1 : i;
|
||||
}
|
||||
|
@ -57,6 +57,21 @@ unpack_spir_gss6450_samples::~unpack_spir_gss6450_samples()
|
||||
}
|
||||
|
||||
|
||||
int unpack_spir_gss6450_samples::compute_two_complement(unsigned long data)
|
||||
{
|
||||
int res = 0;
|
||||
if (static_cast<int>(data) < two_compl_thres)
|
||||
{
|
||||
res = static_cast<int>(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = static_cast<int>(data) - adc_bits_two_pow;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int unpack_spir_gss6450_samples::work(int noutput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items)
|
||||
{
|
||||
@ -86,17 +101,3 @@ int unpack_spir_gss6450_samples::work(int noutput_items,
|
||||
}
|
||||
return noutput_items;
|
||||
}
|
||||
|
||||
int unpack_spir_gss6450_samples::compute_two_complement(unsigned long data)
|
||||
{
|
||||
int res = 0;
|
||||
if (static_cast<int>(data) < two_compl_thres)
|
||||
{
|
||||
res = static_cast<int>(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = static_cast<int>(data) - adc_bits_two_pow;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user