Compare commits

..

No commits in common. "master" and "gr3.8" have entirely different histories.

106 changed files with 1098 additions and 3989 deletions

4
.gitignore vendored
View File

@ -1,4 +0,0 @@
/.vscode/*
/build/*
*.pyc
*.pyo

View File

@ -21,8 +21,8 @@
# Project setup
########################################################################
cmake_minimum_required(VERSION 3.8)
project(gr-osmosdr CXX C)
include(GNUInstallDirs)
project(gr-osmosdr CXX C)
enable_testing()
#policy setup
@ -41,8 +41,7 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
# Find GNURadio (pmt and runtime are core, always included)
include(FindPkgConfig)
find_package(Gnuradio "3.9" REQUIRED COMPONENTS blocks fft filter)
find_package(Gnuradio "3.8" REQUIRED COMPONENTS blocks fft filter)
# Set the version information here
set(VERSION_MAJOR 0)
@ -63,7 +62,15 @@ if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
add_definitions(-fvisibility-inlines-hidden)
endif()
set(CMAKE_CXX_STANDARD 11)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_STANDARD 11)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_STANDARD 11)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_STANDARD 11)
else()
message(WARNING "C++ standard could not be set because compiler is not GNU, Clang or MSVC.")
endif()
# Misc options
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
@ -164,7 +171,6 @@ message (STATUS " Found Volk: ${Volk_FOUND}")
####################
find_package(LibRTLSDR)
find_package(LibMiriSDR)
if(ENABLE_NONFREE)
find_package(LibSDRplay)
endif(ENABLE_NONFREE)
@ -172,7 +178,7 @@ find_package(LibHackRF)
find_package(LibAIRSPY)
find_package(LibAIRSPYHF)
find_package(LibbladeRF)
find_package(GnuradioFuncube)
find_package(GnuradioFCDPP)
find_package(SoapySDR NO_MODULE)
find_package(LibFreeSRP)
find_package(LibXTRX)
@ -182,11 +188,20 @@ find_package(Doxygen)
##########
find_package(PythonLibs 3)
find_package(pybind11)
find_package(SWIG)
if(SWIG_FOUND)
message(STATUS "Minimum SWIG version required is 1.3.31")
set(SWIG_VERSION_CHECK FALSE)
if("${SWIG_VERSION}" VERSION_GREATER "1.3.30")
set(SWIG_VERSION_CHECK TRUE)
endif()
endif(SWIG_FOUND)
GR_REGISTER_COMPONENT("Python support" ENABLE_PYTHON
PYTHONLIBS_FOUND
pybind11_FOUND
SWIG_FOUND
SWIG_VERSION_CHECK
)
########################################################################
@ -254,6 +269,7 @@ add_custom_target(uninstall
add_subdirectory(include/osmosdr)
add_subdirectory(lib)
if(ENABLE_PYTHON)
add_subdirectory(swig)
add_subdirectory(python)
add_subdirectory(grc)
add_subdirectory(apps)

View File

@ -15,7 +15,7 @@ author:
copyright_owner:
- Dimitri Stolnikov <horiz0n@gmx.net>
license: GPLv3
repo: https://gitea.osmocom.org/sdr/gr-osmosdr
repo: git://git.osmocom.org/gr-osmosdr
website: http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
---
GNU Radio block for interfacing with various radio hardware

51
README Normal file
View File

@ -0,0 +1,51 @@
While primarily being developed for the OsmoSDR hardware, this block
as well supports:
* FUNcube Dongle through libgnuradio-fcd
* FUNcube Dongle Pro+ through gr-fcdproplus
* RTL2832U based DVB-T dongles through librtlsdr
* RTL-TCP spectrum server (see librtlsdr project)
* SDRplay RSP through SDRplay API library
* gnuradio .cfile input through libgnuradio-blocks
* RFSPACE SDR-IQ, SDR-IP, NetSDR (incl. X2 option)
* AirSpy Wideband Receiver through libairspy
* CCCamp 2015 rad1o Badge through libhackrf
* Great Scott Gadgets HackRF through libhackrf
* Nuand LLC bladeRF through libbladeRF library
* Ettus USRP Devices through Ettus UHD library
* Fairwaves UmTRX through Fairwaves' module for UHD
* Fairwaves XTRX through libxtrx
* Red Pitaya SDR transceiver (http://bazaar.redpitaya.com)
* FreeSRP through libfreesrp
By using the OsmoSDR block you can take advantage of a common software api in
your application(s) independent of the underlying radio hardware.
For installation and usage guidelines please read the documentation available
at http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
For the impatient :) a short excerpt:
The Gnu Radio block requires a recent gnuradio (>= v3.7) to be installed.
Before building the block you have to make sure that all the dependencies
(see list of supported devices above) you are intend to work with are
properly installed. The build system of gr-osmosdr will recognize them and
enable specific source/sink components thereafter.
Please note: prior pulling a new version from git and compiling it,
please do a "make uninstall" first to properly remove the previous version.
Building with cmake:
git clone git://git.osmocom.org/gr-osmosdr
cd gr-osmosdr/
mkdir build
cd build/
cmake ../
make
sudo make install
sudo ldconfig
NOTE: The osmocom blocks will appear under 'Sources' and 'Sinks' categories
in GRC menu.

View File

@ -1,92 +0,0 @@
gr-osmosdr - generic gnuradio SDR I/O block
===========================================
While originally being developed for the
[OsmoSDR](https://osmocom.org/projects/osmosdr/wiki) hardware, this
block has become a generic SDR I/O block for a variety of SDR
hardware, including:
* FUNcube Dongle / Pro+ through [gr-funcube](https://github.com/dl1ksv/gr-funcube)
* RTL2832U based DVB-T dongles through [librtlsdr](https://osmocom.org/projects/rtl-sdr/wiki)
* RTL-TCP spectrum server (see librtlsdr project)
* MSi2500 based DVB-T dongles through [libmirisdr](https://gitea.osmocom.org/sdr/libmirisdr)
* SDRplay RSP through SDRplay API library
* gnuradio .cfile input through libgnuradio-blocks
* RFSPACE SDR-IQ, SDR-IP, NetSDR (incl. X2 option), Cloud-IQ, and CloudSDR
* AirSpy Wideband Receiver through [libairspy](https://github.com/airspy/airspyone_host)
* CCCamp 2015 rad1o Badge through [libhackrf](https://github.com/greatscottgadgets/hackrf)
* Great Scott Gadgets HackRF through [libhackrf](https://github.com/greatscottgadgets/hackrf)
* Nuand LLC bladeRF through [libbladeRF library](https://www.nuand.com/libbladeRF-doc/)
* Ettus USRP Devices through [Ettus UHD library](https://github.com/EttusResearch/uhd)
* Fairwaves UmTRX through [Fairwaves' module for UHD](https://github.com/fairwaves/UHD-Fairwaves)
* Fairwaves XTRX through [libxtrx](https://github.com/myriadrf/libxtrx)
* Red Pitaya SDR transceiver <http://bazaar.redpitaya.com>
* FreeSRP through [libfreesrp](https://github.com/myriadrf/libfreesrp)
By using the gr-osmosdr block you can take advantage of a common software API in
your application(s) independent of the underlying radio hardware.
Homepage + Documentation
------------------------
For installation and usage guidelines please read the documentation available
at <https://osmocom.org/projects/gr-osmosdr/wiki>
For the impatient :) a short excerpt:
The Gnu Radio block requires a recent gnuradio (>= v3.7) to be installed.
Before building the block you have to make sure that all the dependencies
(see list of supported devices above) you are intend to work with are
properly installed. The build system of gr-osmosdr will recognize them and
enable specific source/sink components thereafter.
Please note: prior pulling a new version from git and compiling it,
please do a `make uninstall` first to properly remove the previous version.
Building with cmake:
```
git clone https://gitea.osmocom.org/sdr/gr-osmosdr
cd gr-osmosdr/
mkdir build
cd build/
cmake ../
make
sudo make install
sudo ldconfig
```
NOTE: The osmocom blocks will appear under *Sources* and *Sinks* categories
in GRC menu.
Forum
-----
We welcome any gr-osmosdr related discussions in the
[SDR](https://discourse.osmocom.org/c/sdr/)
section of the osmocom discourse (web based Forum).
Mailing List
------------
Discussions related to libosmocore are happening on the
osmocom-sdr@lists.osmocom.org mailing list, please see
<https://lists.osmocom.org/mailman/listinfo/osmocom-sdr> for subscription
options and the list archive.
Please observe the [Osmocom Mailing List
Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules)
when posting.
Issue tracker
-------------
We are using the Osmocom redmine at <https://osmocom.org/projects/gr-osmosdr/issues>
Contributing
------------
We maintain our source code in a self-hosted instance of gitea at
<https://gitea.osmocom.org/sdr/gr-osmosdr>. You can send pull requests there, or send
patches the old-fashioned way (git send-email) to the above-mentioned mailing list.

View File

@ -30,6 +30,6 @@ GR_PYTHON_INSTALL(
osmocom_fft
# osmocom_siggen
osmocom_siggen_nogui
# osmocom_spectrum_sense
osmocom_spectrum_sense
DESTINATION ${GR_RUNTIME_DIR}
)

View File

@ -24,7 +24,7 @@ import osmosdr
from gnuradio import blocks
from gnuradio import gr
from gnuradio import eng_notation
from gnuradio.fft import window
from gnuradio.filter import firdes
from gnuradio.eng_option import eng_option
from optparse import OptionParser
from functools import partial
@ -238,19 +238,16 @@ class app_top_block(gr.top_block, Qt.QMainWindow):
self.iq_balance_mag = 0
self.iq_balance_pha = 0
# see https://github.com/gnuradio/gnuradio/issues/5175 - 3.9 has a backport of pyqwidget, but 3.10 does not.
check_qwidget = lambda : self.scope.pyqwidget() if "pyqwidget" in dir(self.scope) else self.scope.qwidget()
if options.fosphor:
from gnuradio import fosphor
self.scope = fosphor.qt_sink_c()
self.scope.set_frequency_range(0, input_rate)
self.scope_win = sip.wrapinstance(check_qwidget(), Qt.QWidget)
self.scope_win = sip.wrapinstance(self.scope.pyqwidget(), Qt.QWidget)
self.scope_win.setMinimumSize(800, 300)
elif options.waterfall:
self.scope = qtgui.waterfall_sink_c(
options.fft_size,
wintype=window.WIN_BLACKMAN_hARRIS,
wintype=firdes.WIN_BLACKMAN_hARRIS,
fc=0,
bw=input_rate,
name="",
@ -259,7 +256,7 @@ class app_top_block(gr.top_block, Qt.QMainWindow):
self.scope.enable_grid(False)
self.scope.enable_axis_labels(True)
self.scope.set_intensity_range(-100, 20)
self.scope_win = sip.wrapinstance(check_qwidget(), Qt.QWidget)
self.scope_win = sip.wrapinstance(self.scope.pyqwidget(), Qt.QWidget)
self.scope_win.setMinimumSize(800, 420)
elif options.oscilloscope:
@ -269,13 +266,13 @@ class app_top_block(gr.top_block, Qt.QMainWindow):
name="",
nconnections=1
)
self.scope_win = sip.wrapinstance(check_qwidget(), Qt.QWidget)
self.scope_win = sip.wrapinstance(self.scope.pyqwidget(), Qt.QWidget)
self.scope_win.setMinimumSize(800, 600)
elif options.qtgui:
self.scope = qtgui.sink_c(
options.fft_size,
wintype=window.WIN_BLACKMAN_hARRIS,
wintype=firdes.WIN_BLACKMAN_hARRIS,
fc=0,
bw=input_rate,
name="",
@ -284,20 +281,20 @@ class app_top_block(gr.top_block, Qt.QMainWindow):
plottime=True,
plotconst=True
)
self.scope_win = sip.wrapinstance(check_qwidget(), Qt.QWidget)
self.scope_win = sip.wrapinstance(self.scope.pyqwidget(), Qt.QWidget)
self.scope.set_update_time(1.0/10)
self.scope_win.setMinimumSize(800, 600)
else:
self.scope = qtgui.freq_sink_c(
fftsize=options.fft_size,
wintype=window.WIN_BLACKMAN_hARRIS,
wintype=firdes.WIN_BLACKMAN_hARRIS,
fc=0,
bw=input_rate,
name="",
nconnections=1
)
self.scope_win = sip.wrapinstance(check_qwidget(), Qt.QWidget)
self.scope_win = sip.wrapinstance(self.scope.pyqwidget(), Qt.QWidget)
self.scope.disable_legend()
self.scope_win.setMinimumSize(800, 420)

View File

@ -483,7 +483,7 @@ def main():
app.MainLoop()
except RuntimeError, e:
print(e)
print e
sys.exit(1)
# Make sure to create the top block (tb) within a function: That code

View File

@ -46,7 +46,7 @@ from gnuradio import blocks
from gnuradio import filter
from gnuradio import analog
from gnuradio import digital
from gnuradio import gr, eng_notation
from gnuradio import gr, gru, eng_notation
from gnuradio.gr.pubsub import pubsub
from gnuradio.eng_option import eng_option
from optparse import OptionParser

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

@ -1,27 +0,0 @@
if(NOT GNURADIO_FUNCUBE_FOUND)
pkg_check_modules (GNURADIO_FUNCUBE_PKG libgnuradio-funcube)
find_path(GNURADIO_FUNCUBE_INCLUDE_DIRS NAMES funcube/api.h
PATHS
${GNURADIO_FUNCUBE_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
)
find_library(GNURADIO_FUNCUBE_LIBRARIES NAMES gnuradio-funcube
PATHS
${GNURADIO_FUNCUBE_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)
if(GNURADIO_FUNCUBE_INCLUDE_DIRS AND GNURADIO_FUNCUBE_LIBRARIES)
set(GNURADIO_FUNCUBE_FOUND TRUE CACHE INTERNAL "gnuradio-funcube found")
message(STATUS "Found gnuradio-funcube: ${GNURADIO_FUNCUBE_INCLUDE_DIRS}, ${GNURADIO_FUNCUBE_LIBRARIES}")
else(GNURADIO_FUNCUBE_INCLUDE_DIRS AND GNURADIO_FUNCUBE_LIBRARIES)
set(GNURADIO_FUNCUBE_FOUND FALSE CACHE INTERNAL "gnuradio-funcube found")
message(STATUS "gnuradio-funcube not found.")
endif(GNURADIO_FUNCUBE_INCLUDE_DIRS AND GNURADIO_FUNCUBE_LIBRARIES)
mark_as_advanced(GNURADIO_FUNCUBE_LIBRARIES GNURADIO_FUNCUBE_INCLUDE_DIRS)
endif(NOT GNURADIO_FUNCUBE_FOUND)

View File

@ -1,6 +1,4 @@
if(NOT PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
endif()
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_LIBAIRSPY libairspy)
FIND_PATH(
@ -22,5 +20,5 @@ FIND_LIBRARY(
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibAIRSPY DEFAULT_MSG LIBAIRSPY_LIBRARIES LIBAIRSPY_INCLUDE_DIRS)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBAIRSPY DEFAULT_MSG LIBAIRSPY_LIBRARIES LIBAIRSPY_INCLUDE_DIRS)
MARK_AS_ADVANCED(LIBAIRSPY_LIBRARIES LIBAIRSPY_INCLUDE_DIRS)

View File

@ -1,6 +1,4 @@
if(NOT PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
endif()
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_LIBAIRSPYHF libairspyhf)
FIND_PATH(
@ -22,5 +20,5 @@ FIND_LIBRARY(
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibAIRSPYHF DEFAULT_MSG LIBAIRSPYHF_LIBRARIES LIBAIRSPYHF_INCLUDE_DIRS)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBAIRSPYHF DEFAULT_MSG LIBAIRSPYHF_LIBRARIES LIBAIRSPYHF_INCLUDE_DIRS)
MARK_AS_ADVANCED(LIBAIRSPYHF_LIBRARIES LIBAIRSPYHF_INCLUDE_DIRS)

View File

@ -1,6 +1,4 @@
if(NOT PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
endif()
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_LIBHACKRF libhackrf)
FIND_PATH(
@ -22,6 +20,6 @@ FIND_LIBRARY(
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibHackRF DEFAULT_MSG LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIRS)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBHACKRF DEFAULT_MSG LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIRS)
MARK_AS_ADVANCED(LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIRS)

View File

@ -1,27 +0,0 @@
if(NOT LIBMIRISDR_FOUND)
pkg_check_modules (LIBMIRISDR_PKG libmirisdr)
find_path(LIBMIRISDR_INCLUDE_DIRS NAMES mirisdr.h
PATHS
${LIBMIRISDR_PKG_INCLUDE_DIRS}
/usr/include
/usr/local/include
)
find_library(LIBMIRISDR_LIBRARIES NAMES mirisdr
PATHS
${LIBMIRISDR_PKG_LIBRARY_DIRS}
/usr/lib
/usr/local/lib
)
if(LIBMIRISDR_INCLUDE_DIRS AND LIBMIRISDR_LIBRARIES)
set(LIBMIRISDR_FOUND TRUE CACHE INTERNAL "libmirisdr found")
message(STATUS "Found libmirisdr: ${LIBMIRISDR_INCLUDE_DIRS}, ${LIBMIRISDR_LIBRARIES}")
else(LIBMIRISDR_INCLUDE_DIRS AND LIBMIRISDR_LIBRARIES)
set(LIBMIRISDR_FOUND FALSE CACHE INTERNAL "libmirisdr found")
message(STATUS "libmirisdr not found.")
endif(LIBMIRISDR_INCLUDE_DIRS AND LIBMIRISDR_LIBRARIES)
mark_as_advanced(LIBMIRISDR_LIBRARIES LIBMIRISDR_INCLUDE_DIRS)
endif(NOT LIBMIRISDR_FOUND)

View File

@ -1,9 +1,5 @@
if(NOT LIBBLADERF_FOUND)
pkg_check_modules (LIBBLADERF_PKG libbladeRF)
if (LIBBLADERF_PKG_FOUND AND LIBBLADERF_PKG_VERSION VERSION_LESS "2")
message( FATAL_ERROR "Install version 2 or greater of libbladeRF."
" Current version ( ${LIBBLADERF_PKG_VERSION} ) is out of date." )
endif()
find_path(LIBBLADERF_INCLUDE_DIRS NAMES libbladeRF.h
PATHS
${LIBBLADERF_PKG_INCLUDE_DIRS}

188
debian/changelog vendored
View File

@ -1,188 +0,0 @@
gr-osmosdr (0.1.5git) unstable; urgency=medium
* Add initial support for Airspy HF+
* Support for FreeSRP via libfreesrp
-- Harald Welte <laforge@gnumonks.org> Sun, 03 Jun 2018 10:38:52 +0200
gr-osmosdr (0.1.4-14) unstable; urgency=medium
* Add initial support for Airspy HF+
* Support for FreeSRP via libfreesrp
-- A. Maitland Bottoms <bottoms@debian.org> Thu, 23 Nov 2017 10:38:52 -0500
gr-osmosdr (0.1.4-13) unstable; urgency=medium
* update to v0.1.4-98-gc653754
* rtl-sdr bias-T support
* build with gnuradio-3.7.11
-- A. Maitland Bottoms <bottoms@debian.org> Thu, 07 Sep 2017 19:50:05 -0400
gr-osmosdr (0.1.4-12) unstable; urgency=medium
* rebuild with airspy-host 1.0.9
-- A. Maitland Bottoms <bottoms@debian.org> Fri, 14 Oct 2016 20:58:28 -0400
gr-osmosdr (0.1.4-11) unstable; urgency=medium
* Add SoapySDR support
-- A. Maitland Bottoms <bottoms@debian.org> Sun, 28 Aug 2016 14:52:53 -0400
gr-osmosdr (0.1.4-10) unstable; urgency=medium
* build with gnuradio-3.7.10
-- A. Maitland Bottoms <bottoms@debian.org> Sun, 10 Jul 2016 12:41:34 -0400
gr-osmosdr (0.1.4-9) unstable; urgency=medium
* update to v0.1.4-72-g164a09f
* rebuild on kfreebsd (Closes: #822132)
-- A. Maitland Bottoms <bottoms@debian.org> Fri, 29 Apr 2016 05:10:35 -0400
gr-osmosdr (0.1.4-8) unstable; urgency=medium
* update to v0.1.4-67-gac15e78, build with gnuradio 3.7.9
-- A. Maitland Bottoms <bottoms@debian.org> Wed, 13 Jan 2016 00:16:06 -0500
gr-osmosdr (0.1.4-7) unstable; urgency=medium
* Lintian cleanups pre-depends and dep5-copyright
-- A. Maitland Bottoms <bottoms@debian.org> Sat, 28 Nov 2015 22:57:30 -0500
gr-osmosdr (0.1.4-6) unstable; urgency=medium
* Don't depend upon hackrf on non-linux
-- A. Maitland Bottoms <bottoms@debian.org> Mon, 05 Oct 2015 00:25:01 -0400
gr-osmosdr (0.1.4-5) unstable; urgency=medium
* Rebuild with uhd 3.9.1-3
-- A. Maitland Bottoms <bottoms@debian.org> Wed, 30 Sep 2015 21:06:49 -0400
gr-osmosdr (0.1.4-4) unstable; urgency=medium
* Tighten libuhd003 versioned dependency via dh_makeshlibs
-- A. Maitland Bottoms <bottoms@debian.org> Wed, 30 Sep 2015 01:04:40 -0400
gr-osmosdr (0.1.4-3) unstable; urgency=low
* rebuild with uhd-3.9.1
* post gcc-5 libstdc++6 transition build (Closes: #791062)
-- A. Maitland Bottoms <bottoms@debian.org> Mon, 14 Sep 2015 20:51:16 -0400
gr-osmosdr (0.1.4-2) unstable; urgency=medium
* add watch file, rebuild with uhd-3.9.0
-- A. Maitland Bottoms <bottoms@debian.org> Thu, 10 Sep 2015 10:55:58 -0400
gr-osmosdr (0.1.4-1) unstable; urgency=medium
* New upstream, update to v0.1.4-48-g86ad584
build with gnuradio 3.7.8
-- A. Maitland Bottoms <bottoms@debian.org> Sun, 16 Aug 2015 21:55:38 -0400
gr-osmosdr (0.1.3-2) unstable; urgency=low
* Add versioned depends for bladerf (Closes: #759927)
-- A. Maitland Bottoms <bottoms@debian.org> Wed, 10 Sep 2014 23:57:56 -0400
gr-osmosdr (0.1.3-1) unstable; urgency=low
* New upstream release
* build with gnuradio 3.7.5
-- A. Maitland Bottoms <bottoms@debian.org> Wed, 03 Sep 2014 22:21:12 -0400
gr-osmosdr (0.1.2-1) unstable; urgency=low
* New upstream release, update to v0.1.2-2-g8604d76
* Include airspy support
* pkg-gr-osmosdr git for Debian packaging (Closes: #759268)
-- A. Maitland Bottoms <bottoms@debian.org> Thu, 28 Aug 2014 14:37:08 -0400
gr-osmosdr (0.1.1.4.ac95af2-1) unstable; urgency=low
* Update to v0.1.1-4-gac95af2
reverting 66109099 rtl: implement methods allowing runtime to control
sampling process
* Build with gnuradio 3.7.3 (Closes: #743392)
* Osmocom MiriSDR support
-- A. Maitland Bottoms <bottoms@debian.org> Sat, 19 Apr 2014 19:22:49 -0400
gr-osmosdr (0.1.0.55.80c4af-2~bpo70~1) wheezy-backports; urgency=low
* Rebuild for wheezy-backports.
-- A. Maitland Bottoms <bottoms@debian.org> Tue, 11 Feb 2014 16:57:11 -0500
gr-osmosdr (0.1.0.55.80c4af-2) unstable; urgency=low
* ship grc blocks
-- A. Maitland Bottoms <bottoms@debian.org> Fri, 03 Jan 2014 00:32:28 -0500
gr-osmosdr (0.1.0.55.80c4af-1) unstable; urgency=low
* New upstream commit, build with gnuradio 3.7.2.1
-- A. Maitland Bottoms <bottoms@debian.org> Tue, 31 Dec 2013 00:09:54 -0500
gr-osmosdr (0.1.0.11.04b4c8-3) unstable; urgency=low
* Fix up dependencies for current unstable build
-- A. Maitland Bottoms <bottoms@debian.org> Thu, 12 Dec 2013 12:05:35 -0500
gr-osmosdr (0.1.0.11.04b4c8-2) unstable; urgency=low
* drop bladerf dependency
-- A. Maitland Bottoms <bottoms@debian.org> Sat, 23 Nov 2013 11:25:21 -0500
gr-osmosdr (0.1.0.11.04b4c8-1) unstable; urgency=low
* New upstream snapshot (Closes: #726469)
* Match GNU Radio live distribution version
-- A. Maitland Bottoms <bottoms@debian.org> Tue, 08 Oct 2013 17:30:31 -0400
gr-osmosdr (0.1git59ceddb-1) unstable; urgency=low
* New upstream release, build with gnuradio 3.6.4.1-0wheezy1
-- A. Maitland Bottoms <bottoms@debian.org> Wed, 01 May 2013 17:19:35 -0400
gr-osmosdr (0.1gitd11b7a-1) unstable; urgency=low
* New upstream git, build with gnuradio 3.6.3
-- A. Maitland Bottoms <bottoms@debian.org> Wed, 13 Feb 2013 15:56:33 -0500
gr-osmosdr (0.1git0f25dae-1) unstable; urgency=low
* New upstream git, build with gnuradio 3.6.2
-- A. Maitland Bottoms <bottoms@debian.org> Sun, 16 Sep 2012 20:47:39 -0400
gr-osmosdr (0.0git7f796fe-1) unstable; urgency=low
* New upstream git, build with gnuradio 3.6.0
-- A. Maitland Bottoms <bottoms@debian.org> Mon, 14 May 2012 20:28:18 -0400

1
debian/compat vendored
View File

@ -1 +0,0 @@
9

79
debian/control vendored
View File

@ -1,79 +0,0 @@
Source: gr-osmosdr
Section: libdevel
Priority: optional
Maintainer: Harald Welte <laforge@gnumonks.org>
Build-Depends: cmake,
debhelper (>= 9.0.0~),
dh-python,
doxygen,
gnuradio-dev (>=3.7.11),
gr-fcdproplus (>=3.7.25.4b6464b-3) [!hurd-i386],
gr-iqbal (>=0.37.2-8),
libairspy-dev (>= 1.0.9~) [!hurd-i386],
libairspyhf-dev [!hurd-i386],
libbladerf-dev (>=0.2016.01~rc1) [!hurd-i386],
libboost-dev,
libboost-system-dev,
libboost-thread-dev,
libfreesrp-dev [!hurd-i386],
libhackrf-dev [linux-any],
liblog4cpp5-dev,
libmirisdr-dev [!hurd-i386],
libosmosdr-dev [!hurd-i386],
librtlsdr-dev [!hurd-i386],
libsoapysdr-dev,
libuhd-dev (>=3.10),
pkg-config,
python-dev,
python-soapysdr,
swig
X-Python-Version: >= 2.7, << 2.8
Standards-Version: 4.1.0
Homepage: https://osmocom.org/projects/gr-osmosdr/wiki
Vcs-Git: https://gitea.osmocom.org/sdr/gr-osmosdr
Vcs-Browser: https://gitea.osmocom.org/sdr/gr-osmosdr
Package: gr-osmosdr
Architecture: any
Pre-Depends: ${misc:Pre-Depends}
Depends: ${misc:Depends}, ${python:Depends}, ${shlibs:Depends}
Recommends: gnuradio, gr-fosphor
Description: Gnuradio blocks from the OsmoSDR project
The Osmocom project is a family of projects regarding Open source
mobile communications.
.
While primarily being developed for the OsmoSDR hardware, this block
as well supports:
- FUNcube Dongle through libgnuradio-fcd
- FUNcube Dongle Pro+ through gr-fcdproplus
- sysmocom OsmoSDR Devices through libosmosdr
- RTL2832U based DVB-T dongles through librtlsdr
- RTL-TCP spectrum server (see librtlsdr project)
- MSi2500 based DVB-T dongles through libmirisdr
- gnuradio .cfile input through libgnuradio-blocks
- RFSPACE SDR-IQ, SDR-IP, NetSDR (incl. X2 option)
- Great Scott Gadgets HackRF through libhackrf
- Nuand LLC bladeRF through libbladeRF library
- Ettus USRP Devices through Ettus UHD library
- Fairwaves UmTRX through Fairwaves' fork of UHD
- AIRSPY Receiver
- AIRSPY HF+ Receiver
- SoapySDR support
- Red Pitaya SDR transceiver (http://bazaar.redpitaya.com)
- FreeSRP through libfreesrp
.
By using the OsmoSDR block you can take advantage of a common
software API in your application(s) independent of the underlying
radio hardware.
Package: libgnuradio-osmosdr0.1.4
Section: libs
Architecture: any
Pre-Depends: ${misc:Pre-Depends}
Depends: ${misc:Depends}, ${shlibs:Depends}
Multi-Arch: same
Description: Gnuradio blocks from the OsmoSDR project - library
The Osmocom project is a family of projects regarding Open source
mobile communications.
.
This package contains the shared library.

195
debian/copyright vendored
View File

@ -1,195 +0,0 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: gr-osmosdr
Upstream-Contact: http://sdr.osmocom.org/trac/wiki/rtl-sdr
Source:
git clone https://gitea.osmocom.org/sdr/gr-osmosdr
The upstream package source tarball was generated from the tag:
git archive --format=tar --prefix=gr-osmosdr-0.1.4/ v0.1.4 | xz > ../gr-osmosdr_0.1.4.orig.tar.xz
Comment:
Debian packages by A. Maitland Bottoms <bottoms@debian.org>,
.
Upstream Author:
Dimitri Stolnikov <horiz0n@gmx.net>
Copyright: 2012,2013 Dimitri Stolnikov <horiz0n@gmx.net>
License: GPL-3+
Files: COPYING
Copyright: 2007 Free Software Foundation, Inc. <http://fsf.org/>
License: FSF-COPYING
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Files: CMakeLists.txt apps/* docs/* python/* include/osmosdr/api.h
cmake/Modules/* include/osmosdr/CMakeLists.txt
lib/CMakeLists.txt lib/gnuradio-osmosdr.rc.in
lib/bladerf/CMakeLists.txt swig/* grc/CMakeLists.txt
Copyright: 2005,2007-2013 Free Software Foundation, Inc.
Comment: GNU Radio gr_modtool derived
License: GPL-3+
Files: debian/*
Copyright: 2013 A. Maitland Bottoms <bottoms@debian.org>
License: GPL-3+
Files: grc/gen_osmosdr_blocks.py
Copyright: 2012 Free Software Foundation, Inc.
License: GPL-2+
Files: include/osmosdr/pimpl.h include/osmosdr/ranges.h lib/ranges.cc
include/osmosdr/time_spec.h lib/time_spec.cc
Copyright: 2010-2013 Ettus Research LLC
License: GPL-3+
FIles: lib/bladerf/bladerf_common.cc lib/bladerf/bladerf_common.h
lib/bladerf/bladerf_sink_c.cc lib/bladerf/bladerf_sink_c.h
lib/bladerf/bladerf_source_c.cc lib/bladerf/bladerf_source_c.h
Copyright: 2013 Nuand LLC
2013 Dimitri Stolnikov <horiz0n@gmx.net>
License: GPL-3+
Files: lib/soapy/*
Copyright: 2015 Josh Blum <josh@joshknows.com>
2013 Dimitri Stolnikov <horiz0n@gmx.net>
License: GPL-3+
Files: lib/freesrp/*
Copyright: 2017 by Lukas Lao Beyer
License: GPL-3+
Files: AUTHORS MANIFEST.md README.md gnuradio-osmosdr.pc.in
cmake/cmake_uninstall.cmake.in include/osmosdr/device.h
include/osmosdr/sink.h include/osmosdr/source.h
lib/arg_helpers.h lib/config.h.in lib/device.cc
lib/sink_iface.h lib/sink_impl.cc lib/sink_impl.h
lib/source_iface.h lib/source_impl.cc lib/source_impl.h
lib/airspy/* lib/fcd/* lib/file/* lib/hackrf/*
lib/miri/* lib/osmosdr/* lib/rfspace/* lib/rtl*
lib/sdrplay/* lib/uhd/*
Copyright: 2012-2013 Dimitri Stolnikov <horiz0n@gmx.net>
License: GPL-3+
Files: lib/rtl_tcp/rtl_tcp_source_f.h
Copyright: 2012 Hoernchen <la@tfc-server.de>
License: GPL-3+
Files: lib/miri/miri_source_c.cc
Copyright: 2012 Steve Markgraf <steve@steve-m.de>
2012 Dimitri Stolnikov <horiz0n@gmx.net>
License: GPL-3+
Files: lib/redpitaya/*
Copyright: 2015 Pavel Demin
2012,2015 Dimitri Stolnikov <horiz0n@gmx.net>
License: GPL-3+
Files: lib/freesrp/readerwriterqueue/*
Copyright: 2013-2015, Cameron Desrochers
Comment: libfreesrp includes ReaderWriterQueue
License: Simplified-BSD
All rights reserved.
.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
.
- Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Files: lib/freesrp/readerwriterqueue/atomicops.h
Copyright: 2015 Jeff Preshing
License: atomicops
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
.
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgement in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Files: cmake/Modules/CMakeParseArgumentsCopy.cmake
Copyright: 2010 Alexander Neundorf <neundorf@kde.org>
Comment: copy of CMakeParseArguments.cmake from cmake 2.8.x
License: Kitware-BSD
All rights reserved.
.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
.
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
* Neither the names of Kitware, Inc., the Insight Software Consortium,
nor the names of their contributors may be used to endorse or promote
products derived from this software without specific prior written
permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: GPL-2+
GNU Radio Companion 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 2
of the License, or (at your option) any later version.
.
GNU Radio Companion 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 this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
.
On Debian systems, the complete text of the GNU General Public
License (GPL) version 3 can be found in the file
'/usr/share/common-licenses/GPL-2'.
License: GPL-3+
GNU Radio 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, or (at your option)
any later version.
.
GNU Radio 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.
.
On Debian systems, the complete text of the GNU General Public
License (GPL) version 3 can be found in the file
'/usr/share/common-licenses/GPL-3'.

View File

@ -1,6 +0,0 @@
usr/bin/*
usr/include/*
usr/lib/*/lib*.so
usr/lib/*/pkgconfig/*
usr/lib/python*
usr/share/*

View File

@ -1,4 +0,0 @@
debian/osmocom_fft.1
debian/osmocom_siggen.1
debian/osmocom_siggen_nogui.1
debian/osmocom_spectrum_sense.1

View File

@ -1 +0,0 @@
usr/lib/*/lib*.so.*

