Changing name of rtlsdr_signal source by osmosdr_signal_source

This commit is contained in:
Carles Fernandez 2014-12-15 17:39:22 +01:00
parent a0f78d933a
commit d73095620b
9 changed files with 84 additions and 82 deletions

View File

@ -37,7 +37,7 @@ file(RELATIVE_PATH RELATIVE_CMAKE_CALL ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRE
option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF)
option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF)
option(ENABLE_RTLSDR "Enable the use of RTL dongles as signal source (experimental)" OFF)
option(ENABLE_OSMOSDR "Enable the use of OsmoSDR and compatible front-ends (RTL-based dongles, HackRF, etc.) as signal source (experimental)" OFF)
option(ENABLE_OPENCL "Enable building of processing blocks implemented with OpenCL (experimental)" OFF)
option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF)
option(ENABLE_GENERIC_ARCH "Builds a portable binary" OFF)
@ -971,20 +971,18 @@ endif(ENABLE_ARRAY)
if($ENV{RTLSDR_DRIVER})
message(STATUS "RTLSDR_DRIVER environment variable found." )
set(ENABLE_RTLSDR ON)
set(ENABLE_OSMOSDR ON)
endif($ENV{RTLSDR_DRIVER})
if(RAW_ARRAY_DRIVER)
set(ENABLE_RTLSDR ON)
set(ENABLE_OSMOSDR ON)
endif(RAW_ARRAY_DRIVER)
if(ENABLE_RTLSDR)
message(STATUS "The driver for RTL-based dongles will be compiled." )
message(STATUS "You can disable it with 'cmake -DENABLE_RTLSDR=OFF ../'" )
# find libosmosdr (done in src/algorithms/signal_sources/adapters)
# find gr-osmosdr (done in src/algorithms/signal_sources/adapters)
else(ENABLE_RTLSDR)
message(STATUS "The (optional) driver for RTL-based dongles is not enabled." )
message(STATUS "Enable it with 'cmake -DENABLE_RTLSDR=ON ../' to add support for Realtek's RTL2832U-based USB dongles." )
endif(ENABLE_RTLSDR)
if(ENABLE_OSMOSDR)
message(STATUS "The driver for OsmoSDR and other font-ends (HackRF, Realtek's RTL2832U-based dongles) will be compiled." )
message(STATUS "You can disable it with 'cmake -DENABLE_OSMOSDR=OFF ../'" )
else(ENABLE_OSMOSDR)
message(STATUS "The (optional) driver for OsmoSDR and related front-ends is not enabled." )
message(STATUS "Enable it with 'cmake -DENABLE_OSMOSDR=ON ../' to add support for OsmoSDR and other font-ends (HackRF, Realtek's RTL2832U-based USB dongles, etc.)" )
endif(ENABLE_OSMOSDR)
########################################################################

View File

