mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-27 21:47:39 +00:00
Added optional support for Sparkfun SiGe GN3S USB GPS RF sampler:
- Added a pre-compiled custom GN3S firmware. - Added a fully-compliant GNU Radio source block for GN3S USB dongle. It can be used also from GNU Radio companion and from Python applications. - Added a new GN3S_Signal_Source block. It is possible to disable the GN3S signal source compilation. See README. git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@217 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
125
src/algorithms/signal_source/adapters/gn3s_signal_source.cc
Normal file
125
src/algorithms/signal_source/adapters/gn3s_signal_source.cc
Normal file
@@ -0,0 +1,125 @@
|
||||
/*!
|
||||
* \file gn3s_signal_source.cc
|
||||
* \brief GN3S USB dongle GPS RF front-end signal sampler driver
|
||||
* \author Javier Arribas, jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "gn3s_signal_source.h"
|
||||
#include <gnuradio/gr_file_sink.h>
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
#include <gn3s/gn3s_source_cc.h>
|
||||
#include "configuration_interface.h"
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream, unsigned int out_stream, gr_msg_queue_sptr queue) :
|
||||
role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
||||
{
|
||||
|
||||
std::string default_item_type = "short";
|
||||
std::string default_dump_file = "./data/gn3s_source.dat";
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type",
|
||||
default_item_type);
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||
default_dump_file);
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
gn3s_source_ = gn3s_make_source_cc();
|
||||
DLOG(INFO) << "Item size " << item_size_;
|
||||
DLOG(INFO) << "gn3s_source(" << gn3s_source_->unique_id() << ")";
|
||||
|
||||
}
|
||||
// else if (item_type_.compare("short") == 0)
|
||||
// {
|
||||
// item_size_ = sizeof(short);
|
||||
// resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_,
|
||||
// sample_freq_out_);
|
||||
// }
|
||||
else
|
||||
{
|
||||
LOG_AT_LEVEL(WARNING) << item_type_
|
||||
<< " unrecognized item type for resampler";
|
||||
item_size_ = sizeof(short);
|
||||
}
|
||||
|
||||
if (dump_)
|
||||
{
|
||||
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
||||
file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
|
||||
}
|
||||
|
||||
|
||||
if (dump_)
|
||||
{
|
||||
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||
}
|
||||
}
|
||||
|
||||
Gn3sSignalSource::~Gn3sSignalSource()
|
||||
{
|
||||
}
|
||||
void Gn3sSignalSource::connect(gr_top_block_sptr top_block)
|
||||
{
|
||||
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(gn3s_source_, 0, file_sink_, 0);
|
||||
DLOG(INFO) << "connected gn3s_source to file sink";
|
||||
}
|
||||
else
|
||||
{
|
||||
DLOG(INFO) << "nothing to connect internally";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Gn3sSignalSource::disconnect(gr_top_block_sptr top_block)
|
||||
{
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(gn3s_source_, 0, file_sink_, 0);
|
||||
}
|
||||
}
|
||||
|
||||
gr_basic_block_sptr Gn3sSignalSource::get_left_block()
|
||||
{
|
||||
LOG_AT_LEVEL(WARNING)
|
||||
<< "Left block of a signal source should not be retrieved";
|
||||
return gr_block_sptr();
|
||||
}
|
||||
|
||||
gr_basic_block_sptr Gn3sSignalSource::get_right_block()
|
||||
{
|
||||
return gn3s_source_;
|
||||
}
|
||||
84
src/algorithms/signal_source/adapters/gn3s_signal_source.h
Normal file
84
src/algorithms/signal_source/adapters/gn3s_signal_source.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*!
|
||||
* \file gn3s_signal_source.h
|
||||
* \brief GN3S USB dongle GPS RF front-end signal sampler driver
|
||||
* \author Javier Arribas, jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GN3S_SIGNAL_SOURCE_H_
|
||||
#define GN3S_SIGNAL_SOURCE_H_
|
||||
|
||||
#include <gnuradio/gr_hier_block2.h>
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/gr_msg_queue.h>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
class Gn3sSignalSource: public GNSSBlockInterface
|
||||
{
|
||||
|
||||
public:
|
||||
Gn3sSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
unsigned int out_stream, gr_msg_queue_sptr queue);
|
||||
|
||||
virtual ~Gn3sSignalSource();
|
||||
|
||||
std::string role()
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "Gn3sSignalSource";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
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();
|
||||
|
||||
private:
|
||||
|
||||
std::string role_;
|
||||
unsigned int in_stream_;
|
||||
unsigned int out_stream_;
|
||||
std::string item_type_;
|
||||
size_t item_size_;
|
||||
long samples_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
gr_block_sptr gn3s_source_;
|
||||
gr_block_sptr file_sink_;
|
||||
gr_msg_queue_sptr queue_;
|
||||
};
|
||||
|
||||
#endif /*GN3S_SIGNAL_SOURCE_H_*/
|
||||
@@ -1,6 +1,13 @@
|
||||
project : build-dir ../../../../build ;
|
||||
|
||||
#ECHO Global: [ VARNAMES ] ;
|
||||
local GN3S_DRIVER = [ modules.peek : GN3S_DRIVER ] ;
|
||||
|
||||
obj file_signal_source : file_signal_source.cc ;
|
||||
obj uhd_signal_source : uhd_signal_source.cc ;
|
||||
|
||||
if ($(GN3S_DRIVER))
|
||||
{
|
||||
obj gn3s_signal_source : gn3s_signal_source.cc ;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user