224
debian/osmocom_fft.1 vendored
View File

@ -1,224 +0,0 @@
.TH osmocom_fft "1" "October 2013" "OSMOCOM" "User Commands"
.SH NAME
osmocom_fft \- Spectrum Browser
.SH SYNOPSIS
.B osmocom_fft
[\fIoptions\fR]
.SH DESCRIPTION
Spectrum Browser
.SH OPTIONS
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-a\fR ARGS, \fB\-\-args\fR=\fIARGS\fR
Device args, [default=]
.TP
\fB\-A\fR ANTENNA, \fB\-\-antenna\fR=\fIANTENNA\fR
Select RX antenna where appropriate
.TP
\fB\-s\fR SAMP_RATE, \fB\-\-samp\-rate\fR=\fISAMP_RATE\fR
Set sample rate (bandwidth), minimum by default
.TP
\fB\-f\fR FREQ, \fB\-\-center\-freq\fR=\fIFREQ\fR
Set frequency to FREQ
.TP
\fB\-c\fR FREQ_CORR, \fB\-\-freq\-corr\fR=\fIFREQ_CORR\fR
Set frequency correction (ppm)
.TP
\fB\-g\fR GAIN, \fB\-\-gain\fR=\fIGAIN\fR
Set gain in dB (default is midpoint)
.TP
\fB\-W\fR, \fB\-\-waterfall\fR
Enable waterfall display
.TP
\fB\-S\fR, \fB\-\-oscilloscope\fR
Enable oscilloscope display
.TP
\fB\-\-avg\-alpha\fR=\fIAVG_ALPHA\fR
Set fftsink averaging factor, default=[0.1]
.TP
\fB\-\-averaging\fR
Enable fftsink averaging, default=[False]
.TP
\fB\-\-ref\-scale\fR=\fIREF_SCALE\fR
Set dBFS=0dB input value, default=[1.0]
.TP
\fB\-\-fft\-size\fR=\fIFFT_SIZE\fR
Set number of FFT bins [default=1024]
.TP
\fB\-\-fft\-rate\fR=\fIFFT_RATE\fR
Set FFT update rate, [default=30]
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Use verbose console output [default=False]
.SH "SEE ALSO"
The full documentation for
.B linux;
is maintained as a Texinfo manual. If the
.B info
and
.B linux;
programs are properly installed at your site, the command
.IP
.B info linux;
.PP
should give you access to the complete manual.
.SH Device specification
You can specify the source or sink device using a comma separated string of argument=value pairs. The always-up-to-date block documentation with examples is available right here.
.SH FCD Source
.TP
Argument
Notes
.TP
fcd=<device-index>
0-based device identifier, optional
.TP
device=hw:2
overrides the audio device
.TP
type=2
selects the dongle type, 1 for Classic, 2 for Pro+
.LP
The "device" argument overrides the audio device used by the underlying driver to access the dongle's IQ sample stream.
.LP
The "type" argument selects the dongle type, 1 for Classic, 2 for Pro+.
.SH OsmoSDR Source
.TP
Argument
Notes
.TP
osmosdr=<device-index>
0-based device identifier
.TP
buffers=<number-of-buffers>
Default is 32
.TP
buflen=<length-of-buffer>
Default is 256kB, must be multiple of 512
.SH RTL-SDR Source
.TP
Argument
Notes
.TP
rtl=<device-index>
0-based device identifier OR serial number
.TP
rtl_xtal=<frequency>
Frequency (Hz) used for the RTL chip, accepts eng notation
.TP
tuner_xtal=<frequency>
Frequency (Hz) used for the tuner chip, accepts eng notation
.TP
buffers=<number-of-buffers>
Default is 32
.TP
buflen=<length-of-buffer>
Default is 256kB, must be multiple of 512
.TP
direct_samp=0|1|2
Enable direct sampling mode on the RTL chip. 0: Disable, 1: use I channel, 2: use Q channel
.TP
offset_tune=0|1
Enable offset tune mode for E4000 tuners
.LP
NOTE: use rtl_eeprom -s to program your own serial number to the device
.LP
NOTE: if you don't specify rtl_xtal/tuner_xtal, the underlying driver will use 28.0MHz
.SH RTL-SDR TCP Source
.TP
Argument
Notes
.TP
rtl_tcp=<hostname>:<port>
hostname defaults to "localhost", port to "1234"
.TP
psize=<payload-size>
Default is 16384 bytes
.TP
direct_samp=0|1|2
Enable direct sampling mode on the RTL chip 0=Off, 1=I-ADC input enabled, 2=Q-ADC input enabled
.TP
offset_tune=0|1
Enable offset tune mode for E4000 tuners
.SH Miri Source
.TP
Argument
Notes
.TP
miri=<device-index>
0-based device identifier
.TP
buffers=<number-of-buffers>
Default is 32
.SH UHD Source / Sink
Argument
Notes
.TP
uhd
Use this argument without a value
.TP
nchan=<channel-count>
For multichannel USRP configurations use the subdev parameter to specify stream mapping
.TP
subdev=<subdev-spec>
Examples: "A:0", "B:0", "A:0 B:0" when nchan=2. Refer original ettus documentation on this
.TP
lo_offset=<frequency>
Offset frequency in Hz, must be within daughterboard bandwidth. Accepts eng notation
.LP
Additional argument/value pairs will be passed to the underlying driver, for more information see specifying the subdevice and common device identifiers in the Ettus documentation.
.SH bladeRF Source / Sink
.TP
Argument
Notes
.TP
bladerf[=0]
0-based device identifier (optional)
.TP
fw='/path/to/the/firmware.img'
program MCU firmware from given file. usually not needed. power cycle required.
.TP
fpga='/path/to/the/bitstream.rbf'
load FPGA bitstream from given file. required only at first run at the moment.
.SH HackRF Source / Sink
.TP
Argument
Notes
.TP
hackrf
Use this argument without a value
.TP
buffers=<number-of-buffers>
Default is 32
.LP
Only the first device found may be used at the moment because of libhackrf limitation.
.LP
Transmit support has been verified by using the crc-mmbTools DAB sdr transmitter.
.SH IQ File Source
.TP
Argument
Notes
.TP
file=<path-to-file-name>
.TP
freq=<frequency>
Center frequency in Hz, accepts eng notation
.TP
rate=<sampling-rate>
Mandatory, in samples/s, accepts eng notation
.TP
repeat=true|false
Default is true
.TP
throttle=true|false
Throttle flow of samples, default is true
.SH EXAMPLES
.LP
osmocom_fft -a rtl=0 -v -f 100e6 -s 2.4e6 -g 15
.LP
osmocom_fft -a hackrf -v
.LP
osmocom_fft -a uhd -v
.SH "SEE ALSO"
osmocom_siggen(1) osmocom_siggen_nogui(1) osmocom_spectrum_sense(1)

View File

@ -1,222 +0,0 @@
.TH osmocom_siggen "1" "October 2013" "OSMOCOM" "User Commands"
.SH NAME
osmocom_siggen \- Signal Generator Application with GUI controls
.SH SYNOPSIS
.B osmocom_siggen:
[\fIoptions\fR]
.SH DESCRIPTION
Signal Generator Application with GUI controls
.SH OPTIONS
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-a\fR ARGS, \fB\-\-args\fR=\fIARGS\fR
Device args, [default=]
.TP
\fB\-A\fR ANTENNA, \fB\-\-antenna\fR=\fIANTENNA\fR
Select Rx Antenna where appropriate
.TP
\fB\-s\fR SAMP_RATE, \fB\-\-samp\-rate\fR=\fISAMP_RATE\fR
Set sample rate (bandwidth), minimum by default
.TP
\fB\-g\fR GAIN, \fB\-\-gain\fR=\fIGAIN\fR
Set gain in dB (default is midpoint)
.TP
\fB\-f\fR FREQ, \fB\-\-tx\-freq\fR=\fIFREQ\fR
Set carrier frequency to FREQ [default=mid\-point]
.TP
\fB\-c\fR FREQ_CORR, \fB\-\-freq\-corr\fR=\fIFREQ_CORR\fR
Set carrier frequency correction [default=0]
.TP
\fB\-x\fR WAVEFORM_FREQ, \fB\-\-waveform\-freq\fR=\fIWAVEFORM_FREQ\fR
Set baseband waveform frequency to FREQ [default=0]
.TP
\fB\-y\fR WAVEFORM2_FREQ, \fB\-\-waveform2\-freq\fR=\fIWAVEFORM2_FREQ\fR
Set 2nd waveform frequency to FREQ [default=none]
.TP
\fB\-\-sine\fR
Generate a carrier modulated by a complex sine wave
.TP
\fB\-\-const\fR
Generate a constant carrier
.TP
\fB\-\-offset\fR=\fIOFFSET\fR
Set waveform phase offset to OFFSET [default=0]
.TP
\fB\-\-gaussian\fR
Generate Gaussian random output
.TP
\fB\-\-uniform\fR
Generate Uniform random output
.TP
\fB\-\-2tone\fR
Generate Two Tone signal for IMD testing
.TP
\fB\-\-sweep\fR
Generate a swept sine wave
.TP
\fB\-\-gsm\fR
Generate GMSK modulated GSM Burst Sequence
.TP
\fB\-\-amplitude\fR=\fIAMPL\fR
Set output amplitude to AMPL (0.1\-1.0) [default=0.3]
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Use verbose console output [default=False]
.SH Device specification
You can specify the source or sink device using a comma separated string of argument=value pairs. The always-up-to-date block documentation with examples is available right here.
.SH FCD Source
.TP
Argument
Notes
.TP
fcd=<device-index>
0-based device identifier, optional
.TP
device=hw:2
overrides the audio device
.TP
type=2
selects the dongle type, 1 for Classic, 2 for Pro+
.LP
The "device" argument overrides the audio device used by the underlying driver to access the dongle's IQ sample stream.
.LP
The "type" argument selects the dongle type, 1 for Classic, 2 for Pro+.
.SH OsmoSDR Source
.TP
Argument
Notes
.TP
osmosdr=<device-index>
0-based device identifier
.TP
buffers=<number-of-buffers>
Default is 32
.TP
buflen=<length-of-buffer>
Default is 256kB, must be multiple of 512
.SH RTL-SDR Source
.TP
Argument
Notes
.TP
rtl=<device-index>
0-based device identifier OR serial number
.TP
rtl_xtal=<frequency>
Frequency (Hz) used for the RTL chip, accepts eng notation
.TP
tuner_xtal=<frequency>
Frequency (Hz) used for the tuner chip, accepts eng notation
.TP
buffers=<number-of-buffers>
Default is 32
.TP
buflen=<length-of-buffer>
Default is 256kB, must be multiple of 512
.TP
direct_samp=0|1|2
Enable direct sampling mode on the RTL chip. 0: Disable, 1: use I channel, 2: use Q channel
.TP
offset_tune=0|1
Enable offset tune mode for E4000 tuners
.LP
NOTE: use rtl_eeprom -s to program your own serial number to the device
.LP
NOTE: if you don't specify rtl_xtal/tuner_xtal, the underlying driver will use 28.0MHz
.SH RTL-SDR TCP Source
.TP
Argument
Notes
.TP
rtl_tcp=<hostname>:<port>
hostname defaults to "localhost", port to "1234"
.TP
psize=<payload-size>
Default is 16384 bytes
.TP
direct_samp=0|1|2
Enable direct sampling mode on the RTL chip 0=Off, 1=I-ADC input enabled, 2=Q-ADC input enabled
.TP
offset_tune=0|1
Enable offset tune mode for E4000 tuners
.SH Miri Source
.TP
Argument
Notes
.TP
miri=<device-index>
0-based device identifier
.TP
buffers=<number-of-buffers>
Default is 32
.SH UHD Source / Sink
Argument
Notes
.TP
uhd
Use this argument without a value
.TP
nchan=<channel-count>
For multichannel USRP configurations use the subdev parameter to specify stream mapping
.TP
subdev=<subdev-spec>
Examples: "A:0", "B:0", "A:0 B:0" when nchan=2. Refer original ettus documentation on this
.TP
lo_offset=<frequency>
Offset frequency in Hz, must be within daughterboard bandwidth. Accepts eng notation
.LP
Additional argument/value pairs will be passed to the underlying driver, for more information see specifying the subdevice and common device identifiers in the Ettus documentation.
.SH bladeRF Source / Sink
.TP
Argument
Notes
.TP
bladerf[=0]
0-based device identifier (optional)
.TP
fw='/path/to/the/firmware.img'
program MCU firmware from given file. usually not needed. power cycle required.
.TP
fpga='/path/to/the/bitstream.rbf'
load FPGA bitstream from given file. required only at first run at the moment.
.SH HackRF Source / Sink
.TP
Argument
Notes
.TP
hackrf
Use this argument without a value
.TP
buffers=<number-of-buffers>
Default is 32
.LP
Only the first device found may be used at the moment because of libhackrf limitation.
.LP
Transmit support has been verified by using the crc-mmbTools DAB sdr transmitter.
.SH IQ File Source
.TP
Argument
Notes
.TP
file=<path-to-file-name>
.TP
freq=<frequency>
Center frequency in Hz, accepts eng notation
.TP
rate=<sampling-rate>
Mandatory, in samples/s, accepts eng notation
.TP
repeat=true|false
Default is true
.TP
throttle=true|false
Throttle flow of samples, default is true
.SH EXAMPLES
.LP
osmocom_siggen -a hackrf -f 100e6 --sine
.LP
osmocom_siggen -a hackrf -f 100e6 --sweep -x 2M -y 1 -c34
.SH "SEE ALSO"
osmocom_fft(1) osmocom_siggen(1) osmocom_spectrum_sense(1)

