1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-26 13:07:39 +00:00

Switch to GNU Radio 3.7.x API

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@368 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Javier Arribas
2013-07-04 13:47:40 +00:00
parent 1e242e3e61
commit 58b280afb6
206 changed files with 4239 additions and 4751 deletions

View File

@@ -16,6 +16,15 @@
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
#if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
#set(GNSS_SPLIBS_SOURCES
# galileo_e1_signal_processing.cc
# gnss_sdr_valve.cc
# gnss_signal_processing.cc
# gps_sdr_signal_processing.cc
# pass_through.cc
#)
#else(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(GNSS_SPLIBS_SOURCES
galileo_e1_signal_processing.cc
gnss_sdr_valve.cc
@@ -24,12 +33,17 @@ set(GNSS_SPLIBS_SOURCES
nco_lib.cc
pass_through.cc
)
#endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
include_directories(
$(CMAKE_CURRENT_SOURCE_DIR)
${CMAKE_SOURCE_DIR}/src/core/system_parameters
${CMAKE_SOURCE_DIR}/src/core/receiver
${CMAKE_SOURCE_DIR}/src/core/interfaces
${Boost_INCLUDE_DIRS}
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
)
add_library(gnss_sp_libs ${GNSS_SPLIBS_SOURCES})
add_library(gnss_sp_libs ${GNSS_SPLIBS_SOURCES})
target_link_libraries(gnss_sp_libs ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES})

View File

@@ -34,6 +34,7 @@
#include <complex>
#include <iostream>
#include <gnuradio/math.h>
#include "Galileo_E1.h"
#include "gnss_signal_processing.h"

View File

@@ -31,28 +31,28 @@
*/
#include "gnss_sdr_valve.h"
#include <gnuradio/gr_io_signature.h>
#include "control_message_factory.h"
#include <gnuradio/io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include "control_message_factory.h"
using google::LogMessage;
gnss_sdr_valve::gnss_sdr_valve (size_t sizeof_stream_item,
int nitems,
gr_msg_queue_sptr queue) : gr_sync_block ("valve",
gr_make_io_signature (1, 1, sizeof_stream_item),
gr_make_io_signature (1, 1, sizeof_stream_item)),
d_nitems (nitems), d_ncopied_items (0), d_queue(queue)
gr::msg_queue::sptr queue) : gr::sync_block("valve",
gr::io_signature::make(1, 1, sizeof_stream_item),
gr::io_signature::make(1, 1, sizeof_stream_item) ),
d_nitems(nitems), d_ncopied_items(0), d_queue(queue)
{}
gr_block_sptr gnss_sdr_make_valve (size_t sizeof_stream_item,
boost::shared_ptr<gr::block> gnss_sdr_make_valve (size_t sizeof_stream_item,
int nitems,
gr_msg_queue_sptr queue)
gr::msg_queue::sptr queue)
{
return gr_block_sptr (new gnss_sdr_valve (sizeof_stream_item, nitems, queue));
return boost::shared_ptr<gnss_sdr_valve> (new gnss_sdr_valve (sizeof_stream_item, nitems, queue));
}
@@ -72,7 +72,7 @@ int gnss_sdr_valve::work (int noutput_items,
unsigned n = std::min(d_nitems - d_ncopied_items, noutput_items);
if (n == 0)
return 0;
memcpy (output_items[0], input_items[0], n * input_signature()->sizeof_stream_item (0));
memcpy (output_items[0], input_items[0], n * input_signature()->sizeof_stream_item(0));
d_ncopied_items += n;
return n;
}

View File

@@ -34,30 +34,32 @@
#define GNSS_SDR_GNSS_SDR_VALVE_H_
#include <cstring>
#include <gr_sync_block.h>
#include <gr_msg_queue.h>
#include <gnuradio/sync_block.h>
#include <gnuradio/msg_queue.h>
#include <boost/shared_ptr.hpp>
gr_block_sptr gnss_sdr_make_valve (size_t sizeof_stream_item,
boost::shared_ptr<gr::block> gnss_sdr_make_valve (size_t sizeof_stream_item,
int nitems,
gr_msg_queue_sptr queue);
gr::msg_queue::sptr queue);
/*!
* \brief Implementation of a GNU Radio block that sends a STOP message to the
* control queue right after a specific number of samples have passed through it.
*/
class gnss_sdr_valve : public gr_sync_block
class gnss_sdr_valve : public gr::sync_block
{
friend gr_block_sptr gnss_sdr_make_valve(size_t sizeof_stream_item,
int nitems,
gr_msg_queue_sptr queue);
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
int nitems,
gr::msg_queue::sptr queue);
gnss_sdr_valve (size_t sizeof_stream_item,
int nitems,
gr_msg_queue_sptr queue);
int nitems,
gr::msg_queue::sptr queue);
int d_nitems;
int d_ncopied_items;
gr_msg_queue_sptr d_queue;
gr::msg_queue::sptr d_queue;
public:
int work (int noutput_items,
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};

