fcd: restore support for FUNcube Dongle and Pro+

Support for the original FUNcube Dongle used to live in GNU Radio's
gr-fcd module, which was removed in version 3.8. As a result, gr-osmosdr
lost support for both FUNcube Dongle and FUNcube Dongle Pro+.

The gr-fcdproplus out-of-tree module subsequently added support for the
original FUNcube Dongle, meaning that it now supports both types. As a
result, FUNcube support can easily be restored in gr-osmosdr. The
now.

Signed-off-by: Eric Wild <ewild@sysmocom.de>

XXX
This commit is contained in:
Clayton Smith 2020-05-31 03:43:18 +00:00 committed by Eric Wild
parent 52fcb0935f
commit 800d2eaeaf
6 changed files with 43 additions and 46 deletions

View File

@ -175,6 +175,7 @@ find_package(LibHackRF)
find_package(LibAIRSPY)
find_package(LibAIRSPYHF)
find_package(LibbladeRF)
find_package(GnuradioFCDPP)
find_package(SoapySDR NO_MODULE)
find_package(LibFreeSRP)
find_package(Doxygen)

View File

@ -0,0 +1,27 @@
if(NOT GNURADIO_FCDPP_FOUND)
pkg_check_modules (GNURADIO_FCDPP_PKG libgnuradio-fcdproplus)
find_path(GNURADIO_FCDPP_INCLUDE_DIRS NAMES fcdproplus/api.h
PATHS
${GNURADIO_FCDPP_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
)
find_library(GNURADIO_FCDPP_LIBRARIES NAMES gnuradio-fcdproplus
PATHS
${GNURADIO_FCDPP_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)
if(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES)
set(GNURADIO_FCDPP_FOUND TRUE CACHE INTERNAL "gnuradio-fcdproplus found")
message(STATUS "Found gnuradio-fcdproplus: ${GNURADIO_FCDPP_INCLUDE_DIRS}, ${GNURADIO_FCDPP_LIBRARIES}")
else(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES)
set(GNURADIO_FCDPP_FOUND FALSE CACHE INTERNAL "gnuradio-fcdproplus found")
message(STATUS "gnuradio-fcdproplus not found.")
endif(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES)
mark_as_advanced(GNURADIO_FCDPP_LIBRARIES GNURADIO_FCDPP_INCLUDE_DIRS)
endif(NOT GNURADIO_FCDPP_FOUND)

View File

@ -135,6 +135,14 @@ if(ENABLE_OSMOSDR)
add_subdirectory(osmosdr)
endif(ENABLE_OSMOSDR)
########################################################################
# Setup FCD component
########################################################################
GR_REGISTER_COMPONENT("FUNcube Dongle" ENABLE_FCD GNURADIO_FCDPP_FOUND)
if(ENABLE_FCD)
add_subdirectory(fcd)
endif(ENABLE_FCD)
########################################################################
# Setup File component
########################################################################

View File

@ -23,26 +23,12 @@
target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${GNURADIO_FCDPP_INCLUDE_DIRS}
)
if(ENABLE_FCD)
target_include_directories(gnuradio-osmosdr PRIVATE
${Gnuradio-fcd_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
${Gnuradio-fcd_LIBRARIES}
)
endif(ENABLE_FCD)
if(ENABLE_FCDPP)
target_include_directories(gnuradio-osmosdr PRIVATE
${Gnuradio-fcdpp_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
${Gnuradio-fcdpp_LIBRARIES}
)
endif(ENABLE_FCDPP)
list(APPEND gr_osmosdr_libs
${GNURADIO_FCDPP_LIBRARIES}
)
list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/fcd_source_c.cc

View File

@ -142,18 +142,15 @@ fcd_source_c::fcd_source_c(const std::string &args) :
std::cerr << "Using " << name() << " (" << dev_name << ")" << std::endl;
#ifdef HAVE_FCD
if ( FUNCUBE_V1 == _type )
{
_src_v1 = gr::fcd::source_c::make( dev_name );
_src_v1 = gr::fcdproplus::fcd::make( dev_name );
connect( _src_v1, 0, self(), 0 );
set_gain( 20, "LNA" );
set_gain( 12, "MIX" );
}
#endif
#ifdef HAVE_FCDPP
if ( FUNCUBE_V2 == _type )
{
_src_v2 = gr::fcdproplus::fcdproplus::make( dev_name );
@ -163,7 +160,6 @@ fcd_source_c::fcd_source_c(const std::string &args) :
set_gain( 1, "MIX" );
set_gain( 15, "BB" );
}
#endif
}
fcd_source_c::~fcd_source_c()
@ -241,15 +237,11 @@ osmosdr::freq_range_t fcd_source_c::get_freq_range( size_t chan )
double fcd_source_c::set_center_freq( double freq, size_t chan )
{
#ifdef HAVE_FCD
if ( FUNCUBE_V1 == _type )
_src_v1->set_freq( float(freq) );
#endif
#ifdef HAVE_FCDPP
if ( FUNCUBE_V2 == _type )
_src_v2->set_freq( float(freq) );
#endif
_freq = freq;
@ -263,15 +255,11 @@ double fcd_source_c::get_center_freq( size_t chan )
double fcd_source_c::set_freq_corr( double ppm, size_t chan )
{
#ifdef HAVE_FCD
if ( FUNCUBE_V1 == _type )
_src_v1->set_freq_corr( ppm );
#endif
#ifdef HAVE_FCDPP
if ( FUNCUBE_V2 == _type )
_src_v2->set_freq_corr( ppm );
#endif
_correct = ppm;
@ -343,7 +331,6 @@ double fcd_source_c::set_gain( double gain, size_t chan )
double fcd_source_c::set_gain( double gain, const std::string & name, size_t chan )
{
#ifdef HAVE_FCD
if ( FUNCUBE_V1 == _type )
{
if ( "LNA" == name )
@ -357,9 +344,7 @@ double fcd_source_c::set_gain( double gain, const std::string & name, size_t cha
_src_v1->set_mixer_gain(_mix_gain);
}
}
#endif
#ifdef HAVE_FCDPP
if ( FUNCUBE_V2 == _type )
{
if ( "LNA" == name )
@ -378,7 +363,6 @@ double fcd_source_c::set_gain( double gain, const std::string & name, size_t cha
_src_v2->set_if_gain(_bb_gain);
}
}
#endif
return get_gain( name, chan );
}

View File

@ -22,13 +22,8 @@
#include <gnuradio/hier_block2.h>
#ifdef HAVE_FCD
#include <gnuradio/fcd/source_c.h>
#endif
#ifdef HAVE_FCDPP
#include <fcdproplus/fcd.h>
#include <fcdproplus/fcdproplus.h>
#endif
#include "source_iface.h"
@ -86,12 +81,8 @@ public:
private:
dongle_type _type;
#ifdef HAVE_FCD
gr::fcd::source_c::sptr _src_v1;
#endif
#ifdef HAVE_FCDPP
gr::fcdproplus::fcd::sptr _src_v1;
gr::fcdproplus::fcdproplus::sptr _src_v2;
#endif
double _lna_gain, _mix_gain, _bb_gain, _freq;
int _correct;
};