@ -33,7 +33,7 @@ Before building GNSS-SDR, you need to install all the required dependencies. If
$ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time-dev \
libboost-system-dev libboost-filesystem-dev libboost-thread-dev \
libboost-serialization-dev libboost-program-options-dev libboost-test-dev \
liblog4cpp5-dev libuhd-dev gnuradio-dev libblas-dev liblapack-dev gfortran \
liblog4cpp5-dev libuhd-dev gnuradio-dev gr-osmosdr libblas-dev liblapack-dev gfortran \
libarmadillo-dev libgflags-dev libgoogle-glog-dev libssl-dev libgtest-dev
~~~~~~
@ -287,7 +287,7 @@ GNSS-SDR comes with a pre-compiled custom GN3S firmware available at gnss-sdr/fi
###### Build RTL-SDR support (OPTIONAL):
###### Build OSMOSDR support (OPTIONAL):
Install the [OsmoSDR](http://sdr.osmocom.org/trac/ "OsmoSDR's Homepage") library and GNU Radio's source block:
@ -313,15 +313,15 @@ $ sudo ldconfig
~~~~~~
Then configure GNSS-SDR to build the Rtlsdr_Signal_Source by:
Then, configure GNSS-SDR to build the Osmosdr_Signal_Source by:
~~~~~~
$ cmake -DENABLE_RTLSDR=ON ../
$ cmake -DENABLE_OSMOSDR=ON ../
$ make
$ sudo make install
~~~~~~
(in order to disable the Rtlsdr_Signal_Source compilation, you can pass -DENABLE_RTLSDR=OFF to cmake and build GNSS-SDR again).
(in order to disable the Osmosdr_Signal_Source compilation, you can pass -DENABLE_OSMOSDR=OFF to cmake and build GNSS-SDR again).
@ -346,7 +346,7 @@ $ make
$ sudo make install
~~~~~~
Using this option, all SIMD instructions are accessed via VOLK, which automatically includes versions of each function for different SIMD instruction sets, then detects at runtime which to use, or if there are none, substitutes a generic, non-SIMD implementation.
Using this option, all SIMD instructions are exclusively accessed via VOLK, which automatically includes versions of each function for different SIMD instruction sets, then detects at runtime which to use, or if there are none, substitutes a generic, non-SIMD implementation.

View File

@ -20,7 +20,7 @@
FIND_PATH(GROSMOSDR_INCLUDE_DIR
NAMES osmosdr/source_c.h
NAMES osmosdr/source.h
osmosdr/api.h
HINTS ${GrOsmoSDR_ROOT_DIR}/include
PATHS /usr/local/include

View File

@ -27,8 +27,8 @@ GNSS-SDR.SUPL_LAC=0x59e2
GNSS-SDR.SUPL_CI=0x31b0
;######### SIGNAL_SOURCE CONFIG ############
;#implementation: Use [File_Signal_Source] or [UHD_Signal_Source] or [GN3S_Signal_Source] [RTLSDR_Signal_Source]
SignalSource.implementation=Rtlsdr_Signal_Source
;#implementation: Use [File_Signal_Source] or [UHD_Signal_Source] or [GN3S_Signal_Source] [Osmosdr_Signal_Source]
SignalSource.implementation=Osmosdr_Signal_Source
;#filename: path to file with the captured GNSS signal samples to be processed
SignalSource.filename=/media/DATALOGGER_/signals/RTL-SDR/geo/pmt4.dat

View File

@ -83,23 +83,24 @@ if(ENABLE_ARRAY)
endif(ENABLE_ARRAY)
if(ENABLE_RTLSDR)
if(ENABLE_OSMOSDR)
################################################################################
# OsmoSDR - http://sdr.osmocom.org/trac/
################################################################################
find_package(GrOsmoSDR REQUIRED)
if(NOT GROSMOSDR_FOUND)
message(FATAL_ERROR "gr-osmosdr required to build gnss-sdr with the optional RTLSDR driver")
endif(NOT GROSMOSDR_FOUND)
# set RTL include dirs
set(RTL_DRIVER_INCLUDE_DIRS
if(NOT GROSMOSDR_FOUND)
message(FATAL_ERROR "gr-osmosdr required to build gnss-sdr with the optional OSMOSDR driver")
endif(NOT GROSMOSDR_FOUND)
# set OSMO include dirs
set(OSMO_DRIVER_INCLUDE_DIRS
${OPT_DRIVER_INCLUDE_DIRS}
${GROSMOSDR_INCLUDE_DIR}/osmosdr
)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} rtlsdr_signal_source.cc)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} osmosdr_signal_source.cc)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GROSMOSDR_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${RTL_DRIVER_INCLUDE_DIRS})
endif(ENABLE_RTLSDR)
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${OSMO_DRIVER_INCLUDE_DIRS})
endif(ENABLE_OSMOSDR)
if(ENABLE_UHD)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} uhd_signal_source.cc)

View File