View File

@ -1,224 +0,0 @@
.TH osmocom_siggen_nogui "1" "October 2013" "OSMOCOM" "User Commands"
.SH NAME
osmocom_siggen_nogui \- Signal generator application
.SH SYNOPSIS
.B osmocom_siggen_nogui:
[\fIoptions\fR]
.SH DESCRIPTION
Signal generator application
.SH OPTIONS
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-a\fR ARGS, \fB\-\-args\fR=\fIARGS\fR
Device args, [default=]
.TP
\fB\-A\fR ANTENNA, \fB\-\-antenna\fR=\fIANTENNA\fR
Select Rx Antenna where appropriate
.TP
\fB\-s\fR SAMP_RATE, \fB\-\-samp\-rate\fR=\fISAMP_RATE\fR
Set sample rate (bandwidth), minimum by default
.TP
\fB\-g\fR GAIN, \fB\-\-gain\fR=\fIGAIN\fR
Set gain in dB (default is midpoint)
.TP
\fB\-f\fR FREQ, \fB\-\-tx\-freq\fR=\fIFREQ\fR
Set carrier frequency to FREQ [default=mid\-point]
.TP
\fB\-c\fR FREQ_CORR, \fB\-\-freq\-corr\fR=\fIFREQ_CORR\fR
Set carrier frequency correction [default=0]
.TP
\fB\-x\fR WAVEFORM_FREQ, \fB\-\-waveform\-freq\fR=\fIWAVEFORM_FREQ\fR
Set baseband waveform frequency to FREQ [default=0]
.TP
\fB\-y\fR WAVEFORM2_FREQ, \fB\-\-waveform2\-freq\fR=\fIWAVEFORM2_FREQ\fR
Set 2nd waveform frequency to FREQ [default=none]
.TP
\fB\-\-sine\fR
Generate a carrier modulated by a complex sine wave
.TP
\fB\-\-const\fR
Generate a constant carrier
.TP
\fB\-\-offset\fR=\fIOFFSET\fR
Set waveform phase offset to OFFSET [default=0]
.TP
\fB\-\-gaussian\fR
Generate Gaussian random output
.TP
\fB\-\-uniform\fR
Generate Uniform random output
.TP
\fB\-\-2tone\fR
Generate Two Tone signal for IMD testing
.TP
\fB\-\-sweep\fR
Generate a swept sine wave
.TP
\fB\-\-gsm\fR
Generate GMSK modulated GSM Burst Sequence
.TP
\fB\-\-amplitude\fR=\fIAMPL\fR
Set output amplitude to AMPL (0.1\-1.0) [default=0.3]
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Use verbose console output [default=False]
.PP
Note: failed to enable realtime scheduling, continuing
.SH Device specification
You can specify the source or sink device using a comma separated string of argument=value pairs. The always-up-to-date block documentation with examples is available right here.
.SH FCD Source
.TP
Argument
Notes
.TP
fcd=<device-index>
0-based device identifier, optional
.TP
device=hw:2
overrides the audio device
.TP
type=2
selects the dongle type, 1 for Classic, 2 for Pro+
.LP
The "device" argument overrides the audio device used by the underlying driver to access the dongle's IQ sample stream.
.LP
The "type" argument selects the dongle type, 1 for Classic, 2 for Pro+.
.SH OsmoSDR Source
.TP
Argument
Notes
.TP
osmosdr=<device-index>
0-based device identifier
.TP
buffers=<number-of-buffers>
Default is 32
.TP
buflen=<length-of-buffer>
Default is 256kB, must be multiple of 512
.SH RTL-SDR Source
.TP
Argument
Notes
.TP
rtl=<device-index>
0-based device identifier OR serial number
.TP
rtl_xtal=<frequency>
Frequency (Hz) used for the RTL chip, accepts eng notation
.TP
tuner_xtal=<frequency>
Frequency (Hz) used for the tuner chip, accepts eng notation
.TP
buffers=<number-of-buffers>
Default is 32
.TP
buflen=<length-of-buffer>
Default is 256kB, must be multiple of 512
.TP
direct_samp=0|1|2
Enable direct sampling mode on the RTL chip. 0: Disable, 1: use I channel, 2: use Q channel
.TP
offset_tune=0|1
Enable offset tune mode for E4000 tuners
.LP
NOTE: use rtl_eeprom -s to program your own serial number to the device
.LP
NOTE: if you don't specify rtl_xtal/tuner_xtal, the underlying driver will use 28.0MHz
.SH RTL-SDR TCP Source
.TP
Argument
Notes
.TP
rtl_tcp=<hostname>:<port>
hostname defaults to "localhost", port to "1234"
.TP
psize=<payload-size>
Default is 16384 bytes
.TP
direct_samp=0|1|2
Enable direct sampling mode on the RTL chip 0=Off, 1=I-ADC input enabled, 2=Q-ADC input enabled
.TP
offset_tune=0|1
Enable offset tune mode for E4000 tuners
.SH Miri Source
.TP
Argument
Notes
.TP
miri=<device-index>
0-based device identifier
.TP
buffers=<number-of-buffers>
Default is 32
.SH UHD Source / Sink
Argument
Notes
.TP
uhd
Use this argument without a value
.TP
nchan=<channel-count>
For multichannel USRP configurations use the subdev parameter to specify stream mapping
.TP
subdev=<subdev-spec>
Examples: "A:0", "B:0", "A:0 B:0" when nchan=2. Refer original ettus documentation on this
.TP
lo_offset=<frequency>
Offset frequency in Hz, must be within daughterboard bandwidth. Accepts eng notation
.LP
Additional argument/value pairs will be passed to the underlying driver, for more information see specifying the subdevice and common device identifiers in the Ettus documentation.
.SH bladeRF Source / Sink
.TP
Argument
Notes
.TP
bladerf[=0]
0-based device identifier (optional)
.TP
fw='/path/to/the/firmware.img'
program MCU firmware from given file. usually not needed. power cycle required.
.TP
fpga='/path/to/the/bitstream.rbf'
load FPGA bitstream from given file. required only at first run at the moment.
.SH HackRF Source / Sink
.TP
Argument
Notes
.TP
hackrf
Use this argument without a value
.TP
buffers=<number-of-buffers>
Default is 32
.LP
Only the first device found may be used at the moment because of libhackrf limitation.
.LP
Transmit support has been verified by using the crc-mmbTools DAB sdr transmitter.
.SH IQ File Source
.TP
Argument
Notes
.TP
file=<path-to-file-name>
.TP
freq=<frequency>
Center frequency in Hz, accepts eng notation
.TP
rate=<sampling-rate>
Mandatory, in samples/s, accepts eng notation
.TP
repeat=true|false
Default is true
.TP
throttle=true|false
Throttle flow of samples, default is true
.SH EXAMPLES
.LP
osmocom_siggen_nogui -a hackrf -f 100e6 --sweep -x 2e6 -y 10 -v
.LP
osmocom_siggen_nogui -a uhd,subdev=A:0 -f 100e6 --sweep -x 2e6 -y 10 -s 4e6 -v
.SH "SEE ALSO"
osmocom_fft(1) osmocom_siggen(1) osmocom_spectrum_sense(1)

View File

@ -1,196 +0,0 @@
.TH osmocom_spectrum_sense "1" "October 2013" "OSMOCOMM" "User Commands"
.SH NAME
osmocom_spectrum_sense \- GNU Radio application from OsmoSDR
.SH SYNOPSIS
.B osmocom_spectrum_sense
[\fIoptions\fR] \fImin_freq max_freq\fR
.SH DESCRIPTION
GNU Radio application from OsmoSDR
.SH OPTIONS
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-a\fR ARGS, \fB\-\-args\fR=\fIARGS\fR
Device args [default=]
.TP
\fB\-A\fR ANTENNA, \fB\-\-antenna\fR=\fIANTENNA\fR
Select antenna where appropriate
.TP
\fB\-s\fR SAMP_RATE, \fB\-\-samp\-rate\fR=\fISAMP_RATE\fR
Set sample rate (bandwidth), minimum by default
.TP
\fB\-g\fR GAIN, \fB\-\-gain\fR=\fIGAIN\fR
Set gain in dB (default is midpoint)
.TP
\fB\-\-tune\-delay\fR=\fISECS\fR
Time to delay (in seconds) after changing frequency
[default=0.25]
.TP
\fB\-\-dwell\-delay\fR=\fISECS\fR
Time to dwell (in seconds) at a given frequency
[default=0.25]
.TP
\fB\-b\fR Hz, \fB\-\-channel\-bandwidth\fR=\fIHz\fR
Channel bandwidth of fft bins in Hz [default=6250.0]
.TP
\fB\-q\fR dB, \fB\-\-squelch\-threshold\fR=\fIdB\fR
Squelch threshold in dB [default=none]
.TP
\fB\-F\fR FFT_SIZE, \fB\-\-fft\-size\fR=\fIFFT_SIZE\fR
Specify number of FFT bins
[default=samp_rate/channel_bw]
.TP
\fB\-\-real\-time\fR
Attempt to enable real\-time scheduling
.SH Device specification
You can specify the source or sink device using a comma separated string of argument=value pairs. The always-up-to-date block documentation with examples is available right here.
.SH FCD Source
.TP
Argument
Notes
.TP
fcd=<device-index>
0-based device identifier, optional
.TP
device=hw:2
overrides the audio device
.TP
type=2
selects the dongle type, 1 for Classic, 2 for Pro+
.LP
The "device" argument overrides the audio device used by the underlying driver to access the dongle's IQ sample stream.
.LP
The "type" argument selects the dongle type, 1 for Classic, 2 for Pro+.
.SH OsmoSDR Source
.TP
Argument
Notes
.TP
osmosdr=<device-index>
0-based device identifier
.TP
buffers=<number-of-buffers>
Default is 32
.TP
buflen=<length-of-buffer>
Default is 256kB, must be multiple of 512
.SH RTL-SDR Source
.TP
Argument
Notes
.TP
rtl=<device-index>
0-based device identifier OR serial number
.TP
rtl_xtal=<frequency>
Frequency (Hz) used for the RTL chip, accepts eng notation
.TP
tuner_xtal=<frequency>
Frequency (Hz) used for the tuner chip, accepts eng notation
.TP
buffers=<number-of-buffers>
Default is 32
.TP
buflen=<length-of-buffer>
Default is 256kB, must be multiple of 512
.TP
direct_samp=0|1|2
Enable direct sampling mode on the RTL chip. 0: Disable, 1: use I channel, 2: use Q channel
.TP
offset_tune=0|1
Enable offset tune mode for E4000 tuners
.LP
NOTE: use rtl_eeprom -s to program your own serial number to the device
.LP
NOTE: if you don't specify rtl_xtal/tuner_xtal, the underlying driver will use 28.0MHz
.SH RTL-SDR TCP Source
.TP
Argument
Notes
.TP
rtl_tcp=<hostname>:<port>
hostname defaults to "localhost", port to "1234"
.TP
psize=<payload-size>
Default is 16384 bytes
.TP
direct_samp=0|1|2
Enable direct sampling mode on the RTL chip 0=Off, 1=I-ADC input enabled, 2=Q-ADC input enabled
.TP
offset_tune=0|1
Enable offset tune mode for E4000 tuners
.SH Miri Source
.TP
Argument
Notes
.TP
miri=<device-index>
0-based device identifier
.TP
buffers=<number-of-buffers>
Default is 32
.SH UHD Source / Sink
Argument
Notes
.TP
uhd
Use this argument without a value
.TP
nchan=<channel-count>
For multichannel USRP configurations use the subdev parameter to specify stream mapping
.TP
subdev=<subdev-spec>
Examples: "A:0", "B:0", "A:0 B:0" when nchan=2. Refer original ettus documentation on this
.TP
lo_offset=<frequency>
Offset frequency in Hz, must be within daughterboard bandwidth. Accepts eng notation
.LP
Additional argument/value pairs will be passed to the underlying driver, for more information see specifying the subdevice and common device identifiers in the Ettus documentation.
.SH bladeRF Source / Sink
.TP
Argument
Notes
.TP
bladerf[=0]
0-based device identifier (optional)
.TP
fw='/path/to/the/firmware.img'
program MCU firmware from given file. usually not needed. power cycle required.
.TP
fpga='/path/to/the/bitstream.rbf'
load FPGA bitstream from given file. required only at first run at the moment.
.SH HackRF Source / Sink
.TP
Argument
Notes
.TP
hackrf
Use this argument without a value
.TP
buffers=<number-of-buffers>
Default is 32
.LP
Only the first device found may be used at the moment because of libhackrf limitation.
.LP
Transmit support has been verified by using the crc-mmbTools DAB sdr transmitter.
.SH IQ File Source
.TP
Argument
Notes
.TP
file=<path-to-file-name>
.TP
freq=<frequency>
Center frequency in Hz, accepts eng notation
.TP
rate=<sampling-rate>
Mandatory, in samples/s, accepts eng notation
.TP
repeat=true|false
Default is true
.TP
throttle=true|false
Throttle flow of samples, default is true
.SH "SEE ALSO"
osmocom_fft(1) osmocom_siggen(1) osmocom_siggen_nogui(1)

29
debian/rules vendored
View File