View File

@@ -32,7 +32,7 @@
*/
#include "gnss_signal_processing.h"
#include <gr_fxpt.h> // fixed point sine and cosine
#include <gnuradio/fxpt.h> // fixed point sine and cosine
void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps)
@@ -44,7 +44,7 @@ void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs, unsigned
int phase_i = 0;
int phase_step_i;
float phase_step_f = (float)((GPS_TWO_PI * _f) / _fs);
phase_step_i = gr_fxpt::float_to_fixed(phase_step_f);
phase_step_i = gr::fxpt::float_to_fixed(phase_step_f);
float sin_f,cos_f;
for(unsigned int i = 0; i < _samps; i++)
@@ -53,7 +53,7 @@ void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs, unsigned
//_dest[i] = std::complex<float>(cos(phase), sin(phase));
//phase += phase_step;
//new Fixed Point NCO (faster)
gr_fxpt::sincos(phase_i,&sin_f,&cos_f);
gr::fxpt::sincos(phase_i,&sin_f,&cos_f);
_dest[i] = std::complex<float>(cos_f, sin_f);
phase_i += phase_step_i;
}
@@ -69,7 +69,7 @@ void complex_exp_gen_conj(std::complex<float>* _dest, double _f, double _fs, uns
int phase_i = 0;
int phase_step_i;
float phase_step_f = (float)((GPS_TWO_PI * _f) / _fs);
phase_step_i = gr_fxpt::float_to_fixed(phase_step_f);
phase_step_i = gr::fxpt::float_to_fixed(phase_step_f);
float sin_f,cos_f;
for(unsigned int i = 0; i < _samps; i++)
@@ -78,7 +78,7 @@ void complex_exp_gen_conj(std::complex<float>* _dest, double _f, double _fs, uns
//_dest[i] = std::complex<float>(cos(phase), sin(phase));
//phase += phase_step;
//new Fixed Point NCO (faster)
gr_fxpt::sincos(phase_i,&sin_f,&cos_f);
gr::fxpt::sincos(phase_i,&sin_f,&cos_f);
_dest[i] = std::complex<float>(cos_f, -sin_f);
phase_i += phase_step_i;
}

View File

@@ -31,7 +31,6 @@
*/
#include "gps_sdr_signal_processing.h"
#include <math.h>
#include <stdlib.h>
#include <cmath>

View File

@@ -36,123 +36,121 @@
typedef ALIGN16_BEG union {
float f[4];
int i[4];
v4sf v;
float f[4];
int i[4];
v4sf v;
} ALIGN16_END V4SF;
void sse_nco(std::complex<float> *dest, int n_samples,float start_phase_rad, float phase_step_rad)
void sse_nco(std::complex<float> *dest, int n_samples, float start_phase_rad, float phase_step_rad)
{
//SSE NCO
int sse_loops_four_op;
int remnant_ops;
sse_loops_four_op=(int)n_samples/4;
remnant_ops=n_samples%4;
sse_loops_four_op = (int)n_samples/4;
remnant_ops = n_samples%4;
V4SF vx, sin4, cos4;
float phase_rad;
phase_rad=start_phase_rad;
phase_rad = start_phase_rad;
int index=0;
for(int i=0;i<sse_loops_four_op;i++)
{
vx.f[0]=phase_rad;
phase_rad=phase_rad+phase_step_rad;
vx.f[1]=phase_rad;
phase_rad=phase_rad+phase_step_rad;
vx.f[2]=phase_rad;
phase_rad=phase_rad+phase_step_rad;
vx.f[3]=phase_rad;
phase_rad=phase_rad+phase_step_rad;
sincos_ps(vx.v, &sin4.v, &cos4.v);
dest[index] = std::complex<float>(cos4.f[0], -sin4.f[0]);
index++;
dest[index] = std::complex<float>(cos4.f[1], -sin4.f[1]);
index++;
dest[index] = std::complex<float>(cos4.f[2], -sin4.f[2]);
index++;
dest[index] = std::complex<float>(cos4.f[3], -sin4.f[3]);
index++;
}
for(int i=0;i<remnant_ops;i++)
{
vx.f[i]=phase_rad;
phase_rad=phase_rad+phase_step_rad;
}
int index = 0;
for(int i = 0;i<sse_loops_four_op;i++)
{
vx.f[0] = phase_rad;
phase_rad = phase_rad+phase_step_rad;
vx.f[1] = phase_rad;
phase_rad = phase_rad+phase_step_rad;
vx.f[2] = phase_rad;
phase_rad = phase_rad+phase_step_rad;
vx.f[3] = phase_rad;
phase_rad = phase_rad+phase_step_rad;
sincos_ps(vx.v, &sin4.v, &cos4.v);
dest[index] = std::complex<float>(cos4.f[0], -sin4.f[0]);
index++;
dest[index] = std::complex<float>(cos4.f[1], -sin4.f[1]);
index++;
dest[index] = std::complex<float>(cos4.f[2], -sin4.f[2]);
index++;
dest[index] = std::complex<float>(cos4.f[3], -sin4.f[3]);
index++;
}
for(int i = 0;i<remnant_ops;i++)
{
vx.f[i] = phase_rad;
phase_rad = phase_rad+phase_step_rad;
}
sincos_ps(vx.v, &sin4.v, &cos4.v);
for(int i=0;i<remnant_ops;i++)
{
dest[index] = std::complex<float>(cos4.f[i], -sin4.f[i]);
index++;
}
for(int i = 0;i<remnant_ops;i++)
{
dest[index] = std::complex<float>(cos4.f[i], -sin4.f[i]);
index++;
}
}
void fxp_nco(std::complex<float> *dest, int n_samples,float start_phase_rad, float phase_step_rad)
void fxp_nco(std::complex<float> *dest, int n_samples, float start_phase_rad, float phase_step_rad)
{
int phase_rad_i;
phase_rad_i=gr_fxpt::float_to_fixed(start_phase_rad);
int phase_step_rad_i;
phase_step_rad_i=gr_fxpt::float_to_fixed(phase_step_rad);
int phase_rad_i;
phase_rad_i = gr::fxpt::float_to_fixed(start_phase_rad);
int phase_step_rad_i;
phase_step_rad_i = gr::fxpt::float_to_fixed(phase_step_rad);
float sin_f,cos_f;
float sin_f,cos_f;
for(int i = 0; i < n_samples; i++)
{
//using temp variables
gr_fxpt::sincos(-phase_rad_i,&sin_f,&cos_f);
dest[i] = gr_complex(cos_f, sin_f);
phase_rad_i += phase_step_rad_i;
}
for(int i = 0; i < n_samples; i++)
{
//using temp variables
gr::fxpt::sincos(-phase_rad_i,&sin_f,&cos_f);
dest[i] = gr_complex(cos_f, sin_f);
phase_rad_i += phase_step_rad_i;
}
}
void fxp_nco_cpyref(std::complex<float> *dest, int n_samples,float start_phase_rad, float phase_step_rad)
void fxp_nco_cpyref(std::complex<float> *dest, int n_samples, float start_phase_rad, float phase_step_rad)
{
int phase_rad_i;
phase_rad_i=gr_fxpt::float_to_fixed(start_phase_rad);
int phase_step_rad_i;
phase_step_rad_i=gr_fxpt::float_to_fixed(phase_step_rad);
int phase_rad_i;
phase_rad_i = gr::fxpt::float_to_fixed(start_phase_rad);
int phase_step_rad_i;
phase_step_rad_i = gr::fxpt::float_to_fixed(phase_step_rad);
float* vector_cpx;
vector_cpx=(float*)dest;
for(int i = 0; i < n_samples; i++)
{
//using references (may be it can be a problem for c++11 standard
//gr_fxpt::sincos(phase_rad_i,&d_carr_sign[i].imag(),&d_carr_sign[i].real());
gr_fxpt::sincos(-phase_rad_i,&vector_cpx[i*2+1],&vector_cpx[i*2]);
phase_rad_i += phase_step_rad_i;
float* vector_cpx;
vector_cpx = (float*)dest;
for(int i = 0; i < n_samples; i++)
{
//using references (maybe it can be a problem for c++11 ?)
//gr_fxpt::sincos(phase_rad_i,&d_carr_sign[i].imag(),&d_carr_sign[i].real());
gr::fxpt::sincos(-phase_rad_i, &vector_cpx[i*2+1], &vector_cpx[i*2]);
phase_rad_i += phase_step_rad_i;
}
}
}
void fxp_nco_IQ_split(float* I, float* Q , int n_samples,float start_phase_rad, float phase_step_rad)
{
int phase_rad_i;
phase_rad_i=gr_fxpt::float_to_fixed(start_phase_rad);
int phase_step_rad_i;
phase_step_rad_i=gr_fxpt::float_to_fixed(phase_step_rad);
int phase_rad_i;
phase_rad_i = gr::fxpt::float_to_fixed(start_phase_rad);
int phase_step_rad_i;
phase_step_rad_i = gr::fxpt::float_to_fixed(phase_step_rad);
float sin_f,cos_f;
for(int i = 0; i < n_samples; i++)
{
gr_fxpt::sincos(-phase_rad_i,&sin_f,&cos_f);
I[i]=cos_f;
Q[i]=sin_f;
phase_rad_i += phase_step_rad_i;
float sin_f,cos_f;
for(int i = 0; i < n_samples; i++)
{
gr::fxpt::sincos(-phase_rad_i,&sin_f,&cos_f);
I[i] = cos_f;
Q[i] = sin_f;
phase_rad_i += phase_step_rad_i;
}
}
}
void std_nco(std::complex<float> *dest, int n_samples,float start_phase_rad, float phase_step_rad)
void std_nco(std::complex<float> *dest, int n_samples, float start_phase_rad, float phase_step_rad)
{
float phase_rad;
phase_rad=start_phase_rad;
float phase_rad;
phase_rad = start_phase_rad;
for(int i = 0; i < n_samples; i++)
{
// Using std::cos and std::sin
dest[i] = gr_complex(std::cos(phase_rad), -std::sin(phase_rad));
phase_rad=phase_rad+phase_step_rad;
}
for(int i = 0; i < n_samples; i++)
{
// Using std::cos and std::sin
dest[i] = gr_complex(std::cos(phase_rad), -std::sin(phase_rad));
phase_rad = phase_rad+phase_step_rad;
}
}

View File

@@ -37,7 +37,7 @@
#ifndef GNSS_SDR_NCO_LIB_CC_H_
#define GNSS_SDR_NCO_LIB_CC_H_
#include <gr_fxpt.h>
#include <gnuradio/fxpt.h>
#include <xmmintrin.h>
#include <sse_mathfun.h>
#include <cmath>

View File

@@ -33,7 +33,7 @@
#include "pass_through.h"
#include <iostream>
#include <gnuradio/gr_io_signature.h>
//#include <gnuradio/io_signature.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include "configuration_interface.h"
@@ -67,7 +67,7 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro
LOG_AT_LEVEL(WARNING) << item_type_ << " unrecognized item type. Using float";
item_size_ = sizeof(float);
}
kludge_copy_ = gr_make_kludge_copy(item_size_);
kludge_copy_ = gr::blocks::copy::make(item_size_);
DLOG(INFO) << "kludge_copy(" << kludge_copy_->unique_id() << ")";
}
@@ -78,28 +78,28 @@ Pass_Through::~Pass_Through()
void Pass_Through::connect(gr_top_block_sptr top_block)
void Pass_Through::connect(gr::top_block_sptr top_block)
{
DLOG(INFO) << "nothing to connect internally";
}
void Pass_Through::disconnect(gr_top_block_sptr top_block)
void Pass_Through::disconnect(gr::top_block_sptr top_block)
{
// Nothing to disconnect
}
gr_basic_block_sptr Pass_Through::get_left_block()
gr::basic_block_sptr Pass_Through::get_left_block()
{
return kludge_copy_;
}
gr_basic_block_sptr Pass_Through::get_right_block()
gr::basic_block_sptr Pass_Through::get_right_block()
{
return kludge_copy_;
}