@ -1,5 +1,5 @@
/*!
* \file rtlsdr_signal_source.cc
* \file osmosdr_signal_source.cc
* \brief Signal source for the Realtek RTL2832U USB dongle DVB-T receiver
* (see http://sdr.osmocom.org/trac/wiki/rtl-sdr for more information)
* \author Javier Arribas, 2012. jarribas(at)cttc.es
@ -29,7 +29,7 @@
* -------------------------------------------------------------------------
*/
#include "rtlsdr_signal_source.h"
#include "osmosdr_signal_source.h"
#include <iostream>
#include <boost/format.hpp>
#include <glog/logging.h>
@ -42,7 +42,7 @@
using google::LogMessage;
RtlsdrSignalSource::RtlsdrSignalSource(ConfigurationInterface* configuration,
OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, unsigned int out_stream,
boost::shared_ptr<gr::msg_queue> queue) :
role_(role), in_stream_(in_stream), out_stream_(out_stream),
@ -57,7 +57,7 @@ RtlsdrSignalSource::RtlsdrSignalSource(ConfigurationInterface* configuration,
dump_filename_ = configuration->property(role + ".dump_filename",
default_dump_file);
// RTLSDR Driver parameters
// OSMOSDR Driver parameters
AGC_enabled_ = configuration->property(role + ".AGC_enabled", true);
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
gain_ = configuration->property(role + ".gain", (double)40.0);
@ -76,7 +76,7 @@ RtlsdrSignalSource::RtlsdrSignalSource(ConfigurationInterface* configuration,
// 1. Make the driver instance
try
{
rtlsdr_source_ = osmosdr::source::make();
osmosdr_source_ = osmosdr::source::make();
}
catch( boost::exception & e )
{
@ -84,34 +84,34 @@ RtlsdrSignalSource::RtlsdrSignalSource(ConfigurationInterface* configuration,
}
// 2 set sampling rate
rtlsdr_source_->set_sample_rate(sample_rate_);
std::cout << boost::format("Actual RX Rate: %f [SPS]...") % (rtlsdr_source_->get_sample_rate()) << std::endl ;
LOG(INFO) << boost::format("Actual RX Rate: %f [SPS]...") % (rtlsdr_source_->get_sample_rate());
osmosdr_source_->set_sample_rate(sample_rate_);
std::cout << boost::format("Actual RX Rate: %f [SPS]...") % (osmosdr_source_->get_sample_rate()) << std::endl ;
LOG(INFO) << boost::format("Actual RX Rate: %f [SPS]...") % (osmosdr_source_->get_sample_rate());
// 3. set rx frequency
rtlsdr_source_->set_center_freq(freq_);
std::cout << boost::format("Actual RX Freq: %f [Hz]...") % (rtlsdr_source_->get_center_freq()) << std::endl ;
LOG(INFO) << boost::format("Actual RX Freq: %f [Hz]...") % (rtlsdr_source_->get_center_freq());
osmosdr_source_->set_center_freq(freq_);
std::cout << boost::format("Actual RX Freq: %f [Hz]...") % (osmosdr_source_->get_center_freq()) << std::endl ;
LOG(INFO) << boost::format("Actual RX Freq: %f [Hz]...") % (osmosdr_source_->get_center_freq());
// TODO: Assign the remnant IF from the PLL tune error
std::cout << boost::format("PLL Frequency tune error %f [Hz]...") % (rtlsdr_source_->get_center_freq() - freq_) ;
LOG(INFO) << boost::format("PLL Frequency tune error %f [Hz]...") % (rtlsdr_source_->get_center_freq() - freq_) ;
std::cout << boost::format("PLL Frequency tune error %f [Hz]...") % (osmosdr_source_->get_center_freq() - freq_) ;
LOG(INFO) << boost::format("PLL Frequency tune error %f [Hz]...") % (osmosdr_source_->get_center_freq() - freq_) ;
// 4. set rx gain
if (this->AGC_enabled_ == true)
{
rtlsdr_source_->set_gain_mode(true);
osmosdr_source_->set_gain_mode(true);
std::cout << "AGC enabled" << std::endl;
LOG(INFO) << "AGC enabled";
}
else
{
rtlsdr_source_->set_gain_mode(false);
rtlsdr_source_->set_gain(gain_, 0);
rtlsdr_source_->set_if_gain(rf_gain_, 0);
rtlsdr_source_->set_bb_gain(if_gain_, 0);
std::cout << boost::format("Actual RX Gain: %f dB...") % rtlsdr_source_->get_gain() << std::endl;
LOG(INFO) << boost::format("Actual RX Gain: %f dB...") % rtlsdr_source_->get_gain();
osmosdr_source_->set_gain_mode(false);
osmosdr_source_->set_gain(gain_, 0);
osmosdr_source_->set_if_gain(rf_gain_, 0);
osmosdr_source_->set_bb_gain(if_gain_, 0);
std::cout << boost::format("Actual RX Gain: %f dB...") % osmosdr_source_->get_gain() << std::endl;
LOG(INFO) << boost::format("Actual RX Gain: %f dB...") % osmosdr_source_->get_gain();
}
}
else
@ -137,17 +137,17 @@ RtlsdrSignalSource::RtlsdrSignalSource(ConfigurationInterface* configuration,
RtlsdrSignalSource::~RtlsdrSignalSource()
OsmosdrSignalSource::~OsmosdrSignalSource()
{}
void RtlsdrSignalSource::connect(gr::top_block_sptr top_block)
void OsmosdrSignalSource::connect(gr::top_block_sptr top_block)
{
if (samples_ != 0)
{
top_block->connect(rtlsdr_source_, 0, valve_, 0);
DLOG(INFO) << "connected rtlsdr source to valve";
top_block->connect(osmosdr_source_, 0, valve_, 0);
DLOG(INFO) << "connected osmosdr source to valve";
if (dump_)
{
top_block->connect(valve_, 0, file_sink_, 0);
@ -158,19 +158,19 @@ void RtlsdrSignalSource::connect(gr::top_block_sptr top_block)
{
if (dump_)
{
top_block->connect(rtlsdr_source_, 0, file_sink_, 0);
DLOG(INFO) << "connected rtlsdr source to file sink";
top_block->connect(osmosdr_source_, 0, file_sink_, 0);
DLOG(INFO) << "connected osmosdr source to file sink";
}
}
}
void RtlsdrSignalSource::disconnect(gr::top_block_sptr top_block)
void OsmosdrSignalSource::disconnect(gr::top_block_sptr top_block)
{
if (samples_ != 0)
{
top_block->disconnect(rtlsdr_source_, 0, valve_, 0);
top_block->disconnect(osmosdr_source_, 0, valve_, 0);
if (dump_)
{
top_block->disconnect(valve_, 0, file_sink_, 0);
@ -180,14 +180,14 @@ void RtlsdrSignalSource::disconnect(gr::top_block_sptr top_block)
{
if (dump_)
{
top_block->disconnect(rtlsdr_source_, 0, file_sink_, 0);
top_block->disconnect(osmosdr_source_, 0, file_sink_, 0);
}
}
}
gr::basic_block_sptr RtlsdrSignalSource::get_left_block()
gr::basic_block_sptr OsmosdrSignalSource::get_left_block()
{
LOG(WARNING) << "Trying to get signal source left block.";
return gr::basic_block_sptr();
@ -195,7 +195,7 @@ gr::basic_block_sptr RtlsdrSignalSource::get_left_block()
gr::basic_block_sptr RtlsdrSignalSource::get_right_block()
gr::basic_block_sptr OsmosdrSignalSource::get_right_block()
{
if (samples_ != 0)
{
@ -203,6 +203,6 @@ gr::basic_block_sptr RtlsdrSignalSource::get_right_block()
}
else
{
return rtlsdr_source_;
return osmosdr_source_;
}
}

View File

@ -1,6 +1,7 @@
/*!
* \file rtlsdr_signal_source.h
* \brief Signal source for the Realtek RTL2832U USB dongle DVB-T receiver
* \file osmosdr_signal_source.h
* \brief Signal source wrapper for OsmoSDR-compatible front-ends, such as
* HackRF or Realtek's RTL2832U-based USB dongle DVB-T receivers
* (see http://sdr.osmocom.org/trac/wiki/rtl-sdr for more information)
* \author Javier Arribas, 2012. jarribas(at)cttc.es
*
@ -29,8 +30,8 @@
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_RTLSDR_SIGNAL_SOURCE_H_
#define GNSS_SDR_RTLSDR_SIGNAL_SOURCE_H_
#ifndef GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H_
#define GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H_
#include <string>
#include <boost/shared_ptr.hpp>
@ -42,16 +43,18 @@
class ConfigurationInterface;
/*!
* \brief This class reads samples from Realtek RTL2832U USB dongle DVB-T receiver (see http://sdr.osmocom.org/trac/wiki/rtl-sdr)
* \brief This class reads samples OsmoSDR-compatible front-ends, such as
* HackRF or Realtek's RTL2832U-based USB dongle DVB-T receivers
* (see http://sdr.osmocom.org/trac/wiki/rtl-sdr)
*/
class RtlsdrSignalSource: public GNSSBlockInterface
class OsmosdrSignalSource: public GNSSBlockInterface
{
public:
RtlsdrSignalSource(ConfigurationInterface* configuration,
OsmosdrSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream,
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
virtual ~RtlsdrSignalSource();
virtual ~OsmosdrSignalSource();
std::string role()
{
@ -59,11 +62,11 @@ public:
}
/*!
* \brief Returns "Rtlsdr_Signal_Source"
* \brief Returns "Osmosdr_Signal_Source"
*/
std::string implementation()
{
return "Rtlsdr_Signal_Source";
return "Osmosdr_Signal_Source";
}
size_t item_size()
{
@ -96,11 +99,11 @@ private:
bool dump_;
std::string dump_filename_;
osmosdr::source::sptr rtlsdr_source_;
osmosdr::source::sptr osmosdr_source_;
boost::shared_ptr<gr::block> valve_;
gr::blocks::file_sink::sptr file_sink_;
boost::shared_ptr<gr::msg_queue> queue_;
};
#endif /*GNSS_SDR_RTLSDR_SIGNAL_SOURCE_H_*/
#endif /*GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H_*/

View File

@ -73,9 +73,9 @@ if(ENABLE_ARRAY)
add_definitions(-DRAW_ARRAY_DRIVER=1)
endif(ENABLE_ARRAY)
if(ENABLE_RTLSDR)
add_definitions(-DRTLSDR_DRIVER=1)
endif(ENABLE_RTLSDR)
if(ENABLE_OSMOSDR)
add_definitions(-DOSMOSDR_DRIVER=1)
endif(ENABLE_OSMOSDR)
if(ENABLE_UHD)
add_definitions(-DUHD_DRIVER=1)

View File

@ -100,8 +100,8 @@
#include "raw_array_signal_source.h"
#endif
#if RTLSDR_DRIVER
#include "rtlsdr_signal_source.h"
#if OSMOSDR_DRIVER
#include "osmosdr_signal_source.h"
#endif
#if UHD_DRIVER
@ -417,10 +417,10 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
}
#endif
#if RTLSDR_DRIVER
else if (implementation.compare("Rtlsdr_Signal_Source") == 0)
#if OSMOSDR_DRIVER
else if (implementation.compare("Osmosdr_Signal_Source") == 0)
{
std::unique_ptr<GNSSBlockInterface> block_(new RtlsdrSignalSource(configuration.get(), role, in_streams,
std::unique_ptr<GNSSBlockInterface> block_(new OsmosdrSignalSource(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}