@ -1,29 +0,0 @@
#!/usr/bin/make -f
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_HOST_MULTIARCH
DEB_DEBIAN_DIR=$(dir $(firstword $(MAKEFILE_LIST)))
VER=$(shell dpkg-parsechangelog -l$(DEB_DEBIAN_DIR)/changelog \
| sed -rne 's,^Version: ([^-]+).*,\1,p')
GITREV=$(shell echo $(VER) | sed -rne 's,[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\.([0-f]+),\1,p')
%:
dh $@ --with python2
override_dh_auto_configure:
dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DPythonLibs_FIND_VERSION:STRING="2.7" -DPYTHON_EXECUTABLE:STRING="/usr/bin/python"
override_dh_auto_install:
dh_auto_install
rm -f debian/gr-osmosdr/usr/lib/python2.7/dist-packages/osmosdr/*pyc
rm -f debian/gr-osmosdr/usr/lib/python2.7/dist-packages/osmosdr/*pyo
override_dh_makeshlibs:
dh_makeshlibs -V 'libgnuradio-osmosdr0.1.4 (>= 0.1.4-13)'
version-to-get:
echo $(VER) is $(GITREV)
get-orig-source: version-to-get
git clone https://gitea.osmocom.org/sdr/gr-osmosdr
cd gr-osmosdr && git archive --format=tar --prefix=gr-osmosdr-$(VER)/ $(GITREV) | xz > ../gr-osmosdr_$(VER).orig.tar.xz
rm -rf gr-osmosdr

View File

@ -1 +0,0 @@
3.0 (native)

3
debian/watch vendored
View File

@ -1,3 +0,0 @@
version=3
opts="downloadurlmangle=s/refs\/tags/snapshot/,uversionmangle=s|(.*)git|1|" \
http://cgit.osmocom.org/gr-osmosdr/refs/tags /gr-osmosdr/snapshot/gr-osmosdr-(\d.*)\.tar\.xz

View File

@ -1,19 +0,0 @@
#ifndef PYDOC_MACROS_H
#define PYDOC_MACROS_H
#define __EXPAND(x) x
#define __COUNT(_1, _2, _3, _4, _5, _6, _7, COUNT, ...) COUNT
#define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1))
#define __CAT1(a, b) a##b
#define __CAT2(a, b) __CAT1(a, b)
#define __DOC1(n1) __doc_##n1
#define __DOC2(n1, n2) __doc_##n1##_##n2
#define __DOC3(n1, n2, n3) __doc_##n1##_##n2##_##n3
#define __DOC4(n1, n2, n3, n4) __doc_##n1##_##n2##_##n3##_##n4
#define __DOC5(n1, n2, n3, n4, n5) __doc_##n1##_##n2##_##n3##_##n4##_##n5
#define __DOC6(n1, n2, n3, n4, n5, n6) __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6
#define __DOC7(n1, n2, n3, n4, n5, n6, n7) \
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7
#define DOC(...) __EXPAND(__EXPAND(__CAT2(__DOC, __VA_SIZE(__VA_ARGS__)))(__VA_ARGS__))
#endif // PYDOC_MACROS_H

View File

@ -2,22 +2,34 @@
# Copyright 2010-2012 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gnuradio
# This file is a part of gr-osmosdr
#
# SPDX-License-Identifier: GPL-3.0-or-later
# GNU Radio 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, or (at your option)
# any later version.
#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
"""
Updates the *pydoc_h files for a module
Execute using: python update_pydoc.py xml_path outputfilename
Creates the swig_doc.i SWIG interface file.
Execute using: python swig_doc.py xml_path outputfilename
The file instructs Pybind11 to transfer the doxygen comments into the
The file instructs SWIG to transfer the doxygen comments into the
python docstrings.
"""
from __future__ import unicode_literals
import os, sys, time, glob, re, json
from argparse import ArgumentParser
import sys, time
from doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile
from doxyxml import DoxyOther, base
@ -75,7 +87,6 @@ def utoascii(text):
return ''
out = text.encode('ascii', 'replace')
# swig will require us to replace blackslash with 4 backslashes
# TODO: evaluate what this should be for pybind11
out = out.replace(b'\\', b'\\\\\\\\')
out = out.replace(b'"', b'\\"').decode('ascii')
return str(out)
@ -104,7 +115,7 @@ def format_params(parameteritems):
entry_templ = '%feature("docstring") {name} "{docstring}"'
def make_entry(obj, name=None, templ="{description}", description=None, params=[]):
"""
Create a docstring key/value pair, where the key is the object name.
Create a docstring entry for a swig interface file.
obj - a doxyxml object from which documentation will be extracted.
name - the name of the C object (defaults to obj.name())
@ -115,8 +126,6 @@ def make_entry(obj, name=None, templ="{description}", description=None, params=[
"""
if name is None:
name=obj.name()
if hasattr(obj,'_parse_data') and hasattr(obj._parse_data,'definition'):
name=obj._parse_data.definition.split(' ')[-1]
if "operator " in name:
return ''
if description is None:
@ -125,28 +134,56 @@ def make_entry(obj, name=None, templ="{description}", description=None, params=[
description += '\n\n'
description += utoascii(format_params(params))
docstring = templ.format(description=description)
if not docstring:
return ''
return entry_templ.format(
name=name,
docstring=docstring,
)
return {name: docstring}
def make_func_entry(func, name=None, description=None, params=None):
"""
Create a function docstring entry for a swig interface file.
func - a doxyxml object from which documentation will be extracted.
name - the name of the C object (defaults to func.name())
description - if this optional variable is set then it's value is
used as the description instead of extracting it from func.
params - a parameter list that overrides using func.params.
"""
#if params is None:
# params = func.params
#params = [prm.declname for prm in params]
#if params:
# sig = "Params: (%s)" % ", ".join(params)
#else:
# sig = "Params: (NONE)"
#templ = "{description}\n\n" + sig
#return make_entry(func, name=name, templ=utoascii(templ),
# description=description)
return make_entry(func, name=name, description=description, params=params)
def make_class_entry(klass, description=None, ignored_methods=[], params=None):
"""
Create a class docstring key/value pair.
Create a class docstring for a swig interface file.
"""
if params is None:
params = klass.params
output = {}
output.update(make_entry(klass, description=description, params=params))
output = []
output.append(make_entry(klass, description=description, params=params))
for func in klass.in_category(DoxyFunction):
if func.name() not in ignored_methods:
name = klass.name() + '::' + func.name()
output.update(make_entry(func, name=name))
return output
output.append(make_func_entry(func, name=name))
return "\n\n".join(output)
def make_block_entry(di, block):
"""
Create class and function docstrings of a gnuradio block
Create class and function docstrings of a gnuradio block for a
swig interface file.
"""
descriptions = []
# Get the documentation associated with the class.
@ -171,16 +208,18 @@ def make_block_entry(di, block):
super_description = "\n\n".join(descriptions)
# Associate the combined description with the class and
# the make function.
output = {}
output.update(make_class_entry(block, description=super_description))
output.update(make_entry(make_func, description=super_description,
output = []
output.append(make_class_entry(block, description=super_description))
output.append(make_func_entry(make_func, description=super_description,
params=block.params))
return output
return "\n\n".join(output)
def make_block2_entry(di, block):
"""
Create class and function docstrings of a new style gnuradio block
Create class and function docstrings of a new style gnuradio block for a
swig interface file.
"""
descriptions = []
# For new style blocks all the relevant documentation should be
# associated with the 'make' method.
class_description = combine_descriptions(block)
@ -189,21 +228,28 @@ def make_block2_entry(di, block):
description = class_description + "\n\nConstructor Specific Documentation:\n\n" + make_description
# Associate the combined description with the class and
# the make function.
output = {}
output.update(make_class_entry(
output = []
output.append(make_class_entry(
block, description=description,
ignored_methods=['make'], params=make_func.params))
makename = block.name() + '::make'
output.update(make_entry(
output.append(make_func_entry(
make_func, name=makename, description=description,
params=make_func.params))
return output
return "\n\n".join(output)
def get_docstrings_dict(di, custom_output=None):
def make_swig_interface_file(di, swigdocfilename, custom_output=None):
output = {}
if custom_output:
output.update(custom_output)
output = ["""
/*
* This file was automatically generated using swig_doc.py.
*
* Any changes to it will be lost next time it is regenerated.
*/
"""]
if custom_output is not None:
output.append(custom_output)
# Create docstrings for the blocks.
blocks = di.in_category(Block)
@ -216,7 +262,7 @@ def get_docstrings_dict(di, custom_output=None):
# Don't want to risk writing to output twice.
if make_func.name() not in make_funcs:
make_funcs.add(make_func.name())
output.update(make_block_entry(di, block))
output.append(make_block_entry(di, block))
except block.ParsingError:
sys.stderr.write('Parsing error for block {0}\n'.format(block.name()))
raise
@ -228,7 +274,7 @@ def get_docstrings_dict(di, custom_output=None):
# Don't want to risk writing to output twice.
if make_func_name not in make_funcs:
make_funcs.add(make_func_name)
output.update(make_block2_entry(di, block))
output.append(make_block2_entry(di, block))
except block.ParsingError:
sys.stderr.write('Parsing error for block {0}\n'.format(block.name()))
raise
@ -239,7 +285,7 @@ def get_docstrings_dict(di, custom_output=None):
if f.name() not in make_funcs and not f.name().startswith('std::')]
for f in funcs:
try:
output.update(make_entry(f))
output.append(make_func_entry(f))
except f.ParsingError:
sys.stderr.write('Parsing error for function {0}\n'.format(f.name()))
@ -250,97 +296,37 @@ def get_docstrings_dict(di, custom_output=None):
if k.name() not in block_names and not k.name().startswith('std::')]
for k in klasses:
try:
output.update(make_class_entry(k))
output.append(make_class_entry(k))
except k.ParsingError:
sys.stderr.write('Parsing error for class {0}\n'.format(k.name()))
# Docstrings are not created for anything that is not a function or a class.
# If this excludes anything important please add it here.
return output
output = "\n\n".join(output)
def sub_docstring_in_pydoc_h(pydoc_files, docstrings_dict, output_dir, filter_str=None):
if filter_str:
docstrings_dict = {k: v for k, v in docstrings_dict.items() if k.startswith(filter_str)}
with open(os.path.join(output_dir,'docstring_status'),'w') as status_file:
for pydoc_file in pydoc_files:
if filter_str:
filter_str2 = "::".join((filter_str,os.path.split(pydoc_file)[-1].split('_pydoc_template.h')[0]))
docstrings_dict2 = {k: v for k, v in docstrings_dict.items() if k.startswith(filter_str2)}
else:
docstrings_dict2 = docstrings_dict
file_in = open(pydoc_file,'r').read()
for key, value in docstrings_dict2.items():
file_in_tmp = file_in
try:
doc_key = key.split("::")
# if 'gr' in doc_key:
# doc_key.remove('gr')
doc_key = '_'.join(doc_key)
regexp = r'(__doc_{} =\sR\"doc\()[^)]*(\)doc\")'.format(doc_key)
regexp = re.compile(regexp, re.MULTILINE)
(file_in, nsubs) = regexp.subn(r'\1'+value+r'\2', file_in, count=1)
if nsubs == 1:
status_file.write("PASS: " + pydoc_file + "\n")
except KeyboardInterrupt:
raise KeyboardInterrupt
except: # be permissive, TODO log, but just leave the docstring blank
status_file.write("FAIL: " + pydoc_file + "\n")
file_in = file_in_tmp
output_pathname = os.path.join(output_dir, os.path.basename(pydoc_file).replace('_template.h','.h'))
# FIXME: Remove this debug print
print('output docstrings to {}'.format(output_pathname))
with open(output_pathname,'w') as file_out:
file_out.write(file_in)
def copy_docstring_templates(pydoc_files, output_dir):
with open(os.path.join(output_dir,'docstring_status'),'w') as status_file:
for pydoc_file in pydoc_files:
file_in = open(pydoc_file,'r').read()
output_pathname = os.path.join(output_dir, os.path.basename(pydoc_file).replace('_template.h','.h'))
# FIXME: Remove this debug print
print('copy docstrings to {}'.format(output_pathname))
with open(output_pathname,'w') as file_out:
file_out.write(file_in)
status_file.write("DONE")
def argParse():
"""Parses commandline args."""
desc='Scrape the doxygen generated xml for docstrings to insert into python bindings'
parser = ArgumentParser(description=desc)
parser.add_argument("function", help="Operation to perform on docstrings", choices=["scrape","sub","copy"])
parser.add_argument("--xml_path")
parser.add_argument("--bindings_dir")
parser.add_argument("--output_dir")
parser.add_argument("--json_path")
parser.add_argument("--filter", default=None)
return parser.parse_args()
swig_doc = open(swigdocfilename, 'w')
swig_doc.write(output)
swig_doc.close()
if __name__ == "__main__":
# Parse command line options and set up doxyxml.
args = argParse()
if args.function.lower() == 'scrape':
di = DoxyIndex(args.xml_path)
docstrings_dict = get_docstrings_dict(di)
with open(args.json_path, 'w') as fp:
json.dump(docstrings_dict, fp)
elif args.function.lower() == 'sub':
with open(args.json_path, 'r') as fp:
docstrings_dict = json.load(fp)
pydoc_files = glob.glob(os.path.join(args.bindings_dir,'*_pydoc_template.h'))
sub_docstring_in_pydoc_h(pydoc_files, docstrings_dict, args.output_dir, args.filter)
elif args.function.lower() == 'copy':
pydoc_files = glob.glob(os.path.join(args.bindings_dir,'*_pydoc_template.h'))
copy_docstring_templates(pydoc_files, args.output_dir)
err_msg = "Execute using: python swig_doc.py xml_path outputfilename"
if len(sys.argv) != 3:
raise Exception(err_msg)
xml_path = sys.argv[1]
swigdocfilename = sys.argv[2]
di = DoxyIndex(xml_path)
# gnuradio.gr.msq_queue.insert_tail and delete_head create errors unless docstrings are defined!
# This is presumably a bug in SWIG.
#msg_q = di.get_member(u'gr_msg_queue', DoxyClass)
#insert_tail = msg_q.get_member(u'insert_tail', DoxyFunction)
#delete_head = msg_q.get_member(u'delete_head', DoxyFunction)
output = []
#output.append(make_func_entry(insert_tail, name='gr_py_msg_queue__insert_tail'))
#output.append(make_func_entry(delete_head, name='gr_py_msg_queue__delete_head'))
custom_output = "\n\n".join(output)
# Generate the docstrings interface file.
make_swig_interface_file(di, swigdocfilename, custom_output=custom_output)

View File

@ -159,7 +159,6 @@ documentation: |-
% if sourk == 'source':
* RTL2832U based DVB-T dongles through librtlsdr
* RTL-TCP spectrum server (see librtlsdr project)
* MSi2500 based DVB-T dongles through libmirisdr
* SDRplay RSP devices through SDRplay library
* gnuradio .cfile input through libgnuradio-blocks
* RFSPACE SDR-IQ, SDR-IP, NetSDR (incl. X2 option)
@ -192,7 +191,6 @@ documentation: |-
Lines ending with ... mean it's possible to bind devices together by specifying multiple device arguments separated with a space.
% if sourk == 'source':
miri=0[,buffers=32] ...
rtl=serial_number ...
rtl=0[,rtl_xtal=28.8e6][,tuner_xtal=28.8e6] ...
rtl=1[,buffers=32][,buflen=N*512] ...

View File

@ -38,7 +38,7 @@ class sink;
class OSMOSDR_API sink : virtual public gr::hier_block2
{
public:
typedef std::shared_ptr< sink > sptr;
typedef boost::shared_ptr< sink > sptr;
/*!
* \brief Return a shared_ptr to a new instance of sink.

View File

@ -38,7 +38,7 @@ class source;
class OSMOSDR_API source : virtual public gr::hier_block2
{
public:
typedef std::shared_ptr< source > sptr;
typedef boost::shared_ptr< source > sptr;
/*!
* \brief Return a shared_ptr to a new instance of source.
@ -63,7 +63,6 @@ public:
*
* \param seek_point sample offset in file
* \param whence one of SEEK_SET, SEEK_CUR, SEEK_END (man fseek)
* \param chan the channel index 0 to N-1
* \return true on success
*/
virtual bool seek( long seek_point, int whence, size_t chan = 0 ) = 0;

View File

@ -44,7 +44,7 @@ endif()
#this appends all unnamed implicit macro args!
MACRO (APPEND_LIB_LIST)
SET (gr_osmosdr_libs "${gr_osmosdr_libs};${ARGN}" CACHE INTERNAL "lib list")
ENDMACRO (APPEND_LIB_LIST)
ENDMACRO (APPEND_INTERNAL_LIST)
set(gr_osmosdr_libs "" CACHE INTERNAL "lib that accumulates link targets")
@ -138,7 +138,7 @@ endif(ENABLE_IQBALANCE)
########################################################################
# Setup FCD component
########################################################################
GR_REGISTER_COMPONENT("FUNcube Dongle" ENABLE_FCD GNURADIO_FUNCUBE_FOUND)
GR_REGISTER_COMPONENT("FUNcube Dongle" ENABLE_FCD GNURADIO_FCDPP_FOUND)
if(ENABLE_FCD)
add_subdirectory(fcd)
endif(ENABLE_FCD)
@ -175,14 +175,6 @@ if(ENABLE_UHD)
add_subdirectory(uhd)
endif(ENABLE_UHD)
########################################################################
# Setup MiriSDR component
########################################################################
GR_REGISTER_COMPONENT("Osmocom MiriSDR" ENABLE_MIRI LIBMIRISDR_FOUND)
if(ENABLE_MIRI)
add_subdirectory(miri)
endif(ENABLE_MIRI)
########################################################################
# Setup SDRplay component
########################################################################

View File

@ -36,7 +36,7 @@
class airspy_source_c;
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr::blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -44,9 +44,9 @@ class airspy_source_c;
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<airspy_source_c> airspy_source_c_sptr;
typedef boost::shared_ptr<airspy_source_c> airspy_source_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of airspy_source_c.

View File

@ -35,7 +35,7 @@
class airspyhf_source_c;
typedef std::shared_ptr<airspyhf_source_c> airspyhf_source_c_sptr;
typedef boost::shared_ptr<airspyhf_source_c> airspyhf_source_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of airspyhf_source_c.

View File

@ -49,7 +49,7 @@ static size_t const STREAM_TIMEOUT_MS = 3000;
using namespace boost::assign;
std::mutex bladerf_common::_devs_mutex;
std::list<std::weak_ptr<struct bladerf> > bladerf_common::_devs;
std::list<std::weak_ptr<struct bladerf>> bladerf_common::_devs;
/* name for system-wide gain (which is not its own libbladeRF gain stage) */
static const char *SYSTEM_GAIN_NAME = "system";
@ -133,7 +133,7 @@ size_t num_streams(bladerf_channel_layout layout)
* Public methods
******************************************************************************/
bladerf_common::bladerf_common() :
_dev(std::shared_ptr<struct bladerf>()),
_dev(NULL),
_pfx("[bladeRF common] "),
_failures(0),
_num_buffers(NUM_BUFFERS),
@ -1107,7 +1107,7 @@ bladerf_sptr bladerf_common::open(std::string const &device_name)
/* Add the device handle to our cache */
bladerf_sptr dev = bladerf_sptr(raw_dev, bladerf_common::close);
_devs.push_back(static_cast<std::weak_ptr<struct bladerf> >(dev));
_devs.push_back(static_cast<std::weak_ptr<struct bladerf>>(dev));
return dev;
}
@ -1115,7 +1115,7 @@ bladerf_sptr bladerf_common::open(std::string const &device_name)
void bladerf_common::close(void *dev)
{
std::lock_guard<std::mutex> lock(_devs_mutex);
std::list<std::weak_ptr<struct bladerf> >::iterator it(_devs.begin());
std::list<std::weak_ptr<struct bladerf>>::iterator it(_devs.begin());
/* Prune expired entries from device cache */
while (it != _devs.end()) {

View File

@ -287,7 +287,7 @@ private:
* Private members
****************************************************************************/
static std::mutex _devs_mutex; /**< mutex for access to _devs */
static std::list<std::weak_ptr<struct bladerf> > _devs; /**< dev cache */
static std::list<std::weak_ptr<struct bladerf>> _devs; /**< dev cache */
};
#endif

View File

@ -66,7 +66,7 @@
}
/* Changed enums/defines */
#define BLADERF_GAIN_DEFAULT BLADERF_GAIN_MANUAL
#define BLADERF_GAIN_DEFAULT BLADERF_GAIN_AUTOMATIC
#define BLADERF_GAIN_MGC BLADERF_GAIN_MANUAL
#define BLADERF_RX_MUX_BASEBAND BLADERF_RX_MUX_BASEBAND_LMS

View File

@ -174,9 +174,11 @@ bool bladerf_sink_c::start()
for (size_t ch = 0; ch < get_max_channels(); ++ch) {
bladerf_channel brfch = BLADERF_CHANNEL_TX(ch);
status = bladerf_enable_module(_dev.get(), brfch, get_channel_enable(brfch));
if (status != 0) {
BLADERF_THROW_STATUS(status, "bladerf_enable_module failed");
if (get_channel_enable(brfch)) {
status = bladerf_enable_module(_dev.get(), brfch, true);
if (status != 0) {
BLADERF_THROW_STATUS(status, "bladerf_enable_module failed");
}
}
}
@ -208,9 +210,11 @@ bool bladerf_sink_c::stop()
for (size_t ch = 0; ch < get_max_channels(); ++ch) {
bladerf_channel brfch = BLADERF_CHANNEL_TX(ch);
status = bladerf_enable_module(_dev.get(), brfch, get_channel_enable(brfch));
if (status != 0) {
BLADERF_THROW_STATUS(status, "bladerf_enable_module failed");
if (get_channel_enable(brfch)) {
status = bladerf_enable_module(_dev.get(), brfch, false);
if (status != 0) {
BLADERF_THROW_STATUS(status, "bladerf_enable_module failed");
}
}
}

View File

@ -30,7 +30,7 @@
class bladerf_sink_c;
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -38,9 +38,9 @@ class bladerf_sink_c;
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<bladerf_sink_c> bladerf_sink_c_sptr;
typedef boost::shared_ptr<bladerf_sink_c> bladerf_sink_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of bladerf_sink_c.

View File

@ -112,15 +112,6 @@ bladerf_source_c::bladerf_source_c(const std::string &args) :
/* RX Mux */
set_rx_mux_mode(dict.count("rxmux") ? dict["rxmux"] : "baseband");
/* Ref in frequency */
if (dict.count("refin_freq")) {
status = bladerf_set_pll_refclk(_dev.get(), boost::lexical_cast< uint64_t >(dict["refin_freq"]));
if (status != 0) {
BLADERF_WARNING("Problem while setting refin_freq: " <<
bladerf_strerror(status));
}
}
/* AGC mode */
if (dict.count("agc_mode")) {
set_agc_mode(dict["agc_mode"]);
@ -239,9 +230,11 @@ bool bladerf_source_c::start()
for (size_t ch = 0; ch < get_max_channels(); ++ch) {
bladerf_channel brfch = BLADERF_CHANNEL_RX(ch);
status = bladerf_enable_module(_dev.get(), brfch, get_channel_enable(brfch));
if (status != 0) {
BLADERF_THROW_STATUS(status, "bladerf_enable_module failed");
if (get_channel_enable(brfch)) {
status = bladerf_enable_module(_dev.get(), brfch, true);
if (status != 0) {
BLADERF_THROW_STATUS(status, "bladerf_enable_module failed");
}
}
}
@ -351,7 +344,7 @@ int bladerf_source_c::work(int noutput_items,
memcpy(out[0], _32fcbuf, sizeof(gr_complex) * noutput_items);
}
return noutput_items/(get_num_channels());
return noutput_items;
}
osmosdr::meta_range_t bladerf_source_c::get_sample_rates()

View File

@ -30,7 +30,7 @@
class bladerf_source_c;
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -38,9 +38,9 @@ class bladerf_source_c;
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<bladerf_source_c> bladerf_source_c_sptr;
typedef boost::shared_ptr<bladerf_source_c> bladerf_source_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of bladerf_source_c.

View File

@ -9,7 +9,6 @@
#cmakedefine ENABLE_RTL
#cmakedefine ENABLE_RTL_TCP
#cmakedefine ENABLE_UHD
#cmakedefine ENABLE_MIRI
#cmakedefine ENABLE_SDRPLAY
#cmakedefine ENABLE_HACKRF
#cmakedefine ENABLE_BLADERF

View File

@ -49,10 +49,6 @@
#include <uhd_source_c.h>
#endif
#ifdef ENABLE_MIRI
#include <miri_source_c.h>
#endif
#ifdef ENABLE_SDRPLAY
#include <sdrplay_source_c.h>
#endif
@ -157,10 +153,6 @@ devices_t device::find(const device_t &hint)
for (std::string dev : uhd_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_MIRI
for (std::string dev : miri_source_c::get_devices())
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_SDRPLAY
for (std::string dev : sdrplay_source_c::get_devices())
devices.push_back( device_t(dev) );

View File

@ -23,11 +23,11 @@
target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${GNURADIO_FUNCUBE_INCLUDE_DIRS}
${GNURADIO_FCDPP_INCLUDE_DIRS}
)
APPEND_LIB_LIST(
${GNURADIO_FUNCUBE_LIBRARIES}
${GNURADIO_FCDPP_LIBRARIES}
)
list(APPEND gr_osmosdr_srcs

View File

@ -143,7 +143,7 @@ fcd_source_c::fcd_source_c(const std::string &args) :
if ( FUNCUBE_V1 == _type )
{
_src_v1 = gr::funcube::fcd::make( dev_name );
_src_v1 = gr::fcdproplus::fcd::make( dev_name );
connect( _src_v1, 0, self(), 0 );
set_gain( 20, "LNA" );
@ -152,7 +152,7 @@ fcd_source_c::fcd_source_c(const std::string &args) :
if ( FUNCUBE_V2 == _type )
{
_src_v2 = gr::funcube::fcdpp::make( dev_name );
_src_v2 = gr::fcdproplus::fcdproplus::make( dev_name );
connect( _src_v2, 0, self(), 0 );
set_gain( 1, "LNA" );
@ -237,10 +237,10 @@ 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 )
{
if ( FUNCUBE_V1 == _type )
_src_v1->set_freq( freq );
_src_v1->set_freq( float(freq) );
if ( FUNCUBE_V2 == _type )
_src_v2->set_freq( freq );
_src_v2->set_freq( float(freq) );
_freq = freq;

View File

@ -22,14 +22,14 @@
#include <gnuradio/hier_block2.h>
#include <funcube/fcd.h>
#include <funcube/fcdpp.h>
#include <fcdproplus/fcd.h>
#include <fcdproplus/fcdproplus.h>
#include "source_iface.h"
class fcd_source_c;
typedef std::shared_ptr< fcd_source_c > fcd_source_c_sptr;
typedef boost::shared_ptr< fcd_source_c > fcd_source_c_sptr;
fcd_source_c_sptr make_fcd_source_c( const std::string & args = "" );
@ -81,10 +81,10 @@ public:
private:
dongle_type _type;
gr::funcube::fcd::sptr _src_v1;
gr::funcube::fcdpp::sptr _src_v2;
gr::fcdproplus::fcd::sptr _src_v1;
gr::fcdproplus::fcdproplus::sptr _src_v2;
double _lna_gain, _mix_gain, _bb_gain, _freq;
double _correct;
int _correct;
};
#endif // FCD_SOURCE_C_H

View File

@ -28,7 +28,7 @@
class file_sink_c;
typedef std::shared_ptr< file_sink_c > file_sink_c_sptr;
typedef boost::shared_ptr< file_sink_c > file_sink_c_sptr;
file_sink_c_sptr make_file_sink_c( const std::string & args = "" );

View File

@ -28,7 +28,7 @@
class file_source_c;
typedef std::shared_ptr< file_source_c > file_source_c_sptr;
typedef boost::shared_ptr< file_source_c > file_source_c_sptr;
file_source_c_sptr make_file_source_c( const std::string & args = "" );

View File

@ -6,11 +6,13 @@
#include <arg_helpers.h>
using namespace FreeSRP;
using namespace std;
using namespace boost::assign;
std::shared_ptr<::FreeSRP::FreeSRP> freesrp_common::_srp;
freesrp_common::freesrp_common(const std::string &args)
freesrp_common::freesrp_common(const string &args)
{
dict_t dict = params_to_dict(args);
@ -18,7 +20,7 @@ freesrp_common::freesrp_common(const std::string &args)
{
try
{
std::string serial = "";
string serial = "";
if(dict.count("freesrp"))
{
@ -27,22 +29,22 @@ freesrp_common::freesrp_common(const std::string &args)
if(dict.count("fx3"))
{
if(FreeSRP::Util::find_fx3())
if(Util::find_fx3())
{
// Upload firmware to FX3
std::string firmware_path = std::string(getenv("HOME")) + "/.freesrp/fx3.img";
string firmware_path = string(getenv("HOME")) + "/.freesrp/fx3.img";
if(dict["fx3"].length() > 0)
{
firmware_path = dict["fx3"];
}
FreeSRP::Util::find_fx3(true, firmware_path);
std::cout << "FX3 programmed with '" << firmware_path << "'" << std::endl;
Util::find_fx3(true, firmware_path);
cout << "FX3 programmed with '" << firmware_path << "'" << endl;
// Give FX3 time to re-enumerate
std::this_thread::sleep_for(std::chrono::milliseconds(600));
this_thread::sleep_for(chrono::milliseconds(600));
}
else
{
std::cout << "No FX3 in bootloader mode found" << std::endl;
cout << "No FX3 in bootloader mode found" << endl;
}
}
@ -50,45 +52,45 @@ freesrp_common::freesrp_common(const std::string &args)
if(dict.count("fpga") || !_srp->fpga_loaded())
{
std::string bitstream_path = std::string(getenv("HOME")) + "/.freesrp/fpga.bin";
string bitstream_path = string(getenv("HOME")) + "/.freesrp/fpga.bin";
if(dict["fpga"].length() > 0)
{
bitstream_path = dict["fpga"];
}
FreeSRP::fpga_status stat = _srp->load_fpga(bitstream_path);
fpga_status stat = _srp->load_fpga(bitstream_path);
switch(stat)
{
case FreeSRP::FPGA_CONFIG_ERROR:
throw std::runtime_error("Could not load FPGA configuration!");
case FreeSRP::FPGA_CONFIG_SKIPPED:
std::cout << "FPGA already configured. Restart the FreeSRP to load a new bitstream." << std::endl;
case FPGA_CONFIG_ERROR:
throw runtime_error("Could not load FPGA configuration!");
case FPGA_CONFIG_SKIPPED:
cout << "FPGA already configured. Restart the FreeSRP to load a new bitstream." << endl;
break;
case FreeSRP::FPGA_CONFIG_DONE:
std::cout << "FPGA configured with '" << bitstream_path << "'" << std::endl;
case FPGA_CONFIG_DONE:
cout << "FPGA configured with '" << bitstream_path << "'" << endl;
break;
}
}
std::cout << "Connected to FreeSRP" << std::endl;
cout << "Connected to FreeSRP" << endl;
if(dict.count("loopback"))
{
FreeSRP::response res = _srp->send_cmd({FreeSRP::SET_LOOPBACK_EN, 1});
if(res.error == FreeSRP::CMD_OK)
response res = _srp->send_cmd({SET_LOOPBACK_EN, 1});
if(res.error == CMD_OK)
{
std::cout << "AD9364 in loopback mode" << std::endl;
cout << "AD9364 in loopback mode" << endl;
}
else
{
throw std::runtime_error("Could not put AD9364 into loopback mode!");
throw runtime_error("Could not put AD9364 into loopback mode!");
}
}
else
{
FreeSRP::response res = _srp->send_cmd({FreeSRP::SET_LOOPBACK_EN, 0});
if(res.error != FreeSRP::CMD_OK)
response res = _srp->send_cmd({SET_LOOPBACK_EN, 0});
if(res.error != CMD_OK)
{
throw std::runtime_error("Error disabling AD9364 loopback mode!");
throw runtime_error("Error disabling AD9364 loopback mode!");
}
}
@ -101,28 +103,28 @@ freesrp_common::freesrp_common(const std::string &args)
_ignore_overflow = false;
}
}
catch(const std::runtime_error& e)
catch(const runtime_error& e)
{
std::cerr << "FreeSRP Error: " << e.what() << std::endl;
throw std::runtime_error(e.what());
cerr << "FreeSRP Error: " << e.what() << endl;
throw runtime_error(e.what());
}
}
}
std::vector<std::string> freesrp_common::get_devices()
vector<string> freesrp_common::get_devices()
{
std::vector<std::string> devices;
vector<string> devices;
std::vector<std::string> serial_numbers = ::FreeSRP::FreeSRP::list_connected();
vector<string> serial_numbers = ::FreeSRP::FreeSRP::list_connected();
int index = 0;
for(std::string &serial : serial_numbers)
for(string &serial : serial_numbers)
{
index++;
std::string str;
str = "freesrp=" + serial + ",label='FreeSRP " + std::to_string(index) + "'";
string str;
str = "freesrp=" + serial + ",label='FreeSRP " + to_string(index) + "'";
devices.push_back(str);
}

View File

@ -1,6 +1,9 @@
#include "freesrp_sink_c.h"
freesrp_sink_c_sptr make_freesrp_sink_c (const std::string &args)
using namespace FreeSRP;
using namespace std;
freesrp_sink_c_sptr make_freesrp_sink_c (const string &args)
{
return gnuradio::get_initial_sptr(new freesrp_sink_c (args));
}
@ -19,21 +22,21 @@ static const int MAX_IN = 1; // maximum number of input streams
static const int MIN_OUT = 0; // minimum number of output streams
static const int MAX_OUT = 0; // maximum number of output streams
freesrp_sink_c::freesrp_sink_c (const std::string & args) : gr::sync_block("freesrp_sink_c",
freesrp_sink_c::freesrp_sink_c (const string & args) : gr::sync_block("freesrp_sink_c",
gr::io_signature::make (MIN_IN, MAX_IN, sizeof (gr_complex)),
gr::io_signature::make (MIN_OUT, MAX_OUT, sizeof (gr_complex))),
freesrp_common(args)
{
if(_srp == nullptr)
{
throw std::runtime_error("FreeSRP not initialized!");
throw runtime_error("FreeSRP not initialized!");
}
}
bool freesrp_sink_c::start()
{
FreeSRP::response res = _srp->send_cmd({FreeSRP::SET_DATAPATH_EN, 1});
if(res.error != FreeSRP::CMD_OK)
response res = _srp->send_cmd({SET_DATAPATH_EN, 1});
if(res.error != CMD_OK)
{
return false;
}
@ -43,16 +46,16 @@ bool freesrp_sink_c::start()
bool freesrp_sink_c::stop()
{
_srp->send_cmd({FreeSRP::SET_DATAPATH_EN, 0});
_srp->send_cmd({SET_DATAPATH_EN, 0});
_srp->stop_tx();
return true;
}
void freesrp_sink_c::freesrp_tx_callback(std::vector<FreeSRP::sample>& samples)
void freesrp_sink_c::freesrp_tx_callback(vector<sample>& samples)
{
std::unique_lock<std::mutex> lk(_buf_mut);
unique_lock<std::mutex> lk(_buf_mut);
for(FreeSRP::sample &s : samples)
for(sample &s : samples)
{
if(!_buf_queue.try_dequeue(s))
{
@ -72,7 +75,7 @@ int freesrp_sink_c::work(int noutput_items, gr_vector_const_void_star& input_ite
{
const gr_complex *in = (const gr_complex *) input_items[0];
std::unique_lock<std::mutex> lk(_buf_mut);
unique_lock<std::mutex> lk(_buf_mut);
// Wait until enough space is available
while(_buf_available_space < (unsigned int) noutput_items)
@ -82,13 +85,13 @@ int freesrp_sink_c::work(int noutput_items, gr_vector_const_void_star& input_ite
for(int i = 0; i < noutput_items; ++i)
{
FreeSRP::sample s;
sample s;
s.i = (int16_t) (real(in[i]) * 2047.0f);
s.q = (int16_t) (imag(in[i]) * 2047.0f);
if(!_buf_queue.try_enqueue(s))
{
throw std::runtime_error("Failed to add sample to buffer. This should never happen. Available space reported to be " + std::to_string(_buf_available_space) + " samples, noutput_items=" + std::to_string(noutput_items) + ", i=" + std::to_string(i));
throw runtime_error("Failed to add sample to buffer. This should never happen. Available space reported to be " + to_string(_buf_available_space) + " samples, noutput_items=" + to_string(noutput_items) + ", i=" + to_string(i));
}
else
{
@ -101,11 +104,11 @@ int freesrp_sink_c::work(int noutput_items, gr_vector_const_void_star& input_ite
double freesrp_sink_c::set_sample_rate( double rate )
{
FreeSRP::command cmd = _srp->make_command(FreeSRP::SET_TX_SAMP_FREQ, rate);
FreeSRP::response r = _srp->send_cmd(cmd);
if(r.error != FreeSRP::CMD_OK)
command cmd = _srp->make_command(SET_TX_SAMP_FREQ, rate);
response r = _srp->send_cmd(cmd);
if(r.error != CMD_OK)
{
std::cerr << "Could not set TX sample rate, error: " << r.error << std::endl;
cerr << "Could not set TX sample rate, error: " << r.error << endl;
return 0;
}
else
@ -116,10 +119,10 @@ double freesrp_sink_c::set_sample_rate( double rate )
double freesrp_sink_c::get_sample_rate( void )
{
FreeSRP::response r = _srp->send_cmd({FreeSRP::GET_TX_SAMP_FREQ, 0});
if(r.error != FreeSRP::CMD_OK)
response r = _srp->send_cmd({GET_TX_SAMP_FREQ, 0});
if(r.error != CMD_OK)
{
std::cerr << "Could not get TX sample rate, error: " << r.error << std::endl;
cerr << "Could not get TX sample rate, error: " << r.error << endl;
return 0;
}
else
@ -130,11 +133,11 @@ double freesrp_sink_c::get_sample_rate( void )
double freesrp_sink_c::set_center_freq( double freq, size_t chan )
{
FreeSRP::command cmd = _srp->make_command(FreeSRP::SET_TX_LO_FREQ, freq);
FreeSRP::response r = _srp->send_cmd(cmd);
if(r.error != FreeSRP::CMD_OK)
command cmd = _srp->make_command(SET_TX_LO_FREQ, freq);
response r = _srp->send_cmd(cmd);
if(r.error != CMD_OK)
{
std::cerr << "Could not set TX LO frequency, error: " << r.error << std::endl;
cerr << "Could not set TX LO frequency, error: " << r.error << endl;
return 0;
}
else
@ -145,10 +148,10 @@ double freesrp_sink_c::set_center_freq( double freq, size_t chan )
double freesrp_sink_c::get_center_freq( size_t chan )
{
FreeSRP::response r = _srp->send_cmd({FreeSRP::GET_TX_LO_FREQ, 0});
if(r.error != FreeSRP::CMD_OK)
response r = _srp->send_cmd({GET_TX_LO_FREQ, 0});
if(r.error != CMD_OK)
{
std::cerr << "Could not get TX LO frequency, error: " << r.error << std::endl;
cerr << "Could not get TX LO frequency, error: " << r.error << endl;
return 0;
}
else
@ -157,9 +160,9 @@ double freesrp_sink_c::get_center_freq( size_t chan )
}
}
std::vector<std::string> freesrp_sink_c::get_gain_names( size_t chan )
vector<string> freesrp_sink_c::get_gain_names( size_t chan )
{
std::vector<std::string> names;
vector<string> names;
names.push_back("TX_RF");
@ -175,7 +178,7 @@ osmosdr::gain_range_t freesrp_sink_c::get_gain_range(size_t chan)
return gain_ranges;
}
osmosdr::gain_range_t freesrp_sink_c::get_gain_range(const std::string& name, size_t chan)
osmosdr::gain_range_t freesrp_sink_c::get_gain_range(const string& name, size_t chan)
{
return get_gain_range(chan);
}
@ -186,11 +189,11 @@ double freesrp_sink_c::set_gain(double gain, size_t chan)
double atten = 89.75 - gain;
FreeSRP::command cmd = _srp->make_command(FreeSRP::SET_TX_ATTENUATION, atten * 1000);
FreeSRP::response r = _srp->send_cmd(cmd);
if(r.error != FreeSRP::CMD_OK)
command cmd = _srp->make_command(SET_TX_ATTENUATION, atten * 1000);
response r = _srp->send_cmd(cmd);
if(r.error != CMD_OK)
{
std::cerr << "Could not set TX attenuation, error: " << r.error << std::endl;
cerr << "Could not set TX attenuation, error: " << r.error << endl;
return 0;
}
else
@ -199,17 +202,17 @@ double freesrp_sink_c::set_gain(double gain, size_t chan)
}
}
double freesrp_sink_c::set_gain(double gain, const std::string& name, size_t chan)
double freesrp_sink_c::set_gain(double gain, const string& name, size_t chan)
{
return set_gain(gain, chan);
}
double freesrp_sink_c::get_gain(size_t chan)
{
FreeSRP::response r = _srp->send_cmd({FreeSRP::GET_TX_ATTENUATION, 0});
if(r.error != FreeSRP::CMD_OK)
response r = _srp->send_cmd({GET_TX_ATTENUATION, 0});
if(r.error != CMD_OK)
{
std::cerr << "Could not get TX RF attenuation, error: " << r.error << std::endl;
cerr << "Could not get TX RF attenuation, error: " << r.error << endl;
return 0;
}
else
@ -218,7 +221,7 @@ double freesrp_sink_c::get_gain(size_t chan)
}
}
double freesrp_sink_c::get_gain(const std::string& name, size_t chan)
double freesrp_sink_c::get_gain(const string& name, size_t chan)
{
return get_gain(chan);
}
@ -228,32 +231,32 @@ double freesrp_sink_c::set_bb_gain(double gain, size_t chan)
return set_gain(gain, chan);
}
std::vector<std::string> freesrp_sink_c::get_antennas(size_t chan)
vector<string> freesrp_sink_c::get_antennas(size_t chan)
{
std::vector<std::string> antennas;
vector<string> antennas;
antennas.push_back(get_antenna(chan));
return antennas;
}
std::string freesrp_sink_c::set_antenna(const std::string& antenna, size_t chan)
string freesrp_sink_c::set_antenna(const string& antenna, size_t chan)
{
return get_antenna(chan);
}
std::string freesrp_sink_c::get_antenna(size_t chan)
string freesrp_sink_c::get_antenna(size_t chan)
{
return "TX";
}
double freesrp_sink_c::set_bandwidth(double bandwidth, size_t chan)
{
FreeSRP::command cmd = _srp->make_command(FreeSRP::SET_TX_RF_BANDWIDTH, bandwidth);
FreeSRP::response r = _srp->send_cmd(cmd);
if(r.error != FreeSRP::CMD_OK)
command cmd = _srp->make_command(SET_TX_RF_BANDWIDTH, bandwidth);
response r = _srp->send_cmd(cmd);
if(r.error != CMD_OK)
{
std::cerr << "Could not set TX RF bandwidth, error: " << r.error << std::endl;
cerr << "Could not set TX RF bandwidth, error: " << r.error << endl;
return 0;
}
else
@ -264,10 +267,10 @@ double freesrp_sink_c::set_bandwidth(double bandwidth, size_t chan)
double freesrp_sink_c::get_bandwidth(size_t chan)
{
FreeSRP::response r = _srp->send_cmd({FreeSRP::GET_TX_RF_BANDWIDTH, 0});
if(r.error != FreeSRP::CMD_OK)
response r = _srp->send_cmd({GET_TX_RF_BANDWIDTH, 0});
if(r.error != CMD_OK)
{
std::cerr << "Could not get TX RF bandwidth, error: " << r.error << std::endl;
cerr << "Could not get TX RF bandwidth, error: " << r.error << endl;
return 0;
}
else

View File

@ -39,7 +39,7 @@
class freesrp_sink_c;
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -47,9 +47,9 @@ class freesrp_sink_c;
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<freesrp_sink_c> freesrp_sink_c_sptr;
typedef boost::shared_ptr<freesrp_sink_c> freesrp_sink_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of freesrp_sink_c.

View File

@ -1,6 +1,9 @@
#include "freesrp_source_c.h"
freesrp_source_c_sptr make_freesrp_source_c (const std::string &args)
using namespace FreeSRP;
using namespace std;
freesrp_source_c_sptr make_freesrp_source_c (const string &args)
{
return gnuradio::get_initial_sptr(new freesrp_source_c (args));
}
@ -19,21 +22,21 @@ static const int MAX_IN = 0; // maximum number of input streams
static const int MIN_OUT = 1; // minimum number of output streams
static const int MAX_OUT = 1; // maximum number of output streams
freesrp_source_c::freesrp_source_c (const std::string & args) : gr::sync_block ("freesrp_source_c",
freesrp_source_c::freesrp_source_c (const string & args) : gr::sync_block ("freesrp_source_c",
gr::io_signature::make (MIN_IN, MAX_IN, sizeof (gr_complex)),
gr::io_signature::make (MIN_OUT, MAX_OUT, sizeof (gr_complex))),
freesrp_common(args)
{
if(_srp == nullptr)
{
throw std::runtime_error("FreeSRP not initialized!");
throw runtime_error("FreeSRP not initialized!");
}
}
bool freesrp_source_c::start()
{
FreeSRP::response res = _srp->send_cmd({FreeSRP::SET_DATAPATH_EN, 1});
if(res.error != FreeSRP::CMD_OK)
response res = _srp->send_cmd({SET_DATAPATH_EN, 1});
if(res.error != CMD_OK)
{
return false;
}
@ -46,7 +49,7 @@ bool freesrp_source_c::start()
bool freesrp_source_c::stop()
{
_srp->send_cmd({FreeSRP::SET_DATAPATH_EN, 0});
_srp->send_cmd({SET_DATAPATH_EN, 0});
_srp->stop_rx();
_running = false;
@ -54,17 +57,17 @@ bool freesrp_source_c::stop()
return true;
}
void freesrp_source_c::freesrp_rx_callback(const std::vector<FreeSRP::sample> &samples)
void freesrp_source_c::freesrp_rx_callback(const vector<sample> &samples)
{
std::unique_lock<std::mutex> lk(_buf_mut);
unique_lock<std::mutex> lk(_buf_mut);
for(const FreeSRP::sample &s : samples)
for(const sample &s : samples)
{
if(!_buf_queue.try_enqueue(s))
{
if(!_ignore_overflow)
{
throw std::runtime_error("RX buffer overflow");
throw runtime_error("RX buffer overflow");
}
}
else
@ -80,7 +83,7 @@ int freesrp_source_c::work(int noutput_items, gr_vector_const_void_star& input_i
{
gr_complex *out = static_cast<gr_complex *>(output_items[0]);
std::unique_lock<std::mutex> lk(_buf_mut);
unique_lock<std::mutex> lk(_buf_mut);
if(!_running)
{
@ -95,11 +98,11 @@ int freesrp_source_c::work(int noutput_items, gr_vector_const_void_star& input_i
for(int i = 0; i < noutput_items; ++i)
{
FreeSRP::sample s;
sample s;
if(!_buf_queue.try_dequeue(s))
{
// This should not be happening
throw std::runtime_error("Failed to get sample from buffer. This should never happen. Number of available samples reported to be " + std::to_string(_buf_num_samples) + ", noutput_items=" + std::to_string(noutput_items) + ", i=" + std::to_string(i));
throw runtime_error("Failed to get sample from buffer. This should never happen. Number of available samples reported to be " + to_string(_buf_num_samples) + ", noutput_items=" + to_string(noutput_items) + ", i=" + to_string(i));
}
else
{
@ -114,11 +117,11 @@ int freesrp_source_c::work(int noutput_items, gr_vector_const_void_star& input_i
double freesrp_source_c::set_sample_rate( double rate )
{
FreeSRP::command cmd = _srp->make_command(FreeSRP::SET_RX_SAMP_FREQ, rate);
FreeSRP::response r = _srp->send_cmd(cmd);
if(r.error != FreeSRP::CMD_OK)
command cmd = _srp->make_command(SET_RX_SAMP_FREQ, rate);
response r = _srp->send_cmd(cmd);
if(r.error != CMD_OK)
{
std::cerr << "Could not set RX sample rate, error: " << r.error << std::endl;
cerr << "Could not set RX sample rate, error: " << r.error << endl;
return 0;
}
else
@ -129,10 +132,10 @@ double freesrp_source_c::set_sample_rate( double rate )
double freesrp_source_c::get_sample_rate( void )
{
FreeSRP::response r = _srp->send_cmd({FreeSRP::GET_RX_SAMP_FREQ, 0});
if(r.error != FreeSRP::CMD_OK)
response r = _srp->send_cmd({GET_RX_SAMP_FREQ, 0});
if(r.error != CMD_OK)
{
std::cerr << "Could not get RX sample rate, error: " << r.error << std::endl;
cerr << "Could not get RX sample rate, error: " << r.error << endl;
return 0;
}
else
@ -143,11 +146,11 @@ double freesrp_source_c::get_sample_rate( void )
double freesrp_source_c::set_center_freq( double freq, size_t chan )
{
FreeSRP::command cmd = _srp->make_command(FreeSRP::SET_RX_LO_FREQ, freq);
FreeSRP::response r = _srp->send_cmd(cmd);
if(r.error != FreeSRP::CMD_OK)
command cmd = _srp->make_command(SET_RX_LO_FREQ, freq);
response r = _srp->send_cmd(cmd);
if(r.error != CMD_OK)
{
std::cerr << "Could not set RX LO frequency, error: " << r.error << std::endl;
cerr << "Could not set RX LO frequency, error: " << r.error << endl;
return 0;
}
else
@ -158,10 +161,10 @@ double freesrp_source_c::set_center_freq( double freq, size_t chan )
double freesrp_source_c::get_center_freq( size_t chan )
{
FreeSRP::response r = _srp->send_cmd({FreeSRP::GET_RX_LO_FREQ, 0});
if(r.error != FreeSRP::CMD_OK)
response r = _srp->send_cmd({GET_RX_LO_FREQ, 0});
if(r.error != CMD_OK)
{
std::cerr << "Could not get RX LO frequency, error: " << r.error << std::endl;
cerr << "Could not get RX LO frequency, error: " << r.error << endl;
return 0;
}
else
@ -170,9 +173,9 @@ double freesrp_source_c::get_center_freq( size_t chan )
}
}
std::vector<std::string> freesrp_source_c::get_gain_names( size_t chan )
vector<string> freesrp_source_c::get_gain_names( size_t chan )
{
std::vector<std::string> names;
vector<string> names;
names.push_back("RF");
@ -190,41 +193,41 @@ osmosdr::gain_range_t freesrp_source_c::get_gain_range(size_t chan)
bool freesrp_source_c::set_gain_mode( bool automatic, size_t chan )
{
uint8_t gc_mode = FreeSRP::RF_GAIN_SLOWATTACK_AGC;
uint8_t gc_mode = RF_GAIN_SLOWATTACK_AGC;
if(!automatic)
{
gc_mode = FreeSRP::RF_GAIN_MGC;
gc_mode = RF_GAIN_MGC;
}
FreeSRP::command cmd = _srp->make_command(FreeSRP::SET_RX_GC_MODE, gc_mode);
FreeSRP::response r = _srp->send_cmd(cmd);
if(r.error != FreeSRP::CMD_OK)
command cmd = _srp->make_command(SET_RX_GC_MODE, gc_mode);
response r = _srp->send_cmd(cmd);
if(r.error != CMD_OK)
{
std::cerr << "Could not set RX RF gain control mode, error: " << r.error << std::endl;
cerr << "Could not set RX RF gain control mode, error: " << r.error << endl;
return false;
}
else
{
return r.param != FreeSRP::RF_GAIN_MGC;
return r.param != RF_GAIN_MGC;
}
}
bool freesrp_source_c::get_gain_mode( size_t chan )
{
FreeSRP::response r = _srp->send_cmd({FreeSRP::GET_RX_GC_MODE, 0});
if(r.error != FreeSRP::CMD_OK)
response r = _srp->send_cmd({GET_RX_GC_MODE, 0});
if(r.error != CMD_OK)
{
std::cerr << "Could not get RX RF gain control mode, error: " << r.error << std::endl;
cerr << "Could not get RX RF gain control mode, error: " << r.error << endl;
return false;
}
else
{
return r.param != FreeSRP::RF_GAIN_MGC;
return r.param != RF_GAIN_MGC;
}
}
osmosdr::gain_range_t freesrp_source_c::get_gain_range(const std::string& name, size_t chan)
osmosdr::gain_range_t freesrp_source_c::get_gain_range(const string& name, size_t chan)
{
return get_gain_range(chan);
}
@ -233,11 +236,11 @@ double freesrp_source_c::set_gain(double gain, size_t chan)
{
gain = get_gain_range().clip(gain);
FreeSRP::command cmd = _srp->make_command(FreeSRP::SET_RX_RF_GAIN, gain);
FreeSRP::response r = _srp->send_cmd(cmd);
if(r.error != FreeSRP::CMD_OK)
command cmd = _srp->make_command(SET_RX_RF_GAIN, gain);
response r = _srp->send_cmd(cmd);
if(r.error != CMD_OK)
{
std::cerr << "Could not set RX RF gain, error: " << r.error << std::endl;
cerr << "Could not set RX RF gain, error: " << r.error << endl;
return 0;
}
else
@ -246,7 +249,7 @@ double freesrp_source_c::set_gain(double gain, size_t chan)
}
}
double freesrp_source_c::set_gain(double gain, const std::string& name, size_t chan)
double freesrp_source_c::set_gain(double gain, const string& name, size_t chan)
{
if(name == "RF")
{
@ -260,10 +263,10 @@ double freesrp_source_c::set_gain(double gain, const std::string& name, size_t c
double freesrp_source_c::get_gain(size_t chan)
{
FreeSRP::response r = _srp->send_cmd({FreeSRP::GET_RX_RF_GAIN, 0});
if(r.error != FreeSRP::CMD_OK)
response r = _srp->send_cmd({GET_RX_RF_GAIN, 0});
if(r.error != CMD_OK)
{
std::cerr << "Could not get RX RF gain, error: " << r.error << std::endl;
cerr << "Could not get RX RF gain, error: " << r.error << endl;
return 0;
}
else
@ -272,7 +275,7 @@ double freesrp_source_c::get_gain(size_t chan)
}
}
double freesrp_source_c::get_gain(const std::string& name, size_t chan)
double freesrp_source_c::get_gain(const string& name, size_t chan)
{
if(name == "RF")
{
@ -289,32 +292,32 @@ double freesrp_source_c::set_bb_gain(double gain, size_t chan)
return set_gain(gain, chan);
}
std::vector<std::string> freesrp_source_c::get_antennas(size_t chan)
vector<string> freesrp_source_c::get_antennas(size_t chan)
{
std::vector<std::string> antennas;
vector<string> antennas;
antennas.push_back(get_antenna(chan));
return antennas;
}
std::string freesrp_source_c::set_antenna(const std::string& antenna, size_t chan)
string freesrp_source_c::set_antenna(const string& antenna, size_t chan)
{
return get_antenna(chan);
}
std::string freesrp_source_c::get_antenna(size_t chan)
string freesrp_source_c::get_antenna(size_t chan)
{
return "RX";
}
double freesrp_source_c::set_bandwidth(double bandwidth, size_t chan)
{
FreeSRP::command cmd = _srp->make_command(FreeSRP::SET_RX_RF_BANDWIDTH, bandwidth);
FreeSRP::response r = _srp->send_cmd(cmd);
if(r.error != FreeSRP::CMD_OK)
command cmd = _srp->make_command(SET_RX_RF_BANDWIDTH, bandwidth);
response r = _srp->send_cmd(cmd);
if(r.error != CMD_OK)
{
std::cerr << "Could not set RX RF bandwidth, error: " << r.error << std::endl;
cerr << "Could not set RX RF bandwidth, error: " << r.error << endl;
return 0;
}
else
@ -325,10 +328,10 @@ double freesrp_source_c::set_bandwidth(double bandwidth, size_t chan)
double freesrp_source_c::get_bandwidth(size_t chan)
{
FreeSRP::response r = _srp->send_cmd({FreeSRP::GET_RX_RF_BANDWIDTH, 0});
if(r.error != FreeSRP::CMD_OK)
response r = _srp->send_cmd({GET_RX_RF_BANDWIDTH, 0});
if(r.error != CMD_OK)
{
std::cerr << "Could not get RX RF bandwidth, error: " << r.error << std::endl;
cerr << "Could not get RX RF bandwidth, error: " << r.error << endl;
return 0;
}
else

View File

@ -40,7 +40,7 @@
class freesrp_source_c;
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -48,9 +48,9 @@ class freesrp_source_c;
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<freesrp_source_c> freesrp_source_c_sptr;
typedef boost::shared_ptr<freesrp_source_c> freesrp_source_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of freesrp_source_c.

View File

@ -299,7 +299,7 @@ void convert_avx(const float* inbuf, int8_t* outbuf,const unsigned int count)
#elif USE_SSE2
void convert_sse2(const float* inbuf, int8_t* outbuf,const unsigned int count)
{
const __m128 mulme = _mm_set_ps( 127.0f, 127.0f, 127.0f, 127.0f );
const register __m128 mulme = _mm_set_ps( 127.0f, 127.0f, 127.0f, 127.0f );
__m128 itmp1,itmp2,itmp3,itmp4;
__m128i otmp1,otmp2,otmp3,otmp4;

View File

@ -45,7 +45,7 @@ typedef struct circular_buffer
} circular_buffer_t;
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr::blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -53,9 +53,9 @@ typedef struct circular_buffer
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<hackrf_sink_c> hackrf_sink_c_sptr;
typedef boost::shared_ptr<hackrf_sink_c> hackrf_sink_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of hackrf_sink_c.

View File

@ -34,7 +34,7 @@
class hackrf_source_c;
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr::blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -42,9 +42,9 @@ class hackrf_source_c;
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<hackrf_source_c> hackrf_source_c_sptr;
typedef boost::shared_ptr<hackrf_source_c> hackrf_source_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of hackrf_source_c.

View File

@ -1,36 +0,0 @@
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of gr-osmosdr
#
# gr-osmosdr 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, or (at your option)
# any later version.
#
# gr-osmosdr 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 gr-osmosdr; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
########################################################################
# This file included, use CMake directory variables
########################################################################
target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${LIBMIRISDR_INCLUDE_DIRS}
)
APPEND_LIB_LIST(
${LIBMIRISDR_LIBRARIES}
)
list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/miri_source_c.cc
)
set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE)

View File

@ -1,451 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
* Copyright 2012 Steve Markgraf <steve@steve-m.de>
*
* GNU Radio 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, or (at your option)
* any later version.
*
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
/*
* config.h is generated by configure. It contains the results
* of probing for features, options etc. It should be the first
* file included in your .cc file.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "miri_source_c.h"
#include <gnuradio/io_signature.h>
#include <boost/assign.hpp>
#include <boost/format.hpp>
#include <stdexcept>
#include <iostream>
#include <stdio.h>
#include <mirisdr.h>
#include "arg_helpers.h"
using namespace boost::assign;
#define BUF_SIZE 2304 * 8 * 2
#define BUF_NUM 15
#define BUF_SKIP 1 // buffers to skip due to garbage
#define BYTES_PER_SAMPLE 4 // mirisdr device delivers 16 bit signed IQ data
// containing 12 bits of information
/*
* Create a new instance of miri_source_c and return
* a boost shared_ptr. This is effectively the public constructor.
*/
miri_source_c_sptr
make_miri_source_c (const std::string &args)
{
return gnuradio::get_initial_sptr(new miri_source_c (args));
}
/*
* Specify constraints on number of input and output streams.
* This info is used to construct the input and output signatures
* (2nd & 3rd args to gr::block's constructor). The input and
* output signatures are used by the runtime system to
* check that a valid number and type of inputs and outputs
* are connected to this block. In this case, we accept
* only 0 input and 1 output.
*/
static const int MIN_IN = 0; // mininum number of input streams
static const int MAX_IN = 0; // maximum number of input streams
static const int MIN_OUT = 1; // minimum number of output streams
static const int MAX_OUT = 1; // maximum number of output streams
/*
* The private constructor
*/
miri_source_c::miri_source_c (const std::string &args)
: gr::sync_block ("miri_source_c",
gr::io_signature::make(MIN_IN, MAX_IN, sizeof (gr_complex)),
gr::io_signature::make(MIN_OUT, MAX_OUT, sizeof (gr_complex))),
_running(true),
_auto_gain(false),
_skipped(0)
{
int ret;
unsigned int dev_index = 0;
dict_t dict = params_to_dict(args);
if (dict.count("miri"))
dev_index = boost::lexical_cast< unsigned int >( dict["miri"] );
_buf_num = _buf_head = _buf_used = _buf_offset = 0;
_samp_avail = BUF_SIZE / BYTES_PER_SAMPLE;
if (dict.count("buffers"))
_buf_num = boost::lexical_cast< unsigned int >( dict["buffers"] );
if (0 == _buf_num)
_buf_num = BUF_NUM;
if ( BUF_NUM != _buf_num ) {
std::cerr << "Using " << _buf_num << " buffers of size " << BUF_SIZE << "."
<< std::endl;
}
if ( dev_index >= mirisdr_get_device_count() )
throw std::runtime_error("Wrong mirisdr device index given.");
std::cerr << "Using device #" << dev_index << ": "
<< mirisdr_get_device_name(dev_index)
<< std::endl;
_dev = NULL;
ret = mirisdr_open( &_dev, dev_index );
if (ret < 0)
throw std::runtime_error("Failed to open mirisdr device.");
#if 0
ret = mirisdr_set_sample_rate( _dev, 500000 );
if (ret < 0)
throw std::runtime_error("Failed to set default samplerate.");
ret = mirisdr_set_tuner_gain_mode(_dev, int(!_auto_gain));
if (ret < 0)
throw std::runtime_error("Failed to enable manual gain mode.");
#endif
ret = mirisdr_reset_buffer( _dev );
if (ret < 0)
throw std::runtime_error("Failed to reset usb buffers.");
_buf = (unsigned short **) malloc(_buf_num * sizeof(unsigned short *));
_buf_lens = (unsigned int *) malloc(_buf_num * sizeof(unsigned int));
if (_buf && _buf_lens) {
for(unsigned int i = 0; i < _buf_num; ++i)
_buf[i] = (unsigned short *) malloc(BUF_SIZE);
}
_thread = gr::thread::thread(_mirisdr_wait, this);
}
/*
* Our virtual destructor.
*/
miri_source_c::~miri_source_c ()
{
if (_dev) {
_running = false;
mirisdr_cancel_async( _dev );
_thread.join();
mirisdr_close( _dev );
_dev = NULL;
}
if (_buf) {
for(unsigned int i = 0; i < _buf_num; ++i) {
free(_buf[i]);
}
free(_buf);
_buf = NULL;
free(_buf_lens);
_buf_lens = NULL;
}
}
void miri_source_c::_mirisdr_callback(unsigned char *buf, uint32_t len, void *ctx)
{
miri_source_c *obj = (miri_source_c *)ctx;
obj->mirisdr_callback(buf, len);
}
void miri_source_c::mirisdr_callback(unsigned char *buf, uint32_t len)
{
if (_skipped < BUF_SKIP) {
_skipped++;
return;
}
{
std::lock_guard<std::mutex> lock( _buf_mutex );
if (len > BUF_SIZE)
throw std::runtime_error("Buffer too small.");
int buf_tail = (_buf_head + _buf_used) % _buf_num;
memcpy(_buf[buf_tail], buf, len);
_buf_lens[buf_tail] = len;
if (_buf_used == _buf_num) {
std::cerr << "O" << std::flush;
_buf_head = (_buf_head + 1) % _buf_num;
} else {
_buf_used++;
}
}
_buf_cond.notify_one();
}
void miri_source_c::_mirisdr_wait(miri_source_c *obj)
{
obj->mirisdr_wait();
}
void miri_source_c::mirisdr_wait()
{
int ret = mirisdr_read_async( _dev, _mirisdr_callback, (void *)this, _buf_num, BUF_SIZE );
_running = false;
if ( ret != 0 )
std::cerr << "mirisdr_read_async returned with " << ret << std::endl;
_buf_cond.notify_one();
}
int miri_source_c::work( int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items )
{
gr_complex *out = (gr_complex *)output_items[0];
{
std::unique_lock<std::mutex> lock( _buf_mutex );
while (_buf_used < 3 && _running) // collect at least 3 buffers
_buf_cond.wait( lock );
}
if (!_running)
return WORK_DONE;
short *buf = (short *)_buf[_buf_head] + _buf_offset;
if (noutput_items <= _samp_avail) {
for (int i = 0; i < noutput_items; i++)
*out++ = gr_complex( float(*(buf + i * 2 + 0)) * (1.0f/4096.0f),
float(*(buf + i * 2 + 1)) * (1.0f/4096.0f) );
_buf_offset += noutput_items * 2;
_samp_avail -= noutput_items;
} else {
for (int i = 0; i < _samp_avail; i++)
*out++ = gr_complex( float(*(buf + i * 2 + 0)) * (1.0f/4096.0f),
float(*(buf + i * 2 + 1)) * (1.0f/4096.0f) );
{
std::lock_guard<std::mutex> lock( _buf_mutex );
_buf_head = (_buf_head + 1) % _buf_num;
_buf_used--;
}
buf = (short *)_buf[_buf_head];
int remaining = noutput_items - _samp_avail;
for (int i = 0; i < remaining; i++)
*out++ = gr_complex( float(*(buf + i * 2 + 0)) * (1.0f/4096.0f),
float(*(buf + i * 2 + 1)) * (1.0f/4096.0f) );
_buf_offset = remaining * 2;
_samp_avail = (_buf_lens[_buf_head] / BYTES_PER_SAMPLE) - remaining;
}
return noutput_items;
}
std::vector<std::string> miri_source_c::get_devices()
{
std::vector<std::string> devices;
for (unsigned int i = 0; i < mirisdr_get_device_count(); i++) {
std::string args = "miri=" + boost::lexical_cast< std::string >( i );
args += ",label='" + std::string(mirisdr_get_device_name( i )) + "'";
devices.push_back( args );
}
return devices;
}
size_t miri_source_c::get_num_channels()
{
return 1;
}
osmosdr::meta_range_t miri_source_c::get_sample_rates()
{
osmosdr::meta_range_t range;
range += osmosdr::range_t( 8000000 ); // known to work
return range;
}
double miri_source_c::set_sample_rate(double rate)
{
if (_dev) {
mirisdr_set_sample_rate( _dev, (uint32_t)rate );
}
return get_sample_rate();
}
double miri_source_c::get_sample_rate()
{
if (_dev)
return (double)mirisdr_get_sample_rate( _dev );
return 0;
}
osmosdr::freq_range_t miri_source_c::get_freq_range( size_t chan )
{
osmosdr::freq_range_t range;
range += osmosdr::range_t( 150e3, 30e6 ); /* LW/MW/SW (150 kHz - 30 MHz) */
range += osmosdr::range_t( 64e6, 108e6 ); /* VHF Band II (64 - 108 MHz) */
range += osmosdr::range_t( 162e6, 240e6 ); /* Band III (162 - 240 MHz) */
range += osmosdr::range_t( 470e6, 960e6 ); /* Band IV/V (470 - 960 MHz) */
range += osmosdr::range_t( 1450e6, 1675e6 ); /* L-Band (1450 - 1675 MHz) */
return range;
}
double miri_source_c::set_center_freq( double freq, size_t chan )
{
if (_dev)
mirisdr_set_center_freq( _dev, (uint32_t)freq );
return get_center_freq( chan );
}
double miri_source_c::get_center_freq( size_t chan )
{
if (_dev)
return (double)mirisdr_get_center_freq( _dev );
return 0;
}
double miri_source_c::set_freq_corr( double ppm, size_t chan )
{
return get_freq_corr( chan );
}
double miri_source_c::get_freq_corr( size_t chan )
{
return 0;
}
std::vector<std::string> miri_source_c::get_gain_names( size_t chan )
{
std::vector< std::string > gains;
gains += "LNA";
return gains;
}
osmosdr::gain_range_t miri_source_c::get_gain_range( size_t chan )
{
osmosdr::gain_range_t range;
if (_dev) {
int count = mirisdr_get_tuner_gains(_dev, NULL);
if (count > 0) {
int* gains = new int[ count ];
count = mirisdr_get_tuner_gains(_dev, gains);
for (int i = 0; i < count; i++)
range += osmosdr::range_t( gains[i] / 10.0 );
delete[] gains;
}
}
return range;
}
osmosdr::gain_range_t miri_source_c::get_gain_range( const std::string & name, size_t chan )
{
return get_gain_range( chan );
}
bool miri_source_c::set_gain_mode( bool automatic, size_t chan )
{
if (_dev) {
if (!mirisdr_set_tuner_gain_mode(_dev, int(!automatic))) {
_auto_gain = automatic;
}
}
return get_gain_mode(chan);
}
bool miri_source_c::get_gain_mode( size_t chan )
{
return _auto_gain;
}
double miri_source_c::set_gain( double gain, size_t chan )
{
osmosdr::gain_range_t rf_gains = miri_source_c::get_gain_range( chan );
if (_dev) {
mirisdr_set_tuner_gain( _dev, int(rf_gains.clip(gain) * 10.0) );
}
return get_gain( chan );
}
double miri_source_c::set_gain( double gain, const std::string & name, size_t chan)
{
return set_gain( gain, chan );
}
double miri_source_c::get_gain( size_t chan )
{
if ( _dev )
return ((double)mirisdr_get_tuner_gain( _dev )) / 10.0;
return 0;
}
double miri_source_c::get_gain( const std::string & name, size_t chan )
{
return get_gain( chan );
}
std::vector< std::string > miri_source_c::get_antennas( size_t chan )
{
std::vector< std::string > antennas;
antennas += get_antenna( chan );
return antennas;
}
std::string miri_source_c::set_antenna( const std::string & antenna, size_t chan )
{
return get_antenna( chan );
}
std::string miri_source_c::get_antenna( size_t chan )
{
return "RX";
}

View File

@ -1,124 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
*
* GNU Radio 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, or (at your option)
* any later version.
*
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_MIRI_SOURCE_C_H
#define INCLUDED_MIRI_SOURCE_C_H
#include <gnuradio/sync_block.h>
#include <gnuradio/thread/thread.h>
#include <mutex>
#include <condition_variable>
#include "source_iface.h"
class miri_source_c;
typedef struct mirisdr_dev mirisdr_dev_t;
typedef std::shared_ptr<miri_source_c> miri_source_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of miri_source_c.
*
* To avoid accidental use of raw pointers, miri_source_c's
* constructor is private. make_miri_source_c is the public
* interface for creating new instances.
*/
miri_source_c_sptr make_miri_source_c (const std::string & args = "");
/*!
* \brief Provides a stream of complex samples.
* \ingroup block
*/
class miri_source_c :
public gr::sync_block,
public source_iface
{
private:
// The friend declaration allows make_miri_source_c to
// access the private constructor.
friend miri_source_c_sptr make_miri_source_c (const std::string & args);
/*!
* \brief Provides a stream of complex samples.
*/
miri_source_c (const std::string & args); // private constructor
public:
~miri_source_c (); // public destructor
int work( int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items );
static std::vector< std::string > get_devices();
size_t get_num_channels( void );
osmosdr::meta_range_t get_sample_rates( void );
double set_sample_rate( double rate );
double get_sample_rate( void );
osmosdr::freq_range_t get_freq_range( size_t chan = 0 );
double set_center_freq( double freq, size_t chan = 0 );
double get_center_freq( size_t chan = 0 );
double set_freq_corr( double ppm, size_t chan = 0 );
double get_freq_corr( size_t chan = 0 );
std::vector<std::string> get_gain_names( size_t chan = 0 );
osmosdr::gain_range_t get_gain_range( size_t chan = 0 );
osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 );
bool set_gain_mode( bool automatic, size_t chan = 0 );
bool get_gain_mode( size_t chan = 0 );
double set_gain( double gain, size_t chan = 0 );
double set_gain( double gain, const std::string & name, size_t chan = 0 );
double get_gain( size_t chan = 0 );
double get_gain( const std::string & name, size_t chan = 0 );
std::vector< std::string > get_antennas( size_t chan = 0 );
std::string set_antenna( const std::string & antenna, size_t chan = 0 );
std::string get_antenna( size_t chan = 0 );
private:
static void _mirisdr_callback(unsigned char *buf, uint32_t len, void *ctx);
void mirisdr_callback(unsigned char *buf, uint32_t len);
static void _mirisdr_wait(miri_source_c *obj);
void mirisdr_wait();
mirisdr_dev_t *_dev;
gr::thread::thread _thread;
unsigned short **_buf;
unsigned int *_buf_lens;
unsigned int _buf_num;
unsigned int _buf_head;
unsigned int _buf_used;
std::mutex _buf_mutex;
std::condition_variable _buf_cond;
bool _running;
unsigned int _buf_offset;
int _samp_avail;
bool _auto_gain;
unsigned int _skipped;
};
#endif /* INCLUDED_MIRI_SOURCE_C_H */

View File

@ -29,12 +29,6 @@ APPEND_LIB_LIST(
${Gnuradio-blocks_LIBRARIES}
)
if(WIN32)
APPEND_LIB_LIST(
ws2_32
)
endif()
list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/redpitaya_source_c.cc
${CMAKE_CURRENT_SOURCE_DIR}/redpitaya_sink_c.cc

View File

@ -26,6 +26,7 @@
#if defined(_WIN32)
#include <winsock2.h>
#include <ws2tcpip.h>
#pragma comment(lib, "ws2_32.lib")
#include <windows.h>
#define INVSOC INVALID_SOCKET
#else

View File

@ -29,7 +29,7 @@
class redpitaya_sink_c;
typedef std::shared_ptr< redpitaya_sink_c > redpitaya_sink_c_sptr;
typedef boost::shared_ptr< redpitaya_sink_c > redpitaya_sink_c_sptr;
redpitaya_sink_c_sptr make_redpitaya_sink_c( const std::string & args = "" );

View File

@ -29,7 +29,7 @@
class redpitaya_source_c;
typedef std::shared_ptr< redpitaya_source_c > redpitaya_source_c_sptr;
typedef boost::shared_ptr< redpitaya_source_c > redpitaya_source_c_sptr;
redpitaya_source_c_sptr make_redpitaya_source_c( const std::string & args = "" );

View File

@ -122,9 +122,6 @@ rfspace_source_c::rfspace_source_c (const std::string &args)
if ( dict.count("cloudiq") )
dict["rfspace"] = dict["cloudiq"];
if ( dict.count("cloudsdr") )
dict["rfspace"] = dict["cloudsdr"];
if ( dict.count("rfspace") )
{
std::string value = dict["rfspace"];
@ -149,9 +146,6 @@ rfspace_source_c::rfspace_source_c (const std::string &args)
if ( first.count("cloudiq") )
value = first["cloudiq"];
if ( first.count("cloudsdr") )
value = first["cloudsdr"];
dict["rfspace"] = value;
dict["label"] = first["label"];
}
@ -297,7 +291,7 @@ rfspace_source_c::rfspace_source_c (const std::string &args)
memset(&host_sa, 0, sizeof(host_sa));
host_sa.sin_family = AF_INET;
host_sa.sin_addr.s_addr = htonl(INADDR_ANY);
host_sa.sin_port = htons(port); /* host port must match sdr port */
host_sa.sin_port = htons(DEFAULT_PORT);
if ( bind(_udp, (struct sockaddr *)&host_sa, sizeof(host_sa)) < 0 )
{
@ -342,8 +336,6 @@ rfspace_source_c::rfspace_source_c (const std::string &args)
_radio = RFSPACE_NETSDR;
else if ( 0x434C4951 == product_id ) /* CloudIQ Product ID */
_radio = RFSPACE_CLOUDIQ;
else if ( 0x434C5344 == product_id ) /* CloudSDR Product ID */
_radio = RFSPACE_CLOUDSDR;
else
std::cerr << "UNKNOWN ";
}
@ -382,8 +374,7 @@ rfspace_source_c::rfspace_source_c (const std::string &args)
if ( RFSPACE_NETSDR == _radio ||
RFSPACE_SDR_IP == _radio ||
RFSPACE_CLOUDIQ == _radio ||
RFSPACE_CLOUDSDR == _radio)
RFSPACE_CLOUDIQ == _radio)
{
unsigned char hardver[] = { 0x05, 0x20, 0x04, 0x00, 0x02 };
if ( transaction( hardver, sizeof(hardver), response ) )
@ -391,8 +382,7 @@ rfspace_source_c::rfspace_source_c (const std::string &args)
}
if ( RFSPACE_NETSDR == _radio ||
RFSPACE_CLOUDIQ == _radio ||
RFSPACE_CLOUDSDR == _radio)
RFSPACE_CLOUDIQ == _radio)
{
unsigned char fpgaver[] = { 0x05, 0x20, 0x04, 0x00, 0x03 };
if ( transaction( fpgaver, sizeof(fpgaver), response ) )
@ -441,8 +431,7 @@ rfspace_source_c::rfspace_source_c (const std::string &args)
set_bandwidth( 0 ); /* switch to automatic filter selection by default */
}
else if ( RFSPACE_CLOUDIQ == _radio ||
RFSPACE_CLOUDSDR == _radio)
else if ( RFSPACE_CLOUDIQ == _radio)
{
set_sample_rate( 240000 );
set_bandwidth( 0 );
@ -451,8 +440,7 @@ rfspace_source_c::rfspace_source_c (const std::string &args)
/* start TCP keepalive thread */
if ( RFSPACE_NETSDR == _radio ||
RFSPACE_SDR_IP == _radio ||
RFSPACE_CLOUDIQ == _radio ||
RFSPACE_CLOUDSDR == _radio )
RFSPACE_CLOUDIQ == _radio )
{
_run_tcp_keepalive_task = true;
_thread = gr::thread::thread( boost::bind(&rfspace_source_c::tcp_keepalive_task, this) );
@ -1277,21 +1265,6 @@ osmosdr::meta_range_t rfspace_source_c::get_sample_rates()
range += osmosdr::range_t( 1228800 );
range += osmosdr::range_t( 1807058 );
}
else if ( RFSPACE_CLOUDSDR == _radio )
{
/* CloudSDR supports 122.88 MHz / 4*N for N = 15 ... 2560, but lets limit
* ourselves to the ones available in SpectraVue
*/
range += osmosdr::range_t( 48000 ); // 40 kHz
range += osmosdr::range_t( 61440 ); // 50 kHz
range += osmosdr::range_t( 122880 ); // 100 kHz
range += osmosdr::range_t( 245760 ); // 200 kHz
range += osmosdr::range_t( 370120 ); // 300 kHz
range += osmosdr::range_t( 495483 ); // 400 kHz
range += osmosdr::range_t( 614400 ); // 500 kHz
range += osmosdr::range_t( 1228800 ); // 1 MHz
range += osmosdr::range_t( 2048000 ); // 2 MHz (16 bit)
}
return range;
}
@ -1589,8 +1562,7 @@ std::string rfspace_source_c::get_antenna( size_t chan )
double rfspace_source_c::set_bandwidth( double bandwidth, size_t chan )
{
if ( RFSPACE_SDR_IQ == _radio ||
RFSPACE_CLOUDIQ == _radio ||
RFSPACE_CLOUDSDR == _radio) /* not supported by SDR-IQ, Cloud-IQ, or CloudSDR */
RFSPACE_CLOUDIQ == _radio) /* not supported by SDR-IQ or Cloud-IQ */
return 0.0f;
/* SDR-IP 4.2.5 RF Filter Selection */

View File

@ -38,7 +38,7 @@ class rfspace_source_c;
#endif
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -46,9 +46,9 @@ class rfspace_source_c;
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<rfspace_source_c> rfspace_source_c_sptr;
typedef boost::shared_ptr<rfspace_source_c> rfspace_source_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of rfspace_source_c.
@ -130,8 +130,7 @@ private: /* members */
RFSPACE_SDR_IQ,
RFSPACE_SDR_IP,
RFSPACE_NETSDR,
RFSPACE_CLOUDIQ,
RFSPACE_CLOUDSDR
RFSPACE_CLOUDIQ
};
radio_type _radio;

View File

@ -455,8 +455,6 @@ double rtl_source_c::get_sample_rate()
osmosdr::freq_range_t rtl_source_c::get_freq_range( size_t chan )
{
osmosdr::freq_range_t range;
char manufact[256];
char product[256];
if (_dev) {
if (_no_tuner) {
@ -466,8 +464,6 @@ osmosdr::freq_range_t rtl_source_c::get_freq_range( size_t chan )
return range;
}
rtlsdr_get_usb_strings( _dev, manufact, product, NULL );
enum rtlsdr_tuner tuner = rtlsdr_get_tuner_type(_dev);
if ( tuner == RTLSDR_TUNER_E4000 ) {
@ -482,8 +478,6 @@ osmosdr::freq_range_t rtl_source_c::get_freq_range( size_t chan )
range += osmosdr::range_t( 438e6, 924e6 );
} else if ( tuner == RTLSDR_TUNER_R820T ) {
range += osmosdr::range_t( 24e6, 1766e6 );
} else if ( tuner == RTLSDR_TUNER_R828D && strcmp(manufact, "RTLSDRBlog") == 0 && strcmp(product, "Blog V4") == 0 ) {
range += osmosdr::range_t( 0e6, 1766e6 );
} else if ( tuner == RTLSDR_TUNER_R828D ) {
range += osmosdr::range_t( 24e6, 1766e6 );
}

View File

@ -35,7 +35,7 @@ class rtl_source_c;
typedef struct rtlsdr_dev rtlsdr_dev_t;
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr::blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -43,9 +43,9 @@ typedef struct rtlsdr_dev rtlsdr_dev_t;
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<rtl_source_c> rtl_source_c_sptr;
typedef boost::shared_ptr<rtl_source_c> rtl_source_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of rtl_source_c.

View File

@ -29,12 +29,6 @@ APPEND_LIB_LIST(
${Gnuradio-blocks_LIBRARIES}
)
if(WIN32)
APPEND_LIB_LIST(
ws2_32
)
endif()
list(APPEND gr_osmosdr_srcs
${CMAKE_CURRENT_SOURCE_DIR}/rtl_tcp_source_c.cc
)

View File

@ -32,6 +32,7 @@
#if defined(_WIN32)
// if not posix, assume winsock
#pragma comment(lib, "ws2_32.lib")
#define USING_WINSOCK
#include <winsock2.h>
#include <ws2tcpip.h>
@ -88,9 +89,7 @@ static int is_error( int perr )
{
// Compare error to posix error code; return nonzero if match.
#if defined(USING_WINSOCK)
#ifndef ENOPROTOOPT
#define ENOPROTOOPT 109
#endif
// All codes to be checked for must be defined below
int werr = WSAGetLastError();
switch( werr ) {

View File

@ -26,7 +26,7 @@
class rtl_tcp_source_c;
typedef std::shared_ptr< rtl_tcp_source_c > rtl_tcp_source_c_sptr;
typedef boost::shared_ptr< rtl_tcp_source_c > rtl_tcp_source_c_sptr;
rtl_tcp_source_c_sptr make_rtl_tcp_source_c( const std::string & args = "" );

View File

@ -0,0 +1,327 @@
/* -*- c++ -*- */
/*
* Copyright 2012 Hoernchen <la@tfc-server.de>
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net>
*
* GNU Radio 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, or (at your option)
* any later version.
*
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
//#define HAVE_WINDOWS_H
#include <rtl_tcp_source_f.h>
#include <gnuradio/io_signature.h>
#include <stdexcept>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#ifndef _WIN32
#include <netinet/in.h>
#else
#include <WinSock2.h>
#endif
/* copied from rtl sdr code */
typedef struct { /* structure size must be multiple of 2 bytes */
char magic[4];
uint32_t tuner_type;
uint32_t tuner_gain_count;
} dongle_info_t;
#define USE_SELECT 1 // non-blocking receive on all platforms
#define USE_RCV_TIMEO 0 // non-blocking receive on all but Cygwin
#define SRC_VERBOSE 0
#define SNK_VERBOSE 0
static int is_error( int perr )
{
// Compare error to posix error code; return nonzero if match.
#if defined(USING_WINSOCK)
#define ENOPROTOOPT 109
// All codes to be checked for must be defined below
int werr = WSAGetLastError();
switch( werr ) {
case WSAETIMEDOUT:
return( perr == EAGAIN );
case WSAENOPROTOOPT:
return( perr == ENOPROTOOPT );
default:
fprintf(stderr,"rtl_tcp_source_f: unknown error %d WS err %d \n", perr, werr );
throw std::runtime_error("internal error");
}
return 0;
#else
return( perr == errno );
#endif
}
static void report_error( const char *msg1, const char *msg2 )
{
// Deal with errors, both posix and winsock
#if defined(USING_WINSOCK)
int werr = WSAGetLastError();
fprintf(stderr, "%s: winsock error %d\n", msg1, werr );
#else
perror(msg1);
#endif
if( msg2 != NULL )
throw std::runtime_error(msg2);
return;
}
rtl_tcp_source_f::rtl_tcp_source_f(size_t itemsize,
const char *host,
unsigned short port,
int payload_size,
bool eof,
bool wait)
: gr::sync_block ("rtl_tcp_source_f",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, sizeof(float))),
d_itemsize(itemsize),
d_payload_size(payload_size),
d_eof(eof),
d_wait(wait),
d_socket(-1),
d_temp_offset(0)
{
int ret = 0;
#if defined(USING_WINSOCK) // for Windows (with MinGW)
// initialize winsock DLL
WSADATA wsaData;
int iResult = WSAStartup( MAKEWORD(2,2), &wsaData );
if( iResult != NO_ERROR ) {
report_error( "rtl_tcp_source_f WSAStartup", "can't open socket" );
}
#endif
// Set up the address stucture for the source address and port numbers
// Get the source IP address from the host name
struct addrinfo *ip_src; // store the source IP address to use
struct addrinfo hints;
memset( (void*)&hints, 0, sizeof(hints) );
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = AI_PASSIVE;
char port_str[12];
sprintf( port_str, "%d", port );
// FIXME leaks if report_error throws below
ret = getaddrinfo( host, port_str, &hints, &ip_src );
if( ret != 0 )
report_error("rtl_tcp_source_f/getaddrinfo",
"can't initialize source socket" );
// FIXME leaks if report_error throws below
d_temp_buff = new unsigned char[d_payload_size]; // allow it to hold up to payload_size bytes
d_LUT= new float[0xff+1];
for(int i=0; i <=(0xff);++i){
d_LUT[i] = (((float)(i&0xff))-127.4f)*(1.0f/128.0f);
}
// create socket
d_socket = socket(ip_src->ai_family, ip_src->ai_socktype,
ip_src->ai_protocol);
if(d_socket == -1) {
report_error("socket open","can't open socket");
}
// Turn on reuse address
int opt_val = 1;
if(setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, (optval_t)&opt_val, sizeof(int)) == -1) {
report_error("SO_REUSEADDR","can't set socket option SO_REUSEADDR");
}
// Don't wait when shutting down
linger lngr;
lngr.l_onoff = 1;
lngr.l_linger = 0;
if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (optval_t)&lngr, sizeof(linger)) == -1) {
if( !is_error(ENOPROTOOPT) ) { // no SO_LINGER for SOCK_DGRAM on Windows
report_error("SO_LINGER","can't set socket option SO_LINGER");
}
}
#if USE_RCV_TIMEO
// Set a timeout on the receive function to not block indefinitely
// This value can (and probably should) be changed
// Ignored on Cygwin
#if defined(USING_WINSOCK)
DWORD timeout = 1000; // milliseconds
#else
timeval timeout;
timeout.tv_sec = 1;
timeout.tv_usec = 0;
#endif
if(setsockopt(d_socket, SOL_SOCKET, SO_RCVTIMEO, (optval_t)&timeout, sizeof(timeout)) == -1) {
report_error("SO_RCVTIMEO","can't set socket option SO_RCVTIMEO");
}
#endif // USE_RCV_TIMEO
while(connect(d_socket, ip_src->ai_addr, ip_src->ai_addrlen) != 0);
freeaddrinfo(ip_src);
int flag = 1;
setsockopt(d_socket, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,sizeof(flag));
dongle_info_t dongle_info;
ret = recv(d_socket, (char*)&dongle_info, sizeof(dongle_info), 0);
if (sizeof(dongle_info) != ret)
fprintf(stderr,"failed to read dongle info\n");
d_tuner_type = RTLSDR_TUNER_UNKNOWN;
d_tuner_gain_count = 0;
d_tuner_if_gain_count = 0;
if (memcmp(dongle_info.magic, "RTL0", 4) == 0)
{
d_tuner_type = ntohl(dongle_info.tuner_type);
d_tuner_gain_count = ntohl(dongle_info.tuner_gain_count);
if ( RTLSDR_TUNER_E4000 == d_tuner_type )
d_tuner_if_gain_count = 53;
}
}
rtl_tcp_source_f_sptr make_rtl_tcp_source_f (size_t itemsize,
const char *ipaddr,
unsigned short port,
int payload_size,
bool eof,
bool wait)
{
return gnuradio::get_initial_sptr(new rtl_tcp_source_f (
itemsize,
ipaddr,
port,
payload_size,
eof,
wait));
}
rtl_tcp_source_f::~rtl_tcp_source_f ()
{
delete [] d_temp_buff;
if (d_socket != -1){
shutdown(d_socket, SHUT_RDWR);
#if defined(USING_WINSOCK)
closesocket(d_socket);
#else
::close(d_socket);
#endif
d_socket = -1;
}
#if defined(USING_WINSOCK) // for Windows (with MinGW)
// free winsock resources
WSACleanup();
#endif
}
int rtl_tcp_source_f::work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
float *out = (float *) output_items[0];
ssize_t r = 0;
int bytesleft = noutput_items;
int index = 0;
int receivedbytes = 0;
while(bytesleft > 0) {
receivedbytes = recv(d_socket, (char*)&d_temp_buff[index], bytesleft, 0);
if(receivedbytes == -1 && !is_error(EAGAIN)){
fprintf(stderr, "socket error\n");
return -1;
}
bytesleft -= receivedbytes;
index += receivedbytes;
}
r = noutput_items;
for(int i=0; i<r; ++i)
out[i]=d_LUT[*(d_temp_buff+d_temp_offset+i)];
return r;
}
#ifdef _WIN32
#define __attribute__(x)
#pragma pack(push, 1)
#endif
struct command{
unsigned char cmd;
unsigned int param;
}__attribute__((packed));
#ifdef _WIN32
#pragma pack(pop)
#endif
void rtl_tcp_source_f::set_freq(int freq)
{
struct command cmd = { 0x01, htonl(freq) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}
void rtl_tcp_source_f::set_sample_rate(int sample_rate)
{
struct command cmd = { 0x02, htonl(sample_rate) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}
void rtl_tcp_source_f::set_gain_mode(int manual)
{
struct command cmd = { 0x03, htonl(manual) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}
void rtl_tcp_source_f::set_gain(int gain)
{
struct command cmd = { 0x04, htonl(gain) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}
void rtl_tcp_source_f::set_freq_corr(int ppm)
{
struct command cmd = { 0x05, htonl(ppm) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}
void rtl_tcp_source_f::set_if_gain(int stage, int gain)
{
uint32_t params = stage << 16 | (gain & 0xffff);
struct command cmd = { 0x06, htonl(params) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}
void rtl_tcp_source_f::set_agc_mode(int on)
{
struct command cmd = { 0x08, htonl(on) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}
void rtl_tcp_source_f::set_direct_sampling(int on)
{
struct command cmd = { 0x09, htonl(on) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}
void rtl_tcp_source_f::set_offset_tuning(int on)
{
struct command cmd = { 0x0a, htonl(on) };
send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
}

View File

@ -0,0 +1,125 @@
/* -*- c++ -*- */
/*
* Copyright 2012 Hoernchen <la@tfc-server.de>
*
* GNU Radio 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, or (at your option)
* any later version.
*
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef RTL_TCP_SOURCE_F_H
#define RTL_TCP_SOURCE_F_H
#include <gnuradio/sync_block.h>
#include <gnuradio/thread/thread.h>
#if defined(_WIN32)
// if not posix, assume winsock
#pragma comment(lib, "ws2_32.lib")
#define USING_WINSOCK
#include <winsock2.h>
#include <ws2tcpip.h>
#define SHUT_RDWR 2
typedef char* optval_t;
#else
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
typedef void* optval_t;
#endif
#ifdef _MSC_VER
#include <cstddef>
typedef ptrdiff_t ssize_t;
#endif //_MSC_VER
/* copied from rtl sdr */
enum rtlsdr_tuner {
RTLSDR_TUNER_UNKNOWN = 0,
RTLSDR_TUNER_E4000,
RTLSDR_TUNER_FC0012,
RTLSDR_TUNER_FC0013,
RTLSDR_TUNER_FC2580,
RTLSDR_TUNER_R820T,
RTLSDR_TUNER_R828D
};
class rtl_tcp_source_f;
typedef boost::shared_ptr<rtl_tcp_source_f> rtl_tcp_source_f_sptr;
rtl_tcp_source_f_sptr make_rtl_tcp_source_f (
size_t itemsize,
const char *host,
unsigned short port,
int payload_size,
bool eof = false,
bool wait = false);
class rtl_tcp_source_f : public gr::sync_block
{
private:
size_t d_itemsize;
int d_payload_size; // maximum transmission unit (packet length)
bool d_eof; // zero-length packet is EOF
bool d_wait; // wait if data if not immediately available
int d_socket; // handle to socket
unsigned char *d_temp_buff; // hold buffer between calls
size_t d_temp_offset; // point to temp buffer location offset
float *d_LUT;
unsigned int d_tuner_type;
unsigned int d_tuner_gain_count;
unsigned int d_tuner_if_gain_count;
private:
rtl_tcp_source_f(size_t itemsize, const char *host,
unsigned short port, int payload_size, bool eof, bool wait);
// The friend declaration allows make_source_c to
// access the private constructor.
friend rtl_tcp_source_f_sptr make_rtl_tcp_source_f (
size_t itemsize,
const char *host,
unsigned short port,
int payload_size,
bool eof,
bool wait);
public:
~rtl_tcp_source_f();
enum rtlsdr_tuner get_tuner_type() { return (enum rtlsdr_tuner) d_tuner_type; }
unsigned int get_tuner_gain_count() { return d_tuner_gain_count; }
unsigned int get_tuner_if_gain_count() { return d_tuner_if_gain_count; }
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
void set_freq(int freq);
void set_sample_rate(int sample_rate);
void set_gain_mode(int manual);
void set_gain(int gain);
void set_freq_corr(int ppm);
void set_if_gain(int stage, int gain);
void set_agc_mode(int on);
void set_direct_sampling(int on);
void set_offset_tuning(int on);
};
#endif /* RTL_TCP_SOURCE_F_H */

View File

@ -36,7 +36,7 @@ class sdrplay_source_c;
typedef struct sdrplay_dev sdrplay_dev_t;
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr::blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -44,9 +44,9 @@ typedef struct sdrplay_dev sdrplay_dev_t;
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<sdrplay_source_c> sdrplay_source_c_sptr;
typedef boost::shared_ptr<sdrplay_source_c> sdrplay_source_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of sdrplay_source_c.

View File

@ -32,8 +32,6 @@
class sink_iface
{
public:
virtual ~sink_iface() = default;
/*!
* Get the number of channels the underlying radio hardware offers.
* \return the number of available channels
@ -203,7 +201,6 @@ public:
/*!
* Select the active antenna of the underlying radio hardware.
* \param antenna the antenna name
* \param chan the channel index 0 to N-1
* \return the actual antenna's name
*/

View File

@ -232,26 +232,19 @@ sink_impl::sink_impl( const std::string &args )
}
#endif
if (iface != NULL && reinterpret_cast<std::intptr_t>(block.get()) != 0) {
if ( iface != NULL && long(block.get()) != 0 ) {
_devs.push_back( iface );
for (size_t i = 0; i < iface->get_num_channels(); i++) {
connect(self(), channel++, block, i);
}
} else if ((iface != NULL) || (reinterpret_cast<std::intptr_t>(block.get()) != 0))
} else if ( (iface != NULL) || (long(block.get()) != 0) )
throw std::runtime_error("Either iface or block are NULL.");
}
if (!_devs.size())
throw std::runtime_error("No devices specified via device arguments.");
/* Populate the _gain and _gain_mode arrays with the hardware state */
for ( sink_iface *dev : _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) {
_gain_mode[dev_chan] = dev->get_gain_mode(dev_chan);
_gain[dev_chan] = dev->get_gain(dev_chan);
}
}
size_t sink_impl::get_num_channels()
@ -410,7 +403,7 @@ bool sink_impl::set_gain_mode( bool automatic, size_t chan )
for (sink_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( (_gain_mode.count(chan) == 0) || (_gain_mode[ chan ] != automatic) ) {
if ( _gain_mode[ chan ] != automatic ) {
_gain_mode[ chan ] = automatic;
bool mode = dev->set_gain_mode( automatic, dev_chan );
if (!automatic) // reapply gain value when switched to manual mode

View File

@ -36,7 +36,7 @@ namespace SoapySDR
}
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -44,9 +44,9 @@ namespace SoapySDR
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<soapy_sink_c> soapy_sink_c_sptr;
typedef boost::shared_ptr<soapy_sink_c> soapy_sink_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of soapy_sink_c.

View File

@ -36,7 +36,7 @@ namespace SoapySDR
}
/*
* We use std::shared_ptr's instead of raw pointers for all access
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
@ -44,9 +44,9 @@ namespace SoapySDR
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a std::shared_ptr
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef std::shared_ptr<soapy_source_c> soapy_source_c_sptr;
typedef boost::shared_ptr<soapy_source_c> soapy_source_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of soapy_source_c.

View File

@ -32,8 +32,6 @@
class source_iface
{
public:
virtual ~source_iface() = default;
/*!
* Get the number of channels the underlying radio hardware offers.
* \return the number of available channels
@ -45,7 +43,6 @@ public:
*
* \param seek_point sample offset in file
* \param whence one of SEEK_SET, SEEK_CUR, SEEK_END (man fseek)
* \param chan the channel index 0 to N-1
* \return true on success
*/
virtual bool seek( long seek_point, int whence, size_t chan = 0 ) { return false; }
@ -213,7 +210,6 @@ public:
/*!
* Select the active antenna of the underlying radio hardware.
* \param antenna the antenna name
* \param chan the channel index 0 to N-1
* \return the actual antenna's name
*/

View File

@ -52,10 +52,6 @@
#include <uhd_source_c.h>
#endif
#ifdef ENABLE_MIRI
#include <miri_source_c.h>
#endif
#ifdef ENABLE_SDRPLAY
#include <sdrplay_source_c.h>
#endif
@ -140,9 +136,6 @@ source_impl::source_impl( const std::string &args )
#ifdef ENABLE_UHD
dev_types.push_back("uhd");
#endif
#ifdef ENABLE_MIRI
dev_types.push_back("miri");
#endif
#ifdef ENABLE_SDRPLAY
dev_types.push_back("sdrplay");
#endif
@ -186,7 +179,6 @@ source_impl::source_impl( const std::string &args )
dev_types.push_back("sdr-ip");
dev_types.push_back("netsdr");
dev_types.push_back("cloudiq");
dev_types.push_back("cloudsdr");
#endif
for (std::string arg : arg_list) {
@ -213,10 +205,6 @@ source_impl::source_impl( const std::string &args )
for (std::string dev : uhd_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_MIRI
for (std::string dev : miri_source_c::get_devices())
dev_list.push_back( dev );
#endif
#ifdef ENABLE_SDRPLAY
for (std::string dev : sdrplay_source_c::get_devices())
dev_list.push_back( dev );
@ -314,13 +302,6 @@ source_impl::source_impl( const std::string &args )
}
#endif
#ifdef ENABLE_MIRI
if ( dict.count("miri") ) {
miri_source_c_sptr src = make_miri_source_c( arg );
block = src; iface = src.get();
}
#endif
#ifdef ENABLE_SDRPLAY
if ( dict.count("sdrplay") ) {
sdrplay_source_c_sptr src = make_sdrplay_source_c( arg );
@ -347,8 +328,7 @@ source_impl::source_impl( const std::string &args )
dict.count("sdr-iq") ||
dict.count("sdr-ip") ||
dict.count("netsdr") ||
dict.count("cloudiq") ||
dict.count("cloudsdr") ) {
dict.count("cloudiq") ) {
rfspace_source_c_sptr src = make_rfspace_source_c( arg );
block = src; iface = src.get();
}
@ -396,7 +376,7 @@ source_impl::source_impl( const std::string &args )
}
#endif
if (iface != NULL && reinterpret_cast<std::intptr_t>(block.get()) != 0 ) {
if ( iface != NULL && long(block.get()) != 0 ) {
_devs.push_back( iface );
for (size_t i = 0; i < iface->get_num_channels(); i++) {
@ -416,20 +396,13 @@ source_impl::source_impl( const std::string &args )
connect(block, i, self(), channel++);
#endif
}
} else if ((iface != NULL) || (reinterpret_cast<std::intptr_t>(block.get()) != 0))
} else if ( (iface != NULL) || (long(block.get()) != 0) )
throw std::runtime_error("Either iface or block are NULL.");
}
if (!_devs.size())
throw std::runtime_error("No devices specified via device arguments.");
/* Populate the _gain and _gain_mode arrays with the hardware state */
for ( source_iface *dev : _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) {
_gain_mode[dev_chan] = dev->get_gain_mode(dev_chan);
_gain[dev_chan] = dev->get_gain(dev_chan);
}
}
size_t source_impl::get_num_channels()
@ -617,7 +590,7 @@ bool source_impl::set_gain_mode( bool automatic, size_t chan )
for (source_iface *dev : _devs)
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ ) {
if ( (_gain_mode.count(chan) == 0) || (_gain_mode[ chan ] != automatic) ) {
if ( _gain_mode[ chan ] != automatic ) {
_gain_mode[ chan ] = automatic;
bool mode = dev->set_gain_mode( automatic, dev_chan );
if (!automatic) // reapply gain value when switched to manual mode

View File

@ -27,7 +27,7 @@
class uhd_sink_c;
typedef std::shared_ptr< uhd_sink_c > uhd_sink_c_sptr;
typedef boost::shared_ptr< uhd_sink_c > uhd_sink_c_sptr;
uhd_sink_c_sptr make_uhd_sink_c(const std::string &args = "");

View File

@ -27,7 +27,7 @@
class uhd_source_c;
typedef std::shared_ptr< uhd_source_c > uhd_source_c_sptr;
typedef boost::shared_ptr< uhd_source_c > uhd_source_c_sptr;
uhd_source_c_sptr make_uhd_source_c(const std::string &args = "");

View File

@ -68,8 +68,6 @@ xtrx_obj::xtrx_obj(const std::string &path, unsigned loglevel, bool lmsreset)
unsigned xtrxflag = (loglevel & XTRX_O_LOGLVL_MASK) | ((lmsreset) ? XTRX_O_RESET : 0);
std::cerr << "xtrx_obj::xtrx_obj = " << xtrxflag << std::endl;
xtrx_log_setlevel(loglevel, NULL);
int res = xtrx_open_string(path.c_str(), &_obj);
if (res < 0) {
std::stringstream message;

View File

@ -28,7 +28,7 @@
class xtrx_obj;
typedef std::shared_ptr<xtrx_obj> xtrx_obj_sptr;
typedef boost::shared_ptr<xtrx_obj> xtrx_obj_sptr;
class xtrx_obj
{

View File

@ -36,7 +36,7 @@ static const pmt::pmt_t COMMAND_KEY = pmt::string_to_symbol("tx_command");
class xtrx_sink_c;
typedef std::shared_ptr< xtrx_sink_c > xtrx_sink_c_sptr;
typedef boost::shared_ptr< xtrx_sink_c > xtrx_sink_c_sptr;
xtrx_sink_c_sptr make_xtrx_sink_c( const std::string & args = "" );

View File

@ -32,7 +32,7 @@ static const pmt::pmt_t FREQ_KEY = pmt::string_to_symbol("rx_freq");
class xtrx_source_c;
typedef std::shared_ptr< xtrx_source_c > xtrx_source_c_sptr;
typedef boost::shared_ptr< xtrx_source_c > xtrx_source_c_sptr;
xtrx_source_c_sptr make_xtrx_source_c( const std::string & args = "" );

View File

@ -1,10 +1,21 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-osmosdr
# This file is part of gr-osmosdr
#
# SPDX-License-Identifier: GPL-3.0-or-later
# gr-osmosdr 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, or (at your option)
# any later version.
#
# gr-osmosdr 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 gr-osmosdr; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
########################################################################
# Include python install macros
@ -14,8 +25,6 @@ if(NOT PYTHONINTERP_FOUND)
return()
endif()
add_subdirectory(bindings)
########################################################################
# Install python sources
########################################################################
@ -31,3 +40,4 @@ GR_PYTHON_INSTALL(
include(GrTest)
set(GR_TEST_TARGET_DEPS gnuradio-osmosdr)
set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)

View File

@ -1,24 +1,25 @@
#
# Copyright 2008,2009 Free Software Foundation, Inc.
#
# SPDX-License-Identifier: GPL-3.0-or-later
# This application 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, or (at your option)
# any later version.
#
# This application 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 this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# The presence of this file turns this directory into a Python package
'''
This is the GNU Radio OSMOSDR module. Place your Python package
description here (python/__init__.py).
This is the GNU Radio OsmoSDR module.
'''
import os
# import pybind11 generated symbols into the osmosdr namespace
try:
from .osmosdr_python import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "bindings"))
from .osmosdr_python import *
# import any pure python here
#
from .osmosdr_swig import *

View File

@ -1,33 +0,0 @@
# Copyright 2020 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
GR_PYTHON_CHECK_MODULE_RAW(
"pygccxml"
"import pygccxml"
PYGCCXML_FOUND
)
include(GrPybind)
########################################################################
# Python Bindings
########################################################################
list(APPEND osmosdr_python_files
device_python.cc
sink_python.cc
source_python.cc
ranges_python.cc
time_spec_python.cc
python_bindings.cc)
GR_PYBIND_MAKE_OOT(osmosdr
../..
gr::osmosdr
"${osmosdr_python_files}")
install(TARGETS osmosdr_python DESTINATION ${GR_PYTHON_DIR}/osmosdr COMPONENT pythonapi)

View File

@ -1,53 +0,0 @@
import warnings
import argparse
import os
from gnuradio.bindtool import BindingGenerator
import pathlib
import sys
parser = argparse.ArgumentParser(description='Bind a GR Out of Tree Block')
parser.add_argument('--module', type=str,
help='Name of gr module containing file to bind (e.g. fft digital analog)')
parser.add_argument('--output_dir', default='/tmp',
help='Output directory of generated bindings')
parser.add_argument('--prefix', help='Prefix of Installed GNU Radio')
parser.add_argument('--src', help='Directory of gnuradio source tree',
default=os.path.dirname(os.path.abspath(__file__))+'/../../..')
parser.add_argument(
'--filename', help="File to be parsed")
parser.add_argument(
'--include', help='Additional Include Dirs, separated', default=(), nargs='+')
parser.add_argument(
'--status', help='Location of output file for general status (used during cmake)', default=None
)
parser.add_argument(
'--flag_automatic', default='0'
)
parser.add_argument(
'--flag_pygccxml', default='0'
)
args = parser.parse_args()
prefix = args.prefix
output_dir = args.output_dir
includes = args.include
name = args.module
namespace = [name]
prefix_include_root = name
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
bg = BindingGenerator(prefix, namespace,
prefix_include_root, output_dir, addl_includes=','.join(args.include), catch_exceptions=False, write_json_output=False, status_output=args.status,
flag_automatic=True if args.flag_automatic.lower() in [
'1', 'true'] else False,
flag_pygccxml=True if args.flag_pygccxml.lower() in ['1', 'true'] else False)
bg.gen_file_binding(args.filename)

View File

@ -1,27 +0,0 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
namespace py = pybind11;
#include <osmosdr/device.h>
void bind_device(py::module& m)
{
using device_t = ::osmosdr::device_t;
py::class_<device_t>(m, "device_t")
.def(py::init<std::string&>(), py::arg("args") = "")
.def("to_pp_string", &device_t::to_pp_string)
.def("to_string", &device_t::to_string);
using devices_t = ::osmosdr::devices_t;
py::class_<devices_t>(m, "devices_t");
using device = ::osmosdr::device;
py::class_<device>(m, "device")
.def_static("find", &device::find, py::arg("hint") = device_t());
}

View File

@ -1 +0,0 @@
This directory stores templates for docstrings that are scraped from the include header files for each block

View File

@ -1,153 +0,0 @@
/*
* Copyright 2020 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include "pydoc_macros.h"
#define D(...) DOC(osmosdr, __VA_ARGS__ )
/*
This file contains placeholders for docstrings for the Python bindings.
Do not edit! These were automatically extracted during the binding process
and will be overwritten during the build process
*/
static const char *__doc_osmosdr_sink = R"doc()doc";
static const char *__doc_osmosdr_sink_sink_0 = R"doc()doc";
static const char *__doc_osmosdr_sink_sink_1 = R"doc()doc";
static const char *__doc_osmosdr_sink_make = R"doc()doc";
static const char *__doc_osmosdr_sink_get_num_channels = R"doc()doc";
static const char *__doc_osmosdr_sink_get_sample_rates = R"doc()doc";
static const char *__doc_osmosdr_sink_set_sample_rate = R"doc()doc";
static const char *__doc_osmosdr_sink_get_sample_rate = R"doc()doc";
static const char *__doc_osmosdr_sink_get_freq_range = R"doc()doc";
static const char *__doc_osmosdr_sink_set_center_freq = R"doc()doc";
static const char *__doc_osmosdr_sink_get_center_freq = R"doc()doc";
static const char *__doc_osmosdr_sink_set_freq_corr = R"doc()doc";
static const char *__doc_osmosdr_sink_get_freq_corr = R"doc()doc";
static const char *__doc_osmosdr_sink_get_gain_names = R"doc()doc";
static const char *__doc_osmosdr_sink_get_gain_range_0 = R"doc()doc";
static const char *__doc_osmosdr_sink_get_gain_range_1 = R"doc()doc";
static const char *__doc_osmosdr_sink_set_gain_mode = R"doc()doc";
static const char *__doc_osmosdr_sink_get_gain_mode = R"doc()doc";
static const char *__doc_osmosdr_sink_set_gain_0 = R"doc()doc";
static const char *__doc_osmosdr_sink_set_gain_1 = R"doc()doc";
static const char *__doc_osmosdr_sink_get_gain_0 = R"doc()doc";
static const char *__doc_osmosdr_sink_get_gain_1 = R"doc()doc";
static const char *__doc_osmosdr_sink_set_if_gain = R"doc()doc";
static const char *__doc_osmosdr_sink_set_bb_gain = R"doc()doc";
static const char *__doc_osmosdr_sink_get_antennas = R"doc()doc";
static const char *__doc_osmosdr_sink_set_antenna = R"doc()doc";
static const char *__doc_osmosdr_sink_get_antenna = R"doc()doc";
static const char *__doc_osmosdr_sink_set_dc_offset = R"doc()doc";
static const char *__doc_osmosdr_sink_set_iq_balance = R"doc()doc";
static const char *__doc_osmosdr_sink_set_bandwidth = R"doc()doc";
static const char *__doc_osmosdr_sink_get_bandwidth = R"doc()doc";
static const char *__doc_osmosdr_sink_get_bandwidth_range = R"doc()doc";
static const char *__doc_osmosdr_sink_set_time_source = R"doc()doc";
static const char *__doc_osmosdr_sink_get_time_source = R"doc()doc";
static const char *__doc_osmosdr_sink_get_time_sources = R"doc()doc";
static const char *__doc_osmosdr_sink_set_clock_source = R"doc()doc";
static const char *__doc_osmosdr_sink_get_clock_source = R"doc()doc";
static const char *__doc_osmosdr_sink_get_clock_sources = R"doc()doc";
static const char *__doc_osmosdr_sink_get_clock_rate = R"doc()doc";
static const char *__doc_osmosdr_sink_set_clock_rate = R"doc()doc";
static const char *__doc_osmosdr_sink_get_time_now = R"doc()doc";
static const char *__doc_osmosdr_sink_get_time_last_pps = R"doc()doc";
static const char *__doc_osmosdr_sink_set_time_now = R"doc()doc";
static const char *__doc_osmosdr_sink_set_time_next_pps = R"doc()doc";
static const char *__doc_osmosdr_sink_set_time_unknown_pps = R"doc()doc";

View File

@ -1,162 +0,0 @@
/*
* Copyright 2020 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include "pydoc_macros.h"
#define D(...) DOC(osmosdr, __VA_ARGS__ )
/*
This file contains placeholders for docstrings for the Python bindings.
Do not edit! These were automatically extracted during the binding process
and will be overwritten during the build process
*/
static const char *__doc_osmosdr_source = R"doc()doc";
static const char *__doc_osmosdr_source_source_0 = R"doc()doc";
static const char *__doc_osmosdr_source_source_1 = R"doc()doc";
static const char *__doc_osmosdr_source_make = R"doc()doc";
static const char *__doc_osmosdr_source_get_num_channels = R"doc()doc";
static const char *__doc_osmosdr_source_seek = R"doc()doc";
static const char *__doc_osmosdr_source_get_sample_rates = R"doc()doc";
static const char *__doc_osmosdr_source_set_sample_rate = R"doc()doc";
static const char *__doc_osmosdr_source_get_sample_rate = R"doc()doc";
static const char *__doc_osmosdr_source_get_freq_range = R"doc()doc";
static const char *__doc_osmosdr_source_set_center_freq = R"doc()doc";
static const char *__doc_osmosdr_source_get_center_freq = R"doc()doc";
static const char *__doc_osmosdr_source_set_freq_corr = R"doc()doc";
static const char *__doc_osmosdr_source_get_freq_corr = R"doc()doc";
static const char *__doc_osmosdr_source_get_gain_names = R"doc()doc";
static const char *__doc_osmosdr_source_get_gain_range_0 = R"doc()doc";
static const char *__doc_osmosdr_source_get_gain_range_1 = R"doc()doc";
static const char *__doc_osmosdr_source_set_gain_mode = R"doc()doc";
static const char *__doc_osmosdr_source_get_gain_mode = R"doc()doc";
static const char *__doc_osmosdr_source_set_gain_0 = R"doc()doc";
static const char *__doc_osmosdr_source_set_gain_1 = R"doc()doc";
static const char *__doc_osmosdr_source_get_gain_0 = R"doc()doc";
static const char *__doc_osmosdr_source_get_gain_1 = R"doc()doc";
static const char *__doc_osmosdr_source_set_if_gain = R"doc()doc";
static const char *__doc_osmosdr_source_set_bb_gain = R"doc()doc";
static const char *__doc_osmosdr_source_get_antennas = R"doc()doc";
static const char *__doc_osmosdr_source_set_antenna = R"doc()doc";
static const char *__doc_osmosdr_source_get_antenna = R"doc()doc";
static const char *__doc_osmosdr_source_set_dc_offset_mode = R"doc()doc";
static const char *__doc_osmosdr_source_set_dc_offset = R"doc()doc";
static const char *__doc_osmosdr_source_set_iq_balance_mode = R"doc()doc";
static const char *__doc_osmosdr_source_set_iq_balance = R"doc()doc";
static const char *__doc_osmosdr_source_set_bandwidth = R"doc()doc";
static const char *__doc_osmosdr_source_get_bandwidth = R"doc()doc";
static const char *__doc_osmosdr_source_get_bandwidth_range = R"doc()doc";
static const char *__doc_osmosdr_source_set_time_source = R"doc()doc";
static const char *__doc_osmosdr_source_get_time_source = R"doc()doc";
static const char *__doc_osmosdr_source_get_time_sources = R"doc()doc";
static const char *__doc_osmosdr_source_set_clock_source = R"doc()doc";
static const char *__doc_osmosdr_source_get_clock_source = R"doc()doc";
static const char *__doc_osmosdr_source_get_clock_sources = R"doc()doc";
static const char *__doc_osmosdr_source_get_clock_rate = R"doc()doc";
static const char *__doc_osmosdr_source_set_clock_rate = R"doc()doc";
static const char *__doc_osmosdr_source_get_time_now = R"doc()doc";
static const char *__doc_osmosdr_source_get_time_last_pps = R"doc()doc";
static const char *__doc_osmosdr_source_set_time_now = R"doc()doc";
static const char *__doc_osmosdr_source_set_time_next_pps = R"doc()doc";
static const char *__doc_osmosdr_source_set_time_unknown_pps = R"doc()doc";

View File

@ -1,78 +0,0 @@
# Utilities for reading values in header files
from argparse import ArgumentParser
import re
class PybindHeaderParser:
def __init__(self, pathname):
with open(pathname,'r') as f:
self.file_txt = f.read()
def get_flag_automatic(self):
# p = re.compile(r'BINDTOOL_GEN_AUTOMATIC\(([^\s])\)')
# m = p.search(self.file_txt)
m = re.search(r'BINDTOOL_GEN_AUTOMATIC\(([^\s])\)', self.file_txt)
if (m and m.group(1) == '1'):
return True
else:
return False
def get_flag_pygccxml(self):
# p = re.compile(r'BINDTOOL_USE_PYGCCXML\(([^\s])\)')
# m = p.search(self.file_txt)
m = re.search(r'BINDTOOL_USE_PYGCCXML\(([^\s])\)', self.file_txt)
if (m and m.group(1) == '1'):
return True
else:
return False
def get_header_filename(self):
# p = re.compile(r'BINDTOOL_HEADER_FILE\(([^\s]*)\)')
# m = p.search(self.file_txt)
m = re.search(r'BINDTOOL_HEADER_FILE\(([^\s]*)\)', self.file_txt)
if (m):
return m.group(1)
else:
return None
def get_header_file_hash(self):
# p = re.compile(r'BINDTOOL_HEADER_FILE_HASH\(([^\s]*)\)')
# m = p.search(self.file_txt)
m = re.search(r'BINDTOOL_HEADER_FILE_HASH\(([^\s]*)\)', self.file_txt)
if (m):
return m.group(1)
else:
return None
def get_flags(self):
return f'{self.get_flag_automatic()};{self.get_flag_pygccxml()};{self.get_header_filename()};{self.get_header_file_hash()};'
def argParse():
"""Parses commandline args."""
desc='Reads the parameters from the comment block in the pybind files'
parser = ArgumentParser(description=desc)
parser.add_argument("function", help="Operation to perform on comment block of pybind file", choices=["flag_auto","flag_pygccxml","header_filename","header_file_hash","all"])
parser.add_argument("pathname", help="Pathname of pybind c++ file to read, e.g. blockname_python.cc")
return parser.parse_args()
if __name__ == "__main__":
# Parse command line options and set up doxyxml.
args = argParse()
pbhp = PybindHeaderParser(args.pathname)
if args.function == "flag_auto":
print(pbhp.get_flag_automatic())
elif args.function == "flag_pygccxml":
print(pbhp.get_flag_pygccxml())
elif args.function == "header_filename":
print(pbhp.get_header_filename())
elif args.function == "header_file_hash":
print(pbhp.get_header_file_hash())
elif args.function == "all":
print(pbhp.get_flags())

View File

@ -1,65 +0,0 @@
/*
* Copyright 2020 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include <pybind11/pybind11.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>
namespace py = pybind11;
// Headers for binding functions
/**************************************/
// The following comment block is used for
// gr_modtool to insert function prototypes
// Please do not delete
/**************************************/
// BINDING_FUNCTION_PROTOTYPES(
void bind_sink(py::module& m);
void bind_source(py::module& m);
// ) END BINDING_FUNCTION_PROTOTYPES
void bind_device(py::module& m);
void bind_ranges(py::module& m);
void bind_time_spec(py::module& m);
// We need this hack because import_array() returns NULL
// for newer Python versions.
// This function is also necessary because it ensures access to the C API
// and removes a warning.
void* init_numpy()
{
import_array();
return NULL;
}
PYBIND11_MODULE(osmosdr_python, m)
{
// Initialize the numpy C API
// (otherwise we will see segmentation faults)
init_numpy();
// Allow access to base block methods
py::module::import("gnuradio.gr");
/**************************************/
// The following comment block is used for
// gr_modtool to insert binding function calls
// Please do not delete
/**************************************/
// BINDING_FUNCTION_CALLS(
bind_sink(m);
bind_source(m);
// ) END BINDING_FUNCTION_CALLS
bind_device(m);
bind_ranges(m);
bind_time_spec(m);
}

Some files were not shown because too many files have changed in this diff Show More