aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClayton Smith <argilo at gmail.com>2020-05-31 03:43:18 +0000
committerEric Wild <ewild@sysmocom.de>2020-08-03 01:20:52 +0200
commit800d2eaeaf840261471ba11ad4c920b1e6353d4a (patch)
tree6fe6d9a542d866c449cbe3616b4b95f51987ba98
parent52fcb0935f22f7abbbb582c9a757ac9b10ae95a4 (diff)
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
-rw-r--r--CMakeLists.txt1
-rw-r--r--cmake/Modules/FindGnuradioFCDPP.cmake27
-rw-r--r--lib/CMakeLists.txt8
-rw-r--r--lib/fcd/CMakeLists.txt22
-rw-r--r--lib/fcd/fcd_source_c.cc18
-rw-r--r--lib/fcd/fcd_source_c.h13
6 files changed, 43 insertions, 46 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf24991..e89f584 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/cmake/Modules/FindGnuradioFCDPP.cmake b/cmake/Modules/FindGnuradioFCDPP.cmake
new file mode 100644
index 0000000..f81fe8a
--- /dev/null
+++ b/cmake/Modules/FindGnuradioFCDPP.cmake
@@ -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)
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index f8c9db7..d7b2457 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -136,6 +136,14 @@ if(ENABLE_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
########################################################################
GR_REGISTER_COMPONENT("IQ File Source & Sink" ENABLE_FILE gnuradio-blocks_FOUND)
diff --git a/lib/fcd/CMakeLists.txt b/lib/fcd/CMakeLists.txt
index 80f88d3..f5d4aa5 100644
--- a/lib/fcd/CMakeLists.txt
+++ b/lib/fcd/CMakeLists.txt
@@ -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
diff --git a/lib/fcd/fcd_source_c.cc b/lib/fcd/fcd_source_c.cc
index 885d514..744fa69 100644
--- a/lib/fcd/fcd_source_c.cc
+++ b/lib/fcd/fcd_source_c.cc
@@ -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 );
}
diff --git a/lib/fcd/fcd_source_c.h b/lib/fcd/fcd_source_c.h
index 70239f8..2b02eb1 100644
--- a/lib/fcd/fcd_source_c.h
+++ b/lib/fcd/fcd_source_c.h
@@ -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;
};