View File

@@ -33,9 +33,11 @@
#ifndef GNSS_SDR_PASS_THROUGH_H_
#define GNSS_SDR_PASS_THROUGH_H_
#include <gr_hier_block2.h>
#include <gr_kludge_copy.h>
#include <gr_file_sink.h>
#include <gnuradio/hier_block2.h>
//#include <gr_kludge_copy.h>
#include <gnuradio/blocks/copy.h>
//#include <gr_file_sink.h>
//#include <gnuradio/blocks/file_sink.h>
#include "gnss_block_interface.h"
class ConfigurationInterface;
@@ -73,10 +75,10 @@ public:
{
return item_size_;
}
void connect(gr_top_block_sptr top_block);
void disconnect(gr_top_block_sptr top_block);
gr_basic_block_sptr get_left_block();
gr_basic_block_sptr get_right_block();
void connect(gr::top_block_sptr top_block);
void disconnect(gr::top_block_sptr top_block);
gr::basic_block_sptr get_left_block();
gr::basic_block_sptr get_right_block();
private:
std::string item_type_;
@@ -84,7 +86,8 @@ private:
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
gr_kludge_copy_sptr kludge_copy_;
//gr_kludge_copy_sptr kludge_copy_;
gr::blocks::copy::sptr kludge_copy_;
size_t item_size_;
};